Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* debugging a program which spawns multiple children
@ 2018-02-13  1:19 Christian Groessler
  2018-02-13  1:21 ` Christian Groessler
  2018-02-13  1:24 ` Simon Marchi
  0 siblings, 2 replies; 6+ messages in thread
From: Christian Groessler @ 2018-02-13  1:19 UTC (permalink / raw)
  To: gdb

Hi,

I'm trying to debug a problem in FreeBSD's "dump" command. The dump 
command creates 4 or 5 child processes,
and in my use case one of them gets a SIGSEGV.

Is it possible to monitor all spawned processes simultaneously? I'm 
currently using gdb version 7.12.1 from the FreeBSD ports.
I would have to problem to use a newer version of gdb and compile it 
locally.

regards,
chris


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

* Re: debugging a program which spawns multiple children
  2018-02-13  1:19 debugging a program which spawns multiple children Christian Groessler
@ 2018-02-13  1:21 ` Christian Groessler
  2018-02-13  1:24 ` Simon Marchi
  1 sibling, 0 replies; 6+ messages in thread
From: Christian Groessler @ 2018-02-13  1:21 UTC (permalink / raw)
  To: gdb

On 02/13/18 02:19, Christian Groessler wrote:
> I would have to problem to use a newer version of gdb and compile it 
> locally.


"I would have no problem ...."


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

* Re: debugging a program which spawns multiple children
  2018-02-13  1:19 debugging a program which spawns multiple children Christian Groessler
  2018-02-13  1:21 ` Christian Groessler
@ 2018-02-13  1:24 ` Simon Marchi
  2018-02-15 23:16   ` John Baldwin
  1 sibling, 1 reply; 6+ messages in thread
From: Simon Marchi @ 2018-02-13  1:24 UTC (permalink / raw)
  To: Christian Groessler, gdb; +Cc: John Baldwin

On 2018-02-12 08:19 PM, Christian Groessler wrote:
> Hi,
> 
> I'm trying to debug a problem in FreeBSD's "dump" command. The dump 
> command creates 4 or 5 child processes,
> and in my use case one of them gets a SIGSEGV.
> 
> Is it possible to monitor all spawned processes simultaneously? I'm 
> currently using gdb version 7.12.1 from the FreeBSD ports.
> I would have to problem to use a newer version of gdb and compile it 
> locally.
> 
> regards,
> chris
> 

Hi Christian,

If GDB for FreeBSD supports it, you can keep debugging the parent process as
well as child processes by using "set detach-on-fork off".  John (in CC) may
give more info about the support for multi process debugging with FreeBSD.

You might want to read more about the "all-stop" vs "non-stop" modes in the GDB
documentation and their related settings.

Simon


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

* Re: debugging a program which spawns multiple children
  2018-02-13  1:24 ` Simon Marchi
@ 2018-02-15 23:16   ` John Baldwin
  2018-02-16 11:34     ` Christian Groessler
  0 siblings, 1 reply; 6+ messages in thread
From: John Baldwin @ 2018-02-15 23:16 UTC (permalink / raw)
  To: Simon Marchi; +Cc: Christian Groessler, gdb

On Monday, February 12, 2018 08:24:32 PM Simon Marchi wrote:
> On 2018-02-12 08:19 PM, Christian Groessler wrote:
> > Hi,
> > 
> > I'm trying to debug a problem in FreeBSD's "dump" command. The dump 
> > command creates 4 or 5 child processes,
> > and in my use case one of them gets a SIGSEGV.
> > 
> > Is it possible to monitor all spawned processes simultaneously? I'm 
> > currently using gdb version 7.12.1 from the FreeBSD ports.
> > I would have to problem to use a newer version of gdb and compile it 
> > locally.
> > 
> > regards,
> > chris
> > 
> 
> Hi Christian,
> 
> If GDB for FreeBSD supports it, you can keep debugging the parent process as
> well as child processes by using "set detach-on-fork off".  John (in CC) may
> give more info about the support for multi process debugging with FreeBSD.

GDB 7.12.1 from ports should support fork following as Simon noted, but that
does only work on FreeBSD versions 9.1 and later.

> You might want to read more about the "all-stop" vs "non-stop" modes in the GDB
> documentation and their related settings.

The FreeBSD native target only supports "all-stop" mode currently.

-- 
John Baldwin


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

