]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
libdwfl/
authorRoland McGrath <roland@redhat.com>
Fri, 26 Aug 2005 05:55:04 +0000 (05:55 +0000)
committerRoland McGrath <roland@redhat.com>
Fri, 26 Aug 2005 05:55:04 +0000 (05:55 +0000)
2005-08-25  Roland McGrath  <roland@redhat.com>

* cu.c (__libdwfl_nextcu): Return success when dwarf_nextcu hits end.
* dwfl_nextcu.c (dwfl_nextcu): Skip modules with no dwarf info.

libdwfl/ChangeLog
libdwfl/cu.c
libdwfl/dwfl_nextcu.c

index 422bbfec43ba7055d582027b9789408d1d751e6a..f921042463c993981707010402c53972ed60388d 100644 (file)
@@ -1,3 +1,8 @@
+2005-08-25  Roland McGrath  <roland@redhat.com>
+
+       * cu.c (__libdwfl_nextcu): Return success when dwarf_nextcu hits end.
+       * dwfl_nextcu.c (dwfl_nextcu): Skip modules with no dwarf info.
+
 2005-08-24  Roland McGrath  <roland@redhat.com>
 
        * dwfl_lineinfo.c (dwfl_lineinfo): Add bias, don't subtract it.
index cf7e3887f2bb600e12d06d0e6ee3e92ee1cc8228..22865df7612d78b6673b45bbf1bb4af0e4d4061e 100644 (file)
@@ -230,9 +230,15 @@ __libdwfl_nextcu (Dwfl_Module *mod, struct dwfl_cu *lastcu,
     {
       size_t cuhdrsz;
       Dwarf_Off nextoff;
-      if (INTUSE(dwarf_nextcu) (mod->dw, cuoff, &nextoff, &cuhdrsz,
-                               NULL, NULL, NULL) != 0)
+      int end = INTUSE(dwarf_nextcu) (mod->dw, cuoff, &nextoff, &cuhdrsz,
+                                       NULL, NULL, NULL);
+      if (end < 0)
        return DWFL_E_LIBDW;
+      if (end > 0)
+       {
+         *cu = NULL;
+         return DWFL_E_NOERROR;
+       }
 
       Dwfl_Error result = intern_cu (mod, cuoff + cuhdrsz, nextp);
       if (result != DWFL_E_NOERROR)
index a5565c693857115eae9d9fe7bc114c33cee7d8ca..7224bb35fa6011324832b5e1694285b2a6d2a9dc 100644 (file)
@@ -31,20 +31,35 @@ dwfl_nextcu (Dwfl *dwfl, Dwarf_Die *lastcu, Dwarf_Addr *bias)
     mod = cu->mod;
 
   Dwfl_Error error;
-  while ((error = __libdwfl_nextcu (mod, cu, &cu)) == DWFL_E_NOERROR)
+  do
     {
+      error = __libdwfl_nextcu (mod, cu, &cu);
+      if (error != DWFL_E_NOERROR)
+       break;
+
       if (cu != NULL)
        {
          *bias = mod->debug.bias;
          return &cu->die;
        }
 
-      mod = mod->next;
+      do
+       {
+         mod = mod->next;
+
+       nextmod:
+         if (mod == NULL)
+           return NULL;
 
-    nextmod:
-      if (mod == NULL || INTUSE(dwfl_module_getdwarf) (mod, bias) == NULL)
-       return NULL;
+         error = mod->dwerr;
+         if (error == DWFL_E_NOERROR
+             && (mod->dw != NULL
+                 || INTUSE(dwfl_module_getdwarf) (mod, bias) != NULL))
+           break;
+       }
+      while (error == DWFL_E_NO_DWARF);
     }
+  while (error == DWFL_E_NOERROR);
 
   __libdwfl_seterrno (error);
   return NULL;