Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreutarass2010-03-09 20:18:55 -0500
committereutarass2010-03-09 20:18:55 -0500
commitc12de90aa1437b8eac7b1d983e13164aa232e375 (patch)
treef7fb1e7407156b1b1f03ed75ff6ba06c5419e3fd /plugins/org.eclipse.tm.tcf.debug
parent3c71c9e409ad39a155a5378aaa4b3ba5c423a55e (diff)
downloadorg.eclipse.tcf-c12de90aa1437b8eac7b1d983e13164aa232e375.tar.gz
org.eclipse.tcf-c12de90aa1437b8eac7b1d983e13164aa232e375.tar.xz
org.eclipse.tcf-c12de90aa1437b8eac7b1d983e13164aa232e375.zip
TCF Agent: more symbols value-add code.
Diffstat (limited to 'plugins/org.eclipse.tm.tcf.debug')
-rw-r--r--plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TestExpressions.java37
-rw-r--r--plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TestRCBP1.java21
2 files changed, 43 insertions, 15 deletions
diff --git a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TestExpressions.java b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TestExpressions.java
index 9975b5773..2dfbe5176 100644
--- a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TestExpressions.java
+++ b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TestExpressions.java
@@ -25,7 +25,6 @@ import org.eclipse.tm.tcf.services.IExpressions;
import org.eclipse.tm.tcf.services.IRunControl;
import org.eclipse.tm.tcf.services.IStackTrace;
import org.eclipse.tm.tcf.services.ISymbols;
-import org.eclipse.tm.tcf.services.IRunControl.RunControlContext;
class TestExpressions implements ITCFTest,
IRunControl.RunControlListener, IExpressions.ExpressionsListener, IBreakpoints.BreakpointsListener {
@@ -48,6 +47,7 @@ class TestExpressions implements ITCFTest,
private String suspended_pc;
private boolean waiting_suspend;
private String[] stack_trace;
+ private IStackTrace.StackTraceContext[] stack_frames;
private String[] local_vars;
private final HashMap<String,IRunControl.RunControlContext> ctx_map = new HashMap<String,IRunControl.RunControlContext>();
private final Map<String,IExpressions.Expression> expr_ctx = new HashMap<String,IExpressions.Expression>();
@@ -293,6 +293,25 @@ class TestExpressions implements ITCFTest,
});
return;
}
+ if (stack_frames == null) {
+ stk.getContext(stack_trace, new IStackTrace.DoneGetContext() {
+ public void doneGetContext(IToken token, Exception error, IStackTrace.StackTraceContext[] frames) {
+ if (error != null) {
+ exit(error);
+ }
+ else {
+ stack_frames = frames;
+ if (stack_frames == null || stack_frames.length != stack_trace.length) {
+ exit(new Exception("Invalid stack trace"));
+ }
+ else {
+ runTest();
+ }
+ }
+ }
+ });
+ return;
+ }
if (local_vars == null) {
expr.getChildren(stack_trace[stack_trace.length - 2], new IExpressions.DoneGetChildren() {
public void doneGetChildren(IToken token, Exception error, String[] context_ids) {
@@ -454,14 +473,14 @@ class TestExpressions implements ITCFTest,
}
public void contextAdded(IRunControl.RunControlContext[] contexts) {
- for (RunControlContext ctx : contexts) {
+ for (IRunControl.RunControlContext ctx : contexts) {
if (ctx_map.get(ctx.getID()) != null) exit(new Error("Invalid 'contextAdded' event"));
ctx_map.put(ctx.getID(), ctx);
}
}
public void contextChanged(IRunControl.RunControlContext[] contexts) {
- for (RunControlContext ctx : contexts) {
+ for (IRunControl.RunControlContext ctx : contexts) {
if (ctx_map.get(ctx.getID()) == null) return;
ctx_map.put(ctx.getID(), ctx);
}
@@ -474,8 +493,16 @@ class TestExpressions implements ITCFTest,
for (String id : context_ids) {
ctx_map.remove(id);
if (id.equals(process_id)) {
- if (test_done) exit(null);
- else exit(new Exception("Test process exited too soon"));
+ if (test_done) {
+ bp.set(null, new IBreakpoints.DoneCommand() {
+ public void doneCommand(IToken token, Exception error) {
+ exit(error);
+ }
+ });
+ }
+ else {
+ exit(new Exception("Test process exited too soon"));
+ }
return;
}
}
diff --git a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TestRCBP1.java b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TestRCBP1.java
index b47a39155..2d7d2fe8e 100644
--- a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TestRCBP1.java
+++ b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TestRCBP1.java
@@ -57,6 +57,7 @@ class TestRCBP1 implements ITCFTest,
private final Map<String,Map<String,IRegisters.RegistersContext>> regs =
new HashMap<String,Map<String,IRegisters.RegistersContext>>();
private final Map<String,Map<String,Object>> bp_list = new HashMap<String,Map<String,Object>>();
+ private final Random rnd = new Random();
private String context_id; // Test process context ID
private IRunControl.RunControlContext context;
@@ -229,7 +230,7 @@ class TestRCBP1 implements ITCFTest,
Map<String,Object> m[] = new Map[4];
for (int i = 0; i < m.length; i++) {
m[i] = new HashMap();
- m[i].put(IBreakpoints.PROP_ID, "TcfTestBP" + i);
+ m[i].put(IBreakpoints.PROP_ID, "TcfTestBP" + i + "" + channel_id);
m[i].put(IBreakpoints.PROP_ENABLED, Boolean.TRUE);
switch (i) {
case 0:
@@ -247,7 +248,6 @@ class TestRCBP1 implements ITCFTest,
break;
case 3:
// Breakpoint that will be enabled with "enable" command
- m[i].put(IBreakpoints.PROP_ID, "TcfTestBP3" + channel_id);
m[i].put(IBreakpoints.PROP_ENABLED, Boolean.FALSE);
m[i].put(IBreakpoints.PROP_LOCATION, "tcf_test_func2");
break;
@@ -526,10 +526,10 @@ class TestRCBP1 implements ITCFTest,
exit(new Exception("Test main thread breakpoint count = " + bp_cnt + ", expected 30"));
}
rc.removeListener(this);
- // Flush communication channel of pending commands
- Protocol.sync(new Runnable() {
- public void run() {
- exit(null);
+ // Reset breakpoint list
+ bp.set(null, new IBreakpoints.DoneCommand() {
+ public void doneCommand(IToken token, Exception error) {
+ exit(error);
}
});
}
@@ -660,7 +660,9 @@ class TestRCBP1 implements ITCFTest,
SuspendedContext sc = suspended.get(id);
IRunControl.RunControlContext ctx = threads.get(id);
if (ctx != null && sc != null) {
- ctx.resume(IRunControl.RM_RESUME, 1, new HashMap<String,Object>(), new IRunControl.DoneCommand() {
+ int rm = rnd.nextInt(6);
+ if (!ctx.canResume(rm)) rm = IRunControl.RM_RESUME;
+ ctx.resume(rm, 1, new HashMap<String,Object>(), new IRunControl.DoneCommand() {
public void doneCommand(IToken token, Exception error) {
if (test_suite.cancel) return;
if (!test_suite.isActive(TestRCBP1.this)) return;
@@ -733,7 +735,7 @@ class TestRCBP1 implements ITCFTest,
final Number addr, final byte[] buf,
final Runnable done) {
final byte[] data = new byte[buf.length];
- new Random().nextBytes(data);
+ rnd.nextBytes(data);
mem_ctx.set(addr, 1, data, 0, data.length, 0, new IMemory.DoneMemory() {
public void doneMemory(IToken token, MemoryError error) {
if (suspended.get(sc.id) != sc) {
@@ -774,7 +776,7 @@ class TestRCBP1 implements ITCFTest,
final Number addr, final byte[] buf,
final Runnable done) {
final byte[] data = new byte[buf.length / 7];
- new Random().nextBytes(data);
+ rnd.nextBytes(data);
mem_ctx.fill(addr, 1, data, buf.length, 0, new IMemory.DoneMemory() {
public void doneMemory(IToken token, MemoryError error) {
if (suspended.get(sc.id) != sc) {
@@ -897,7 +899,6 @@ class TestRCBP1 implements ITCFTest,
}));
}
if (!reg_map.isEmpty()) {
- Random rnd = new Random();
List<IRegisters.Location> locs = new ArrayList<IRegisters.Location>();
String[] ids = reg_map.keySet().toArray(new String[reg_map.size()]);
for (int i = 0; i < rnd.nextInt(32); i++) {

Back to the top