1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-05 08:05:24 +02:00

Bug 497349 - Reverse debug is always enabled when attaching to a process

Change-Id: I3761e57fb625cab31e013676d3eda7f214496918
This commit is contained in:
Marc Khouzam 2016-07-05 15:08:59 -04:00 committed by Gerrit Code Review @ Eclipse.org
parent db2d46c7fc
commit efa5f6a75f

View file

@ -56,30 +56,36 @@ public class GDBProcesses_7_10 extends GDBProcesses_7_4 {
ILaunch launch = procCtx.getAdapter(ILaunch.class);
if (launch != null) {
try {
ICommandControlDMContext controlContext = DMContexts.getAncestorOfType(procCtx, ICommandControlDMContext.class);
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(controlContext, ReverseDebugMethod.SOFTWARE, rm);
}
else if (reverseMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_MODE_HARDWARE)) {
String defaultValue = Platform.getPreferencesService().getString(GdbPlugin.PLUGIN_ID,
IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_HARDWARE,
IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_GDB_TRACE, null);
ReverseDebugMethod traceMethod = ReverseDebugMethod.GDB_TRACE;
if (defaultValue.equals(IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_BRANCH_TRACE)) {
traceMethod = ReverseDebugMethod.BRANCH_TRACE;
} else if (defaultValue.equals(IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_PROCESSOR_TRACE)) {
traceMethod = ReverseDebugMethod.PROCESSOR_TRACE;
}
reverseService.enableReverseMode(controlContext, traceMethod, rm);
}
else {
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Unexpected Reverse debugging mode " + reverseMode, null)); //$NON-NLS-1$
}
boolean reverseEnabled =
launch.getLaunchConfiguration().getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE,
IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_DEFAULT);
if (reverseEnabled) {
ICommandControlDMContext controlContext = DMContexts.getAncestorOfType(procCtx, ICommandControlDMContext.class);
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(controlContext, ReverseDebugMethod.SOFTWARE, rm);
} else if (reverseMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_MODE_HARDWARE)) {
String defaultValue = Platform.getPreferencesService().getString(GdbPlugin.PLUGIN_ID,
IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_HARDWARE,
IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_GDB_TRACE, null);
ReverseDebugMethod traceMethod = ReverseDebugMethod.GDB_TRACE;
if (defaultValue.equals(IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_BRANCH_TRACE)) {
traceMethod = ReverseDebugMethod.BRANCH_TRACE;
} else if (defaultValue.equals(IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_PROCESSOR_TRACE)) {
traceMethod = ReverseDebugMethod.PROCESSOR_TRACE;
}
reverseService.enableReverseMode(controlContext, traceMethod, rm);
}
else {
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Unexpected Reverse debugging mode " + reverseMode, null)); //$NON-NLS-1$
}
} else {
rm.done();
}
} catch (CoreException e) {
// Ignore, just don't set reverse method
rm.done();