Module Name: src
Committed By: christos
Date: Sat Apr 5 23:33:16 UTC 2014
Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: dwarf.c
Log Message:
Handle assembly code built with -g
To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.9 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.10
--- src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.9 Sun Mar 9 16:48:01 2014
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c Sat Apr 5 19:33:15 2014
@@ -1924,7 +1924,6 @@ should_have_dwarf(Elf *elf)
char *name;
name = elf_strptr(elf, shdr.sh_link, sym.st_name);
-fprintf(stderr, "name = %s\n", name);
/* Studio emits these local symbols regardless */
if ((strcmp(name, "Bbss.bss") != 0) &&
@@ -1995,15 +1994,29 @@ dw_read(tdata_t *td, Elf *elf, char *fil
&addrsz, &offsz, NULL, &nxthdr, &dw.dw_err)) != DW_DLV_OK)
terminate("rc = %d %s\n", rc, dwarf_errmsg(dw.dw_err));
- if ((cu = die_sibling(&dw, NULL)) == NULL ||
- (((child = die_child(&dw, cu)) == NULL) &&
- should_have_dwarf(elf))) {
- terminate("file does not contain dwarf type data "
- "(try compiling with -g)\n");
- } else if (child == NULL) {
- return (0);
+ if ((cu = die_sibling(&dw, NULL)) == NULL)
+ goto out;
+
+ if ((child = die_child(&dw, cu)) == NULL) {
+ Dwarf_Unsigned lang;
+ if (die_unsigned(&dw, cu, DW_AT_language, &lang, 0)) {
+ debug(1, "DWARF language: %u\n", lang);
+ /*
+ * Assembly languages are typically that.
+ * They have some dwarf info, but not what
+ * we expect. They have local symbols for
+ * example, but they are missing the child info.
+ */
+ if (lang >= DW_LANG_lo_user)
+ return 0;
+ }
+ if (should_have_dwarf(elf))
+ goto out;
}
+ if (child == NULL)
+ return (0);
+
dw.dw_maxoff = nxthdr - 1;
if (dw.dw_maxoff > TID_FILEMAX)
@@ -2044,4 +2057,7 @@ dw_read(tdata_t *td, Elf *elf, char *fil
/* leak the dwarf_t */
return (0);
+out:
+ terminate("file does not contain dwarf type data "
+ "(try compiling with -g)\n");
}