mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Bug 478740: Changes for supporting Hardware Reverse Debugging
The original toggle button for reverse debugging has been modified to a pulldown menu for selecting between hardware and software methods along with all necessary support. Change-Id: I2e4d97c46950253986d427cb87cda66b820744c9 Signed-off-by: raddepal <ravitheja.addepally@intel.com> Signed-off-by: Marc Khouzam <marc.khouzam@ericsson.com>
This commit is contained in:
parent
e7d064e89c
commit
5aa4380050
36 changed files with 1330 additions and 91 deletions
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %pluginName
|
||||
Bundle-SymbolicName: org.eclipse.cdt.debug.core; singleton:=true
|
||||
Bundle-Version: 7.7.0.qualifier
|
||||
Bundle-Version: 7.8.0.qualifier
|
||||
Bundle-Activator: org.eclipse.cdt.debug.core.CDebugCorePlugin
|
||||
Bundle-Vendor: %providerName
|
||||
Bundle-Localization: plugin
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<version>7.7.0-SNAPSHOT</version>
|
||||
<version>7.8.0-SNAPSHOT</version>
|
||||
<artifactId>org.eclipse.cdt.debug.core</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
</project>
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015 Intel Corporation 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:
|
||||
* Intel Corporation - Added Reverse Debugging BTrace support
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.core.model;
|
||||
|
||||
import org.eclipse.debug.core.commands.IDebugCommandHandler;
|
||||
|
||||
/**
|
||||
* Handler interface for the reverse debug change trace method command
|
||||
*
|
||||
* @since 7.8
|
||||
*/
|
||||
public interface IChangeReverseMethodHandler extends IReverseToggleHandler, IDebugCommandHandler {
|
||||
|
||||
public enum ReverseTraceMethod {INVALID, STOP_TRACE, FULL_TRACE, HARDWARE_TRACE, BRANCH_TRACE, PROCESSOR_TRACE, GDB_TRACE};
|
||||
|
||||
void setTraceMethod(ReverseTraceMethod traceMethod);
|
||||
|
||||
/**
|
||||
* get the trace method
|
||||
* @return FullTrace, BranchTrace, ProcessorTrace
|
||||
*
|
||||
*/
|
||||
ReverseTraceMethod getTraceMethod(Object context);
|
||||
}
|
BIN
debug/org.eclipse.cdt.debug.ui/icons/obj16/branch_trace_off.gif
Normal file
BIN
debug/org.eclipse.cdt.debug.ui/icons/obj16/branch_trace_off.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 221 B |
BIN
debug/org.eclipse.cdt.debug.ui/icons/obj16/branch_trace_on.gif
Normal file
BIN
debug/org.eclipse.cdt.debug.ui/icons/obj16/branch_trace_on.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 162 B |
BIN
debug/org.eclipse.cdt.debug.ui/icons/obj16/full_trace_off.gif
Normal file
BIN
debug/org.eclipse.cdt.debug.ui/icons/obj16/full_trace_off.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 221 B |
BIN
debug/org.eclipse.cdt.debug.ui/icons/obj16/full_trace_on.gif
Normal file
BIN
debug/org.eclipse.cdt.debug.ui/icons/obj16/full_trace_on.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 162 B |
|
@ -15,6 +15,7 @@
|
|||
# Alvaro Sanchez-Leon (Ericsson AB) - Support for Step into selection (bug 244865)
|
||||
# Marc Khouzam (Ericsson) - Added dynamic printf support (Bug 400628)
|
||||
# Jonah Graham (Kichwa Coders) - Create "Add Line Breakpoint (C/C++)" action (Bug 464917)
|
||||
# Intel Corporation - Added Reverse Debugging BTrace support
|
||||
###############################################################################
|
||||
|
||||
pluginName=C/C++ Development Tools Debugger UI
|
||||
|
@ -210,6 +211,7 @@ ReverseDebuggingCategory.description = Set of commands for Reverse Debugging
|
|||
ReverseToggle.name = Reverse Toggle
|
||||
ReverseToggle.description = Toggle Reverse Debugging
|
||||
ReverseToggle.label = Toggle Reverse Debugging
|
||||
ReverseToggle.commandparam = TraceMethod
|
||||
ReverseResume.name = Reverse Resume
|
||||
ReverseResume.description = Perform Reverse Resume
|
||||
ReverseResume.label = Reverse Resume
|
||||
|
@ -222,6 +224,15 @@ ReverseStepOver.label = Reverse Step Over
|
|||
Uncall.name = Uncall
|
||||
Uncall.description = Perform Uncall
|
||||
Uncall.label = Uncall
|
||||
ChangeTraceMethod.name = Set Reverse Debugging Trace Method
|
||||
ChangeTraceMethod.description = Set Reverse Debugging Trace Method
|
||||
ChangeTraceMethod.label = Set Reverse Debugging Trace Method
|
||||
SoftwareTrace.name = Use Software Trace
|
||||
SoftwareTrace.description = Use Software Trace for Reverse Debugging. Slow, but detailed reverse debugging method.
|
||||
SoftwareTrace.label = Use Software Trace
|
||||
HardwareTrace.name = Use Hardware Trace
|
||||
HardwareTrace.description = Use Hardware Trace for Reverse Debugging. Fast, but less detailed reverse debugging method.
|
||||
HardwareTrace.label = Use Hardware Trace
|
||||
|
||||
# Connect command
|
||||
Connect.name = Connect
|
||||
|
|
|
@ -1911,6 +1911,21 @@
|
|||
description="%ReverseToggle.description"
|
||||
id="org.eclipse.cdt.debug.ui.command.reverseToggle"
|
||||
name="%ReverseToggle.name">
|
||||
<commandParameter
|
||||
id="org.eclipse.ui.commands.radioStateParameter"
|
||||
name="%ReverseToggle.commandparam"
|
||||
optional="false">
|
||||
</commandParameter>
|
||||
<state
|
||||
id="org.eclipse.ui.commands.radioState">
|
||||
<class
|
||||
class="org.eclipse.ui.handlers.RadioState">
|
||||
<parameter
|
||||
name="persisted"
|
||||
value="false">
|
||||
</parameter>
|
||||
</class>
|
||||
</state>
|
||||
</command>
|
||||
<command
|
||||
categoryId="org.eclipse.cdt.debug.ui.category.reverseDebugging"
|
||||
|
@ -2371,7 +2386,7 @@
|
|||
commandId="org.eclipse.cdt.debug.ui.command.reverseToggle"
|
||||
icon="icons/obj16/reverse_toggle.gif"
|
||||
label="%ReverseToggle.label"
|
||||
style="toggle">
|
||||
style="pulldown">
|
||||
<visibleWhen checkEnabled="false">
|
||||
<and>
|
||||
<reference definitionId="org.eclipse.cdt.debug.ui.testIsReverseDebuggingActionSetActive"/>
|
||||
|
@ -2444,15 +2459,15 @@
|
|||
<!-- Reverse debugging contributions to Run menu -->
|
||||
<menuContribution
|
||||
locationURI="menu:org.eclipse.ui.run?before=stepGroup">
|
||||
<command
|
||||
<menu
|
||||
commandId="org.eclipse.cdt.debug.ui.command.reverseToggle"
|
||||
icon="icons/obj16/reverse_toggle.gif"
|
||||
label="%ReverseToggle.label"
|
||||
style="toggle">
|
||||
style="pulldown">
|
||||
<visibleWhen checkEnabled="false">
|
||||
<reference definitionId="org.eclipse.cdt.debug.ui.testIsReverseDebuggingActionSetActive"/>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
</menu>
|
||||
</menuContribution>
|
||||
<menuContribution
|
||||
locationURI="menu:org.eclipse.ui.run?after=stepGroup">
|
||||
|
@ -2506,15 +2521,35 @@
|
|||
<!-- Reverse debugging contributions to Debug view popup -->
|
||||
<menuContribution
|
||||
locationURI="popup:org.eclipse.debug.ui.DebugView?before=stepGroup">
|
||||
<command
|
||||
<menu
|
||||
commandId="org.eclipse.cdt.debug.ui.command.reverseToggle"
|
||||
icon="icons/obj16/reverse_toggle.gif"
|
||||
label="%ReverseToggle.label"
|
||||
style="toggle">
|
||||
style="pulldown">
|
||||
<visibleWhen checkEnabled="false">
|
||||
<reference definitionId="org.eclipse.cdt.debug.ui.testIsReverseDebuggingActionSetActive"/>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<command
|
||||
commandId="org.eclipse.cdt.debug.ui.command.reverseToggle"
|
||||
label="%SoftwareTrace.label"
|
||||
tooltip="%SoftwareTrace.description"
|
||||
style="radio">
|
||||
<parameter
|
||||
name="org.eclipse.ui.commands.radioStateParameter"
|
||||
value="UseSoftTrace">
|
||||
</parameter>
|
||||
</command>
|
||||
<command
|
||||
commandId="org.eclipse.cdt.debug.ui.command.reverseToggle"
|
||||
label="%HardwareTrace.label"
|
||||
tooltip="%HardwareTrace.description"
|
||||
style="radio">
|
||||
<parameter
|
||||
name="org.eclipse.ui.commands.radioStateParameter"
|
||||
value="UseHardTrace">
|
||||
</parameter>
|
||||
</command>
|
||||
</menu>
|
||||
</menuContribution>
|
||||
<menuContribution
|
||||
locationURI="popup:org.eclipse.debug.ui.DebugView?after=threadGroup">
|
||||
|
@ -2595,12 +2630,55 @@
|
|||
commandId="org.eclipse.cdt.debug.ui.command.reverseToggle"
|
||||
icon="icons/obj16/reverse_toggle.gif"
|
||||
label="%ReverseToggle.label"
|
||||
style="toggle">
|
||||
style="pulldown">
|
||||
<visibleWhen checkEnabled="false">
|
||||
<reference definitionId="org.eclipse.cdt.debug.ui.testIsReverseDebuggingActionSetActive"/>
|
||||
</visibleWhen>
|
||||
<command
|
||||
commandId="org.eclipse.cdt.debug.ui.command.reverseToggle"
|
||||
label="%SoftwareTrace.label"
|
||||
tooltip="%SoftwareTrace.description"
|
||||
style="radio">
|
||||
<parameter
|
||||
name="org.eclipse.ui.commands.radioStateParameter"
|
||||
value="UseSoftTrace">
|
||||
</parameter>
|
||||
</command>
|
||||
<command
|
||||
commandId="org.eclipse.cdt.debug.ui.command.reverseToggle"
|
||||
label="%HardwareTrace.label"
|
||||
tooltip="%HardwareTrace.description"
|
||||
style="radio">
|
||||
<parameter
|
||||
name="org.eclipse.ui.commands.radioStateParameter"
|
||||
value="UseHardTrace">
|
||||
</parameter>
|
||||
</command>
|
||||
</command>
|
||||
</menuContribution>
|
||||
<menuContribution
|
||||
locationURI="menu:org.eclipse.cdt.debug.ui.command.reverseToggle">
|
||||
<command
|
||||
commandId="org.eclipse.cdt.debug.ui.command.reverseToggle"
|
||||
label="%SoftwareTrace.label"
|
||||
tooltip="%SoftwareTrace.description"
|
||||
style="radio">
|
||||
<parameter
|
||||
name="org.eclipse.ui.commands.radioStateParameter"
|
||||
value="UseSoftTrace">
|
||||
</parameter>
|
||||
</command>
|
||||
<command
|
||||
commandId="org.eclipse.cdt.debug.ui.command.reverseToggle"
|
||||
label="%HardwareTrace.label"
|
||||
tooltip="%HardwareTrace.description"
|
||||
style="radio">
|
||||
<parameter
|
||||
name="org.eclipse.ui.commands.radioStateParameter"
|
||||
value="UseHardTrace">
|
||||
</parameter>
|
||||
</command>
|
||||
</menuContribution>
|
||||
<menuContribution
|
||||
locationURI="toolbar:org.eclipse.debug.ui.main.toolbar?before=threadGroup">
|
||||
<command
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2008 QNX Software Systems and others.
|
||||
* Copyright (c) 2004, 2015 QNX Software Systems 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
|
||||
|
@ -7,6 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* Intel Corporation - Added Reverse Debugging BTrace support
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui;
|
||||
|
||||
|
@ -39,5 +40,6 @@ public class CDebugUIPreferenceInitializer extends AbstractPreferenceInitializer
|
|||
pstore.setDefault( ICDebugPreferenceConstants.PREF_DISASM_OPEN_SOURCE_NOT_FOUND, false );
|
||||
pstore.setDefault( ICDebugPreferenceConstants.PREF_DISASM_SHOW_INSTRUCTIONS, true );
|
||||
pstore.setDefault( ICDebugPreferenceConstants.PREF_DISASM_SHOW_SOURCE, true );
|
||||
pstore.setDefault(ICDebugPreferenceConstants.PREF_SHOW_ERROR_REVERSE_TRACE_METHOD_NOT_AVAILABLE, true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,16 +7,26 @@
|
|||
*
|
||||
* Contributors:
|
||||
* Ericsson - initial API and implementation
|
||||
* Intel Corporation - Added Reverse Debugging BTrace support
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.commands;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.debug.core.model.IChangeReverseMethodHandler;
|
||||
import org.eclipse.cdt.debug.core.model.IChangeReverseMethodHandler.ReverseTraceMethod;
|
||||
import org.eclipse.cdt.debug.core.model.IReverseToggleHandler;
|
||||
import org.eclipse.cdt.debug.internal.ui.preferences.ICDebugPreferenceConstants;
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.core.runtime.FileLocator;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IAdapterManager;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.debug.core.IRequest;
|
||||
|
@ -25,15 +35,23 @@ import org.eclipse.debug.ui.actions.DebugCommandHandler;
|
|||
import org.eclipse.debug.ui.contexts.DebugContextEvent;
|
||||
import org.eclipse.debug.ui.contexts.IDebugContextListener;
|
||||
import org.eclipse.debug.ui.contexts.IDebugContextService;
|
||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.commands.ICommandService;
|
||||
import org.eclipse.ui.commands.IElementUpdater;
|
||||
import org.eclipse.ui.handlers.HandlerUtil;
|
||||
import org.eclipse.ui.handlers.RadioState;
|
||||
import org.eclipse.ui.menus.UIElement;
|
||||
import org.eclipse.ui.progress.WorkbenchJob;
|
||||
import org.eclipse.ui.services.IEvaluationService;
|
||||
import org.osgi.framework.Bundle;
|
||||
|
||||
/**
|
||||
* Command handler to toggle reverse debugging mode
|
||||
|
@ -41,10 +59,16 @@ import org.eclipse.ui.services.IEvaluationService;
|
|||
* @since 7.0
|
||||
*/
|
||||
public class ReverseToggleCommandHandler extends DebugCommandHandler implements IDebugContextListener, IElementUpdater {
|
||||
@Override
|
||||
protected Class<?> getCommandType() {
|
||||
return IReverseToggleHandler.class;
|
||||
}
|
||||
|
||||
ReverseTraceMethod traceMethod = null;
|
||||
ReverseTraceMethod lastTraceMethod = null;
|
||||
ImageDescriptor tracemethodOnImages[];
|
||||
ImageDescriptor tracemethodOffImages[];
|
||||
ImageDescriptor tracemethodDefaultImage = null;
|
||||
@Override
|
||||
protected Class<?> getCommandType() {
|
||||
return IReverseToggleHandler.class;
|
||||
}
|
||||
|
||||
//
|
||||
// The below logic allows us to keep the checked state of the toggle button
|
||||
|
@ -62,25 +86,42 @@ public class ReverseToggleCommandHandler extends DebugCommandHandler implements
|
|||
private IReverseToggleHandler fTargetAdapter = null;
|
||||
private IDebugContextService fContextService = null;
|
||||
|
||||
private ImageDescriptor getImageDescriptor (String path) {
|
||||
Bundle bundle = Platform.getBundle("org.eclipse.cdt.debug.ui"); //$NON-NLS-1$
|
||||
URL url = null;
|
||||
if (bundle != null){
|
||||
url = FileLocator.find(bundle, new Path(path), null);
|
||||
if(url != null) {
|
||||
return ImageDescriptor.createFromURL(url);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ReverseToggleCommandHandler() {
|
||||
final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
|
||||
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
|
||||
if (window != null) {
|
||||
window.getShell().getDisplay().asyncExec(new Runnable() {
|
||||
fContextService = DebugUITools.getDebugContextManager().getContextService(window);
|
||||
if (fContextService != null) {
|
||||
fContextService.addPostDebugContextListener(this);
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
fContextService = DebugUITools.getDebugContextManager().getContextService(window);
|
||||
if (fContextService != null) {
|
||||
fContextService.addPostDebugContextListener(ReverseToggleCommandHandler.this);
|
||||
// This constructor might be called after the launch, so we must refresh here too.
|
||||
// This can happen if we activate the action set after the launch.
|
||||
refresh(fContextService.getActiveContext());
|
||||
|
||||
// This constructor might be called after the launch, so we must refresh here too.
|
||||
// This can happen if we activate the action set after the launch.
|
||||
refresh(fContextService.getActiveContext());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
tracemethodOnImages = new ImageDescriptor[2];
|
||||
tracemethodOffImages = new ImageDescriptor[2];
|
||||
tracemethodDefaultImage = getImageDescriptor("icons/obj16/reverse_toggle.gif"); //$NON-NLS-1$
|
||||
tracemethodOnImages[0] = getImageDescriptor("icons/obj16/full_trace_on.gif"); //$NON-NLS-1$
|
||||
tracemethodOnImages[1] = getImageDescriptor("icons/obj16/branch_trace_on.gif"); //$NON-NLS-1$
|
||||
tracemethodOffImages[0] = getImageDescriptor("icons/obj16/full_trace_off.gif"); //$NON-NLS-1$
|
||||
tracemethodOffImages[1] = getImageDescriptor("icons/obj16/branch_trace_off.gif"); //$NON-NLS-1$
|
||||
|
||||
traceMethod = ReverseTraceMethod.STOP_TRACE;
|
||||
lastTraceMethod = ReverseTraceMethod.STOP_TRACE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
|
@ -96,7 +137,7 @@ public class ReverseToggleCommandHandler extends DebugCommandHandler implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public void debugContextChanged(DebugContextEvent event) {
|
||||
public void debugContextChanged(DebugContextEvent event) {
|
||||
refresh(event.getContext());
|
||||
}
|
||||
|
||||
|
@ -119,15 +160,79 @@ public class ReverseToggleCommandHandler extends DebugCommandHandler implements
|
|||
}
|
||||
}
|
||||
|
||||
private IReverseToggleHandler getAdapter(IAdaptable adaptable) {
|
||||
IReverseToggleHandler adapter = adaptable.getAdapter(IReverseToggleHandler.class);
|
||||
private IChangeReverseMethodHandler getAdapter(IAdaptable adaptable) {
|
||||
IReverseToggleHandler adapter = adaptable.getAdapter(IReverseToggleHandler.class);
|
||||
if (adapter == null) {
|
||||
IAdapterManager adapterManager = Platform.getAdapterManager();
|
||||
if (adapterManager.hasAdapter(adaptable, getCommandType().getName())) {
|
||||
adapter = (IReverseToggleHandler)adapterManager.loadAdapter(adaptable, IReverseToggleHandler.class.getName());
|
||||
}
|
||||
}
|
||||
return adapter;
|
||||
if (adapter instanceof IChangeReverseMethodHandler)
|
||||
return (IChangeReverseMethodHandler)adapter;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.debug.ui.actions.DebugCommandHandler#execute(org.eclipse.core.commands.ExecutionEvent)
|
||||
*/
|
||||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
ReverseTraceMethod traceMethod;
|
||||
try {
|
||||
|
||||
if(HandlerUtil.matchesRadioState(event)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String radioState = event.getParameter(RadioState.PARAMETER_ID);
|
||||
|
||||
if (radioState.equals("UseSoftTrace")) { //$NON-NLS-1$
|
||||
traceMethod = ReverseTraceMethod.FULL_TRACE;
|
||||
}
|
||||
else if (radioState.equals("UseHardTrace")) { //$NON-NLS-1$
|
||||
traceMethod = ReverseTraceMethod.HARDWARE_TRACE;
|
||||
}
|
||||
else {
|
||||
// undefined trace method
|
||||
throw new ExecutionException("Undefined trace method for Reverse Debugging."); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
// store the parameter in the gdb command handler class
|
||||
if (fTargetAdapter != null && fTargetAdapter instanceof IChangeReverseMethodHandler) {
|
||||
((IChangeReverseMethodHandler)fTargetAdapter).setTraceMethod(traceMethod);
|
||||
}
|
||||
|
||||
// execute the event
|
||||
super.execute(event);
|
||||
|
||||
// and finally update the radio current state
|
||||
HandlerUtil.updateRadioState(event.getCommand(), radioState);
|
||||
|
||||
return null;
|
||||
}
|
||||
catch ( NullPointerException | ExecutionException e) {
|
||||
// Disable tracing
|
||||
if (fTargetAdapter != null && fTargetAdapter instanceof IChangeReverseMethodHandler) {
|
||||
if (fTargetAdapter.toggleNeedsUpdating()){
|
||||
ReverseTraceMethod currMethod = ((IChangeReverseMethodHandler)fTargetAdapter).getTraceMethod(fActiveContext);
|
||||
if(currMethod == ReverseTraceMethod.STOP_TRACE) {
|
||||
if( lastTraceMethod != ReverseTraceMethod.STOP_TRACE && lastTraceMethod != ReverseTraceMethod.FULL_TRACE) {
|
||||
traceMethod = ReverseTraceMethod.HARDWARE_TRACE;
|
||||
}
|
||||
else
|
||||
traceMethod = ReverseTraceMethod.FULL_TRACE;
|
||||
|
||||
}
|
||||
else
|
||||
traceMethod = ReverseTraceMethod.STOP_TRACE;
|
||||
((IChangeReverseMethodHandler)fTargetAdapter).setTraceMethod(traceMethod);
|
||||
}
|
||||
}
|
||||
super.execute(event);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -137,38 +242,88 @@ public class ReverseToggleCommandHandler extends DebugCommandHandler implements
|
|||
* We keep this logic for users that may not do the refresh themselves.
|
||||
*/
|
||||
@Override
|
||||
protected void postExecute(IRequest request, Object[] targets) {
|
||||
super.postExecute(request, targets);
|
||||
new WorkbenchJob("") { //$NON-NLS-1$
|
||||
@Override
|
||||
public IStatus runInUIThread(IProgressMonitor monitor) {
|
||||
// Request re-evaluation of property "org.eclipse.cdt.debug.ui.isReverseDebuggingEnabled" to update
|
||||
// visibility of reverse stepping commands.
|
||||
IEvaluationService exprService = PlatformUI.getWorkbench().getService(IEvaluationService.class);
|
||||
if (exprService != null) {
|
||||
exprService.requestEvaluation("org.eclipse.cdt.debug.ui.isReverseDebuggingEnabled"); //$NON-NLS-1$
|
||||
}
|
||||
// Refresh reverse toggle commands with the new state of reverse enabled.
|
||||
// This is in order to keep multiple toggle actions in UI in sync.
|
||||
ICommandService commandService = PlatformUI.getWorkbench().getService(ICommandService.class);
|
||||
if (commandService != null) {
|
||||
commandService.refreshElements(REVERSE_TOGGLE_COMMAND_ID, null);
|
||||
}
|
||||
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
}.schedule();
|
||||
protected void postExecute(final IRequest request, Object[] targets) {
|
||||
super.postExecute(request, targets);
|
||||
new WorkbenchJob("") { //$NON-NLS-1$
|
||||
@Override
|
||||
public IStatus runInUIThread(IProgressMonitor monitor) {
|
||||
boolean prop = CDebugUIPlugin.getDefault().getPreferenceStore().getBoolean(ICDebugPreferenceConstants.PREF_SHOW_ERROR_REVERSE_TRACE_METHOD_NOT_AVAILABLE);
|
||||
if(prop && request.getStatus() != null && request.getStatus().getCode() != 0 ) {
|
||||
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
|
||||
Shell activeShell = null;
|
||||
if(window != null)
|
||||
activeShell = window.getShell();
|
||||
else
|
||||
activeShell = new Shell(PlatformUI.getWorkbench().getDisplay());
|
||||
|
||||
MessageDialogWithToggle dialogbox = new MessageDialogWithToggle(activeShell, "Error", //$NON-NLS-1$
|
||||
null, "Hardware Tracing Method not available, Reverse debugging is switched Off, please select another method", MessageDialog.QUESTION, //$NON-NLS-1$
|
||||
new String[] {IDialogConstants.OK_LABEL}, 0,
|
||||
"Don't show this message again", false); //$NON-NLS-1$
|
||||
dialogbox.setPrefStore(CDebugUIPlugin.getDefault().getPreferenceStore());
|
||||
dialogbox.setPrefKey(ICDebugPreferenceConstants.PREF_SHOW_ERROR_REVERSE_TRACE_METHOD_NOT_AVAILABLE);
|
||||
if(dialogbox.open() == 0){
|
||||
boolean toggled = dialogbox.getToggleState();
|
||||
CDebugUIPlugin.getDefault().getPreferenceStore().setValue(ICDebugPreferenceConstants.PREF_SHOW_ERROR_REVERSE_TRACE_METHOD_NOT_AVAILABLE, !toggled);
|
||||
}
|
||||
}
|
||||
// Request re-evaluation of property "org.eclipse.cdt.debug.ui.isReverseDebuggingEnabled" to update
|
||||
// visibility of reverse stepping commands.
|
||||
IEvaluationService exprService = PlatformUI.getWorkbench().getService(IEvaluationService.class);
|
||||
if (exprService != null) {
|
||||
exprService.requestEvaluation("org.eclipse.cdt.debug.ui.isReverseDebuggingEnabled"); //$NON-NLS-1$
|
||||
}
|
||||
// Refresh reverse toggle commands with the new state of reverse enabled.
|
||||
// This is in order to keep multiple toggle actions in UI in sync.
|
||||
ICommandService commandService = PlatformUI.getWorkbench().getService(ICommandService.class);
|
||||
if (commandService != null) {
|
||||
commandService.refreshElements(REVERSE_TOGGLE_COMMAND_ID, null);
|
||||
}
|
||||
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
}.schedule();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateElement(UIElement element,
|
||||
public void updateElement(UIElement element,
|
||||
@SuppressWarnings("rawtypes") Map parameters) {
|
||||
// Make sure the toggle state reflects the actual state
|
||||
// We must check this, in case we have multiple launches
|
||||
// or if we re-launch (restart)
|
||||
if (fTargetAdapter != null && fTargetAdapter.toggleNeedsUpdating()){
|
||||
boolean toggled = fTargetAdapter.isReverseToggled(fActiveContext);
|
||||
element.setChecked(toggled);
|
||||
if(fTargetAdapter != null && fTargetAdapter instanceof IChangeReverseMethodHandler){
|
||||
ReverseTraceMethod reverseMethod = ((IChangeReverseMethodHandler)fTargetAdapter).getTraceMethod(fActiveContext);
|
||||
ICommandService commandService = PlatformUI.getWorkbench().getService(ICommandService.class);
|
||||
if(reverseMethod != traceMethod){
|
||||
lastTraceMethod = traceMethod;
|
||||
traceMethod = reverseMethod;
|
||||
}
|
||||
try{
|
||||
if (traceMethod != ReverseTraceMethod.STOP_TRACE && traceMethod != ReverseTraceMethod.FULL_TRACE) {
|
||||
HandlerUtil.updateRadioState(commandService.getCommand(REVERSE_TOGGLE_COMMAND_ID), "UseHardTrace"); //$NON-NLS-1$
|
||||
element.setTooltip("Toggle Hardware Trace"); //$NON-NLS-1$
|
||||
element.setIcon(tracemethodOnImages[1]);
|
||||
}
|
||||
else if (traceMethod == ReverseTraceMethod.FULL_TRACE) {
|
||||
HandlerUtil.updateRadioState(commandService.getCommand(REVERSE_TOGGLE_COMMAND_ID), "UseSoftTrace"); //$NON-NLS-1$
|
||||
element.setTooltip("Toggle Software Trace"); //$NON-NLS-1$
|
||||
element.setIcon(tracemethodOnImages[0]);
|
||||
}
|
||||
else {
|
||||
element.setTooltip("Toggle Reverse Debugging"); //$NON-NLS-1$
|
||||
if (lastTraceMethod != ReverseTraceMethod.STOP_TRACE && lastTraceMethod != ReverseTraceMethod.FULL_TRACE) {
|
||||
HandlerUtil.updateRadioState(commandService.getCommand(REVERSE_TOGGLE_COMMAND_ID), "UseHardTrace"); //$NON-NLS-1$
|
||||
element.setIcon(tracemethodOffImages[1]);
|
||||
}
|
||||
else if (lastTraceMethod == ReverseTraceMethod.FULL_TRACE) {
|
||||
HandlerUtil.updateRadioState(commandService.getCommand(REVERSE_TOGGLE_COMMAND_ID), "UseSoftTrace"); //$NON-NLS-1$
|
||||
element.setIcon(tracemethodOffImages[0]);
|
||||
}
|
||||
else {
|
||||
element.setIcon(tracemethodDefaultImage);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(ExecutionException e){
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,6 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* Intel Corporation - Added Reverse Debugging BTrace support
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.preferences;
|
||||
|
||||
|
@ -50,4 +51,9 @@ public interface ICDebugPreferenceConstants {
|
|||
* Boolean preference controlling whether the disassembly editor is be activated if the source file can't be found.
|
||||
*/
|
||||
public static final String PREF_DISASM_OPEN_SOURCE_NOT_FOUND = ICDebugUIConstants.PLUGIN_ID + ".disassembly.openSourceNotFound"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Boolean preference controlling whether to display error dialog box when trace method is not available.
|
||||
*/
|
||||
public static final String PREF_SHOW_ERROR_REVERSE_TRACE_METHOD_NOT_AVAILABLE = ICDebugUIConstants.PLUGIN_ID + ".reversedebugpref.tracemethodNotAvailable"; //$NON-NLS-1$
|
||||
}
|
||||
|
|
|
@ -11,11 +11,13 @@
|
|||
# Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121)
|
||||
# Vladimir Prus (Mentor Graphics) - OS Resources view (bug 360314)
|
||||
# Marc Khouzam (Ericsson) - Support for dynamic printf (bug 400628)
|
||||
# Intel Corporation - Added Reverse Debugging BTrace support
|
||||
###############################################################################
|
||||
pluginName=GDB DSF Debugger Integration UI
|
||||
providerName=Eclipse CDT
|
||||
|
||||
gdbPreferencePage.name = GDB
|
||||
reverseDebugPreferences.name = Reverse Debugging Preferences
|
||||
|
||||
launchTab.main.name=Main
|
||||
launchTab.arguments.name=Arguments
|
||||
|
|
|
@ -499,6 +499,12 @@
|
|||
id="org.eclipse.cdt.dsf.gdb.ui.preferences.TracepointActionsPreferencePage"
|
||||
name="%tracepointActionsPrefPage.name">
|
||||
</page>
|
||||
<page
|
||||
category="org.eclipse.cdt.dsf.gdb.ui.preferences"
|
||||
class="org.eclipse.cdt.dsf.gdb.internal.ui.preferences.ReverseDebugPreferencePage"
|
||||
id="org.eclipse.cdt.dsf.gdb.ui.preferences.reversedebugpreferences"
|
||||
name="%reverseDebugPreferences.name">
|
||||
</page>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.console.consolePageParticipants">
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
* Contributors:
|
||||
* Marc Khouzam (Ericsson) - initial API and implementation
|
||||
* Mikhail Khodjaiants (Mentor Graphics) - initial API and implementation
|
||||
* Intel Corporation - Added Reverse Debugging BTrace support
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.internal.ui;
|
||||
|
||||
|
@ -312,7 +313,7 @@ public class GdbSessionAdapters {
|
|||
if (IRefreshAllTarget.class.equals(adapterType)) {
|
||||
return (T)new DefaultRefreshAllTarget();
|
||||
}
|
||||
if (IReverseToggleHandler.class.equals(adapterType)) {
|
||||
if (IReverseToggleHandler.class.equals(adapterType)) {
|
||||
return (T)new GdbReverseToggleCommand(session);
|
||||
}
|
||||
if (IStartTracingHandler.class.equals(adapterType)) {
|
||||
|
|
|
@ -8,13 +8,14 @@
|
|||
* Contributors:
|
||||
* Ericsson - initial API and implementation
|
||||
* Marc Khouzam (Ericsson) - Listen for IReverseModeChangedDMEvent (Bug 399163)
|
||||
* Intel Corporation - Added Reverse Debugging BTrace support
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.internal.ui.commands;
|
||||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
|
||||
import org.eclipse.cdt.debug.core.model.IReverseToggleHandler;
|
||||
import org.eclipse.cdt.debug.core.model.IChangeReverseMethodHandler;
|
||||
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||
import org.eclipse.cdt.dsf.concurrent.DsfExecutor;
|
||||
import org.eclipse.cdt.dsf.concurrent.DsfRunnable;
|
||||
|
@ -24,9 +25,12 @@ import org.eclipse.cdt.dsf.datamodel.IDMContext;
|
|||
import org.eclipse.cdt.dsf.debug.service.IRunControl;
|
||||
import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
|
||||
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
|
||||
import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants;
|
||||
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
|
||||
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
|
||||
import org.eclipse.cdt.dsf.gdb.service.IReverseRunControl;
|
||||
import org.eclipse.cdt.dsf.gdb.service.IReverseRunControl.IReverseModeChangedDMEvent;
|
||||
import org.eclipse.cdt.dsf.gdb.service.IReverseRunControl2;
|
||||
import org.eclipse.cdt.dsf.service.DsfServiceEventHandler;
|
||||
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
|
||||
import org.eclipse.cdt.dsf.service.DsfSession;
|
||||
|
@ -34,6 +38,7 @@ import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext;
|
|||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.debug.core.IRequest;
|
||||
import org.eclipse.debug.core.commands.AbstractDebugCommand;
|
||||
|
@ -49,15 +54,18 @@ import org.eclipse.ui.services.IEvaluationService;
|
|||
*
|
||||
* @since 2.1
|
||||
*/
|
||||
public class GdbReverseToggleCommand extends AbstractDebugCommand implements IReverseToggleHandler {
|
||||
public class GdbReverseToggleCommand extends AbstractDebugCommand implements IChangeReverseMethodHandler {
|
||||
private final DsfExecutor fExecutor;
|
||||
private final DsfServicesTracker fTracker;
|
||||
private final DsfSession fSession;
|
||||
|
||||
private ReverseTraceMethod fTraceMethod = null;
|
||||
|
||||
public GdbReverseToggleCommand(DsfSession session) {
|
||||
fExecutor = session.getExecutor();
|
||||
fTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
|
||||
fSession = session;
|
||||
fTraceMethod = ReverseTraceMethod.STOP_TRACE;
|
||||
try {
|
||||
fExecutor.execute(new DsfRunnable() {
|
||||
@Override
|
||||
|
@ -83,7 +91,7 @@ public class GdbReverseToggleCommand extends AbstractDebugCommand implements IRe
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(Object[] targets, IProgressMonitor monitor, IRequest request) throws CoreException {
|
||||
protected void doExecute(Object[] targets, IProgressMonitor monitor, final IRequest request) throws CoreException {
|
||||
if (targets.length != 1) {
|
||||
return;
|
||||
}
|
||||
|
@ -97,18 +105,57 @@ public class GdbReverseToggleCommand extends AbstractDebugCommand implements IRe
|
|||
Query<Object> setReverseMode = new Query<Object>() {
|
||||
@Override
|
||||
public void execute(final DataRequestMonitor<Object> rm) {
|
||||
final IReverseRunControl runControl = fTracker.getService(IReverseRunControl.class);
|
||||
final IReverseRunControl2 runControl = fTracker.getService(IReverseRunControl2.class);
|
||||
|
||||
if (runControl != null) {
|
||||
runControl.isReverseModeEnabled(controlDmc,
|
||||
new DataRequestMonitor<Boolean>(fExecutor, rm) {
|
||||
@Override
|
||||
public void handleSuccess() {
|
||||
runControl.enableReverseMode(controlDmc, !getData(), rm);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
rm.done();
|
||||
if (runControl != null) {
|
||||
ReverseTraceMethod traceMethod = fTraceMethod;
|
||||
if (fTraceMethod == ReverseTraceMethod.HARDWARE_TRACE) {
|
||||
if (Platform.getPreferencesService().getString(GdbPlugin.PLUGIN_ID,
|
||||
IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_HARDWARE,
|
||||
IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_GDB_TRACE,
|
||||
null).equals(IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_BRANCH_TRACE)) {
|
||||
traceMethod = ReverseTraceMethod.BRANCH_TRACE; // Branch Trace
|
||||
} else if (Platform.getPreferencesService().getString(GdbPlugin.PLUGIN_ID,
|
||||
IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_HARDWARE,
|
||||
IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_GDB_TRACE,
|
||||
null).equals(IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_PROCESSOR_TRACE)) {
|
||||
traceMethod = ReverseTraceMethod.PROCESSOR_TRACE; // Processor Trace
|
||||
} else {
|
||||
traceMethod = ReverseTraceMethod.GDB_TRACE; // GDB Selected Option
|
||||
}
|
||||
}
|
||||
runControl.enableReverseMode(controlDmc, traceMethod, new DataRequestMonitor<Boolean>(fExecutor, rm) {
|
||||
@Override
|
||||
public void handleError() {
|
||||
// Call the parent function
|
||||
// Since otherwise the status is not updated
|
||||
super.handleError();
|
||||
// Here we avoid setting any status other than OK, since we want to
|
||||
// avoid the default dialog box from eclipse and we propagate the error
|
||||
// with the plugin specific code of 1, here the ReverseToggleCommandHandler
|
||||
// interprets it as, the selected trace method is not available
|
||||
request.setStatus(new Status(IStatus.OK, GdbPlugin.PLUGIN_ID, 1, null, null));
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
final IReverseRunControl runControl_old = fTracker.getService(IReverseRunControl.class);
|
||||
if (runControl_old != null) {
|
||||
if(fTraceMethod != ReverseTraceMethod.STOP_TRACE && fTraceMethod != ReverseTraceMethod.FULL_TRACE) {
|
||||
runControl_old.enableReverseMode(controlDmc, false, rm); // Swtich Off tracing
|
||||
request.setStatus(new Status(IStatus.OK, GdbPlugin.PLUGIN_ID, 1, null, null));
|
||||
return;
|
||||
}
|
||||
runControl_old.isReverseModeEnabled(controlDmc,
|
||||
new DataRequestMonitor<Boolean>(fExecutor, rm) {
|
||||
@Override
|
||||
public void handleSuccess() {
|
||||
runControl_old.enableReverseMode(controlDmc, !getData(), rm);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
rm.done();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -251,4 +298,54 @@ public class GdbReverseToggleCommand extends AbstractDebugCommand implements IRe
|
|||
}
|
||||
}.schedule();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTraceMethod(ReverseTraceMethod traceMethod) {
|
||||
fTraceMethod = traceMethod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReverseTraceMethod getTraceMethod(final Object context) {
|
||||
IDMContext dmc;
|
||||
|
||||
if (context instanceof IDMContext) {
|
||||
dmc = (IDMContext)context;
|
||||
} else if (context instanceof IDMVMContext) {
|
||||
dmc = ((IDMVMContext)context).getDMContext();
|
||||
} else {
|
||||
return ReverseTraceMethod.STOP_TRACE;
|
||||
}
|
||||
|
||||
final ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
|
||||
if (controlDmc == null) {
|
||||
return ReverseTraceMethod.STOP_TRACE;
|
||||
}
|
||||
|
||||
Query<ReverseTraceMethod> ReverseMethodQuery = new Query<ReverseTraceMethod>() {
|
||||
@Override
|
||||
public void execute(final DataRequestMonitor<ReverseTraceMethod> rm) {
|
||||
final IReverseRunControl2 runControl = fTracker.getService(IReverseRunControl2.class);
|
||||
if (runControl != null) {
|
||||
runControl.getReverseTraceMethod(controlDmc, rm);
|
||||
}
|
||||
else {
|
||||
rm.setData(ReverseTraceMethod.INVALID);
|
||||
rm.done();
|
||||
}
|
||||
}
|
||||
};
|
||||
try {
|
||||
fExecutor.execute(ReverseMethodQuery);
|
||||
ReverseTraceMethod returnedTrace = ReverseMethodQuery.get();
|
||||
if (returnedTrace == ReverseTraceMethod.INVALID)
|
||||
return isReverseToggled(context) ? ReverseTraceMethod.FULL_TRACE : ReverseTraceMethod.STOP_TRACE ;
|
||||
else
|
||||
return returnedTrace;
|
||||
} catch (InterruptedException e) {
|
||||
} catch (ExecutionException e) {
|
||||
} catch (RejectedExecutionException e) {
|
||||
}
|
||||
|
||||
return ReverseTraceMethod.STOP_TRACE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
* Ericsson - Modified for DSF
|
||||
* Sergey Prigogin (Google)
|
||||
* Marc Khouzam (Ericsson) - Support for fast tracepoints (Bug 346320)
|
||||
* Intel Corporation - Added Reverse Debugging BTrace support
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.internal.ui.launching;
|
||||
|
||||
|
@ -56,7 +57,8 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
|
|||
protected Button fReverseCheckBox;
|
||||
protected Button fUpdateThreadlistOnSuspend;
|
||||
protected Button fDebugOnFork;
|
||||
|
||||
protected Combo fReverseDebugMode;
|
||||
|
||||
/**
|
||||
* A combo box to let the user choose if fast tracepoints should be used or not.
|
||||
*/
|
||||
|
@ -91,6 +93,8 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
|
|||
preferenceStore.getBoolean(IGdbDebugPreferenceConstants.PREF_DEFAULT_NON_STOP));
|
||||
configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE,
|
||||
IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_DEFAULT);
|
||||
configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE_MODE,
|
||||
IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_MODE_DEFAULT);
|
||||
configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND,
|
||||
IGDBLaunchConfigurationConstants.DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND_DEFAULT);
|
||||
configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_DEBUG_ON_FORK,
|
||||
|
@ -144,6 +148,9 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
|
|||
preferenceStore.getBoolean(IGdbDebugPreferenceConstants.PREF_DEFAULT_NON_STOP));
|
||||
boolean reverseEnabled = getBooleanAttr(configuration, IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE,
|
||||
IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_DEFAULT);
|
||||
|
||||
updateRevereDebugModeFromConfig(configuration);
|
||||
|
||||
boolean updateThreadsOnSuspend = getBooleanAttr(configuration, IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND,
|
||||
IGDBLaunchConfigurationConstants.DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND_DEFAULT);
|
||||
boolean debugOnFork = getBooleanAttr(configuration, IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_DEBUG_ON_FORK,
|
||||
|
@ -186,6 +193,19 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
|
|||
}
|
||||
}
|
||||
|
||||
protected void updateRevereDebugModeFromConfig(ILaunchConfiguration config){
|
||||
if (fReverseDebugMode != null){
|
||||
String debugMode = getStringAttr(config, IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE_MODE,
|
||||
IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_MODE_DEFAULT);
|
||||
|
||||
if(debugMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_MODE_HARDWARE)) {
|
||||
fReverseDebugMode.setText(LaunchUIMessages.getString("GDBDebuggerPage.reverse_Debuggingmodehard")); //$NON-NLS-1$
|
||||
} else {
|
||||
fReverseDebugMode.setText(LaunchUIMessages.getString("GDBDebuggerPage.reverse_Debuggingmodesoft")); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected String getSelectedTracepointMode() {
|
||||
if (fTracepointModeCombo != null) {
|
||||
int selectedIndex = fTracepointModeCombo.getSelectionIndex();
|
||||
|
@ -202,6 +222,20 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
|
|||
return IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_MODE_DEFAULT;
|
||||
}
|
||||
|
||||
protected String getSelectedReverseDebugMode() {
|
||||
if (fReverseDebugMode != null) {
|
||||
int selectedIndex = fReverseDebugMode.getSelectionIndex();
|
||||
if (fReverseDebugMode.getItem(selectedIndex).equals(LaunchUIMessages.getString("GDBDebuggerPage.reverse_Debuggingmodehard"))) { //$NON-NLS-1$
|
||||
return IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_MODE_HARDWARE;
|
||||
} else if (fReverseDebugMode.getItem(selectedIndex).equals(LaunchUIMessages.getString("GDBDebuggerPage.reverse_Debuggingmodesoft"))) { //$NON-NLS-1$
|
||||
return IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_MODE_SOFTWARE;
|
||||
} else {
|
||||
assert false : "Unknown Reverse Debug mode: " + fReverseDebugMode.getItem(selectedIndex); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
return IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_MODE_DEFAULT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
|
||||
configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME,
|
||||
|
@ -221,7 +255,12 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
|
|||
configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_TRACEPOINT_MODE,
|
||||
getSelectedTracepointMode());
|
||||
}
|
||||
|
||||
|
||||
if (fReverseDebugMode != null) {
|
||||
configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE_MODE,
|
||||
getSelectedReverseDebugMode());
|
||||
}
|
||||
|
||||
if (fSolibBlock != null)
|
||||
fSolibBlock.performApply(configuration);
|
||||
}
|
||||
|
@ -368,6 +407,8 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
|
|||
// TODO: Find a way to determine if reverse is supported (i.e. find the GDB version) then grey out the check box if necessary
|
||||
fReverseCheckBox = addCheckbox(subComp, LaunchUIMessages.getString("GDBDebuggerPage.reverse_Debugging")); //$NON-NLS-1$
|
||||
|
||||
createReverseDebugModeCombo(subComp);
|
||||
|
||||
fUpdateThreadlistOnSuspend = addCheckbox(subComp, LaunchUIMessages.getString("GDBDebuggerPage.update_thread_list_on_suspend")); //$NON-NLS-1$
|
||||
// This checkbox needs an explanation. Attach context help to it.
|
||||
PlatformUI.getWorkbench().getHelpSystem().setHelp(fUpdateThreadlistOnSuspend, GdbUIPlugin.PLUGIN_ID + ".update_threadlist_button_context"); //$NON-NLS-1$
|
||||
|
@ -401,6 +442,25 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
|
|||
fTracepointModeCombo.select(0);
|
||||
}
|
||||
|
||||
protected void createReverseDebugModeCombo(Composite parent){
|
||||
fReverseDebugMode = new Combo(parent,SWT.READ_ONLY | SWT.DROP_DOWN );
|
||||
|
||||
GridData gd = new GridData();
|
||||
gd.horizontalSpan = 2;
|
||||
gd.verticalSpan = 1;
|
||||
gd.horizontalIndent = 3;
|
||||
fReverseDebugMode.setLayoutData(gd);
|
||||
fReverseDebugMode.add(LaunchUIMessages.getString("GDBDebuggerPage.reverse_Debuggingmodesoft")); //$NON-NLS-1$
|
||||
fReverseDebugMode.add(LaunchUIMessages.getString("GDBDebuggerPage.reverse_Debuggingmodehard")); //$NON-NLS-1$
|
||||
fReverseDebugMode.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
updateLaunchConfigurationDialog();
|
||||
}
|
||||
});
|
||||
fReverseDebugMode.select(0);
|
||||
}
|
||||
|
||||
public void createSolibTab(TabFolder tabFolder) {
|
||||
TabItem tabItem = new TabItem(tabFolder, SWT.NONE);
|
||||
tabItem.setText(LaunchUIMessages.getString("GDBDebuggerPage.shared_libraries")); //$NON-NLS-1$
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
###############################################################################
|
||||
# Copyright (c) 2003, 2010 QNX Software Systems and others.
|
||||
# Copyright (c) 2003, 2015 QNX Software Systems 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
|
||||
|
@ -9,6 +9,7 @@
|
|||
# QNX Software Systems - initial API and implementation
|
||||
# Ericsson - Updated for DSF
|
||||
# Marc Khouzam (Ericsson) - Support for fast tracepoints (Bug 346320)
|
||||
# Intel Corporation - Added Reverse Debugging BTrace support
|
||||
###############################################################################
|
||||
|
||||
GDBDebuggerPage.gdb_executable_not_specified=Debugger executable must be specified.
|
||||
|
@ -24,6 +25,8 @@ GDBDebuggerPage.cmdfile_warning=(Warning: Some commands in this file may interfe
|
|||
GDBDebuggerPage.shared_libraries=Shared Libraries
|
||||
GDBDebuggerPage.nonstop_mode=Non-stop mode (Note: Requires non-stop GDB)
|
||||
GDBDebuggerPage.reverse_Debugging=Enable Reverse Debugging at startup (Note: Requires Reverse GDB)
|
||||
GDBDebuggerPage.reverse_Debuggingmodesoft=Software Trace for Reverse Debugging.Slower, detailed reverse debugging method
|
||||
GDBDebuggerPage.reverse_Debuggingmodehard=Hardware Trace for Reverse Debugging.Fast, less information available during reverse debugging
|
||||
GDBDebuggerPage.update_thread_list_on_suspend=Force thread list update on suspend
|
||||
GDBDebuggerPage.Automatically_debug_forked_processes=Automatically debug forked processes (Note: Requires Multi Process GDB)
|
||||
GDBDebuggerPage.tracepoint_mode_label=Tracepoint mode:
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
* Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536)
|
||||
* IBM Corporation
|
||||
* Marc Khouzam (Ericsson) - Add preference for aggressive breakpoint filtering (Bug 360735)
|
||||
* Intel Corporation - Added Reverse Debugging BTrace support
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.internal.ui.preferences;
|
||||
|
||||
|
@ -66,7 +67,13 @@ class MessagesForPreferences extends NLS {
|
|||
/** @since 2.3 */
|
||||
public static String GdbDebugPreferencePage_use_rtti_label2;
|
||||
|
||||
|
||||
public static String ReverseDebugPreferencePage_1;
|
||||
public static String ReverseDebugPreferencePage_2;
|
||||
public static String ReverseDebugPreferencePage_3;
|
||||
public static String ReverseDebugPreferencePage_4;
|
||||
public static String ReverseDebugPreferencePage_6;
|
||||
public static String ReverseDebugPreferencePage_8;
|
||||
|
||||
static {
|
||||
// initialize resource bundle
|
||||
NLS.initializeMessages(MessagesForPreferences.class.getName(), MessagesForPreferences.class);
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
# Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536)
|
||||
# IBM Corporation
|
||||
# Marc Khouzam (Ericsson) - Add preference for aggressive breakpoint filtering (Bug 360735)
|
||||
# Intel Corporation - Added Reverse Debugging BTrace support
|
||||
###############################################################################
|
||||
|
||||
GdbDebugPreferencePage_Add_button=Add
|
||||
|
@ -54,3 +55,10 @@ GdbDebugPreferencePage_GDB_debugger=GDB debugger:
|
|||
GdbDebugPreferencePage_GDB_debugger_dialog_title=GDB Debugger
|
||||
GdbDebugPreferencePage_Non_stop_mode=Non-stop mode (Note: Requires non-stop GDB)
|
||||
GdbDebugPreferencePage_Stop_on_startup_at=Stop on startup at:
|
||||
|
||||
ReverseDebugPreferencePage_1=Reverse Debug Settings
|
||||
ReverseDebugPreferencePage_2=Show Error Dialog when Reverse Trace Method not available
|
||||
ReverseDebugPreferencePage_3=Select Hardware Tracing Method
|
||||
ReverseDebugPreferencePage_4=Use GDB preference
|
||||
ReverseDebugPreferencePage_6=Use Branch Trace
|
||||
ReverseDebugPreferencePage_8=Use Processor Trace
|
||||
|
|
|
@ -0,0 +1,97 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015 Intel Corporation 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:
|
||||
* Intel Corporation - Added Reverse Debugging BTrace support
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.internal.ui.preferences;
|
||||
|
||||
import org.eclipse.cdt.debug.internal.ui.preferences.ICDebugPreferenceConstants;
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants;
|
||||
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
|
||||
import org.eclipse.jface.preference.BooleanFieldEditor;
|
||||
import org.eclipse.jface.preference.FieldEditor;
|
||||
import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.jface.preference.RadioGroupFieldEditor;
|
||||
import org.eclipse.ui.IWorkbench;
|
||||
import org.eclipse.ui.IWorkbenchPreferencePage;
|
||||
|
||||
@SuppressWarnings("restriction")
|
||||
public class ReverseDebugPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
|
||||
|
||||
public ReverseDebugPreferencePage() {
|
||||
super( GRID );
|
||||
IPreferenceStore store = GdbUIPlugin.getDefault().getPreferenceStore();
|
||||
setPreferenceStore( store );
|
||||
setDescription( MessagesForPreferences.ReverseDebugPreferencePage_1 );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createFieldEditors() {
|
||||
FieldEditor edit = new BooleanFieldEditor(
|
||||
ICDebugPreferenceConstants.PREF_SHOW_ERROR_REVERSE_TRACE_METHOD_NOT_AVAILABLE,
|
||||
MessagesForPreferences.ReverseDebugPreferencePage_2,
|
||||
getFieldEditorParent() ) {
|
||||
/** We are swapping the preference store since PREF_SHOW_ERROR_REVERSE_TRACE_METHOD_NOT_AVAILABLE is
|
||||
* available with CDebugUIPlugin */
|
||||
|
||||
@Override
|
||||
protected void doStore() {
|
||||
IPreferenceStore store = CDebugUIPlugin.getDefault().getPreferenceStore();
|
||||
setPreferenceStore( store );
|
||||
super.doStore();
|
||||
store = GdbUIPlugin.getDefault().getPreferenceStore();
|
||||
setPreferenceStore( store );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doLoadDefault() {
|
||||
IPreferenceStore store = CDebugUIPlugin.getDefault().getPreferenceStore();
|
||||
setPreferenceStore( store );
|
||||
super.doLoadDefault();
|
||||
store = GdbUIPlugin.getDefault().getPreferenceStore();
|
||||
setPreferenceStore( store );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doLoad() {
|
||||
IPreferenceStore store = CDebugUIPlugin.getDefault().getPreferenceStore();
|
||||
setPreferenceStore( store );
|
||||
super.doLoad();
|
||||
store = GdbUIPlugin.getDefault().getPreferenceStore();
|
||||
setPreferenceStore( store );
|
||||
}
|
||||
};
|
||||
IPreferenceStore store = CDebugUIPlugin.getDefault().getPreferenceStore();
|
||||
setPreferenceStore( store );
|
||||
edit.fillIntoGrid( getFieldEditorParent(), 2 );
|
||||
getPreferenceStore().setDefault(ICDebugPreferenceConstants.PREF_SHOW_ERROR_REVERSE_TRACE_METHOD_NOT_AVAILABLE, true);
|
||||
addField( edit );
|
||||
|
||||
store = GdbUIPlugin.getDefault().getPreferenceStore();
|
||||
setPreferenceStore( store );
|
||||
edit = new RadioGroupFieldEditor(
|
||||
IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_HARDWARE
|
||||
, MessagesForPreferences.ReverseDebugPreferencePage_3
|
||||
,1
|
||||
, new String[][] {
|
||||
{MessagesForPreferences.ReverseDebugPreferencePage_4, IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_GDB_TRACE},
|
||||
{MessagesForPreferences.ReverseDebugPreferencePage_6, IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_BRANCH_TRACE},
|
||||
{MessagesForPreferences.ReverseDebugPreferencePage_8, IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_PROCESSOR_TRACE}
|
||||
}
|
||||
, getFieldEditorParent() );
|
||||
edit.fillIntoGrid( getFieldEditorParent(), 1 );
|
||||
getPreferenceStore().setDefault(IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_HARDWARE, IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_GDB_TRACE);
|
||||
addField( edit );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( IWorkbench workbench ) {
|
||||
}
|
||||
}
|
|
@ -9,6 +9,7 @@
|
|||
* Ericsson - initial API and implementation
|
||||
* Marc Khouzam (Ericsson) - Support for fast tracepoints (Bug 346320)
|
||||
* Anton Gorenkov - Need to use a process factory (Bug 210366)
|
||||
* Intel Corporation - Added Reverse Debugging BTrace support
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb;
|
||||
|
||||
|
@ -84,6 +85,12 @@ public class IGDBLaunchConfigurationConstants {
|
|||
*/
|
||||
public static final String ATTR_DEBUGGER_REVERSE = GdbPlugin.PLUGIN_ID + ".REVERSE"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Launch configuration attribute key. String value to select reverse debugging method at launch time.
|
||||
* @since 5.0
|
||||
*/
|
||||
public static final String ATTR_DEBUGGER_REVERSE_MODE = GdbPlugin.PLUGIN_ID + ".REVERSE_MODE"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Launch configuration attribute key. Boolean value. See
|
||||
* IGDBBackend.getUpdateThreadListOnSuspend()
|
||||
|
@ -154,6 +161,24 @@ public class IGDBLaunchConfigurationConstants {
|
|||
*/
|
||||
public static final boolean DEBUGGER_REVERSE_DEFAULT = false;
|
||||
|
||||
/**
|
||||
* Possible attribute value for the key is ATTR_DEBUGGER_REVERSE_MODE.
|
||||
* @since 5.0
|
||||
*/
|
||||
public static final String DEBUGGER_REVERSE_MODE_SOFTWARE = "UseSoftTrace"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Launch configuration attribute value. The key is ATTR_DEBUGGER_REVERSE_MODE.
|
||||
* @since 5.0
|
||||
*/
|
||||
public static final String DEBUGGER_REVERSE_MODE_DEFAULT = DEBUGGER_REVERSE_MODE_SOFTWARE;
|
||||
|
||||
/**
|
||||
* Possible attribute value for the key is ATTR_DEBUGGER_REVERSE_MODE.
|
||||
* @since 5.0
|
||||
*/
|
||||
public static final String DEBUGGER_REVERSE_MODE_HARDWARE = "UseHardTrace"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Launch configuration attribute value. The key is
|
||||
* ATTR_DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
* Sergey Prigogin (Google)
|
||||
* Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536)
|
||||
* Marc Khouzam (Ericsson) - Add preference for aggressive breakpoint filtering (Bug 360735)
|
||||
* Intel Corporation - Added Reverse Debugging BTrace support
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb;
|
||||
|
||||
|
@ -146,5 +147,26 @@ public interface IGdbDebugPreferenceConstants {
|
|||
* @since 4.2
|
||||
*/
|
||||
public static final String PREF_AGGRESSIVE_BP_FILTER = PREFIX + "aggressiveBpFilter"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* String preference controlling trace method used for hardware tracing.
|
||||
*/
|
||||
public static final String PREF_REVERSE_TRACE_METHOD_HARDWARE = PREFIX + ".reversedebugpref.tracemethodHardware"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* String preference controlling trace method used for hardware tracing.
|
||||
*/
|
||||
public static final String PREF_REVERSE_TRACE_METHOD_GDB_TRACE = "UseGdbTrace"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* String preference controlling trace method used for hardware tracing.
|
||||
*/
|
||||
public static final String PREF_REVERSE_TRACE_METHOD_BRANCH_TRACE = "UseBranchTrace"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* String preference controlling trace method used for hardware tracing.
|
||||
*/
|
||||
public static final String PREF_REVERSE_TRACE_METHOD_PROCESSOR_TRACE = "UseProcessorTrace"; //$NON-NLS-1$
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
* Marc Khouzam (Ericsson) - Move to org.eclipse.cdt.dsf.gdb from UI plugin (bug 348159)
|
||||
* Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536)
|
||||
* Marc Khouzam (Ericsson) - Add preference for aggressive breakpoint filtering (Bug 360735)
|
||||
* Intel Corporation - Added Reverse Debugging BTrace support
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.internal;
|
||||
|
||||
|
@ -45,5 +46,6 @@ public class GdbPreferenceInitializer extends AbstractPreferenceInitializer {
|
|||
node.putInt(IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT_VALUE, IGdbDebugPreferenceConstants.COMMAND_TIMEOUT_VALUE_DEFAULT);
|
||||
node.putBoolean(IGdbDebugPreferenceConstants.PREF_HIDE_RUNNING_THREADS, false);
|
||||
node.putBoolean(IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER, true);
|
||||
node.put( IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_HARDWARE, IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_GDB_TRACE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,269 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015 Intel Corporation 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:
|
||||
* Intel Corporation - Added Reverse Debugging BTrace support
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.service;
|
||||
|
||||
import java.util.Hashtable;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.debug.core.model.IChangeReverseMethodHandler.ReverseTraceMethod;
|
||||
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||
import org.eclipse.cdt.dsf.concurrent.DsfExecutor;
|
||||
import org.eclipse.cdt.dsf.concurrent.ImmediateDataRequestMonitor;
|
||||
import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
|
||||
import org.eclipse.cdt.dsf.concurrent.ImmediateRequestMonitor;
|
||||
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
||||
import org.eclipse.cdt.dsf.concurrent.Sequence;
|
||||
import org.eclipse.cdt.dsf.datamodel.DMContexts;
|
||||
import org.eclipse.cdt.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.cdt.dsf.debug.service.IMultiDetach;
|
||||
import org.eclipse.cdt.dsf.debug.service.IMultiTerminate;
|
||||
import org.eclipse.cdt.dsf.debug.service.IMemory.IMemoryDMContext;
|
||||
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
|
||||
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
|
||||
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
|
||||
import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants;
|
||||
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
|
||||
import org.eclipse.cdt.dsf.gdb.service.command.IGDBControl;
|
||||
import org.eclipse.cdt.dsf.mi.service.IMICommandControl;
|
||||
import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext;
|
||||
import org.eclipse.cdt.dsf.mi.service.IMIProcessDMContext;
|
||||
import org.eclipse.cdt.dsf.mi.service.IMIRunControl;
|
||||
import org.eclipse.cdt.dsf.mi.service.IMIRunControl.MIRunMode;
|
||||
import org.eclipse.cdt.dsf.mi.service.MIBreakpointsManager;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.CommandFactory;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.output.MIAddInferiorInfo;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
|
||||
import org.eclipse.cdt.dsf.service.DsfSession;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.debug.core.ILaunch;
|
||||
|
||||
/**
|
||||
* Adding support for reverse trace method selection with GDB 7.10
|
||||
*
|
||||
* @since 5.0
|
||||
*/
|
||||
public class GDBProcesses_7_10 extends GDBProcesses_7_4 {
|
||||
|
||||
private CommandFactory fCommandFactory;
|
||||
private IGDBControl fCommandControl;
|
||||
|
||||
public GDBProcesses_7_10(DsfSession session) {
|
||||
super(session);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(final RequestMonitor requestMonitor) {
|
||||
super.initialize(new ImmediateRequestMonitor(requestMonitor) {
|
||||
@Override
|
||||
protected void handleSuccess() {
|
||||
doInitialize(requestMonitor);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes this service after our superclass's initialize()
|
||||
* method succeeds.
|
||||
*
|
||||
* @param requestMonitor
|
||||
* The call-back object to notify when this service's
|
||||
* initialization is done.
|
||||
*/
|
||||
private void doInitialize(RequestMonitor requestMonitor) {
|
||||
register(new String[]{ IMultiDetach.class.getName(), IMultiTerminate.class.getName() }, new Hashtable<String,String>());
|
||||
|
||||
fCommandControl = getServicesTracker().getService(IGDBControl.class);
|
||||
fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
|
||||
|
||||
requestMonitor.done();
|
||||
}
|
||||
@Override
|
||||
public void attachDebuggerToProcess(IProcessDMContext procCtx, DataRequestMonitor<IDMContext> rm) {
|
||||
attachDebuggerToProcess(procCtx, null, rm);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Sequence getStartOrRestartProcessSequence(DsfExecutor executor, IContainerDMContext containerDmc,
|
||||
Map<String, Object> attributes, boolean restart,
|
||||
DataRequestMonitor<IContainerDMContext> rm) {
|
||||
return new StartOrRestartProcessSequence_7_10(executor, containerDmc, attributes, restart, rm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attachDebuggerToProcess(final IProcessDMContext procCtx, final String binaryPath, final DataRequestMonitor<IDMContext> dataRm) {
|
||||
if (procCtx instanceof IMIProcessDMContext) {
|
||||
if (!doIsDebuggerAttachSupported()) {
|
||||
dataRm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Attach not supported.", null)); //$NON-NLS-1$
|
||||
dataRm.done();
|
||||
return;
|
||||
}
|
||||
|
||||
// Use a sequence for better control of each step
|
||||
ImmediateExecutor.getInstance().execute(new Sequence(getExecutor(), dataRm) {
|
||||
private IMIContainerDMContext fContainerDmc;
|
||||
|
||||
private Step[] steps = new Step[] {
|
||||
// If this is not the very first inferior, we first need create the new inferior
|
||||
new Step() {
|
||||
@Override
|
||||
public void execute(final RequestMonitor rm) {
|
||||
if (isInitialProcess()) {
|
||||
// If it is the first inferior, GDB has already created it for us
|
||||
// We really should get the id from GDB instead of hard-coding it
|
||||
fContainerDmc = createContainerContext(procCtx, "i1"); //$NON-NLS-1$
|
||||
rm.done();
|
||||
return;
|
||||
}
|
||||
|
||||
ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(procCtx, ICommandControlDMContext.class);
|
||||
fCommandControl.queueCommand(
|
||||
fCommandFactory.createMIAddInferior(controlDmc),
|
||||
new ImmediateDataRequestMonitor<MIAddInferiorInfo>(rm) {
|
||||
@Override
|
||||
protected void handleSuccess() {
|
||||
final String groupId = getData().getGroupId();
|
||||
if (groupId == null || groupId.trim().length() == 0) {
|
||||
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid gdb group id.", null)); //$NON-NLS-1$
|
||||
} else {
|
||||
fContainerDmc = createContainerContext(procCtx, groupId);
|
||||
}
|
||||
rm.done();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
new Step() {
|
||||
@Override
|
||||
public void execute(final RequestMonitor rm) {
|
||||
// Now, set the binary to be used.
|
||||
if (binaryPath != null) {
|
||||
fCommandControl.queueCommand(
|
||||
fCommandFactory.createMIFileExecAndSymbols(fContainerDmc, binaryPath),
|
||||
new ImmediateDataRequestMonitor<MIInfo>(rm) {
|
||||
@Override
|
||||
protected void handleCompleted() {
|
||||
super.handleCompleted();
|
||||
};
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
rm.done();
|
||||
}
|
||||
},
|
||||
// Now, actually do the attach
|
||||
new Step() {
|
||||
@Override
|
||||
public void execute(RequestMonitor rm) {
|
||||
// For non-stop mode, we do a non-interrupting attach
|
||||
// Bug 333284
|
||||
boolean shouldInterrupt = true;
|
||||
IMIRunControl runControl = getServicesTracker().getService(IMIRunControl.class);
|
||||
if (runControl != null && runControl.getRunMode() == MIRunMode.NON_STOP) {
|
||||
shouldInterrupt = false;
|
||||
}
|
||||
|
||||
fCommandControl.queueCommand(
|
||||
fCommandFactory.createMITargetAttach(fContainerDmc, ((IMIProcessDMContext)procCtx).getProcId(), shouldInterrupt),
|
||||
new ImmediateDataRequestMonitor<MIInfo>(rm));
|
||||
}
|
||||
},
|
||||
// Initialize memory data for this process.
|
||||
new Step() {
|
||||
@Override
|
||||
public void execute(RequestMonitor rm) {
|
||||
IGDBMemory memory = getServicesTracker().getService(IGDBMemory.class);
|
||||
IMemoryDMContext memContext = DMContexts.getAncestorOfType(fContainerDmc, IMemoryDMContext.class);
|
||||
if (memory == null || memContext == null) {
|
||||
rm.done();
|
||||
return;
|
||||
}
|
||||
memory.initializeMemoryData(memContext, rm);
|
||||
}
|
||||
},
|
||||
// Start tracking this process' breakpoints.
|
||||
new Step() {
|
||||
@Override
|
||||
public void execute(RequestMonitor rm) {
|
||||
MIBreakpointsManager bpmService = getServicesTracker().getService(MIBreakpointsManager.class);
|
||||
bpmService.startTrackingBpForProcess(fContainerDmc, rm);
|
||||
}
|
||||
},
|
||||
// Select reverse debugging mode to what was enabled as a launch option
|
||||
new Step() {
|
||||
@Override
|
||||
public void execute(RequestMonitor rm) {
|
||||
IReverseRunControl2 reverseService = getServicesTracker().getService(IReverseRunControl2.class);
|
||||
if (reverseService != null) {
|
||||
ILaunch launch = procCtx.getAdapter(ILaunch.class);
|
||||
if (launch != null) {
|
||||
try {
|
||||
String reverseMode =
|
||||
launch.getLaunchConfiguration().getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE_MODE,
|
||||
IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_MODE_DEFAULT);
|
||||
if (reverseMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_MODE_SOFTWARE)) {
|
||||
reverseService.enableReverseMode(fCommandControl.getContext(), ReverseTraceMethod.FULL_TRACE, rm);
|
||||
return;
|
||||
}
|
||||
else if (reverseMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_MODE_HARDWARE)) {
|
||||
if (Platform.getPreferencesService().getString(GdbPlugin.PLUGIN_ID,
|
||||
IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_HARDWARE,
|
||||
IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_GDB_TRACE,
|
||||
null).equals(IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_BRANCH_TRACE)) {
|
||||
reverseService.enableReverseMode(fCommandControl.getContext(), ReverseTraceMethod.BRANCH_TRACE, rm); // Branch Trace
|
||||
} else if (Platform.getPreferencesService().getString(GdbPlugin.PLUGIN_ID,
|
||||
IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_HARDWARE,
|
||||
IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_GDB_TRACE,
|
||||
null).equals(IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_PROCESSOR_TRACE)) {
|
||||
reverseService.enableReverseMode(fCommandControl.getContext(), ReverseTraceMethod.PROCESSOR_TRACE, rm); // Processor Trace
|
||||
} else {
|
||||
reverseService.enableReverseMode(fCommandControl.getContext(), ReverseTraceMethod.GDB_TRACE, rm); // GDB Selected Option
|
||||
}
|
||||
return;
|
||||
}
|
||||
else {
|
||||
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid Trace Method Selected", null)); //$NON-NLS-1$
|
||||
rm.done();
|
||||
return;
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
// Ignore, just don't set reverse method
|
||||
}
|
||||
}
|
||||
}
|
||||
rm.done();
|
||||
}
|
||||
},
|
||||
// Store the fully formed container context so it can be returned to the caller
|
||||
// and mark that we are not dealing with the first process anymore.
|
||||
new Step() {
|
||||
@Override
|
||||
public void execute(RequestMonitor rm) {
|
||||
dataRm.setData(fContainerDmc);
|
||||
setIsInitialProcess(false);
|
||||
|
||||
rm.done();
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
@Override public Step[] getSteps() { return steps; }
|
||||
});
|
||||
} else {
|
||||
dataRm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid process context.", null)); //$NON-NLS-1$
|
||||
dataRm.done();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -10,6 +10,7 @@
|
|||
* Marc Khouzam (Ericsson) - Workaround for Bug 352998
|
||||
* Marc Khouzam (Ericsson) - Update breakpoint handling for GDB >= 7.4 (Bug 389945)
|
||||
* Alvaro Sanchez-Leon (Ericsson) - Breakpoint Enable does not work after restarting the application (Bug 456959)
|
||||
* Intel Corporation - Added Reverse Debugging BTrace support
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.service;
|
||||
|
||||
|
@ -486,7 +487,8 @@ public class GDBProcesses_7_2 extends GDBProcesses_7_1 implements IMultiTerminat
|
|||
}
|
||||
}
|
||||
|
||||
private void connectToTarget(IProcessDMContext procCtx, RequestMonitor rm) {
|
||||
/** @since 5.0 */
|
||||
protected void connectToTarget(IProcessDMContext procCtx, RequestMonitor rm) {
|
||||
ILaunch launch = procCtx.getAdapter(ILaunch.class);
|
||||
assert launch != null;
|
||||
if (launch != null) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008, 2013 Wind River Systems and others.
|
||||
* Copyright (c) 2008, 2015 Wind River Systems 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
|
||||
|
@ -13,6 +13,7 @@
|
|||
* Ericsson - Added IReverseControl support
|
||||
* Marc Khouzam (Ericsson) - Added IReverseModeChangedDMEvent (Bug 399163)
|
||||
* Marc Khouzam (Ericsson) - Started inheriting from GDBRunControl (Bug 405123)
|
||||
* Intel Corporation - Added Reverse Debugging BTrace support
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.dsf.gdb.service;
|
||||
|
@ -81,6 +82,14 @@ public class GDBRunControl_7_0 extends GDBRunControl implements IReverseRunContr
|
|||
*/
|
||||
private boolean fRunControlOperationsEnabled = true;
|
||||
|
||||
/**
|
||||
* Indicates if reverse debugging is supported for the currend debug session.
|
||||
* @since 5.0
|
||||
*/
|
||||
public boolean getReverseSupported() {
|
||||
return fReverseSupported;
|
||||
}
|
||||
|
||||
public GDBRunControl_7_0(DsfSession session) {
|
||||
super(session);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,135 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015 Intel Corporation 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:
|
||||
* Intel Corporation - Added Reverse Debugging BTrace support
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.service;
|
||||
|
||||
import java.util.Hashtable;
|
||||
|
||||
import org.eclipse.cdt.debug.core.model.IChangeReverseMethodHandler.ReverseTraceMethod;
|
||||
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||
import org.eclipse.cdt.dsf.concurrent.ImmediateRequestMonitor;
|
||||
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
||||
import org.eclipse.cdt.dsf.gdb.service.IReverseRunControl2;
|
||||
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
|
||||
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
|
||||
import org.eclipse.cdt.dsf.mi.service.IMICommandControl;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.CommandFactory;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
|
||||
import org.eclipse.cdt.dsf.service.DsfSession;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
|
||||
/** @since 5.0 */
|
||||
public class GDBRunControl_7_10 extends GDBRunControl_7_6 implements IReverseRunControl2 {
|
||||
|
||||
private IMICommandControl fCommandControl;
|
||||
private CommandFactory fCommandFactory;
|
||||
|
||||
private ReverseTraceMethod fReverseTraceMethod; // default: no trace
|
||||
|
||||
public GDBRunControl_7_10(DsfSession session) {
|
||||
super(session);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(final RequestMonitor requestMonitor) {
|
||||
super.initialize(
|
||||
new ImmediateRequestMonitor(requestMonitor) {
|
||||
@Override
|
||||
public void handleSuccess() {
|
||||
doInitialize(requestMonitor);
|
||||
}});
|
||||
}
|
||||
|
||||
private void doInitialize(RequestMonitor requestMonitor) {
|
||||
|
||||
fCommandControl = getServicesTracker().getService(IMICommandControl.class);
|
||||
fCommandFactory = fCommandControl.getCommandFactory();
|
||||
fReverseTraceMethod = ReverseTraceMethod.STOP_TRACE;
|
||||
|
||||
if (fCommandControl == null) {
|
||||
requestMonitor.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Service is not available")); //$NON-NLS-1$
|
||||
return;
|
||||
}
|
||||
|
||||
fCommandControl.addEventListener(this);
|
||||
|
||||
register(new String[]{ IReverseRunControl2.class.getName() },
|
||||
new Hashtable<String,String>());
|
||||
|
||||
requestMonitor.done();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getReverseTraceMethod(ICommandControlDMContext context, DataRequestMonitor<ReverseTraceMethod> rm) {
|
||||
rm.setData(fReverseTraceMethod);
|
||||
rm.done();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableReverseMode(final ICommandControlDMContext context,final ReverseTraceMethod traceMethod, final RequestMonitor rm) {
|
||||
if (!getReverseSupported()) {
|
||||
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Reverse mode is not supported.", null)); //$NON-NLS-1$
|
||||
return;
|
||||
}
|
||||
|
||||
if (fReverseTraceMethod == traceMethod) {
|
||||
rm.done();
|
||||
return;
|
||||
}
|
||||
|
||||
if(fReverseTraceMethod == ReverseTraceMethod.STOP_TRACE || traceMethod == ReverseTraceMethod.STOP_TRACE) {
|
||||
getConnection().queueCommand(
|
||||
fCommandFactory.createCLIRecord(context, traceMethod),
|
||||
new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
|
||||
@Override
|
||||
public void handleSuccess() {
|
||||
boolean enabled = false;
|
||||
fReverseTraceMethod = traceMethod;
|
||||
if(fReverseTraceMethod != ReverseTraceMethod.STOP_TRACE)
|
||||
enabled = true;
|
||||
setReverseModeEnabled(enabled );
|
||||
rm.done();
|
||||
}
|
||||
@Override
|
||||
public void handleFailure() {
|
||||
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Trace method could not be selected", null)); //$NON-NLS-1$
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
getConnection().queueCommand(
|
||||
fCommandFactory.createCLIRecord(context, ReverseTraceMethod.STOP_TRACE),
|
||||
new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
|
||||
@Override
|
||||
public void handleSuccess() {
|
||||
setReverseModeEnabled(false);
|
||||
getConnection().queueCommand(
|
||||
fCommandFactory.createCLIRecord(context, traceMethod),
|
||||
new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
|
||||
@Override
|
||||
public void handleSuccess() {
|
||||
fReverseTraceMethod = traceMethod;
|
||||
setReverseModeEnabled(true);
|
||||
rm.done();
|
||||
}
|
||||
@Override
|
||||
public void handleFailure() {
|
||||
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Trace method could not be selected", null)); //$NON-NLS-1$
|
||||
setReverseModeEnabled(false);
|
||||
fReverseTraceMethod = ReverseTraceMethod.STOP_TRACE;
|
||||
rm.done();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
|
@ -19,6 +19,7 @@
|
|||
* Marc Khouzam (Ericsson) - Support dynamic printf in bp service 7.5 (Bug 400628)
|
||||
* Alvaro Sanchez-Leon (Ericsson) - Allow user to edit the register groups (Bug 235747)
|
||||
* Marc Dumais (Ericsson) - Update GDBHardwareAndOS service to take advantage of GDB providing CPU/core info (bug 464184)
|
||||
* Intel Corporation - Added Reverse Debugging BTrace support
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.service;
|
||||
|
||||
|
@ -229,6 +230,9 @@ public class GdbDebugServicesFactory extends AbstractDsfDebugServicesFactory {
|
|||
|
||||
@Override
|
||||
protected IProcesses createProcessesService(DsfSession session) {
|
||||
if (compareVersionWith(GDB_7_10_VERSION) >= 0) {
|
||||
return new GDBProcesses_7_10(session);
|
||||
}
|
||||
if (compareVersionWith(GDB_7_4_VERSION) >= 0) {
|
||||
return new GDBProcesses_7_4(session);
|
||||
}
|
||||
|
@ -257,6 +261,9 @@ public class GdbDebugServicesFactory extends AbstractDsfDebugServicesFactory {
|
|||
|
||||
@Override
|
||||
protected IRunControl createRunControlService(DsfSession session) {
|
||||
if (compareVersionWith(GDB_7_10_VERSION) >= 0) {
|
||||
return new GDBRunControl_7_10(session);
|
||||
}
|
||||
if (compareVersionWith(GDB_7_6_VERSION) >= 0) {
|
||||
return new GDBRunControl_7_6(session);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015 Intel Corporation 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:
|
||||
* Intel Corporation - Added Reverse Debugging BTrace support
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.service;
|
||||
|
||||
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
||||
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
|
||||
import org.eclipse.cdt.debug.core.model.IChangeReverseMethodHandler.ReverseTraceMethod;
|
||||
|
||||
/** @since 5.0 */
|
||||
public interface IReverseRunControl2 extends IReverseRunControl {
|
||||
|
||||
/**
|
||||
* Get the reverse debugging trace method.
|
||||
*
|
||||
* @param rm Will contain the result of the operation, true or false, not null.
|
||||
*/
|
||||
void getReverseTraceMethod(ICommandControlDMContext context, DataRequestMonitor<ReverseTraceMethod> rm);
|
||||
|
||||
/**
|
||||
* Change reverse debugging trace method based on the method parameter.
|
||||
*
|
||||
* @param set the reverse debugging trace method to Full Trace, Branch Trace or Processor Trace
|
||||
*/
|
||||
void enableReverseMode(ICommandControlDMContext context, ReverseTraceMethod traceMethod, RequestMonitor rm);
|
||||
}
|
|
@ -9,6 +9,7 @@
|
|||
* Ericsson - initial API and implementation
|
||||
* Sergey Prigogin (Google)
|
||||
* Anton Gorenkov - Need to use a process factory (Bug 210366)
|
||||
* Intel Corporation - Added Reverse Debugging BTrace support
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.service;
|
||||
|
||||
|
@ -108,6 +109,11 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
|
|||
return fUserBreakpointIsOnMain;
|
||||
}
|
||||
|
||||
/** @since 5.0 */
|
||||
protected boolean getReverseEnabled() {
|
||||
return fReverseEnabled;
|
||||
}
|
||||
|
||||
public StartOrRestartProcessSequence_7_0(DsfExecutor executor, IContainerDMContext containerDmc,
|
||||
Map<String, Object> attributes, boolean restart, DataRequestMonitor<IContainerDMContext> rm) {
|
||||
super(executor, rm);
|
||||
|
|
|
@ -0,0 +1,128 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015 Intel Corporation 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:
|
||||
* Intel Corporation - Added Reverse Debugging BTrace support
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.debug.core.CDebugUtils;
|
||||
import org.eclipse.cdt.debug.core.model.IChangeReverseMethodHandler.ReverseTraceMethod;
|
||||
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||
import org.eclipse.cdt.dsf.concurrent.DsfExecutor;
|
||||
import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
|
||||
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
||||
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
|
||||
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
|
||||
import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants;
|
||||
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
|
||||
import org.eclipse.cdt.dsf.gdb.service.command.IGDBControl;
|
||||
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
|
||||
/**
|
||||
* @since 5.0
|
||||
*/
|
||||
public class StartOrRestartProcessSequence_7_10 extends StartOrRestartProcessSequence_7_3 {
|
||||
|
||||
private IGDBControl fCommandControl;
|
||||
private IReverseRunControl2 fReverseService;
|
||||
private ReverseTraceMethod fReverseMode = ReverseTraceMethod.FULL_TRACE;
|
||||
private final Map<String, Object> fAttributes;
|
||||
|
||||
public StartOrRestartProcessSequence_7_10(DsfExecutor executor, IContainerDMContext containerDmc,
|
||||
Map<String, Object> attributes, boolean restart, DataRequestMonitor<IContainerDMContext> rm) {
|
||||
super(executor, containerDmc, attributes, restart, rm);
|
||||
|
||||
fAttributes = attributes;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String[] getExecutionOrder(String group) {
|
||||
if (GROUP_TOP_LEVEL.equals(group)) {
|
||||
// Initialize the list with the base class' steps
|
||||
// We need to create a list that we can modify, which is why we create our own ArrayList.
|
||||
List<String> orderList = new ArrayList<String>(Arrays.asList(super.getExecutionOrder(GROUP_TOP_LEVEL)));
|
||||
|
||||
// Insert the new stepSetReverseMode after stepSetReverseOff
|
||||
orderList.add(orderList.indexOf("stepSetReverseOff") + 1, "stepSetReverseMode"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
return orderList.toArray(new String[orderList.size()]);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the members of the StartOrRestartProcessSequence_7_10 class.
|
||||
* This step is mandatory for the rest of the sequence to complete.
|
||||
*/
|
||||
@Override
|
||||
@Execute
|
||||
public void stepInitializeBaseSequence(final RequestMonitor rm) {
|
||||
super.stepInitializeBaseSequence(new RequestMonitor (getExecutor(), rm) {
|
||||
@Override
|
||||
protected void handleSuccess() {
|
||||
DsfServicesTracker tracker = new DsfServicesTracker(GdbPlugin.getBundleContext(), getContainerContext().getSessionId());
|
||||
fCommandControl = tracker.getService(IGDBControl.class);
|
||||
fReverseService = tracker.getService(IReverseRunControl2.class);
|
||||
tracker.dispose();
|
||||
|
||||
if (fReverseService != null) {
|
||||
|
||||
// Here we check for the reverse mode to be used for launching the reverse
|
||||
// debugging service.
|
||||
String fReverseModeString = CDebugUtils.getAttribute(fAttributes,
|
||||
IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE_MODE,
|
||||
IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_MODE_DEFAULT);
|
||||
if (fReverseModeString.equals(IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_MODE_HARDWARE)) {
|
||||
if (Platform.getPreferencesService().getString(GdbPlugin.PLUGIN_ID,
|
||||
IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_HARDWARE,
|
||||
IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_GDB_TRACE,
|
||||
null).equals(IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_BRANCH_TRACE)) {
|
||||
fReverseMode = ReverseTraceMethod.BRANCH_TRACE; // Branch Trace
|
||||
} else if (Platform.getPreferencesService().getString(GdbPlugin.PLUGIN_ID,
|
||||
IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_HARDWARE,
|
||||
IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_GDB_TRACE,
|
||||
null).equals(IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_PROCESSOR_TRACE)) {
|
||||
fReverseMode = ReverseTraceMethod.PROCESSOR_TRACE; // Processor Trace
|
||||
} else {
|
||||
fReverseMode = ReverseTraceMethod.GDB_TRACE; // GDB Selected Option
|
||||
}
|
||||
}
|
||||
else if (fReverseModeString.equals(IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_MODE_SOFTWARE)) {
|
||||
fReverseMode = ReverseTraceMethod.FULL_TRACE; // Full Trace
|
||||
} else {
|
||||
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR, "Invalid Trace Method Selected", null)); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
rm.done();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Here we set the reverse debug mode
|
||||
*/
|
||||
@Execute
|
||||
public void stepSetReverseMode(RequestMonitor rm) {
|
||||
if (getReverseEnabled() && fReverseService != null ) {
|
||||
fReverseService.enableReverseMode(fCommandControl.getContext(), fReverseMode, rm);
|
||||
} else {
|
||||
rm.done();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,7 +8,7 @@
|
|||
package org.eclipse.cdt.dsf.gdb.service.extensions;
|
||||
|
||||
import org.eclipse.cdt.dsf.debug.service.IProcesses;
|
||||
import org.eclipse.cdt.dsf.gdb.service.GDBProcesses_7_4;
|
||||
import org.eclipse.cdt.dsf.gdb.service.GDBProcesses_7_10;
|
||||
import org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactory;
|
||||
import org.eclipse.cdt.dsf.service.DsfSession;
|
||||
|
||||
|
@ -36,14 +36,14 @@ import org.eclipse.cdt.dsf.service.DsfSession;
|
|||
*
|
||||
* @since 4.8
|
||||
*/
|
||||
public class GDBProcesses_HEAD extends GDBProcesses_7_4 {
|
||||
public class GDBProcesses_HEAD extends GDBProcesses_7_10 {
|
||||
public GDBProcesses_HEAD(DsfSession session) {
|
||||
super(session);
|
||||
|
||||
validateGdbVersion(session);
|
||||
}
|
||||
|
||||
protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_4_VERSION; }
|
||||
protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_10_VERSION; }
|
||||
|
||||
protected void validateGdbVersion(DsfSession session) {
|
||||
GdbDebugServicesFactory.validateGdbVersion(session, getMinGDBVersionSupported(), this);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
package org.eclipse.cdt.dsf.gdb.service.extensions;
|
||||
|
||||
import org.eclipse.cdt.dsf.debug.service.IRunControl;
|
||||
import org.eclipse.cdt.dsf.gdb.service.GDBRunControl_7_6;
|
||||
import org.eclipse.cdt.dsf.gdb.service.GDBRunControl_7_10;
|
||||
import org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactory;
|
||||
import org.eclipse.cdt.dsf.service.DsfSession;
|
||||
|
||||
|
@ -37,14 +37,14 @@ import org.eclipse.cdt.dsf.service.DsfSession;
|
|||
*
|
||||
* @since 4.8
|
||||
*/
|
||||
public class GDBRunControl_HEAD extends GDBRunControl_7_6 {
|
||||
public class GDBRunControl_HEAD extends GDBRunControl_7_10 {
|
||||
public GDBRunControl_HEAD(DsfSession session) {
|
||||
super(session);
|
||||
|
||||
validateGdbVersion(session);
|
||||
}
|
||||
|
||||
protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_6_VERSION; }
|
||||
protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_10_VERSION; }
|
||||
|
||||
protected void validateGdbVersion(DsfSession session) {
|
||||
GdbDebugServicesFactory.validateGdbVersion(session, getMinGDBVersionSupported(), this);
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
* Alvaro Sanchez-Leon (Ericsson AB) - [Memory] Support 16 bit addressable size (Bug 426730)
|
||||
* Marc Khouzam (Ericsson) - Support for dynamic printf (Bug 400638)
|
||||
* Marc Khouzam (Ericsson) - Support for -gdb-version (Bug 455408)
|
||||
* Intel Corporation - Added Reverse Debugging BTrace support
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.dsf.mi.service.command;
|
||||
|
@ -237,7 +238,7 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIVarSetFormatInfo;
|
|||
import org.eclipse.cdt.dsf.mi.service.command.output.MIVarShowAttributesInfo;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.output.MIVarShowFormatInfo;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.output.MIVarUpdateInfo;
|
||||
|
||||
import org.eclipse.cdt.debug.core.model.IChangeReverseMethodHandler.ReverseTraceMethod;
|
||||
|
||||
/**
|
||||
* Factory to create MI/CLI commands.
|
||||
|
@ -316,6 +317,11 @@ public class CommandFactory {
|
|||
return new CLIRecord(ctx, enable);
|
||||
}
|
||||
|
||||
/** @since 5.0*/
|
||||
public ICommand<MIInfo> createCLIRecord(ICommandControlDMContext ctx, ReverseTraceMethod traceMethod) {
|
||||
return new CLIRecord(ctx, traceMethod);
|
||||
}
|
||||
|
||||
/** @since 4.1 */
|
||||
public ICommand<MIInfo> createCLIRemoteGet(ICommandControlDMContext ctx, String remoteFile, String localFile) {
|
||||
return new CLIRemoteGet(ctx, remoteFile, localFile);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2009, 2010 Ericsson and others.
|
||||
* Copyright (c) 2009, 2015 Ericsson 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
|
||||
|
@ -7,11 +7,13 @@
|
|||
*
|
||||
* Contributors:
|
||||
* Ericsson - Initial API and implementation
|
||||
* Intel Corporation - Added Reverse Debugging BTrace support
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.mi.service.command.commands;
|
||||
|
||||
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
|
||||
import org.eclipse.cdt.debug.core.model.IChangeReverseMethodHandler.ReverseTraceMethod;
|
||||
|
||||
/**
|
||||
* This command turns on on off the recording of "Process Record and Replay".
|
||||
|
@ -19,7 +21,34 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
|
|||
* @since 3.0
|
||||
*/
|
||||
public class CLIRecord extends CLICommand<MIInfo> {
|
||||
|
||||
public CLIRecord(ICommandControlDMContext ctx, boolean enable) {
|
||||
super(ctx, enable ? "record" : "record stop"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
|
||||
/** Only available for GDB >= 7.10 */
|
||||
/** @since 5.0 */
|
||||
public CLIRecord(ICommandControlDMContext ctx, ReverseTraceMethod traceMethod) {
|
||||
super(ctx, "record" + createRecordParams(traceMethod)); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
private static String createRecordParams(ReverseTraceMethod traceMethod)
|
||||
{
|
||||
String recordParam;
|
||||
|
||||
if (traceMethod == ReverseTraceMethod.STOP_TRACE)
|
||||
recordParam = " stop"; //$NON-NLS-1$
|
||||
else if (traceMethod == ReverseTraceMethod.FULL_TRACE) // full trace
|
||||
recordParam = " full"; //$NON-NLS-1$
|
||||
else if (traceMethod == ReverseTraceMethod.BRANCH_TRACE) // branch trace
|
||||
recordParam = " btrace bts"; //$NON-NLS-1$
|
||||
else if (traceMethod == ReverseTraceMethod.PROCESSOR_TRACE) // processor trace
|
||||
recordParam = " btrace pt"; //$NON-NLS-1$
|
||||
else if (traceMethod == ReverseTraceMethod.GDB_TRACE) // gdb selected trace
|
||||
recordParam = " btrace"; //$NON-NLS-1$
|
||||
else // no trace method defined
|
||||
recordParam = ""; //$NON-NLS-1$
|
||||
|
||||
return recordParam;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue