libunwind-devel
[Top][All Lists]
Advanced

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

[libunwind] [PATCH][2/4] Dwarf unwinder may corrupt IP. Save and restore


From: Arun Sharma
Subject: [libunwind] [PATCH][2/4] Dwarf unwinder may corrupt IP. Save and restore between calls to dwarf_step.
Date: Wed, 15 Feb 2006 15:41:02 -0800
User-agent: Mutt/1.5.6+20040907i

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;

reply via email to

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