mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 09:16:02 +02:00
[268470] CLI command ""monitor list processes" will not be used. -list-thread-groups is used instead.
This commit is contained in:
parent
739592300e
commit
e5674e350e
3 changed files with 5 additions and 169 deletions
|
@ -33,8 +33,6 @@ import org.eclipse.cdt.dsf.mi.service.IMIProcessDMContext;
|
|||
import org.eclipse.cdt.dsf.mi.service.IMIProcesses;
|
||||
import org.eclipse.cdt.dsf.mi.service.MIProcesses;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.MIInferiorProcess;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.commands.CLIMonitorListProcesses;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.output.CLIMonitorListProcessesInfo;
|
||||
import org.eclipse.cdt.dsf.service.DsfSession;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
|
@ -262,27 +260,11 @@ public class GDBProcesses extends MIProcesses {
|
|||
}
|
||||
rm.done();
|
||||
} else {
|
||||
// monitor list processes is only for remote session
|
||||
fGdb.queueCommand(
|
||||
new CLIMonitorListProcesses(dmc),
|
||||
new DataRequestMonitor<CLIMonitorListProcessesInfo>(getExecutor(), rm) {
|
||||
@Override
|
||||
protected void handleCompleted() {
|
||||
if (isSuccess()) {
|
||||
for (IProcessInfo procInfo : getData().getProcessList()) {
|
||||
fProcessNames.put(procInfo.getPid(), procInfo.getName());
|
||||
}
|
||||
rm.setData(makeProcessDMCs(controlDmc, getData().getProcessList()));
|
||||
} else {
|
||||
// The monitor list command is not supported.
|
||||
// Just return an empty list and let the caller deal with it.
|
||||
fProcessNames.clear();
|
||||
rm.setData(new IProcessDMContext[0]);
|
||||
}
|
||||
rm.done();
|
||||
}
|
||||
|
||||
});
|
||||
// Pre-GDB 7.0, there is no way to list processes on a remote host
|
||||
// Just return an empty list and let the caller deal with it.
|
||||
fProcessNames.clear();
|
||||
rm.setData(new IProcessDMContext[0]);
|
||||
rm.done();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008 Ericsson and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Ericsson - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.dsf.mi.service.command.commands;
|
||||
|
||||
|
||||
import org.eclipse.cdt.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.output.CLIMonitorListProcessesInfo;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
|
||||
|
||||
/**
|
||||
*
|
||||
* monitor list processes
|
||||
*
|
||||
* This command is not available in the current version of GDBServer. However it should
|
||||
* be available in the future.
|
||||
*
|
||||
*/
|
||||
public class CLIMonitorListProcesses extends CLICommand<CLIMonitorListProcessesInfo>
|
||||
{
|
||||
public CLIMonitorListProcesses(IDMContext ctx) {
|
||||
super(ctx, "monitor list processes"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
@Override
|
||||
public CLIMonitorListProcessesInfo getResult(MIOutput output) {
|
||||
return (CLIMonitorListProcessesInfo)getMIInfo(output);
|
||||
}
|
||||
|
||||
public MIInfo getMIInfo(MIOutput out) {
|
||||
MIInfo info = null;
|
||||
if (out != null) {
|
||||
info = new CLIMonitorListProcessesInfo(out);
|
||||
}
|
||||
return info;
|
||||
}
|
||||
}
|
|
@ -1,100 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2009 Ericsson and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Ericsson - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.mi.service.command.output;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.eclipse.cdt.core.IProcessInfo;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @" 26 N 0 N 32794 Idle 2 Http daemon\n"
|
||||
*/
|
||||
public class CLIMonitorListProcessesInfo extends MIInfo {
|
||||
|
||||
@Deprecated
|
||||
public class ProcessInfo implements IProcessInfo, Comparable<ProcessInfo> {
|
||||
int pid;
|
||||
String name;
|
||||
|
||||
public ProcessInfo(String pidString, String name) {
|
||||
try {
|
||||
pid = Integer.parseInt(pidString);
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public ProcessInfo(int pid, String name) {
|
||||
this.pid = pid;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.core.IProcessInfo#getName()
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.core.IProcessInfo#getPid()
|
||||
*/
|
||||
public int getPid() {
|
||||
return pid;
|
||||
}
|
||||
|
||||
public int compareTo(ProcessInfo other) {
|
||||
int nameCompare = getName().compareTo(other.getName());
|
||||
if (nameCompare != 0) return nameCompare;
|
||||
else return (getPid() < other.getPid()) ? -1 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
IProcessInfo[] fProcessList;
|
||||
|
||||
public CLIMonitorListProcessesInfo(MIOutput out) {
|
||||
super(out);
|
||||
parse();
|
||||
}
|
||||
|
||||
public IProcessInfo[] getProcessList() {
|
||||
return fProcessList;
|
||||
}
|
||||
|
||||
private void parse() {
|
||||
List<IProcessInfo> aList = new ArrayList<IProcessInfo>();
|
||||
if (isDone()) {
|
||||
MIOutput out = getMIOutput();
|
||||
MIOOBRecord[] oobs = out.getMIOOBRecords();
|
||||
for (int i = 0; i < oobs.length; i++) {
|
||||
if (oobs[i] instanceof MITargetStreamOutput) {
|
||||
MIStreamRecord cons = (MIStreamRecord) oobs[i];
|
||||
String str = cons.getString().trim();
|
||||
if (str.length() > 0) {
|
||||
// Parsing pattern of type @" 26 N 0 N 32794 Idle 2 Http daemon\n"
|
||||
Pattern pattern = Pattern.compile("(\\d*)\\s(Y|N)\\s*\\d*\\s(Y|N)\\s*\\d*\\s*\\D*\\s*\\d\\s(.*)", Pattern.MULTILINE); //$NON-NLS-1$
|
||||
Matcher matcher = pattern.matcher(str);
|
||||
if (matcher.find()) {
|
||||
ProcessInfo proc = new ProcessInfo(matcher.group(1), matcher.group(4));
|
||||
aList.add(proc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fProcessList = aList.toArray(new IProcessInfo[aList.size()]);
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue