|
From: Florian K. <fl...@ei...> - 2013-11-17 18:59:57
|
I've been looking some more at running valgrind on binaries compiled by
clang 3.3 -- mainly by running regression tests. Most of the failures I
see there had this cause:
parse_var_DIE: confused by:
<0><b>: DW_TAG_compile_unit
DW_AT_producer : (indirect string, offset: 0x........): clang
version 3.3 (tags/RELEASE_33/final)
DW_AT_language : 12
DW_AT_name : (indirect string, offset: 0x........):
free_is_write.c
DW_AT_low_pc : 0x........
DW_AT_stmt_list : 0
DW_AT_comp_dir : (indirect string, offset: 0x........): ...
The assert is thrown because upon reaching the sanity checks in
readwarf.c:1740 we have this:
have_lo = true
have_hi1 = false
have_range = false
and that causes the assertion. The patch below works around this but I
won't pretend that I know what I'm doing here.. Is this sensible?
I reran the regressions with this patch and there are no longer
assertions about invalid DIEs.
Thanks,
Florian
Index: coregrind/m_debuginfo/readdwarf3.c
===================================================================
--- coregrind/m_debuginfo/readdwarf3.c (revision 13714)
+++ coregrind/m_debuginfo/readdwarf3.c (working copy)
@@ -1758,6 +1758,14 @@
level,
False/*isFunc*/, NULL/*fbGX*/ );
} else
+ // clang generates this
+ if ((have_lo) && (!have_hi1) && (!have_range)) {
+ /* CU has no code, presumably? */
+ varstack_push( cc, parser, td3,
+ empty_range_list(),
+ level,
+ False/*isFunc*/, NULL/*fbGX*/ );
+ } else
if (have_lo && (!have_hi1) && have_range && ip_lo == 0) {
/* broken DIE created by gcc-4.3.X ? Ignore the
apparently-redundant DW_AT_low_pc and use the DW_AT_ranges
|
|
From: Mark W. <mj...@re...> - 2013-11-17 19:47:08
|
On Sun, Nov 17, 2013 at 07:59:45PM +0100, Florian Krohm wrote: > I've been looking some more at running valgrind on binaries compiled by > clang 3.3 -- mainly by running regression tests. Most of the failures I > see there had this cause: > > parse_var_DIE: confused by: > <0><b>: DW_TAG_compile_unit > DW_AT_producer : (indirect string, offset: 0x........): clang > version 3.3 (tags/RELEASE_33/final) > DW_AT_language : 12 > DW_AT_name : (indirect string, offset: 0x........): > free_is_write.c > DW_AT_low_pc : 0x........ > DW_AT_stmt_list : 0 > DW_AT_comp_dir : (indirect string, offset: 0x........): ... > > The assert is thrown because upon reaching the sanity checks in > readwarf.c:1740 we have this: > > have_lo = true > have_hi1 = false > have_range = false > > and that causes the assertion. The patch below works around this but I > won't pretend that I know what I'm doing here.. Is this sensible? This is a bug in clang apparently, see also https://bugs.kde.org/show_bug.cgi?id=306340 It isn't valid DWARF, you do need either, no range at all, a single range (with DW_AT_high_pc) or multiple ranges (with DW_AT_ranges). With only DW_AT_low_pc your patch might be the best we can do. Assume the CU doesn't really describe an code ranges. Does the CU really not contain any DIEs that describe code ranges? If they do, then theoretically we could scan the full CU and create the ranges that way, but that is very expensive. It might be good to print a warning. And file a bug upstream against the compiler. Working around it with your patch (and maybe a warning) might sadly be the only thing we can do since it isn't just clang that gets this wrong. icc also seems to have a similar DWARF output bug sometimes: https://bugs.kde.org/show_bug.cgi?id=317698 Cheers, Mark |