summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland McGrath <[email protected]>2005-08-26 05:55:04 +0000
committerRoland McGrath <[email protected]>2005-08-26 05:55:04 +0000
commit995f92d7d696930e2cbf08427d028d948e8c5180 (patch)
treed4a8edd4e7620ef3aa50f91f790b5b7db81b70a0
parentefb5caae4f88c3a192872d66473412277e029930 (diff)
libdwfl/
2005-08-25 Roland McGrath <[email protected]> * cu.c (__libdwfl_nextcu): Return success when dwarf_nextcu hits end. * dwfl_nextcu.c (dwfl_nextcu): Skip modules with no dwarf info.
-rw-r--r--libdwfl/ChangeLog5
-rw-r--r--libdwfl/cu.c10
-rw-r--r--libdwfl/dwfl_nextcu.c25
3 files changed, 33 insertions, 7 deletions
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 422bbfec..f9210424 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,8 @@
+2005-08-25 Roland McGrath <[email protected]>
+
+ * 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 <[email protected]>
* dwfl_lineinfo.c (dwfl_lineinfo): Add bias, don't subtract it.
diff --git a/libdwfl/cu.c b/libdwfl/cu.c
index cf7e3887..22865df7 100644
--- a/libdwfl/cu.c
+++ b/libdwfl/cu.c
@@ -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)
diff --git a/libdwfl/dwfl_nextcu.c b/libdwfl/dwfl_nextcu.c
index a5565c69..7224bb35 100644
--- a/libdwfl/dwfl_nextcu.c
+++ b/libdwfl/dwfl_nextcu.c
@@ -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;