public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* [RFC] multi-process gdb (forks, checkpoints)
@ 2005-11-28 23:16 Michael Snyder
  2005-11-29  6:01 ` Eli Zaretskii
  2005-11-30  1:58 ` Jim Blandy
  0 siblings, 2 replies; 6+ messages in thread
From: Michael Snyder @ 2005-11-28 23:16 UTC (permalink / raw)
  To: GDB Patches, gdb, drow, Eli Zaretskii

Folks, I'm pretty close to actually submitting this for approval;
this is (knock on wood) my last request for pre-review.

Instead of attaching a patch, I've checked this in on a branch:
msnyder-fork-checkpoint-branch.

This is, no kidding, gdb debugging multiple processes.
I've adapted it to work with the existing "follow-fork"
infrastructure, so that when a process forks, instead of
being forced to choose between debugging the parent or the
child, we can now debug both.  The user sets a mode flag,
and rather than detaching from one of the forks, gdb will
set it aside (in a ptrace-stopped state), and let you
return to debugging it later, switching back and forth
at will.

Daniel, it handles quit, kill, and inferior exit.
If one process exits and there's another available,
it just switches automatically (as it would with threads).

I've added a testcase, gdb.base/multi-forks.exp, which serves
to demonstrate the debugging of 16 forks at a time.

And of course checkpoint and restart are in there too.

Eli, I'll be working on documentation.  For the mean time,
the user interface looks like this:

	set/show detach-on-fork (on/off) [default on]
	info forks
	fork <n> [analogous to thread <n>]
	detach-fork <n>
	delete-fork <n> [and kill]

	checkpoint
	restart <n>
	info checkpoints
	delete-checkpoint <n>
	detach-checkpoint <n> [well...]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC] multi-process gdb (forks, checkpoints)
  2005-11-28 23:16 [RFC] multi-process gdb (forks, checkpoints) Michael Snyder
@ 2005-11-29  6:01 ` Eli Zaretskii
  2005-11-29 21:31   ` Michael Snyder
  2005-11-30  1:58 ` Jim Blandy
  1 sibling, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2005-11-29  6:01 UTC (permalink / raw)
  To: Michael Snyder; +Cc: gdb-patches, gdb

> Date: Mon, 28 Nov 2005 14:57:51 -0800
> From: Michael Snyder <msnyder@redhat.com>
> 
> This is, no kidding, gdb debugging multiple processes.

Wow!  Thanks!

> Eli, I'll be working on documentation.  For the mean time,
> the user interface looks like this:
> 
> 	set/show detach-on-fork (on/off) [default on]
> 	info forks
> 	fork <n> [analogous to thread <n>]
> 	detach-fork <n>
> 	delete-fork <n> [and kill]

I'd prefer that we use ``process'' instead of ``fork'' here.  That is,

    info processes
    process <n>  [assuming n is a PID]
    detach-process <n>
    delete-process <n>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC] multi-process gdb (forks, checkpoints)
  2005-11-29  6:01 ` Eli Zaretskii
@ 2005-11-29 21:31   ` Michael Snyder
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Snyder @ 2005-11-29 21:31 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb-patches, gdb

Eli Zaretskii wrote:
>>Date: Mon, 28 Nov 2005 14:57:51 -0800
>>From: Michael Snyder <msnyder@redhat.com>
>>
>>This is, no kidding, gdb debugging multiple processes.
> 
> 
> Wow!  Thanks!
> 
> 
>>Eli, I'll be working on documentation.  For the mean time,
>>the user interface looks like this:
>>
>>	set/show detach-on-fork (on/off) [default on]
>>	info forks
>>	fork <n> [analogous to thread <n>]
>>	detach-fork <n>
>>	delete-fork <n> [and kill]
> 
> 
> I'd prefer that we use ``process'' instead of ``fork'' here.  That is,
> 
>     info processes
>     process <n>  [assuming n is a PID]

Good idea.  But <n>, as written, is not a PID, it's a
small counting number (analogous to a breakpoint id or
thread id).

I've added the command "process <proc-id" on the branch,
but kept "fork <fork-id>" since its semantics is different
(and still useful).  "info processes" is problematic, since
there is already an "info proc" command.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC] multi-process gdb (forks, checkpoints)
  2005-11-28 23:16 [RFC] multi-process gdb (forks, checkpoints) Michael Snyder
  2005-11-29  6:01 ` Eli Zaretskii
@ 2005-11-30  1:58 ` Jim Blandy
  2005-11-30  2:30   ` Michael Snyder
  1 sibling, 1 reply; 6+ messages in thread
From: Jim Blandy @ 2005-11-30  1:58 UTC (permalink / raw)
  To: Michael Snyder; +Cc: GDB Patches, gdb, drow, Eli Zaretskii

What happens if we fork, and then one of the forks unloads or loads a
shared library?

We're really crippled by our symtab data structures.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC] multi-process gdb (forks, checkpoints)
  2005-11-30  1:58 ` Jim Blandy
@ 2005-11-30  2:30   ` Michael Snyder
  2005-11-30  4:21     ` Daniel Jacobowitz
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Snyder @ 2005-11-30  2:30 UTC (permalink / raw)
  To: Jim Blandy; +Cc: GDB Patches, gdb, drow, Eli Zaretskii

Jim Blandy wrote:
> What happens if we fork, and then one of the forks unloads or loads a
> shared library?
> 
> We're really crippled by our symtab data structures.

Hmmm... unload would be the bigger problem, I suppose.

I'd look at it this way -- this is really a subset of "debugging
separate processes".  The subset is, processes that share the same
symbol set.  What you suggest is crowding that boundary.   ;-)

We know that the set of programs that can be debugged this way
is prescribed.  Can't do multi-threaded programs, for instance.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC] multi-process gdb (forks, checkpoints)
  2005-11-30  2:30   ` Michael Snyder
@ 2005-11-30  4:21     ` Daniel Jacobowitz
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Jacobowitz @ 2005-11-30  4:21 UTC (permalink / raw)
  To: Michael Snyder; +Cc: Jim Blandy, GDB Patches, gdb, Eli Zaretskii

On Tue, Nov 29, 2005 at 05:58:43PM -0800, Michael Snyder wrote:
> Jim Blandy wrote:
> >What happens if we fork, and then one of the forks unloads or loads a
> >shared library?
> >
> >We're really crippled by our symtab data structures.
> 
> Hmmm... unload would be the bigger problem, I suppose.

Yes.  Eventually we just need to improve the symtab interface enough to
permit this.  I think it's not an unreachable goal.  The user interface
is going to get thornier and thornier, though.

> I'd look at it this way -- this is really a subset of "debugging
> separate processes".  The subset is, processes that share the same
> symbol set.  What you suggest is crowding that boundary.   ;-)
> 
> We know that the set of programs that can be debugged this way
> is prescribed.  Can't do multi-threaded programs, for instance.

Right - we can't duplicate them - we could more or less fake it, but
they know too much about their TIDs, and their TLS, et cetera.

-- 
Daniel Jacobowitz
CodeSourcery, LLC

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-11-30  2:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-28 23:16 [RFC] multi-process gdb (forks, checkpoints) Michael Snyder
2005-11-29  6:01 ` Eli Zaretskii
2005-11-29 21:31   ` Michael Snyder
2005-11-30  1:58 ` Jim Blandy
2005-11-30  2:30   ` Michael Snyder
2005-11-30  4:21     ` Daniel Jacobowitz

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).