Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreutarass2010-04-30 20:24:03 +0000
committereutarass2010-04-30 20:24:03 +0000
commitb6a48dc562c3844a3dfab0c362c8bd103c2d2fee (patch)
treeb858a17c8a1022fa2b9ab2f333a74914c66ba54a
parent5a277bfafe0da72d9a962bd0dbc54c0d72429511 (diff)
downloadorg.eclipse.tcf-b6a48dc562c3844a3dfab0c362c8bd103c2d2fee.tar.gz
org.eclipse.tcf-b6a48dc562c3844a3dfab0c362c8bd103c2d2fee.tar.xz
org.eclipse.tcf-b6a48dc562c3844a3dfab0c362c8bd103c2d2fee.zip
TCF Agent: in order to improve debug API abstraction:
1. removed "pid_t pid" and "pid_t mem" fields from "struct Context": usage of pid_t is not 100% portable, some contexts might not have a PID. 2. added "char id[]" field in "struct Context". The field contains TCF ID of the context. 3. added "Context * mem" field in "struct Context". The field points to memory space object of the context. 4. added "Context * creator" field in "struct Context".
-rw-r--r--plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/services/remote/RunControlProxy.java8
-rw-r--r--plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/tcf/services/IRunControl.java40
-rw-r--r--plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TestExpressions.java30
-rw-r--r--plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TestRCBP1.java2
4 files changed, 73 insertions, 7 deletions
diff --git a/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/services/remote/RunControlProxy.java b/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/services/remote/RunControlProxy.java
index c1147e5a3..bed999776 100644
--- a/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/services/remote/RunControlProxy.java
+++ b/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/services/remote/RunControlProxy.java
@@ -48,6 +48,14 @@ public class RunControlProxy implements IRunControl {
return (String)props.get(PROP_PARENT_ID);
}
+ public String getProcessID() {
+ return (String)props.get(PROP_PROCESS_ID);
+ }
+
+ public String getCreatorID() {
+ return (String)props.get(PROP_CREATOR_ID);
+ }
+
public boolean isContainer() {
Boolean b = (Boolean)props.get(PROP_IS_CONTAINER);
return b != null && b.booleanValue();
diff --git a/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/tcf/services/IRunControl.java b/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/tcf/services/IRunControl.java
index e13786406..f0179c93b 100644
--- a/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/tcf/services/IRunControl.java
+++ b/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/tcf/services/IRunControl.java
@@ -24,14 +24,34 @@ public interface IRunControl extends IService {
* Context property names.
*/
static final String
+ /** Run control context ID */
PROP_ID = "ID",
+
+ /** Context parent (owner) ID, for a thread it is same as process ID */
PROP_PARENT_ID = "ParentID",
+
+ /** Context process (memory space) ID */
PROP_PROCESS_ID = "ProcessID",
+
+ /** ID of a context that created this context */
+ PROP_CREATOR_ID = "CreatorID",
+
+ /** true if the context is a container. Container can propagate run control commands to his children */
PROP_IS_CONTAINER = "IsContainer",
+
+ /** true if context has execution state - can be suspended/resumed */
PROP_HAS_STATE = "HasState",
+
+ /** Bit-set of RM_ values that are supported by the context */
PROP_CAN_RESUME = "CanResume",
+
+ /** Bit-set of RM_ values that can be used with count > 1 */
PROP_CAN_COUNT = "CanCount",
+
+ /** true if suspend command is supported by the context */
PROP_CAN_SUSPEND = "CanSuspend",
+
+ /** true if terminate command is supported by the context */
PROP_CAN_TERMINATE = "CanTerminate";
/**
@@ -211,6 +231,13 @@ public interface IRunControl extends IService {
interface RunControlContext {
/**
+ * Get context properties. See PROP_* definitions for property names.
+ * Context properties are read only, clients should not try to modify them.
+ * @return Map of context properties.
+ */
+ Map<String,Object> getProperties();
+
+ /**
* Retrieve context ID.
* Same as getProperties().get(“ID”)
*/
@@ -223,11 +250,16 @@ public interface IRunControl extends IService {
String getParentID();
/**
- * Get context properties. See PROP_* definitions for property names.
- * Context properties are read only, clients should not try to modify them.
- * @return Map of context properties.
+ * Retrieve context process ID.
+ * Same as getProperties().get(“ProcessID”)
*/
- Map<String,Object> getProperties();
+ String getProcessID();
+
+ /**
+ * Retrieve context creator ID.
+ * Same as getProperties().get(“CreatorID”)
+ */
+ String getCreatorID();
/**
* Utility method to read context property PROP_IS_CONTAINER.
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 58d7075bd..5b1cdb6c2 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
@@ -40,9 +40,11 @@ class TestExpressions implements ITCFTest,
private String bp_id;
private boolean bp_ok;
private IDiagnostics.ISymbol sym_func3;
+ private String test_ctx_id;
private String process_id;
private String thread_id;
private boolean test_done;
+ private IRunControl.RunControlContext test_ctx;
private IRunControl.RunControlContext thread_ctx;
private String suspended_pc;
private boolean waiting_suspend;
@@ -181,14 +183,35 @@ class TestExpressions implements ITCFTest,
});
return;
}
- if (process_id == null) {
+ if (test_ctx_id == null) {
diag.runTest("RCBP1", new IDiagnostics.DoneRunTest() {
public void doneRunTest(IToken token, Throwable error, String id) {
if (error != null) {
exit(error);
}
else {
- process_id = id;
+ test_ctx_id = id;
+ runTest();
+ }
+ }
+ });
+ return;
+ }
+ if (test_ctx == null) {
+ rc.getContext(test_ctx_id, new IRunControl.DoneGetContext() {
+ public void doneGetContext(IToken token, Exception error, IRunControl.RunControlContext ctx) {
+ if (error != null) {
+ exit(error);
+ }
+ else if (ctx == null) {
+ exit(new Exception("Invalid test execution context"));
+ }
+ else {
+ test_ctx = ctx;
+ process_id = test_ctx.getProcessID();
+ if (!process_id.equals(test_ctx_id)) {
+ thread_id = test_ctx_id;
+ }
runTest();
}
}
@@ -204,6 +227,9 @@ class TestExpressions implements ITCFTest,
else if (ids == null || ids.length == 0) {
exit(new Exception("Test process has no threads"));
}
+ else if (ids.length != 1) {
+ exit(new Exception("Test process has too many threads"));
+ }
else {
thread_id = ids[0];
runTest();
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 a3a2e87ec..41217f293 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
@@ -714,7 +714,7 @@ class TestRCBP1 implements ITCFTest,
if (!context_id.equals(mem_ctx.getID())) {
exit(new Exception("Bad memory context data: invalid ID"));
}
- Object pid = context.getProperties().get(IRunControl.PROP_PROCESS_ID);
+ Object pid = context.getProcessID();
if (pid != null && !pid.equals(mem_ctx.getProcessID())) {
exit(new Exception("Bad memory context data: invalid ProcessID"));
}

Back to the top