1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Bug 333034 - Select Processes dialog shows command line arguments

This change adds command line arguments to the information listed in the
"Select Processes" dialog, seen e.g. when attaching to a C++ application
to debug.

Change-Id: I18ab685f73cb1c16ed3ea935872f49afa1de9aab
Signed-off-by: Simeon Andreev <simeon.danailov.andreev@gmail.com>
This commit is contained in:
Simeon Andreev 2018-09-07 12:40:38 +02:00 committed by Jonah Graham
parent 74eb81b0bb
commit 094543644b
7 changed files with 76 additions and 7 deletions

View file

@ -19,6 +19,7 @@ public class ProcessInfo implements IProcessExtendedInfo, Comparable<ProcessInfo
private final String name;
private final String[] cores;
private final String ownerId;
private final String description;
public ProcessInfo(int pid, String name) {
this(pid, name, null, null);
@ -26,11 +27,20 @@ public class ProcessInfo implements IProcessExtendedInfo, Comparable<ProcessInfo
/** @since 2.2 */
public ProcessInfo(int pid, String name, String[] cores, String owner) {
this(pid, name, cores, owner, null);
}
/**
* @since 2.6
*/
public ProcessInfo(int pid, String name, String[] cores, String owner, String description) {
this.pid = pid;
this.name = name;
this.cores = cores;
this.ownerId = owner;
this.description = description;
}
@Override
public String getName() {
@ -51,7 +61,12 @@ public class ProcessInfo implements IProcessExtendedInfo, Comparable<ProcessInfo
public String getOwner() {
return ownerId;
}
@Override
public String getDescription() {
return description;
}
/**
* Sort by name, then by pid.
* No need to sort any further since pids are unique.

View file

@ -52,6 +52,7 @@ import org.eclipse.cdt.dsf.gdb.launching.LaunchMessages;
import org.eclipse.cdt.dsf.gdb.service.IGDBBackend;
import org.eclipse.cdt.dsf.gdb.service.IGDBProcesses;
import org.eclipse.cdt.dsf.gdb.service.IGDBProcesses.IGdbThreadDMData;
import org.eclipse.cdt.dsf.gdb.service.IGDBProcesses.IGdbThreadDMData2;
import org.eclipse.cdt.dsf.gdb.service.SessionType;
import org.eclipse.cdt.dsf.mi.service.IMIProcessDMContext;
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
@ -447,7 +448,11 @@ public class GdbConnectCommand extends RefreshableDebugCommand implements IConne
cores = ((IGdbThreadDMData)processData).getCores();
owner = ((IGdbThreadDMData)processData).getOwner();
}
procInfoList.add(new ProcessInfo(pid, processData.getName(), cores, owner));
String description = null;
if (processData instanceof IGdbThreadDMData2) {
description = ((IGdbThreadDMData2)processData).getDescription();
}
procInfoList.add(new ProcessInfo(pid, processData.getName(), cores, owner, description));
}
// Re-use the counting monitor and trigger it right away.
@ -484,7 +489,11 @@ public class GdbConnectCommand extends RefreshableDebugCommand implements IConne
cores = ((IGdbThreadDMData)processData).getCores();
owner = ((IGdbThreadDMData)processData).getOwner();
}
procInfoList.add(new ProcessInfo(pid, processData.getName(), cores, owner));
String description = null;
if (processData instanceof IGdbThreadDMData2) {
description = ((IGdbThreadDMData2)processData).getDescription();
}
procInfoList.add(new ProcessInfo(pid, processData.getName(), cores, owner, description));
countingRm.done();
}
});

View file

@ -133,6 +133,11 @@ public class ProcessPrompter implements IStatusHandler {
text.replace(text.length()-2, text.length(), "]"); //$NON-NLS-1$
}
String description = info.getDescription();
if (description != null) {
text.append(" : " + description); //$NON-NLS-1$
}
return text.toString();
}
@ -145,6 +150,10 @@ public class ProcessPrompter implements IStatusHandler {
@Override
public String getText(Object element) {
IProcessExtendedInfo info = (IProcessExtendedInfo)element;
String description = info.getDescription();
if (description != null) {
return description;
}
return info.getName();
}

View file

@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.cdt.dsf.gdb;singleton:=true
Bundle-Version: 5.5.0.qualifier
Bundle-Version: 5.6.0.qualifier
Bundle-Activator: org.eclipse.cdt.dsf.gdb.internal.GdbPlugin
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime,

View file

@ -44,4 +44,11 @@ public interface IProcessExtendedInfo {
* information is not available.
*/
public String getOwner();
/**
* @return The description of this process, i.e. the program and
* its arguments, or null if not available.
* @since 5.6
*/
public String getDescription();
}

View file

@ -477,18 +477,28 @@ public class GDBProcesses_7_0 extends AbstractDsfService
* @since 4.0
*/
@Immutable
protected static class MIProcessDMCAndData extends MIProcessDMC implements IGdbThreadDMData {
protected static class MIProcessDMCAndData extends MIProcessDMC implements IGdbThreadDMData2 {
final String fName;
// Note that cores are only available from GDB 7.1.
final String[] fCores;
final String fOwner;
final String fDescription;
public MIProcessDMCAndData(String sessionId, ICommandControlDMContext controlDmc,
String id, String name, String[] cores, String owner) {
this(sessionId, controlDmc, id, name, cores, owner, null);
}
/**
* @since 5.6
*/
public MIProcessDMCAndData(String sessionId, ICommandControlDMContext controlDmc,
String id, String name, String[] cores, String owner, String description) {
super(sessionId, controlDmc, id);
fName = name;
fCores = cores;
fOwner = owner;
fDescription = description;
}
@Override
@ -497,6 +507,9 @@ public class GDBProcesses_7_0 extends AbstractDsfService
@Override
public String getName() { return fName; }
@Override
public String getDescription() { return fDescription; }
@Override
public boolean isDebuggerAttached() {
return true;
@ -1587,7 +1600,8 @@ public class GDBProcesses_7_0 extends AbstractDsfService
process.getGroupId(),
process.getName(),
process.getCores(),
process.getUser());
process.getUser(),
process.getDesciption());
}
return procDmcs;
}

View file

@ -54,7 +54,22 @@ public interface IGDBProcesses extends IMIProcesses {
*/
String getOwner();
}
/**
* This interface extends the {@link IGdbThreadDMData} to provide a description
* for a process or thread.
*
* @since 5.6
*/
public interface IGdbThreadDMData2 extends IGdbThreadDMData {
/**
* @return The description for this process or thread. Usually
* the program and its arguments.
*/
String getDescription();
}
/**
* This interface describes an exited thread/process.
*