5 * which accompanies this distribution, and is available at |
5 * which accompanies this distribution, and is available at |
6 * http://www.eclipse.org/legal/epl-v10.html |
6 * http://www.eclipse.org/legal/epl-v10.html |
7 * |
7 * |
8 * Contributors: |
8 * Contributors: |
9 * Wind River Systems - initial API and implementation |
9 * Wind River Systems - initial API and implementation |
|
10 * Nokia - enhanced to work for both GDB and EDC. Nov. 2009. |
10 *******************************************************************************/ |
11 *******************************************************************************/ |
11 package org.eclipse.cdt.dsf.debug.service; |
12 package org.eclipse.cdt.dsf.debug.service; |
12 |
13 |
13 import java.util.List; |
14 import java.util.List; |
14 import java.util.Map; |
15 import java.util.Map; |
15 |
16 |
16 import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor; |
17 import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor; |
17 import org.eclipse.cdt.dsf.concurrent.ThreadSafeAndProhibitedFromDsfExecutor; |
|
18 import org.eclipse.cdt.dsf.debug.service.BreakpointsMediator.BreakpointEventType; |
18 import org.eclipse.cdt.dsf.debug.service.BreakpointsMediator.BreakpointEventType; |
19 import org.eclipse.cdt.dsf.debug.service.BreakpointsMediator.ITargetBreakpointInfo; |
19 import org.eclipse.cdt.dsf.debug.service.BreakpointsMediator.ITargetBreakpointInfo; |
20 import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext; |
20 import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext; |
21 import org.eclipse.core.runtime.CoreException; |
21 import org.eclipse.core.runtime.CoreException; |
22 import org.eclipse.debug.core.model.IBreakpoint; |
22 import org.eclipse.debug.core.model.IBreakpoint; |
23 |
23 |
24 /** |
24 /** |
25 * Breakpoint attribute translator interface |
25 * Enhanced breakpoint attribute translator interface |
26 * |
26 * |
27 * @since 2.1 |
27 * @since 2.1 |
28 */ |
28 */ |
29 |
29 |
30 @ThreadSafeAndProhibitedFromDsfExecutor("") |
|
31 public interface IBreakpointAttributeTranslatorExtension extends IBreakpointAttributeTranslator { |
30 public interface IBreakpointAttributeTranslatorExtension extends IBreakpointAttributeTranslator { |
32 /** |
31 /** |
33 * Convert all attributes of the given platform breakpoint (BP) to |
32 * Resolve the breakpoint in given context. A platform BP may be mapped to |
34 * attributes of potential target breakpoints. Two tasks are involved:<br> |
33 * two or more target BPs, e.g. a breakpoint in an in-line function may be |
35 * 1. Convert the attributes to debugger specific ones, if needed. For |
34 * mapped to several target BPs, or a thread-specific BP may be mapped to |
36 * instance, GDB implementation has its own breakpoint attribute keys. <br> |
35 * several target BPs each of which is for one thread. This method will get |
37 * 2. Resolve the breakpoint. A platform BP may be mapped to two or more |
36 * the list of attribute maps each of which corresponds to one target BP.<br> |
38 * target BPs, e.g. a breakpoint in an in-line function may be mapped to |
|
39 * several target BPs, or a thread-specific BP may be mapped to several |
|
40 * target BPs each of which is for one thread. This method will return an |
|
41 * attribute map for each of the target BP.<br> |
|
42 * <br> |
37 * <br> |
43 * This method must be called in DSF execution thread. |
38 * This method is and must be called in DSF execution thread. |
44 * |
39 * |
45 * @param context |
40 * @param context |
46 * - a IBreakpointsTargetDMContext object (which could be a |
41 * - a IBreakpointsTargetDMContext object (which could be a |
47 * process or a loaded module) in which we locate target BPs for |
42 * process or a loaded module) in which we locate target BPs for |
48 * the platform BP. |
43 * the platform BP. Cannot be null. |
49 * @param breakpoint |
44 * @param breakpoint |
50 * - platform breakpoint. |
45 * - platform breakpoint. |
51 * @param bpManagerEnabled |
46 * @param bpAttributes |
52 * - flag from platform breakpoint manager indicating that all |
47 * - all attributes of the breakpoint, usually output from |
53 * breakpoints are enabled. |
48 * {@link #getAllBreakpointAttributes(IBreakpoint, boolean)}. |
54 * @param drm |
49 * @param drm |
55 * - on completion of the request, the DataRequestMonitor |
50 * - on completion of the request, the DataRequestMonitor |
56 * contains one or more attribute maps each of which |
51 * contains one or more attribute maps each of which |
57 * corresponding to one target breakpoint. |
52 * corresponding to one target breakpoint. |
58 * @throws CoreException |
53 * @throws CoreException |
59 */ |
54 */ |
60 public void getTargetBreakpointAttributes(IBreakpointsTargetDMContext context, IBreakpoint breakpoint, |
55 public void resolveBreakpoint(IBreakpointsTargetDMContext context, IBreakpoint breakpoint, |
61 boolean bpManagerEnabled, DataRequestMonitor<List<Map<String, Object>>> drm); |
56 Map<String, Object> bpAttributes, DataRequestMonitor<List<Map<String, Object>>> drm); |
62 |
57 |
63 /** |
58 /** |
64 * Convert platform breakpoint attributes to target-recognizable attributes. |
59 * Get all platform defined attributes for a breakpoint plus all attributes |
65 * This method does not perform task #2 done by {@link this#getTargetBreakpointAttributes(List, IBreakpoint, boolean)}. |
60 * defined by any breakpoint extension such as ICBreakpointExtension in CDT. |
66 * |
61 * In other words, get all attributes available from UI. <br> |
67 * @param platformBPAttrDelta |
62 * <br> |
68 * @return |
63 * The attributes returned are independent of runtime context (process, |
69 */ |
64 * module, etc), whereas attributes from |
70 public Map<String, Object> convertAttributeDelta(Map<String, Object> platformBPAttrDelta); |
65 * {@link #resolveBreakpoint(IBreakpointsTargetDMContext, IBreakpoint, Map, DataRequestMonitor)} |
|
66 * are context sensitive. <br> |
|
67 * <br> |
|
68 * Note this method must not be called in DSF dispatch thread because we are |
|
69 * accessing the resources system to retrieve the breakpoint attributes. |
|
70 * Accessing the resources system potentially requires using global locks. |
|
71 * |
|
72 * @param platformBP |
|
73 * @param bpManagerEnabled |
|
74 * @return list of target (debugger implementation) recognizable attributes. |
|
75 * @throws CoreException |
|
76 */ |
|
77 public Map<String, Object> getAllBreakpointAttributes(IBreakpoint platformBP, boolean bpManagerEnabled) throws CoreException; |
|
78 |
|
79 /** |
|
80 * Convert platform breakpoint attributes to target attributes. This usually |
|
81 * involves changing attributes keys to target recognizable ones. For |
|
82 * instance, GDB integration has its own breakpoint attribute keys. <br> |
|
83 * |
|
84 * @param platformBPAttr |
|
85 * @return |
|
86 */ |
|
87 public Map<String, Object> convertAttributes(Map<String, Object> platformBPAttr); |
71 |
88 |
72 /** |
89 /** |
73 * Update platform about breakpoint status change, e.g. breakpoint installed on target successfully or breakpoint |
90 * Update platform about breakpoint status change, e.g. breakpoint installed on target successfully or breakpoint |
74 * removed from target successfully. |
91 * removed from target successfully.<br> |
75 * |
92 * <br> |
|
93 * Note this method is not and must not be called in DSF dispatch thread. |
|
94 * |
76 * @param bpsInfo |
95 * @param bpsInfo |
77 * @param eventType |
96 * @param eventType |
78 */ |
97 */ |
79 public void updateBreakpointsStatus(Map<IBreakpoint, Map<IBreakpointsTargetDMContext, ITargetBreakpointInfo[]>> bpsInfo, BreakpointEventType eventType); |
98 public void updateBreakpointsStatus(Map<IBreakpoint, Map<IBreakpointsTargetDMContext, ITargetBreakpointInfo[]>> bpsInfo, BreakpointEventType eventType); |
|
99 |
|
100 /** |
|
101 * This is enhanced version of |
|
102 * {@link #canUpdateAttributes(org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointDMContext, Map)} |
|
103 * in that this API gives more context parameters so that client can make |
|
104 * decision on a finer granularity when needed.<br> |
|
105 * <br> |
|
106 * This will be called in DSF dispatch thread. |
|
107 * |
|
108 * @param bp platform breakpoint. |
|
109 * @param context |
|
110 * @param attributes target-recognizable attributes. |
|
111 * @return false as long as one of the attributes cannot be updated by client, otherwise true. |
|
112 */ |
|
113 public boolean canUpdateAttributes(IBreakpoint bp, IBreakpointsTargetDMContext context, Map<String, Object> attributes); |
80 } |
114 } |