public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Guinevere Larsen <blarsen@redhat.com>
To: "Metzger, Markus T" <markus.t.metzger@intel.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PATCH v4 1/4] gdb, infrun, btrace: fix reverse/replay stepping at end of execution history
Date: Fri, 5 Apr 2024 09:53:08 -0300	[thread overview]
Message-ID: <b23dd115-178b-4cb7-86c9-7ab12b64579d@redhat.com> (raw)
In-Reply-To: <DM8PR11MB5749426408282079354C3E12DE032@DM8PR11MB5749.namprd11.prod.outlook.com>

On 4/5/24 06:12, Metzger, Markus T wrote:
>>> When trying to step over a breakpoint at the end of the trace, the
>>> step-over will fail with no-history.  This does not clear step_over_info
>>> so a subsequent resume will cause GDB to not resume the thread and
>> expect
>>> a SIGTRAP to complete the step-over.  This will never come causing GDB to
>>> hang in the wait-for-event poll.
>>>
>>> That step-over failed after actually completing the step.  This is wrong.
>>> The step-over itself should have failed and the step should not have
>>> completed.  Fix it by moving the end of execution history check to before
>>> we are stepping.
>>>
>>> This exposes another issue, however.  When completing a step-over at the
>>> end of the execution history, we implicitly stop replaying that thread.  A
>>> continue command would resume after the step-over and, since we're no
>>> longer replaying, would continue recording.
>>>
>>> Fix that by recording the replay state in the thread's control state and
>>> failing with no-history in keep_going if we're switching from replay to
>>> recording.
>> I am a little confused by your test case. From the commit message
>> description, I expected the following GDB session to have been problematic:
>>
>> $ gdb record_goto
>> (gdb) start
>> 49 fun4 ();
>> (gdb) record btrace
>> (gdb) break fun1
>> (gdb) continue
>> in frame fun1 ()
>> 23 }
>> (gdb) reverse-next
>> In frame fun4 ()
>> 41 fun1 ();
>> (gdb) next
>> No more reverse-execution history.
>> 23 }
>> (gdb) next
>> # problems due to the SIGTRAP from the previous line
>>
>> (Pardon my hand written gdb session, my new system has an AMD cpu, so I
>> seem to be locked out of btrace).
>>
>> My confusion comes from your test case never explicitly setting any
>> breakpoints. I don't see why the inferior would have a sigtrap generated
>> to test it. Am I misunderstanding the issue you described?
> There are three tests contained in this patch.  Two of them do

My bad, I should have said that no test set the breakpoint to the 
furthest point that is executed.

I didn't understand that the break should be in the previous 
instruction. Now that I'm rethinking my example, it doesn't really make 
sense, since as the testcase says, GDB wouldn't be replaying at that 
point. With this new understanding, this change LGTM.

Reviewed-By: Guinevere Larsen <blarsen@redhat.com>

-- 
Cheers,
Guinevere Larsen
She/Her/Hers

>
>>> +# We need to be replaying, otherwise, we'd just continue recording.
>>> +gdb_test "reverse-stepi"
>>> +gdb_test "break"
>>> +
>>> +# Continuing will step over the breakpoint and then run into the end of
>>> +# the execution history.  This ends replay, so we can continue recording.
>>> +gdb_test "continue" "No more reverse-execution history.*"
>>> +gdb_continue_to_end
> The third test makes sure that 'step n' doesn't suddenly start recording.
>
> Regards,
> Markus.
>
> Intel Deutschland GmbH
> Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
> Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
> Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva
> Chairperson of the Supervisory Board: Nicole Lau
> Registered Office: Munich
> Commercial Register: Amtsgericht Muenchen HRB 186928


  reply	other threads:[~2024-04-05 12:53 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-12 11:34 [PATCH v4 0/4] btrace: infrun fixes Markus Metzger
2024-03-12 11:34 ` [PATCH v4 1/4] gdb, infrun, btrace: fix reverse/replay stepping at end of execution history Markus Metzger
2024-03-12 11:56   ` Hannes Domani
2024-03-13 11:47     ` Hannes Domani
2024-04-04 18:03   ` Guinevere Larsen
2024-04-05  9:12     ` Metzger, Markus T
2024-04-05 12:53       ` Guinevere Larsen [this message]
2024-03-12 11:34 ` [PATCH v4 2/4] gdb, infrun, record: fix hang when step-over fails with no-history Markus Metzger
2024-04-04 18:27   ` Guinevere Larsen
2024-03-12 11:34 ` [PATCH v4 3/4] gdb, infrun, record: move no-history notification into normal_stop Markus Metzger
2024-04-04 18:57   ` Guinevere Larsen
2024-04-05  9:16     ` Metzger, Markus T
2024-04-05 15:51       ` Guinevere Larsen
2024-03-12 11:34 ` [PATCH v4 4/4] gdb, infrun: fix multi-threaded reverse stepping Markus Metzger
2024-04-03 20:27   ` Guinevere Larsen
2024-04-09  9:14     ` Metzger, Markus T

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=b23dd115-178b-4cb7-86c9-7ab12b64579d@redhat.com \
    --to=blarsen@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=markus.t.metzger@intel.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).