This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]