public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: Kevin Buettner via Gdb-patches <gdb-patches@sourceware.org>
Cc: Guinevere Larsen <blarsen@redhat.com>
Subject: Re: [PATCH v3 1/2] gdb/record: print frame information when exiting a recursive call
Date: Wed, 27 Sep 2023 18:57:10 -0700	[thread overview]
Message-ID: <20230927185710.3475c282@f37-zws-nv> (raw)
In-Reply-To: <20230927162231.5d301671@f37-zws-nv>

On Wed, 27 Sep 2023 16:22:31 -0700
Kevin Buettner <kevinb@redhat.com> wrote:

> I'll now do some actual debugging, comparing what happens with and
> without Gwen's patch...

I think I understand what's going on now.  This part of the
patch...

    diff --git a/gdb/infrun.c b/gdb/infrun.c
    index 4730d290442..3491327422d 100644
    --- a/gdb/infrun.c
    +++ b/gdb/infrun.c
    @@ -6923,6 +6923,11 @@ process_event_stop_test (struct execution_control_state *ecs)
       frame = get_current_frame ();
       gdbarch = get_frame_arch (frame);
     
    +  /* Shorthand to make if statements smaller.  */
    +  struct frame_id original_frame_id
    +    = ecs->event_thread->control.step_frame_id;
    +  struct frame_id curr_frame_id = get_frame_id (get_current_frame ());
    +
       switch (what.main_action)
	 {
	 case BPSTAT_WHAT_SET_LONGJMP_RESUME:

...is causing get_frame_id() to be called in situations where it might
not have been called before.  For the test case in question, it's
causing glibc's symbols to be loaded - they weren't before.  If the
new code is either removed or moved to a location later in the
function, then glibc's symbols aren't loaded.

Is this a problem?

For most (almost all?) debugging scenarios, this will merely cause
some symbols to be loaded somewhat earlier in the debugging session
than they would have been otherwise.  Therefore, I don't think it's a
problem.  However, if someone has a different point of view, I'd like
to hear it...

How should we fix the regresssion?

The problematic command in gdb.dwarf2/dw2-out-of-range-end-of-seq.exp
is:

    maint info line-table main.c$

The 'main.c$' part of it is actually a regular expression.  Due
to the fact that glibc has been loaded earlier than it had been
in the past, this RE is matching main.c, which is what we want,
but also textdomain.c and support_test_main.c, which we don't.
These latter two files are from glibc.  The relevant lines from
the log file are as follows:

    (gdb) maint info line-table main.c$
    objfile: /mesquite2/sourceware-git/f38-review/bld/gdb/testsuite/outputs/gdb.dwarf2/dw2-out-of-range-end-of-seq/dw2-out-of-range-end-of-seq ((struct objfile *) 0x2273d50)
    compunit_symtab: main.c ((struct compunit_symtab *) 0x2267b80)
    symtab: /mesquite2/sourceware-git/worktree-review/gdb/testsuite/gdb.dwarf2/main.c ((struct symtab *) 0x2267c00)
    linetable: ((struct linetable *) 0x2267e20):
    INDEX  LINE   REL-ADDRESS        UNREL-ADDRESS      IS-STMT PROLOGUE-END 
    0      1      0x0000000000401106 0x0000000000401106 Y                    
    1      END    0x0000000000401111 0x0000000000401111 Y                    

    objfile: /usr/lib/debug/usr/lib64/libc.so.6-2.37-5.fc38.x86_64.debug ((struct objfile *) 0x23eecc0)
    compunit_symtab: <unknown> ((struct compunit_symtab *) 0x2c47a50)
    symtab: /usr/src/debug/glibc-2.37-5.fc38.x86_64/intl/textdomain.c ((struct symtab *) 0x2c71530)
    linetable: ((struct linetable *) 0x0):
    No line table.

    objfile: /usr/lib/debug/usr/lib64/libc.so.6-2.37-5.fc38.x86_64.debug ((struct objfile *) 0x23eecc0)
    compunit_symtab: <unknown> ((struct compunit_symtab *) 0x2c47a50)
    symtab: /usr/src/debug/glibc-2.37-5.fc38.x86_64/support/support_test_main.c ((struct symtab *) 0x2c87410)
    linetable: ((struct linetable *) 0x0):
    No line table.

If the command is changed to "maint info line-table \bmain.c$", the
word boundary anchor \b will cause only main.c to be matched.

(Ideally, the .  would also be escaped with '\' so that it would only
match a literal .  (period) and not any character.)

Kevin


  reply	other threads:[~2023-09-28  1:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-27 10:19 [PATCH v3 0/2] Improving frame printing with recursive Guinevere Larsen
2023-09-27 10:19 ` [PATCH v3 1/2] gdb/record: print frame information when exiting a recursive call Guinevere Larsen
2023-09-27 21:26   ` Kevin Buettner
2023-09-27 23:22     ` Kevin Buettner
2023-09-28  1:57       ` Kevin Buettner [this message]
2023-10-02 13:11         ` Guinevere Larsen
2023-09-27 10:19 ` [PATCH v3 2/2] gdb/infrun: simplify process_event_stop_test Guinevere Larsen

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=20230927185710.3475c282@f37-zws-nv \
    --to=kevinb@redhat.com \
    --cc=blarsen@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /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).