* Re: debugging a program which spawns multiple children
  2018-02-15 23:16   ` John Baldwin
@ 2018-02-16 11:34     ` Christian Groessler
  2018-02-21  1:33       ` John Baldwin
  0 siblings, 1 reply; 6+ messages in thread
From: Christian Groessler @ 2018-02-16 11:34 UTC (permalink / raw)
  To: John Baldwin; +Cc: Simon Marchi, gdb

On 02/15/18 20:54, John Baldwin wrote:
> On Monday, February 12, 2018 08:24:32 PM Simon Marchi wrote:
>> On 2018-02-12 08:19 PM, Christian Groessler wrote:
>>> Hi,
>>>
>>> I'm trying to debug a problem in FreeBSD's "dump" command. The dump
>>> command creates 4 or 5 child processes,
>>> and in my use case one of them gets a SIGSEGV.
>>>
>>> Is it possible to monitor all spawned processes simultaneously? I'm
>>> currently using gdb version 7.12.1 from the FreeBSD ports.
>>> I would have to problem to use a newer version of gdb and compile it
>>> locally.
>>>
>>> regards,
>>> chris
>>>
>> Hi Christian,
>>
>> If GDB for FreeBSD supports it, you can keep debugging the parent process as
>> well as child processes by using "set detach-on-fork off".  John (in CC) may
>> give more info about the support for multi process debugging with FreeBSD.
> GDB 7.12.1 from ports should support fork following as Simon noted, but that
> does only work on FreeBSD versions 9.1 and later.


I have 7.12.1 already installed and am using FreeBSD 10.3. I haven't had
time to try this gdb version it out yet...


>
>> You might want to read more about the "all-stop" vs "non-stop" modes in the GDB
>> documentation and their related settings.
> The FreeBSD native target only supports "all-stop" mode currently.


That should be enough. In fact, I want everything to stop when the first
SIGSEGV happens...


Thanks,
chris


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

* Re: debugging a program which spawns multiple children
  2018-02-16 11:34     ` Christian Groessler
@ 2018-02-21  1:33       ` John Baldwin
  0 siblings, 0 replies; 6+ messages in thread
From: John Baldwin @ 2018-02-21  1:33 UTC (permalink / raw)
  To: gdb; +Cc: Christian Groessler, Simon Marchi

On Friday, February 16, 2018 12:34:19 PM Christian Groessler wrote:
> On 02/15/18 20:54, John Baldwin wrote:
> > On Monday, February 12, 2018 08:24:32 PM Simon Marchi wrote:
> >> On 2018-02-12 08:19 PM, Christian Groessler wrote:
> >>> Hi,
> >>>
> >>> I'm trying to debug a problem in FreeBSD's "dump" command. The dump
> >>> command creates 4 or 5 child processes,
> >>> and in my use case one of them gets a SIGSEGV.
> >>>
> >>> Is it possible to monitor all spawned processes simultaneously? I'm
> >>> currently using gdb version 7.12.1 from the FreeBSD ports.
> >>> I would have to problem to use a newer version of gdb and compile it
> >>> locally.
> >>>
> >>> regards,
> >>> chris
> >>>
> >> Hi Christian,
> >>
> >> If GDB for FreeBSD supports it, you can keep debugging the parent process as
> >> well as child processes by using "set detach-on-fork off".  John (in CC) may
> >> give more info about the support for multi process debugging with FreeBSD.
> > GDB 7.12.1 from ports should support fork following as Simon noted, but that
> > does only work on FreeBSD versions 9.1 and later.
> 
> 
> I have 7.12.1 already installed and am using FreeBSD 10.3. I haven't had
> time to try this gdb version it out yet...

As Simon suggested, 'set detach-on-fork off' should work.  Note that it won't
prevent processes from exiting while you are in the debugger unless you are
setting some kind of breakpoint in the exit path.  If you just want to stop in
a process when it hits a SIGSEGV and don't mind that other processes are still
running and/or exited I think detach-on-fork is all you need.

-- 
John Baldwin


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

end of thread, other threads:[~2018-02-21  1:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-13  1:19 debugging a program which spawns multiple children Christian Groessler
2018-02-13  1:21 ` Christian Groessler
2018-02-13  1:24 ` Simon Marchi
2018-02-15 23:16   ` John Baldwin
2018-02-16 11:34     ` Christian Groessler
2018-02-21  1:33       ` John Baldwin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox