From 7cc57a3e1a109e8bd4ba34a7df922c3eac43bbd7 Mon Sep 17 00:00:00 2001 From: eutarass Date: Wed, 14 Oct 2009 18:58:19 +0000 Subject: TCF Agent: Breakpoints service: implemented "StopGroup" breakpoint property --- docs/TCF Service - Breakpoints.html | 81 ++++++++++++++++++++-- .../org/eclipse/tm/tcf/services/IBreakpoints.java | 7 +- .../tm/internal/tcf/debug/tests/TestRCBP1.java | 20 +++--- 3 files changed, 90 insertions(+), 18 deletions(-) diff --git a/docs/TCF Service - Breakpoints.html b/docs/TCF Service - Breakpoints.html index 0bf6ce047..723cb659f 100644 --- a/docs/TCF Service - Breakpoints.html +++ b/docs/TCF Service - Breakpoints.html @@ -189,7 +189,8 @@ A breakpoint service implementation may not change the properties set by the cli @@ -500,12 +501,18 @@ Tools and targets can define additional properties. Predefined properties are:"HasChildren" : <boolean> - if true, children of the context can have different capabilities -
  • "Address" : <boolean> - - if true, "Address" breakpoint property is supported +
  • "Location" : <boolean> + - if true, "Location" breakpoint property is supported
  • "Condition" : <boolean> - if true, "Condition" breakpoint property is supported
  • "FileLine" : <boolean> - if true, "File", "Line" and "Column" breakpoint properties are supported +
  • "ContextIds" : <boolean> + - if true, "ContextIds" breakpoint property is supported +
  • "StopGroup" : <boolean> + - if true, "StopGroup" breakpoint property is supported +
  • "IgnoreCount" : <boolean> + - if true, "IgnoreCount" breakpoint property is supported

    Events

    @@ -618,26 +625,42 @@ E • Breakpoints • contextRemoved • <array of breakpoint IDs * Breakpoint status field names. */ static final String - STATUS_INSTALLED = "Installed", // Array of addresses + STATUS_INSTANCES = "Instances", // Array of Map<String,Object> STATUS_ERROR = "Error", // String STATUS_FILE = "File", // String STATUS_LINE = "Line", // Number STATUS_COLUMN = "Column"; // Number + /** + * Breakpoint instance field names. + */ + static final String + INSTANCE_ERROR = "Error", // String + INSTANCE_CONTEXT = "LocationContext", // String + INSTANCE_ADDRESS = "Address"; // Number + /** * Breakpoint service capabilities. */ static final String CAPABILITY_CONTEXT_ID = "ID", // String CAPABILITY_HAS_CHILDREN = "HasChildren", // Boolean - CAPABILITY_ADDRESS = "Address", // Boolean + CAPABILITY_LOCATION = "Location", // Boolean CAPABILITY_CONDITION = "Condition", // Boolean - CAPABILITY_FILE_LINE = "FileLine"; // Boolean + CAPABILITY_FILE_LINE = "FileLine", // Boolean + CAPABILITY_CONTEXTIDS = "ContextIds", // Boolean + CAPABILITY_STOP_GROUP = "StopGroup", // Boolean + CAPABILITY_IGNORECOUNT = "IgnoreCount"; // Boolean /** * Call back interface for breakpoint service commands. */ interface DoneCommand { + /** + * Called when command is done. + * @param token - command handle. + * @param error - error object or null. + */ void doneCommand(IToken token, Exception error); } @@ -650,6 +673,7 @@ E • Breakpoints • contextRemoved • <array of breakpoint IDs * * @param properties - array of breakpoints. * @param done - command result call back object. + * @return - pending command handle. */ IToken set(Map<String,Object>[] properties, DoneCommand done); @@ -657,6 +681,7 @@ E • Breakpoints • contextRemoved • <array of breakpoint IDs * Called when breakpoint is added into breakpoints table. * @param properties - breakpoint properties. * @param done - command result call back object. + * @return - pending command handle. */ IToken add(Map<String,Object> properties, DoneCommand done); @@ -664,6 +689,7 @@ E • Breakpoints • contextRemoved • <array of breakpoint IDs * Called when breakpoint properties are changed. * @param properties - breakpoint properties. * @param done - command result call back object. + * @return - pending command handle. */ IToken change(Map<String,Object> properties, DoneCommand done); @@ -671,6 +697,7 @@ E • Breakpoints • contextRemoved • <array of breakpoint IDs * Tell target to change (only) PROP_ENABLED breakpoint property 'true'. * @param ids - array of enabled breakpoint identifiers. * @param done - command result call back object. + * @return - pending command handle. */ IToken enable(String[] ids, DoneCommand done); @@ -678,6 +705,7 @@ E • Breakpoints • contextRemoved • <array of breakpoint IDs * Tell target to change (only) PROP_ENABLED breakpoint property to 'false'. * @param ids - array of disabled breakpoint identifiers. * @param done - command result call back object. + * @return - pending command handle. */ IToken disable(String[] ids, DoneCommand done); @@ -685,16 +713,27 @@ E • Breakpoints • contextRemoved • <array of breakpoint IDs * Tell target to remove breakpoint. * @param id - unique breakpoint identifier. * @param done - command result call back object. + * @return - pending command handle. */ IToken remove(String[] ids, DoneCommand done); /** * Upload IDs of breakpoints known to target agent. * @param done - command result call back object. + * @return - pending command handle. */ IToken getIDs(DoneGetIDs done); + /** + * Call back interface for 'getIDs' command. + */ interface DoneGetIDs { + /** + * Called when 'getIDs' command is done. + * @param token - command handle. + * @param error - error object or null. + * @param ids - IDs of breakpoints known to target agent. + */ void doneGetIDs(IToken token, Exception error, String[] ids); } @@ -702,10 +741,20 @@ E • Breakpoints • contextRemoved • <array of breakpoint IDs * Upload properties of given breakpoint from target agent breakpoint table. * @param id - unique breakpoint identifier. * @param done - command result call back object. + * @return - pending command handle. */ IToken getProperties(String id, DoneGetProperties done); + /** + * Call back interface for 'getProperties' command. + */ interface DoneGetProperties { + /** + * Called when 'getProperties' command is done. + * @param token - command handle. + * @param error - error object or null. + * @param properties - properties of the breakpoint. + */ void doneGetProperties(IToken token, Exception error, Map<String,Object> properties); } @@ -713,10 +762,20 @@ E • Breakpoints • contextRemoved • <array of breakpoint IDs * Upload status of given breakpoint from target agent. * @param id - unique breakpoint identifier. * @param done - command result call back object. + * @return - pending command handle. */ IToken getStatus(String id, DoneGetStatus done); + /** + * Call back interface for 'getStatus' command. + */ interface DoneGetStatus { + /** + * Called when 'getStatus' command is done. + * @param token - command handle. + * @param error - error object or null. + * @param status - status of the breakpoint. + */ void doneGetStatus(IToken token, Exception error, Map<String,Object> status); } @@ -729,10 +788,20 @@ E • Breakpoints • contextRemoved • <array of breakpoint IDs * capabilities. * @param id - a context ID or null. * @param done - command result call back object. + * @return - pending command handle. */ IToken getCapabilities(String id, DoneGetCapabilities done); + /** + * Call back interface for 'getCapabilities' command. + */ interface DoneGetCapabilities { + /** + * Called when 'getCapabilities' command is done. + * @param token - command handle. + * @param error - error object or null. + * @param capabilities - breakpoints service capabilities description. + */ void doneGetCapabilities(IToken token, Exception error, Map<String,Object> capabilities); } diff --git a/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/tcf/services/IBreakpoints.java b/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/tcf/services/IBreakpoints.java index ae6b94f44..55ea017cd 100644 --- a/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/tcf/services/IBreakpoints.java +++ b/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/tcf/services/IBreakpoints.java @@ -118,9 +118,12 @@ public interface IBreakpoints extends IService { static final String CAPABILITY_CONTEXT_ID = "ID", // String CAPABILITY_HAS_CHILDREN = "HasChildren", // Boolean - CAPABILITY_ADDRESS = "Location", // Boolean + CAPABILITY_LOCATION = "Location", // Boolean CAPABILITY_CONDITION = "Condition", // Boolean - CAPABILITY_FILE_LINE = "FileLine"; // Boolean + CAPABILITY_FILE_LINE = "FileLine", // Boolean + CAPABILITY_CONTEXTIDS = "ContextIds", // Boolean + CAPABILITY_STOP_GROUP = "StopGroup", // Boolean + CAPABILITY_IGNORECOUNT = "IgnoreCount"; // Boolean /** * Call back interface for breakpoint service commands. 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 136ee03df..491e3b816 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 @@ -377,6 +377,7 @@ class TestRCBP1 implements ITCFTest, ArrayList l = new ArrayList(); l.add(context_id); m.put(IBreakpoints.PROP_CONTEXTIDS, l); + m.put(IBreakpoints.PROP_STOP_GROUP, l); StringBuffer bf = new StringBuffer(); for (String id : threads.keySet()) { if (bf.length() > 0) bf.append(" || "); @@ -532,7 +533,7 @@ class TestRCBP1 implements ITCFTest, public void contextResumed(String id) { if (threads.get(id) == null) return; SuspendedContext sc = suspended.remove(id); - if (!isAlienBreakpoint(sc)) suspended_prev.put(id, sc); + if (isMyBreakpoint(sc)) suspended_prev.put(id, sc); running.add(id); } @@ -551,15 +552,14 @@ class TestRCBP1 implements ITCFTest, } } - private boolean isAlienBreakpoint(SuspendedContext sc) { - // Check if context suspended by a breakpoint from another debug session - // Test should ignore such breakpoints. + private boolean isMyBreakpoint(SuspendedContext sc) { + // Check if context suspended by a one of our breakpoint if (!"Breakpoint".equals(sc.reason)) return false; long pc = Long.parseLong(sc.pc); - if (pc == func0.getValue().longValue()) return false; - if (pc == func1.getValue().longValue()) return false; - if (pc == func2.getValue().longValue()) return false; - return true; + if (pc == func0.getValue().longValue()) return true; + if (pc == func1.getValue().longValue()) return true; + if (pc == func2.getValue().longValue()) return true; + return false; } public void contextSuspended(String id, String pc, String reason, Map params) { @@ -575,7 +575,7 @@ class TestRCBP1 implements ITCFTest, sc = new SuspendedContext(id, pc, reason, params); suspended.put(id, sc); } - if (main_thread_id == null && "Breakpoint".equals(reason) && !isAlienBreakpoint(sc)) { + if (main_thread_id == null && "Breakpoint".equals(reason) && isMyBreakpoint(sc)) { // Process main thread should be the first to hit a breakpoint in the test if (!done_starting_test_process) { exit(new Exception("Unexpeceted breakpoint hit")); @@ -587,7 +587,7 @@ class TestRCBP1 implements ITCFTest, resume(sc); return; } - if (!isAlienBreakpoint(sc)) { + if (isMyBreakpoint(sc)) { if ("Breakpoint".equals(reason) && id.equals(main_thread_id)) bp_cnt++; SuspendedContext sp = suspended_prev.get(id); if (sp != null) { -- cgit v1.2.3