This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: fork()


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
   }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]