Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Andrew Burgess <andrew.burgess@embecosm.com>
Cc: Tom Tromey <tromey@adacore.com>,  gdb-patches@sourceware.org
Subject: Re: [PATCH] Find tailcall frames before inline frames
Date: Thu, 18 Jun 2020 15:07:32 -0600	[thread overview]
Message-ID: <87zh90ytez.fsf@tromey.com> (raw)
In-Reply-To: <20200618182502.GD2737@embecosm.com> (Andrew Burgess's message of "Thu, 18 Jun 2020 19:25:02 +0100")

>>>>> "Andrew" == Andrew Burgess <andrew.burgess@embecosm.com> writes:

>> However, in this scenario, what happened is that the DWARF unwinder
>> did find tailcall frames -- but then the PC of the first such frame
>> was recognized and claimed by the inline frame sniffer.

Andrew> I'm trying to understand the setup you have here in the hope I might
Andrew> be able to craft a test case for this - given that I'm not convinced
Andrew> the new placement of the tail call sniffer is safe.

Andrew> Was the setup something like:

Andrew>                     ,-- f3 tail calls to f4.
Andrew>                     |
Andrew>                     |
Andrew>   f1 --> f2 --> f3 --> f4 --> f5 --> f6

Andrew>   |_______________|
Andrew>   All inlined in f1

Andrew> Was there anything else special about this case?  I feel like there
Andrew> must have been, but I don't really understand the problem description.

Sorry about that.  While I do still have the test executable and core
file (and so I can easily try any patches), I can't send them out.  I'm
happy to test patches.

I only vaguely remember the details, and I can't really re-debug the
problem in the near term (I'm on PTO next week...).  However, I do also
have some notes, though not exhaustive ones.

Looking at the backtrace now, it does seem be like the above.
Here's some heavily trimmed down output:

    (gdb) frame apply 7 info frame
    [...]
    Stack level 0, frame at 0x7ffffffb07c0:
     called by frame at 0x7ffffffb07c0
    Stack level 1, frame at 0x7ffffffb07c0:
     tail call frame, caller of frame at 0x7ffffffb07c0
    Stack level 2, frame at 0x7ffffffb07c0:
     tail call frame, caller of frame at 0x7ffffffb07c0
    Stack level 3, frame at 0x7ffffffb0ab0:
     called by frame at 0x7ffffffb8c80, caller of frame at 0x7ffffffb07c0
    Stack level 4, frame at 0x7ffffffb8c80:
     inlined into frame 5, caller of frame at 0x7ffffffb0ab0
    Stack level 5, frame at 0x7ffffffb8c80:
     called by frame at 0x7ffffffb8cc0, caller of frame at 0x7ffffffb8c80
    Stack level 6, frame at 0x7ffffffb8cc0:
     called by frame at 0x7ffffffba490, caller of frame at 0x7ffffffb8c80

All I recall is what I wrote: dwarf2_tailcall_sniffer_first would note
that a frame came from tailcalls -- so tailcall_frame_sniffer would be
expected to notice this.  However, the inline sniffer would grab it
first, causing confusion.

One thing that would have helped here was the ability to turn off inline
and/or tail-call unwinding.  Perhaps we should add settings for this.

I wonder if I erred in my analysis and there's a combination of
tail-call and inlining happening.  That certainly seems like a
possibility and would explain the confusion ... whereas the "info frame"
stuff above seems innocuous to me now.

Tom


      reply	other threads:[~2020-06-18 21:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-20 15:58 Tom Tromey
2020-03-03 21:45 ` Tom Tromey
2020-03-05 10:21   ` Luis Machado
2020-03-05 16:56     ` Tom Tromey
2020-03-09 17:55     ` Luis Machado
2020-03-12 21:34     ` Tom Tromey
2020-03-13 13:31       ` Luis Machado
2020-03-24 21:24         ` Luis Machado
2020-03-26  1:59           ` Tom Tromey
2020-03-26  2:47             ` Luis Machado
2020-06-18 18:25 ` Andrew Burgess
2020-06-18 21:07   ` Tom Tromey [this message]

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=87zh90ytez.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=andrew.burgess@embecosm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@adacore.com \
    /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