mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-05 08:46:02 +02:00
Added Event dispatching for the MI parser.
This commit is contained in:
parent
fb8ec5c2d4
commit
385d59ed68
27 changed files with 824 additions and 99 deletions
|
@ -2,6 +2,7 @@ package org.eclipse.cdt.debug.mi.core;
|
|||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Observable;
|
||||
|
||||
import org.eclipse.cdt.debug.mi.core.command.Command;
|
||||
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
||||
|
@ -11,7 +12,7 @@ import org.eclipse.cdt.debug.mi.core.output.MIParser;
|
|||
|
||||
/**
|
||||
*/
|
||||
public class MISession {
|
||||
public class MISession extends Observable {
|
||||
|
||||
InputStream inChannel;
|
||||
OutputStream outChannel;
|
||||
|
@ -30,6 +31,12 @@ public class MISession {
|
|||
|
||||
MIParser parser;
|
||||
|
||||
long cmdTimeout = 0000; // 20 * 1000 (~ 20 secs);
|
||||
|
||||
final int STOPPED = 0;
|
||||
final int RUNNING = 1;
|
||||
int state = STOPPED;
|
||||
|
||||
/**
|
||||
* The constructor.
|
||||
*/
|
||||
|
@ -95,20 +102,63 @@ public class MISession {
|
|||
parser = p;
|
||||
}
|
||||
|
||||
/**
|
||||
* postCommand(cmd, 20 secs)
|
||||
*/
|
||||
public void postCommand(Command cmd) throws MIException {
|
||||
postCommand(cmd, cmdTimeout);
|
||||
}
|
||||
|
||||
public void setCommandTimeout(long timeout) {
|
||||
cmdTimeout = timeout;
|
||||
}
|
||||
|
||||
public long getCommandTimeout() {
|
||||
return cmdTimeout;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void postCommand(Command cmd) {
|
||||
public void postCommand(Command cmd, long timeout) throws MIException {
|
||||
|
||||
if (!txThread.isAlive()) {
|
||||
throw new MIException("TxThread terminated");
|
||||
}
|
||||
txQueue.addCommand(cmd);
|
||||
synchronized (cmd) {
|
||||
try {
|
||||
// FIXME: missing the predicate
|
||||
cmd.wait();
|
||||
} catch (InterruptedException e) {
|
||||
// RxThread will set the MIOutput on the cmd
|
||||
// when the response arrive.
|
||||
while (cmd.getMIOutput() == null) {
|
||||
try {
|
||||
cmd.wait(timeout);
|
||||
break; // Timeout or Notify
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isStopped() {
|
||||
return state == STOPPED;
|
||||
}
|
||||
|
||||
public boolean isRunning() {
|
||||
return state == RUNNING;
|
||||
}
|
||||
|
||||
void setStopped() {
|
||||
state = STOPPED;
|
||||
}
|
||||
|
||||
void setRunning() {
|
||||
state = RUNNING;
|
||||
}
|
||||
|
||||
public void setDirty() {
|
||||
setChanged();
|
||||
}
|
||||
|
||||
Queue getTxQueue() {
|
||||
return txQueue;
|
||||
}
|
||||
|
|
|
@ -3,12 +3,25 @@ package org.eclipse.cdt.debug.mi.core;
|
|||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.debug.mi.core.command.Command;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIAsyncRecord;
|
||||
import org.eclipse.cdt.debug.mi.core.event.EventThread;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIBreakpointEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIExitEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIFunctionFinishedEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MISignalEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIStepEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIWatchpointEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIConst;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIExecAsyncOutput;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIOOBRecord;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIOutput;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIResult;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIResultRecord;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIValue;
|
||||
|
||||
/*
|
||||
* (c) Copyright QNX Software Systems Ltd. 2002.
|
||||
|
@ -19,7 +32,7 @@ import org.eclipse.cdt.debug.mi.core.output.MIResultRecord;
|
|||
|
||||
public class RxThread extends Thread {
|
||||
|
||||
MISession session;
|
||||
final MISession session;
|
||||
|
||||
public RxThread(MISession s) {
|
||||
super("MI RX Thread");
|
||||
|
@ -29,7 +42,7 @@ public class RxThread extends Thread {
|
|||
|
||||
/*
|
||||
* Get the response, parse the output, dispatch for OOB
|
||||
* search for the corresponding token in rxQueue.
|
||||
* search for the corresponding token in rxQueue for the ResultRecord.
|
||||
*/
|
||||
public void run () {
|
||||
BufferedReader reader =
|
||||
|
@ -40,6 +53,7 @@ public class RxThread extends Thread {
|
|||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
if (line.startsWith("(gdb)")) {
|
||||
// discard termination
|
||||
processMIOutput(buffer.toString());
|
||||
buffer = new StringBuffer();
|
||||
} else {
|
||||
|
@ -52,14 +66,29 @@ public class RxThread extends Thread {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Search for the command in the RxQueue, set the MIOutput
|
||||
* and notify() the other end.
|
||||
* Any OOBs are consider like event and dipatch to the
|
||||
* listeners/observers in different thread.
|
||||
*/
|
||||
void processMIOutput(String buffer) {
|
||||
MIOutput response = session.parse(buffer);
|
||||
if (response != null) {
|
||||
List list = new ArrayList();
|
||||
Queue rxQueue = session.getRxQueue();
|
||||
|
||||
// Notify any command waiting for a ResultRecord.
|
||||
MIResultRecord rr = response.getMIResultRecord();
|
||||
if (rr != null) {
|
||||
// Check if the state changed.
|
||||
String state = rr.getResultClass();
|
||||
if ("running".equals(state)) {
|
||||
session.setRunning();
|
||||
} else {
|
||||
session.setStopped();
|
||||
}
|
||||
|
||||
int id = rr.geToken();
|
||||
Command cmd = rxQueue.removeCommand(id);
|
||||
if (cmd != null) {
|
||||
|
@ -68,25 +97,126 @@ public class RxThread extends Thread {
|
|||
cmd.notifyAll();
|
||||
}
|
||||
}
|
||||
// Some result record contains informaton specific to oob.
|
||||
// This will happen when CLI-Command is use, for example
|
||||
// doing "run" will block and return a breakpointhit
|
||||
processMIOOBRecord(rr, list);
|
||||
}
|
||||
|
||||
// A command may wait on a specific oob, like breakpointhit
|
||||
// Process OOBs
|
||||
MIOOBRecord[] oobs = response.getMIOOBRecords();
|
||||
for (int i = 0; i < oobs.length; i++) {
|
||||
if (oobs[i] instanceof MIAsyncRecord) {
|
||||
int id = ((MIAsyncRecord)oobs[i]).getToken();
|
||||
Command cmd = rxQueue.removeCommand(id);
|
||||
if (cmd != null) {
|
||||
cmd.setMIOutput(response);
|
||||
cmd.notifyAll();
|
||||
}
|
||||
}
|
||||
processMIOOBRecord(oobs[i]);
|
||||
processMIOOBRecord(oobs[i], list);
|
||||
}
|
||||
|
||||
MIEvent[] events = (MIEvent[])list.toArray(new MIEvent[list.size()]);
|
||||
if (events.length > 0) {
|
||||
Thread eventTread = new EventThread(session, events);
|
||||
eventTread.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void processMIOOBRecord(MIOOBRecord oob) {
|
||||
// Dispatch a thread to deal with the listeners.
|
||||
/**
|
||||
* Dispatch a thread to deal with the listeners.
|
||||
*/
|
||||
void processMIOOBRecord(MIOOBRecord oob, List list) {
|
||||
if (oob instanceof MIExecAsyncOutput) {
|
||||
MIExecAsyncOutput exec = (MIExecAsyncOutput)oob;
|
||||
|
||||
// Change of state.
|
||||
String state = exec.getAsyncClass();
|
||||
if ("stopped".equals(state)) {
|
||||
session.setStopped();
|
||||
}
|
||||
|
||||
MIResult[] results = exec.getMIResults();
|
||||
for (int i = 0; i < results.length; i++) {
|
||||
String var = results[i].getVariable();
|
||||
MIValue value = results[i].getMIValue();
|
||||
if (var.equals("reason")) {
|
||||
if (value instanceof MIConst) {
|
||||
String reason = ((MIConst)value).getString();
|
||||
MIEvent e = createEvent(reason, exec);
|
||||
if (e != null) {
|
||||
list.add(e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch a thread to deal with the listeners.
|
||||
*/
|
||||
void processMIOOBRecord(MIResultRecord rr, List list) {
|
||||
MIResult[] results = rr.getMIResults();
|
||||
for (int i = 0; i < results.length; i++) {
|
||||
String var = results[i].getVariable();
|
||||
if (var.equals("reason")) {
|
||||
MIValue value = results[i].getMIValue();
|
||||
if (value instanceof MIConst) {
|
||||
String reason = ((MIConst)value).getString();
|
||||
MIEvent event = createEvent(reason, rr);
|
||||
if (event != null) {
|
||||
list.add(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MIEvent createEvent(String reason, MIExecAsyncOutput exec) {
|
||||
return createEvent(reason, null, exec);
|
||||
}
|
||||
|
||||
MIEvent createEvent(String reason, MIResultRecord rr) {
|
||||
return createEvent(reason, rr, null);
|
||||
}
|
||||
|
||||
MIEvent createEvent(String reason, MIResultRecord rr, MIExecAsyncOutput exec) {
|
||||
MIEvent event = null;
|
||||
if ("breakpoint-hit".equals(reason)) {
|
||||
if (exec != null) {
|
||||
event = new MIBreakpointEvent(exec);
|
||||
} else if (rr != null) {
|
||||
event = new MIBreakpointEvent(rr);
|
||||
}
|
||||
} else if ("watchpoint-trigger".equals(reason)) {
|
||||
if (exec != null) {
|
||||
event = new MIWatchpointEvent(exec);
|
||||
} else if (rr != null) {
|
||||
event = new MIWatchpointEvent(rr);
|
||||
}
|
||||
} else if ("end-stepping-range".equals(reason)) {
|
||||
if (exec != null) {
|
||||
event = new MIStepEvent(exec);
|
||||
} else if (rr != null) {
|
||||
event = new MIStepEvent(rr);
|
||||
}
|
||||
} else if ("signal-received".equals(reason)) {
|
||||
if (exec != null) {
|
||||
event = new MISignalEvent(exec);
|
||||
} else if (rr != null) {
|
||||
event = new MISignalEvent(rr);
|
||||
}
|
||||
} else if ("location-reached".equals(reason)) {
|
||||
if (exec != null) {
|
||||
event = new MISignalEvent(exec);
|
||||
} else if (rr != null) {
|
||||
event = new MISignalEvent(rr);
|
||||
}
|
||||
} else if ("function-finished".equals(reason)) {
|
||||
if (exec != null) {
|
||||
event = new MIFunctionFinishedEvent(exec);
|
||||
} else if (rr != null) {
|
||||
event = new MIFunctionFinishedEvent(rr);
|
||||
}
|
||||
} else if ("exited-normally".equals(reason)) {
|
||||
event = new MIExitEvent();
|
||||
}
|
||||
return event;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,36 +23,32 @@ public class TxThread extends Thread {
|
|||
}
|
||||
|
||||
public void run () {
|
||||
while (true) {
|
||||
Command cmd = null;
|
||||
Queue txQueue = session.getTxQueue();
|
||||
// The removeCommand will block until a command is available.
|
||||
try {
|
||||
cmd = txQueue.removeCommand();
|
||||
} catch (Exception e) {
|
||||
//e.printStackTrace();
|
||||
}
|
||||
|
||||
// The command is then:
|
||||
// - given a Id/token
|
||||
// - shove in the pipe
|
||||
// - Remove from the TxQueue
|
||||
// - Move to the RxQueue
|
||||
if (cmd != null) {
|
||||
OutputStream out = session.getChannelOutputStream();
|
||||
cmd.setToken(token);
|
||||
//System.out.println("Tx " + cmd.toString());
|
||||
try {
|
||||
while (true) {
|
||||
Command cmd = null;
|
||||
Queue txQueue = session.getTxQueue();
|
||||
// removeCommand() will block until a command is available.
|
||||
try {
|
||||
String str = cmd.toString();
|
||||
out.write(str.getBytes());
|
||||
out.flush();
|
||||
} catch (IOException e) {
|
||||
cmd = txQueue.removeCommand();
|
||||
} catch (Exception e) {
|
||||
//e.printStackTrace();
|
||||
}
|
||||
Queue rxQueue = session.getRxQueue();
|
||||
rxQueue.addCommand(cmd);
|
||||
token++;
|
||||
|
||||
if (cmd != null) {
|
||||
// Give the command a token and increment.
|
||||
cmd.setToken(token++);
|
||||
// shove in the pipe
|
||||
String str = cmd.toString();
|
||||
OutputStream out = session.getChannelOutputStream();
|
||||
out.write(str.getBytes());
|
||||
out.flush();
|
||||
// Move to the RxQueue
|
||||
Queue rxQueue = session.getRxQueue();
|
||||
rxQueue.addCommand(cmd);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
//e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,10 @@ package org.eclipse.cdt.debug.mi.core.command;
|
|||
*/
|
||||
public class MIExecRun extends MICommand
|
||||
{
|
||||
public MIExecRun() {
|
||||
super("-exec-run");
|
||||
}
|
||||
|
||||
public MIExecRun(String[] args) {
|
||||
super("-exec-run", args);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package org.eclipse.cdt.debug.mi.core.event;
|
||||
|
||||
import org.eclipse.cdt.debug.mi.core.MISession;
|
||||
|
||||
/*
|
||||
* (c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
public class EventThread extends Thread {
|
||||
|
||||
final MISession session;
|
||||
final MIEvent[] events;
|
||||
|
||||
public EventThread(MISession s, MIEvent[] evts) {
|
||||
super("MI Event Thread");
|
||||
session = s;
|
||||
events = evts;
|
||||
setDaemon(true);
|
||||
}
|
||||
|
||||
/*
|
||||
*/
|
||||
public void run () {
|
||||
session.setDirty();
|
||||
session.notifyObservers(events);
|
||||
}
|
||||
}
|
|
@ -1,27 +1,34 @@
|
|||
package org.eclipse.cdt.debug.mi.core.output;
|
||||
|
||||
package org.eclipse.cdt.debug.mi.core.event;
|
||||
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIConst;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIExecAsyncOutput;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIFrame;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIResult;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIResultRecord;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MITuple;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIValue;
|
||||
|
||||
/**
|
||||
* ^done,reason="breakpoint-hit",bkptno="1",thread-id="0",frame={addr="0x08048468",func="main",args=[{name="argc",value="1"},{name="argv",value="0xbffff18c"}],file="hello.c",line="4"}
|
||||
*
|
||||
*/
|
||||
public class MIBreakHitInfo {
|
||||
public class MIBreakpointEvent extends MIEvent {
|
||||
|
||||
int bkptno;
|
||||
int threadId;
|
||||
MIFrame frame;
|
||||
String file = "";
|
||||
int line;
|
||||
|
||||
MIExecAsyncOutput exec;
|
||||
MIResultRecord rr;
|
||||
|
||||
public MIBreakHitInfo(MIExecAsyncOutput record) {
|
||||
public MIBreakpointEvent(MIExecAsyncOutput record) {
|
||||
exec = record;
|
||||
parse();
|
||||
}
|
||||
|
||||
public MIBreakHitInfo(MIResultRecord record) {
|
||||
public MIBreakpointEvent(MIResultRecord record) {
|
||||
rr = record;
|
||||
parse();
|
||||
}
|
||||
|
||||
public int getBreakNumber() {
|
||||
|
@ -36,12 +43,12 @@ public class MIBreakHitInfo {
|
|||
return frame;
|
||||
}
|
||||
|
||||
public String getFile() {
|
||||
return file;
|
||||
}
|
||||
|
||||
public int getLine() {
|
||||
return line;
|
||||
public String toString() {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append("number=").append(bkptno).append('\n');
|
||||
buffer.append("thread-id=").append(threadId).append('\n');
|
||||
buffer.append(frame.toString());
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
void parse () {
|
||||
|
@ -62,25 +69,18 @@ public class MIBreakHitInfo {
|
|||
|
||||
if (var.equals("bkptno")) {
|
||||
try {
|
||||
bkptno = Integer.parseInt(str);
|
||||
bkptno = Integer.parseInt(str.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
} else if (var.equals("thread-id")) {
|
||||
try {
|
||||
threadId = Integer.parseInt(str);
|
||||
threadId = Integer.parseInt(str.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
} else if (var.equals("frame")) {
|
||||
if (value instanceof MITuple) {
|
||||
frame = new MIFrame((MITuple)value);
|
||||
}
|
||||
} else if (var.equals("file")) {
|
||||
file = str;
|
||||
} else if (var.equals("line")) {
|
||||
try {
|
||||
line = Integer.parseInt(str);
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package org.eclipse.cdt.debug.mi.core.event;
|
||||
|
||||
/**
|
||||
*/
|
||||
public abstract class MIEvent {
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package org.eclipse.cdt.debug.mi.core.event;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* *stopped,reason="exited-normally"
|
||||
*
|
||||
*/
|
||||
public class MIExitEvent extends MIEvent {
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
package org.eclipse.cdt.debug.mi.core.event;
|
||||
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIConst;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIExecAsyncOutput;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIFrame;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIResult;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIResultRecord;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MITuple;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIValue;
|
||||
|
||||
/**
|
||||
* *stopped,reason="function-finished",thread-id="0",frame={addr="0x0804855a",func="main",args=[{name="argc",value="1"},{name="argv",value="0xbffff18c"}],file="hello.c",line="17"},gdb-result-var="$1",return-value="10"
|
||||
*/
|
||||
public class MIFunctionFinishedEvent extends MIEvent {
|
||||
|
||||
String gdbResult = "";
|
||||
String returnValue = "";
|
||||
int threadId;
|
||||
MIFrame frame;
|
||||
|
||||
MIExecAsyncOutput exec;
|
||||
MIResultRecord rr;
|
||||
|
||||
public MIFunctionFinishedEvent(MIExecAsyncOutput record) {
|
||||
exec = record;
|
||||
parse();
|
||||
}
|
||||
|
||||
public MIFunctionFinishedEvent(MIResultRecord record) {
|
||||
rr = record;
|
||||
parse();
|
||||
}
|
||||
|
||||
public String getGDBResultVar() {
|
||||
return gdbResult;
|
||||
}
|
||||
|
||||
public String getReturnValue() {
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
public int getThreadId() {
|
||||
return threadId;
|
||||
}
|
||||
|
||||
public MIFrame getFrame() {
|
||||
return frame;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append("gdb-result-var=" + gdbResult + "\n");;
|
||||
buffer.append("return-value=" + returnValue + "\n");
|
||||
buffer.append("thread-id=").append(threadId).append('\n');
|
||||
buffer.append(frame.toString());
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
void parse () {
|
||||
MIResult[] results = null;
|
||||
if (exec != null) {
|
||||
results = exec.getMIResults();
|
||||
} else if (rr != null) {
|
||||
results = rr.getMIResults();
|
||||
}
|
||||
if (results != null) {
|
||||
for (int i = 0; i < results.length; i++) {
|
||||
String var = results[i].getVariable();
|
||||
MIValue value = results[i].getMIValue();
|
||||
String str = "";
|
||||
if (value instanceof MIConst) {
|
||||
str = ((MIConst)value).getString();
|
||||
}
|
||||
|
||||
if (var.equals("gdb-result-var")) {
|
||||
gdbResult = str;
|
||||
} else if (var.equals("return-value")) {
|
||||
returnValue = str;
|
||||
} else if (var.equals("thread-id")) {
|
||||
try {
|
||||
threadId = Integer.parseInt(str.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
} else if (var.equals("frame")) {
|
||||
if (value instanceof MITuple) {
|
||||
frame = new MIFrame((MITuple)value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
package org.eclipse.cdt.debug.mi.core.event;
|
||||
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIConst;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIExecAsyncOutput;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIFrame;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIResult;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIResultRecord;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MITuple;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIValue;
|
||||
|
||||
/**
|
||||
* *stopped,reason="location-reached",thread-id="0",frame={addr="0x0804858e",func="main2",args=[],file="hello.c",line="27"}
|
||||
*/
|
||||
public class MILocationReachedEvent extends MIEvent {
|
||||
|
||||
int threadId;
|
||||
MIFrame frame;
|
||||
|
||||
MIExecAsyncOutput exec;
|
||||
MIResultRecord rr;
|
||||
|
||||
public MILocationReachedEvent(MIExecAsyncOutput record) {
|
||||
exec = record;
|
||||
parse();
|
||||
}
|
||||
|
||||
public MILocationReachedEvent(MIResultRecord record) {
|
||||
rr = record;
|
||||
parse();
|
||||
}
|
||||
|
||||
public int getThreadId() {
|
||||
return threadId;
|
||||
}
|
||||
|
||||
public MIFrame getFrame() {
|
||||
return frame;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append("thread-id=").append(threadId).append('\n');
|
||||
buffer.append(frame.toString());
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
void parse () {
|
||||
MIResult[] results = null;
|
||||
if (exec != null) {
|
||||
results = exec.getMIResults();
|
||||
} else if (rr != null) {
|
||||
results = rr.getMIResults();
|
||||
}
|
||||
if (results != null) {
|
||||
for (int i = 0; i < results.length; i++) {
|
||||
String var = results[i].getVariable();
|
||||
MIValue value = results[i].getMIValue();
|
||||
String str = "";
|
||||
if (value instanceof MIConst) {
|
||||
str = ((MIConst)value).getString();
|
||||
}
|
||||
|
||||
if (var.equals("thread-id")) {
|
||||
try {
|
||||
threadId = Integer.parseInt(str.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
} else if (var.equals("frame")) {
|
||||
if (value instanceof MITuple) {
|
||||
frame = new MIFrame((MITuple)value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
package org.eclipse.cdt.debug.mi.core.event;
|
||||
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIConst;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIExecAsyncOutput;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIFrame;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIResult;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIResultRecord;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MITuple;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIValue;
|
||||
|
||||
/**
|
||||
* *stopped,reason="signal-received",signal-name="SIGINT",signal-meaning="Interrupt",thread-id="0",frame={addr="0x400e18e1",func="__libc_nanosleep",args=[],file="__libc_nanosleep",line="-1"}
|
||||
*
|
||||
*/
|
||||
public class MISignalEvent extends MIEvent {
|
||||
|
||||
String sigName = "";
|
||||
String sigMeaning = "";
|
||||
int threadId;
|
||||
MIFrame frame;
|
||||
|
||||
MIExecAsyncOutput exec;
|
||||
MIResultRecord rr;
|
||||
|
||||
public MISignalEvent(MIExecAsyncOutput record) {
|
||||
exec = record;
|
||||
parse();
|
||||
}
|
||||
|
||||
public MISignalEvent(MIResultRecord record) {
|
||||
rr = record;
|
||||
parse();
|
||||
}
|
||||
|
||||
public String getSignalName() {
|
||||
return sigName;
|
||||
}
|
||||
|
||||
public String getSignalMeaning() {
|
||||
return sigMeaning;
|
||||
}
|
||||
|
||||
|
||||
public int getThreadId() {
|
||||
return threadId;
|
||||
}
|
||||
|
||||
public MIFrame getFrame() {
|
||||
return frame;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append("signal-name=" + sigName + "\n");;
|
||||
buffer.append("signal-meaning=" + sigMeaning + "\n");;
|
||||
buffer.append("thread-id=").append(threadId).append('\n');
|
||||
buffer.append(frame.toString());
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
void parse () {
|
||||
MIResult[] results = null;
|
||||
if (exec != null) {
|
||||
results = exec.getMIResults();
|
||||
} else if (rr != null) {
|
||||
results = rr.getMIResults();
|
||||
}
|
||||
if (results != null) {
|
||||
for (int i = 0; i < results.length; i++) {
|
||||
String var = results[i].getVariable();
|
||||
MIValue value = results[i].getMIValue();
|
||||
String str = "";
|
||||
if (value instanceof MIConst) {
|
||||
str = ((MIConst)value).getString();
|
||||
}
|
||||
|
||||
if (var.equals("signal-name")) {
|
||||
sigName = str;
|
||||
} else if (var.equals("signal-meaning")) {
|
||||
sigMeaning = str;
|
||||
} else if (var.equals("thread-id")) {
|
||||
try {
|
||||
threadId = Integer.parseInt(str.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
} else if (var.equals("frame")) {
|
||||
if (value instanceof MITuple) {
|
||||
frame = new MIFrame((MITuple)value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
package org.eclipse.cdt.debug.mi.core.event;
|
||||
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIConst;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIExecAsyncOutput;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIFrame;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIResult;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIResultRecord;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MITuple;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIValue;
|
||||
|
||||
/**
|
||||
*
|
||||
* *stopped,reason="end-stepping-range",thread-id="0",frame={addr="0x08048538",func="main",args=[{name="argc",value="1"},{name="argv",value="0xbffff18c"}],file="hello.c",line="13"}
|
||||
*/
|
||||
public class MIStepEvent extends MIEvent {
|
||||
|
||||
int threadId;
|
||||
MIFrame frame;
|
||||
|
||||
MIExecAsyncOutput exec;
|
||||
MIResultRecord rr;
|
||||
|
||||
public MIStepEvent(MIExecAsyncOutput record) {
|
||||
exec = record;
|
||||
parse();
|
||||
}
|
||||
|
||||
public MIStepEvent(MIResultRecord record) {
|
||||
rr = record;
|
||||
parse();
|
||||
}
|
||||
|
||||
public int getThreadId() {
|
||||
return threadId;
|
||||
}
|
||||
|
||||
public MIFrame getFrame() {
|
||||
return frame;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append("thread-id=").append(threadId).append('\n');
|
||||
buffer.append(frame.toString());
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
void parse () {
|
||||
MIResult[] results = null;
|
||||
if (exec != null) {
|
||||
results = exec.getMIResults();
|
||||
} else if (rr != null) {
|
||||
results = rr.getMIResults();
|
||||
}
|
||||
if (results != null) {
|
||||
for (int i = 0; i < results.length; i++) {
|
||||
String var = results[i].getVariable();
|
||||
MIValue value = results[i].getMIValue();
|
||||
|
||||
if (var.equals("thread-id")) {
|
||||
if (value instanceof MIConst) {
|
||||
String str = ((MIConst)value).getString();
|
||||
try {
|
||||
threadId = Integer.parseInt(str.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
}
|
||||
} else if (var.equals("frame")) {
|
||||
if (value instanceof MITuple) {
|
||||
frame = new MIFrame((MITuple)value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,149 @@
|
|||
package org.eclipse.cdt.debug.mi.core.event;
|
||||
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIConst;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIExecAsyncOutput;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIFrame;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIResult;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIResultRecord;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MITuple;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIValue;
|
||||
|
||||
/**
|
||||
* *stopped,reason="watchpoint-trigger",wpt={number="2",exp="i"},value={old="0",new="1"},thread-id="0",frame={addr="0x08048534",func="main",args=[{name="argc",value="1"},{name="argv",value="0xbffff18c"}],file="hello.c",line="10"}
|
||||
*
|
||||
*/
|
||||
public class MIWatchpointEvent extends MIEvent {
|
||||
|
||||
int number;
|
||||
String exp = "";
|
||||
String oldValue = "";
|
||||
String newValue = "";
|
||||
int threadId;
|
||||
MIFrame frame;
|
||||
|
||||
MIExecAsyncOutput exec;
|
||||
MIResultRecord rr;
|
||||
|
||||
public MIWatchpointEvent(MIExecAsyncOutput record) {
|
||||
exec = record;
|
||||
parse();
|
||||
}
|
||||
|
||||
public MIWatchpointEvent(MIResultRecord record) {
|
||||
rr = record;
|
||||
parse();
|
||||
}
|
||||
|
||||
public int getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
public String getExpression() {
|
||||
return exp;
|
||||
}
|
||||
|
||||
public String getOldValue() {
|
||||
return oldValue;
|
||||
}
|
||||
|
||||
public String getNewValue() {
|
||||
return newValue;
|
||||
}
|
||||
|
||||
public int getThreadId() {
|
||||
return threadId;
|
||||
}
|
||||
|
||||
public MIFrame getFrame() {
|
||||
return frame;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append("number=").append(number).append('\n');
|
||||
buffer.append("expression=" + exp + "\n");
|
||||
;
|
||||
buffer.append("old=" + oldValue + "\n");
|
||||
buffer.append("new=" + newValue + "\n");
|
||||
buffer.append("thread-id=").append(threadId).append('\n');
|
||||
buffer.append(frame.toString());
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
void parse() {
|
||||
MIResult[] results = null;
|
||||
if (exec != null) {
|
||||
results = exec.getMIResults();
|
||||
} else if (rr != null) {
|
||||
results = rr.getMIResults();
|
||||
}
|
||||
if (results != null) {
|
||||
for (int i = 0; i < results.length; i++) {
|
||||
String var = results[i].getVariable();
|
||||
MIValue value = results[i].getMIValue();
|
||||
|
||||
if (var.equals("wpt")) {
|
||||
if (value instanceof MITuple) {
|
||||
parseWPT((MITuple) value);
|
||||
}
|
||||
} else if (var.equals("value")) {
|
||||
if (value instanceof MITuple) {
|
||||
parseValue((MITuple) value);
|
||||
}
|
||||
} else if (var.equals("thread-id")) {
|
||||
if (value instanceof MIConst) {
|
||||
String str = ((MIConst) value).getString();
|
||||
try {
|
||||
threadId = Integer.parseInt(str.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
}
|
||||
} else if (var.equals("frame")) {
|
||||
if (value instanceof MITuple) {
|
||||
frame = new MIFrame((MITuple) value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void parseWPT(MITuple tuple) {
|
||||
MIResult[] results = tuple.getMIResults();
|
||||
for (int i = 0; i < results.length; i++) {
|
||||
String var = results[i].getVariable();
|
||||
MIValue value = results[i].getMIValue();
|
||||
|
||||
if (var.equals("number")) {
|
||||
if (value instanceof MIConst) {
|
||||
String str = ((MIConst) value).getString();
|
||||
try {
|
||||
number = Integer.parseInt(str);
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
}
|
||||
} else if (var.equals("exp")) {
|
||||
if (value instanceof MIConst) {
|
||||
exp = ((MIConst) value).getString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void parseValue(MITuple tuple) {
|
||||
MIResult[] results = tuple.getMIResults();
|
||||
for (int i = 0; i < results.length; i++) {
|
||||
String var = results[i].getVariable();
|
||||
MIValue value = results[i].getMIValue();
|
||||
String str = "";
|
||||
if (value instanceof MIConst) {
|
||||
str = ((MIConst) value).getString();
|
||||
}
|
||||
|
||||
if (var.equals("old")) {
|
||||
oldValue = str;
|
||||
} else if (var.equals("new")) {
|
||||
newValue = str;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -77,21 +77,21 @@ public class MIAsm {
|
|||
|
||||
if (var.equals("address")) {
|
||||
try {
|
||||
address = Long.decode(str).longValue();
|
||||
address = Long.decode(str.trim()).longValue();
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
} else if (var.equals("func-name")) {
|
||||
func = str;
|
||||
} else if (var.equals("offset")) {
|
||||
try {
|
||||
offset = Long.decode(str).longValue();
|
||||
offset = Long.decode(str.trim()).longValue();
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
} else if (var.equals("inst")) {
|
||||
inst = str;
|
||||
} else if (var.equals("line")) {
|
||||
try {
|
||||
line = Integer.parseInt(str);
|
||||
line = Integer.parseInt(str.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
} else if (var.equals("file")) {
|
||||
|
|
|
@ -71,7 +71,7 @@ public class MIBreakPoint {
|
|||
|
||||
if (var.equals("number")) {
|
||||
try {
|
||||
number = Integer.parseInt(str);
|
||||
number = Integer.parseInt(str.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
} else if (var.equals("type")) {
|
||||
|
@ -82,7 +82,7 @@ public class MIBreakPoint {
|
|||
enabled = str.equals("y");
|
||||
} else if (var.equals("addr")) {
|
||||
try {
|
||||
address = Long.decode(str).longValue();
|
||||
address = Long.decode(str.trim()).longValue();
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
} else if (var.equals("func")) {
|
||||
|
@ -91,12 +91,12 @@ public class MIBreakPoint {
|
|||
file = str;
|
||||
} else if (var.equals("line")) {
|
||||
try {
|
||||
line = Integer.parseInt(str);
|
||||
line = Integer.parseInt(str.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
} else if (var.equals("times")) {
|
||||
try {
|
||||
times = Integer.parseInt(str);
|
||||
times = Integer.parseInt(str.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
} else if (var.equals("what") || var.equals("exp")) {
|
||||
|
|
|
@ -42,7 +42,7 @@ public class MIDataListChangedRegistersInfo extends MIInfo {
|
|||
for (int i = 0; i < aList.size(); i++) {
|
||||
String str = (String)aList.get(i);
|
||||
try {
|
||||
registers[i] = Integer.parseInt(str);
|
||||
registers[i] = Integer.parseInt(str.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,37 +110,37 @@ public class MIDataReadMemoryInfo extends MIInfo {
|
|||
|
||||
if (var.equals("addr")) {
|
||||
try {
|
||||
addr = Long.decode(str).longValue();
|
||||
addr = Long.decode(str.trim()).longValue();
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
} else if (var.equals("nr-bytes")) {
|
||||
try {
|
||||
numBytes = Long.decode(str).longValue();
|
||||
numBytes = Long.decode(str.trim()).longValue();
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
} else if (var.equals("total-bytes")) {
|
||||
try {
|
||||
totalBytes = Long.decode(str).longValue();
|
||||
totalBytes = Long.decode(str.trim()).longValue();
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
} else if (var.equals("next-row")) {
|
||||
try {
|
||||
nextRow = Long.decode(str).longValue();
|
||||
nextRow = Long.decode(str.trim()).longValue();
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
} else if (var.equals("prev-row")) {
|
||||
try {
|
||||
prevRow = Long.decode(str).longValue();
|
||||
prevRow = Long.decode(str.trim()).longValue();
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
} else if (var.equals("next-page")) {
|
||||
try {
|
||||
nextPage = Long.decode(str).longValue();
|
||||
nextPage = Long.decode(str.trim()).longValue();
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
} else if (var.equals("prev-page")) {
|
||||
try {
|
||||
prevPage = Long.decode(str).longValue();
|
||||
prevPage = Long.decode(str.trim()).longValue();
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
} else if (var.equals("memory")) {
|
||||
|
|
|
@ -39,8 +39,8 @@ public class MIFrame {
|
|||
if (i != 0) {
|
||||
buffer.append(',');
|
||||
}
|
||||
buffer.append("{name=\"" + args[i].getName());
|
||||
buffer.append(",value=\"" + args[i].getValue() + "}");
|
||||
buffer.append("{name=\"" + args[i].getName() + "\"");
|
||||
buffer.append(",value=\"" + args[i].getValue() + "\"}");
|
||||
}
|
||||
buffer.append(']');
|
||||
return buffer.toString();
|
||||
|
@ -58,12 +58,12 @@ public class MIFrame {
|
|||
|
||||
if (var.equals("level")) {
|
||||
try {
|
||||
level = Integer.parseInt(str);
|
||||
level = Integer.parseInt(str.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
} else if (var.equals("addr")) {
|
||||
try {
|
||||
addr = Long.decode(str).longValue();
|
||||
addr = Long.decode(str.trim()).longValue();
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
} else if (var.equals("func")) {
|
||||
|
@ -72,7 +72,7 @@ public class MIFrame {
|
|||
file = str;
|
||||
} else if (var.equals("line")) {
|
||||
try {
|
||||
line = Integer.parseInt(str);
|
||||
line = Integer.parseInt(str.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
} else if (var.equals("args")) {
|
||||
|
|
|
@ -30,9 +30,15 @@ public class MIList extends MIValue {
|
|||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append('[');
|
||||
for (int i = 0; i < results.length; i++) {
|
||||
if (i != 0) {
|
||||
buffer.append(',');
|
||||
}
|
||||
buffer.append(results[i].toString());
|
||||
}
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
if (i != 0) {
|
||||
buffer.append(',');
|
||||
}
|
||||
buffer.append(values[i].toString());
|
||||
}
|
||||
buffer.append(']');
|
||||
|
|
|
@ -52,7 +52,7 @@ public class MIMemory {
|
|||
|
||||
if (var.equals("addr")) {
|
||||
try {
|
||||
addr = Long.decode(str).longValue();
|
||||
addr = Long.decode(str.trim()).longValue();
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
} else if (var.equals("data")) {
|
||||
|
@ -72,7 +72,7 @@ public class MIMemory {
|
|||
if (values[i] instanceof MIConst) {
|
||||
String str = ((MIConst)values[i]).getString();
|
||||
try {
|
||||
data[i] = Long.decode(str).longValue();
|
||||
data[i] = Long.decode(str.trim()).longValue();
|
||||
} catch (NumberFormatException e) {
|
||||
data[i] = 0;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,6 @@ public class MIOutput {
|
|||
if (rr != null) {
|
||||
buffer.append(rr.toString());
|
||||
}
|
||||
buffer.append(terminator + "\n");
|
||||
return buffer.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -261,6 +261,7 @@ public class MIParser {
|
|||
result.setMIValue(value);
|
||||
} else {
|
||||
result.setVariable(buffer.toString());
|
||||
result.setMIValue(new MIConst()); // Empty string:???
|
||||
buffer.setLength(0);
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -76,8 +76,8 @@ public class MIRegisterValue {
|
|||
}
|
||||
|
||||
try {
|
||||
int reg = Integer.parseInt(aName);
|
||||
long val = Long.decode(aValue).longValue();
|
||||
int reg = Integer.parseInt(aName.trim());
|
||||
long val = Long.decode(aValue.trim()).longValue();
|
||||
arg = new MIRegisterValue(reg, val);
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
|
|
|
@ -23,9 +23,17 @@ public class MIResult {
|
|||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append(variable);
|
||||
if (value != null) {
|
||||
return variable + "=" + value.toString();
|
||||
String v = value.toString();
|
||||
buffer.append('=');
|
||||
if (v.charAt(0) == '[' || v.charAt(0) =='{') {
|
||||
buffer.append(v);
|
||||
} else {
|
||||
buffer.append("\"" + value.toString() + "\"");
|
||||
}
|
||||
}
|
||||
return variable;
|
||||
return buffer.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ public class MIStackInfoDepthInfo extends MIInfo {
|
|||
if (val instanceof MIConst) {
|
||||
String str = ((MIConst)val).getString();
|
||||
try {
|
||||
depth = Integer.parseInt(str);
|
||||
depth = Integer.parseInt(str.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public class MIThreadListIdsInfo extends MIInfo {
|
|||
if (value instanceof MIConst) {
|
||||
String str = ((MIConst)value).getString();
|
||||
try {
|
||||
threadIds[i] = Integer.parseInt(str);
|
||||
threadIds[i] = Integer.parseInt(str.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public class MIThreadSelectInfo extends MIInfo {
|
|||
if (value instanceof MIConst) {
|
||||
String str = ((MIConst)value).getString();
|
||||
try {
|
||||
threadId = Integer.parseInt(str);
|
||||
threadId = Integer.parseInt(str.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue