Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: gdb@sourceware.org
Cc: Nick Roberts <nickrob@snap.net.nz>
Subject: Non-stop debugging and automatically stopping the target
Date: Thu, 10 Apr 2008 17:59:00 -0000	[thread overview]
Message-ID: <20080410141711.GA22694@caradoc.them.org> (raw)

This is a followup to Nick's backtrace patch of April 1st, which
temporarily stops the target to generate a backtrace.  It raises an
issue which Pedro and Volodya have also noticed, and I think we should
discuss it before we commit to any option.  The general issue is
this: should GDB implicitly stop the target?

For instance, consider memory reads.  Reading memory while the target
is running divides roughly into these types:

  - Can't do it.  GDB has to stop the target first.  Reading memory
    via ptrace is in this category.

  - Can do it, mildly intrusively (5ms - 10ms delay in execution).
    Some embedded debug interfaces are like this; the CPU is used to
    assist the debug interface, so while it's processing debug
    requests the target does not make progress.

  - Can do it, as long as some other thread is stopped.  Ptrace on a
    multi-threaded program is in this category, generally.  It doesn't
    matter which thread is stopped.

  - Can do it, pretty much transparently to the target.  Some embedded
    debug interfaces are like this; so is reading memory via /proc
    on a multi-processor Linux system.

Then of course there are race conditions.  Even if we can read memory
non-intrusively, we probably can't get a consistent snapshot of memory
for long enough to generate a backtrace; the current function will
return in the middle of the unwinding process.  So for backtrace, the
target is going to have to stop.

Under which of these conditions should we allow the user to say
"backtrace" or "x/x ADDR", and under which should we require the user
(or front end) to say "stop thread 3; backtrace; continue thread 3"?
I am a little worried about making backtrace always work even if it
has to pause the target; some targets should not be paused without
explicit request, if they're time sensitive.  Or maybe time-sensitive
should be a setting the user or front end has to make.

-- 
Daniel Jacobowitz
CodeSourcery


             reply	other threads:[~2008-04-10 14:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-10 17:59 Daniel Jacobowitz [this message]
2008-04-10 18:00 ` Joel Brobecker
2008-04-10 18:10   ` Daniel Jacobowitz
2008-04-10 18:24     ` Joel Brobecker

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=20080410141711.GA22694@caradoc.them.org \
    --to=drow@false.org \
    --cc=gdb@sourceware.org \
    --cc=nickrob@snap.net.nz \
    /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