Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Contents looks good, just need a test to ensure that warnings are quieted. There should be a test for each kind of warning, so it should be easy to run that same command with the --quiet option and verify that the warning does _not_ appear.
Makes sense. However, I didn't find any tests for these warnings in llvm/test/tools/llvm-gsymutil.
There are test cases in https://github.com/llvm/llvm-project/blob/1d01fc100bb5bef5f5eaf92520b2e52f64ee1d6e/llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp, however they don't check the warnings either. It seems that a test case like TestDWARFTextRanges would trigger a warning, though I am not completely sure which one. Should these test cases be transferred into llvm-lit tests as well?
@clayborg I am not sure what it means you now accepted the revision? I am still not sure what to do about the tests.
One more thing is that I suppress everything that's called a "warning" here. I tested it, and on our release/optimized binaries (built with gcc) we get lots of "errors" such as:
00:10:57.048 error: DIE has a start address whose LowPC is between the line table Row[9006] with address 0x00000000033aaf17 and the next one. 00:10:57.048 00:10:57.048 0x0ca2fa30: DW_TAG_subprogram 00:10:57.048 DW_AT_abstract_origin (0x0ca2fa0b "_ZN5boost15program_options20invalid_option_valueC4ERKSbIwSt11char_traitsIwESaIwEE") 00:10:57.048 DW_AT_MIPS_linkage_name ("_ZN5boost15program_options20invalid_option_valueC2ERKSbIwSt11char_traitsIwESaIwEE") 00:10:57.048 DW_AT_object_pointer (0x0ca2fa49) 00:10:57.048 DW_AT_ranges (0x009bbe70 00:10:57.048 [0x000000000ae3a740, 0x000000000ae3ab29) 00:10:57.048 [0x00000000033aaf20, 0x00000000033aaff5)) 00:10:57.048 DW_AT_frame_base (DW_OP_call_frame_cfa) 00:10:57.048 DW_AT_GNU_all_call_sites (0x01) 00:10:57.048 DW_AT_sibling (0x0ca3288d) 00:10:57.048 error: DIE has a start address whose LowPC is between the line table Row[9368] with address 0x00000000033ab1fb and the next one.
I am not sure if this was just accidentally called "error" instead of "warning", and we should suppress that as well with --quiet, or if this is rather a more severe issue, which should not be silenced. I guess in that case, we would probably update the compiler version to fix that (assuming it is fixed in a more recent gcc version).
I will need to add tests for these warnings since they don't already exist. These kinds of tests require a deep knowledge of making DWARF that contains each of these warnings, so I won't have you do this.
One more thing is that I suppress everything that's called a "warning" here. I tested it, and on our release/optimized binaries (built with gcc) we get lots of "errors" such as:
00:10:57.048 error: DIE has a start address whose LowPC is between the line table Row[9006] with address 0x00000000033aaf17 and the next one. 00:10:57.048 00:10:57.048 0x0ca2fa30: DW_TAG_subprogram 00:10:57.048 DW_AT_abstract_origin (0x0ca2fa0b "_ZN5boost15program_options20invalid_option_valueC4ERKSbIwSt11char_traitsIwESaIwEE") 00:10:57.048 DW_AT_MIPS_linkage_name ("_ZN5boost15program_options20invalid_option_valueC2ERKSbIwSt11char_traitsIwESaIwEE") 00:10:57.048 DW_AT_object_pointer (0x0ca2fa49) 00:10:57.048 DW_AT_ranges (0x009bbe70 00:10:57.048 [0x000000000ae3a740, 0x000000000ae3ab29) 00:10:57.048 [0x00000000033aaf20, 0x00000000033aaff5)) 00:10:57.048 DW_AT_frame_base (DW_OP_call_frame_cfa) 00:10:57.048 DW_AT_GNU_all_call_sites (0x01) 00:10:57.048 DW_AT_sibling (0x0ca3288d) 00:10:57.048 error: DIE has a start address whose LowPC is between the line table Row[9368] with address 0x00000000033ab1fb and the next one.I am not sure if this was just accidentally called "error" instead of "warning", and we should suppress that as well with --quiet, or if this is rather a more severe issue, which should not be silenced. I guess in that case, we would probably update the compiler version to fix that (assuming it is fixed in a more recent gcc version).
This is an valid error. The compiler or linker has messed up and the DWARF is broken and this really should remain an error. Normally when you have a function, you should have a line entry for the first address in function. So if you have a function named "A" whose address range is [0x1000-0x2000) you would expect an line table entry for address 0x1000. In this error case we have a line table that looks like:
0x0000FFF0: main.cpp:12 0x00001010: main.cpp:13
So something serious went wrong in the compiler, LTO, or linker where they didn't modify the DWARF correctly. So this really should remain an error so that compiler and linker people can see this and really try to fix it.
Ok, thanks! Then I will push my patch.
One more thing is that I suppress everything that's called a "warning" here. I tested it, and on our release/optimized binaries (built with gcc) we get lots of "errors" such as:
00:10:57.048 error: DIE has a start address whose LowPC is between the line table Row[9006] with address 0x00000000033aaf17 and the next one. 00:10:57.048 00:10:57.048 0x0ca2fa30: DW_TAG_subprogram 00:10:57.048 DW_AT_abstract_origin (0x0ca2fa0b "_ZN5boost15program_options20invalid_option_valueC4ERKSbIwSt11char_traitsIwESaIwEE") 00:10:57.048 DW_AT_MIPS_linkage_name ("_ZN5boost15program_options20invalid_option_valueC2ERKSbIwSt11char_traitsIwESaIwEE") 00:10:57.048 DW_AT_object_pointer (0x0ca2fa49) 00:10:57.048 DW_AT_ranges (0x009bbe70 00:10:57.048 [0x000000000ae3a740, 0x000000000ae3ab29) 00:10:57.048 [0x00000000033aaf20, 0x00000000033aaff5)) 00:10:57.048 DW_AT_frame_base (DW_OP_call_frame_cfa) 00:10:57.048 DW_AT_GNU_all_call_sites (0x01) 00:10:57.048 DW_AT_sibling (0x0ca3288d) 00:10:57.048 error: DIE has a start address whose LowPC is between the line table Row[9368] with address 0x00000000033ab1fb and the next one.I am not sure if this was just accidentally called "error" instead of "warning", and we should suppress that as well with --quiet, or if this is rather a more severe issue, which should not be silenced. I guess in that case, we would probably update the compiler version to fix that (assuming it is fixed in a more recent gcc version).
This is an valid error. The compiler or linker has messed up and the DWARF is broken and this really should remain an error. Normally when you have a function, you should have a line entry for the first address in function. So if you have a function named "A" whose address range is [0x1000-0x2000) you would expect an line table entry for address 0x1000. In this error case we have a line table that looks like:
0x0000FFF0: main.cpp:12 0x00001010: main.cpp:13So something serious went wrong in the compiler, LTO, or linker where they didn't modify the DWARF correctly. So this really should remain an error so that compiler and linker people can see this and really try to fix it.
Yeah, makes sense that this is a real issue. I can reproduce such errors with a RelWithDebInfo build of ninja-build using gcc 8.3.1, 9.3.1 and 10.2.1 (from CentOS 7 devtoolset-* packages), with or without LTO, using both gold and lld (I didn't try all combinations), with varying number of errors. e.g.
$ CC=/opt/rh/devtoolset-10/root/bin/gcc CXX=/opt/rh/devtoolset-10/root/bin/g++ cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -B build-gcc10 -G Ninja [...] $ cmake --build build-gcc10/ [...] $ llvm-gsymutil --quiet --convert build-gcc10/ninja Input file: build-gcc10/ninja Output file (x86_64): build-gcc10/ninja.gsym error: DIE has a start address whose LowPC is between the line table Row[2448] with address 0x0000000000404aea and the next one. 0x0001fea8: DW_TAG_subprogram DW_AT_abstract_origin (0x00016646 "_ZNSt10_HashtableI11StringPieceSt4pairIKS0_PN8BuildLog8LogEntryEESaIS6_ENSt8__detail10_Select1stESt8equal_toIS0_ESt4hashIS0_ENS8_18_Mod_range_hashingENS8_20_Default_ranged_hashENS8_20_Prime_rehash_policyENS8_17_Hashtable_traitsILb1ELb0ELb1EEEE10_M_emplaceIJS6_EEES1_INS8_14_Node_iteratorIS6_Lb0ELb1EEEbESt17integral_constantIbLb1EEDpOT_") DW_AT_ranges (0x00001e00 [0x0000000000407a60, 0x0000000000407d61) [0x0000000000404af6, 0x0000000000404b22)) DW_AT_frame_base (DW_OP_call_frame_cfa) DW_AT_GNU_all_call_sites (true) DW_AT_sibling (0x00021223) error: DIE has a start address whose LowPC is between the line table Row[701] with address 0x0000000000405460 and the next one. 0x0015068e: DW_TAG_subprogram DW_AT_specification (0x0014dd01 "_ZN13DiskInterface8MakeDirsERKSs") DW_AT_object_pointer (0x001506a1) DW_AT_ranges (0x00022500 [0x0000000000414e30, 0x0000000000415018) [0x000000000040546c, 0x0000000000405486)) DW_AT_frame_base (DW_OP_call_frame_cfa) DW_AT_GNU_all_call_sites (true) DW_AT_sibling (0x00151687) error: DIE has a start address whose LowPC is between the line table Row[2462] with address 0x000000000040553a and the next one. [...]