blob: dbdce61ec1293422862d44bb25f7cc6f478b1fe9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
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
*
*/
public class MIStoppedEvent extends MIEvent {
private int threadId;
private MIFrame frame;
private MIExecAsyncOutput exec;
private MIResultRecord rr;
public MIStoppedEvent(MIExecAsyncOutput record) {
super(record.getToken());
exec = record;
parse();
}
public MIStoppedEvent(MIResultRecord record) {
super(record.getToken());
rr = record;
parse();
}
public int getThreadId() {
return threadId;
}
public void setThreadId(int id) {
threadId = id;
}
public MIFrame getFrame() {
return frame;
}
public void setFrame(MIFrame f) {
frame = f;
}
public MIExecAsyncOutput getMIExecAsyncOutput() {
return exec;
}
public MIResultRecord getMIResultRecord() {
return rr;
}
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")) { //$NON-NLS-1$
if (value instanceof MIConst) {
String str = ((MIConst)value).getString();
try {
threadId = Integer.parseInt(str.trim());
} catch (NumberFormatException e) {
}
}
} else if (var.equals("frame")) { //$NON-NLS-1$
if (value instanceof MITuple) {
frame = new MIFrame((MITuple)value);
}
}
}
}
}
}
|