libunwind-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [libunwind] [PATCH][2/4] Dwarf unwinder may corrupt IP. Save andrest


From: Yeshurun, Meir
Subject: RE: [libunwind] [PATCH][2/4] Dwarf unwinder may corrupt IP. Save andrestore between calls to dwarf_step.
Date: Thu, 16 Feb 2006 09:34:23 +0200

Thanks Arun.

-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of Arun Sharma
Sent: Thursday, February 16, 2006 1:41 AM
To: address@hidden
Subject: [libunwind] [PATCH][2/4] Dwarf unwinder may corrupt IP. Save
andrestore between calls to dwarf_step.

Dwarf unwinder may corrupt IP. Save and restore between calls to
dwarf_step.

--- libunwind-0.98.5/src/x86_64/Gstep.c-        2005-11-18
15:45:00.000000000 -0800
+++ libunwind-0.98.5/src/x86_64/Gstep.c 2005-11-18 15:55:15.000000000
-0800
@@ -34,6 +34,7 @@
 {
   struct cursor *c = (struct cursor *) cursor;
   int ret, i;
+  unw_word_t oldip = c->dwarf.ip;

   /* Try DWARF-based unwinding... */
   ret = dwarf_step (&c->dwarf);
@@ -55,7 +56,8 @@
       struct dwarf_loc rbp_loc, rsp_loc, rip_loc;

       Debug (13, "dwarf_step() failed (ret=%d), trying frame-chain\n",
ret);
-
+      /* DWARF may have corrupted oldip. Reset it */
+      c->dwarf.ip = oldip;
       if (unw_is_signal_frame (cursor))
        {
          unw_word_t ucontext = c->dwarf.cfa;

diff -r d3d8dec76ff0 -r 294c797d261e src/x86_64/Gstep.c
--- a/src/x86_64/Gstep.c        Fri Feb  3 18:50:51 2006
+++ b/src/x86_64/Gstep.c        Fri Feb  3 20:57:59 2006
@@ -34,6 +34,7 @@
 {
   struct cursor *c = (struct cursor *) cursor;
   int ret, i;
+  unw_word_t oldip = c->dwarf.ip;
 
   Debug (1, "(cursor=%p, ip=0x%016llx)\n",
         c, (unsigned long long) c->dwarf.ip);
@@ -72,7 +73,8 @@
       struct dwarf_loc rbp_loc, rsp_loc, rip_loc;
 
       Debug (13, "dwarf_step() failed (ret=%d), trying frame-chain\n",
ret);
-
+      /* DWARF may have corrupted oldip. Reset it */
+      c->dwarf.ip = oldip;
       if (unw_is_signal_frame (cursor))
        {
          unw_word_t ucontext = c->dwarf.cfa;
_______________________________________________
libunwind mailing list
address@hidden
http://www.hpl.hp.com/hosted/linux/mail-archives/libunwind/


reply via email to

[Prev in Thread] Current Thread [Next in Thread]