From: Doug Evans <dje@google.com>
To: Ulrich Weigand <uweigand@de.ibm.com>
Cc: gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [RFA] Fix hand called function when another thread has hit a bp.
Date: Fri, 03 Apr 2009 23:25:00 -0000 [thread overview]
Message-ID: <e394668d0904031625s52ae248cqedbad79db8dd133@mail.gmail.com> (raw)
In-Reply-To: <200903301840.n2UIemX1018434@d12av02.megacenter.de.ibm.com>
On Mon, Mar 30, 2009 at 11:40 AM, Ulrich Weigand <uweigand@de.ibm.com> wrote:
> Doug Evans wrote:
>
>> Hi. Here's an updated version of the patch.
>
> Sorry for the late reply on this!
No worries.
>> Handling the restart after several threads are all stopped at a
>> breakpoint (via scheduler-locking = on), is left for a later patch
>> (it's happens more rarely).
>
> This patch, as far as I can see, just replaces one incorrect
> behaviour with a different incorrect behaviour, right?
One could look at it that way. I look at it as taking one step of a
two step fix. :-)
> That is to say, in the scenario where we have
>
> - set scheduler-locking on
> - stop on BP in thread A
> - manually switch to thread B
> - continue execution
>
> the behaviour today is:
>
> - GDB will switch back to A and single-step
> - (correctly) bypass the already-hit breakpoint in A
> - (incorrectly) continue execution thread A
>
> i.e. the incorrect behaviour is that thread A is continued,
> and not thread B.
>
> With your patch, the behaviour is:
>
> - GDB (correctly) continues execution of thread B
> - but the next time thread A is run, GDB will (incorrectly)
> report a second time the same breakpoint the user already saw
>
> Did I miss anything here?
>
> In any case, I guess I agree that the "new" type of incorrect
> behaviour is probably less bad that what we have today, so
> your patch does seem to be a step forward.
>
> Will you be working on a follow-on patch to fix the new
> incorrect behaviour?
That's the plan. It involves recording the stop reason for every
thread, and appropriately applying it when resuming.
>
>>+for { set i 1 } { $i <= $total_nr_threads } { incr i } {
>>+ set thread_nr $i
>>+ gdb_test "thread $thread_nr" "" "prepare to discard hand call, thread $thread_nr"
>>+ set frame_number [get_dummy_frame_number]
>>+ if { "$frame_number" == "" } {
>>+ fail "dummy stack frame number, thread $thread_nr"
>>+ setup_xfail "*-*-*"
>>+ # Need something.
>>+ set frame_number 0
>
> Why do we need this xfail here?
It's not needed. I can remove it.
>>+# Continue one last time, the program should exit normally.
>>+#
>>+# ??? This currently doesn't work because gdb doesn't know how to singlestep
>>+# over reported breakpoints that weren't in the last thread to run.
>>+# Fixing this first requires defining what the correct behaviour is.
>>+# Commented out until then.
>>+#
>>+# Manually set the thread back to the first thread: the program is still at
>>+# the all_threads_running breakpoint, which wasn't the last thread to run,
>>+# and gdb doesn't know how to singlestep over reported breakpoints that
>>+# weren't in the last thread to run.
>>+#gdb_test "thread 1" "" "set thread to 1, prepare to resume"
>>+#
>>+#gdb_continue_to_end "hand-call-in-threads"
>
> Should the "thread 1" really be here? It seems to me this was just an
> unsuccessful attempt to work-around the bug ...
It's there to document the bug (until it's fixed).
> Otherwise, the patch is OK.
prev parent reply other threads:[~2009-04-03 23:25 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-02 3:01 Doug Evans
2008-12-02 3:48 ` Doug Evans
2008-12-02 11:41 ` Doug Evans
2008-12-14 22:00 ` Doug Evans
2008-12-14 22:14 ` Ulrich Weigand
2008-12-15 22:07 ` Doug Evans
2008-12-15 22:50 ` Ulrich Weigand
2008-12-15 23:15 ` Doug Evans
2008-12-17 19:14 ` Ulrich Weigand
2009-02-24 10:42 ` Doug Evans
2009-03-13 17:06 ` Doug Evans
2009-03-29 13:36 ` Doug Evans
2009-03-30 18:48 ` Ulrich Weigand
2009-04-03 23:25 ` Doug Evans [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=e394668d0904031625s52ae248cqedbad79db8dd133@mail.gmail.com \
--to=dje@google.com \
--cc=gdb-patches@sourceware.org \
--cc=uweigand@de.ibm.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