Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* fork()
@ 2005-03-31  6:00 Russell Shaw
  2005-03-31  9:11 ` fork() Siddharth Choudhary Kode
  0 siblings, 1 reply; 6+ messages in thread
From: Russell Shaw @ 2005-03-31  6:00 UTC (permalink / raw)
  To: GDB

Hi,

I was debugging a program with gdb-6.3 and did: set follow-fork-mode child

but fork() still returns the PID meaning that it is still following the parent.


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

* Re: fork()
  2005-03-31  6:00 fork() Russell Shaw
@ 2005-03-31  9:11 ` Siddharth Choudhary Kode
  2005-03-31  9:31   ` fork() Russell Shaw
  0 siblings, 1 reply; 6+ messages in thread
From: Siddharth Choudhary Kode @ 2005-03-31  9:11 UTC (permalink / raw)
  To: Russell Shaw; +Cc: GDB

Check the info doc, sec. 4.10.  This is only supported on GNU/Linux 
2.5.60+ and HP-UX 11.x+.  If your platform doesn't support it, the best 
option is to insert a sleep() statement at the beginning of your child 
code and then have a new gdb session attach to the child process before 
the sleep expires.

On Thu, 31 Mar 2005, Russell Shaw wrote:

> Hi,
>
> I was debugging a program with gdb-6.3 and did: set follow-fork-mode child
>
> but fork() still returns the PID meaning that it is still following the 
> parent.
>


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

* Re: fork()
  2005-03-31  9:11 ` fork() Siddharth Choudhary Kode
@ 2005-03-31  9:31   ` Russell Shaw
  2005-03-31  9:41     ` fork() Ramana Radhakrishnan
  0 siblings, 1 reply; 6+ messages in thread
From: Russell Shaw @ 2005-03-31  9:31 UTC (permalink / raw)
  Cc: GDB

Siddharth Choudhary Kode wrote:
> Check the info doc, sec. 4.10.  This is only supported on GNU/Linux 
> 2.5.60+ and HP-UX 11.x+.  If your platform doesn't support it, the best 
> option is to insert a sleep() statement at the beginning of your child 
> code and then have a new gdb session attach to the child process before 
> the sleep expires.

Hi,
I'm using 2.6.10 on debian sid.

> On Thu, 31 Mar 2005, Russell Shaw wrote:
> 
>> Hi,
>>
>> I was debugging a program with gdb-6.3 and did: set follow-fork-mode 
>> child
>>
>> but fork() still returns the PID meaning that it is still following 
>> the parent.
>>
> 


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

* Re: fork()
  2005-03-31  9:31   ` fork() Russell Shaw
@ 2005-03-31  9:41     ` Ramana Radhakrishnan
  2005-03-31 10:44       ` fork() Russell Shaw
  2005-03-31 10:46       ` fork() Russell Shaw
  0 siblings, 2 replies; 6+ messages in thread
From: Ramana Radhakrishnan @ 2005-03-31  9:41 UTC (permalink / raw)
  To: Russell Shaw; +Cc: GDB

Russell Shaw wrote:
> Siddharth Choudhary Kode wrote:
> 
>> Check the info doc, sec. 4.10.  This is only supported on GNU/Linux 
>> 2.5.60+ and HP-UX 11.x+.  If your platform doesn't support it, the 
>> best option is to insert a sleep() statement at the beginning of your 
>> child code and then have a new gdb session attach to the child process 
>> before the sleep expires.
> 
> 
> Hi,
> I'm using 2.6.10 on debian sid.
> 
>> On Thu, 31 Mar 2005, Russell Shaw wrote:
>>
>>> Hi,
>>>
>>> I was debugging a program with gdb-6.3 and did: set follow-fork-mode 
>>> child
>>>
>>> but fork() still returns the PID meaning that it is still following 
>>> the parent.

Can you show the context in which you are getting this ?

>>>
>>


-- 
Ramana Radhakrishnan
GNU Tools
codito ergo sum (www.codito.com)


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

