Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Doug Evans <dje@google.com>
To: Ulrich Weigand <uweigand@de.ibm.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA] Fix hand called function when another thread has hit a bp.
Date: Mon, 15 Dec 2008 22:07:00 -0000	[thread overview]
Message-ID: <e394668d0812151406r1852ce82sa6d810675efb785f@mail.gmail.com> (raw)
In-Reply-To: <200812142213.mBEMDAFX019852@d12av02.megacenter.de.ibm.com>

On Sun, Dec 14, 2008 at 2:13 PM, Ulrich Weigand <uweigand@de.ibm.com> wrote:
> Doug Evans wrote:
>
>> >> Adding the above to the end of the testcase reveals the fact that this
>> >> patch causes gdb to lose track of the fact that it needs to single
>> >> step over the breakpoint at all_threads_running in the main thread,
>> >> and resuming execution causes the breakpoint to be hit again.  Global
>> >> state, gotta love it.
>> >>
>> >> I'm assuming non-stop mode doesn't have this problem.
>> >> Can we record in struct thread_info (or some such) the last stop
>> >> reason and before resuming with !scheduler-locking iterate over all
>> >> threads, single stepping them as necessary?  Is there a better
>> >> solution?
>> >
>> > This patch fixes the expanded hand-call-in-threads.exp testcase (which
>> > is part of the patch).  In the process I discovered a bigger problem -
>> > gdb doesn't handle resuming after more than one thread is stopped at a
>> > breakpoint.  This can happen if the user runs several threads in turn
>> > with scheduler-locking on, and then turns scheduler-locking off and
>> > resumes the program.  I wrote another testcase,
>> > multi-bp-in-threads.exp, to expose this issue.  Fixing this appears to
>> > be a much harder problem, and I think I'd like to declare partial
>> > victory with this patch ...
>
> I'm not sure this is the right approach -- how can we be sure those
> breakpoints in other threads have already been reported to the user?

Hmm, do we need a flag that says which signals have been reported?

> The original code specifically steps only over the one breakpoint that
> was reported when GDB last stopped.  If other threads hit breakpoints
> simultaneously, we *want* them to trigger again, so that they can be
> properly reported to the user ...
>
> Why does this not work for your test case?

Hmm, I think we need to distinguish which testcase we're talking about.

hand-call-in-threads.exp:
  What it does:
    - start up N threads and stop
    - set scheduler-locking on
    - hand-call a function in N threads, each of which hits a breakpoint
    - manually pop pending dummy frames
    - set scheduler-locking off
    - continue
  What it tests:
    - verify a previously hit breakpoint in a different thread is NOT
singlestepped when resuming with scheduler-locking on
    - verify manually popping all pending dummy frames works
    - verify that resuming after manually popping all pending dummy
frames works (i.e. a previously hit and reported breakpoint is not
re-reported)

multi-bp-in-threads.exp:
  What it does:
    - start up N threads and stop
    - set scheduler-locking on
    - hand-call a function in N threads, each of which hits a breakpoint
    - set scheduler-locking off
    - continue
  What it tests:
    - see what happens ... it's not clear to me what _should_ happen here

Perhaps first we should agree on what the right behavior is.
For hand-call-in-threads.exp I think the testcase is correct as is.
For multi-bp-in-threads.exp, one approach is to just define the
problem away and say that GDB's current behavior is the correct
behavior. :)


  reply	other threads:[~2008-12-15 22:07 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 [this message]
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

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=e394668d0812151406r1852ce82sa6d810675efb785f@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