addr2line: skip CUs lacking debug info instead of bailing out

Some binaries (such as the FreeBSD kernel) contain a mixture of CUs
with and without debug information. Previously translate() exited upon
encountering a CU without debug information. Instead, just move on to
the next CU.

Reported by:	royger
Reviewed by:	royger
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D3712
This commit is contained in:
emaste 2015-09-22 16:51:40 +00:00
parent e6d5be3edc
commit 10b8b85018

View File

@ -248,7 +248,13 @@ translate(Dwarf_Debug dbg, const char* addrstr)
continue;
}
if (dwarf_srclines(die, &lbuf, &lcount, &de) != DW_DLV_OK) {
switch (dwarf_srclines(die, &lbuf, &lcount, &de)) {
case DW_DLV_OK:
break;
case DW_DLV_NO_ENTRY:
/* If one CU lacks debug info, just skip it. */
continue;
default:
warnx("dwarf_srclines: %s", dwarf_errmsg(de));
goto out;
}