1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
/*******************************************************************************
* Copyright (c) 2007, 2015 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.tcf.internal.cdt.ui.breakpoints;
import java.util.Map;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.model.ICBreakpointType;
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
import org.eclipse.cdt.dsf.debug.ui.actions.AbstractDisassemblyBreakpointsTarget;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IWorkbenchPart;
/**
* Toggles a TCF Scoped breakpoint in the disassembly view.
*/
public class TCFDisassemblyToggleBreakpointAdapter extends AbstractDisassemblyBreakpointsTarget {
private final String TOGGLE_TYPE;
private IWorkbenchPart fTogglePart;
TCFDisassemblyToggleBreakpointAdapter(String toggle_type ) {
TOGGLE_TYPE = toggle_type;
}
@Override
public void toggleLineBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
// Save the workbench part that toggle is invoked on, use it in {@link #createLineBreakpoint}
fTogglePart = part;
super.toggleLineBreakpoints(part, selection);
fTogglePart = null;
}
@Override
protected void createLineBreakpoint( String sourceHandle, IResource resource, int lineNumber ) throws CoreException {
Map<String, Object> attributes = TCFToggleBreakpointAdapter.getDefaultAttributes(fTogglePart, TOGGLE_TYPE);
ICLineBreakpoint lineBp = CDIDebugModel.createBlankLineBreakpoint();
CDIDebugModel.setLineBreakpointAttributes(
attributes, sourceHandle, getBreakpointType(), lineNumber, true, 0, "" ); //$NON-NLS-1$
CDIDebugModel.createBreakpointMarker(lineBp, resource, attributes, true);
}
@Override
protected void createLineBreakpointInteractive(IWorkbenchPart part, String sourceHandle, IResource resource, int lineNumber) throws CoreException {
ICLineBreakpoint lineBp = CDIDebugModel.createBlankLineBreakpoint();
Map<String, Object> attributes = TCFToggleBreakpointAdapter.getDefaultAttributes(fTogglePart, TOGGLE_TYPE);
CDIDebugModel.setLineBreakpointAttributes(
attributes, sourceHandle, getBreakpointType(), lineNumber, true, 0, ""); //$NON-NLS-1$
openBreakpointPropertiesDialog(lineBp, part, resource, attributes);
}
@Override
protected void createAddressBreakpoint(IResource resource, IAddress address) throws CoreException {
CDIDebugModel.createAddressBreakpoint(null, null, resource, getBreakpointType(), address, true, 0, "", true); //$NON-NLS-1$
}
@Override
protected void createAddressBreakpointInteractive(IWorkbenchPart part, IResource resource, IAddress address) throws CoreException {
ICLineBreakpoint lineBp = CDIDebugModel.createBlankAddressBreakpoint();
Map<String, Object> attributes = TCFToggleBreakpointAdapter.getDefaultAttributes(fTogglePart, TOGGLE_TYPE);
CDIDebugModel.setAddressBreakpointAttributes(
attributes, null, null, getBreakpointType(), -1, address, true, 0, ""); //$NON-NLS-1$
openBreakpointPropertiesDialog(lineBp, part, resource, attributes);
}
protected int getBreakpointType() {
return ICBreakpointType.REGULAR;
}
}
|