public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: will schmidt <will_schmidt@vnet.ibm.com>
To: Luis Machado <luis.machado@arm.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH, v2] Fix reverse stepping multiple contiguous PC ranges over the line table
Date: Tue, 05 Apr 2022 10:15:13 -0500	[thread overview]
Message-ID: <553238d49ce5aae0e88a6ce0b7dd6afa96931bc6.camel@vnet.ibm.com> (raw)
In-Reply-To: <3d467cfa-1844-397c-931b-ffd832fa254f@arm.com>

On Tue, 2022-04-05 at 09:36 +0100, Luis Machado wrote:
> On 4/4/22 17:55, will schmidt wrote:
> > On Thu, 2022-03-31 at 14:52 +0100, Luis Machado via Gdb-patches
> > wrote:
> > > v2:
> > > - Check if both the line and symtab match for a particular line
> > > table entry.
> > > 
> > > --
> > > 
> > > When running GDB's testsuite on aarch64-linux/Ubuntu 20.04 (also
> > > spotted on
> > > the ppc backend), I noticed some failures in gdb.reverse/solib-
> > > precsave.exp
> > > and gdb.reverse/solib-reverse.exp.
> > > 
> > > The failure happens around the following code:
> > > 
> > > 38  b[1] = shr2(17);		/* middle part two */
> > > 40  b[0] = 6;   b[1] = 9;	/* generic statement, end part two */
> > > 42  shr1 ("message 1\n");	/* shr1 one */
> > > 
> > > Normal execution:
> > > 
> > > - step from line 38 will land on line 40.
> > > - step from line 40 will land on line 42.
> > > 
> > > Reverse execution:
> > > 
> > > - step from line 42 will land on line 40.
> > > - step from line 40 will land on line 40.
> > > - step from line 40 will land on line 38.
> > > 
> > > The problem here is that line 40 contains two contiguous but
> > > distinct
> > > PC ranges in the line table, like so:
> > > 
> > > Line 40 - [0x7ec ~ 0x7f4]
> > > Line 40 - [0x7f4 ~ 0x7fc]
> > 
> > <snip>
> > 
> > 
> > > I'm not particularly happy with how we go back in the ranges
> > > (using "pc - 1").
> > > Feedback would be welcome.
> > 
> > I suppose there could be a loop of some sort that iterates
> > backwards to
> > a valid line; though I'd think pc - 1 is sufficient?
> > 
> 
> Yes, it seems to do the job.
> 
> > > Validated on aarch64-linux/Ubuntu 20.04/18.04. Carl Love has
> > > verified that it
> > > does fix a similar issue on ppc.
> > > 
> > > Ubuntu 18.04 doesn't actually run into these failures because the
> > > compiler
> > > doesn't generate distinct PC ranges for the same line.
> > > 
> > > I see similar failures on x86_64 in the gdb.reverse tests
> > > (gdb.reverse/step-reverse.exp and gdb.reverse/step-reverse.exp).
> > > Those are
> > > also fixed by this patch, although Carl's testcase doesn't fail
> > > for x86_64.
> > > 
> > > There seems to be a corner case where a line table has only one
> > > instruction,
> > > and while stepping that doesn't take the same path through
> > > infrun. I think it
> > > needs some more investigation. Therefore this is a tentative
> > > patch for now.
> > 
> > Are you (or Carl) continuing to pursue that edge case?
> > 
> 
> Not at the moment unfortunately. I know that this needs to be handled
> in 
> the fallthrough of process_event_stop_test. Carl's test doesn't seem
> to 
> fail for x86_64 (at least for me). We need to polish the testcase a
> bit 
> more so that we can cover that corner case as well.
> 
> Also, this is more of a RFC at this point. You'll notice some debug 
> print statement in the patch. It would be nice to turn those into 
> permanent debug prints, as this code doesn't seem to print too much 
> detail about what it is doing.

OK,
thanks.

I did notice the debug printfs.   Since they were actually using
the infrun_debug_printf helper, versus actual printf calls,  I assumed
they were deliberate and meant for the long term.  :-)
I wasn't going to
nit on the uppercase content of the debug printfs, I figure since they
are actually debug for special circumstances the debug was fine as
presented.  :-)
I'm generally a fan of adding more debug output.

Thanks
-Will



  reply	other threads:[~2022-04-05 15:15 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-23 16:39 [PATCH] Updated, fix reverse stepping multiple contiguous PC ranges Carl Love
2022-02-28 18:02 ` Carl Love
2022-03-08 20:21 ` Bruno Larsen
2022-03-08 22:01   ` Carl Love
2022-03-09 12:23     ` Bruno Larsen
2022-03-09 20:52       ` Carl Love
2022-03-10 13:49         ` Bruno Larsen
2022-03-09 14:53     ` Luis Machado
2022-03-10 11:13   ` Luis Machado
2022-03-10 13:19     ` Bruno Larsen
2022-03-10 13:33       ` Luis Machado
2022-03-22 15:28   ` Carl Love
2022-03-22 17:05     ` [PATCH V2] " Carl Love
2022-03-22 17:10       ` Luis Machado
2022-03-23 12:20       ` Bruno Larsen
2022-03-23 15:43         ` [PATCH V3] " Carl Love
2022-03-31 13:52     ` [PATCH, v2] Fix reverse stepping multiple contiguous PC ranges over the line table Luis Machado
2022-04-04 16:55       ` will schmidt
2022-04-05  8:36         ` Luis Machado
2022-04-05 15:15           ` will schmidt [this message]
2022-04-05 15:24             ` Luis Machado
2023-04-27 20:59 [PATCH] " Carl Love
2023-05-03  9:53 ` Bruno Larsen
2023-05-04  2:55   ` [PATCH v2] " Carl Love

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=553238d49ce5aae0e88a6ce0b7dd6afa96931bc6.camel@vnet.ibm.com \
    --to=will_schmidt@vnet.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=luis.machado@arm.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).