libunwind-devel
[Top][All Lists]
Advanced

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

[libunwind] misc. DWARF2-fixes


From: David Mosberger
Subject: [libunwind] misc. DWARF2-fixes
Date: Thu, 21 Oct 2004 08:19:20 -0700

Max,

I was a on a long train-ride yesterday, which gave me the opportunity
to work on some of the "make check" failures on x86.  I fixed a bunch
of things in the DWARF2 unwinder (as well as some of the test-programs
themselves).  Those fixes I was comfortable with are in the bk
repository already but there are a few things where I'm not really
sure yet that I fixed them right.  I attached a patch for some of
those changes below.

My biggest issue/complaint at the moment is that the x86 vsyscall
unwind info for sigtramp() provides no way to detect that we're
dealing with a signal-trampoline.  That means unw_resume() can't know
that it should restore the signal mask when crossing a signal frame.
Also, it means that unw_is_signal_frame() has to resort to
code-reading which is definitely slow and potentially fragile.

I'm not sure whether you're still working on libunwind for x86-64 but
if you are you make want to look at the bk repository and the patches
below to verify they're ok.

        --david

===== include/tdep-x86.h 1.10 vs edited =====
--- 1.10/include/tdep-x86.h     2004-09-09 15:06:00 +02:00
+++ edited/include/tdep-x86.h   2004-10-21 11:06:53 +02:00
@@ -70,6 +70,7 @@
 # define DWARF_NULL_LOC                DWARF_LOC (0, 0)
 # define DWARF_IS_NULL_LOC(l)  (DWARF_GET_LOC (l) == 0)
 # define DWARF_LOC(r, t)       ((dwarf_loc_t) { .val = (r) })
+# define DWARF_IS_REG_LOC(l)   0
 # define DWARF_REG_LOC(c,r)    (DWARF_LOC((unw_word_t)                      \
                                 tdep_uc_addr((c)->as_arg, (r)), 0))
 # define DWARF_MEM_LOC(c,m)    DWARF_LOC ((m), 0)
===== src/x86/Gregs.c 1.6 vs edited =====
--- 1.6/src/x86/Gregs.c 2004-08-20 13:23:10 +02:00
+++ edited/src/x86/Gregs.c      2004-10-21 11:06:53 +02:00
@@ -157,15 +157,11 @@
     case UNW_X86_EDX: loc = c->dwarf.loc[EDX]; break;
     case UNW_X86_EBX: loc = c->dwarf.loc[EBX]; break;
     case UNW_X86_ESP:
-      if (c->dwarf.cfa_is_sp)
-       {
-         if (write)
-           return -UNW_EREADONLYREG;
-         *valp = c->dwarf.cfa;
-         return 0;
-       }
-      loc = c->dwarf.loc[ESP];
-      break;
+      if (write)
+       return -UNW_EREADONLYREG;
+      *valp = c->dwarf.cfa;
+      return 0;
+
     case UNW_X86_EBP: loc = c->dwarf.loc[EBP]; break;
     case UNW_X86_ESI: loc = c->dwarf.loc[ESI]; break;
     case UNW_X86_EDI: loc = c->dwarf.loc[EDI]; break;
===== src/x86/Gstep.c 1.10 vs edited =====
--- 1.10/src/x86/Gstep.c        2004-08-26 12:02:45 +02:00
+++ edited/src/x86/Gstep.c      2004-10-21 11:06:54 +02:00
@@ -37,7 +37,7 @@
   /* Try DWARF-based unwinding... */
   ret = dwarf_step (&c->dwarf);
 
-  if (unlikely (ret == -UNW_ESTOPUNWIND))
+  if (ret < 0 && ret != -UNW_ENOINFO)
     return ret;
 
   if (unlikely (ret < 0))
===== src/x86_64/Gstep.c 1.3 vs edited =====
--- 1.3/src/x86_64/Gstep.c      2004-08-20 13:23:10 +02:00
+++ edited/src/x86_64/Gstep.c   2004-10-21 11:06:54 +02:00
@@ -38,7 +38,7 @@
   /* Try DWARF-based unwinding... */
   ret = dwarf_step (&c->dwarf);
 
-  if (unlikely (ret == -UNW_ESTOPUNWIND))
+  if (ret < 0 && ret != -UNW_ENOINFO)
     return ret;
 
   if (likely (ret >= 0))


reply via email to

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