Created attachment 73703 [details] trivial program compiled with clang-3.1 -g on Linux Compiling any program with clang-3.1, make parse_var_DIE to emit a warning: > valgrind --tool=exp-sgcheck a.out ==18668== exp-sgcheck, a stack and global array overrun detector ==18668== NOTE: This is an Experimental-Class Valgrind Tool ==18668== Copyright (C) 2003-2012, and GNU GPL'd, by OpenWorks Ltd et al. ==18668== Using Valgrind-3.9.0.SVN and LibVEX; rerun with -h for copyright info ==18668== Command: a.out ==18668== parse_var_DIE: confused by: <0><10d>: DW_TAG_compile_unit DW_AT_producer : (indirect string, offset: 0xab): clang version 3.1 (branches/release_31) DW_AT_language : 12 DW_AT_name : (indirect string, offset: 0xd3): ../a.c DW_AT_low_pc : 0x0 DW_AT_stmt_list : 136 DW_AT_comp_dir : (indirect string, offset: 0xda): /home/uabpath/tmp --18668-- WARNING: Serious error when reading debug info --18668-- When reading debug info from /home/uabpath/tmp/a.out: --18668-- parse_var_DIE: confused by the above DIE ==18668== ==18668== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
The error still persists, here for clang 3.3dev: ==6223== exp-sgcheck, a stack and global array overrun detector ==6223== NOTE: This is an Experimental-Class Valgrind Tool ==6223== Copyright (C) 2003-2012, and GNU GPL'd, by OpenWorks Ltd et al. ==6223== Using Valgrind-3.9.0.SVN and LibVEX; rerun with -h for copyright info ==6223== Command: cppcheck --enable=all variadicTemplates.cpp ==6223== parse_var_DIE: confused by: <0><10e>: DW_TAG_compile_unit DW_AT_producer : (indirect string, offset: 0x73): clang version 3.3 (trunk 180841) DW_AT_language : 4 DW_AT_name : (indirect string, offset: 0x94): cli/cmdlineparser.cpp DW_AT_low_pc : 0x0 DW_AT_stmt_list : 136 DW_AT_comp_dir : (indirect string, offset: 0xaa): /home/alex/src/cppcheck/head --6223-- WARNING: Serious error when reading debug info --6223-- When reading debug info from /home/alex/src/cppcheck/head/cppcheck: --6223-- parse_var_DIE: confused by the above DIE --6223-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93 --6223-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93 --6223-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93 --6223-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93
Those WARNINGs are correct. Those are corrupt compile units. They only have a DW_AT_low_pc (at zero) and no DW_AT_high_pc or DW_AT_ranges. Please file a bug against clang.
(In reply to comment #2) > Those WARNINGs are correct. Those are corrupt compile units. They only have > a DW_AT_low_pc (at zero) and no DW_AT_high_pc or DW_AT_ranges. Please file a > bug against clang. I was just about to do this and looking for details. Then I realized that on my system the error shows up depending on the compiler I use for building valgrind - not the application which I am debugging. Is that still in alignment with your analysis? To me it is a surprise. (valgrind 3.9.0 TEST1 + clang 3.4 trunk)
(In reply to alexanderm.08 from comment #3) > I was just about to do this and looking for details. Then I realized that on > my system the error shows up depending on the compiler I use for building > valgrind - not the application which I am debugging. Is that still in > alignment with your analysis? To me it is a surprise. > (valgrind 3.9.0 TEST1 + clang 3.4 trunk) It depends on the details. It could be because valgrind also reads debuginfo from its own vgpreload libraries. The upstream bug is: http://llvm.org/bugs/show_bug.cgi?id=13351 See also bug #338781
(In reply to Mark Wielaard from comment #4) > It depends on the details. It could be because valgrind also reads debuginfo > from its own vgpreload libraries. The upstream bug is: > http://llvm.org/bugs/show_bug.cgi?id=13351 > > See also bug #338781 I confirm that valgrind reads its own debuginfo (for both the preloaded files and the tool file). This debuginfo reading is needed either to make host or guest stack trace. We could optimise to *not* read the var info data for the tool, as this is not needed.
2nd thoughts, this looks like a debug info issue
The llvm bug is still open https://github.com/llvm/llvm-project/issues/13723 but I think it might have been fixed since we haven't seen this issue in a very long time. sgcheck isn't part of valgrind anymore. But you can still trigger this with valgrind 3.21.0 using --read-var-info=yes: $ valgrind --read-var-info=yes /tmp/frob ==8280== Memcheck, a memory error detector ==8280== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al. ==8280== Using Valgrind-3.21.0 and LibVEX; rerun with -h for copyright info ==8280== Command: /tmp/frob ==8280== parse DIE(readdwarf3.c:3025): confused by: <0><10d>: Abbrev Number: 1 (DW_TAG_compile_unit) DW_AT_producer : (indirect string, offset: 0xab): clang version 3.1 (branches/release_31) DW_AT_language : 12 DW_AT_name : (indirect string, offset: 0xd3): ../a.c DW_AT_low_pc : 0x0 DW_AT_stmt_list : 136 DW_AT_comp_dir : (indirect string, offset: 0xda): /home/uabpath/tmp parse_var_DIE: --8280-- WARNING: Serious error when reading debug info --8280-- When reading debug info from /tmp/frob: --8280-- confused by the above DIE It won't trigger for valgrind 3.22.0 since that has lazy debuginfo reading by default and since the debuginfo isn't actually needed it won't parse it... Since this is just a warning and a real bug in llvm produced debuginfo I am closing this bug.