Hi Martin, On Fri, 2018-08-03 at 09:41 +0200, Martin Liška wrote: > As slightly discussed with Mark, there are tests that expect 'main' > will be present in backtrace. That's not always true on x86_64 > because > -freorder-blocks-and-partition option is on by default. Then one can > see: > > [ 88s] FAIL: run-backtrace-dwarf.sh > [ 88s] ============================ > [ 88s] > [ 88s] 0x7f1fd49800cb raise > [ 88s] 0x7f1fd49694e9 abort > [ 88s] 0x5627fddd0188 callme > [ 88s] 0x5627fddd0192 doit > [ 88s] 0x5627fddd01a3 main.cold.1 > [ 88s] 0x7f1fd496afeb __libc_start_main > [ 88s] 0x5627fddd04aa _start > [ 88s] /home/abuild/rpmbuild/BUILD/elfutils-0.173/tests/backtrace- > dwarf: dwfl_thread_getframes: no error > [ 88s] 0x5627fddd01a3 main.cold.1 > > Thus I'm suggesting to disable the option for tests? > Thoughts?
So the problem is that some tests look for a 'main' symbol. This is imho for C based programs a natural way to see if we can unwind to the start of the program (everything before 'main' is infrastructure that isn't really relevant to the user). But in some cases the 'main' symbol is munged into something else. 'main.cold.1' in this case. The first question is, does the program also contain a 'main' symbol? If so, what does it cover? Could you eu-readelf -s tests/backtrace-dwarf | grep main Now if it does, the question is why didn't we see it? Is main.cold.1 an alias? Then we probably should look harder/smarter. Or does it now cover any of the backtrace addresses? If there isn't, or it isn't actually called, then the question is, is that actually legal? It seems, at least for C and C++ based programs that they should start in 'main'. If not they are not, is that because gcc did an illegal transformation? Or does it only look that way because we cannot unwind correctly (did it do some tail call)? We could just use -freorder-blocks-and-partition. But I would like to first really understand why it is necessary. If you could maybe post the binary somewhere for inspection that would be great. Thanks, Mark