public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Jim Blandy <jimb@codesourcery.com>
To: Michael Snyder <msnyder@specifix.com>
Cc: Thiago Jung Bauermann <bauerman@br.ibm.com>,
		  Vladimir Prus <vladimir@codesourcery.com>,
	 gdb@sources.redhat.com
Subject: Re: Keeping breakpoints inserted
Date: Sat, 01 Dec 2007 00:08:00 -0000	[thread overview]
Message-ID: <m363zjuvi2.fsf@codesourcery.com> (raw)
In-Reply-To: <1196458063.2501.153.camel@localhost.localdomain> (Michael Snyder's message of "Fri, 30 Nov 2007 13:27:43 -0800")


Michael Snyder <msnyder at specifix.com> writes:
> There will be some as-it-were non-deterministic behavior, 
> it seems to me.  If threads are running while we are inserting
> breakpoints, then there will (at some point) be breakpoint
> events while we are inserting breakpoints, and the order of
> these events (and of running-threads stopping) will depend
> on the order in which we insert them, as well as on what 
> the running threads happen to be doing at the time.
>
> I should think that this would be more intrusive (in the 
> sense of changing the behavior of the target program) than
> we already are.
>
> We could see a deadlock develop during the time it takes us
> to insert all the breakpoints.

Since breakpoints only make the threads that hit them execute "very
slowly", I don't see how they could introduce a deadlock in code that
didn't already have the potential for deadlock in the absence of a
debugger.

It's true that the breakpoints won't all appear in the address space
simultaneously.  It might be useful to be able to insert breakpoints
disabled, and then enable them as a group.  Even in all-stop mode, GDB
isn't able to stop all threads simulataneously; it has to obtain the
list of threads and send each one a signal.  So it seems to me that
some degree of 'play' in breakpoint insertion isn't so different from
what we have now.

Inserting breakpoints into code that's currently being executed
inevitably entails race conditions.  But I expect one would only do
such a thing in circumstances where it's meaningful and controllable.

For example, you might know that you'll reach the breakpoint only in
response to a certain input, which you'll send to the program after
you've set the breakpoint.

Or, it might not matter which particular execution of the code you
catch first, you just want to interrupt it.

Non-stop debugging is more invasive than all-stop debugging, if you
assess invasiveness by looking at how the threads progress relative to
each other.  Non-stop debugging can make one thread run 'extremely
slowly' while other threads progress at a normal rate.  All-stop
debugging stops all threads roughly equally (but even then not
perfectly so).

However, non-stop debugging can be less invasive than all-stop
debugging, if you assess invasiveness by looking at how responsive the
system remains to outside events.  With non-stop debugging, you can
debug one particular thread out of the entire system while the others
continue to work normally.

Deciding which mode to use depends on the developer's knowledge of the
system they're debugging.

  reply	other threads:[~2007-12-01  0:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-29 19:24 Vladimir Prus
2007-11-30  1:25 ` Michael Snyder
2007-11-30 10:11   ` Vladimir Prus
2007-11-30 21:03 ` Thiago Jung Bauermann
2007-11-30 21:41   ` Michael Snyder
2007-12-01  0:08     ` Jim Blandy [this message]
2007-12-01  1:43       ` Michael Snyder
2007-12-01 17:52         ` Jim Blandy
2007-12-02 18:38           ` Thiago Jung Bauermann
2007-12-03 18:14             ` Jim Blandy
2007-11-30 23:53   ` Jim Blandy

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=m363zjuvi2.fsf@codesourcery.com \
    --to=jimb@codesourcery.com \
    --cc=bauerman@br.ibm.com \
    --cc=gdb@sources.redhat.com \
    --cc=msnyder@specifix.com \
    --cc=vladimir@codesourcery.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).