public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: Lancelot SIX <lancelot.six@amd.com>
Cc: gdb-patches@sourceware.org, Guinevere Larsen <blarsen@redhat.com>,
	<lsix@lancelotsix.com>
Subject: Re: [PATCH] gdb/infrun: lazily load curr_frame_id in process_event_stop_test
Date: Wed, 10 Jan 2024 13:04:14 -0700	[thread overview]
Message-ID: <20240110130414.1f95f367@f39-zbm-amd> (raw)
In-Reply-To: <20231228193359.3888031-1-lancelot.six@amd.com>

On Thu, 28 Dec 2023 19:33:59 +0000
Lancelot SIX <lancelot.six@amd.com> wrote:

> A recent(ish) change in gdb/infrun.c made process_event_stop_test load
> debug information where it would not have done so previously.  The
> change is:
> 
>     commit bf2813aff8f2988ad3d53e819a0415abf295c91f
>     AuthorDate: Fri Sep 1 13:47:32 2023 +0200
>     CommitDate: Mon Nov 20 10:54:03 2023 +0100
> 
>         gdb/record: print frame information when exiting a recursive call
> 
>         Currently,  when GDB is reverse stepping out of a function into the same
>         function due to a recursive call, it doesn't print frame information, as
>         reported by PR record/29178. This happens because when the inferior
>         leaves the current frame, GDB decides to refresh the step information,
>         clobbering the original step_frame_id, making it impossible to figure
>         out later on that the frame has been changed.
> 
>         This commit changes GDB so that, if we notice we're in this exact
>         situation, we won't refresh the step information.
> 
>         Because of implementation details, this change can cause some debug
>         information to be read when it normally wouldn't before, which showed up
>         as a regression on gdb.dwarf2/dw2-out-of-range-end-of-seq. Since that
>         isn't a problem, the test was changed to allow for the new output.
> 
>         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29178
> 
> Although there is nothing wrong with this change in principle, it
> happens to break most of the tests in gdb/testsuite/gdb.rocm/*.exp.
> This is because those tests do rely on GDB not loading debug
> information.  This is necessary because the debug information produced
> for AMDGPU code is using DWARF extensions which are not supported by GDB
> at this point.
> 
> In this patch, I propose to use a lazy loading mechanism so the frame_id
> for the current frame is only computed when required instead of when
> entering process_event_stop_test.  The lazy_loader class is currently
> defined locally in infrun.c, but if it turns out to be useful elsewhere,
> it could go somewhere under gdbsupport.
> 
> This patch should restore the behavior GDB had before
> bf2813aff8f2988ad3d53e819a0415abf295c91f when it comes to load debug
> info.
> 
> Another approach could have been to revert
> fb84fbf8a51f5be2e78765508ebd9753af96b492 (gdb/infrun: simplify
> process_event_stop_test) and adjust the implementation of
> bf2813aff8f2988ad3d53e819a0415abf295c91f (gdb/record: print frame
> information when exiting a recursive call).  However, I think that the
> lazy loading works well with the simplification done recently, so I went
> down that route.
> 
> Regression tested on x86_64-linux (Ubuntu 22.04) with AMDGPU support.

I remember reviewing that change from Guinevere last year wondering if
there might be any unexpected fallout from reading debug info earlier
than it had been previously.  Now we know...

I'm okay with your approach, but I'd like to give other maintainers
a chance to weigh in.  So, please wait a few more days before you
push this change.

Approved-by: Kevin Buettner <kevinb@redhat.com>

Kevin


  reply	other threads:[~2024-01-10 20:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-28 19:33 Lancelot SIX
2024-01-10 20:04 ` Kevin Buettner [this message]
2024-01-21 16:20   ` Six, Lancelot

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=20240110130414.1f95f367@f39-zbm-amd \
    --to=kevinb@redhat.com \
    --cc=blarsen@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=lancelot.six@amd.com \
    --cc=lsix@lancelotsix.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).