[commit] [tests patchv2] FYI unwinder: tests/ update
Jan Kratochvil
jan.kratochvil at redhat.com
Thu Dec 5 15:19:02 UTC 2013
Hi Mark,
jankratochvil/testsO2
On Thu, 05 Dec 2013 11:26:13 +0100, Mark Wielaard wrote:
> The backtrace generated is:
>
> TID 31941:
> #0 0x00007fd3a47975db raise
sigusr2 is missing here
> #1 0x00007fd3a4bc7dec stdarg
> #2 0x00007fd3a4bc7e70 backtracegen
> #3 0x00007fd3a4bc7e79 start
> #4 0x00007fd3a478f9d1 start_thread
> #5 0x00007fd3a44dcb6d __clone
it is because of -O2 in build CFLAGS and tail call optimization:
Dump of assembler code for function sigusr2:
[...]
0x00007f1fc53bdd43 <+19>: mov $0x6,%edi
0x00007f1fc53bdd48 <+24>: add $0x8,%rsp
0x00007f1fc53bdd4c <+28>: jmpq 0x7f1fc53bd960 <raise at plt>
OK for check-in?
Thanks,
Jan
-------------- next part --------------
>From f88863fbb3a7380ad8c7ebcdf6dceb023f3ccf75 Mon Sep 17 00:00:00 2001
From: Jan Kratochvil <jan.kratochvil at redhat.com>
Date: Thu, 5 Dec 2013 16:16:14 +0100
Subject: [PATCH] Fix test FAIL with -O2
Signed-off-by: Jan Kratochvil <jan.kratochvil at redhat.com>
---
tests/ChangeLog | 5 +++++
tests/backtrace-child.c | 4 +++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 8992568..9e4cd9a 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,8 @@
+2013-12-05 Jan Kratochvil <jan.kratochvil at redhat.com>
+
+ Fix test FAIL with -O2.
+ * backtrace-child.c (sigusr2): Add NOINLINE_NOCLONE and final asm stub.
+
2013-12-05 Mark Wielaard <mjw at redhat.com>
* backtrace-data.c (main): If unsupported also print to stderr.
diff --git a/tests/backtrace-child.c b/tests/backtrace-child.c
index 2bc0ede..0db1258 100644
--- a/tests/backtrace-child.c
+++ b/tests/backtrace-child.c
@@ -93,7 +93,7 @@ static int ptraceme, gencore;
/* Execution will arrive here from jmp by an artificial ptrace-spawn signal. */
-static void
+static NOINLINE_NOCLONE void
sigusr2 (int signo)
{
assert (signo == SIGUSR2);
@@ -105,6 +105,8 @@ sigusr2 (int signo)
}
/* Here we dump the core for --gencore. */
raise (SIGABRT);
+ /* Avoid tail call optimization for the raise call. */
+ asm volatile ("");
}
static NOINLINE_NOCLONE void
--
1.8.3.1
More information about the elfutils-devel
mailing list