]> xenbits.xensource.com Git - people/julieng/freebsd.git/commitdiff
addr2line: skip CUs lacking debug info instead of bailing out
authoremaste <emaste@FreeBSD.org>
Tue, 22 Sep 2015 16:51:40 +0000 (16:51 +0000)
committeremaste <emaste@FreeBSD.org>
Tue, 22 Sep 2015 16:51:40 +0000 (16:51 +0000)
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

contrib/elftoolchain/addr2line/addr2line.c

index cfdcc745f9fb073b3e833e258d9715c118c9e3eb..86e728229075afaa63c5662afa483e1f0888b44b 100644 (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;
                }