From a845f68bf43f90e0670ed6b33154f2aff98ad46b Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Wed, 3 Dec 2008 03:41:58 +0000 Subject: src/ 2008-12-02 Roland McGrath * readelf.c (count_dwflmod, process_file): Don't presume encoding of nonzero OFFSET argument to dwfl_getmodules. --- src/ChangeLog | 5 +++++ src/readelf.c | 13 +++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 4ef23a22..fb17835f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2008-12-02 Roland McGrath + + * readelf.c (count_dwflmod, process_file): Don't presume encoding of + nonzero OFFSET argument to dwfl_getmodules. + 2008-08-07 Roland McGrath * addr2line.c (main): Pass string to handle_address. diff --git a/src/readelf.c b/src/readelf.c index 7b599ec8..2797a849 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -459,8 +459,10 @@ count_dwflmod (Dwfl_Module *dwflmod __attribute__ ((unused)), Dwarf_Addr base __attribute__ ((unused)), void *arg) { - *(bool *) arg = false; - return DWARF_CB_ABORT; + if (*(bool *) arg) + return DWARF_CB_ABORT; + *(bool *) arg = true; + return DWARF_CB_OK; } struct process_dwflmod_args @@ -548,8 +550,11 @@ process_file (int fd, const char *fname, bool only_one) dwfl_report_end (dwfl, NULL, NULL); if (only_one) - /* Clear ONLY_ONE if we have multiple modules, from an archive. */ - dwfl_getmodules (dwfl, &count_dwflmod, &only_one, 1); + { + /* Clear ONLY_ONE if we have multiple modules, from an archive. */ + bool seen = false; + only_one = dwfl_getmodules (dwfl, &count_dwflmod, &seen, 0) == 0; + } /* Process the one or more modules gleaned from this file. */ struct process_dwflmod_args a = { .fd = fd, .only_one = only_one }; -- cgit v1.2.1