Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Russell Shaw <rjshaw@netspace.net.au>
Cc: GDB <gdb@sources.redhat.com>
Subject: Re: fork()
Date: Thu, 31 Mar 2005 10:46:00 -0000	[thread overview]
Message-ID: <424BD5BE.1000800@netspace.net.au> (raw)
In-Reply-To: <424BC58A.3040603@codito.com>

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
    }



      parent reply	other threads:[~2005-03-31 10:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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       ` Russell Shaw [this message]

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=424BD5BE.1000800@netspace.net.au \
    --to=rjshaw@netspace.net.au \
    --cc=gdb@sources.redhat.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