This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
[patch] Fix DW_CFA_expression & co. CFA initial push
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Mon, 08 Oct 2012 19:31:06 +0200
- Subject: [patch] Fix DW_CFA_expression & co. CFA initial push
Hi,
DW_CFA_expression / DW_CFA_val_expression expect CFA to be pushed first on the
DWARF stack. This is what CFAP parameter of __libdw_intern_expression says.
But it did not work.
Testcase for this patch is the whole testsuite of:
[API RFC] unwinder
https://lists.fedorahosted.org/pipermail/elfutils-devel/2012-October/002618.html
$ ./backtrace
[...]
# 1 0x7fc399f48a75 - 1 sigusr2
# 2 0x7fc399786300 - 1 (null)
unknown error
->
[...]
# 1 0x7fb29b7fda75 - 1 sigusr2
# 2 0x7fb29b03b300 __restore_rt
# 3 0x7fb29b7fda7b jmp
[...]
Thanks,
Jan
libdw/
2012-10-08 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf_getlocation.c (__libdw_intern_expression) <cfap>: Fix the
produced bytecode.
diff --git a/libdw/dwarf_getlocation.c b/libdw/dwarf_getlocation.c
index dfaa742..6ab7023 100644
--- a/libdw/dwarf_getlocation.c
+++ b/libdw/dwarf_getlocation.c
@@ -459,7 +459,6 @@ __libdw_intern_expression (Dwarf *dbg, bool other_byte_order,
if (cfap)
{
/* Synthesize the operation to push the CFA before the expression. */
- --n;
result[0].atom = DW_OP_call_frame_cfa;
result[0].number = 0;
result[0].number2 = 0;
@@ -480,7 +479,7 @@ __libdw_intern_expression (Dwarf *dbg, bool other_byte_order,
loclist = loclist->next;
}
- while (n > 0);
+ while (n > (cfap ? 1U : 0U));
/* Insert a record in the search tree so that we can find it again later. */
struct loc_s *newp;