* Re: fork()
  2005-03-31  9:41     ` fork() Ramana Radhakrishnan
@ 2005-03-31 10:44       ` Russell Shaw
  2005-03-31 10:46       ` fork() Russell Shaw
  1 sibling, 0 replies; 6+ messages in thread
From: Russell Shaw @ 2005-03-31 10:44 UTC (permalink / raw)
  Cc: GDB

Ramana Radhakrishnan wrote:
> Russell Shaw wrote:
> 
>> Siddharth Choudhary Kode wrote:
>>
>>> Check the info doc, sec. 4.10.  This is only supported on GNU/Linux 
>>> 2.5.60+ and HP-UX 11.x+.  If your platform doesn't support it, the 
>>> best option is to insert a sleep() statement at the beginning of your 
>>> child code and then have a new gdb session attach to the child 
>>> process before the sleep expires.
>>
>>
>>
>> Hi,
>> I'm using 2.6.10 on debian sid.
>>
>>> On Thu, 31 Mar 2005, Russell Shaw wrote:
>>>
>>>> Hi,
>>>>
>>>> I was debugging a program with gdb-6.3 and did: set follow-fork-mode 
>>>> child but fork() still returns the PID meaning that it is still following 
>>>> the parent.
> 
> Can you show the context in which you are getting this ?

I was debugging ttink (a utility for monitoring epson printers). It doesn't matter
much now because i found a different utilty.

cmd.c:

/* no server, create the shared memory   */
    /* and the sub process for port /dev/... */
    if ( pid == -1 && ! connectedOnServer )
    {
       *shmem->function    = '\0';
       shmem->printerState = 4;
       shmem->mode         = mode;
       shmem->command      = command;
       shmem->pass         = pass;
       shmem->choice       = choice;
       *shmem->buf         = '\0';
       shmem->ready        = 0;

       switch((pid=fork()))               <<<-------------------- here
       {
          case 0:
             doCommands(NULL);
             break;
          case -1:
          break;
          default:
             /* allow to react on child dead */
             signal(SIGCHLD, sigChild);
       }
#endif
    }


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

* Re: fork()
  2005-03-31  9:41     ` fork() Ramana Radhakrishnan
  2005-03-31 10:44       ` fork() Russell Shaw
@ 2005-03-31 10:46       ` Russell Shaw
  1 sibling, 0 replies; 6+ messages in thread
From: Russell Shaw @ 2005-03-31 10:46 UTC (permalink / raw)
  Cc: GDB

Ramana Radhakrishnan wrote:
> Russell Shaw wrote:
> 
>> Siddharth Choudhary Kode wrote:
>>
>>> Check the info doc, sec. 4.10.  This is only supported on GNU/Linux 
>>> 2.5.60+ and HP-UX 11.x+.  If your platform doesn't support it, the 
>>> best option is to insert a sleep() statement at the beginning of your 
>>> child code and then have a new gdb session attach to the child 
>>> process before the sleep expires.
>>
>>
>>
>> Hi,
>> I'm using 2.6.10 on debian sid.
>>
>>> On Thu, 31 Mar 2005, Russell Shaw wrote:
>>>
>>>> Hi,
>>>>
>>>> I was debugging a program with gdb-6.3 and did: set follow-fork-mode 
>>>> child but fork() still returns the PID meaning that it is still following 
>>>> the parent.
> 
> Can you show the context in which you are getting this ?

I was debugging ttink (a utility for monitoring epson printers). It doesn't matter
much now because i found a different utilty.

I compiled it from source with gcc-3.4.4, using CFLAGS= -g -O0.

cmd.c:


/* no server, create the shared memory   */
    /* and the sub process for port /dev/... */
    if ( pid == -1 && ! connectedOnServer )
    {
       *shmem->function    = '\0';
       shmem->printerState = 4;
       shmem->mode         = mode;
       shmem->command      = command;
       shmem->pass         = pass;
       shmem->choice       = choice;
       *shmem->buf         = '\0';
       shmem->ready        = 0;

       switch((pid=fork()))               <<<-------------------- here
       {
          case 0:
             doCommands(NULL);
             break;
          case -1:
          break;
          default:
             /* allow to react on child dead */
             signal(SIGCHLD, sigChild);
       }
#endif
    }



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

end of thread, other threads:[~2005-03-31 10:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-31  6:00 fork() Russell Shaw
2005-03-31  9:11 ` fork() Siddharth Choudhary Kode
2005-03-31  9:31   ` fork() Russell Shaw
2005-03-31  9:41     ` fork() Ramana Radhakrishnan
2005-03-31 10:44       ` fork() Russell Shaw
2005-03-31 10:46       ` fork() Russell Shaw

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