Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 370375 - [attach] List of processes returned by GDB 7.4 is not parsed properly
Summary: [attach] List of processes returned by GDB 7.4 is not parsed properly
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-dsf-gdb (show other bugs)
Version: 8.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 8.1.0   Edit
Assignee: Marc Khouzam CLA
QA Contact: Marc Khouzam CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-01 16:09 EST by Marc Khouzam CLA
Modified: 2012-02-29 13:23 EST (History)
2 users (show)

See Also:


Attachments
Screenshot of truncated output (25.39 KB, image/png)
2012-02-01 16:09 EST, Marc Khouzam CLA
no flags Details
Better parsing for new output from GDB 7.4 (3.51 KB, patch)
2012-02-02 14:32 EST, Marc Khouzam CLA
marc.khouzam: iplog-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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