+2010-05-04 Roland McGrath <roland@redhat.com>
+
+ * core-file.c (dwfl_core_file_report): Return any nonzero count of
+ modules reported, even if link_map grovelling failed and only sniffing
+ found anything.
+
2010-04-26 Roland McGrath <roland@redhat.com>
* relocate.c (relocate_section): Treat R_*_NONE reloc as no reloc.
return ndx;
/* Now sniff segment contents for modules. */
+ int sniffed = 0;
ndx = 0;
do
{
core_file_read_eagerly, elf);
if (unlikely (seg < 0))
return seg;
- ndx = seg > ndx ? seg : ndx + 1;
+ if (seg > ndx)
+ {
+ ndx = seg;
+ ++sniffed;
+ }
+ else
+ ++ndx;
}
while (ndx < (int) phnum);
/* Now we have NT_AUXV contents. From here on this processing could be
used for a live process with auxv read from /proc. */
- return dwfl_link_map_report (dwfl, auxv, auxv_size,
- dwfl_elf_phdr_memory_callback, elf);
+ int listed = dwfl_link_map_report (dwfl, auxv, auxv_size,
+ dwfl_elf_phdr_memory_callback, elf);
+
+ /* We return the number of modules we found if we found any.
+ If we found none, we return -1 instead of 0 if there was an
+ error rather than just nothing found. If link_map handling
+ failed, we still have the sniffed modules. */
+ return sniffed == 0 || listed > sniffed ? listed : sniffed;
}
INTDEF (dwfl_core_file_report)