From: Roland McGrath Date: Fri, 26 Aug 2005 05:55:04 +0000 (+0000) Subject: libdwfl/ X-Git-Tag: elfutils-0.120~84 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=995f92d7d696930e2cbf08427d028d948e8c5180;p=thirdparty%2Felfutils.git libdwfl/ 2005-08-25 Roland McGrath * cu.c (__libdwfl_nextcu): Return success when dwarf_nextcu hits end. * dwfl_nextcu.c (dwfl_nextcu): Skip modules with no dwarf info. --- diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 422bbfec4..f92104246 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,8 @@ +2005-08-25 Roland McGrath + + * 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 * dwfl_lineinfo.c (dwfl_lineinfo): Add bias, don't subtract it. diff --git a/libdwfl/cu.c b/libdwfl/cu.c index cf7e3887f..22865df76 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 a5565c693..7224bb35f 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;