public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
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: Thu, 30 Aug 2018 16:16:00 -0000	[thread overview]
Message-ID: <1535645755.5475.9.camel@klomp.org> (raw)
In-Reply-To: <43cf32f1-c9f0-b4d2-36bf-17a8ece77e76@suse.cz>

[-- Attachment #1: Type: text/plain, Size: 727 bytes --]

Hi Martin,

Sorry for dropping this after you provided such an excellent analysis.
So the problem really is that main gets split into main.cold which is
jumped into, so a simple backtrace won't see the "hot" main anymore. If
we would use the debuginfo we might be able to get the "correct"
function name, but that isn't really the purpose of this testcase.

The only problem is that I haven't been able to replicate this in the
testsuite (I do see the partitioning in the standalone testcase you
posted).

Is it just run-backtrace-dwarf that is a problem for you?
In that case, does the attached patch help? It puts all of main in its
own section, which should prevent gcc from partitioning it.

Thanks,

Mark

[-- Attachment #2: Type: text/x-patch, Size: 454 bytes --]

diff --git a/tests/backtrace-dwarf.c b/tests/backtrace-dwarf.c
index e1eb492..35f25ed 100644
--- a/tests/backtrace-dwarf.c
+++ b/tests/backtrace-dwarf.c
@@ -124,6 +124,7 @@ thread_callback (Dwfl_Thread *thread, void *thread_arg)
 }
 
 int
+__attribute__((section(".main"))) /* Defeat -freorder-blocks-and-partition  */
 main (int argc __attribute__ ((unused)), char **argv)
 {
   /* We use no threads here which can interfere with handling a stream.  */

  reply	other threads:[~2018-08-30 16:16 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
2018-08-03 10:07   ` Martin Liška
2018-08-30 16:16     ` Mark Wielaard [this message]
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=1535645755.5475.9.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).