Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 361942

Summary: C/C++ Remote Application and multiprocess debugging
Product: [Tools] CDT Reporter: Mark <mark.wehner>
Component: cdt-debug-dsf-gdbAssignee: Project Inbox <cdt-debug-dsf-gdb-inbox>
Status: CLOSED NOT_ECLIPSE QA Contact: Marc Khouzam <marc.khouzam>
Severity: normal    
Priority: P3 CC: cdtdoug, pawel.1.piech
Version: 8.0   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Mark CLA 2011-10-25 11:26:45 EDT
Build Identifier: 20110916-0149

I use Eclipse Indigo Service Release 1 with gdb version 7.3.1. Gdb is running on a x86_64 linux system and the gdbserver on a mips processor with kernel 2.6.32.

I try to debug the following simple program, which uses the fork command to create a child process:

#include <unistd.h>
#include <stdio.h>

int main()
{
  pid_t  pid;

  pid = fork();
  if (pid == 0)
    {
      while(1)
      {
    	  sleep(5);
    	  printf("Child process is running!\n");
      }
    }
  else
    {
       while(1)
       {
	  sleep(5);
	  printf("Parent process is running!\n");
       }
    }
  return 0;
}

The debugger options "automatically debug forked process" and "Non-stop mode" are set. However, the debugger only lunches the parent process. So I suppose it is a bug. 

Mark

Reproducible: Always
Comment 1 Marc Khouzam CLA 2011-11-03 21:09:43 EDT
The C/C++ Remote Application launch does not support multi-process.  We probably should not have the "automatically debug forked process" option in that case.

You should use the C/C++ Attach to Application launch instead and use the 'gdbserver' debugger in the Debugger tab.  The difference is that with this launch, you will connect to a running process on your target, instead of starting a new one.

This limitation is due to the fact that gdbserver only supports multi-process in the extended-remote mode which is used in C/C++ Attach to Application but not the C/C++ Remote Application Launch.