mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Bug 370375: [attach] List of processes returned by GDB 7.4 is not parsed properly
This commit is contained in:
parent
ce342ee755
commit
d2ba7a5b34
2 changed files with 34 additions and 3 deletions
|
@ -91,7 +91,15 @@ public class ProcessPrompter implements IStatusHandler {
|
|||
@Override
|
||||
public String getText(Object element) {
|
||||
IProcessExtendedInfo info = (IProcessExtendedInfo)element;
|
||||
IPath path = new Path(info.getName());
|
||||
// Sometimes, if we are not getting the list of processes from GDB,
|
||||
// we use CCorePlugin.getDefault().getProcessList(); which returns
|
||||
// the process and its arguments. If the arguments contain a /
|
||||
// we will get confused when using path.lastSegment(), so,
|
||||
// let's only keep the name to be sure
|
||||
String name = info.getName();
|
||||
name = name.split("\\s", 2)[0]; //$NON-NLS-1$
|
||||
|
||||
IPath path = new Path(name);
|
||||
StringBuffer text = new StringBuffer(path.lastSegment());
|
||||
|
||||
String owner = info.getOwner();
|
||||
|
|
|
@ -232,8 +232,31 @@ public class MIListThreadGroupsInfo extends MIInfo {
|
|||
name = matcher.group(1);
|
||||
} else {
|
||||
// If we didn't get the form "name: " then we expect to have the form
|
||||
// "/usr/sbin/dhcdbd --system"
|
||||
name = desc.split("\\s", 2)[0]; //$NON-NLS-1$
|
||||
// "/usr/sbin/dhcdbd --system"
|
||||
// or (starting with GDB 7.4)
|
||||
// "[migration/0]" where the integer represents the core, if the process
|
||||
// has an instance of many cores
|
||||
// "[kacpid]" when the process only runs on one core
|
||||
// "[async/mgr]"
|
||||
// "[jbd2/dm-1-8]"
|
||||
// The brackets indicate that the startup parameters are not available
|
||||
// We handle this case by removing the brackets and the core indicator
|
||||
// since GDB already tells us the core separately.
|
||||
if (desc.length() > 0 && desc.charAt(0) == '[') {
|
||||
// Remove brackets
|
||||
name = desc.substring(1, desc.length()-1);
|
||||
|
||||
// Look for [name/coreNum] pattern to remove /coreNum
|
||||
pattern = Pattern.compile("(.+?)(/\\d+)", Pattern.MULTILINE); //$NON-NLS-1$
|
||||
matcher = pattern.matcher(name);
|
||||
if (matcher.find()) {
|
||||
// Found a pattern /coreNum, so ignore it
|
||||
name = matcher.group(1);
|
||||
}
|
||||
// else, no /coreNum pattern, so the name is correct already
|
||||
} else {
|
||||
name = desc.split("\\s", 2)[0]; //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
return name;
|
||||
|
|
Loading…
Add table
Reference in a new issue