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