From: Mark Wielaard <mark@klomp.org>
To: "Martin Liška" <mliska@suse.cz>, elfutils-devel@sourceware.org
Subject: Re: tests/backtrace-dwarf.c failure due to -freorder-blocks-and-partition
Date: Fri, 03 Aug 2018 09:46:00 -0000 [thread overview]
Message-ID: <1533289594.24471.57.camel@klomp.org> (raw)
In-Reply-To: <7cb09329-1ea2-0cb3-bf72-1c697de2934d@suse.cz>
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
next prev parent reply other threads:[~2018-08-03 9:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-03 7:41 Martin Liška
2018-08-03 9:46 ` Mark Wielaard [this message]
2018-08-03 10:07 ` Martin Liška
2018-08-30 16:16 ` Mark Wielaard
2018-09-11 11:02 ` Mark Wielaard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1533289594.24471.57.camel@klomp.org \
--to=mark@klomp.org \
--cc=elfutils-devel@sourceware.org \
--cc=mliska@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).