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

Bug 370375

Summary: [attach] List of processes returned by GDB 7.4 is not parsed properly
Product: [Tools] CDT Reporter: Marc Khouzam <marc.khouzam>
Component: cdt-debug-dsf-gdbAssignee: Marc Khouzam <marc.khouzam>
Status: RESOLVED FIXED QA Contact: Marc Khouzam <marc.khouzam>
Severity: normal    
Priority: P3 CC: cdtdoug, pawel.1.piech
Version: 8.0   
Target Milestone: 8.1.0   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Screenshot of truncated output
none
Better parsing for new output from GDB 7.4 marc.khouzam: iplog-

Description Marc Khouzam CLA 2012-02-01 16:09:42 EST
Created attachment 210401 [details]
Screenshot of truncated output

GDB 7.4 seems to have a slightly different output for the result of "-list-thread-groups --available".  We use this command to list all processes in the connect dialog.

The difference is that now processes that were not being reported before are, and may contain a '/' in them:
{id="4",type="process",description="[ksoftirqd/0]",user="root",cores=["0"]}

My guess is that we don't parse the / properly and we get some truncated results as shown in the attached screenshot.
Comment 1 Marc Khouzam CLA 2012-02-02 14:32:02 EST
Created attachment 210471 [details]
Better parsing for new output from GDB 7.4

It turns out that the name of the form [ksoftirqd/0] mimics the linux ps program, and indicates that the cmd line arguments of the program are not known.  The /0 means that instance is running on core 0.

This patch removes the wrapping [] and removes the /coreNum pattern to extract the actual name of the process.
Comment 2 Marc Khouzam CLA 2012-02-02 14:34:50 EST
Oh, and the patch also handles the case where where we don't use -list-thread-groups --available and have to fall back to 
  CCorePlugin.getDefault().getProcessList(); 
This call returns the process and include its arguments.  If the arguments contain a / we would think we were dealing with a path, and truncate it.

This can be easily reproduced by doing a local attach session using GDB 6.8.

The patch removes the arguments of the process entry before truncating the path.
Comment 3 Marc Khouzam CLA 2012-02-02 15:07:52 EST
Committed to master
Comment 4 CDT Genie CLA 2012-02-29 13:23:36 EST
*** cdt git genie on behalf of Marc Khouzam ***

    Bug 370375: [attach] List of processes returned by GDB 7.4 is not parsed properly

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=d2ba7a5b346d568eb26a84666b15c2a944dea8fc
*** cdt git genie on behalf of Marc Khouzam ***

    Bug 370375: [attach] List of processes returned by GDB 7.4 is not parsed properly

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=d2ba7a5b346d568eb26a84666b15c2a944dea8fc