Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonah Graham2018-11-20 16:20:42 +0000
committerJonah Graham2018-11-22 21:47:02 +0000
commit170e654b4796bad1453ae85a427b97317d67a69a (patch)
tree6ca9b8a8fedd5fd25f97eb79c408312e256ff981 /dsf-gdb
parent35996a5c5ca5c254959ba48241eaada6dbf8628d (diff)
downloadorg.eclipse.cdt-170e654b4796bad1453ae85a427b97317d67a69a.tar.gz
org.eclipse.cdt-170e654b4796bad1453ae85a427b97317d67a69a.tar.xz
org.eclipse.cdt-170e654b4796bad1453ae85a427b97317d67a69a.zip
Bug 540373: Cleanup: Format & Remove trailing whitespace
This was done by selecting all projects in Eclipse then Source -> Clean Up... -> choosing: - Format source code - Remove trailing white spaces on all lines and completing the wizard Change-Id: I63685372c6bcc67719bcf145123bcb72e5b00394
Diffstat (limited to 'dsf-gdb')
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui.tests/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/ui/test/AutomatedIntegrationSuite.java8
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui.tests/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/ui/test/PersistentSettingsManagerTest.java238
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui.tests/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/ui/test/VisualizerVirtualBoundsGraphicObjectTest.java5
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/MulticoreVisualizerUIPlugin.java82
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/EnableLoadMetersAction.java30
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/FilterCanvasAction.java17
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/PinToDebugSessionAction.java29
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/RefreshAction.java35
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/SelectAllAction.java35
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/SetLoadMeterPeriodAction.java18
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/ShowDebugToolbarAction.java29
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/IVisualizerModelObject.java8
-rwxr-xr-xdsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerCPU.java60
-rwxr-xr-xdsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerCore.java49
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerExecutionState.java7
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerLoadInfo.java29
-rwxr-xr-xdsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerModel.java91
-rwxr-xr-xdsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerThread.java105
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/IMulticoreVisualizerConstants.java32
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/IPinnable.java4
-rwxr-xr-xdsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizer.java919
-rwxr-xr-xdsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerCPU.java70
-rwxr-xr-xdsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerCanvas.java614
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerCanvasFilter.java262
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerCanvasFilterManager.java53
-rwxr-xr-xdsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerCore.java87
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerEventListener.java525
-rwxr-xr-xdsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerGraphicObject.java10
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerLoadMeter.java81
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerMarquee.java29
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerSelectionFinder.java84
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerStatusBar.java20
-rwxr-xr-xdsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerThread.java77
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/DSFDebugModel.java202
-rwxr-xr-xdsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/DSFSessionState.java78
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/DebugViewTreeWalker.java73
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/DebugViewUtils.java110
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/IDSFTargetDataProxy.java18
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/MementoUtils.java18
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/PersistentSettingsManager.java296
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/service/CommonDsfTest.java42
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/service/GDBRegisterTest.java99
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/tests/AutomatedIntegrationSuite.java19
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/tests/FilePartsTest.java37
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/tests/LaunchUtilsTest.java280
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/tests/ProcStatParserTest.java187
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/mi/service/command/commands/TestMIBreakInsertCommand.java19
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/mi/service/command/commands/TestMICommandConstructCommand.java22
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/mi/service/command/commands/TestMIGDBSetSysroot.java1
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStringHandlerTests.java807
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/mi/service/command/output/MIThreadTests.java10
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbAdapterFactory.java251
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbDebugTextHover.java39
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbPinColorTracker.java32
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbPinProvider.java200
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbSessionAdapters.java420
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbStatusHandler.java33
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbSuspendTrigger.java98
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbUIPlugin.java117
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/IGdbUIConstants.java6
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/Messages.java2
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/DsfLoadSymbolsCommandHandler.java16
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/DsfTerminateCommand.java380
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/FetchMoreChildrenAction.java37
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbDisconnectCommand.java338
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbRestartCommand.java154
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbSteppingModeTarget.java52
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/ProcessInfo.java35
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/ReverseDebuggingPropertyTester.java37
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/CBreakpointGdbThreadFilterPage.java47
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/DisassemblyToggleDynamicPrintfTarget.java63
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/DisassemblyToggleTracepointsTarget.java35
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/GDBDynamicPrintfPropertyPage.java264
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/GDBTracepointPropertyPage.java254
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/GdbThreadFilterEditor.java987
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/Messages.java2
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/ToggleDynamicPrintfTargetFactory.java7
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/ToggleTracepointsTargetFactory.java12
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/AddLocalsExpressionCommandHandler.java2
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/AddRegistersExpressionCommandHandler.java2
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbAbstractReverseStepCommand.java123
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbConnectCommand.java1021
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbDebugNewExecutableCommand.java143
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbResumeWithoutSignalCommand.java181
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbReverseResumeCommand.java163
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbReverseStepIntoCommand.java5
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbReverseStepOverCommand.java3
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbReverseToggleCommand.java657
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbSaveTraceDataCommand.java55
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbSelectNextTraceRecordCommand.java166
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbSelectPrevTraceRecordCommand.java154
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbStartTracingCommand.java97
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbStopTracingCommand.java79
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbUncallCommand.java14
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/Messages.java8
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/RefreshableDebugCommand.java4
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/SelectNextTraceRecordCommandHandler.java4
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/SelectPrevTraceRecordCommandHandler.java4
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/ConsoleMessages.java10
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/ConsolePageParticipant.java181
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbAbstractConsolePreferenceListener.java12
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbBasicCliConsole.java302
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbBasicCliConsolePage.java20
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbCliConsoleManager.java109
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbConsoleLifecycleListener.java6
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbFullCliConsole.java128
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbFullCliConsolePage.java63
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbTerminalConnector.java30
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbTerminalPageConnector.java163
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/IGDBDebuggerConsole.java10
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/IGdbTerminalControlConnector.java4
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/TracingConsole.java235
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/TracingConsoleManager.java70
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/actions/ConsoleSaveAction.java39
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/actions/GdbAutoTerminateAction.java3
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/actions/GdbConsoleClearAction.java4
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/actions/GdbConsolePasteAction.java1
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/actions/GdbConsoleScrollLockAction.java7
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/actions/GdbConsoleTerminateLaunchAction.java9
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/disassembly/AddDynamicPrintfRulerAction.java155
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/disassembly/DisassemblyMessages.java12
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/AttachCDebuggerTab.java13
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CArgumentsTab.java166
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CDebuggerTab.java115
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CLaunchConfigurationTab.java31
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CMainAttachTab.java11
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CMainCoreTab.java11
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CMainTab.java13
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CoreFileDebuggerTab.java8
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CoreFilePrompter.java13
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/GDBSolibBlock.java146
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/GdbCoreDebuggerPage.java59
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/GdbDebuggerPage.java109
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/GdbServerDebuggerPage.java50
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/ICDTLaunchHelpContextIds.java14
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/IMILaunchConfigurationComponent.java30
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/LaunchImages.java28
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/LaunchUIMessages.java19
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/LocalApplicationCDebuggerTab.java50
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/NewExecutableDialog.java171
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/NewExecutableInfo.java28
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/ProcessPrompter.java79
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/ProcessPrompterDialog.java107
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/RemoteApplicationCDebuggerTab.java50
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/SerialPortSettingsBlock.java31
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/SolibSearchPathBlock.java165
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/TCPSettingsBlock.java23
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/WorkingDirectoryBlock.java67
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/memory/GdbMemoryBlockAddressInfoRetrieval.java270
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/AttachProcessHandler.java2
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/ColumnLayout.java60
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/ContentLabelProviderWrapper.java14
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/OSData.java59
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/OSResourcesView.java205
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/ResourceClassContributionItem.java46
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/SessionOSData.java185
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbConsolePreferencePage.java10
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbDebugPreferencePage.java509
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.java2
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/ReverseDebugPreferencePage.java32
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/sync/GdbDebugContextSyncManager.java9
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/CollectActionPage.java80
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/EvaluateActionPage.java9
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/MessagesForTracepointActions.java4
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/TracepointActionDialog.java49
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/TracepointActionsList.java4
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/TracepointActionsPreferencePage.java11
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/TracepointActionsPropertyPage.java9
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/TracepointGlobalActionsList.java27
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/WhileSteppingActionPage.java26
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/AbstractImageRegistry.java83
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/CircularProgress.java42
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/FlatButton.java75
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/FlatRadioButton.java32
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/TraceControlModel.java308
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/TraceControlView.java436
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/TraceVarDetailsDialog.java53
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/TracepointImageRegistry.java80
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/TracepointsMessages.java13
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/FetchMoreChildrenEvent.java22
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/GdbExpressionVMProvider.java294
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/GdbVariableVMNode.java578
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/GdbVariableVMProvider.java184
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/GdbViewModelAdapter.java67
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/Messages.java19
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/breakpoints/GdbBreakpointVMNode.java60
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/breakpoints/GdbBreakpointVMProvider.java555
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/commands/RetargetDebugContextCommand.java232
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/ContainerVMNode.java912
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/GdbExecutionContextLabelText.java69
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/GdbStackFramesVMNode.java74
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/GdbStandardProcessVMNode.java262
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/IGdbLaunchVMConstants.java82
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/LaunchVMModelProxyStrategy.java36
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/LaunchVMProvider.java234
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/MessagesForGdbLaunchVM.java30
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/ThreadVMNode.java732
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/GDBTypeParser.java126
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGDBLaunchConfigurationConstants.java75
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGdbDebugConstants.java68
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGdbDebugPreferenceConstants.java56
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/actions/IConnect.java4
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/breakpoints/CBreakpointGdbThreadsFilterExtension.java112
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/breakpoints/GDBDynamicPrintfUtils.java50
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/CoreInfo.java4
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/CoreList.java129
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbDebugOptions.java15
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPlugin.java184
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPreferenceInitializer.java36
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/Messages.java8
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/ProcStatCoreLoads.java17
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/ProcStatCounters.java45
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/ProcStatParser.java135
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/commands/ISelectNextTraceRecordHandler.java4
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/commands/ISelectPrevTraceRecordHandler.java2
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/launching/CoreBuildLocalDebugLaunchDelegate.java26
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/memory/GdbMemoryAddressInfoRegistersRetrieval.java73
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/memory/GdbMemoryAddressInfoVariablesRetrieval.java14
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/memory/GdbMemoryBlock.java85
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/memory/GdbMemoryBlockRetrieval.java448
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/memory/GdbMemoryBlockRetrievalManager.java11
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/memory/MemoryBlockAddressInfoItem.java2
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/memory/Messages.java16
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/GDBFocusSynchronizer.java319
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/IGDBFocusSynchronizer.java43
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/command/commands/MIMetaGetCPUInfo.java20
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/command/events/EventMessages.java18
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/command/events/MITracepointSelectedEvent.java70
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/command/output/MIMetaGetCPUInfoInfo.java6
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/control/StepIntoSelectionActiveOperation.java8
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/control/StepIntoSelectionUtils.java18
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/tracepointactions/CollectAction.java44
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/tracepointactions/EvaluateAction.java6
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/tracepointactions/ITracepointAction.java1
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/tracepointactions/MessagesForTracepointActions.java4
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/tracepointactions/TracepointActionManager.java20
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/tracepointactions/WhileSteppingAction.java14
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java310
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence_7_0.java117
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence_7_12.java42
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence_7_2.java32
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence_7_7.java32
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GDBDebugger.java5
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GDBProcess.java17
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GDBServerDebugger.java5
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbAttachLaunchDelegate.java7
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunch.java64
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunchDelegate.java594
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbProcessFactory.java10
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbSourceLookupDirector.java10
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbSourceLookupParticipant.java4
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/IProcessExtendedInfo.java16
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/ITracedLaunch.java7
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/InferiorRuntimeProcess.java19
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/LaunchMessages.java16
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/LaunchUtils.java475
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/ServicesLaunchSequence.java245
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/ShutdownSequence.java73
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/memory/IGdbMemoryAddressInfoTypeRetrieval.java20
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/DebugNewProcessSequence.java267
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/DebugNewProcessSequence_7_2.java67
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBackend.java84
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBackend_7_12.java81
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpointsManager_7_0.java39
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpointsManager_7_2.java9
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_0.java326
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_2.java222
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_4.java211
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_6.java19
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_7.java194
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBDisassembly_7_3.java95
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBHardwareAndOS.java833
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBHardwareAndOS_7_10.java89
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBHardwareAndOS_7_5.java40
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBMemory.java389
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBMemory_7_0.java46
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBMemory_7_6.java168
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBPatternMatchingExpressions.java907
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses.java753
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java2404
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_1.java156
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_10.java90
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_12.java52
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java702
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2_1.java13
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_3.java18
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_4.java21
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRegisters.java248
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl.java755
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0.java544
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0_NS.java1845
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_10.java158
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_12.java249
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_2_NS.java60
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_6.java82
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBSourceLookup.java2
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBTraceControl_7_2.java1371
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBTraceControl_7_4.java66
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GdbDebugServicesFactory.java95
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBBackend.java52
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBHardwareAndOS.java155
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBHardwareAndOS2.java83
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBMemory.java6
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBMemory2.java9
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBProcesses.java230
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBSourceLookup.java6
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBTraceControl.java379
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBTraceControl2.java20
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IReverseRunControl.java140
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IReverseRunControl2.java16
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/Messages.java2
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/SessionType.java6
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_0.java238
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_10.java183
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_12.java8
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_3.java4
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/CommandFactory_6_8.java12
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/CustomTimeoutsMap.java53
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBBackendCLIProcess.java123
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBBackendProcessWithoutIO.java4
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl.java889
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControlDMContext.java16
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_0.java181
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_12.java16
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_2.java17
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_4.java31
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_7.java18
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GdbCommandTimeoutManager.java372
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/IGDBBackendProcessWithoutIO.java4
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/IGDBControl.java50
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBBackend_HEAD.java18
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBBreakpointsManager_HEAD.java20
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBBreakpointsSynchronizer_HEAD.java20
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBBreakpoints_HEAD.java20
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBControl_HEAD.java20
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBDisassembly_HEAD.java20
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBExpressions_HEAD.java20
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBHardwareAndOS_HEAD.java20
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBMemory_HEAD.java18
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBModules_HEAD.java20
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBProcesses_HEAD.java20
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBRegisters_HEAD.java20
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBRunControl_HEAD.java20
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBRunControl_NS_HEAD.java20
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBSourceLookup_HEAD.java20
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBStack_HEAD.java20
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBTraceControl_HEAD.java20
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/CSourceLookup.java230
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIBackend.java118
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIBackend2.java10
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIBreakpointPathAdjuster.java4
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMICommandControl.java8
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIContainerDMContext.java15
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIExecutionDMContext.java23
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIExpressions.java28
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIProcessDMContext.java16
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIProcesses.java88
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIRunControl.java35
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointDMData.java207
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpoints.java1367
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java4049
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsSynchronizer.java1516
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIDisassembly.java410
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIExpressions.java2188
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIFormat.java156
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIMemory.java1332
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIModules.java485
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIProcesses.java764
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRegisters.java1243
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRunControl.java1460
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIStack.java425
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIVariableManager.java2714
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/Messages.java4
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/breakpoint/actions/BreakpointActionAdapter.java46
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/breakpoint/actions/CLIDebugActionEnabler.java10
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/breakpoint/actions/MILogActionEnabler.java89
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/breakpoint/actions/MIResumeActionEnabler.java38
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/breakpoint/actions/MIReverseDebugEnabler.java85
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/AbstractCLIProcess.java852
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/AbstractMIControl.java1902
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CLIEventProcessor.java641
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CLIEventProcessor_7_0.java453
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CLIEventProcessor_7_7.java33
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CommandFactory.java185
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/IEventProcessor.java2
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/LargePipedInputStream.java13
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIAsyncErrorProcessor.java34
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIBackendCLIProcess.java238
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIControlDMContext.java87
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIInferiorProcess.java906
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIInferiorProcess_7_3.java148
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor.java637
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor_7_0.java694
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor_7_12.java8
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/Adjustable.java8
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIAddressableSize.java12
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIAttach.java6
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLICatch.java16
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLICommand.java25
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIExecAbort.java19
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIInferior.java4
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIInfoBreak.java18
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIInfoProgram.java4
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIInfoRecord.java6
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIInfoSharedLibrary.java11
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIInfoThreads.java8
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIJump.java2
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIPasscount.java13
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIRecord.java43
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIRemote.java13
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIRemoteGet.java7
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLISharedLibrary.java4
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIShowEndian.java6
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLISource.java16
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIThread.java8
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLITrace.java9
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLITraceDump.java17
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIUnsetEnv.java8
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIUnsetSubstitutePath.java4
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/ExprMetaCommand.java96
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/ExprMetaGetAttributes.java2
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/ExprMetaGetChildCount.java8
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/ExprMetaGetChildren.java10
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/ExprMetaGetValue.java26
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/ExprMetaGetVar.java2
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIAddInferior.java30
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakAfter.java15
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakCommands.java15
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakCondition.java11
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakDelete.java31
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakDisable.java31
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakEnable.java31
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakInsert.java185
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakList.java21
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakPasscount.java22
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakWatch.java26
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MICommand.java366
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDPrintfInsert.java176
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataDisassemble.java85
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataEvaluateExpression.java43
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataListRegisterNames.java41
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataListRegisterValues.java286
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataReadMemory.java143
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataReadMemoryBytes.java19
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataWriteMemory.java122
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataWriteMemoryBytes.java17
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIEnablePrettyPrinting.java11
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIEnvironmentCD.java7
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIEnvironmentDirectory.java8
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecArguments.java7
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecContinue.java63
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecFinish.java13
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecInterrupt.java63
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecJump.java15
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecNext.java11
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecNextInstruction.java19
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReturn.java23
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseContinue.java12
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseNext.java16
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseNextInstruction.java18
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseStep.java19
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseStepInstruction.java19
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecRun.java23
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecStep.java19
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecStepInstruction.java19
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecUncall.java10
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecUntil.java19
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIFileExecAndSymbols.java21
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIFileExecFile.java38
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIFileSymbolFile.java38
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBExit.java13
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSet.java21
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetAutoSolib.java19
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetBreakpointPending.java19
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetCharset.java10
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetCircularTraceBuffer.java6
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetDPrintfStyle.java18
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetDetachOnFork.java15
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetDisconnectedTracing.java6
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetEnv.java73
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetHostCharset.java10
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetLanguage.java4
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetNewConsole.java4
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetNonStop.java13
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPagination.java13
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPrintObject.java8
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPrintSevenbitStrings.java10
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPythonPrintStack.java23
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetRecordFullStopAtLimit.java11
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetRemoteTimeout.java2
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetSchedulerLocking.java31
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetSolibAbsolutePrefix.java3
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetSolibSearchPath.java16
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetStopOnSolibEvents.java19
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetSysroot.java5
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetTargetAsync.java13
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetTargetCharset.java10
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetTargetWideCharset.java12
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetTraceNotes.java6
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetTraceUser.java6
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBShow.java15
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBShowExitCode.java28
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBShowLanguage.java17
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBShowNewConsole.java8
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBVersion.java12
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIInferiorTTYSet.java22
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIInfoOs.java8
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIInterpreterExec.java20
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIInterpreterExecConsole.java14
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIInterpreterExecConsoleKill.java6
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIListFeatures.java7
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIListThreadGroups.java74
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIRemoveInferior.java15
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MISetSubstitutePath.java2
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIStackInfoDepth.java31
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIStackListArguments.java49
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIStackListFrames.java32
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIStackListLocals.java23
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIStackSelectFrame.java8
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetAttach.java10
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetDetach.java16
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetDisconnect.java6
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetDownload.java28
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetSelect.java16
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetSelectCore.java2
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetSelectTFile.java4
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIThreadInfo.java16
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIThreadListIds.java14
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIThreadSelect.java16
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITraceDefineVariable.java12
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITraceFind.java36
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITraceListVariables.java18
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITraceSave.java10
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITraceStart.java6
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITraceStatus.java15
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITraceStop.java17
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarAssign.java23
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarCreate.java36
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarDelete.java29
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarEvaluateExpression.java28
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarInfoExpression.java23
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarInfoNumChildren.java23
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarInfoPathExpression.java22
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarInfoType.java24
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarListChildren.java28
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarSetFormat.java65
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarSetUpdateRange.java8
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarShowAttributes.java23
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarShowFormat.java21
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarUpdate.java24
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/RawCommand.java42
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/IMIDMEvent.java25
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIBreakpointChangedEvent.java23
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIBreakpointHitEvent.java115
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MICatchpointHitEvent.java83
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIDetachedEvent.java23
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIErrorEvent.java129
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIEvent.java61
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIFunctionFinishedEvent.java92
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIInferiorExitEvent.java73
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIInferiorSignalExitEvent.java54
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MILocationReachedEvent.java21
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIRunningEvent.java69
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MISharedLibEvent.java34
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MISignalChangedEvent.java23
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MISignalEvent.java80
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MISteppingRangeEvent.java23
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIStoppedEvent.java59
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIThreadCreatedEvent.java72
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIThreadExitEvent.java76
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIThreadGroupAddedEvent.java16
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIThreadGroupCreatedEvent.java17
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIThreadGroupExitedEvent.java50
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIWatchpointScopeEvent.java66
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIWatchpointTriggerEvent.java164
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIAddressableSizeInfo.java24
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLICatchInfo.java8
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIInfoBreakInfo.java34
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIInfoProgramInfo.java10
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIInfoRecordInfo.java28
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIInfoSharedLibraryInfo.java18
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIInfoThreadsInfo.java77
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIShowEndianInfo.java14
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIThreadInfo.java30
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLITraceDumpInfo.java44
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLITraceInfo.java13
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetAttributesInfo.java18
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetChildCountInfo.java20
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetChildrenInfo.java25
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetValueInfo.java40
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetVarInfo.java147
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIAddInferiorInfo.java54
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIArg.java204
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIAsyncRecord.java98
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIBreakInsertInfo.java119
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIBreakListInfo.java128
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIBreakpoint.java800
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIConst.java54
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDataDisassembleInfo.java231
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDataEvaluateExpressionInfo.java36
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDataListRegisterNamesInfo.java104
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDataListRegisterValuesInfo.java148
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDataReadMemoryBytesInfo.java40
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDataReadMemoryInfo.java258
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDataWriteMemoryInfo.java20
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDisplayHint.java108
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIExecAsyncOutput.java4
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIFrame.java226
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIGDBShowExitCodeInfo.java28
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIGDBShowLanguageInfo.java46
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIGDBShowNewConsoleInfo.java2
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIGDBVersionInfo.java16
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIInfo.java134
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIInfoOsInfo.java57
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIInstruction.java258
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIList.java70
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIListFeaturesInfo.java4
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIListThreadGroupsInfo.java257
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIMixedInstruction.java164
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MINotifyAsyncOutput.java4
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIOutput.java94
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIParser.java976
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIRegisterValue.java136
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIResult.java64
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIResultRecord.java96
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStackInfoDepthInfo.java31
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStackListArgumentsInfo.java105
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStackListFramesInfo.java104
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStackListLocalsInfo.java8
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStatusAsyncOutput.java4
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStreamRecord.java41
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStringHandler.java850
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MITargetDownloadInfo.java130
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIThread.java322
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIThreadInfoInfo.java40
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIThreadListIdsInfo.java53
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MITraceFindInfo.java7
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MITraceListVariablesInfo.java132
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MITraceRecord.java23
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MITraceStatusInfo.java67
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MITraceStopInfo.java9
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MITuple.java109
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVar.java172
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarAssignInfo.java48
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarChange.java41
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarCreateInfo.java83
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarDeleteInfo.java56
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarEvaluateExpressionInfo.java46
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarInfoExpressionInfo.java42
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarInfoNumChildrenInfo.java43
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarInfoPathExpressionInfo.java44
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarInfoTypeInfo.java33
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarListChildrenInfo.java58
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarSetFormatInfo.java46
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarShowAttributesInfo.java34
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarShowFormatInfo.java55
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarUpdateInfo.java66
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/GDBExamplePlugin.java21
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/GdbExtendedSessionAdapters.java14
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/actions/DsfExtendedTerminateCommand.java10
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/actions/GdbShowVersionHandler.java4
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedFinalLaunchSequence.java58
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedLaunch.java9
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedLaunchDelegate.java23
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedServicesLaunchSequence.java5
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GDBExtendedControl.java17
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GDBExtendedService.java66
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GdbExtendedDebugServicesFactory.java14
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/IGDBExtendedFunctions.java3
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/command/GdbExtendedCommandFactory_6_8.java14
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/command/commands/CLIGDBVersion.java8
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/ui/ExtendedTab.java6
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/ui/console/GdbExtendedConsoleMessages.java22
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/ui/console/GdbExtendedConsolePageParticipant.java2
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/ui/console/GdbExtendedInfoThreadsAction.java1
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/ui/console/GdbExtendedSpecialBackgroundToggle.java11
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedLaunchVMProvider.java39
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedThreadVMNode.java275
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedVMMessages.java26
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedViewModelAdapter.java35
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/ClassAccessor.java42
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/AsyncCompletionWaitor.java68
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BackgroundRunner.java57
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseParametrizedTestCase.java34
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java441
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/MemoryByteBuffer.java3
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/OnceOnlySuite.java29
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/ServiceEventWaitor.java104
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/ServiceFactoriesManager.java11
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java758
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/launching/TestLaunchDelegate.java70
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/launching/TestsPlugin.java152
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AllRemoteSuites.java2
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AutomatedSuite.java4
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/CommandLineArgsTest.java2
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/CommandTimeoutTest.java132
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBConsoleBreakpointsTest.java532
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBConsoleSynchronizingTest.java335
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBPatternMatchingExpressionsTest.java347
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBProcessesTest.java41
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBRemoteTracepointsTest.java388
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBTestTest.java12
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/ITestConstants.java38
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/LaunchConfigurationAndRestartTest.java1475
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIBreakpointsTest.java834
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MICatchpointsTest.java889
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIDisassemblyTest.java744
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIExpressionsTest.java7097
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIMemoryTest.java276
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIModifiedServicesTest.java22
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRegistersTest.java290
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlReverseTest.java89
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTargetAvailableTest.java1418
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTest.java968
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/OperationsWhileTargetIsRunningTest.java481
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/PostMortemCoreTest.java885
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/SourceLookupTest.java14
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/StepIntoSelectionTest.java374
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/SuiteGdb.java39
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/TraceFileTest.java403
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/GDBMultiNonStopRunControlTest.java1619
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/MIExpressionsNonStopTest.java2
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/MIRunControlNonStopTargetAvailableTest.java2
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/ThreadStackFrameSyncTest.java451
724 files changed, 53859 insertions, 53975 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui.tests/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/ui/test/AutomatedIntegrationSuite.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui.tests/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/ui/test/AutomatedIntegrationSuite.java
index 6122d10ec0c..d20faee1b3b 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui.tests/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/ui/test/AutomatedIntegrationSuite.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui.tests/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/ui/test/AutomatedIntegrationSuite.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Marc Dumais (Ericsson) - Initial Implementation
*******************************************************************************/
@@ -18,14 +18,10 @@ import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
-
@RunWith(Suite.class)
// Add additional test case classes below
-@SuiteClasses({
- PersistentSettingsManagerTest.class,
- VisualizerVirtualBoundsGraphicObjectTest.class,
-})
+@SuiteClasses({ PersistentSettingsManagerTest.class, VisualizerVirtualBoundsGraphicObjectTest.class, })
public class AutomatedIntegrationSuite {
// Often overriding BeforeClass method here
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui.tests/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/ui/test/PersistentSettingsManagerTest.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui.tests/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/ui/test/PersistentSettingsManagerTest.java
index 6dee6dc5bcd..23e10cafdaf 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui.tests/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/ui/test/PersistentSettingsManagerTest.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui.tests/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/ui/test/PersistentSettingsManagerTest.java
@@ -31,12 +31,12 @@ import org.junit.Test;
public class PersistentSettingsManagerTest {
// ---- variables ----
-
+
/** persistent settings manager */
private PersistentSettingsManager m_persistentSettingsManager1;
private PersistentSettingsManager m_persistentSettingsManager2;
private PersistentSettingsManager m_persistentSettingsManager3;
-
+
// set of persistent parameters
private PersistentParameter<String> m_stringParam;
private PersistentParameter<Boolean> m_booleanParam;
@@ -47,24 +47,23 @@ public class PersistentSettingsManagerTest {
private PersistentMapParameter<String> m_mapOfStringParam;
private PersistentMapParameter<Boolean> m_mapOfBooleanParam;
private PersistentMapParameter<Integer> m_mapOfIntegerParam;
-
+
// set of per-instance parameters
private PersistentParameter<String> m_stringParamInstance1;
private PersistentParameter<String> m_stringParamInstance2;
private PersistentParameter<String> m_stringParamInstance3;
-
+
// set of global parameters
private PersistentParameter<String> m_stringGlobalParamInstance1;
private PersistentParameter<String> m_stringGlobalParamInstance2;
private PersistentParameter<String> m_stringGlobalParamInstance3;
-
+
// random number generator
private Random m_random = new Random();
-
-
+
// ---- constants ----
private final static int NUM_LIST_ELEMENTS = 10;
-
+
private final static String INSTANCE_ID_1 = "instance1";
private final static String INSTANCE_ID_2 = "instance2";
private final static String INSTANCE_ID_3 = "instance3";
@@ -72,70 +71,86 @@ public class PersistentSettingsManagerTest {
private final static String DEFAULT_STRING = "Default String";
private final static Boolean DEFAULT_BOOLEAN = false;
private final static Integer DEFAULT_INTEGER = 1234321;
-
+
private final static String DEFAULT_STRING_VAL_INSTANCE1 = "Default String Instance 1";
private final static String DEFAULT_STRING_VAL_INSTANCE2 = "Default String Instance 2";
private final static String DEFAULT_STRING_VAL_INSTANCE3 = "Default String Instance 3";
private final static String DEFAULT_STRING_VAL_SHARED = "Default String Shared Instance";
-
-
+
public PersistentSettingsManagerTest() {
// 3 instances of managers - to simulate, for example, 3 views each having one manager
m_persistentSettingsManager1 = new PersistentSettingsManager("PersistentSettingsManagerTest", INSTANCE_ID_1);
- m_persistentSettingsManager2 = new PersistentSettingsManager("PersistentSettingsManagerTest", INSTANCE_ID_2);
- m_persistentSettingsManager3 = new PersistentSettingsManager("PersistentSettingsManagerTest", INSTANCE_ID_3);
-
+ m_persistentSettingsManager2 = new PersistentSettingsManager("PersistentSettingsManagerTest", INSTANCE_ID_2);
+ m_persistentSettingsManager3 = new PersistentSettingsManager("PersistentSettingsManagerTest", INSTANCE_ID_3);
+
// one persistent parameter for each supported type:
// simple types
- m_stringParam = m_persistentSettingsManager1.getNewParameter(String.class, "String Parameter", false, DEFAULT_STRING);
- m_booleanParam = m_persistentSettingsManager1.getNewParameter(Boolean.class, "Boolean Parameter", false, DEFAULT_BOOLEAN);
- m_integerParam = m_persistentSettingsManager1.getNewParameter(Integer.class, "Integer Parameter", false, DEFAULT_INTEGER);
+ m_stringParam = m_persistentSettingsManager1.getNewParameter(String.class, "String Parameter", false,
+ DEFAULT_STRING);
+ m_booleanParam = m_persistentSettingsManager1.getNewParameter(Boolean.class, "Boolean Parameter", false,
+ DEFAULT_BOOLEAN);
+ m_integerParam = m_persistentSettingsManager1.getNewParameter(Integer.class, "Integer Parameter", false,
+ DEFAULT_INTEGER);
// List<T>
- m_listOfStringParam = m_persistentSettingsManager1.getNewListParameter(String.class, "List of String Parameter", false, new ArrayList<String>());
- m_listOfBooleanParam = m_persistentSettingsManager1.getNewListParameter(Boolean.class, "List of Boolean Parameter", false, new ArrayList<Boolean>());
- m_listOfIntegerParam = m_persistentSettingsManager1.getNewListParameter(Integer.class, "List of Integer Parameter", false, new ArrayList<Integer>());
+ m_listOfStringParam = m_persistentSettingsManager1.getNewListParameter(String.class, "List of String Parameter",
+ false, new ArrayList<String>());
+ m_listOfBooleanParam = m_persistentSettingsManager1.getNewListParameter(Boolean.class,
+ "List of Boolean Parameter", false, new ArrayList<Boolean>());
+ m_listOfIntegerParam = m_persistentSettingsManager1.getNewListParameter(Integer.class,
+ "List of Integer Parameter", false, new ArrayList<Integer>());
// Map<String,T>
- m_mapOfStringParam = m_persistentSettingsManager1.getNewMapParameter(String.class, "Map of String Parameter", true, new HashMap<String,String>());
- m_mapOfBooleanParam = m_persistentSettingsManager1.getNewMapParameter(Boolean.class, "Map of Boolean Parameter", true, new HashMap<String,Boolean>());
- m_mapOfIntegerParam = m_persistentSettingsManager1.getNewMapParameter(Integer.class, "Map of Integer Parameter", true, new HashMap<String,Integer>());
-
+ m_mapOfStringParam = m_persistentSettingsManager1.getNewMapParameter(String.class, "Map of String Parameter",
+ true, new HashMap<String, String>());
+ m_mapOfBooleanParam = m_persistentSettingsManager1.getNewMapParameter(Boolean.class, "Map of Boolean Parameter",
+ true, new HashMap<String, Boolean>());
+ m_mapOfIntegerParam = m_persistentSettingsManager1.getNewMapParameter(Integer.class, "Map of Integer Parameter",
+ true, new HashMap<String, Integer>());
+
// simulate 3 instances using the same parameter, using "per instance" persistence (i.e. they'll be persisted independently)
- m_stringParamInstance1 = m_persistentSettingsManager1.getNewParameter(String.class, "Per-instance String Parameter", true, DEFAULT_STRING_VAL_INSTANCE1);
- m_stringParamInstance2 = m_persistentSettingsManager2.getNewParameter(String.class, "Per-instance String Parameter", true, DEFAULT_STRING_VAL_INSTANCE2);
- m_stringParamInstance3 = m_persistentSettingsManager3.getNewParameter(String.class, "Per-instance String Parameter", true, DEFAULT_STRING_VAL_INSTANCE3);
-
- // This is to simulate a persistent parameter, being "shared" by 3 instances (e.g. views). So, the 3 instances are persisted as a single parameter.
- m_stringGlobalParamInstance1 = m_persistentSettingsManager1.getNewParameter(String.class, "Global String Parameter", false, DEFAULT_STRING_VAL_SHARED);
- m_stringGlobalParamInstance2 = m_persistentSettingsManager2.getNewParameter(String.class, "Global String Parameter", false, DEFAULT_STRING_VAL_SHARED);
- m_stringGlobalParamInstance3 = m_persistentSettingsManager3.getNewParameter(String.class, "Global String Parameter", false, DEFAULT_STRING_VAL_SHARED);
+ m_stringParamInstance1 = m_persistentSettingsManager1.getNewParameter(String.class,
+ "Per-instance String Parameter", true, DEFAULT_STRING_VAL_INSTANCE1);
+ m_stringParamInstance2 = m_persistentSettingsManager2.getNewParameter(String.class,
+ "Per-instance String Parameter", true, DEFAULT_STRING_VAL_INSTANCE2);
+ m_stringParamInstance3 = m_persistentSettingsManager3.getNewParameter(String.class,
+ "Per-instance String Parameter", true, DEFAULT_STRING_VAL_INSTANCE3);
+
+ // This is to simulate a persistent parameter, being "shared" by 3 instances (e.g. views). So, the 3 instances are persisted as a single parameter.
+ m_stringGlobalParamInstance1 = m_persistentSettingsManager1.getNewParameter(String.class,
+ "Global String Parameter", false, DEFAULT_STRING_VAL_SHARED);
+ m_stringGlobalParamInstance2 = m_persistentSettingsManager2.getNewParameter(String.class,
+ "Global String Parameter", false, DEFAULT_STRING_VAL_SHARED);
+ m_stringGlobalParamInstance3 = m_persistentSettingsManager3.getNewParameter(String.class,
+ "Global String Parameter", false, DEFAULT_STRING_VAL_SHARED);
}
-
+
// testcases
-
+
/** Test Un-supported base type - we expect an Exception */
@Test(expected = Exception.class)
public void testUnsupportedBaseType() throws Exception {
m_persistentSettingsManager1.getNewParameter(Float.class, "Float Parameter", false, 1.0f);
}
-
+
/** Test Un-supported List type - we expect an Exception */
@Test(expected = Exception.class)
public void testUnsupportedListType() throws Exception {
- m_persistentSettingsManager1.getNewListParameter(Float.class, "List of Float Parameter", false, new ArrayList<Float>());
+ m_persistentSettingsManager1.getNewListParameter(Float.class, "List of Float Parameter", false,
+ new ArrayList<Float>());
}
-
+
/** Test Un-supported Map type - we expect an Exception */
@Test(expected = Exception.class)
public void testUnsupportedMapType() throws Exception {
- m_persistentSettingsManager1.getNewMapParameter(Float.class, "Map of Float Parameter", false, new HashMap<String,Float>());
+ m_persistentSettingsManager1.getNewMapParameter(Float.class, "Map of Float Parameter", false,
+ new HashMap<String, Float>());
}
-
+
/** Test persisting one String value */
@Test
public void testPersistentParamString() throws Exception {
- // no value persisted yet - should return default
+ // no value persisted yet - should return default
assertEquals(DEFAULT_STRING, m_stringParam.value());
-
+
// set a value
String randomString = getRandomString();
m_stringParam.set(randomString);
@@ -143,7 +158,7 @@ public class PersistentSettingsManagerTest {
assertEquals(randomString, m_stringParam.value());
// force re-read from storage
assertEquals(randomString, m_stringParam.value(true));
-
+
// set a different value
randomString = getRandomString();
m_stringParam.set(randomString);
@@ -152,13 +167,13 @@ public class PersistentSettingsManagerTest {
// force re-read from storage
assertEquals(randomString, m_stringParam.value(true));
}
-
+
/** Test persisting one Boolean value */
@Test
public void testPersistentParamBoolean() throws Exception {
- // no value persisted yet - should return default
+ // no value persisted yet - should return default
assertEquals(DEFAULT_BOOLEAN, m_booleanParam.value());
-
+
// set a value
m_booleanParam.set(!DEFAULT_BOOLEAN);
// get cached value
@@ -166,11 +181,11 @@ public class PersistentSettingsManagerTest {
// force re-read from storage
assertEquals(!DEFAULT_BOOLEAN, m_booleanParam.value(true));
}
-
+
/** Test persisting one Integer value */
@Test
public void testPersistentParamInteger() throws Exception {
- // no value persisted yet - should return default
+ // no value persisted yet - should return default
assertEquals(DEFAULT_INTEGER, m_integerParam.value());
// set a value
@@ -189,176 +204,175 @@ public class PersistentSettingsManagerTest {
// force re-read from storage
assertEquals(randomInt, m_integerParam.value(true));
}
-
+
/** Test persisting a List of String */
@Test
public void testPersistentParamListOfString() throws Exception {
// no value persisted yet - should return default (empty list)
List<String> list = m_listOfStringParam.value();
- assertEquals(0,list.size());
+ assertEquals(0, list.size());
// generate list of random elements
- for(int i = 0; i < NUM_LIST_ELEMENTS; i++) {
+ for (int i = 0; i < NUM_LIST_ELEMENTS; i++) {
list.add(getRandomString());
}
m_listOfStringParam.set(list);
-
+
// get cached value
List<String> list2 = m_listOfStringParam.value();
- for(int i = 0; i < NUM_LIST_ELEMENTS; i++) {
+ for (int i = 0; i < NUM_LIST_ELEMENTS; i++) {
assertEquals(list.get(i), list2.get(i));
}
// force re-read from storage
list2 = m_listOfStringParam.value(true);
- for(int i = 0; i < NUM_LIST_ELEMENTS; i++) {
+ for (int i = 0; i < NUM_LIST_ELEMENTS; i++) {
assertEquals(list.get(i), list2.get(i));
}
}
-
+
/** Test persisting a List of Boolean */
@Test
public void testPersistentParamListOfBoolean() throws Exception {
// no value persisted yet - should return default (empty list)
List<Boolean> list = m_listOfBooleanParam.value();
- assertEquals(0,list.size());
+ assertEquals(0, list.size());
// generate list of random elements
- for(int i = 0; i < NUM_LIST_ELEMENTS; i++) {
+ for (int i = 0; i < NUM_LIST_ELEMENTS; i++) {
list.add(getRandomBoolean());
}
m_listOfBooleanParam.set(list);
-
+
// get cached value
List<Boolean> list2 = m_listOfBooleanParam.value();
- for(int i = 0; i < NUM_LIST_ELEMENTS; i++) {
+ for (int i = 0; i < NUM_LIST_ELEMENTS; i++) {
assertEquals(list.get(i), list2.get(i));
}
// force re-read from storage
list2 = m_listOfBooleanParam.value(true);
- for(int i = 0; i < NUM_LIST_ELEMENTS; i++) {
+ for (int i = 0; i < NUM_LIST_ELEMENTS; i++) {
assertEquals(list.get(i), list2.get(i));
}
}
-
+
/** Test persisting a List of Integer */
@Test
public void testPersistentParamListofInteger() throws Exception {
// no value persisted yet - should return default (empty list)
List<Integer> list = m_listOfIntegerParam.value();
- assertEquals(0,list.size());
+ assertEquals(0, list.size());
// generate list of random elements
- for(int i = 0; i < NUM_LIST_ELEMENTS; i++) {
+ for (int i = 0; i < NUM_LIST_ELEMENTS; i++) {
list.add(getRandomInt());
}
m_listOfIntegerParam.set(list);
-
+
List<Integer> list2;
// get cached value
list2 = m_listOfIntegerParam.value();
- for(int i = 0; i < NUM_LIST_ELEMENTS; i++) {
+ for (int i = 0; i < NUM_LIST_ELEMENTS; i++) {
assertEquals(list.get(i), list2.get(i));
}
// force re-read from storage
list2 = m_listOfIntegerParam.value(true);
- for(int i = 0; i < NUM_LIST_ELEMENTS; i++) {
+ for (int i = 0; i < NUM_LIST_ELEMENTS; i++) {
assertEquals(list.get(i), list2.get(i));
}
}
-
-
+
/** Test persisting a Map of String */
@Test
public void testPersistentParamMapOfString() throws Exception {
// no value persisted yet - should return default (empty Map)
- Map<String,String> map = m_mapOfStringParam.value();
- assertEquals(0,map.size());
-
+ Map<String, String> map = m_mapOfStringParam.value();
+ assertEquals(0, map.size());
+
// generate random elements
- for(int i = 0; i < NUM_LIST_ELEMENTS; i++) {
+ for (int i = 0; i < NUM_LIST_ELEMENTS; i++) {
map.put(getRandomString(), getRandomString());
}
m_mapOfStringParam.set(map);
-
+
// get cached value
- Map<String,String> map2 = m_mapOfStringParam.value();
+ Map<String, String> map2 = m_mapOfStringParam.value();
assertEquals(map.size(), map2.size());
- for(String key : map2.keySet()) {
+ for (String key : map2.keySet()) {
assertEquals(map2.get(key), map.get(key));
}
-
+
// force re-read from storage
map2 = m_mapOfStringParam.value(true);
assertEquals(map.size(), map2.size());
- for(String key : map2.keySet()) {
+ for (String key : map2.keySet()) {
assertEquals(map2.get(key), map.get(key));
}
}
-
+
/** Test persisting a Map of Boolean*/
@Test
public void testPersistentParamMapOfBoolean() throws Exception {
// no value persisted yet - should return default (empty Map)
- Map<String,Boolean> map = m_mapOfBooleanParam.value();
- assertEquals(0,map.size());
-
+ Map<String, Boolean> map = m_mapOfBooleanParam.value();
+ assertEquals(0, map.size());
+
// generate random elements
- for(int i = 0; i < NUM_LIST_ELEMENTS; i++) {
+ for (int i = 0; i < NUM_LIST_ELEMENTS; i++) {
map.put(getRandomString(), getRandomBoolean());
}
m_mapOfBooleanParam.set(map);
-
+
// get cached value
- Map<String,Boolean> map2 = m_mapOfBooleanParam.value();
+ Map<String, Boolean> map2 = m_mapOfBooleanParam.value();
assertEquals(map.size(), map2.size());
- for(String key : map2.keySet()) {
+ for (String key : map2.keySet()) {
assertEquals(map2.get(key), map.get(key));
}
-
+
// force re-read from storage
map2 = m_mapOfBooleanParam.value(true);
assertEquals(map.size(), map2.size());
- for(String key : map2.keySet()) {
+ for (String key : map2.keySet()) {
assertEquals(map2.get(key), map.get(key));
}
}
-
+
/** Test persisting a List of Integer */
@Test
public void testPersistentParamMapOfInteger() throws Exception {
// no value persisted yet - should return default (empty Map)
- Map<String,Integer> map = m_mapOfIntegerParam.value();
- assertEquals(0,map.size());
-
+ Map<String, Integer> map = m_mapOfIntegerParam.value();
+ assertEquals(0, map.size());
+
// generate random elements
- for(int i = 0; i < NUM_LIST_ELEMENTS; i++) {
+ for (int i = 0; i < NUM_LIST_ELEMENTS; i++) {
map.put(getRandomString(), getRandomInt());
}
m_mapOfIntegerParam.set(map);
-
+
// get cached value
- Map<String,Integer> map2 = m_mapOfIntegerParam.value();
+ Map<String, Integer> map2 = m_mapOfIntegerParam.value();
assertEquals(map.size(), map2.size());
- for(String key : map2.keySet()) {
+ for (String key : map2.keySet()) {
assertEquals(map2.get(key), map.get(key));
}
-
+
// force re-read from storage
map2 = m_mapOfIntegerParam.value(true);
assertEquals(map.size(), map2.size());
- for(String key : map2.keySet()) {
+ for (String key : map2.keySet()) {
assertEquals(map2.get(key), map.get(key));
}
}
-
+
/** This test simulates 3 different instances (e.g. views) writing and reading the same persistent
- * parameter. In this case the parameter is defined as "per-instance" (vs "global"), so each
+ * parameter. In this case the parameter is defined as "per-instance" (vs "global"), so each
* instance has it's own independent copy of the persistent parameter. */
@Test
public void testMultipleInstances() throws Exception {
- // no values persisted yet - should return defaults
+ // no values persisted yet - should return defaults
assertEquals(DEFAULT_STRING_VAL_INSTANCE1, m_stringParamInstance1.value());
assertEquals(DEFAULT_STRING_VAL_INSTANCE2, m_stringParamInstance2.value());
assertEquals(DEFAULT_STRING_VAL_INSTANCE3, m_stringParamInstance3.value());
-
- // set values - since the parameters were defined to save values per-instance, they should be
+
+ // set values - since the parameters were defined to save values per-instance, they should be
// persisted independently (i.e. not overwrite each other)
String randomString1 = getRandomString();
String randomString2 = getRandomString();
@@ -369,7 +383,7 @@ public class PersistentSettingsManagerTest {
assertEquals(randomString1, m_stringParamInstance1.value(true));
assertEquals(randomString2, m_stringParamInstance2.value(true));
assertEquals(randomString3, m_stringParamInstance3.value(true));
-
+
// set different values
randomString1 = getRandomString();
randomString2 = getRandomString();
@@ -381,19 +395,18 @@ public class PersistentSettingsManagerTest {
assertEquals(randomString2, m_stringParamInstance2.value(true));
assertEquals(randomString3, m_stringParamInstance3.value(true));
}
-
-
+
/** This test simulates 3 different instances (e.g. views) writing and reading the same persistent
* parameter. In this case the parameter is defined as "global" (vs "per-instance"), so only one
* copy is shared between the instances. */
@Test
public void testGlobalParamsWithMultipleInstances() throws Exception {
- // no values persisted yet - should return defaults
+ // no values persisted yet - should return defaults
assertEquals(DEFAULT_STRING_VAL_SHARED, m_stringGlobalParamInstance1.value());
assertEquals(DEFAULT_STRING_VAL_SHARED, m_stringGlobalParamInstance2.value());
assertEquals(DEFAULT_STRING_VAL_SHARED, m_stringGlobalParamInstance3.value());
-
- // set values - since the parameters were defined to save values per-instance, they should be
+
+ // set values - since the parameters were defined to save values per-instance, they should be
// persisted independently
String randomString1 = getRandomString();
String randomString2 = getRandomString();
@@ -406,7 +419,7 @@ public class PersistentSettingsManagerTest {
assertEquals(randomString3, m_stringGlobalParamInstance1.value(true));
assertEquals(randomString3, m_stringGlobalParamInstance2.value(true));
assertEquals(randomString3, m_stringGlobalParamInstance3.value(true));
-
+
// set different values
randomString1 = getRandomString();
randomString2 = getRandomString();
@@ -420,20 +433,19 @@ public class PersistentSettingsManagerTest {
assertEquals(randomString3, m_stringGlobalParamInstance2.value(true));
assertEquals(randomString3, m_stringGlobalParamInstance3.value(true));
}
-
+
// utility methods
-
+
private int getRandomInt() {
return m_random.nextInt();
}
-
+
private String getRandomString() {
return Integer.toString(getRandomInt(), 16) + Integer.toString(getRandomInt(), 16);
}
-
+
private boolean getRandomBoolean() {
return getRandomInt() % 2 == 0;
}
}
-
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui.tests/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/ui/test/VisualizerVirtualBoundsGraphicObjectTest.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui.tests/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/ui/test/VisualizerVirtualBoundsGraphicObjectTest.java
index a22270ea9f8..be0cb0beb59 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui.tests/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/ui/test/VisualizerVirtualBoundsGraphicObjectTest.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui.tests/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/ui/test/VisualizerVirtualBoundsGraphicObjectTest.java
@@ -12,19 +12,17 @@
* Contributors:
* Marc Dumais (Ericsson) - Initial API and implementation
* Marc Khouzam (Ericsson) - Move to o.e.cdt.dsf.gdb.tests (bug 455237)
- * Marc Dumais (Ericsson) - Move VisualizerVirtualBoundsGraphicObjectTest
+ * Marc Dumais (Ericsson) - Move VisualizerVirtualBoundsGraphicObjectTest
* to o.e.cdt.dsf.gdb.multicoreVisualizer.ui.tests
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui.test;
-
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.cdt.visualizer.ui.canvas.VirtualBoundsGraphicObject;
import org.junit.Test;
public class VisualizerVirtualBoundsGraphicObjectTest {
-
// testcases
/**
@@ -114,7 +112,6 @@ public class VisualizerVirtualBoundsGraphicObjectTest {
org.junit.Assert.assertEquals(10, containerF.getBounds().width);
org.junit.Assert.assertEquals(10, containerF.getBounds().height);
-
// check recursive object retrieval returns expected number of child objects, for A
org.junit.Assert.assertEquals(5, containerA.getAllObjects(true).size());
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/MulticoreVisualizerUIPlugin.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/MulticoreVisualizerUIPlugin.java
index 8a1b05da3da..a40f25be55c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/MulticoreVisualizerUIPlugin.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/MulticoreVisualizerUIPlugin.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Marc Khouzam (Ericsson) - initial API and implementation
* William R. Swanson (Tilera Corporation) - added resource support
@@ -35,25 +35,23 @@ import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
*/
-public class MulticoreVisualizerUIPlugin extends AbstractUIPlugin
-{
+public class MulticoreVisualizerUIPlugin extends AbstractUIPlugin {
// --- constants ---
-
+
// The plug-in ID
public static final String PLUGIN_ID = "org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui"; //$NON-NLS-1$
-
// --- static members ---
/** Singleton instance */
private static MulticoreVisualizerUIPlugin plugin;
/** Bundle context */
- private static BundleContext fgBundleContext;
+ private static BundleContext fgBundleContext;
/** Resource manager */
protected static UIResourceManager s_resources = null;
-
+
/**
* Returns the shared instance
*/
@@ -64,20 +62,18 @@ public class MulticoreVisualizerUIPlugin extends AbstractUIPlugin
/**
* Returns the bundle context for this plugin.
*/
- public static BundleContext getBundleContext() {
- return fgBundleContext;
- }
+ public static BundleContext getBundleContext() {
+ return fgBundleContext;
+ }
-
// --- constructors/destructors ---
-
+
/**
* The constructor
*/
public MulticoreVisualizerUIPlugin() {
}
-
// --- plugin startup/shutdown methods ---
/*
@@ -85,11 +81,11 @@ public class MulticoreVisualizerUIPlugin extends AbstractUIPlugin
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
@Override
- public void start(BundleContext context) throws Exception {
- fgBundleContext = context;
+ public void start(BundleContext context) throws Exception {
+ fgBundleContext = context;
super.start(context);
plugin = this;
-
+
// initialize resource management (strings, images, fonts, colors, etc.)
getPluginResources();
}
@@ -99,30 +95,30 @@ public class MulticoreVisualizerUIPlugin extends AbstractUIPlugin
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
@Override
- public void stop(BundleContext context) throws Exception {
+ public void stop(BundleContext context) throws Exception {
// clean up resource management
cleanupPluginResources();
-
+
plugin = null;
super.stop(context);
- fgBundleContext = null;
+ fgBundleContext = null;
}
-
// --- logging ---
-
+
/**
* Logs the specified status with this plug-in's log.
- *
+ *
* @param status
* status to log
*/
public static void log(IStatus status) {
getDefault().getLog().log(status);
}
+
/**
* Logs an internal error with the specified message.
- *
+ *
* @param message
* the error message to log
*/
@@ -132,7 +128,7 @@ public class MulticoreVisualizerUIPlugin extends AbstractUIPlugin
/**
* Logs an internal error with the specified throwable
- *
+ *
* @param e
* the exception to be logged
*/
@@ -140,7 +136,6 @@ public class MulticoreVisualizerUIPlugin extends AbstractUIPlugin
log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR, e.getMessage(), e));
}
-
// --- accessors ---
/**
@@ -156,12 +151,11 @@ public class MulticoreVisualizerUIPlugin extends AbstractUIPlugin
return getDefault().getBundle().getSymbolicName();
}
-
// --- UI plugin support ---
-
- /**
- * copied from org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin
- */
+
+ /**
+ * copied from org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin
+ */
private static Shell debugDialogShell;
/**
@@ -183,10 +177,10 @@ public class MulticoreVisualizerUIPlugin extends AbstractUIPlugin
public static void setDialogShell(Shell shell) {
debugDialogShell = shell;
}
-
+
/**
* Returns the active workbench window
- *
+ *
* @return the active workbench window
*/
public static IWorkbenchWindow getActiveWorkbenchWindow() {
@@ -203,7 +197,7 @@ public class MulticoreVisualizerUIPlugin extends AbstractUIPlugin
/**
* Returns the active workbench shell or <code>null</code> if none
- *
+ *
* @return the active workbench shell or <code>null</code> if none
*/
public static Shell getActiveWorkbenchShell() {
@@ -238,7 +232,7 @@ public class MulticoreVisualizerUIPlugin extends AbstractUIPlugin
}
// --- resource management ---
-
+
/** Returns resource manager for this plugin */
public UIResourceManager getPluginResources() {
if (s_resources == null) {
@@ -249,47 +243,51 @@ public class MulticoreVisualizerUIPlugin extends AbstractUIPlugin
resourceManager.setParentManager(CDTVisualizerUIPlugin.getResources());
s_resources = resourceManager;
}
-
+
return s_resources;
}
-
+
/** Releases resource manager for this plugin. */
public void cleanupPluginResources() {
- if (s_resources != null) s_resources.dispose();
+ if (s_resources != null)
+ s_resources.dispose();
}
-
+
/** Convenience method for getting plugin resource manager */
public static UIResourceManager getResources() {
return getDefault().getPluginResources();
}
-
+
/** Convenience method for looking up string resources */
public static String getString(String key) {
return getDefault().getPluginResources().getString(key);
}
+
/** Convenience method for looking up string resources */
public static String getString(String key, Object... arguments) {
return getDefault().getPluginResources().getString(key, arguments);
}
-
+
/** Convenience method for looking up image resources */
public static Image getImage(String key) {
return getDefault().getPluginResources().getImage(key);
}
+
/** Convenience method for looking up image resources */
public static ImageDescriptor getImageDescriptor(String key) {
return getDefault().getPluginResources().getImageDescriptor(key);
}
-
+
/** Convenience method for looking up font resources */
public static Font getFont(String fontName, int height) {
return getDefault().getPluginResources().getFont(fontName, height);
}
+
/** Convenience method for looking up font resources */
public static Font getFont(String fontName, int height, int style) {
return getDefault().getPluginResources().getFont(fontName, height, style);
}
-
+
/** Get the preference store for this Eclipse plug-in */
public static IEclipsePreferences getEclipsePreferenceStore() {
return InstanceScope.INSTANCE.getNode(PLUGIN_ID);
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/EnableLoadMetersAction.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/EnableLoadMetersAction.java
index ce3aecb2929..5640cf6bae4 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/EnableLoadMetersAction.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/EnableLoadMetersAction.java
@@ -25,21 +25,20 @@ public class EnableLoadMetersAction extends VisualizerAction {
/** Visualizer instance we're associated with. */
MulticoreVisualizer m_visualizer = null;
-
+
boolean m_enabled = false;
/** Constructor */
public EnableLoadMetersAction(boolean enable) {
m_enabled = enable;
setText(getTextToDisplay());
- setDescription(MulticoreVisualizerUIPlugin.getString(
- "MulticoreVisualizer.actions.EnableLoadMeter.description")); //$NON-NLS-1$
+ setDescription(
+ MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.actions.EnableLoadMeter.description")); //$NON-NLS-1$
}
/** Dispose method. */
@Override
- public void dispose()
- {
+ public void dispose() {
m_visualizer = null;
super.dispose();
}
@@ -47,22 +46,17 @@ public class EnableLoadMetersAction extends VisualizerAction {
// --- init methods ---
/** Initializes this action for the specified view. */
- public void init(MulticoreVisualizer visualizer)
- {
+ public void init(MulticoreVisualizer visualizer) {
m_visualizer = visualizer;
}
-
// --- methods ---
-
+
private String getTextToDisplay() {
- if(m_enabled) {
- return MulticoreVisualizerUIPlugin.getString(
- "MulticoreVisualizer.actions.EnableLoadMeter.Disable.text"); //$NON-NLS-1$
- }
- else {
- return MulticoreVisualizerUIPlugin.getString(
- "MulticoreVisualizer.actions.EnableLoadMeter.Enable.text"); //$NON-NLS-1$
+ if (m_enabled) {
+ return MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.actions.EnableLoadMeter.Disable.text"); //$NON-NLS-1$
+ } else {
+ return MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.actions.EnableLoadMeter.Enable.text"); //$NON-NLS-1$
}
}
@@ -71,10 +65,10 @@ public class EnableLoadMetersAction extends VisualizerAction {
public void run() {
if (m_visualizer != null) {
// toggle enabled state
- m_enabled = !m_enabled;
+ m_enabled = !m_enabled;
m_visualizer.enableLoadMeters(m_enabled);
m_visualizer.refresh();
-
+
setText(getTextToDisplay());
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/FilterCanvasAction.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/FilterCanvasAction.java
index 62a0407dc26..63632b2d87a 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/FilterCanvasAction.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/FilterCanvasAction.java
@@ -23,7 +23,7 @@ public class FilterCanvasAction extends VisualizerAction {
/** Visualizer instance we're associated with. */
MulticoreVisualizer m_visualizer = null;
-
+
/** Does this action enable or disable the filter mechanism? */
boolean m_createFilter = false;
@@ -31,20 +31,18 @@ public class FilterCanvasAction extends VisualizerAction {
* Constructor
* @param create : Controls whether this action will create or clear the filter
*/
- public FilterCanvasAction(boolean create) {
+ public FilterCanvasAction(boolean create) {
m_createFilter = create;
if (m_createFilter) {
setText(MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.actions.SetFilter.text")); //$NON-NLS-1$
- }
- else {
+ } else {
setText(MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.actions.ClearFilter.text")); //$NON-NLS-1$
}
}
/** Dispose method. */
@Override
- public void dispose()
- {
+ public void dispose() {
m_visualizer = null;
super.dispose();
}
@@ -52,12 +50,10 @@ public class FilterCanvasAction extends VisualizerAction {
// --- init methods ---
/** Initializes this action for the specified view. */
- public void init(MulticoreVisualizer visualizer)
- {
+ public void init(MulticoreVisualizer visualizer) {
m_visualizer = visualizer;
}
-
// --- methods ---
/** Invoked when action is triggered. */
@@ -66,8 +62,7 @@ public class FilterCanvasAction extends VisualizerAction {
if (m_visualizer != null) {
if (m_createFilter) {
m_visualizer.applyCanvasFilter();
- }
- else {
+ } else {
m_visualizer.clearCanvasFilter();
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/PinToDebugSessionAction.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/PinToDebugSessionAction.java
index 21670a493d6..b1ed9fadb81 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/PinToDebugSessionAction.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/PinToDebugSessionAction.java
@@ -22,30 +22,28 @@ import org.eclipse.cdt.visualizer.ui.VisualizerAction;
/** Pins the multicore visualizer to the current debug session */
public class PinToDebugSessionAction extends VisualizerAction {
-
+
// --- members ---
-
+
/** current active state of pinning */
private boolean m_pinActive;
-
+
/** Visualizer instance we're associated with. */
MulticoreVisualizer m_visualizer = null;
-
// --- constructors/destructors ---
-
+
/** Constructor. */
public PinToDebugSessionAction() {
- super(MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.actions.PinToDebugSession.text"), //$NON-NLS-1$
- MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.actions.PinToDebugSession.description"), //$NON-NLS-1$
- CDebugImages.DESC_LCL_PIN_VIEW
- );
+ super(MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.actions.PinToDebugSession.text"), //$NON-NLS-1$
+ MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.actions.PinToDebugSession.description"), //$NON-NLS-1$
+ CDebugImages.DESC_LCL_PIN_VIEW);
// at first, this action is disabled (un-pinned)
setChecked(false);
m_pinActive = false;
}
-
+
/** Dispose method. */
@Override
public void dispose() {
@@ -53,15 +51,13 @@ public class PinToDebugSessionAction extends VisualizerAction {
super.dispose();
}
-
// --- init methods ---
-
+
/** Initializes this action for the specified view. */
- public void init(MulticoreVisualizer visualizer)
- {
+ public void init(MulticoreVisualizer visualizer) {
m_visualizer = visualizer;
}
-
+
// --- methods ---
/** Invoked when action is triggered. */
@@ -72,8 +68,7 @@ public class PinToDebugSessionAction extends VisualizerAction {
if (m_pinActive) {
m_visualizer.pin();
- }
- else {
+ } else {
m_visualizer.unpin();
}
// update the toolbar
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/RefreshAction.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/RefreshAction.java
index 1710f3da788..c9f51492e69 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/RefreshAction.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/RefreshAction.java
@@ -20,46 +20,37 @@ import org.eclipse.cdt.visualizer.ui.VisualizerAction;
import org.eclipse.swt.SWT;
/** Action that refreshes the Visualizer canvas. */
-public class RefreshAction extends VisualizerAction
-{
+public class RefreshAction extends VisualizerAction {
// --- members ---
-
+
/** Visualizer instance we're associated with. */
MulticoreVisualizer m_visualizer = null;
-
-
+
// --- constructors/destructors ---
/** Constructor. */
- public RefreshAction()
- {
- setText(MulticoreVisualizerUIPlugin.getString(
- "MulticoreVisualizer.actions.Refresh.text")); //$NON-NLS-1$
- setDescription(MulticoreVisualizerUIPlugin.getString(
- "MulticoreVisualizer.actions.Refresh.description")); //$NON-NLS-1$
+ public RefreshAction() {
+ setText(MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.actions.Refresh.text")); //$NON-NLS-1$
+ setDescription(MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.actions.Refresh.description")); //$NON-NLS-1$
setAccelerator(SWT.F5);
}
-
+
/** Dispose method. */
@Override
- public void dispose()
- {
+ public void dispose() {
m_visualizer = null;
super.dispose();
}
-
-
+
// --- init methods ---
-
+
/** Initializes this action for the specified view. */
- public void init(MulticoreVisualizer visualizer)
- {
+ public void init(MulticoreVisualizer visualizer) {
m_visualizer = visualizer;
}
-
-
+
// --- methods ---
-
+
/** Invoked when action is triggered. */
@Override
public void run() {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/SelectAllAction.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/SelectAllAction.java
index 88e28ba4c77..9f2b640c051 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/SelectAllAction.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/SelectAllAction.java
@@ -20,46 +20,37 @@ import org.eclipse.cdt.visualizer.ui.VisualizerAction;
import org.eclipse.swt.SWT;
/** Select All action for Visualizer context menu. */
-public class SelectAllAction extends VisualizerAction
-{
+public class SelectAllAction extends VisualizerAction {
// --- members ---
-
+
/** Visualizer instance we're associated with. */
MulticoreVisualizer m_visualizer = null;
-
-
+
// --- constructors/destructors ---
/** Constructor. */
- public SelectAllAction()
- {
- setText(MulticoreVisualizerUIPlugin.getString(
- "MulticoreVisualizer.actions.SelectAll.text")); //$NON-NLS-1$
- setDescription(MulticoreVisualizerUIPlugin.getString(
- "MulticoreVisualizer.actions.SelectAll.description")); //$NON-NLS-1$
+ public SelectAllAction() {
+ setText(MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.actions.SelectAll.text")); //$NON-NLS-1$
+ setDescription(MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.actions.SelectAll.description")); //$NON-NLS-1$
setAccelerator(SWT.CTRL + 'A');
}
-
+
/** Dispose method. */
@Override
- public void dispose()
- {
+ public void dispose() {
m_visualizer = null;
super.dispose();
}
-
-
+
// --- init methods ---
-
+
/** Initializes this action for the specified view. */
- public void init(MulticoreVisualizer visualizer)
- {
+ public void init(MulticoreVisualizer visualizer) {
m_visualizer = visualizer;
}
-
-
+
// --- methods ---
-
+
/** Invoked when action is triggered. */
@Override
public void run() {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/SetLoadMeterPeriodAction.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/SetLoadMeterPeriodAction.java
index e1fe94f5d3a..5620f94636c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/SetLoadMeterPeriodAction.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/SetLoadMeterPeriodAction.java
@@ -23,7 +23,6 @@ import org.eclipse.cdt.visualizer.ui.VisualizerAction;
*/
public class SetLoadMeterPeriodAction extends VisualizerAction {
-
/** Visualizer instance we're associated with. */
MulticoreVisualizer m_visualizer = null;
@@ -32,15 +31,14 @@ public class SetLoadMeterPeriodAction extends VisualizerAction {
public SetLoadMeterPeriodAction(String label, int period) {
super(label, AS_RADIO_BUTTON);
m_period = period;
-
- setDescription(MulticoreVisualizerUIPlugin.getString(
- "MulticoreVisualizer.actions.SetLoadMeterPeriod.description")); //$NON-NLS-1$
+
+ setDescription(
+ MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.actions.SetLoadMeterPeriod.description")); //$NON-NLS-1$
}
/** Dispose method. */
@Override
- public void dispose()
- {
+ public void dispose() {
m_visualizer = null;
super.dispose();
}
@@ -48,16 +46,16 @@ public class SetLoadMeterPeriodAction extends VisualizerAction {
// --- init methods ---
/** Initializes this action for the specified view. */
- public void init(MulticoreVisualizer visualizer)
- {
+ public void init(MulticoreVisualizer visualizer) {
m_visualizer = visualizer;
}
/** Invoked when action is triggered. */
@Override
public void run() {
- if (!isChecked()) return;
-
+ if (!isChecked())
+ return;
+
if (m_visualizer != null) {
m_visualizer.setLoadMeterTimerPeriod(m_period);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/ShowDebugToolbarAction.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/ShowDebugToolbarAction.java
index fac7a23d6f0..203aed33718 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/ShowDebugToolbarAction.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/ShowDebugToolbarAction.java
@@ -27,10 +27,10 @@ public class ShowDebugToolbarAction extends VisualizerAction {
/** Visualizer instance we're associated with. */
private MulticoreVisualizer m_visualizer;
-
+
/** persistent settings manager */
private PersistentSettingsManager m_persistentSettingsManager;
-
+
/** Persistent parameter that remembers if the debug actions should be shown or not */
private PersistentParameter<Boolean> m_showDebugActions;
@@ -40,37 +40,34 @@ public class ShowDebugToolbarAction extends VisualizerAction {
* @param showDebugActions : show the debug actions by default
* @param MVInstanceId : id that uniquely identifies a Multicore Visualizer instance
*/
- public ShowDebugToolbarAction(boolean showDebugActions, String MVInstanceId)
- {
- super(MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.actions.ShowDebugToolbar.text"), Action.AS_CHECK_BOX); //$NON-NLS-1$
- setDescription(MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.actions.ShowDebugToolbar.description")); //$NON-NLS-1$
-
+ public ShowDebugToolbarAction(boolean showDebugActions, String MVInstanceId) {
+ super(MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.actions.ShowDebugToolbar.text"), //$NON-NLS-1$
+ Action.AS_CHECK_BOX);
+ setDescription(
+ MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.actions.ShowDebugToolbar.description")); //$NON-NLS-1$
+
m_persistentSettingsManager = new PersistentSettingsManager("ShowDebugToolbarAction", MVInstanceId); //$NON-NLS-1$
- m_showDebugActions = m_persistentSettingsManager.getNewParameter(Boolean.class,
- "showDebugActionsInMVToolbar", true, showDebugActions); //$NON-NLS-1$
-
+ m_showDebugActions = m_persistentSettingsManager.getNewParameter(Boolean.class, "showDebugActionsInMVToolbar", //$NON-NLS-1$
+ true, showDebugActions);
+
// Set initial state
this.setChecked(m_showDebugActions.value());
}
/** Dispose method. */
@Override
- public void dispose()
- {
+ public void dispose() {
m_visualizer = null;
super.dispose();
}
-
// --- init methods ---
/** Initializes this action for the specified view. */
- public void init(MulticoreVisualizer visualizer)
- {
+ public void init(MulticoreVisualizer visualizer) {
m_visualizer = visualizer;
}
-
// --- methods ---
/** Invoked when action is triggered. */
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/IVisualizerModelObject.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/IVisualizerModelObject.java
index 96a10b36b57..3005fcbbfbf 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/IVisualizerModelObject.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/IVisualizerModelObject.java
@@ -17,12 +17,12 @@ package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.model;
* Common interface for visualizer model objects
*/
public interface IVisualizerModelObject {
- /** Get the ID of this model object */
+ /** Get the ID of this model object */
public int getID();
-
+
/** Get the parent of this model object*/
- public IVisualizerModelObject getParent();
-
+ public IVisualizerModelObject getParent();
+
/** Compare two IVisualizerModelObject */
public int compareTo(IVisualizerModelObject o);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerCPU.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerCPU.java
index bceb1ce4641..518868a6d43 100755
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerCPU.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerCPU.java
@@ -26,33 +26,30 @@ import java.util.List;
//----------------------------------------------------------------------------
/** Represents single CPU. */
-public class VisualizerCPU
- implements Comparable<VisualizerCPU>, IVisualizerModelObject
-{
+public class VisualizerCPU implements Comparable<VisualizerCPU>, IVisualizerModelObject {
// --- members ---
-
+
/** ID of this core. */
public int m_id;
-
+
/** Load object associated to this cpu */
protected VisualizerLoadInfo m_loadinfo;
-
+
/** List of cores */
protected ArrayList<VisualizerCore> m_cores;
-
+
/** Lookup table for cores. */
protected Hashtable<Integer, VisualizerCore> m_coreMap;
-
-
+
// --- constructors/destructors ---
-
+
/** Constructor */
public VisualizerCPU(int id) {
m_id = id;
m_cores = new ArrayList<VisualizerCore>();
m_coreMap = new Hashtable<Integer, VisualizerCore>();
}
-
+
/** Dispose method */
public void dispose() {
if (m_cores != null) {
@@ -66,63 +63,61 @@ public class VisualizerCPU
m_loadinfo = null;
}
}
-
-
+
// --- Object methods ---
-
+
/** Returns string representation. */
@Override
public String toString() {
return "CPU:" + m_id; //$NON-NLS-1$
}
-
-
+
// --- accessors ---
-
+
/** Gets ID of this CPU. */
@Override
public int getID() {
return m_id;
}
-
+
/** CPU has no parent - always returns null */
@Override
public IVisualizerModelObject getParent() {
return null;
}
-
+
/** Sets the load object associated to this CPU */
- public synchronized void setLoadInfo (VisualizerLoadInfo info) {
+ public synchronized void setLoadInfo(VisualizerLoadInfo info) {
m_loadinfo = info;
}
-
+
/** Gets the load value associated to this CPU */
public synchronized Integer getLoad() {
return (m_loadinfo == null) ? null : m_loadinfo.getLoad();
}
-
+
/** get the highest recorded load value for this CPU*/
public synchronized Integer getHighLoadWatermark() {
return (m_loadinfo == null) ? null : m_loadinfo.getHighLoadWaterMark();
}
-
+
// --- methods ---
-
+
/** Gets number of cores. */
public int getCoreCount() {
return m_cores.size();
}
-
+
/** Gets cores. */
public List<VisualizerCore> getCores() {
return m_cores;
}
-
+
/** Gets core with specified ID. */
public VisualizerCore getCore(int id) {
return m_coreMap.get(id);
}
-
+
/** Adds core. */
public VisualizerCore addCore(VisualizerCore core) {
m_cores.add(core);
@@ -136,15 +131,13 @@ public class VisualizerCPU
m_coreMap.remove(core.getID());
}
-
/** Sorts cores, cpus, etc. by IDs. */
public void sort() {
Collections.sort(m_cores);
}
-
// --- Comparable implementation ---
-
+
/** Compares this item to the specified item. */
@Override
public int compareTo(VisualizerCPU o) {
@@ -152,20 +145,19 @@ public class VisualizerCPU
if (o != null) {
if (m_id < o.m_id) {
result = -1;
- }
- else if (m_id > o.m_id) {
+ } else if (m_id > o.m_id) {
result = 1;
}
}
return result;
}
-
+
/** IVisualizerModelObject version of compareTO() */
@Override
public int compareTo(IVisualizerModelObject o) {
if (o != null) {
if (o.getClass() == this.getClass()) {
- return compareTo((VisualizerCPU)o);
+ return compareTo((VisualizerCPU) o);
}
}
return 1;
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerCore.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerCore.java
index 3729872ba13..a805a771649 100755
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerCore.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerCore.java
@@ -16,47 +16,42 @@
package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.model;
-
/** Represents single core of a CPU. */
-public class VisualizerCore
- implements Comparable<VisualizerCore>, IVisualizerModelObject
-{
+public class VisualizerCore implements Comparable<VisualizerCore>, IVisualizerModelObject {
// --- members ---
-
+
/** CPU this core is part of. */
public VisualizerCPU m_cpu = null;
-
+
/** Linux CPU ID of this core. */
public int m_id = 0;
-
+
/** Load information associated to this core */
protected VisualizerLoadInfo m_loadinfo;
-
+
// --- constructors/destructors ---
-
+
/** Constructor */
public VisualizerCore(VisualizerCPU cpu, int id) {
m_cpu = cpu;
m_id = id;
}
-
+
/** Dispose method */
public void dispose() {
m_loadinfo = null;
}
-
-
+
// --- Object methods ---
-
+
/** Returns string representation. */
@Override
public String toString() {
return m_cpu + ",Core:" + m_id; //$NON-NLS-1$
}
-
// --- accessors ---
-
+
/** Gets CPU this core is part of. */
public VisualizerCPU getCPU() {
return m_cpu;
@@ -67,35 +62,32 @@ public class VisualizerCore
public int getID() {
return m_id;
}
-
+
/** Return CPU this core is on. */
@Override
public IVisualizerModelObject getParent() {
return getCPU();
}
-
+
/** Sets the load object associated to this core */
- public synchronized void setLoadInfo (VisualizerLoadInfo info) {
+ public synchronized void setLoadInfo(VisualizerLoadInfo info) {
m_loadinfo = info;
}
-
+
/** Gets the load value of this core */
public synchronized Integer getLoad() {
return (m_loadinfo == null) ? null : m_loadinfo.getLoad();
}
-
+
/** Get the highest recorded load value for this core */
public synchronized Integer getHighLoadWatermark() {
return (m_loadinfo == null) ? null : m_loadinfo.getHighLoadWaterMark();
}
-
// --- methods ---
-
-
-
+
// --- Comparable implementation ---
-
+
/** Compares this item to the specified item. */
@Override
public int compareTo(VisualizerCore o) {
@@ -103,8 +95,7 @@ public class VisualizerCore
if (o != null) {
if (m_id < o.m_id) {
result = -1;
- }
- else if (m_id > o.m_id) {
+ } else if (m_id > o.m_id) {
result = 1;
}
}
@@ -116,10 +107,10 @@ public class VisualizerCore
public int compareTo(IVisualizerModelObject o) {
if (o != null) {
if (o.getClass() == this.getClass()) {
- return compareTo((VisualizerCore)o);
+ return compareTo((VisualizerCore) o);
}
}
return 1;
}
-
+
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerExecutionState.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerExecutionState.java
index 12c65077d84..7032fe99b3e 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerExecutionState.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerExecutionState.java
@@ -17,9 +17,6 @@ package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.model;
/**
* Execution state for the different multicore visualizer objects.
*/
-public enum VisualizerExecutionState {
- RUNNING,
- SUSPENDED,
- CRASHED,
- EXITED
+public enum VisualizerExecutionState {
+ RUNNING, SUSPENDED, CRASHED, EXITED
};
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerLoadInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerLoadInfo.java
index acc062d54f8..2f505c80ff7 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerLoadInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerLoadInfo.java
@@ -13,7 +13,6 @@
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.model;
-
//----------------------------------------------------------------------------
//VisualizerLoadInfo
//----------------------------------------------------------------------------
@@ -24,51 +23,47 @@ package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.model;
public class VisualizerLoadInfo {
// --- members ---
-
+
/** load */
protected Integer m_load = null;
-
+
/** the high load water-mark */
protected Integer m_highLoadWatermark = null;
-
-
+
// --- constructors/destructors ---
-
+
/** constructor */
- public VisualizerLoadInfo (Integer load) {
+ public VisualizerLoadInfo(Integer load) {
m_load = load;
}
-
- public VisualizerLoadInfo (Integer load, Integer highLoadWatermark) {
+
+ public VisualizerLoadInfo(Integer load, Integer highLoadWatermark) {
this(load);
m_highLoadWatermark = highLoadWatermark;
}
-
// --- Object methods ---
/** Returns string representation. */
@Override
public String toString() {
- if(m_highLoadWatermark != null) {
+ if (m_highLoadWatermark != null) {
return "Load:" + m_load + ", high water-mark:" + m_highLoadWatermark; //$NON-NLS-1$ //$NON-NLS-2$
- }
- else {
+ } else {
return "Load:" + m_load + ", high water-mark: not defined"; //$NON-NLS-1$ //$NON-NLS-2$
}
}
-
+
// --- accessors ---
-
+
/** Gets the CPU usage load of this core. */
public Integer getLoad() {
return m_load;
}
-
+
/** get the high load water-mark */
public Integer getHighLoadWaterMark() {
return m_highLoadWatermark;
}
-
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerModel.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerModel.java
index 8f674d1ce45..9543be19a0e 100755
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerModel.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerModel.java
@@ -23,35 +23,34 @@ import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
-/**
- * Class representing the state of the data to display in the MulticoreVisualizer.
+/**
+ * Class representing the state of the data to display in the MulticoreVisualizer.
*/
-public class VisualizerModel
-{
+public class VisualizerModel {
// --- members ---
-
+
/** List of cpus (and cores) */
protected ArrayList<VisualizerCPU> m_cpus;
-
+
/** Lookup table for CPUs */
protected Hashtable<Integer, VisualizerCPU> m_cpuMap;
-
+
/** List of threads */
protected ArrayList<VisualizerThread> m_threads;
-
+
// Setting to remove exited threads, or keep them shown.
// If we are to support this, we should have a preference
// and a way to for the user to clean up old threads,
// or maybe a timeout to remove them.
private boolean m_keepExitedThreads = false;
-
+
protected boolean m_loadMetersEnabled = false;
-
+
/** data source corresponding to this model */
protected String m_sessionId = null;
-
+
// --- constructors/destructors ---
-
+
/** Constructor */
public VisualizerModel(String sessionId) {
m_sessionId = sessionId;
@@ -59,7 +58,7 @@ public class VisualizerModel
m_cpuMap = new Hashtable<Integer, VisualizerCPU>();
m_threads = new ArrayList<VisualizerThread>();
}
-
+
/** Dispose method */
public void dispose() {
if (m_cpus != null) {
@@ -80,75 +79,75 @@ public class VisualizerModel
}
m_sessionId = null;
}
-
-
+
// --- accessors ---
- public void setLoadMetersEnabled (boolean enable) {
+ public void setLoadMetersEnabled(boolean enable) {
m_loadMetersEnabled = enable;
}
-
- public boolean getLoadMetersEnabled () {
+
+ public boolean getLoadMetersEnabled() {
return m_loadMetersEnabled;
}
-
+
/** Gets the unique id for the source this model was build from */
public String getSessionId() {
return m_sessionId;
}
-
+
// --- methods ---
-
+
/** Sorts cores, cpus, etc. by IDs. */
public void sort() {
Collections.sort(m_cpus);
- for (VisualizerCPU cpu : m_cpus) cpu.sort();
+ for (VisualizerCPU cpu : m_cpus)
+ cpu.sort();
Collections.sort(m_threads);
}
-
-
+
// --- core/cpu management ---
-
+
/** Gets number of CPUs. */
public int getCPUCount() {
return m_cpus.size();
}
-
+
/** Gets number of cores. */
public int getCoreCount() {
int count = 0;
-
- for(VisualizerCPU cpu : m_cpus) {
+
+ for (VisualizerCPU cpu : m_cpus) {
count += cpu.getCoreCount();
}
return count;
}
-
+
/** Gets number of threads. */
- public int getThreadCount () {
+ public int getThreadCount() {
return m_threads.size();
}
-
+
/** Gets CPU with specified ID. */
public VisualizerCPU getCPU(int id) {
return m_cpuMap.get(id);
}
-
+
/** Gets Core with specified ID. */
public VisualizerCore getCore(int id) {
VisualizerCore result = null;
- for (VisualizerCPU cpu: m_cpus) {
+ for (VisualizerCPU cpu : m_cpus) {
result = cpu.getCore(id);
- if (result != null) break;
+ if (result != null)
+ break;
}
return result;
}
-
+
/** Gets CPU set. */
public List<VisualizerCPU> getCPUs() {
return m_cpus;
}
-
+
/** Adds CPU. */
public VisualizerCPU addCPU(VisualizerCPU cpu) {
m_cpus.add(cpu);
@@ -162,26 +161,25 @@ public class VisualizerModel
m_cpuMap.remove(cpu.getID());
}
-
/** Gets maximum number of cores per CPU. */
public int getCoresPerCPU() {
int maxCores = 1;
for (VisualizerCPU cpu : m_cpus) {
int cores = cpu.getCoreCount();
- if (cores > maxCores) maxCores = cores;
+ if (cores > maxCores)
+ maxCores = cores;
}
return maxCores;
}
-
-
+
// --- thread management ---
-
+
/** Gets threads. */
public List<VisualizerThread> getThreads() {
return m_threads;
}
- /**
+ /**
* Finds thread(s) by process ID.
* If no threads are found, returns null rather
* than an empty list.
@@ -190,14 +188,15 @@ public class VisualizerModel
List<VisualizerThread> result = null;
for (VisualizerThread thread : m_threads) {
if (thread.getPID() == processId) {
- if (result == null) result = new ArrayList<VisualizerThread>();
+ if (result == null)
+ result = new ArrayList<VisualizerThread>();
result.add(thread);
}
}
return result;
}
- /**
+ /**
* Find a thread by GDB threadId.
* Since thread ids are unique across a GDB session,
* we can uniquely find a thread based on its id.
@@ -224,7 +223,7 @@ public class VisualizerModel
m_threads.remove(thread);
}
- /**
+ /**
* Removes thread by GDB threadId.
*/
public void removeThread(int threadId) {
@@ -237,7 +236,7 @@ public class VisualizerModel
}
}
}
-
+
/**
* Mark the specified thread as having exited.
*/
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerThread.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerThread.java
index 73277829629..dfbd3e6568a 100755
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerThread.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerThread.java
@@ -10,7 +10,7 @@
*
* Contributors:
* William R. Swanson (Tilera Corporation) - initial API and implementation
- * Marc Khouzam (Ericsson) - Added knowledge about execution
+ * Marc Khouzam (Ericsson) - Added knowledge about execution
* state and os/gdb thread ids
* Marc Dumais (Ericsson) - Bug 405390
* Marc Dumais (Ericsson) - Bug 409965
@@ -21,19 +21,16 @@ package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.model;
import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMData;
-
/** Represents single thread. */
-public class VisualizerThread
- implements Comparable<VisualizerThread>, IVisualizerModelObject
-{
+public class VisualizerThread implements Comparable<VisualizerThread>, IVisualizerModelObject {
// --- members ---
-
+
/** Current core this thread is on. */
protected VisualizerCore m_core;
-
+
/** Process ID (pid). */
protected int m_pid;
-
+
/** OS Thread ID (tid). */
protected int m_tid;
@@ -44,9 +41,8 @@ public class VisualizerThread
protected VisualizerExecutionState m_threadState;
/** Location of this Thread, if any, based on his MIFrame */
- protected String m_locInfo;
+ protected String m_locInfo;
-
// --- constructors/destructors ---
/** Constructor. */
@@ -55,7 +51,8 @@ public class VisualizerThread
}
/** Constructor. */
- public VisualizerThread(VisualizerCore core, int pid, int tid, int gdbtid, VisualizerExecutionState state, IFrameDMData frame) {
+ public VisualizerThread(VisualizerCore core, int pid, int tid, int gdbtid, VisualizerExecutionState state,
+ IFrameDMData frame) {
m_core = core;
m_pid = pid;
m_tid = tid;
@@ -63,26 +60,21 @@ public class VisualizerThread
m_threadState = state;
setLocationInfo(frame);
}
-
+
/** Dispose method */
public void dispose() {
m_core = null;
}
-
-
+
// --- Object methods ---
-
+
/** Equality comparison. */
@Override
public boolean equals(Object obj) {
boolean result = false;
if (obj instanceof VisualizerThread) {
VisualizerThread v = (VisualizerThread) obj;
- result = (
- v.m_pid == m_pid &&
- v.m_tid == m_tid &&
- v.m_gdbtid == m_gdbtid
- );
+ result = (v.m_pid == m_pid && v.m_tid == m_tid && v.m_gdbtid == m_gdbtid);
}
return result;
}
@@ -91,24 +83,23 @@ public class VisualizerThread
public int hashCode() {
return m_pid ^ m_tid ^ m_gdbtid;
}
-
+
/** Returns string representation. */
@Override
public String toString() {
StringBuilder output = new StringBuilder();
output.append(m_core).append(",Proc:").append(m_pid) //$NON-NLS-1$
- .append(",Thread:(").append(m_tid).append(",").append(m_gdbtid).append(")"); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
+ .append(",Thread:(").append(m_tid).append(",").append(m_gdbtid).append(")"); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
return output.toString();
}
-
// --- accessors ---
-
+
/** Gets core. */
- public VisualizerCore getCore() {
+ public VisualizerCore getCore() {
return m_core;
}
-
+
public void setCore(VisualizerCore core) {
m_core = core;
}
@@ -116,23 +107,22 @@ public class VisualizerThread
/** Returns true if this is the "process" thread, i.e.
* its PID and OS TID are the same.
*/
- public boolean isProcessThread()
- {
+ public boolean isProcessThread() {
return m_pid == m_tid;
}
-
+
/** Gets process id (pid). */
public int getPID() {
return m_pid;
}
-
+
/** Gets thread id (tid). */
- public int getTID() {
+ public int getTID() {
return m_tid;
}
-
+
/** Sets thread id (tid). */
- public void setTID(int tid) {
+ public void setTID(int tid) {
m_tid = tid;
}
@@ -147,9 +137,9 @@ public class VisualizerThread
public IVisualizerModelObject getParent() {
return getCore();
}
-
+
/** Gets gdb thread id. */
- public int getGDBTID() {
+ public int getGDBTID() {
return m_gdbtid;
}
@@ -157,19 +147,16 @@ public class VisualizerThread
public VisualizerExecutionState getState() {
return m_threadState;
}
-
+
/** Sets thread execution state. */
public void setState(VisualizerExecutionState state) {
m_threadState = state;
}
-
-
+
// --- methods ---
-
-
// --- Comparable implementation ---
-
+
/** Compares this item to the specified item. */
@Override
public int compareTo(VisualizerThread o) {
@@ -177,26 +164,23 @@ public class VisualizerThread
if (o != null) {
if (m_pid < o.m_pid) {
result = -1;
- }
- else if (m_pid > o.m_pid) {
+ } else if (m_pid > o.m_pid) {
result = 1;
- }
- else if (getID() < o.getID()) {
+ } else if (getID() < o.getID()) {
result = -1;
- }
- else if (getID() > o.getID()) {
+ } else if (getID() > o.getID()) {
result = 1;
}
}
return result;
}
-
+
/** IVisualizerModelObject version of compareTo() */
@Override
public int compareTo(IVisualizerModelObject o) {
if (o != null) {
if (o.getClass() == this.getClass()) {
- return compareTo((VisualizerThread)o);
+ return compareTo((VisualizerThread) o);
}
}
return 1;
@@ -206,14 +190,14 @@ public class VisualizerThread
* Sets the location info of this thread
* @param s a string, displayinf location information of this thread.
*/
- public void setLocationInfo(String s) {
- this.m_locInfo = s;
- }
+ public void setLocationInfo(String s) {
+ this.m_locInfo = s;
+ }
/**
* Sets the location info of this thread, based on given
* {@link IFrameDMData}
- *
+ *
* @param dmData
* a {@link IFrameDMData} (can be <code>null</code>)
*/
@@ -223,15 +207,13 @@ public class VisualizerThread
} else {
StringBuilder label = new StringBuilder();
// Add the function name
- if (dmData.getFunction() != null
- && dmData.getFunction().length() != 0) {
+ if (dmData.getFunction() != null && dmData.getFunction().length() != 0) {
label.append(" "); //$NON-NLS-1$
label.append(dmData.getFunction());
label.append("()"); //$NON-NLS-1$
}
- boolean hasFileName = dmData.getFile() != null
- && dmData.getFile().length() != 0;
+ boolean hasFileName = dmData.getFile() != null && dmData.getFile().length() != 0;
// Add full file name
if (hasFileName) {
@@ -247,9 +229,7 @@ public class VisualizerThread
}
// Add module
- if (!hasFileName
- && (dmData.getModule() != null && dmData.getModule()
- .length() != 0)) {
+ if (!hasFileName && (dmData.getModule() != null && dmData.getModule().length() != 0)) {
label.append(" "); //$NON-NLS-1$
label.append(dmData.getModule());
label.append(" "); //$NON-NLS-1$
@@ -265,13 +245,12 @@ public class VisualizerThread
/**
* Gets the location of this thread or <code>null</code> if none.
- *
+ *
* @return a String, or <code>null</code>
* @since 3.0
*/
public String getLocationInfo() {
- if (m_threadState == VisualizerExecutionState.RUNNING
- || m_threadState == VisualizerExecutionState.EXITED) {
+ if (m_threadState == VisualizerExecutionState.RUNNING || m_threadState == VisualizerExecutionState.EXITED) {
return null;
}
return m_locInfo;
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/IMulticoreVisualizerConstants.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/IMulticoreVisualizerConstants.java
index b38c7b5c3b0..cb0109d75de 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/IMulticoreVisualizerConstants.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/IMulticoreVisualizerConstants.java
@@ -18,17 +18,15 @@ package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.view;
import org.eclipse.cdt.visualizer.ui.util.Colors;
import org.eclipse.swt.graphics.Color;
-
/**
* Constants to be used in the Multicore Visualizer.
*/
-public class IMulticoreVisualizerConstants
-{
+public class IMulticoreVisualizerConstants {
// General canvas colors
public static final Color COLOR_SELECTED = Colors.CYAN;
-
+
// Colors for drawing threads
-
+
/** Color to be used to draw a running thread */
public static final Color COLOR_RUNNING_THREAD = Colors.GREEN;
/** Color to be used to draw a suspended thread */
@@ -42,7 +40,7 @@ public class IMulticoreVisualizerConstants
public static final Color COLOR_PROCESS_THREAD = Colors.WHITE;
// Colors for drawing cores
-
+
/** Color to be used to draw a running core */
public static final Color COLOR_RUNNING_CORE_FG = Colors.GREEN;
public static final Color COLOR_RUNNING_CORE_BG = Colors.DARK_GREEN;
@@ -52,14 +50,14 @@ public class IMulticoreVisualizerConstants
/** Color to be used to draw a crashed core */
public static final Color COLOR_CRASHED_CORE_FG = Colors.RED;
public static final Color COLOR_CRASHED_CORE_BG = Colors.DARK_RED;
-
+
// Colors for drawing CPUs
-
+
/** Foreground color for cpu */
public static final Color COLOR_CPU_FG = Colors.GREEN;
/** Background color for cpu */
- public static final Color COLOR_CPU_BG = Colors.getColor(0,64,0);
-
+ public static final Color COLOR_CPU_BG = Colors.getColor(0, 64, 0);
+
// Colors for text
/** Foreground color to be used to draw a the text for a thread */
@@ -68,23 +66,23 @@ public class IMulticoreVisualizerConstants
public static final Color COLOR_THREAD_TEXT_BG = Colors.BLACK;
/** Color to be used to draw a the text for a core */
- public static final Color COLOR_CORE_TEXT_FG = Colors.WHITE;
+ public static final Color COLOR_CORE_TEXT_FG = Colors.WHITE;
public static final Color COLOR_CORE_TEXT_BG = Colors.BLACK;
-
+
/** Color to be used to draw the load text */
public static final Color COLOR_LOAD_TEXT = Colors.GREEN;
-
+
/** Color used to draw text to the status bar */
public static final Color COLOR_STATUS_BAR_TEXT = Colors.GREEN;
-
+
// Colors for load meters
-
+
/** Color used to draw the bar representing load, under normal load */
public static final Color COLOR_LOAD_LOADBAR_NORMAL = Colors.GREEN;
/** Color used to draw the bar representing load, under high load */
public static final Color COLOR_LOAD_LOADBAR_OVERLOAD = Colors.RED;
/** Color used to draw the load meter foreground */
- public static final Color COLOR_LOAD_UNDERBAR_FG = Colors.getColor(0,200,0);
+ public static final Color COLOR_LOAD_UNDERBAR_FG = Colors.getColor(0, 200, 0);
/** Color used to draw the load meter background */
- public static final Color COLOR_LOAD_UNDERBAR_BG_DEFAULT = Colors.getColor(0,64,0);
+ public static final Color COLOR_LOAD_UNDERBAR_BG_DEFAULT = Colors.getColor(0, 64, 0);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/IPinnable.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/IPinnable.java
index c468cd49edf..25adaf8a690 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/IPinnable.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/IPinnable.java
@@ -21,12 +21,12 @@ public interface IPinnable {
* Pins to the current context
*/
public void pin();
-
+
/**
* Unpins
*/
public void unpin();
-
+
/** Returns whether currently pinned */
public boolean isPinned();
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizer.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizer.java
index 8f48f4a6a5f..9376dad9532 100755
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizer.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizer.java
@@ -118,25 +118,25 @@ import org.eclipse.swt.widgets.Composite;
/**
* The Multicore Visualizer is a generic visualizer that displays
* CPUs, cores, threads graphically.
- *
+ *
* This visualizer uses the CDT Visualizer framework.
*/
@SuppressWarnings("restriction")
public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPinnable {
// --- constants ---
-
+
private static final String THE_THREAD_ID_DOES_NOT_CONVERT_TO_AN_INTEGER = "The thread id does not convert to an integer: "; //$NON-NLS-1$
- /** Eclipse ID for this view */
+ /** Eclipse ID for this view */
public static final String ECLIPSE_ID = "org.eclipse.cdt.dsf.gdb.multicorevisualizer.visualizer"; //$NON-NLS-1$
-
+
// --- members ---
-
+
/**
* The data model drawn by this visualizer.
*/
protected VisualizerModel fDataModel;
-
+
/**
* Proxy to the target data needed to build the model
*/
@@ -144,43 +144,42 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
/** Downcast reference to canvas. */
protected MulticoreVisualizerCanvas m_canvas;
-
+
/** DSF debug context session object. */
protected DSFSessionState m_sessionState;
-
+
/** Event listener class for DSF events */
protected MulticoreVisualizerEventListener fEventListener;
-
+
/** Cached reference to Debug View viewer. */
protected TreeModelViewer m_debugViewer = null;
-
+
/** Model changed listener, attached to Debug View. */
protected IModelChangedListener m_modelChangedListener = null;
-
+
/** Debug view selection changed listener, attached to Debug View. */
protected ISelectionChangedListener m_debugViewSelectionChangedListener = null;
-
- /** Unique id that differentiates the possible multiple instances of the MV.
- * It's derived from the secondary view Part id of the view associated to the
+
+ /** Unique id that differentiates the possible multiple instances of the MV.
+ * It's derived from the secondary view Part id of the view associated to the
* current instance of the MV. */
protected String m_visualizerInstanceId = null;
-
+
// This is used to cache the CPU and core
// contexts, each time the model is recreated. This way
// we can avoid asking the backend for the CPU/core
// geometry each time we want to update the load information.
protected List<IDMContext> m_cpuCoreContextsCache = null;
-
/** Main switch that determines if we should display the load meters */
private PersistentParameter<Boolean> m_loadMetersEnabled;
-
+
/** Timer used to trigger the update of the CPU/core load meters */
protected Timer m_updateLoadMeterTimer = null;
-
+
/** update period for the load meters */
private PersistentParameter<Integer> m_loadMeterTimerPeriod;
-
+
// Load meters refresh periods, in ms
/** constant for the very short load meters update period */
private static final int LOAD_METER_TIMER_MIN = 100;
@@ -189,89 +188,86 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
/** constant for the medium load meters update period */
private static final int LOAD_METER_TIMER_MEDIUM = 1000;
/** constant for the long load meters update period */
- private static final int LOAD_METER_TIMER_SLOW = 5000;
-
+ private static final int LOAD_METER_TIMER_SLOW = 5000;
+
/** Whether to show debug actions in toolbar, by default */
- private static final boolean SHOW_DEBUG_ACTIONS_IN_MV_TOOLBAR_DEFAULT = true;
-
+ private static final boolean SHOW_DEBUG_ACTIONS_IN_MV_TOOLBAR_DEFAULT = true;
+
/** Currently pinned session id, if any */
private String m_currentPinedSessionId = null;
-
// --- UI members ---
/** Whether actions have been initialized. */
protected boolean m_actionsInitialized = false;
-
+
/** Toolbar / menu action */
- protected Separator m_separatorAction = null;
+ protected Separator m_separatorAction = null;
/** Toolbar / menu action */
protected ResumeCommandAction m_resumeAction = null;
-
+
/** Toolbar / menu action */
protected SuspendCommandAction m_suspendAction = null;
-
+
/** Toolbar / menu action */
protected TerminateCommandAction m_terminateAction = null;
-
+
/** Toolbar / menu action */
protected StepReturnCommandAction m_stepReturnAction = null;
-
+
/** Toolbar / menu action */
protected StepOverCommandAction m_stepOverAction = null;
-
+
/** Toolbar / menu action */
protected StepIntoCommandAction m_stepIntoAction = null;
-
+
/** Toolbar / menu action */
protected DropToFrameCommandAction m_dropToFrameAction = null;
-
+
/** Toolbar / menu action */
protected SelectAllAction m_selectAllAction = null;
-
+
/** Toolbar / menu action */
protected RefreshAction m_refreshAction = null;
-
+
/** Sub-menu */
protected IMenuManager m_loadMetersSubMenu = null;
-
+
/** Sub-sub menu */
protected IMenuManager m_loadMetersRefreshSubSubmenu = null;
-
+
/** Menu action */
protected EnableLoadMetersAction m_enableLoadMetersAction = null;
-
+
/** Menu action */
protected List<SetLoadMeterPeriodAction> m_setLoadMeterPeriodActions = null;
-
+
/** Menu action */
protected FilterCanvasAction m_setFilterAction = null;
/** Menu action */
- protected FilterCanvasAction m_clearFilterAction = null;
-
+ protected FilterCanvasAction m_clearFilterAction = null;
+
/** Menu action */
protected PinToDebugSessionAction m_pinToDbgSessionAction = null;
-
+
/** Menu action */
protected ShowDebugToolbarAction m_showDebugToolbarAction = null;
-
+
/** persistent settings manager */
protected PersistentSettingsManager m_persistentSettingsManager = null;
// --- constructors/destructors ---
-
+
/** Constructor. */
- public MulticoreVisualizer()
- {
+ public MulticoreVisualizer() {
fTargetData = new DSFDebugModel();
}
-
+
/** Dispose method. */
@Override
- public void dispose()
- {
+ public void dispose() {
super.dispose();
removeDebugViewerListener();
disposeActions();
@@ -283,17 +279,16 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
m_cpuCoreContextsCache = null;
}
}
-
-
+
// --- init methods ---
-
+
/** Invoked when visualizer is created, to permit any initialization. */
@Override
public void initializeVisualizer() {
fEventListener = new MulticoreVisualizerEventListener(this);
- m_cpuCoreContextsCache = new ArrayList<IDMContext>();
+ m_cpuCoreContextsCache = new ArrayList<IDMContext>();
m_visualizerInstanceId = getViewer().getView().getViewSite().getSecondaryId();
-
+
// The first visualizer view will have a null secondary id - override that
if (m_visualizerInstanceId == null) {
m_visualizerInstanceId = "0"; //$NON-NLS-1$
@@ -302,99 +297,100 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
}
/**
- * Initialize the persistent parameters
+ * Initialize the persistent parameters
*/
protected void initializePersistentParameters(String visualizerInstanceId) {
// setting managers
m_persistentSettingsManager = new PersistentSettingsManager("MulticoreVisualizer", visualizerInstanceId); //$NON-NLS-1$
// define persistent parameters:
- m_loadMetersEnabled = m_persistentSettingsManager.getNewParameter(Boolean.class,
- "enableLoadMeters", true, false); //$NON-NLS-1$
- m_loadMeterTimerPeriod = m_persistentSettingsManager.getNewParameter(Integer.class,
- "loadMeterTimerPeriod", true, LOAD_METER_TIMER_MEDIUM); //$NON-NLS-1$
+ m_loadMetersEnabled = m_persistentSettingsManager.getNewParameter(Boolean.class, "enableLoadMeters", true, //$NON-NLS-1$
+ false);
+ m_loadMeterTimerPeriod = m_persistentSettingsManager.getNewParameter(Integer.class, "loadMeterTimerPeriod", //$NON-NLS-1$
+ true, LOAD_METER_TIMER_MEDIUM);
}
-
+
/**
* Sets-up the timer associated to load meters refresh
*/
protected void initializeLoadMeterTimer() {
- if (!getLoadMetersEnabled()) return;
- m_updateLoadMeterTimer = getLoadTimer(m_sessionState, getLoadMeterTimerPeriod());
+ if (!getLoadMetersEnabled())
+ return;
+ m_updateLoadMeterTimer = getLoadTimer(m_sessionState, getLoadMeterTimerPeriod());
// one-shot timer (re-scheduled upon successful triggering)
- m_updateLoadMeterTimer.setRepeating(false);
+ m_updateLoadMeterTimer.setRepeating(false);
}
-
+
/**
* disposes of the load meter timer
*/
protected void disposeLoadMeterTimer() {
- if(m_updateLoadMeterTimer != null) {
+ if (m_updateLoadMeterTimer != null) {
m_updateLoadMeterTimer.dispose();
m_updateLoadMeterTimer = null;
}
}
-
+
/** Invoked when visualizer is disposed, to permit any cleanup. */
@Override
- public void disposeVisualizer()
- {
+ public void disposeVisualizer() {
// handle any other cleanup
dispose();
}
-
-
+
// --- accessors ---
-
+
/** Returns non-localized unique name for this visualizer. */
@Override
public String getName() {
return "multicore"; //$NON-NLS-1$
}
-
+
/** Returns localized name to display for this visualizer. */
@Override
public String getDisplayName() {
- return Messages.MulticoreVisualizer_name;
+ return Messages.MulticoreVisualizer_name;
}
-
+
/** Returns localized tooltip text to display for this visualizer. */
@Override
public String getDescription() {
- return Messages.MulticoreVisualizer_tooltip;
+ return Messages.MulticoreVisualizer_tooltip;
}
-
+
/**
* takes care of the details of changing the load meter timer period
*/
public void setLoadMeterTimerPeriod(int p) {
assert (p > LOAD_METER_TIMER_MIN);
- if (getLoadMeterTimerPeriod() == p) return;
+ if (getLoadMeterTimerPeriod() == p)
+ return;
m_loadMeterTimerPeriod.set(p > LOAD_METER_TIMER_MIN ? p : LOAD_METER_TIMER_MIN);
disposeLoadMeterTimer();
initializeLoadMeterTimer();
}
-
+
/** Gets the load meter period */
public int getLoadMeterTimerPeriod() {
return m_loadMeterTimerPeriod != null ? m_loadMeterTimerPeriod.value() : 0;
}
-
+
/**
* enables or disables the load meters
*/
public void enableLoadMeters(boolean enabled) {
- if (getLoadMetersEnabled() == enabled) return;
+ if (getLoadMetersEnabled() == enabled)
+ return;
setLoadMetersEnabled(enabled);
// save load meter enablement in model
fDataModel.setLoadMetersEnabled(getLoadMetersEnabled());
disposeLoadMeterTimer();
initializeLoadMeterTimer();
}
-
+
/** Returns whether the load meters are enabled */
public boolean getLoadMetersEnabled() {
- return m_loadMetersEnabled != null? m_loadMetersEnabled.value() : false;
+ return m_loadMetersEnabled != null ? m_loadMetersEnabled.value() : false;
}
public void setLoadMetersEnabled(boolean enabled) {
@@ -402,20 +398,18 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
}
// --- canvas management ---
-
+
/** Creates and returns visualizer canvas control. */
@Override
- public GraphicCanvas createCanvas(Composite parent)
- {
+ public GraphicCanvas createCanvas(Composite parent) {
m_canvas = new MulticoreVisualizerCanvas(parent);
m_canvas.addSelectionChangedListener(this);
return m_canvas;
}
-
+
/** Invoked when canvas control should be disposed. */
@Override
- public void disposeCanvas()
- {
+ public void disposeCanvas() {
if (m_canvas != null) {
m_canvas.removeSelectionChangedListener(this);
m_canvas.dispose();
@@ -423,33 +417,31 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
}
disposeLoadMeterTimer();
}
-
+
/** Invoked after visualizer control creation, */
@Override
- protected void initializeCanvas(GraphicCanvas canvas)
- {
+ protected void initializeCanvas(GraphicCanvas canvas) {
// Any workbench views left open at application shutdown may be instanced
// before our plugins are fully loaded, so make sure resource manager is initialized.
// Note: this also associates the resource manager with the Colors class;
// until this is done, the Colors constants are null.
CDTVisualizerUIPlugin.getResources();
-
+
m_canvas.setBackground(Colors.BLACK);
m_canvas.setForeground(Colors.GREEN);
}
-
+
/** Returns downcast reference to grid view canvas. */
- public MulticoreVisualizerCanvas getMulticoreVisualizerCanvas()
- {
+ public MulticoreVisualizerCanvas getMulticoreVisualizerCanvas() {
return (MulticoreVisualizerCanvas) getCanvas();
}
-
+
/** Sets-up a canvas filter */
public void applyCanvasFilter() {
m_canvas.applyFilter();
refresh();
}
-
+
/** Removes current canvas filter */
public void clearCanvasFilter() {
m_canvas.clearFilter();
@@ -460,76 +452,81 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
public boolean isCanvasFilterActive() {
return m_canvas.isFilterActive();
}
-
+
/** Return the data model backing this multicore visualizer */
public VisualizerModel getModel() {
return fDataModel;
}
-
-
+
// --- action management ---
/** Creates actions for menus/toolbar. */
- protected void createActions()
- {
- if (m_actionsInitialized) return; // already done
-
+ protected void createActions() {
+ if (m_actionsInitialized)
+ return; // already done
+
LaunchView debugView = DebugViewUtils.getDebugView();
-
- m_separatorAction = new Separator();
-
- m_resumeAction = new ResumeCommandAction();
- if (debugView != null) m_resumeAction.init(debugView);
-
- m_suspendAction = new SuspendCommandAction();
- if (debugView != null) m_suspendAction.init(debugView);
-
- m_terminateAction = new TerminateCommandAction();
- if (debugView != null) m_terminateAction.init(debugView);
-
-
- m_stepReturnAction = new StepReturnCommandAction();
- if (debugView != null) m_stepReturnAction.init(debugView);
-
- m_stepOverAction = new StepOverCommandAction();
- if (debugView != null) m_stepOverAction.init(debugView);
-
- m_stepIntoAction = new StepIntoCommandAction();
- if (debugView != null) m_stepIntoAction.init(debugView);
+
+ m_separatorAction = new Separator();
+
+ m_resumeAction = new ResumeCommandAction();
+ if (debugView != null)
+ m_resumeAction.init(debugView);
+
+ m_suspendAction = new SuspendCommandAction();
+ if (debugView != null)
+ m_suspendAction.init(debugView);
+
+ m_terminateAction = new TerminateCommandAction();
+ if (debugView != null)
+ m_terminateAction.init(debugView);
+
+ m_stepReturnAction = new StepReturnCommandAction();
+ if (debugView != null)
+ m_stepReturnAction.init(debugView);
+
+ m_stepOverAction = new StepOverCommandAction();
+ if (debugView != null)
+ m_stepOverAction.init(debugView);
+
+ m_stepIntoAction = new StepIntoCommandAction();
+ if (debugView != null)
+ m_stepIntoAction.init(debugView);
m_dropToFrameAction = new DropToFrameCommandAction();
- if (debugView != null) m_dropToFrameAction.init(debugView);
-
+ if (debugView != null)
+ m_dropToFrameAction.init(debugView);
+
m_selectAllAction = new SelectAllAction();
m_selectAllAction.init(this);
-
+
m_refreshAction = new RefreshAction();
m_refreshAction.init(this);
// create load meters sub-menu and associated actions
- m_loadMetersSubMenu = new MenuManager(MulticoreVisualizerUIPlugin.getString(
- "MulticoreVisualizer.actions.LoadMeterSubmenu.text")); //$NON-NLS-1$
- m_loadMetersRefreshSubSubmenu = new MenuManager(MulticoreVisualizerUIPlugin.getString(
- "MulticoreVisualizer.actions.LoadMetersRefreshSubSubmenu.text")); //$NON-NLS-1$
-
+ m_loadMetersSubMenu = new MenuManager(
+ MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.actions.LoadMeterSubmenu.text")); //$NON-NLS-1$
+ m_loadMetersRefreshSubSubmenu = new MenuManager(
+ MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.actions.LoadMetersRefreshSubSubmenu.text")); //$NON-NLS-1$
+
m_enableLoadMetersAction = new EnableLoadMetersAction(getLoadMetersEnabled());
m_enableLoadMetersAction.init(this);
- // enable the load meter sub-menu
- m_enableLoadMetersAction.setEnabled(true);
+ // enable the load meter sub-menu
+ m_enableLoadMetersAction.setEnabled(true);
m_setLoadMeterPeriodActions = new ArrayList<SetLoadMeterPeriodAction>();
m_setLoadMeterPeriodActions.add(new SetLoadMeterPeriodAction(
- MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.actions.SetLoadMeterPeriod.fast.text"), //$NON-NLS-1$
+ MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.actions.SetLoadMeterPeriod.fast.text"), //$NON-NLS-1$
LOAD_METER_TIMER_FAST));
-
- // TODO: the default load meter refresh speed is set here but we could instead rely on the value saved in the data store
+
+ // TODO: the default load meter refresh speed is set here but we could instead rely on the value saved in the data store
SetLoadMeterPeriodAction defaultAction = new SetLoadMeterPeriodAction(
- MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.actions.SetLoadMeterPeriod.medium.text"), //$NON-NLS-1$
+ MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.actions.SetLoadMeterPeriod.medium.text"), //$NON-NLS-1$
LOAD_METER_TIMER_MEDIUM);
m_setLoadMeterPeriodActions.add(defaultAction);
-
+
m_setLoadMeterPeriodActions.add(new SetLoadMeterPeriodAction(
- MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.actions.SetLoadMeterPeriod.slow.text"), //$NON-NLS-1$
+ MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.actions.SetLoadMeterPeriod.slow.text"), //$NON-NLS-1$
LOAD_METER_TIMER_SLOW));
for (SetLoadMeterPeriodAction act : m_setLoadMeterPeriodActions) {
act.init(this);
@@ -537,7 +534,7 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
}
defaultAction.setChecked(true);
defaultAction.run();
-
+
// canvas filter actions - they will be dynamically enabled/disabled
// according to canvas selection
m_setFilterAction = new FilterCanvasAction(true);
@@ -547,55 +544,54 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
m_clearFilterAction = new FilterCanvasAction(false);
m_clearFilterAction.init(this);
m_clearFilterAction.setEnabled(false);
-
+
m_pinToDbgSessionAction = new PinToDebugSessionAction();
m_pinToDbgSessionAction.init(this);
m_pinToDbgSessionAction.setEnabled(false);
-
+
// default: do not show debug actions
- m_showDebugToolbarAction = new ShowDebugToolbarAction(SHOW_DEBUG_ACTIONS_IN_MV_TOOLBAR_DEFAULT,
- m_visualizerInstanceId);
+ m_showDebugToolbarAction = new ShowDebugToolbarAction(SHOW_DEBUG_ACTIONS_IN_MV_TOOLBAR_DEFAULT,
+ m_visualizerInstanceId);
m_showDebugToolbarAction.init(this);
m_showDebugToolbarAction.setEnabled(true);
-
+
// Note: debug view may not be initialized at startup,
// so we'll pretend the actions are not yet updated,
// and reinitialize them later.
m_actionsInitialized = (debugView != null);
}
-
+
/** Updates actions displayed on menu/toolbars. */
- protected void updateActions()
- {
- if (! m_actionsInitialized) return;
+ protected void updateActions() {
+ if (!m_actionsInitialized)
+ return;
boolean enabled = hasSelection();
m_selectAllAction.setEnabled(enabled);
m_refreshAction.setEnabled(enabled);
-
- // enable "filter-to selection" menu item if there is a
+
+ // enable "filter-to selection" menu item if there is a
// canvas selection
m_setFilterAction.setEnabled(m_canvas.hasSelection());
-
+
// enable "Clear filter" menu item if filter is active
m_clearFilterAction.setEnabled(isCanvasFilterActive());
-
- // show the load meter refresh speed sub-menu only
- // if the load meters are enabled
- m_loadMetersRefreshSubSubmenu.setVisible(getLoadMetersEnabled());
-
- // Enable pinning menu item when there is a current debug session
- m_pinToDbgSessionAction.setEnabled(m_sessionState != null);
-
+
+ // show the load meter refresh speed sub-menu only
+ // if the load meters are enabled
+ m_loadMetersRefreshSubSubmenu.setVisible(getLoadMetersEnabled());
+
+ // Enable pinning menu item when there is a current debug session
+ m_pinToDbgSessionAction.setEnabled(m_sessionState != null);
+
// We should not change the enablement of the debug view
// actions, as they are automatically enabled/disabled
// by the platform.
}
/** Updates actions specific to context menu. */
- protected void updateContextMenuActions(Point location)
- {
- }
+ protected void updateContextMenuActions(Point location) {
+ }
/** Cleans up actions. */
protected void disposeActions() {
@@ -607,62 +603,62 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
m_resumeAction.dispose();
m_resumeAction = null;
}
-
+
if (m_suspendAction != null) {
m_suspendAction.dispose();
m_suspendAction = null;
}
-
+
if (m_terminateAction != null) {
m_terminateAction.dispose();
m_terminateAction = null;
}
-
+
if (m_stepReturnAction != null) {
m_stepReturnAction.dispose();
m_stepReturnAction = null;
}
-
+
if (m_stepOverAction != null) {
m_stepOverAction.dispose();
m_stepOverAction = null;
}
-
+
if (m_stepIntoAction != null) {
m_stepIntoAction.dispose();
m_stepIntoAction = null;
}
-
+
if (m_dropToFrameAction != null) {
m_dropToFrameAction.dispose();
m_dropToFrameAction = null;
}
-
+
if (m_selectAllAction != null) {
m_selectAllAction.dispose();
m_selectAllAction = null;
}
-
+
if (m_refreshAction != null) {
m_refreshAction.dispose();
m_refreshAction = null;
}
-
+
if (m_loadMetersSubMenu != null) {
m_loadMetersSubMenu.dispose();
m_loadMetersSubMenu = null;
}
-
+
if (m_loadMetersRefreshSubSubmenu != null) {
m_loadMetersRefreshSubSubmenu.dispose();
m_loadMetersRefreshSubSubmenu = null;
}
-
- if (m_enableLoadMetersAction != null ) {
+
+ if (m_enableLoadMetersAction != null) {
m_enableLoadMetersAction.dispose();
m_enableLoadMetersAction = null;
}
-
+
if (m_setLoadMeterPeriodActions != null) {
for (SetLoadMeterPeriodAction act : m_setLoadMeterPeriodActions) {
act.dispose();
@@ -670,7 +666,7 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
m_setLoadMeterPeriodActions.clear();
m_setLoadMeterPeriodActions = null;
}
-
+
if (m_setFilterAction != null) {
m_setFilterAction.dispose();
m_setFilterAction = null;
@@ -680,32 +676,30 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
m_clearFilterAction.dispose();
m_clearFilterAction = null;
}
-
+
if (m_pinToDbgSessionAction != null) {
m_pinToDbgSessionAction.dispose();
m_pinToDbgSessionAction = null;
}
-
+
if (m_showDebugToolbarAction != null) {
m_showDebugToolbarAction.dispose();
m_showDebugToolbarAction = null;
}
-
+
m_actionsInitialized = false;
}
-
// --- menu/toolbar management ---
/** Invoked when visualizer is selected, to populate the toolbar. */
@Override
- public void populateToolBar(IToolBarManager toolBarManager)
- {
+ public void populateToolBar(IToolBarManager toolBarManager) {
// initialize menu/toolbar actions, if needed
createActions();
// display debug buttons only if MV is not pinned
- // note: if in the future we want to display the debug buttons even
+ // note: if in the future we want to display the debug buttons even
// when pinned, all that needs to be done it to remove this check.
if (!m_pinToDbgSessionAction.isChecked()) {
// only show the debug actions in toolbar, if configured to do so
@@ -723,17 +717,16 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
}
}
toolBarManager.add(m_pinToDbgSessionAction);
-
+
updateActions();
}
/** Invoked when visualizer is selected, to populate the toolbar's menu. */
@Override
- public void populateMenu(IMenuManager menuManager)
- {
+ public void populateMenu(IMenuManager menuManager) {
// initialize menu/toolbar actions, if needed
createActions();
-
+
menuManager.add(m_showDebugToolbarAction);
// TODO: Anything we want to hide on the toolbar menu?
@@ -742,137 +735,130 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
/** Invoked when visualizer view's context menu is invoked, to populate it. */
@Override
- public void populateContextMenu(IMenuManager menuManager)
- {
+ public void populateContextMenu(IMenuManager menuManager) {
// initialize menu/toolbar actions, if needed
createActions();
menuManager.add(m_resumeAction);
menuManager.add(m_suspendAction);
menuManager.add(m_terminateAction);
-
+
menuManager.add(m_separatorAction);
-
+
menuManager.add(m_stepReturnAction);
menuManager.add(m_stepOverAction);
menuManager.add(m_stepIntoAction);
menuManager.add(m_dropToFrameAction);
menuManager.add(m_separatorAction);
-
+
menuManager.add(m_selectAllAction);
menuManager.add(m_refreshAction);
-
+
menuManager.add(m_separatorAction);
-
+
// add load meters sub-menus and actions
m_loadMetersSubMenu.removeAll();
m_loadMetersRefreshSubSubmenu.removeAll();
-
+
menuManager.add(m_loadMetersSubMenu);
-
- m_loadMetersSubMenu.add(m_enableLoadMetersAction);
+
+ m_loadMetersSubMenu.add(m_enableLoadMetersAction);
m_loadMetersSubMenu.add(m_loadMetersRefreshSubSubmenu);
-
+
for (SetLoadMeterPeriodAction act : m_setLoadMeterPeriodActions) {
m_loadMetersRefreshSubSubmenu.add(act);
}
-
+
// add filtering options
menuManager.add(m_separatorAction);
menuManager.add(m_setFilterAction);
menuManager.add(m_clearFilterAction);
-
+
updateActions();
Point location = m_viewer.getContextMenuLocation();
updateContextMenuActions(location);
}
-
// --- visualizer selection management ---
-
+
/** Invoked when visualizer has been selected. */
@Override
public void visualizerSelected() {
updateActions();
};
-
+
/** Invoked when another visualizer has been selected, hiding this one. */
@Override
public void visualizerDeselected() {
};
-
// --- workbench selection management ---
-
- /**
- * Tests whether if the IVisualizer can display the selection
- * (or something reachable from it).
+
+ /**
+ * Tests whether if the IVisualizer can display the selection
+ * (or something reachable from it).
*/
@Override
- public int handlesSelection(ISelection selection)
- {
+ public int handlesSelection(ISelection selection) {
// By default, we don't support anything.
int result = 0;
-
+
Object sel = SelectionUtils.getSelectedObject(selection);
- if (sel instanceof GdbLaunch ||
- sel instanceof GDBProcess ||
- sel instanceof IDMVMContext)
- {
+ if (sel instanceof GdbLaunch || sel instanceof GDBProcess || sel instanceof IDMVMContext) {
result = 1;
- }
- else {
+ } else {
result = 0;
}
-
+
// While we're here, see if we need to attach debug view listener
updateDebugViewListener();
-
+
return result;
}
-
+
/**
* Adds listener to debug view's viewer, so we can detect
* Debug View updates (which it doesn't bother to properly
* communicate to the rest of the world, sigh).
*/
- protected void updateDebugViewListener()
- {
+ protected void updateDebugViewListener() {
attachDebugViewerListener();
}
-
+
/** Attaches debug viewer listener. */
- protected void attachDebugViewerListener()
- {
+ protected void attachDebugViewerListener() {
// NOTE: debug viewer might not exist yet, so we
// attach the listener at the first opportunity to do so.
if (m_debugViewer == null) {
m_debugViewer = DebugViewUtils.getDebugViewer();
if (m_debugViewer != null) {
- m_modelChangedListener =
- new IModelChangedListener() {
+ m_modelChangedListener = new IModelChangedListener() {
@Override
- public void modelChanged(IModelDelta delta, IModelProxy proxy)
- {
+ public void modelChanged(IModelDelta delta, IModelProxy proxy) {
// Execute a refresh after any pending UI updates.
- GUIUtils.exec( new Runnable() { @Override public void run() {
- // check if we need to update the debug context
- updateDebugContext();
- }});
+ GUIUtils.exec(new Runnable() {
+ @Override
+ public void run() {
+ // check if we need to update the debug context
+ updateDebugContext();
+ }
+ });
}
};
- m_debugViewSelectionChangedListener =
- new ISelectionChangedListener() {
+ m_debugViewSelectionChangedListener = new ISelectionChangedListener() {
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ // Execute a refresh after any pending UI updates.
+ GUIUtils.exec(new Runnable() {
@Override
- public void selectionChanged(SelectionChangedEvent event) {
- // Execute a refresh after any pending UI updates.
- GUIUtils.exec( new Runnable() { @Override public void run() {
- // Update canvas selection to match to dbg view selection
- updateCanvasSelectionFromDebugView();
- }});
+ public void run() {
+ // Update canvas selection to match to dbg view selection
+ updateCanvasSelectionFromDebugView();
}
- };
+ });
+ }
+ };
m_debugViewer.addModelChangedListener(m_modelChangedListener);
m_debugViewer.addSelectionChangedListener(m_debugViewSelectionChangedListener);
}
@@ -880,8 +866,7 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
}
/** Removes debug viewer listener. */
- protected void removeDebugViewerListener()
- {
+ protected void removeDebugViewerListener() {
if (m_modelChangedListener != null && m_debugViewSelectionChangedListener != null) {
if (m_debugViewer != null) {
m_debugViewer.removeModelChangedListener(m_modelChangedListener);
@@ -892,27 +877,25 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
}
}
}
-
+
private void removeEventListener() {
if (m_sessionState != null) {
m_sessionState.removeServiceEventListener(fEventListener);
}
}
- /**
- * Invoked by VisualizerViewer when workbench selection changes.
- */
+ /**
+ * Invoked by VisualizerViewer when workbench selection changes.
+ */
@Override
- public void workbenchSelectionChanged(ISelection selection)
- {
+ public void workbenchSelectionChanged(ISelection selection) {
// See if we need to update our debug info from
// the workbench selection. This will be done asynchronously.
boolean changed = updateDebugContext();
if (changed) {
update();
- }
- else {
+ } else {
// Even if debug info doesn't change, we still want to
// check whether the canvas selection needs to change
// to reflect the current workbench selection.
@@ -922,26 +905,23 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
// Also check whether we need to attach debug view listener.
updateDebugViewListener();
}
-
+
/** Refreshes visualizer content from model. */
- public void refresh()
- {
+ public void refresh() {
m_canvas.requestRecache();
m_canvas.requestUpdate();
}
-
-
+
/** Updates the UI elements such as the toolbar and context menu */
public void raiseVisualizerChangedEvent() {
// FIXME: replace hack below by raising a new VisualizerChanged
// event, listened-to by VisualizerViewer, that causes it to raise
// its own VISUALIZER_CHANGED event. See bug 442584 for details
-
- // for now do a non-change to the selection to trigger a call to
+
+ // for now do a non-change to the selection to trigger a call to
// VisualizerView#updateUI()
setSelection(getSelection());
}
-
// --- ISelectionChangedListener implementation ---
@@ -953,37 +933,32 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
@Override
public void selectionChanged(SelectionChangedEvent event) {
super.selectionChanged(event);
-
+
// Force Debug View's selection to reflect visualizer selection,
// since debug view doesn't update itself from the workbench selection.
// NOTE: This can be overridden by the model selection policy, if there is one.
ISelection debugViewSelection = visualizerToDebugViewSelection(getSelection());
DebugViewUtils.setDebugViewSelection(debugViewSelection);
-
+
// update actions to reflect change of selection
updateActions();
}
-
-
+
// --- Selection conversion methods ---
-
+
/** Gets debug view selection from visualizer selection. */
- protected ISelection visualizerToDebugViewSelection(ISelection visualizerSelection)
- {
- MulticoreVisualizerSelectionFinder selectionFinder =
- new MulticoreVisualizerSelectionFinder();
- ISelection workbenchSelection =
- selectionFinder.findSelection(visualizerSelection);
+ protected ISelection visualizerToDebugViewSelection(ISelection visualizerSelection) {
+ MulticoreVisualizerSelectionFinder selectionFinder = new MulticoreVisualizerSelectionFinder();
+ ISelection workbenchSelection = selectionFinder.findSelection(visualizerSelection);
return workbenchSelection;
}
-
+
/** Gets visualizer selection from debug view selection. */
- protected ISelection workbenchToVisualizerSelection(ISelection workbenchSelection)
- {
+ protected ISelection workbenchToVisualizerSelection(ISelection workbenchSelection) {
ISelection visualizerSelection = null;
-
+
List<Object> items = SelectionUtils.getSelectedObjects(workbenchSelection);
-
+
if (m_canvas != null) {
// Use the current canvas model to match Debug View items
// with corresponding threads, if any.
@@ -996,34 +971,32 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
// Currently, we ignore selections other than DSF context objects.
// TODO: any other cases where we could map selections to canvas?
- if (item instanceof IDMVMContext)
- {
+ if (item instanceof IDMVMContext) {
IDMContext context = ((IDMVMContext) item).getDMContext();
- IMIProcessDMContext processContext =
- DMContexts.getAncestorOfType(context, IMIProcessDMContext.class);
+ IMIProcessDMContext processContext = DMContexts.getAncestorOfType(context,
+ IMIProcessDMContext.class);
int pid = Integer.parseInt(processContext.getProcId());
- IMIExecutionDMContext execContext =
- DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
+ IMIExecutionDMContext execContext = DMContexts.getAncestorOfType(context,
+ IMIExecutionDMContext.class);
- int tid = 0;
- if (execContext != null) {
- try {
- tid = Integer.parseInt(execContext.getThreadId());
- } catch (NumberFormatException e) {
- // continue tid=0
- assert false : THE_THREAD_ID_DOES_NOT_CONVERT_TO_AN_INTEGER + execContext.getThreadId();
- }
- }
+ int tid = 0;
+ if (execContext != null) {
+ try {
+ tid = Integer.parseInt(execContext.getThreadId());
+ } catch (NumberFormatException e) {
+ // continue tid=0
+ assert false : THE_THREAD_ID_DOES_NOT_CONVERT_TO_AN_INTEGER + execContext.getThreadId();
+ }
+ }
if (tid == 0) { // process
List<VisualizerThread> threads = model.getThreadsForProcess(pid);
if (threads != null) {
selected.addAll(threads);
}
- }
- else { // thread
+ } else { // thread
VisualizerThread thread = model.getThread(tid);
// here "tid" is the "GDB thread id", which is not
// unique across sessions, so make sure the thread
@@ -1037,13 +1010,12 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
visualizerSelection = SelectionUtils.toSelection(selected);
}
}
-
+
return visualizerSelection;
}
-
-
+
// --- IPinnable implementation ---
-
+
/**
* Pins the multicore visualizer to the current debug session, preventing
* it from switching to a different session.
@@ -1053,12 +1025,12 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
// No current session - do nothing
if (m_sessionState == null)
return;
-
+
m_currentPinedSessionId = m_sessionState.getSessionID();
-
+
m_showDebugToolbarAction.setEnabled(false);
}
-
+
/**
* Unpins the visualizer.
*/
@@ -1068,45 +1040,42 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
// force visualizer to re-evaluate its current session and
// display the correct one, if needed
workbenchSelectionChanged(null);
-
+
m_showDebugToolbarAction.setEnabled(true);
}
-
+
/** Returns whether the MV is currently pinned to a session */
@Override
public boolean isPinned() {
return m_currentPinedSessionId != null;
}
-
// --- DSF Context Management ---
-
+
/** Updates debug context being displayed by canvas.
* Returns true if canvas context actually changes, false if not.
*/
- public boolean updateDebugContext()
- {
+ public boolean updateDebugContext() {
// is the visualizer pinned? Then inhibit context change
if (isPinned())
return false;
-
+
String sessionId = null;
IAdaptable debugContext = DebugUITools.getDebugContext();
if (debugContext instanceof IDMVMContext) {
- sessionId = ((IDMVMContext)debugContext).getDMContext().getSessionId();
+ sessionId = ((IDMVMContext) debugContext).getDMContext().getSessionId();
} else if (debugContext instanceof GdbLaunch) {
- GdbLaunch gdbLaunch = (GdbLaunch)debugContext;
+ GdbLaunch gdbLaunch = (GdbLaunch) debugContext;
if (gdbLaunch.isTerminated() == false) {
sessionId = gdbLaunch.getSession().getId();
}
} else if (debugContext instanceof GDBProcess) {
- ILaunch launch = ((GDBProcess)debugContext).getLaunch();
- if (launch.isTerminated() == false &&
- launch instanceof GdbLaunch) {
- sessionId = ((GdbLaunch)launch).getSession().getId();
+ ILaunch launch = ((GDBProcess) debugContext).getLaunch();
+ if (launch.isTerminated() == false && launch instanceof GdbLaunch) {
+ sessionId = ((GdbLaunch) launch).getSession().getId();
}
}
-
+
return setDebugSession(sessionId);
}
@@ -1116,34 +1085,29 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
public boolean setDebugSession(String sessionId) {
boolean changed = false;
- if (m_sessionState != null &&
- ! m_sessionState.getSessionID().equals(sessionId))
- {
+ if (m_sessionState != null && !m_sessionState.getSessionID().equals(sessionId)) {
// stop timer that updates the load meters
disposeLoadMeterTimer();
-
+
m_sessionState.removeServiceEventListener(fEventListener);
m_sessionState.dispose();
m_sessionState = null;
changed = true;
}
-
- if (m_sessionState == null &&
- sessionId != null)
- {
+
+ if (m_sessionState == null && sessionId != null) {
m_sessionState = new DSFSessionState(sessionId);
m_sessionState.addServiceEventListener(fEventListener);
// start timer that updates the load meters
initializeLoadMeterTimer();
changed = true;
}
-
+
return changed;
}
-
// --- Update methods ---
-
+
/** Updates visualizer canvas state. */
public void update() {
// Create new VisualizerModel and hand it to canvas,
@@ -1156,84 +1120,88 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
}
// clear CPU/core cache
m_cpuCoreContextsCache.clear();
-
+
fDataModel = new VisualizerModel(m_sessionState.getSessionID());
getVisualizerModel(fDataModel);
}
-
+
/** Sets canvas model. (Also updates canvas selection.) */
protected void setCanvasModel(VisualizerModel model) {
final VisualizerModel model_f = model;
- GUIUtils.exec(new Runnable() { @Override public void run() {
- if(m_canvas != null) {
- m_canvas.setModel(model_f);
- // Update the canvas's selection from the current workbench selection.
- updateCanvasSelectionInternal();
+ GUIUtils.exec(new Runnable() {
+ @Override
+ public void run() {
+ if (m_canvas != null) {
+ m_canvas.setModel(model_f);
+ // Update the canvas's selection from the current workbench selection.
+ updateCanvasSelectionInternal();
+ }
}
- }});
+ });
}
-
+
/** Updates canvas selection from current workbench selection. */
protected void updateCanvasSelection() {
- GUIUtils.exec(new Runnable() { @Override public void run() {
- // Update the canvas's selection from the current workbench selection.
- updateCanvasSelectionInternal();
- }});
+ GUIUtils.exec(new Runnable() {
+ @Override
+ public void run() {
+ // Update the canvas's selection from the current workbench selection.
+ updateCanvasSelectionInternal();
+ }
+ });
}
-
+
/** Updates canvas selection from current workbench selection.
* Note: this method assumes it is called on the UI thread. */
- protected void updateCanvasSelectionInternal()
- {
+ protected void updateCanvasSelectionInternal() {
updateCanvasSelectionInternal(SelectionUtils.getWorkbenchSelection());
}
-
+
/** Updates canvas selection from current debug view selection.
* Note: this method assumes it is called on the UI thread. */
- protected void updateCanvasSelectionFromDebugView()
- {
+ protected void updateCanvasSelectionFromDebugView() {
updateCanvasSelectionInternal(DebugViewUtils.getDebugViewSelection());
}
-
+
/** Updates canvas selection from current workbench selection.
* Note: this method assumes it is called on the UI thread. */
- protected void updateCanvasSelectionInternal(ISelection selection)
- {
+ protected void updateCanvasSelectionInternal(ISelection selection) {
ISelection canvasSelection = workbenchToVisualizerSelection(selection);
-
+
// canvas does not raise a selection changed event in this case
// to avoid circular selection update events
if (canvasSelection != null)
m_canvas.setSelection(canvasSelection, false);
}
-
-
+
/** Selects all thread(s) displayed in the canvas. */
- public void selectAll()
- {
+ public void selectAll() {
m_canvas.selectAll();
}
-
+
// --- Visualizer model update methods ---
-
- /**
+
+ /**
* Starts visualizer model request.
*/
protected void getVisualizerModel(final VisualizerModel model) {
- m_sessionState.execute(new DsfRunnable() { @Override public void run() {
- // get model asynchronously starting at the top of the hierarchy
- getCPUs(model, new ImmediateRequestMonitor() {
- @Override
- protected void handleCompleted() {
- model.setLoadMetersEnabled(getLoadMetersEnabled());
- updateLoads(model);
- model.sort();
- setCanvasModel(model);
- }
- });
- }});
+ m_sessionState.execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ // get model asynchronously starting at the top of the hierarchy
+ getCPUs(model, new ImmediateRequestMonitor() {
+ @Override
+ protected void handleCompleted() {
+ model.setLoadMetersEnabled(getLoadMetersEnabled());
+ updateLoads(model);
+ model.sort();
+ setCanvasModel(model);
+ }
+ });
+ }
+ });
}
-
+
@ConfinedToDsfExecutor("getSession().getExecutor()")
protected void getCPUs(final VisualizerModel model, final RequestMonitor rm) {
fTargetData.getCPUs(m_sessionState, new ImmediateDataRequestMonitor<ICPUDMContext[]>() {
@@ -1244,27 +1212,26 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
}
});
}
-
+
@ConfinedToDsfExecutor("getSession().getExecutor()")
- protected void getCores(ICPUDMContext[] cpuContexts, final VisualizerModel model, final RequestMonitor rm)
- {
+ protected void getCores(ICPUDMContext[] cpuContexts, final VisualizerModel model, final RequestMonitor rm) {
if (cpuContexts == null || cpuContexts.length == 0) {
// Whoops, no CPU data.
// We'll fake a CPU and use it to contain any cores we find.
-
+
model.addCPU(new VisualizerCPU(0));
-
+
// Collect core data.
fTargetData.getCores(m_sessionState, new ImmediateDataRequestMonitor<ICoreDMContext[]>() {
@Override
protected void handleCompleted() {
// Get Cores
ICoreDMContext[] coreContexts = isSuccess() ? getData() : null;
-
+
ICPUDMContext cpu = null;
if (coreContexts != null && coreContexts.length > 0) {
- // TODO: This keeps the functionality to the same level before change: 459114,
- // although it's noted that this does not cover the possibility to have multiple CPU's
+ // TODO: This keeps the functionality to the same level before change: 459114,
+ // although it's noted that this does not cover the possibility to have multiple CPU's
// within the list of resolved cores
cpu = DMContexts.getAncestorOfType(coreContexts[0], ICPUDMContext.class);
}
@@ -1276,14 +1243,14 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
} else {
// save CPU contexts
m_cpuCoreContextsCache.addAll(Arrays.asList(cpuContexts));
-
+
final CountingRequestMonitor crm = new ImmediateCountingRequestMonitor(rm);
crm.setDoneCount(cpuContexts.length);
-
+
for (final ICPUDMContext cpuContext : cpuContexts) {
int cpuID = Integer.parseInt(cpuContext.getId());
model.addCPU(new VisualizerCPU(cpuID));
-
+
// Collect core data.
fTargetData.getCores(m_sessionState, cpuContext, new ImmediateDataRequestMonitor<ICoreDMContext[]>() {
@Override
@@ -1295,13 +1262,10 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
}
}
}
-
+
@ConfinedToDsfExecutor("getSession().getExecutor()")
- protected void getThreads(final ICPUDMContext cpuContext,
- ICoreDMContext[] coreContexts,
- final VisualizerModel model,
- RequestMonitor rm)
- {
+ protected void getThreads(final ICPUDMContext cpuContext, ICoreDMContext[] coreContexts,
+ final VisualizerModel model, RequestMonitor rm) {
if (coreContexts == null || coreContexts.length == 0) {
// no cores for this cpu context
// That's fine.
@@ -1309,7 +1273,7 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
} else {
// save core contexts
m_cpuCoreContextsCache.addAll(Arrays.asList(coreContexts));
-
+
int cpuID = Integer.parseInt(cpuContext.getId());
VisualizerCPU cpu = model.getCPU(cpuID);
@@ -1319,26 +1283,23 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
for (final ICoreDMContext coreContext : coreContexts) {
int coreID = Integer.parseInt(coreContext.getId());
cpu.addCore(new VisualizerCore(cpu, coreID));
-
+
// Collect thread data
- fTargetData.getThreads(m_sessionState, cpuContext, coreContext, new ImmediateDataRequestMonitor<IDMContext[]>() {
- @Override
- protected void handleCompleted() {
- IDMContext[] threadContexts = isSuccess() ? getData() : null;
- getThreadData(cpuContext, coreContext, threadContexts, model, crm);
- }
- });
- }
+ fTargetData.getThreads(m_sessionState, cpuContext, coreContext,
+ new ImmediateDataRequestMonitor<IDMContext[]>() {
+ @Override
+ protected void handleCompleted() {
+ IDMContext[] threadContexts = isSuccess() ? getData() : null;
+ getThreadData(cpuContext, coreContext, threadContexts, model, crm);
+ }
+ });
+ }
}
}
@ConfinedToDsfExecutor("getSession().getExecutor()")
- protected void getThreadData(final ICPUDMContext cpuContext,
- final ICoreDMContext coreContext,
- IDMContext[] threadContexts,
- final VisualizerModel model,
- RequestMonitor rm)
- {
+ protected void getThreadData(final ICPUDMContext cpuContext, final ICoreDMContext coreContext,
+ IDMContext[] threadContexts, final VisualizerModel model, RequestMonitor rm) {
if (threadContexts == null || threadContexts.length == 0) {
// no threads for this core
// That's fine.
@@ -1348,114 +1309,104 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
crm.setDoneCount(threadContexts.length);
for (IDMContext threadContext : threadContexts) {
- final IMIExecutionDMContext execContext =
- DMContexts.getAncestorOfType(threadContext, IMIExecutionDMContext.class);
+ final IMIExecutionDMContext execContext = DMContexts.getAncestorOfType(threadContext,
+ IMIExecutionDMContext.class);
// Don't add the thread to the model just yet, let's wait until we have its data and execution state.
// Collect thread data
- fTargetData.getThreadData(m_sessionState, cpuContext, coreContext, execContext, new ImmediateDataRequestMonitor<IThreadDMData>() {
- @Override
- protected void handleCompleted() {
- IThreadDMData threadData = isSuccess() ? getData() : null;
- getThreadExecutionState(cpuContext, coreContext, execContext, threadData, model, crm);
- }
- });
+ fTargetData.getThreadData(m_sessionState, cpuContext, coreContext, execContext,
+ new ImmediateDataRequestMonitor<IThreadDMData>() {
+ @Override
+ protected void handleCompleted() {
+ IThreadDMData threadData = isSuccess() ? getData() : null;
+ getThreadExecutionState(cpuContext, coreContext, execContext, threadData, model, crm);
+ }
+ });
}
}
}
-
+
/** Invoked when getThreads() request completes. */
@ConfinedToDsfExecutor("getSession().getExecutor()")
- protected void getThreadExecutionState(final ICPUDMContext cpuContext,
- final ICoreDMContext coreContext,
- final IMIExecutionDMContext execContext,
- final IThreadDMData threadData,
- final VisualizerModel model,
- final RequestMonitor rm)
- {
+ protected void getThreadExecutionState(final ICPUDMContext cpuContext, final ICoreDMContext coreContext,
+ final IMIExecutionDMContext execContext, final IThreadDMData threadData, final VisualizerModel model,
+ final RequestMonitor rm) {
// Get the execution state
- fTargetData.getThreadExecutionState(m_sessionState, cpuContext, coreContext, execContext,
- threadData, new ImmediateDataRequestMonitor<VisualizerExecutionState>() {
- @Override
- protected void handleCompleted() {
- final VisualizerExecutionState state = isSuccess() ? getData() : null;
- if (state != null && !(state.equals(VisualizerExecutionState.RUNNING)) ) {
- // Get the frame data
- fTargetData.getTopFrameData(m_sessionState, execContext, new ImmediateDataRequestMonitor<IFrameDMData>() {
- @Override
- protected void handleCompleted() {
- IFrameDMData frameData = isSuccess() ? getData() : null;
- getThreadExecutionStateDone(cpuContext, coreContext, execContext, threadData,
- frameData, state, model, rm);
+ fTargetData.getThreadExecutionState(m_sessionState, cpuContext, coreContext, execContext, threadData,
+ new ImmediateDataRequestMonitor<VisualizerExecutionState>() {
+ @Override
+ protected void handleCompleted() {
+ final VisualizerExecutionState state = isSuccess() ? getData() : null;
+ if (state != null && !(state.equals(VisualizerExecutionState.RUNNING))) {
+ // Get the frame data
+ fTargetData.getTopFrameData(m_sessionState, execContext,
+ new ImmediateDataRequestMonitor<IFrameDMData>() {
+ @Override
+ protected void handleCompleted() {
+ IFrameDMData frameData = isSuccess() ? getData() : null;
+ getThreadExecutionStateDone(cpuContext, coreContext, execContext,
+ threadData, frameData, state, model, rm);
+ }
+ });
+ } else {
+ // frame data is not valid
+ getThreadExecutionStateDone(cpuContext, coreContext, execContext, threadData, null, state,
+ model, rm);
}
- });
- } else {
- // frame data is not valid
- getThreadExecutionStateDone(cpuContext, coreContext, execContext, threadData,
- null, state, model, rm);
- }
- }
- });
+ }
+ });
}
-
/** Invoked when getThreadExecutionState() request completes. */
@ConfinedToDsfExecutor("getSession().getExecutor()")
- protected void getThreadExecutionStateDone(ICPUDMContext cpuContext,
- ICoreDMContext coreContext,
- IMIExecutionDMContext execContext,
- IThreadDMData threadData,
- IFrameDMData frame,
- VisualizerExecutionState state,
- VisualizerModel model,
- RequestMonitor rm)
- {
- int cpuID = Integer.parseInt(cpuContext.getId());
- VisualizerCPU cpu = model.getCPU(cpuID);
+ protected void getThreadExecutionStateDone(ICPUDMContext cpuContext, ICoreDMContext coreContext,
+ IMIExecutionDMContext execContext, IThreadDMData threadData, IFrameDMData frame,
+ VisualizerExecutionState state, VisualizerModel model, RequestMonitor rm) {
+ int cpuID = Integer.parseInt(cpuContext.getId());
+ VisualizerCPU cpu = model.getCPU(cpuID);
int coreID = Integer.parseInt(coreContext.getId());
VisualizerCore core = cpu.getCore(coreID);
-
+
if (state == null) {
// Unable to obtain execution state. Assume running
state = VisualizerExecutionState.RUNNING;
}
- IMIProcessDMContext processContext =
- DMContexts.getAncestorOfType(execContext, IMIProcessDMContext.class);
+ IMIProcessDMContext processContext = DMContexts.getAncestorOfType(execContext, IMIProcessDMContext.class);
int pid = Integer.parseInt(processContext.getProcId());
- int tid;
- try {
- tid = Integer.parseInt(execContext.getThreadId());
- } catch (NumberFormatException e) {
- rm.setStatus(new Status(IStatus.ERROR, MulticoreVisualizerUIPlugin.PLUGIN_ID, IStatus.ERROR,
- "Unxepected thread id format:" + execContext.getThreadId(), e)); //$NON-NLS-1$
- rm.done();
- assert false : THE_THREAD_ID_DOES_NOT_CONVERT_TO_AN_INTEGER + execContext.getThreadId();
- return;
- }
+ int tid;
+ try {
+ tid = Integer.parseInt(execContext.getThreadId());
+ } catch (NumberFormatException e) {
+ rm.setStatus(new Status(IStatus.ERROR, MulticoreVisualizerUIPlugin.PLUGIN_ID, IStatus.ERROR,
+ "Unxepected thread id format:" + execContext.getThreadId(), e)); //$NON-NLS-1$
+ rm.done();
+ assert false : THE_THREAD_ID_DOES_NOT_CONVERT_TO_AN_INTEGER + execContext.getThreadId();
+ return;
+ }
String osTIDValue = threadData.getId();
// If we can't get the real Linux OS tid, fallback to using the gdb thread id
int osTid = (osTIDValue == null) ? tid : Integer.parseInt(osTIDValue);
- // add thread if not already there - there is a potential race condition where a
- // thread can be added twice to the model: once at model creation and once more
+ // add thread if not already there - there is a potential race condition where a
+ // thread can be added twice to the model: once at model creation and once more
// through the listener. Checking at both places to prevent this.
VisualizerThread t = model.getThread(tid);
if (t == null) {
model.addThread(new VisualizerThread(core, pid, osTid, tid, state, frame));
}
- // if the thread is already in the model, update it's parameters.
+ // if the thread is already in the model, update it's parameters.
else {
t.setCore(core);
t.setTID(osTid);
t.setState(state);
t.setLocationInfo(frame);
}
-
+
rm.done();
}
-
+
/** Updates the loads for all cpus and cores */
@ConfinedToDsfExecutor("getSession().getExecutor()")
protected void updateLoads(final VisualizerModel model) {
@@ -1467,7 +1418,7 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
if (!getLoadMetersEnabled()) {
return;
}
-
+
final CountingRequestMonitor crm = new ImmediateCountingRequestMonitor() {
@Override
protected void handleSuccess() {
@@ -1477,13 +1428,13 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
m_canvas.requestUpdate();
}
if (m_updateLoadMeterTimer != null) {
- // re-start timer
+ // re-start timer
m_updateLoadMeterTimer.start();
}
}
};
crm.setDoneCount(m_cpuCoreContextsCache.size());
-
+
// ask load for each CPU and core
for (final IDMContext context : m_cpuCoreContextsCache) {
fTargetData.getLoad(m_sessionState, context, new ImmediateDataRequestMonitor<ILoadInfo>() {
@@ -1495,33 +1446,32 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
});
}
}
-
+
/** Invoked when a getLoad() request completes. */
@ConfinedToDsfExecutor("getSession().getExecutor()")
- protected void getLoadDone(IDMContext context, ILoadInfo load, VisualizerModel model, RequestMonitor rm)
- {
+ protected void getLoadDone(IDMContext context, ILoadInfo load, VisualizerModel model, RequestMonitor rm) {
Integer l = null;
-
+
if (load != null) {
l = Integer.valueOf(load.getLoad());
}
-
- // CPU context? Update the correct CPU in the model
+
+ // CPU context? Update the correct CPU in the model
if (context instanceof ICPUDMContext) {
ICPUDMContext cpuContext = (ICPUDMContext) context;
VisualizerCPU cpu = model.getCPU(Integer.parseInt(cpuContext.getId()));
cpu.setLoadInfo(new VisualizerLoadInfo(l));
}
// Core context? Update the correct core in the model
- else if(context instanceof ICoreDMContext) {
+ else if (context instanceof ICoreDMContext) {
ICoreDMContext coreContext = (ICoreDMContext) context;
VisualizerCore core = model.getCore(Integer.parseInt(coreContext.getId()));
core.setLoadInfo(new VisualizerLoadInfo(l));
}
-
+
rm.done();
}
-
+
private Timer getLoadTimer(final DSFSessionState sessionState, final int timeout) {
Timer t = new Timer(timeout) {
@Override
@@ -1546,4 +1496,3 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
return t;
}
}
-
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerCPU.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerCPU.java
index a8b94943590..d90a5cd9be3 100755
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerCPU.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerCPU.java
@@ -27,38 +27,35 @@ import org.eclipse.swt.graphics.GC;
/**
* Graphic object for MulticoreVisualizer.
*/
-public class MulticoreVisualizerCPU extends MulticoreVisualizerGraphicObject
-{
+public class MulticoreVisualizerCPU extends MulticoreVisualizerGraphicObject {
// --- members ---
-
+
/** CPU ID. */
protected int m_id;
-
+
/** Child cores. */
protected ArrayList<MulticoreVisualizerCore> m_cores;
-
+
/** Load meter associated to this CPU */
protected MulticoreVisualizerLoadMeter m_loadMeter;
-
+
/** Background color used to draw cpu */
protected static final Color BG_COLOR = IMulticoreVisualizerConstants.COLOR_CPU_BG;
-
+
/** Foreground coloe used to draw cpu */
protected static final Color FG_COLOR = IMulticoreVisualizerConstants.COLOR_CPU_FG;
-
// --- constructors/destructors ---
-
+
/** Constructor */
- public MulticoreVisualizerCPU(int id)
- {
+ public MulticoreVisualizerCPU(int id) {
m_id = id;
m_cores = new ArrayList<MulticoreVisualizerCore>();
-
+
// default load meter
m_loadMeter = new MulticoreVisualizerLoadMeter(null, null);
}
-
+
/** Dispose method */
@Override
public void dispose() {
@@ -67,85 +64,78 @@ public class MulticoreVisualizerCPU extends MulticoreVisualizerGraphicObject
m_loadMeter.dispose();
}
}
-
-
+
// --- accessors ---
-
+
/** Gets CPU ID. */
public int getID() {
return m_id;
}
-
// --- methods ---
-
+
/** Adds child core. */
- public void addCore(MulticoreVisualizerCore core)
- {
+ public void addCore(MulticoreVisualizerCore core) {
m_cores.add(core);
}
-
+
/** Removes child core. */
- public void removeCore(MulticoreVisualizerCore core)
- {
+ public void removeCore(MulticoreVisualizerCore core) {
m_cores.remove(core);
}
-
+
/** Gets list of child cores. */
- public List<MulticoreVisualizerCore> getCores()
- {
+ public List<MulticoreVisualizerCore> getCores() {
return m_cores;
}
/** Sets the load meter associated to this CPU */
- public void setLoadMeter (MulticoreVisualizerLoadMeter meter) {
+ public void setLoadMeter(MulticoreVisualizerLoadMeter meter) {
m_loadMeter = meter;
}
-
+
/** Gets the load meter associated to this CPU */
public MulticoreVisualizerLoadMeter getLoadMeter() {
return m_loadMeter;
}
-
+
// --- paint methods ---
-
+
/** Invoked to allow element to paint itself on the viewer canvas */
@Override
public void paintContent(GC gc) {
gc.setBackground(BG_COLOR);
-
+
// We want the load meter to share the same BG color
m_loadMeter.setParentBgColor(BG_COLOR);
-
+
// highlight in a different color if selected
- if (m_selected)
- {
+ if (m_selected) {
gc.setForeground(IMulticoreVisualizerConstants.COLOR_SELECTED);
- }
- else {
+ } else {
gc.setForeground(FG_COLOR);
}
gc.fillRectangle(m_bounds);
gc.drawRectangle(m_bounds);
}
-
+
/** Returns true if object has decorations to paint. */
@Override
public boolean hasDecorations() {
return true;
}
-
+
/** Invoked to allow element to paint decorations on top of anything drawn on it */
@Override
public void paintDecorations(GC gc) {
if (m_bounds.height > 20) {
gc.setForeground(IMulticoreVisualizerConstants.COLOR_CPU_FG);
gc.setBackground(IMulticoreVisualizerConstants.COLOR_CPU_BG);
-
+
int text_indent_x = 2;
int text_indent_y = 0;
- int tx = m_bounds.x + m_bounds.width - text_indent_x;
+ int tx = m_bounds.x + m_bounds.width - text_indent_x;
int ty = m_bounds.y + m_bounds.height - text_indent_y;
GUIUtils.drawTextAligned(gc, Integer.toString(m_id), m_bounds, tx, ty, false, false);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerCanvas.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerCanvas.java
index 24284192351..367d001c54d 100755
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerCanvas.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerCanvas.java
@@ -10,7 +10,7 @@
*
* Contributors:
* William R. Swanson (Tilera Corporation) - initial API and implementation
- * Marc Dumais (Ericsson) - Bug 396076
+ * Marc Dumais (Ericsson) - Bug 396076
* Marc Dumais (Ericsson) - Bug 396184
* Marc Dumais (Ericsson) - Bug 396200
* Marc Dumais (Ericsson) - Bug 396293
@@ -54,74 +54,68 @@ import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Composite;
-
/**
* MulticoreVisualizer's display canvas.
*/
-public class MulticoreVisualizerCanvas extends GraphicCanvas
- implements ISelectionProvider
-{
+public class MulticoreVisualizerCanvas extends GraphicCanvas implements ISelectionProvider {
// --- constants ---
/** Canvas update interval in milliseconds. */
protected static final int CANVAS_UPDATE_INTERVAL = 100;
-
+
/** Spacing to allow between threads, when many are displayed on same tile. */
protected static final int THREAD_SPACING = 8;
-
+
protected static final int SELECTION_SLOP = 20;
-
// --- members ---
-
+
/** Update timer */
protected Timer m_updateTimer = null;
-
+
/** Whether we need to recache graphic objects. */
protected boolean m_recache = true;
-
+
/** Whether we need to recache objects that depend on target state */
protected boolean m_recacheState = true;
-
+
/** Whether view size has changed, requiring us to recalculate object sizes */
protected boolean m_recacheSizes = true;
-
+
/** Whether the load information has changed and we need to update the load meters */
protected boolean m_recacheLoadMeters = true;
-
+
/** Whether we need to repaint the canvas */
protected boolean m_update = true;
-
// --- UI members ---
-
+
/** Text font */
protected Font m_textFont = null;
-
+
/** Externally visible selection manager. */
protected SelectionManager m_selectionManager;
- /** Mouse-drag marquee graphic element */
- protected MulticoreVisualizerMarquee m_marquee = null;
-
- /** Last mouse down/up point, for shift-click selections. */
- protected Point m_lastSelectionClick = new Point(0,0);
-
+ /** Mouse-drag marquee graphic element */
+ protected MulticoreVisualizerMarquee m_marquee = null;
+
+ /** Last mouse down/up point, for shift-click selections. */
+ protected Point m_lastSelectionClick = new Point(0, 0);
+
/** Mouse click/drag monitor */
- protected MouseMonitor m_mouseMonitor = null;
-
+ protected MouseMonitor m_mouseMonitor = null;
// --- cached repaint state ---
-
+
/** Current visualizer model we're displaying. */
protected VisualizerModel m_model = null;
-
+
/** Number of CPUs to display. */
protected int m_cpu_count = 15;
-
+
/** Number of Cores per CPU to display. */
protected int m_cores_per_cpu = 3;
-
+
/** List of CPUs we're displaying. */
protected ArrayList<MulticoreVisualizerCPU> m_cpus = null;
/** Mapping from model to view objects. */
@@ -131,29 +125,29 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
protected ArrayList<MulticoreVisualizerCore> m_cores = null;
/** Mapping from model to view objects. */
protected Hashtable<VisualizerCore, MulticoreVisualizerCore> m_coreMap = null;
-
+
/** Graphic objects representing threads */
protected ArrayList<MulticoreVisualizerThread> m_threads = null;
/** Mapping from model to view objects. */
protected Hashtable<VisualizerThread, MulticoreVisualizerThread> m_threadMap = null;
-
+
/** Selected PIDs. */
protected HashSet<Integer> m_selectedPIDs = null;
-
+
/** Canvas filter manager */
protected MulticoreVisualizerCanvasFilterManager m_canvasFilterManager = null;
-
+
/** Canvas status bar */
protected MulticoreVisualizerStatusBar m_statusBar = null;
// --- constructors/destructors ---
-
+
/** Constructor. */
public MulticoreVisualizerCanvas(Composite parent) {
super(parent);
initMulticoreVisualizerCanvas(parent);
}
-
+
/** Dispose method. */
@Override
public void dispose() {
@@ -161,29 +155,28 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
super.dispose();
}
-
// --- init methods ---
-
+
/** Initializes control */
protected void initMulticoreVisualizerCanvas(Composite parent) {
// perform any initialization here
-
+
// text font
m_textFont = CDTVisualizerUIPlugin.getResources().getFont("Luxi Sans", 6); //$NON-NLS-1$
setFont(m_textFont);
-
+
// initialize cached state storage
- m_cpus = new ArrayList<MulticoreVisualizerCPU>();
- m_cpuMap = new Hashtable<VisualizerCPU, MulticoreVisualizerCPU>();
-
- m_cores = new ArrayList<MulticoreVisualizerCore>();
- m_coreMap = new Hashtable<VisualizerCore, MulticoreVisualizerCore>();
-
- m_threads = new ArrayList<MulticoreVisualizerThread>();
- m_threadMap = new Hashtable<VisualizerThread, MulticoreVisualizerThread>();
-
+ m_cpus = new ArrayList<MulticoreVisualizerCPU>();
+ m_cpuMap = new Hashtable<VisualizerCPU, MulticoreVisualizerCPU>();
+
+ m_cores = new ArrayList<MulticoreVisualizerCore>();
+ m_coreMap = new Hashtable<VisualizerCore, MulticoreVisualizerCore>();
+
+ m_threads = new ArrayList<MulticoreVisualizerThread>();
+ m_threadMap = new Hashtable<VisualizerThread, MulticoreVisualizerThread>();
+
m_selectedPIDs = new HashSet<Integer>();
-
+
// mouse-drag monitor
m_mouseMonitor = new MouseMonitor(this) {
/** Invoked for a selection click at the specified point. */
@@ -202,7 +195,7 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
@Override
public void mouseDown(int button, int x, int y, int keys) {
if (button == RIGHT_BUTTON) {
- if (! hasSelection()) {
+ if (!hasSelection()) {
// If there isn't a selection currently, try to
// select item(s) under the mouse before popping up the context menu.
MulticoreVisualizerCanvas.this.select(x, y, keys);
@@ -218,13 +211,13 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
}
}
};
-
+
// selection marquee
m_marquee = new MulticoreVisualizerMarquee();
// selection manager
m_selectionManager = new SelectionManager(this, "MulticoreVisualizerCanvas selection manager"); //$NON-NLS-1$
-
+
// add update timer
m_updateTimer = new Timer(CANVAS_UPDATE_INTERVAL) {
@Override
@@ -234,104 +227,99 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
};
m_updateTimer.setRepeating(false); // one-shot timer
m_updateTimer.start();
-
+
// filter manager
m_canvasFilterManager = new MulticoreVisualizerCanvasFilterManager(this);
-
+
// status bar
m_statusBar = new MulticoreVisualizerStatusBar();
}
-
+
/** Cleans up control */
protected void cleanupMulticoreVisualizerCanvas() {
if (m_updateTimer != null) {
m_updateTimer.dispose();
m_updateTimer = null;
}
- if (m_marquee != null) {
- m_marquee.dispose();
- m_marquee = null;
- }
- if (m_mouseMonitor != null) {
- m_mouseMonitor.dispose();
- m_mouseMonitor = null;
- }
- if (m_selectionManager != null) {
- m_selectionManager.dispose();
- m_selectionManager = null;
- }
- if (m_cpus != null) {
- m_cpus.clear();
- m_cpus = null;
- }
- if (m_cpuMap != null) {
- m_cpuMap.clear();
- m_cpuMap = null;
- }
- if (m_cores != null) {
- m_cores.clear();
- m_cores = null;
- }
- if (m_coreMap != null) {
- m_coreMap.clear();
- m_coreMap = null;
- }
- if (m_threads != null) {
- m_threads.clear();
- m_threads = null;
- }
- if (m_threadMap != null) {
- m_threadMap.clear();
- m_threadMap = null;
- }
- if (m_selectedPIDs != null) {
- m_selectedPIDs.clear();
- m_selectedPIDs = null;
- }
- if (m_canvasFilterManager != null) {
- m_canvasFilterManager.dispose();
- m_canvasFilterManager = null;
- }
- if (m_statusBar != null) {
- m_statusBar.dispose();
- m_statusBar = null;
- }
+ if (m_marquee != null) {
+ m_marquee.dispose();
+ m_marquee = null;
+ }
+ if (m_mouseMonitor != null) {
+ m_mouseMonitor.dispose();
+ m_mouseMonitor = null;
+ }
+ if (m_selectionManager != null) {
+ m_selectionManager.dispose();
+ m_selectionManager = null;
+ }
+ if (m_cpus != null) {
+ m_cpus.clear();
+ m_cpus = null;
+ }
+ if (m_cpuMap != null) {
+ m_cpuMap.clear();
+ m_cpuMap = null;
+ }
+ if (m_cores != null) {
+ m_cores.clear();
+ m_cores = null;
+ }
+ if (m_coreMap != null) {
+ m_coreMap.clear();
+ m_coreMap = null;
+ }
+ if (m_threads != null) {
+ m_threads.clear();
+ m_threads = null;
+ }
+ if (m_threadMap != null) {
+ m_threadMap.clear();
+ m_threadMap = null;
+ }
+ if (m_selectedPIDs != null) {
+ m_selectedPIDs.clear();
+ m_selectedPIDs = null;
+ }
+ if (m_canvasFilterManager != null) {
+ m_canvasFilterManager.dispose();
+ m_canvasFilterManager = null;
+ }
+ if (m_statusBar != null) {
+ m_statusBar.dispose();
+ m_statusBar = null;
+ }
}
-
// --- accessors ---
-
+
/** Gets currently displayed model. */
- public VisualizerModel getModel()
- {
+ public VisualizerModel getModel() {
return m_model;
}
-
+
/** Sets model to display, and requests canvas update. */
- public void setModel(VisualizerModel model)
- {
+ public void setModel(VisualizerModel model) {
m_model = model;
-
+
// Set filter associated to new model
if (m_model != null) {
m_canvasFilterManager.setCurrentFilter(m_model.getSessionId());
- }
- else {
+ } else {
m_canvasFilterManager.setCurrentFilter(null);
}
-
+
requestRecache();
requestUpdate();
}
-
+
/** Requests that next paint call should update the load meters */
public void refreshLoadMeters() {
requestRecache(false, false, true);
}
-
-
+
// --- resize methods ---
-
+
/** Invoked when control is resized. */
@Override
public void resized(Rectangle bounds) {
@@ -339,25 +327,26 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
// note: resize itself will trigger an update, so we don't have to request one
}
-
// --- update methods ---
-
+
/**
* Requests an update on next timer tick.
* NOTE: use this method instead of normal update(),
* multiple update requests on same tick are batched.
*/
public void requestUpdate() {
- GUIUtils.exec(new Runnable() { @Override public void run() {
- if (m_updateTimer != null) {
- m_updateTimer.start();
+ GUIUtils.exec(new Runnable() {
+ @Override
+ public void run() {
+ if (m_updateTimer != null) {
+ m_updateTimer.start();
+ }
}
- }});
+ });
}
-
// --- paint methods ---
-
+
/** Requests that next paint call should recache state and/or size information */
// synchronized so we don't change recache flags while doing a recache
public synchronized void requestRecache() {
@@ -369,7 +358,7 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
public synchronized void requestRecache(boolean state, boolean sizes) {
requestRecache(state, sizes, true);
}
-
+
/**
* Requests that the next paint call should recache state and/or size and/or load information
*/
@@ -385,11 +374,11 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
// re-compute filter to reflect latest model changes
m_canvasFilterManager.updateCurrentFilter();
}
-
- /**
+
+ /**
* Fits n square items into a rectangle of the specified size.
* Returns largest edge of one of the square items that allows
- * them all to pack neatly in rows/columns in the specified area.
+ * them all to pack neatly in rows/columns in the specified area.
*/
public int fitSquareItems(int nitems, int width, int height) {
int max_edge = 0;
@@ -399,40 +388,44 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
int w = width / items_per_row;
int h = height / rows;
int edge = (w < h) ? w : h;
- if (edge * rows > height || edge * items_per_row > width) continue;
- if (edge > max_edge) max_edge = edge;
+ if (edge * rows > height || edge * items_per_row > width)
+ continue;
+ if (edge > max_edge)
+ max_edge = edge;
}
- }
- else {
+ } else {
for (int items_per_col = nitems; items_per_col > 0; --items_per_col) {
int cols = (int) Math.ceil(1.0 * nitems / items_per_col);
int w = width / cols;
int h = height / items_per_col;
int edge = (w < h) ? w : h;
- if (edge * cols > width || edge * items_per_col > height) continue;
- if (edge > max_edge) max_edge = edge;
+ if (edge * cols > width || edge * items_per_col > height)
+ continue;
+ if (edge > max_edge)
+ max_edge = edge;
}
}
return max_edge;
}
-
+
/**
* Allows overriding classes to change this behavior.
*/
protected boolean getCPULoadEnabled() {
return m_model == null ? false : m_model.getLoadMetersEnabled();
}
-
+
/** Recache persistent objects (tiles, etc.) for new monitor */
// synchronized so we don't change recache flags while doing a recache
public synchronized void recache() {
- if (! m_recache) return; // nothing to do, free the lock quickly
+ if (!m_recache)
+ return; // nothing to do, free the lock quickly
if (m_recacheState) {
// clear all grid view objects
clear();
-
+
// clear cached state
m_cpus.clear();
m_cores.clear();
@@ -440,17 +433,17 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
m_cpuMap.clear();
m_coreMap.clear();
m_threadMap.clear();
-
+
if (m_model != null) {
for (VisualizerCPU cpu : m_model.getCPUs()) {
- // current filter permits displaying this CPU?
+ // current filter permits displaying this CPU?
if (m_canvasFilterManager.displayObject(cpu)) {
MulticoreVisualizerCPU mcpu = new MulticoreVisualizerCPU(cpu.getID());
m_cpus.add(mcpu);
m_cpuMap.put(cpu, mcpu);
for (VisualizerCore core : cpu.getCores()) {
// current filter permits displaying this core?
- if(m_canvasFilterManager.displayObject(core)) {
+ if (m_canvasFilterManager.displayObject(core)) {
MulticoreVisualizerCore mcore = new MulticoreVisualizerCore(mcpu, core.getID());
m_cores.add(mcore);
m_coreMap.put(core, mcore);
@@ -459,13 +452,13 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
}
}
}
-
+
// we've recached state, which implies recacheing sizes and load meters
m_recacheState = false;
m_recacheLoadMeters = true;
m_recacheSizes = true;
}
-
+
if (m_recacheLoadMeters) {
// refresh the visualizer CPU and core load meters
if (m_model != null) {
@@ -475,7 +468,7 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
MulticoreVisualizerCPU visualizerCpu = m_cpuMap.get(modelCpu);
// when filtering is active, not all objects might be in the map
if (visualizerCpu != null) {
- // update CPUs load meter
+ // update CPUs load meter
MulticoreVisualizerLoadMeter meter = visualizerCpu.getLoadMeter();
meter.setEnabled(getCPULoadEnabled());
meter.setLoad(modelCpu.getLoad());
@@ -495,63 +488,60 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
}
}
}
-
+
m_recacheSizes = true;
m_recacheLoadMeters = false;
}
if (m_recacheSizes) {
// avoid doing resize calculations if the model is not ready
- if (m_model == null ) {
+ if (m_model == null) {
m_recacheSizes = false;
return;
}
// update cached size information
-
+
// General margin/spacing constants.
- int cpu_margin = 8; // margin around edges of CPU grid
- int cpu_separation = 6; // spacing between CPUS
+ int cpu_margin = 8; // margin around edges of CPU grid
+ int cpu_separation = 6; // spacing between CPUS
int statusBarHeight;
// reserve space for status bar only if filter is active
if (isFilterActive()) {
- statusBarHeight = 20;
- }
- else {
- statusBarHeight = 0;
+ statusBarHeight = 20;
+ } else {
+ statusBarHeight = 0;
}
-
+
// make room when load meters are present, else use a more compact layout
- int core_margin = getCPULoadEnabled() ? 20 : 12; // margin around cores in a CPU
- int core_separation = 4; // spacing between cores
+ int core_margin = getCPULoadEnabled() ? 20 : 12; // margin around cores in a CPU
+ int core_separation = 4; // spacing between cores
- int loadMeterWidth = core_margin*3/5;
- int loadMeterHMargin = core_margin/5;
+ int loadMeterWidth = core_margin * 3 / 5;
+ int loadMeterHMargin = core_margin / 5;
int loadMeterHCoreMargin = loadMeterHMargin + 5;
-
+
// Get overall area we have for laying out content.
Rectangle bounds = getClientArea();
GUIUtils.inset(bounds, cpu_margin);
// Figure out area to allocate to each CPU box.
- int ncpus = m_cpus.size();
- int width = bounds.width + cpu_separation;
+ int ncpus = m_cpus.size();
+ int width = bounds.width + cpu_separation;
int height = bounds.height + cpu_separation - statusBarHeight;
-
+
// put status bar at the bottom of the canvas area
- m_statusBar.setBounds(cpu_margin,
- bounds.y + bounds.height - 2 * cpu_margin,
- width ,
- statusBarHeight);
-
+ m_statusBar.setBounds(cpu_margin, bounds.y + bounds.height - 2 * cpu_margin, width, statusBarHeight);
+
int cpu_edge = fitSquareItems(ncpus, width, height);
int cpu_size = cpu_edge - cpu_separation;
- if (cpu_size < 0) cpu_size = 0;
-
+ if (cpu_size < 0)
+ cpu_size = 0;
+
// Calculate area on each CPU for placing cores.
int ncores = 0;
// find the greatest number of cores on a given CPU and use
// that number for size calculations for all CPUs - this way
- // we avoid displaying cores of varying sizes, in different
+ // we avoid displaying cores of varying sizes, in different
// CPUs.
for (MulticoreVisualizerCPU cpu : m_cpus) {
int n = cpu.getCores().size();
@@ -559,33 +549,27 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
ncores = n;
}
}
- int cpu_width = cpu_size - core_margin * 2 + core_separation;
+ int cpu_width = cpu_size - core_margin * 2 + core_separation;
int cpu_height = cpu_size - core_margin * 2 + core_separation;
- int core_edge = fitSquareItems(ncores, cpu_width, cpu_height);
- int core_size = core_edge - core_separation;
- if (core_size < 0) core_size = 0;
-
+ int core_edge = fitSquareItems(ncores, cpu_width, cpu_height);
+ int core_size = core_edge - core_separation;
+ if (core_size < 0)
+ core_size = 0;
+
int x = bounds.x, y = bounds.y;
for (MulticoreVisualizerCPU cpu : m_cpus) {
- cpu.setBounds(x, y, cpu_size-1, cpu_size-1);
+ cpu.setBounds(x, y, cpu_size - 1, cpu_size - 1);
// put cpu meter in the right margin of the CPU
- cpu.getLoadMeter().setBounds(x + cpu_size - 2*cpu_margin,
- y + 2*core_margin,
- loadMeterWidth,
- cpu_size-3*core_margin);
-
+ cpu.getLoadMeter().setBounds(x + cpu_size - 2 * cpu_margin, y + 2 * core_margin, loadMeterWidth,
+ cpu_size - 3 * core_margin);
+
int left = x + core_margin;
int cx = left, cy = y + core_margin;
- for (MulticoreVisualizerCore core : cpu.getCores())
- {
+ for (MulticoreVisualizerCore core : cpu.getCores()) {
core.setBounds(cx, cy, core_size, core_size);
-
- core.getLoadMeter().setBounds(
- cx + core_size - loadMeterHCoreMargin - loadMeterWidth,
- cy + core_size * 1 / 3,
- loadMeterWidth,
- core_size * 2 / 3 - loadMeterHCoreMargin
- );
+
+ core.getLoadMeter().setBounds(cx + core_size - loadMeterHCoreMargin - loadMeterWidth,
+ cy + core_size * 1 / 3, loadMeterWidth, core_size * 2 / 3 - loadMeterHCoreMargin);
cx += core_size + core_separation;
if (cx + core_size + core_margin > x + cpu_size) {
@@ -593,7 +577,7 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
cy += core_size + core_separation;
}
}
-
+
x += cpu_size + cpu_separation;
if (x + cpu_size > bounds.x + width) {
x = bounds.x;
@@ -605,7 +589,7 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
}
m_recache = false;
}
-
+
/** Invoked when canvas repaint event is raised.
* Default implementation clears canvas to background color.
*/
@@ -614,12 +598,12 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
// NOTE: We have a little setup to do first,
// so we delay clearing/redrawing the canvas until needed,
// to minimize any potential visual flickering.
-
+
// recache/resize tiles & shims if needed
recache();
// do any "per frame" updating/replacement of graphic objects
-
+
// recalculate process/thread graphic objects on the fly
// TODO: can we cache/pool these and just move them around?
for (MulticoreVisualizerCore core : m_cores) {
@@ -627,23 +611,22 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
}
m_threads.clear();
m_threadMap.clear();
-
+
// update based on current processes/threads
if (m_model != null) {
-
+
// NOTE: we assume that we've already created and sized the graphic
// objects for cpus/cores in recache() above,
// so we can use these to determine the size/location of more dynamic elements
// like processes and threads
-
+
for (VisualizerThread thread : m_model.getThreads()) {
- // current filter permits displaying this thread?
- if(m_canvasFilterManager.displayObject(thread)) {
+ // current filter permits displaying this thread?
+ if (m_canvasFilterManager.displayObject(thread)) {
VisualizerCore core = thread.getCore();
MulticoreVisualizerCore mcore = m_coreMap.get(core);
if (mcore != null) {
- MulticoreVisualizerThread mthread =
- new MulticoreVisualizerThread(mcore, thread);
+ MulticoreVisualizerThread mthread = new MulticoreVisualizerThread(mcore, thread);
mcore.addThread(mthread);
m_threads.add(mthread);
m_threadMap.put(thread, mthread);
@@ -654,7 +637,7 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
// now set sizes of processes/threads for each tile
for (MulticoreVisualizerCore core : m_cores) {
Rectangle bounds = core.getBounds();
-
+
// how we lay out threads depends on how many there are
List<MulticoreVisualizerThread> threads = core.getThreads();
int threadspotsize = MulticoreVisualizerThread.THREAD_SPOT_SIZE;
@@ -664,14 +647,16 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
int tx = bounds.x + 2;
int ty = bounds.y + 2;
int dty = (count < 1) ? 0 : tileheight / count;
- if (dty > threadheight) dty = threadheight;
+ if (dty > threadheight)
+ dty = threadheight;
if (count > 0 && dty * count <= tileheight) {
ty = bounds.y + 2 + (tileheight - (dty * count)) / 2;
- if (ty < bounds.y + 2) ty = bounds.y + 2;
- }
- else if (count > 0) {
+ if (ty < bounds.y + 2)
+ ty = bounds.y + 2;
+ } else if (count > 0) {
dty = tileheight / count;
- if (dty > threadheight) dty = threadheight;
+ if (dty > threadheight)
+ dty = threadheight;
}
int t = 0;
for (MulticoreVisualizerThread threadobj : threads) {
@@ -680,7 +665,7 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
}
}
}
-
+
// restore canvas object highlighting from model object selection
restoreSelection();
@@ -695,13 +680,13 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
for (MulticoreVisualizerThread mthread : m_threads) {
mthread.setProcessSelected(m_selectedPIDs.contains(mthread.getPID()));
}
-
+
// NOW we can clear the background
clearCanvas(gc);
// Make sure color/font resources are properly initialized.
MulticoreVisualizerUIPlugin.getResources();
-
+
// paint cpus
for (MulticoreVisualizerCPU cpu : m_cpus) {
cpu.paintContent(gc);
@@ -715,7 +700,7 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
core.getLoadMeter().paintContent(gc);
core.getLoadMeter().paintDecorations(gc);
}
-
+
// paint cpus IDs on top of cores
for (MulticoreVisualizerCPU cpu : m_cpus) {
cpu.paintDecorations(gc);
@@ -725,23 +710,21 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
for (MulticoreVisualizerThread thread : m_threads) {
thread.paintContent(gc);
}
-
+
// paint status bar
if (m_canvasFilterManager.isCurrentFilterActive()) {
m_statusBar.setMessage(m_canvasFilterManager.getCurrentFilter().toString());
m_statusBar.paintContent(gc);
}
-
+
// paint drag-selection marquee last, so it's on top.
m_marquee.paintContent(gc);
}
-
-
+
// --- mouse event handlers ---
/** Invoked when mouse is dragged. */
- public void drag(int x, int y, int keys, int dragState)
- {
+ public void drag(int x, int y, int keys, int dragState) {
Rectangle region = m_mouseMonitor.getDragRegion();
switch (dragState) {
case MouseMonitor.MOUSE_DRAG_BEGIN:
@@ -760,47 +743,43 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
boolean addToSelection = MouseMonitor.isShiftDown(keys);
boolean toggleSelection = MouseMonitor.isControlDown(keys);
-
+
selectRegion(m_marquee.getBounds(), addToSelection, toggleSelection);
// remember last mouse-up point for shift-click selection
m_lastSelectionClick.x = x;
m_lastSelectionClick.y = y;
-
+
update();
break;
}
}
/** Invoked for a selection click at the specified point. */
- public void select(int x, int y, int keys)
- {
+ public void select(int x, int y, int keys) {
boolean addToSelection = MouseMonitor.isShiftDown(keys);
boolean toggleSelection = MouseMonitor.isControlDown(keys);
-
- selectPoint(x,y, addToSelection, toggleSelection);
+
+ selectPoint(x, y, addToSelection, toggleSelection);
}
-
// --- selection methods ---
/**
* Selects item(s), if any, in specified region
- *
+ *
* If addToSelection is true, appends item(s) to current selection
* without changing selection state of other items.
- *
+ *
* If toggleSelection is true, toggles selection of item(s)
* without changing selection state of other items.
- *
+ *
* If both are true, deselects item(s)
* without changing selection state of other items.
- *
+ *
* Otherwise, selects item(s) and deselects other items.
*/
- public void selectRegion(Rectangle region,
- boolean addToSelection, boolean toggleSelection)
- {
+ public void selectRegion(Rectangle region, boolean addToSelection, boolean toggleSelection) {
boolean changed = false;
List<MulticoreVisualizerGraphicObject> selectableObjects = getSelectableObjects();
@@ -813,20 +792,17 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
gobj.setSelected(false);
changed = true;
}
- }
- else if (addToSelection) {
+ } else if (addToSelection) {
if (within) {
gobj.setSelected(true);
changed = true;
}
- }
- else if (toggleSelection) {
+ } else if (toggleSelection) {
if (within) {
- gobj.setSelected(! gobj.isSelected());
+ gobj.setSelected(!gobj.isSelected());
changed = true;
}
- }
- else {
+ } else {
gobj.setSelected(within);
changed = true;
}
@@ -835,37 +811,35 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
if (changed)
selectionChanged();
}
-
+
/**
* Selects item(s), if any, at specified point.
- *
+ *
* If addToSelection is true, appends item(s) to current selection
* without changing selection state of other items.
- *
+ *
* If toggleSelection is true, toggles selection of item(s)
* without changing selection state of other items.
- *
+ *
* If both are true, deselects item(s)
* without changing selection state of other items.
- *
+ *
* Otherwise, selects item(s) and deselects other items.
*/
- public void selectPoint(int x, int y,
- boolean addToSelection, boolean toggleSelection)
- {
+ public void selectPoint(int x, int y, boolean addToSelection, boolean toggleSelection) {
List<MulticoreVisualizerGraphicObject> selectedObjects = new ArrayList<MulticoreVisualizerGraphicObject>();
List<MulticoreVisualizerGraphicObject> selectableObjects = getSelectableObjects();
- // the list of selectable objects is ordered to have contained objects
- // before container objects, so the first match we find is the specific
+ // the list of selectable objects is ordered to have contained objects
+ // before container objects, so the first match we find is the specific
// one we want.
for (MulticoreVisualizerGraphicObject gobj : selectableObjects) {
- if (gobj.contains(x,y)) {
+ if (gobj.contains(x, y)) {
selectedObjects.add(gobj);
break;
}
}
-
+
// else we assume it landed outside any CPU; de-select everything
if (selectedObjects.isEmpty()) {
clearSelection();
@@ -877,10 +851,9 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
// overlap the edge of this region)
if (addToSelection) {
int slop = SELECTION_SLOP;
- Rectangle r1 = new Rectangle(m_lastSelectionClick.x - slop/2,
- m_lastSelectionClick.y - slop/2,
- slop, slop);
- Rectangle r2 = new Rectangle(x - slop/2, y - slop/2, slop, slop);
+ Rectangle r1 = new Rectangle(m_lastSelectionClick.x - slop / 2, m_lastSelectionClick.y - slop / 2, slop,
+ slop);
+ Rectangle r2 = new Rectangle(x - slop / 2, y - slop / 2, slop, slop);
Rectangle region = r1.union(r2);
for (MulticoreVisualizerGraphicObject gobj : selectableObjects) {
@@ -900,20 +873,17 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
gobj.setSelected(false);
changed = true;
}
- }
- else if (addToSelection) {
+ } else if (addToSelection) {
if (within) {
gobj.setSelected(true);
changed = true;
}
- }
- else if (toggleSelection) {
+ } else if (toggleSelection) {
if (within) {
- gobj.setSelected(! gobj.isSelected());
+ gobj.setSelected(!gobj.isSelected());
changed = true;
}
- }
- else {
+ } else {
gobj.setSelected(within);
changed = true;
}
@@ -926,14 +896,11 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
m_lastSelectionClick.x = x;
m_lastSelectionClick.y = y;
}
-
-
-
+
// --- selection management methods ---
-
+
/** Selects all items in the canvas. */
- public void selectAll()
- {
+ public void selectAll() {
List<MulticoreVisualizerGraphicObject> selectableObjects = getSelectableObjects();
for (MulticoreVisualizerGraphicObject gobj : selectableObjects) {
@@ -954,7 +921,7 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
selectionChanged();
}
-
+
/** Things to do whenever the selection changes. */
protected void selectionChanged() {
selectionChanged(true);
@@ -972,7 +939,7 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
protected void updateSelection(boolean raiseEvent) {
// get model objects (if any) corresponding to canvas selection
HashSet<Object> selectedObjects = new HashSet<Object>();
-
+
// threads
if (m_threads != null) {
for (MulticoreVisualizerThread tobj : m_threads) {
@@ -981,7 +948,7 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
}
}
}
-
+
// cpus and cores
if (m_model != null) {
for (VisualizerCPU modelCpu : m_model.getCPUs()) {
@@ -997,31 +964,29 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
}
}
}
-
+
// update model object selection
ISelection selection = SelectionUtils.toSelection(selectedObjects);
setSelection(selection, raiseEvent);
}
-
+
/** Restores current selection from saved list of model objects. */
protected void restoreSelection() {
ISelection selection = getSelection();
List<Object> selectedObjects = SelectionUtils.getSelectedObjects(selection);
-
+
for (Object modelObj : selectedObjects) {
if (modelObj instanceof VisualizerThread) {
MulticoreVisualizerThread thread = m_threadMap.get(modelObj);
if (thread != null) {
thread.setSelected(true);
}
- }
- else if (modelObj instanceof VisualizerCore) {
+ } else if (modelObj instanceof VisualizerCore) {
MulticoreVisualizerCore core = m_coreMap.get(modelObj);
if (core != null) {
core.setSelected(true);
}
- }
- else if (modelObj instanceof VisualizerCPU) {
+ } else if (modelObj instanceof VisualizerCPU) {
MulticoreVisualizerCPU cpu = m_cpuMap.get(modelObj);
if (cpu != null) {
cpu.setSelected(true);
@@ -1029,26 +994,25 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
}
}
}
-
- /**
+
+ /**
* Gets the current list of selectable objects. The list is ordered by object type,
* so that more specific objects will appear first, followed by enclosing objects.
- * For instance, threads are before cores and cores before CPUs.
+ * For instance, threads are before cores and cores before CPUs.
*/
- protected List<MulticoreVisualizerGraphicObject> getSelectableObjects () {
- List<MulticoreVisualizerGraphicObject> selectableObjects = new ArrayList<MulticoreVisualizerGraphicObject>();
+ protected List<MulticoreVisualizerGraphicObject> getSelectableObjects() {
+ List<MulticoreVisualizerGraphicObject> selectableObjects = new ArrayList<MulticoreVisualizerGraphicObject>();
selectableObjects.addAll(m_threads);
selectableObjects.addAll(m_cores);
selectableObjects.addAll(m_cpus);
-
+
return selectableObjects;
- }
-
-
+ }
+
// --- ISelectionProvider implementation ---
-
+
// Delegate to selection manager.
-
+
/** Adds external listener for selection change events. */
@Override
public void addSelectionChangedListener(ISelectionChangedListener listener) {
@@ -1062,61 +1026,56 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
m_selectionManager.removeSelectionChangedListener(listener);
}
}
-
+
/** Raises selection changed event. */
public void raiseSelectionChangedEvent() {
m_selectionManager.raiseSelectionChangedEvent();
}
-
+
/** Returns true if we have a selection. */
- public boolean hasSelection()
- {
+ public boolean hasSelection() {
return m_selectionManager.hasSelection();
}
-
+
/** Gets current externally-visible selection. */
@Override
- public ISelection getSelection()
- {
+ public ISelection getSelection() {
return m_selectionManager.getSelection();
}
-
+
/** Sets externally-visible selection. */
@Override
- public void setSelection(ISelection selection)
- {
+ public void setSelection(ISelection selection) {
setSelection(selection, true);
}
-
+
/** Sets externally-visible selection. */
- public void setSelection(ISelection selection, boolean raiseEvent)
- {
+ public void setSelection(ISelection selection, boolean raiseEvent) {
m_selectionManager.setSelection(selection, raiseEvent);
requestUpdate();
}
-
- /** Sets whether selection events are enabled. */
- public void setSelectionEventsEnabled(boolean enabled) {
- m_selectionManager.setSelectionEventsEnabled(enabled);
- }
-
-
- // --- canvas filter methods ---
-
- /** Set-up a canvas white-list filter. */
- public void applyFilter() {
- m_canvasFilterManager.applyFilter();
- }
-
- /** Removes the canvas filter currently in place */
- public void clearFilter() {
- m_canvasFilterManager.clearFilter();
- }
-
- /** Tells if a canvas filter is currently in place */
- public boolean isFilterActive() {
- return m_canvasFilterManager.isCurrentFilterActive();
- }
+
+ /** Sets whether selection events are enabled. */
+ public void setSelectionEventsEnabled(boolean enabled) {
+ m_selectionManager.setSelectionEventsEnabled(enabled);
+ }
+
+ // --- canvas filter methods ---
+
+ /** Set-up a canvas white-list filter. */
+ public void applyFilter() {
+ m_canvasFilterManager.applyFilter();
+ }
+
+ /** Removes the canvas filter currently in place */
+ public void clearFilter() {
+ m_canvasFilterManager.clearFilter();
+ }
+
+ /** Tells if a canvas filter is currently in place */
+ public boolean isFilterActive() {
+ return m_canvasFilterManager.isCurrentFilterActive();
+ }
@Override
public IGraphicObject getGraphicObject(Class<?> type, int x, int y) {
@@ -1126,7 +1085,8 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
if (gobj.contains(x, y)) {
if (type != null) {
Class<?> objType = gobj.getClass();
- if (! type.isAssignableFrom(objType)) continue;
+ if (!type.isAssignableFrom(objType))
+ continue;
}
result = gobj;
break;
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerCanvasFilter.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerCanvasFilter.java
index 362d07170a5..93283d006e2 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerCanvasFilter.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerCanvasFilter.java
@@ -27,66 +27,65 @@ import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.model.VisualizerT
import org.eclipse.cdt.visualizer.ui.util.SelectionUtils;
import org.eclipse.jface.viewers.ISelection;
-
/**
- * White-list Filter for the graphical objects displayed in the multicore
- * visualizer canvas.
+ * White-list Filter for the graphical objects displayed in the multicore
+ * visualizer canvas.
*/
public class MulticoreVisualizerCanvasFilter {
-
- /** white list of objects on which the filter is based */
+
+ /** white list of objects on which the filter is based */
List<IVisualizerModelObject> m_filterList = null;
-
- /**
+
+ /**
* the dynamically expanded list, containing elements in the
* white list and their parents - recalculated as required
- * since some elements can move around and change parent
+ * since some elements can move around and change parent
*/
List<IVisualizerModelObject> m_dynamicFilterList = null;
-
+
/** reference to the canvas */
private MulticoreVisualizerCanvas m_canvas = null;
-
+
/** whether the filter is active */
- private boolean m_filterActive = false;
-
+ private boolean m_filterActive = false;
+
/** counter that reflects the number of CPUs shown once the filter is applied */
private int m_shownCpu = 0;
-
+
/** counter that reflects the number of cores shown once the filter is applied */
private int m_shownCore = 0;
-
+
/** counter that reflects the number of threads shown once the filter is applied */
private int m_shownThread = 0;
-
+
/** total number of CPUs in the current MV model */
private int m_totalCpu = 0;
-
+
/** total number of cores in the current MV model */
private int m_totalCore = 0;
-
+
/** total number of threads in the current MV model */
private int m_totalThread = 0;
-
+
/** String constant used to denote that the filter is not active */
- private static final String STR_FILTER_NOT_ACTIVE =
- MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.view.CanvasFilter.NotActive.text"); //$NON-NLS-1$
-
+ private static final String STR_FILTER_NOT_ACTIVE = MulticoreVisualizerUIPlugin
+ .getString("MulticoreVisualizer.view.CanvasFilter.NotActive.text"); //$NON-NLS-1$
+
/** String constant used to denote that the filter is active */
- private static final String STR_FILTER_ACTIVE =
- MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.view.CanvasFilter.Active.text"); //$NON-NLS-1$
-
+ private static final String STR_FILTER_ACTIVE = MulticoreVisualizerUIPlugin
+ .getString("MulticoreVisualizer.view.CanvasFilter.Active.text"); //$NON-NLS-1$
+
/** String constant used to represent CPUs */
- private static final String STR_CPU =
- MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.view.CanvasFilter.cpu.text"); //$NON-NLS-1$
-
+ private static final String STR_CPU = MulticoreVisualizerUIPlugin
+ .getString("MulticoreVisualizer.view.CanvasFilter.cpu.text"); //$NON-NLS-1$
+
/** String constant used to represent cores */
- private static final String STR_CORE =
- MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.view.CanvasFilter.core.text"); //$NON-NLS-1$
-
+ private static final String STR_CORE = MulticoreVisualizerUIPlugin
+ .getString("MulticoreVisualizer.view.CanvasFilter.core.text"); //$NON-NLS-1$
+
/** String constant used to represent threads */
- private static final String STR_THREAD =
- MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.view.CanvasFilter.thread.text"); //$NON-NLS-1$
+ private static final String STR_THREAD = MulticoreVisualizerUIPlugin
+ .getString("MulticoreVisualizer.view.CanvasFilter.thread.text"); //$NON-NLS-1$
// --- constructors/destructors ---
@@ -94,123 +93,120 @@ public class MulticoreVisualizerCanvasFilter {
public MulticoreVisualizerCanvasFilter(MulticoreVisualizerCanvas canvas) {
m_canvas = canvas;
}
-
+
/** Dispose method */
public void dispose() {
clearFilter();
m_canvas = null;
}
-
// --- filter methods ---
-
+
/**
- * Sets-up a canvas white-list filter from the current canvas selection.
- * Any applicable selected objects are added to the filter.
- */
- public void applyFilter() {
- // replace current filter? Clear old one first.
- if (isFilterActive()) {
- clearFilter();
- }
-
- m_filterList = new ArrayList<IVisualizerModelObject>();
- m_dynamicFilterList = new ArrayList<IVisualizerModelObject>();
-
- m_filterActive = true;
-
- // get list of selected objects the filter applies-for
- ISelection selection = m_canvas.getSelection();
- List<Object> selectedObjects = SelectionUtils.getSelectedObjects(selection);
-
- for (Object obj : selectedObjects) {
- if (obj instanceof IVisualizerModelObject) {
- m_filterList.add((IVisualizerModelObject)obj);
- }
- }
- }
-
+ * Sets-up a canvas white-list filter from the current canvas selection.
+ * Any applicable selected objects are added to the filter.
+ */
+ public void applyFilter() {
+ // replace current filter? Clear old one first.
+ if (isFilterActive()) {
+ clearFilter();
+ }
+
+ m_filterList = new ArrayList<IVisualizerModelObject>();
+ m_dynamicFilterList = new ArrayList<IVisualizerModelObject>();
+
+ m_filterActive = true;
+
+ // get list of selected objects the filter applies-for
+ ISelection selection = m_canvas.getSelection();
+ List<Object> selectedObjects = SelectionUtils.getSelectedObjects(selection);
+
+ for (Object obj : selectedObjects) {
+ if (obj instanceof IVisualizerModelObject) {
+ m_filterList.add((IVisualizerModelObject) obj);
+ }
+ }
+ }
+
/** Removes any canvas filter currently in place */
public void clearFilter() {
if (m_filterList != null) {
m_filterList.clear();
m_filterList = null;
}
-
+
if (m_dynamicFilterList != null) {
m_dynamicFilterList.clear();
m_dynamicFilterList = null;
}
resetCounters();
m_filterActive = false;
-
+
}
/** returns whether a canvas filter is currently in place */
public boolean isFilterActive() {
return m_filterActive;
}
-
- /**
- * Updates the dynamic filter so it contains the up-to-date parent objects
- */
- public void updateFilter() {
- if (m_filterList == null || m_canvas == null)
- return;
-
- VisualizerModel model = m_canvas.getModel();
-
- resetCounters();
- m_dynamicFilterList.clear();
-
- for (IVisualizerModelObject elem : m_filterList) {
- // element still in current model?
- if (isElementInCurrentModel(elem)) {
- // add element to list
- addElementToFilterList(elem);
-
- // also add all its ancestors
- IVisualizerModelObject parent;
-
- // Bug 407673 - if element is a thread, lookup the parent (core)
- // from the current model, to be sure it's up-to-date
- if (elem instanceof VisualizerThread && model != null) {
- parent = model.getThread(((VisualizerThread) elem).getGDBTID()).getParent();
- }
- else {
- parent = elem.getParent();
- }
- while (parent != null) {
- addElementToFilterList(parent);
- parent = parent.getParent();
- }
- }
- }
- }
/**
- * returns whether a candidate model object should be displayed,
- * according to the current filter.
+ * Updates the dynamic filter so it contains the up-to-date parent objects
+ */
+ public void updateFilter() {
+ if (m_filterList == null || m_canvas == null)
+ return;
+
+ VisualizerModel model = m_canvas.getModel();
+
+ resetCounters();
+ m_dynamicFilterList.clear();
+
+ for (IVisualizerModelObject elem : m_filterList) {
+ // element still in current model?
+ if (isElementInCurrentModel(elem)) {
+ // add element to list
+ addElementToFilterList(elem);
+
+ // also add all its ancestors
+ IVisualizerModelObject parent;
+
+ // Bug 407673 - if element is a thread, lookup the parent (core)
+ // from the current model, to be sure it's up-to-date
+ if (elem instanceof VisualizerThread && model != null) {
+ parent = model.getThread(((VisualizerThread) elem).getGDBTID()).getParent();
+ } else {
+ parent = elem.getParent();
+ }
+ while (parent != null) {
+ addElementToFilterList(parent);
+ parent = parent.getParent();
+ }
+ }
+ }
+ }
+
+ /**
+ * returns whether a candidate model object should be displayed,
+ * according to the current filter.
*/
public boolean displayObject(final IVisualizerModelObject candidate) {
- // filter not active? Let anything be displayed
+ // filter not active? Let anything be displayed
if (!m_filterActive) {
return true;
}
-
- // Candidate is in white list?
+
+ // Candidate is in white list?
if (isElementInFilterList(candidate)) {
return true;
}
-
+
return false;
}
-
-
+
// --- filter list management ---
-
+
/**
- * Adds an element to the dynamic filter list, if an equivalent
+ * Adds an element to the dynamic filter list, if an equivalent
* element is not already in there.
*/
private void addElementToFilterList(final IVisualizerModelObject elem) {
@@ -219,24 +215,23 @@ public class MulticoreVisualizerCanvasFilter {
stepStatsCounter(elem);
}
}
-
+
/**
- * Returns whether an element already has an equivalent in the
+ * Returns whether an element already has an equivalent in the
* dynamic filter list.
*/
private boolean isElementInFilterList(final IVisualizerModelObject candidate) {
// is the candidate in the dynamic filter list?
for (IVisualizerModelObject elem : m_dynamicFilterList) {
- // Note: we are comparing the content (IDs), not references.
+ // Note: we are comparing the content (IDs), not references.
if (candidate.compareTo(elem) == 0) {
return true;
}
}
return false;
}
-
-
- /** returns whether a model object currently in the filter still exists in
+
+ /** returns whether a model object currently in the filter still exists in
* the current model.
*/
private boolean isElementInCurrentModel(IVisualizerModelObject element) {
@@ -250,8 +245,7 @@ public class MulticoreVisualizerCanvasFilter {
return true;
}
}
- }
- else if (element instanceof VisualizerCore) {
+ } else if (element instanceof VisualizerCore) {
VisualizerCore core = model.getCore(element.getID());
if (core != null) {
// Note: we are comparing the content (IDs), not references.
@@ -259,8 +253,7 @@ public class MulticoreVisualizerCanvasFilter {
return true;
}
}
- }
- else if (element instanceof VisualizerCPU) {
+ } else if (element instanceof VisualizerCPU) {
VisualizerCPU cpu = model.getCPU(element.getID());
if (cpu != null) {
// Note: we are comparing the content (IDs), not references.
@@ -272,24 +265,22 @@ public class MulticoreVisualizerCanvasFilter {
}
return false;
}
-
+
// --- Stats counters ---
-
- /**
- * Steps the filter counters for a given type of model object.
- */
+
+ /**
+ * Steps the filter counters for a given type of model object.
+ */
private void stepStatsCounter(IVisualizerModelObject modelObj) {
if (modelObj instanceof VisualizerCPU) {
m_shownCpu++;
- }
- else if (modelObj instanceof VisualizerCore) {
+ } else if (modelObj instanceof VisualizerCore) {
m_shownCore++;
- }
- else if (modelObj instanceof VisualizerThread) {
+ } else if (modelObj instanceof VisualizerThread) {
m_shownThread++;
}
}
-
+
/** Resets the filter counters */
private void resetCounters() {
m_shownCpu = 0;
@@ -305,27 +296,20 @@ public class MulticoreVisualizerCanvasFilter {
}
}
}
-
/** returns a String giving the current filtering stats */
private String getStats() {
return STR_FILTER_ACTIVE + " " + STR_CPU + " " + m_shownCpu + "/" + m_totalCpu + ", " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
STR_CORE + " " + m_shownCore + "/" + m_totalCore + ", " + //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-1$
- STR_THREAD + " " + m_shownThread + "/" + m_totalThread; //$NON-NLS-1$//$NON-NLS-2$
+ STR_THREAD + " " + m_shownThread + "/" + m_totalThread; //$NON-NLS-1$//$NON-NLS-2$
}
-
+
@Override
public String toString() {
if (isFilterActive()) {
return getStats();
- }
- else {
+ } else {
return STR_FILTER_NOT_ACTIVE;
}
}
}
-
-
-
-
-
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerCanvasFilterManager.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerCanvasFilterManager.java
index 0d739f15871..82ef92bf0d7 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerCanvasFilterManager.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerCanvasFilterManager.java
@@ -21,32 +21,32 @@ import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.cdt.dsf.service.DsfSession.SessionEndedListener;
/**
- * Manages the canvas filters for all current debug sessions.
+ * Manages the canvas filters for all current debug sessions.
*/
public class MulticoreVisualizerCanvasFilterManager implements SessionEndedListener {
- /** map containing the filter lists for different debug sessions */
- private Hashtable<String,MulticoreVisualizerCanvasFilter> m_filterSessionMap = null;
+ /** map containing the filter lists for different debug sessions */
+ private Hashtable<String, MulticoreVisualizerCanvasFilter> m_filterSessionMap = null;
/** reference to the canvas */
private MulticoreVisualizerCanvas m_canvas = null;
-
+
/** filter currently in place */
private MulticoreVisualizerCanvasFilter m_currentFilter = null;
-
+
/** Constructor */
public MulticoreVisualizerCanvasFilterManager(MulticoreVisualizerCanvas canvas) {
- m_filterSessionMap = new Hashtable<String,MulticoreVisualizerCanvasFilter>();
+ m_filterSessionMap = new Hashtable<String, MulticoreVisualizerCanvasFilter>();
m_canvas = canvas;
// add listener to be notified when a debug session ends
DsfSession.addSessionEndedListener(this);
}
-
+
/** dispose method */
public void dispose() {
// remove listener
DsfSession.removeSessionEndedListener(this);
-
+
// dispose of any filter
if (m_filterSessionMap != null) {
for (MulticoreVisualizerCanvasFilter filter : m_filterSessionMap.values()) {
@@ -58,80 +58,79 @@ public class MulticoreVisualizerCanvasFilterManager implements SessionEndedListe
m_canvas = null;
m_currentFilter = null;
}
-
+
/**
- * Returns the filter for a given debug session if it exists, or else
+ * Returns the filter for a given debug session if it exists, or else
* creates a new filter for that session.
*/
public MulticoreVisualizerCanvasFilter getFilter(String sessionId) {
MulticoreVisualizerCanvasFilter filter = null;
// already a filter for this session ?
filter = m_filterSessionMap.get(sessionId);
-
+
// no filter yet for this session? Create one
if (filter == null) {
// create one
filter = new MulticoreVisualizerCanvasFilter(m_canvas);
m_filterSessionMap.put(sessionId, filter);
-
+
}
return filter;
}
-
+
/** Removes the filter in place for a given debug session, if any. */
public void removeFilter(String sessionId) {
if (m_filterSessionMap.containsKey(sessionId)) {
m_filterSessionMap.remove(sessionId);
}
}
-
+
/** Re-computes the current filter to reflect latest model changes */
public void updateCurrentFilter() {
- if( m_currentFilter != null) {
+ if (m_currentFilter != null) {
m_currentFilter.updateFilter();
}
}
-
+
/** Sets-up a filter, based on the current canvas selection */
public void applyFilter() {
- if( m_currentFilter != null) {
+ if (m_currentFilter != null) {
m_currentFilter.applyFilter();
}
}
-
+
/** Clears the current filter */
public void clearFilter() {
- if( m_currentFilter != null) {
+ if (m_currentFilter != null) {
m_currentFilter.clearFilter();
}
}
-
+
/** Sets the current filter for a given model/session */
public void setCurrentFilter(String sessionId) {
if (sessionId == null) {
m_currentFilter = null;
- }
- else {
+ } else {
m_currentFilter = getFilter(sessionId);
}
}
-
+
/** Returns the current filter */
public MulticoreVisualizerCanvasFilter getCurrentFilter() {
return m_currentFilter;
}
-
+
/** Checks if the current filter is active */
public boolean isCurrentFilterActive() {
- if( m_currentFilter != null) {
+ if (m_currentFilter != null) {
return m_currentFilter.isFilterActive();
}
return false;
}
-
+
/** Checks if the current filter permits the display of an object */
public boolean displayObject(final IVisualizerModelObject obj) {
- if( m_currentFilter != null) {
+ if (m_currentFilter != null) {
return m_currentFilter.displayObject(obj);
}
return false;
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerCore.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerCore.java
index 4d4ec0cee32..5f2ab47c33f 100755
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerCore.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerCore.java
@@ -29,35 +29,35 @@ import org.eclipse.swt.graphics.GC;
/**
* MulticoreVisualizer CPU core object.
*/
-public class MulticoreVisualizerCore extends MulticoreVisualizerGraphicObject
-{
+public class MulticoreVisualizerCore extends MulticoreVisualizerGraphicObject {
// --- members ---
-
+
/** Parent CPU. */
protected MulticoreVisualizerCPU m_cpu = null;
-
+
/** Core ID. */
protected int m_id;
-
+
/** List of threads currently on this core. */
protected ArrayList<MulticoreVisualizerThread> m_threads;
-
+
/** Load meter associated to this core */
protected MulticoreVisualizerLoadMeter m_loadMeter;
-
+
// --- constructors/destructors ---
-
+
/** Constructor */
public MulticoreVisualizerCore(MulticoreVisualizerCPU cpu, int id) {
m_cpu = cpu;
- if (m_cpu != null) m_cpu.addCore(this);
+ if (m_cpu != null)
+ m_cpu.addCore(this);
m_id = id;
m_threads = new ArrayList<MulticoreVisualizerThread>();
-
+
// default load meter
m_loadMeter = new MulticoreVisualizerLoadMeter(null, null);
}
-
+
/** Dispose method */
@Override
public void dispose() {
@@ -70,10 +70,9 @@ public class MulticoreVisualizerCore extends MulticoreVisualizerGraphicObject
m_loadMeter.dispose();
}
}
-
-
+
// --- accessors ---
-
+
/** Gets parent CPU. */
public MulticoreVisualizerCPU getCPU() {
return m_cpu;
@@ -84,38 +83,33 @@ public class MulticoreVisualizerCore extends MulticoreVisualizerGraphicObject
return m_id;
}
-
// --- methods ---
-
+
/** Adds child thread. */
- public void addThread(MulticoreVisualizerThread thread)
- {
+ public void addThread(MulticoreVisualizerThread thread) {
m_threads.add(thread);
}
-
+
/** Removes child thread. */
- public void removeThread(MulticoreVisualizerThread thread)
- {
+ public void removeThread(MulticoreVisualizerThread thread) {
m_threads.remove(thread);
}
-
+
/** Removes all child threads. */
- public void removeAllThreads()
- {
+ public void removeAllThreads() {
m_threads.clear();
}
-
+
/** Gets list of child threads. */
- public List<MulticoreVisualizerThread> getThreads()
- {
+ public List<MulticoreVisualizerThread> getThreads() {
return m_threads;
}
-
+
/** Sets the load meter associated to this core */
- public void setLoadMeter (MulticoreVisualizerLoadMeter meter) {
+ public void setLoadMeter(MulticoreVisualizerLoadMeter meter) {
m_loadMeter = meter;
}
-
+
/** Gets the load meter associated to this core */
public MulticoreVisualizerLoadMeter getLoadMeter() {
return m_loadMeter;
@@ -129,7 +123,7 @@ public class MulticoreVisualizerCore extends MulticoreVisualizerGraphicObject
*/
protected VisualizerExecutionState getCoreState() {
VisualizerExecutionState state = VisualizerExecutionState.RUNNING;
-
+
for (MulticoreVisualizerThread thread : m_threads) {
switch (thread.getState()) {
case CRASHED:
@@ -145,53 +139,54 @@ public class MulticoreVisualizerCore extends MulticoreVisualizerGraphicObject
break;
}
}
-
+
return state;
}
-
+
/** Returns core color for current state. */
protected Color getCoreStateColor(boolean foreground) {
VisualizerExecutionState state = getCoreState();
-
+
switch (state) {
case RUNNING:
- if (foreground) return IMulticoreVisualizerConstants.COLOR_RUNNING_CORE_FG;
+ if (foreground)
+ return IMulticoreVisualizerConstants.COLOR_RUNNING_CORE_FG;
return IMulticoreVisualizerConstants.COLOR_RUNNING_CORE_BG;
case SUSPENDED:
- if (foreground) return IMulticoreVisualizerConstants.COLOR_SUSPENDED_CORE_FG;
+ if (foreground)
+ return IMulticoreVisualizerConstants.COLOR_SUSPENDED_CORE_FG;
return IMulticoreVisualizerConstants.COLOR_SUSPENDED_CORE_BG;
case CRASHED:
- if (foreground) return IMulticoreVisualizerConstants.COLOR_CRASHED_CORE_FG;
+ if (foreground)
+ return IMulticoreVisualizerConstants.COLOR_CRASHED_CORE_FG;
return IMulticoreVisualizerConstants.COLOR_CRASHED_CORE_BG;
}
-
+
assert false;
return Colors.BLACK;
}
-
+
// --- paint methods ---
-
+
/** Invoked to allow element to paint itself on the viewer canvas */
@Override
public void paintContent(GC gc) {
Color bg = getCoreStateColor(false);
-
+
gc.setBackground(bg);
// We want the load meter to share the same BG color
m_loadMeter.setParentBgColor(bg);
// highlight in a different color if selected
- if (m_selected)
- {
+ if (m_selected) {
gc.setForeground(IMulticoreVisualizerConstants.COLOR_SELECTED);
- }
- else {
+ } else {
gc.setForeground(getCoreStateColor(true));
}
gc.fillRectangle(m_bounds);
gc.drawRectangle(m_bounds);
-
+
if (m_bounds.height > 16) {
int text_indent = 3;
int tx = m_bounds.x + m_bounds.width - text_indent;
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerEventListener.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerEventListener.java
index 7ea09bd627b..f1e67aa80e0 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerEventListener.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerEventListener.java
@@ -56,33 +56,30 @@ import org.eclipse.cdt.dsf.mi.service.command.events.MISignalEvent;
import org.eclipse.cdt.dsf.service.DsfServiceEventHandler;
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
-
/**
* DSF event listener class for the Multicore Visualizer.
* This class will handle different relevant DSF events
* and update the Multicore Visualizer accordingly.
*/
public class MulticoreVisualizerEventListener {
-
+
private static final String THE_THREAD_ID_DOES_NOT_CONVERT_TO_AN_INTEGER = "The thread id does not convert to an integer: "; //$NON-NLS-1$
- // --- members ---
+ // --- members ---
/** Visualizer we're managing events for. */
protected MulticoreVisualizer fVisualizer;
-
// --- constructors/destructors ---
-
+
/** Constructor */
public MulticoreVisualizerEventListener(MulticoreVisualizer visualizer) {
fVisualizer = visualizer;
}
-
// --- event handlers ---
-
- /**
- * Invoked when a thread or process is suspended.
+
+ /**
+ * Invoked when a thread or process is suspended.
* Updates both state of the thread and the core it's running on
*/
@DsfServiceEventHandler
@@ -94,86 +91,82 @@ public class MulticoreVisualizerEventListener {
}
IDMContext context = event.getDMContext();
-
// all-stop mode? If so, we take the opportunity, now that GDB has suspended
// execution, to re-create the model so that we synchronize with the debug session
- if (context != null && isSessionAllStop(context.getSessionId()) ) {
+ if (context != null && isSessionAllStop(context.getSessionId())) {
fVisualizer.update();
return;
}
-
+
// non-stop mode
if (context instanceof IContainerDMContext) {
- // We don't deal with processes
- } else if (context instanceof IMIExecutionDMContext) {
- // Thread suspended
-
- final IMIExecutionDMContext execDmc = (IMIExecutionDMContext)context;
- IThreadDMContext threadContext =
- DMContexts.getAncestorOfType(execDmc, IThreadDMContext.class);
-
- final DsfServicesTracker tracker =
- new DsfServicesTracker(MulticoreVisualizerUIPlugin.getBundleContext(),
- execDmc.getSessionId());
+ // We don't deal with processes
+ } else if (context instanceof IMIExecutionDMContext) {
+ // Thread suspended
+
+ final IMIExecutionDMContext execDmc = (IMIExecutionDMContext) context;
+ IThreadDMContext threadContext = DMContexts.getAncestorOfType(execDmc, IThreadDMContext.class);
+
+ final DsfServicesTracker tracker = new DsfServicesTracker(MulticoreVisualizerUIPlugin.getBundleContext(),
+ execDmc.getSessionId());
IProcesses procService = tracker.getService(IProcesses.class);
final IStack stackService = tracker.getService(IStack.class);
tracker.dispose();
-
- procService.getExecutionData(threadContext,
- new ImmediateDataRequestMonitor<IThreadDMData>() {
- @Override
- protected void handleSuccess() {
- IThreadDMData data = getData();
-
- // Check whether we know about cores
- if (data instanceof IGdbThreadDMData) {
- String[] cores = ((IGdbThreadDMData)data).getCores();
- if (cores != null) {
- assert cores.length == 1; // A thread belongs to a single core
- int coreId = Integer.parseInt(cores[0]);
- final VisualizerCore vCore = model.getCore(coreId);
-
- int tid;
- VisualizerThread threadTmp = null;
- try {
- tid = Integer.parseInt(execDmc.getThreadId());
- threadTmp = model.getThread(tid);
- } catch (NumberFormatException e) {
- // unable to resolve thread
- assert false : THE_THREAD_ID_DOES_NOT_CONVERT_TO_AN_INTEGER + execDmc.getThreadId();
- return;
- }
-
- if (threadTmp != null) {
- final VisualizerThread thread = threadTmp;
- assert thread.getState() == VisualizerExecutionState.RUNNING;
-
- VisualizerExecutionState _newState = VisualizerExecutionState.SUSPENDED;
-
- if (event.getReason() == StateChangeReason.SIGNAL) {
- if (event instanceof IMIDMEvent) {
- Object miEvent = ((IMIDMEvent)event).getMIEvent();
- if (miEvent instanceof MISignalEvent) {
- String signalName = ((MISignalEvent)miEvent).getName();
- if (DSFDebugModel.isCrashSignal(signalName)) {
- _newState = VisualizerExecutionState.CRASHED;
- }
- }
- }
- }
- final VisualizerExecutionState newState = _newState;
- if (stackService != null) {
- stackService.getTopFrame(execDmc,
- new ImmediateDataRequestMonitor<IFrameDMContext>(null) {
- @Override
- protected void handleCompleted() {
- IFrameDMContext targetFrameContext = null;
- if (isSuccess()) {
- targetFrameContext = getData();
- }
- if (targetFrameContext != null) {
- stackService.getFrameData(targetFrameContext,
+
+ procService.getExecutionData(threadContext, new ImmediateDataRequestMonitor<IThreadDMData>() {
+ @Override
+ protected void handleSuccess() {
+ IThreadDMData data = getData();
+
+ // Check whether we know about cores
+ if (data instanceof IGdbThreadDMData) {
+ String[] cores = ((IGdbThreadDMData) data).getCores();
+ if (cores != null) {
+ assert cores.length == 1; // A thread belongs to a single core
+ int coreId = Integer.parseInt(cores[0]);
+ final VisualizerCore vCore = model.getCore(coreId);
+
+ int tid;
+ VisualizerThread threadTmp = null;
+ try {
+ tid = Integer.parseInt(execDmc.getThreadId());
+ threadTmp = model.getThread(tid);
+ } catch (NumberFormatException e) {
+ // unable to resolve thread
+ assert false : THE_THREAD_ID_DOES_NOT_CONVERT_TO_AN_INTEGER + execDmc.getThreadId();
+ return;
+ }
+
+ if (threadTmp != null) {
+ final VisualizerThread thread = threadTmp;
+ assert thread.getState() == VisualizerExecutionState.RUNNING;
+
+ VisualizerExecutionState _newState = VisualizerExecutionState.SUSPENDED;
+
+ if (event.getReason() == StateChangeReason.SIGNAL) {
+ if (event instanceof IMIDMEvent) {
+ Object miEvent = ((IMIDMEvent) event).getMIEvent();
+ if (miEvent instanceof MISignalEvent) {
+ String signalName = ((MISignalEvent) miEvent).getName();
+ if (DSFDebugModel.isCrashSignal(signalName)) {
+ _newState = VisualizerExecutionState.CRASHED;
+ }
+ }
+ }
+ }
+ final VisualizerExecutionState newState = _newState;
+ if (stackService != null) {
+ stackService.getTopFrame(execDmc,
+ new ImmediateDataRequestMonitor<IFrameDMContext>(null) {
+ @Override
+ protected void handleCompleted() {
+ IFrameDMContext targetFrameContext = null;
+ if (isSuccess()) {
+ targetFrameContext = getData();
+ }
+ if (targetFrameContext != null) {
+ stackService.getFrameData(targetFrameContext,
new ImmediateDataRequestMonitor<IFrameDMData>(null) {
@Override
protected void handleCompleted() {
@@ -181,28 +174,29 @@ public class MulticoreVisualizerEventListener {
if (isSuccess()) {
frameData = getData();
}
- updateThread(thread, newState, vCore, frameData);
+ updateThread(thread, newState, vCore,
+ frameData);
}
});
- } else {
- updateThread(thread, newState, vCore, null);
- }
+ } else {
+ updateThread(thread, newState, vCore, null);
}
+ }
});
- } else {
- updateThread(thread, newState, vCore, null);
- }
-
- }
+ } else {
+ updateThread(thread, newState, vCore, null);
+ }
+
}
}
}
}
- );
- }
+ });
+ }
}
-
- private void updateThread(VisualizerThread thread, VisualizerExecutionState newState, VisualizerCore vCore, IFrameDMData frameData) {
+
+ private void updateThread(VisualizerThread thread, VisualizerExecutionState newState, VisualizerCore vCore,
+ IFrameDMData frameData) {
thread.setState(newState);
thread.setCore(vCore);
thread.setLocationInfo(frameData);
@@ -217,46 +211,46 @@ public class MulticoreVisualizerEventListener {
if (model == null) {
return;
}
-
+
IDMContext context = event.getDMContext();
-
+
// in all-stop mode... : update all threads states to "running"
- if (context != null && isSessionAllStop(context.getSessionId()) ) {
+ if (context != null && isSessionAllStop(context.getSessionId())) {
List<VisualizerThread> tList = model.getThreads();
- for(VisualizerThread t : tList) {
+ for (VisualizerThread t : tList) {
t.setState(VisualizerExecutionState.RUNNING);
t.setLocationInfo((String) null);
}
fVisualizer.getMulticoreVisualizerCanvas().requestUpdate();
return;
}
-
+
// Non-stop mode
if (context instanceof IContainerDMContext) {
- // We don't deal with processes
- } else if (context instanceof IMIExecutionDMContext) {
- // Thread resumed
- int tid;
- VisualizerThread thread = null;
- String strThreadId = ((IMIExecutionDMContext) context).getThreadId();
- try {
- tid = Integer.parseInt(strThreadId);
- thread = model.getThread(tid);
- } catch (NumberFormatException e) {
- // unable to resolve thread
- assert false : THE_THREAD_ID_DOES_NOT_CONVERT_TO_AN_INTEGER + strThreadId;
- return;
- }
-
- if (thread != null) {
- assert thread.getState() == VisualizerExecutionState.SUSPENDED ||
- thread.getState() == VisualizerExecutionState.CRASHED;
-
- thread.setState(VisualizerExecutionState.RUNNING);
- thread.setLocationInfo((String) null);
- fVisualizer.getMulticoreVisualizerCanvas().requestUpdate();
- }
- }
+ // We don't deal with processes
+ } else if (context instanceof IMIExecutionDMContext) {
+ // Thread resumed
+ int tid;
+ VisualizerThread thread = null;
+ String strThreadId = ((IMIExecutionDMContext) context).getThreadId();
+ try {
+ tid = Integer.parseInt(strThreadId);
+ thread = model.getThread(tid);
+ } catch (NumberFormatException e) {
+ // unable to resolve thread
+ assert false : THE_THREAD_ID_DOES_NOT_CONVERT_TO_AN_INTEGER + strThreadId;
+ return;
+ }
+
+ if (thread != null) {
+ assert thread.getState() == VisualizerExecutionState.SUSPENDED
+ || thread.getState() == VisualizerExecutionState.CRASHED;
+
+ thread.setState(VisualizerExecutionState.RUNNING);
+ thread.setLocationInfo((String) null);
+ fVisualizer.getMulticoreVisualizerCanvas().requestUpdate();
+ }
+ }
}
/** Invoked when a thread or process starts. */
@@ -267,121 +261,118 @@ public class MulticoreVisualizerEventListener {
if (model == null) {
return;
}
-
+
IDMContext context = event.getDMContext();
- if (context == null) return;
+ if (context == null)
+ return;
final String sessionId = context.getSessionId();
-
- // all-stop mode?
- // If so we can't ask GDB for more info about the new thread at this moment.
- // So we still add it to the model, on core zero and with a OS thread id of
- // zero. The next time the execution is stopped, the model will be re-created
+
+ // all-stop mode?
+ // If so we can't ask GDB for more info about the new thread at this moment.
+ // So we still add it to the model, on core zero and with a OS thread id of
+ // zero. The next time the execution is stopped, the model will be re-created
// and show the correct thread ids and cores.
- if (isSessionAllStop(sessionId) && context instanceof IMIExecutionDMContext ) {
- final IMIExecutionDMContext execDmc = (IMIExecutionDMContext)context;
- final IMIProcessDMContext processContext =
- DMContexts.getAncestorOfType(execDmc, IMIProcessDMContext.class);
-
+ if (isSessionAllStop(sessionId) && context instanceof IMIExecutionDMContext) {
+ final IMIExecutionDMContext execDmc = (IMIExecutionDMContext) context;
+ final IMIProcessDMContext processContext = DMContexts.getAncestorOfType(execDmc, IMIProcessDMContext.class);
+
// put it on core zero
VisualizerCore vCore = model.getCore(0);
- if (vCore == null) return;
-
+ if (vCore == null)
+ return;
+
int pid = Integer.parseInt(processContext.getProcId());
- int tid;
- try {
- tid = Integer.parseInt(execDmc.getThreadId());
- } catch (NumberFormatException e) {
- // unable to resolve thread
- assert false : THE_THREAD_ID_DOES_NOT_CONVERT_TO_AN_INTEGER + execDmc.getThreadId();
- return;
- }
+ int tid;
+ try {
+ tid = Integer.parseInt(execDmc.getThreadId());
+ } catch (NumberFormatException e) {
+ // unable to resolve thread
+ assert false : THE_THREAD_ID_DOES_NOT_CONVERT_TO_AN_INTEGER + execDmc.getThreadId();
+ return;
+ }
int osTid = 0;
- // add thread if not already there - there is a potential race condition where a
- // thread can be added twice to the model: once at model creation and once more
+ // add thread if not already there - there is a potential race condition where a
+ // thread can be added twice to the model: once at model creation and once more
// through the listener. Checking at both places to prevent this.
- if (model.getThread(tid) == null ) {
+ if (model.getThread(tid) == null) {
model.addThread(new VisualizerThread(vCore, pid, osTid, tid, VisualizerExecutionState.RUNNING));
- fVisualizer.getMulticoreVisualizerCanvas().requestUpdate();
+ fVisualizer.getMulticoreVisualizerCanvas().requestUpdate();
}
return;
}
-
+
// non-stop mode
if (context instanceof IContainerDMContext) {
- // We don't deal with processes
- } else if (context instanceof IMIExecutionDMContext) {
- // New thread added
- final IMIExecutionDMContext execDmc = (IMIExecutionDMContext)context;
- final IMIProcessDMContext processContext =
- DMContexts.getAncestorOfType(execDmc, IMIProcessDMContext.class);
- IThreadDMContext threadContext =
- DMContexts.getAncestorOfType(execDmc, IThreadDMContext.class);
-
- DsfServicesTracker tracker =
- new DsfServicesTracker(MulticoreVisualizerUIPlugin.getBundleContext(),
- sessionId);
+ // We don't deal with processes
+ } else if (context instanceof IMIExecutionDMContext) {
+ // New thread added
+ final IMIExecutionDMContext execDmc = (IMIExecutionDMContext) context;
+ final IMIProcessDMContext processContext = DMContexts.getAncestorOfType(execDmc, IMIProcessDMContext.class);
+ IThreadDMContext threadContext = DMContexts.getAncestorOfType(execDmc, IThreadDMContext.class);
+
+ DsfServicesTracker tracker = new DsfServicesTracker(MulticoreVisualizerUIPlugin.getBundleContext(),
+ sessionId);
IProcesses procService = tracker.getService(IProcesses.class);
tracker.dispose();
-
- procService.getExecutionData(threadContext,
- new ImmediateDataRequestMonitor<IThreadDMData>() {
- @Override
- protected void handleSuccess() {
- IThreadDMData data = getData();
-
- // Check whether we know about cores
- if (data instanceof IGdbThreadDMData) {
- String[] cores = ((IGdbThreadDMData)data).getCores();
- if (cores != null) {
- assert cores.length == 1; // A thread belongs to a single core
- int coreId = Integer.parseInt(cores[0]);
- VisualizerCore vCore = model.getCore(coreId);
- // There is a race condition that sometimes happens here. We can reach
- // here because we were notified that a thread is started, but the model
- // is not yet completely constructed. If the model doesn't yet contain the
- // core the thread runs-on, the getCore() call above will return null. This
- // will later cause a problem when we try to draw this thread, if we allow
- // this to pass. See Bug 396269/
- if (vCore == null)
- return;
-
- int pid = Integer.parseInt(processContext.getProcId());
- int tid;
- try {
- tid = Integer.parseInt(execDmc.getThreadId());
- } catch (NumberFormatException e) {
- // Unable to resolve thread information
- assert false : THE_THREAD_ID_DOES_NOT_CONVERT_TO_AN_INTEGER + execDmc.getThreadId();
- return;
- }
-
- int osTid = 0;
- try {
- osTid = Integer.parseInt(data.getId());
- } catch (NumberFormatException e) {
- // I've seen a case at startup where GDB is not ready to
- // return the osTID so we get null.
- // That is ok, we'll be refreshing right away at startup
- }
- // add thread if not already there - there is a potential race condition where a
- // thread can be added twice to the model: once at model creation and once more
- // through the listener. Checking at both places to prevent this.
- if (model.getThread(tid) == null ) {
- model.addThread(new VisualizerThread(vCore, pid, osTid, tid, VisualizerExecutionState.RUNNING));
- fVisualizer.getMulticoreVisualizerCanvas().requestUpdate();
- }
+ procService.getExecutionData(threadContext, new ImmediateDataRequestMonitor<IThreadDMData>() {
+ @Override
+ protected void handleSuccess() {
+ IThreadDMData data = getData();
+
+ // Check whether we know about cores
+ if (data instanceof IGdbThreadDMData) {
+ String[] cores = ((IGdbThreadDMData) data).getCores();
+ if (cores != null) {
+ assert cores.length == 1; // A thread belongs to a single core
+ int coreId = Integer.parseInt(cores[0]);
+ VisualizerCore vCore = model.getCore(coreId);
+ // There is a race condition that sometimes happens here. We can reach
+ // here because we were notified that a thread is started, but the model
+ // is not yet completely constructed. If the model doesn't yet contain the
+ // core the thread runs-on, the getCore() call above will return null. This
+ // will later cause a problem when we try to draw this thread, if we allow
+ // this to pass. See Bug 396269/
+ if (vCore == null)
+ return;
+
+ int pid = Integer.parseInt(processContext.getProcId());
+ int tid;
+ try {
+ tid = Integer.parseInt(execDmc.getThreadId());
+ } catch (NumberFormatException e) {
+ // Unable to resolve thread information
+ assert false : THE_THREAD_ID_DOES_NOT_CONVERT_TO_AN_INTEGER + execDmc.getThreadId();
+ return;
+ }
+
+ int osTid = 0;
+ try {
+ osTid = Integer.parseInt(data.getId());
+ } catch (NumberFormatException e) {
+ // I've seen a case at startup where GDB is not ready to
+ // return the osTID so we get null.
+ // That is ok, we'll be refreshing right away at startup
+ }
+
+ // add thread if not already there - there is a potential race condition where a
+ // thread can be added twice to the model: once at model creation and once more
+ // through the listener. Checking at both places to prevent this.
+ if (model.getThread(tid) == null) {
+ model.addThread(
+ new VisualizerThread(vCore, pid, osTid, tid, VisualizerExecutionState.RUNNING));
+ fVisualizer.getMulticoreVisualizerCanvas().requestUpdate();
}
}
}
}
- );
- }
+ });
+ }
}
-
+
/** Invoked when a thread or process exits. */
@DsfServiceEventHandler
public void handleEvent(IExitedDMEvent event) {
@@ -393,94 +384,90 @@ public class MulticoreVisualizerEventListener {
IDMContext context = event.getDMContext();
final MulticoreVisualizerCanvas canvas = fVisualizer.getMulticoreVisualizerCanvas();
-
+
if (context instanceof IContainerDMContext) {
- // process exited
-
- // Note: this is required because we noticed that in GDB 7.6 and older,
- // the "thread exited" signal is not sent for the local detach case.
+ // process exited
+
+ // Note: this is required because we noticed that in GDB 7.6 and older,
+ // the "thread exited" signal is not sent for the local detach case.
// see bug 409512
- DsfServicesTracker tracker =
- new DsfServicesTracker(MulticoreVisualizerUIPlugin.getBundleContext(),
- context.getSessionId());
+ DsfServicesTracker tracker = new DsfServicesTracker(MulticoreVisualizerUIPlugin.getBundleContext(),
+ context.getSessionId());
IProcesses procService = tracker.getService(IProcesses.class);
tracker.dispose();
-
+
// get all threads associated to this process and
// mark them as exited in the model.
- procService.getProcessesBeingDebugged(context,
- new ImmediateDataRequestMonitor<IDMContext[]>() {
- @Override
- protected void handleSuccess() {
- assert getData() != null;
-
- IDMContext[] contexts = getData();
- for (IDMContext c : contexts) {
- if (c instanceof IMIExecutionDMContext) {
- int tid;
- String strThreadId = ((IMIExecutionDMContext) c).getThreadId();
- try {
- tid = Integer.parseInt(strThreadId);
- } catch (NumberFormatException e) {
- // unable to resolve the thread id
- assert false : THE_THREAD_ID_DOES_NOT_CONVERT_TO_AN_INTEGER + strThreadId;
- continue;
- }
-
- model.markThreadExited(tid);
- }
- }
-
- if (canvas != null) {
- canvas.requestUpdate();
+ procService.getProcessesBeingDebugged(context, new ImmediateDataRequestMonitor<IDMContext[]>() {
+ @Override
+ protected void handleSuccess() {
+ assert getData() != null;
+
+ IDMContext[] contexts = getData();
+ for (IDMContext c : contexts) {
+ if (c instanceof IMIExecutionDMContext) {
+ int tid;
+ String strThreadId = ((IMIExecutionDMContext) c).getThreadId();
+ try {
+ tid = Integer.parseInt(strThreadId);
+ } catch (NumberFormatException e) {
+ // unable to resolve the thread id
+ assert false : THE_THREAD_ID_DOES_NOT_CONVERT_TO_AN_INTEGER + strThreadId;
+ continue;
}
+
+ model.markThreadExited(tid);
}
- @Override
- protected void handleFailure() {
- // we are overriding handleFailure() to avoid an error message
- // in the log, in the all-stop mode.
- }
+ }
+
+ if (canvas != null) {
+ canvas.requestUpdate();
+ }
+ }
+
+ @Override
+ protected void handleFailure() {
+ // we are overriding handleFailure() to avoid an error message
+ // in the log, in the all-stop mode.
+ }
});
-
-
- } else if (context instanceof IMIExecutionDMContext) {
- // Thread exited
- int tid;
- String strThreadId = ((IMIExecutionDMContext) context).getThreadId();
- try {
- tid = Integer.parseInt(strThreadId);
- model.markThreadExited(tid);
- } catch (NumberFormatException e) {
- assert false : THE_THREAD_ID_DOES_NOT_CONVERT_TO_AN_INTEGER + strThreadId;
- }
+
+ } else if (context instanceof IMIExecutionDMContext) {
+ // Thread exited
+ int tid;
+ String strThreadId = ((IMIExecutionDMContext) context).getThreadId();
+ try {
+ tid = Integer.parseInt(strThreadId);
+ model.markThreadExited(tid);
+ } catch (NumberFormatException e) {
+ assert false : THE_THREAD_ID_DOES_NOT_CONVERT_TO_AN_INTEGER + strThreadId;
+ }
if (canvas != null) {
canvas.requestUpdate();
}
- }
+ }
}
-
/** Invoked when the debug data model is ready */
@DsfServiceEventHandler
public void handleEvent(DataModelInitializedEvent event) {
// re-create the visualizer model now that CPU and core info is available
fVisualizer.update();
}
-
-
+
// helper functions
/** Returns whether the session is the "all-stop" kind */
private boolean isSessionAllStop(String sessionId) {
- DsfServicesTracker servicesTracker = new DsfServicesTracker(MulticoreVisualizerUIPlugin.getBundleContext(), sessionId);
+ DsfServicesTracker servicesTracker = new DsfServicesTracker(MulticoreVisualizerUIPlugin.getBundleContext(),
+ sessionId);
IMIRunControl runCtrlService = servicesTracker.getService(IMIRunControl.class);
servicesTracker.dispose();
-
- if (runCtrlService != null && runCtrlService.getRunMode() == MIRunMode.ALL_STOP ) {
+
+ if (runCtrlService != null && runCtrlService.getRunMode() == MIRunMode.ALL_STOP) {
return true;
}
return false;
}
}
-
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerGraphicObject.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerGraphicObject.java
index 7cc9d8c0a36..31f7d2ce5fe 100755
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerGraphicObject.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerGraphicObject.java
@@ -20,25 +20,23 @@ import org.eclipse.swt.graphics.GC;
/**
* Graphic object for MulticoreVisualizer.
*/
-public class MulticoreVisualizerGraphicObject extends GraphicObject
-{
+public class MulticoreVisualizerGraphicObject extends GraphicObject {
// --- members ---
// --- constructors/destructors ---
-
+
/** Constructor */
public MulticoreVisualizerGraphicObject() {
}
-
+
/** Dispose method */
@Override
public void dispose() {
super.dispose();
}
-
// --- methods ---
-
+
/** Invoked to allow element to paint itself on the viewer canvas */
@Override
public void paintContent(GC gc) {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerLoadMeter.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerLoadMeter.java
index 1b4597d56f8..9ffc37ff79a 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerLoadMeter.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerLoadMeter.java
@@ -27,39 +27,38 @@ import org.eclipse.swt.graphics.Rectangle;
public class MulticoreVisualizerLoadMeter extends MulticoreVisualizerGraphicObject {
// --- members ---
-
+
/** Is this load meter enabled? */
protected boolean m_enabled = false;
-
+
/** The current CPU/core load */
protected Integer m_currentLoad = null;
-
+
/** the high load water-mark */
protected Integer m_highLoadWatermark = null;
-
+
/** second rectangle, that will be displayed to show the load */
protected Rectangle m_loadRect = null;
-
+
/** to display the high load water-mark */
protected Rectangle m_highWatermarkRect = null;
-
+
/** Switch that permits to hide the load meter when not in overload */
protected Boolean m_showOnlyIfOverload = false;
-
+
/** Default overload threshold */
protected int m_overloadThreshold = 75;
-
+
/** Permits to have the load meter use the same BG color as its parent */
protected Color m_parentBgColor = null;
-
// --- constructors/destructors ---
-
+
/** Constructor */
public MulticoreVisualizerLoadMeter(Integer load) {
m_currentLoad = load;
}
-
+
/** Constructor witch includes the high load water-mark */
public MulticoreVisualizerLoadMeter(Integer load, Integer highWatermark) {
this(load);
@@ -72,85 +71,83 @@ public class MulticoreVisualizerLoadMeter extends MulticoreVisualizerGraphicObje
super.dispose();
}
-
// --- accessors ---
-
+
/** Sets whether the load meter is enabled */
public void setEnabled(boolean enabled) {
m_enabled = enabled;
}
-
+
/** Gets whether the load meter is enabled */
public boolean getEnabled() {
return m_enabled;
}
-
+
/** Sets the load associated to this load meter */
public void setLoad(Integer load) {
m_currentLoad = load;
}
-
+
/**
* @return the load value. If the value is undefined (null), zero is
- * returned. Method isLoadDefined() can be used to determine is the load
+ * returned. Method isLoadDefined() can be used to determine is the load
* value is defined, in the cases where the difference is important
* if needed.
*/
public int getLoad() {
return (m_currentLoad != null) ? m_currentLoad : 0;
}
-
+
/**
* @return true if load is a non-null value, otherwise false.
*/
public boolean isLoadDefined() {
return (m_currentLoad != null);
}
-
+
public void setHighLoadWatermark(Integer wm) {
m_highLoadWatermark = wm;
}
-
+
/** Sets the load value over which the load is considered overload */
- public void setOverloadThreshold (int t) {
+ public void setOverloadThreshold(int t) {
m_overloadThreshold = t;
}
-
- public void setShowyOnlyIfOverload (Boolean o) {
+
+ public void setShowyOnlyIfOverload(Boolean o) {
m_showOnlyIfOverload = o;
}
-
+
public void setParentBgColor(Color c) {
m_parentBgColor = c;
}
// --- paint methods ---
-
+
/** get a color that corresponds to the current load */
private Color getLoadColor() {
if (getLoad() < m_overloadThreshold) {
return IMulticoreVisualizerConstants.COLOR_LOAD_LOADBAR_NORMAL;
- }
- else {
+ } else {
return IMulticoreVisualizerConstants.COLOR_LOAD_LOADBAR_OVERLOAD;
}
}
/** Invoked to allow element to paint itself on the viewer canvas */
@Override
- public void paintContent(GC gc) {
+ public void paintContent(GC gc) {
if (!m_enabled) {
return;
}
-
- if (getLoad() < m_overloadThreshold && m_showOnlyIfOverload)
+
+ if (getLoad() < m_overloadThreshold && m_showOnlyIfOverload)
return;
-
+
// Show meter only if there is enough space
if (m_bounds.height < 30) {
return;
}
-
+
if (m_parentBgColor == null) {
// use default bg color
m_parentBgColor = IMulticoreVisualizerConstants.COLOR_LOAD_UNDERBAR_BG_DEFAULT;
@@ -163,11 +160,11 @@ public class MulticoreVisualizerLoadMeter extends MulticoreVisualizerGraphicObje
gc.drawRectangle(m_bounds);
// Create/display shorter bar over to show current load
- int x,y,w,h;
+ int x, y, w, h;
x = m_bounds.x;
y = (int) (m_bounds.y + m_bounds.height * ((100.0f - getLoad()) / 100.0f));
w = m_bounds.width;
- h = (int) (m_bounds.height - m_bounds.height * ((100.0f - getLoad()) / 100.0f));
+ h = (int) (m_bounds.height - m_bounds.height * ((100.0f - getLoad()) / 100.0f));
m_loadRect = new Rectangle(x, y, w, h);
gc.setBackground(getLoadColor());
@@ -175,7 +172,7 @@ public class MulticoreVisualizerLoadMeter extends MulticoreVisualizerGraphicObje
gc.drawRectangle(m_loadRect);
// Display high water-mark, if defined
- if ( m_highLoadWatermark != null) {
+ if (m_highLoadWatermark != null) {
x = m_bounds.x - 5;
y = (int) (m_bounds.y + m_bounds.height * ((100.0f - m_highLoadWatermark) / 100.0f));
w = m_bounds.width + 7;
@@ -200,15 +197,15 @@ public class MulticoreVisualizerLoadMeter extends MulticoreVisualizerGraphicObje
@Override
public void paintDecorations(GC gc) {
String load;
-
+
// display nothing if load meter is not enabled
- if (!m_enabled)
+ if (!m_enabled)
return;
- // "display only if overload" mode applicable?
- if (getLoad() < m_overloadThreshold && m_showOnlyIfOverload)
+ // "display only if overload" mode applicable?
+ if (getLoad() < m_overloadThreshold && m_showOnlyIfOverload)
return;
-
- // is there an actual value to display yet?
+
+ // is there an actual value to display yet?
if (isLoadDefined()) {
load = Integer.toString(getLoad());
}
@@ -216,7 +213,7 @@ public class MulticoreVisualizerLoadMeter extends MulticoreVisualizerGraphicObje
else {
load = "n/a"; //$NON-NLS-1$
}
-
+
// Show load text only if there is enough space
if (m_bounds.height > 50) {
// Display load in text above the load monitor bar
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerMarquee.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerMarquee.java
index 11e6a6b6d48..cddf1b6b4a1 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerMarquee.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerMarquee.java
@@ -21,10 +21,8 @@ import org.eclipse.swt.graphics.GC;
/**
* MulticoreVisualizer "marquee" (selection box) object.
*/
-public class MulticoreVisualizerMarquee extends MulticoreVisualizerGraphicObject
-{
+public class MulticoreVisualizerMarquee extends MulticoreVisualizerGraphicObject {
// --- members ---
-
// --- constructors/destructors ---
@@ -32,32 +30,29 @@ public class MulticoreVisualizerMarquee extends MulticoreVisualizerGraphicObject
public MulticoreVisualizerMarquee() {
setVisible(false);
}
-
+
/** Dispose method */
@Override
public void dispose() {
super.dispose();
}
-
-
+
// --- Object methods ---
-
+
/** Returns string representation of element */
@Override
public String toString() {
- return "MarqueeGraphicObject[" + //$NON-NLS-1$
- m_bounds.x + "," + //$NON-NLS-1$
- m_bounds.y + "," + //$NON-NLS-1$
- m_bounds.width + "," + //$NON-NLS-1$
- m_bounds.height + "]"; //$NON-NLS-1$
+ return "MarqueeGraphicObject[" + //$NON-NLS-1$
+ m_bounds.x + "," + //$NON-NLS-1$
+ m_bounds.y + "," + //$NON-NLS-1$
+ m_bounds.width + "," + //$NON-NLS-1$
+ m_bounds.height + "]"; //$NON-NLS-1$
}
-
-
+
// --- accessors ---
-
-
+
// --- methods ---
-
+
/** Invoked to allow element to paint itself on the viewer canvas */
@Override
public void paintContent(GC gc) {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerSelectionFinder.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerSelectionFinder.java
index ad9b1911888..591fda6cb2c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerSelectionFinder.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerSelectionFinder.java
@@ -32,15 +32,12 @@ import org.eclipse.cdt.visualizer.ui.util.SelectionUtils;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.TreePath;
-
-/**
+/**
* Debug view tree walker that finds elements to select
* based on selection obtained from the multicore visualizer.
*/
@SuppressWarnings("restriction") // allow access to internal interfaces
-public class MulticoreVisualizerSelectionFinder
- extends DebugViewTreeWalker
-{
+public class MulticoreVisualizerSelectionFinder extends DebugViewTreeWalker {
// --- members ---
/** Selection item(s) we're currently looking for. */
@@ -49,12 +46,10 @@ public class MulticoreVisualizerSelectionFinder
/** Result we've found, if any. */
protected Set<Object> m_result = null;
-
// --- constructors/destructors ---
/** Constructor */
- public MulticoreVisualizerSelectionFinder()
- {
+ public MulticoreVisualizerSelectionFinder() {
}
/** Dispose method */
@@ -70,8 +65,7 @@ public class MulticoreVisualizerSelectionFinder
* (E.g. the IDMVMContext for a VisualizerThread.
* Returns null if no match is found.
*/
- public ISelection findSelection(ISelection selection)
- {
+ public ISelection findSelection(ISelection selection) {
m_selection = SelectionUtils.getSelectedObjects(selection);
m_result = new HashSet<Object>();
@@ -85,8 +79,7 @@ public class MulticoreVisualizerSelectionFinder
* and false if they can be skipped.
*/
@Override
- public boolean processElement(TreePath path)
- {
+ public boolean processElement(TreePath path) {
boolean result = true;
Object element = getElement(path);
@@ -96,28 +89,22 @@ public class MulticoreVisualizerSelectionFinder
int pid = getPID(context);
int tid = getTID(context);
- if (isThreadContext(context))
- {
+ if (isThreadContext(context)) {
for (Object o : m_selection) {
if (o instanceof VisualizerThread) {
VisualizerThread thread = (VisualizerThread) o;
// The Debug view model uses the GDB thread, to we need to use that one from the Visualizer model
- if (thread.getPID() == pid && thread.getGDBTID() == tid)
- {
+ if (thread.getPID() == pid && thread.getGDBTID() == tid) {
m_result.add(element);
}
}
}
- }
- else if (context instanceof IFrameDMContext)
- {
+ } else if (context instanceof IFrameDMContext) {
// FIXME: if we have frame[0] under a selected thread,
// select that stack frame instead of the thread
- if (isThreadFrameZero(context))
- {
+ if (isThreadFrameZero(context)) {
IDMVMContext threadContext = (IDMVMContext) path.getParentPath().getLastSegment();
- if (m_result.contains(threadContext))
- {
+ if (m_result.contains(threadContext)) {
m_result.remove(threadContext);
m_result.add(element);
}
@@ -127,49 +114,40 @@ public class MulticoreVisualizerSelectionFinder
return result;
}
-
+
/** Returns PID for specified debug context. */
- public static int getPID(IDMContext context)
- {
- IMIProcessDMContext processContext =
- DMContexts.getAncestorOfType(context, IMIProcessDMContext.class);
- int pid = (processContext == null) ? 0 :
- Integer.parseInt(processContext.getProcId());
+ public static int getPID(IDMContext context) {
+ IMIProcessDMContext processContext = DMContexts.getAncestorOfType(context, IMIProcessDMContext.class);
+ int pid = (processContext == null) ? 0 : Integer.parseInt(processContext.getProcId());
return pid;
}
/** Returns TID for specified debug context. */
- public static int getTID(IDMContext context)
- {
- IMIExecutionDMContext execContext =
- DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
- int tid = 0;
- if (execContext != null) {
- try {
- tid = Integer.parseInt(execContext.getThreadId());
- } catch (NumberFormatException e) {
- // Unable to resolve thread id
- assert false : "The thread id does not convert to an integer: " + execContext.getThreadId(); //$NON-NLS-1$
- }
- }
+ public static int getTID(IDMContext context) {
+ IMIExecutionDMContext execContext = DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
+ int tid = 0;
+ if (execContext != null) {
+ try {
+ tid = Integer.parseInt(execContext.getThreadId());
+ } catch (NumberFormatException e) {
+ // Unable to resolve thread id
+ assert false : "The thread id does not convert to an integer: " + execContext.getThreadId(); //$NON-NLS-1$
+ }
+ }
return tid;
}
/** Returns true if specified context represents a thread. */
- public static boolean isThreadContext(IDMContext context)
- {
+ public static boolean isThreadContext(IDMContext context) {
// TODO: is there a more elegant way to express this?
- return
- context instanceof IMIExecutionDMContext &&
- context.getParents().length >= 2 &&
- (context.getParents()[0] instanceof IThreadDMContext ||
- context.getParents()[1] instanceof IThreadDMContext);
+ return context instanceof IMIExecutionDMContext && context.getParents().length >= 2
+ && (context.getParents()[0] instanceof IThreadDMContext
+ || context.getParents()[1] instanceof IThreadDMContext);
}
-
+
/** Returns true if context represents the topmost (0th) frame under a thread. */
- public static boolean isThreadFrameZero(IDMContext context)
- {
+ public static boolean isThreadFrameZero(IDMContext context) {
// TODO: is there a more elegant way to express this?
String value = context.toString();
return (value != null && value.endsWith(".frame[0]")); //$NON-NLS-1$
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerStatusBar.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerStatusBar.java
index 9c7147a1070..7a8ef5ef957 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerStatusBar.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerStatusBar.java
@@ -21,16 +21,15 @@ import org.eclipse.swt.graphics.GC;
public class MulticoreVisualizerStatusBar extends MulticoreVisualizerGraphicObject {
// --- members ---
-
+
/** message to display in status bar */
- protected String m_statusMessage = null;
-
+ protected String m_statusMessage = null;
+
// --- constructors/destructors ---
-
+
/** Constructor */
public MulticoreVisualizerStatusBar() {
}
-
/** Dispose method */
@Override
@@ -39,22 +38,21 @@ public class MulticoreVisualizerStatusBar extends MulticoreVisualizerGraphicObje
m_statusMessage = null;
}
-
// --- accessors ---
-
- public void setMessage (String message) {
+
+ public void setMessage(String message) {
m_statusMessage = message;
}
// --- paint methods ---
-
+
/** Invoked to allow element to paint itself on the viewer canvas */
@Override
public void paintContent(GC gc) {
-
+
if (m_statusMessage == null)
return;
-
+
// Display message text
gc.setForeground(IMulticoreVisualizerConstants.COLOR_STATUS_BAR_TEXT);
int tx = m_bounds.x;
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerThread.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerThread.java
index edea6a01ccd..30321422a67 100755
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerThread.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizerThread.java
@@ -25,60 +25,55 @@ import org.eclipse.swt.graphics.GC;
/**
* MulticoreVisualizer Thread object.
*/
-public class MulticoreVisualizerThread extends MulticoreVisualizerGraphicObject
-{
+public class MulticoreVisualizerThread extends MulticoreVisualizerGraphicObject {
// --- constants ---
-
+
/** Thread "pixie" spot width/height */
public static final int THREAD_SPOT_SIZE = 18;
-
+
/** Minimum containing object size to allow thread to draw itself. */
public static final int MIN_PARENT_WIDTH = THREAD_SPOT_SIZE + 4;
-
// --- members ---
-
+
/** Parent CPU. */
protected MulticoreVisualizerCore m_core;
-
+
/** Visualizer model thread. */
protected VisualizerThread m_thread;
-
+
/** Whether this thread is part of a currently selected process. */
protected boolean m_processSelected = true;
-
// --- constructors/destructors ---
-
+
/** Constructor */
public MulticoreVisualizerThread(MulticoreVisualizerCore core, VisualizerThread thread) {
m_core = core;
m_thread = thread;
}
-
+
/** Dispose method */
@Override
public void dispose() {
super.dispose();
m_thread = null;
}
-
-
+
// --- accessors ---
-
+
/** Gets parent Core. */
public MulticoreVisualizerCore getCore() {
return m_core;
}
-
+
/** Sets parent Core. */
public void setCore(MulticoreVisualizerCore core) {
m_core = core;
}
-
+
/** Gets thread model object. */
- public VisualizerThread getThread()
- {
+ public VisualizerThread getThread() {
return m_thread;
}
@@ -91,27 +86,24 @@ public class MulticoreVisualizerThread extends MulticoreVisualizerGraphicObject
public int getTID() {
return m_thread.getTID();
}
-
+
/** Gets thread state. */
public VisualizerExecutionState getState() {
return m_thread.getState();
}
/** Sets whether thread's process is selected. */
- public void setProcessSelected(boolean processSelected)
- {
+ public void setProcessSelected(boolean processSelected) {
m_processSelected = processSelected;
}
-
+
/** Gets whether thread's process is selected. */
- public boolean getProcessSelected()
- {
+ public boolean getProcessSelected() {
return m_processSelected;
}
-
-
+
// --- methods ---
-
+
/** Gets thread color based on current state. */
protected Color getThreadStateColor() {
switch (m_thread.getState()) {
@@ -124,11 +116,11 @@ public class MulticoreVisualizerThread extends MulticoreVisualizerGraphicObject
case EXITED:
return IMulticoreVisualizerConstants.COLOR_EXITED_THREAD;
}
-
+
assert false;
return Colors.BLACK;
}
-
+
// --- paint methods ---
/** Invoked to allow element to paint itself on the viewer canvas */
@@ -136,19 +128,19 @@ public class MulticoreVisualizerThread extends MulticoreVisualizerGraphicObject
public void paintContent(GC gc) {
if (m_core.getWidth() >= MIN_PARENT_WIDTH) {
gc.setBackground(getThreadStateColor());
-
+
int x = m_bounds.x;
int y = m_bounds.y;
int w = THREAD_SPOT_SIZE;
int h = THREAD_SPOT_SIZE;
-
+
// draw an alpha-shaded "pixie" light for each thread
int step1 = 3;
int step2 = 6;
int alpha1 = 128;
int alpha2 = 196;
int alpha3 = 255;
- if (! m_processSelected) {
+ if (!m_processSelected) {
alpha1 -= 64;
alpha2 -= 64;
alpha3 -= 64;
@@ -156,9 +148,9 @@ public class MulticoreVisualizerThread extends MulticoreVisualizerGraphicObject
gc.setAlpha(alpha1);
gc.fillOval(x, y, w, h);
gc.setAlpha(alpha2);
- gc.fillOval(x+step1, y+step1, w-step1*2, h-step1*2);
+ gc.fillOval(x + step1, y + step1, w - step1 * 2, h - step1 * 2);
gc.setAlpha(alpha3);
- gc.fillOval(x+step2, y+step2, w-step2*2, h-step2*2);
+ gc.fillOval(x + step2, y + step2, w - step2 * 2, h - step2 * 2);
gc.setAlpha(255);
// special case: for the "process" thread, draw an enclosing circle
@@ -167,27 +159,26 @@ public class MulticoreVisualizerThread extends MulticoreVisualizerGraphicObject
// in the case of drawOval because that method
// adds a pixel to each value for some reason
gc.setForeground(IMulticoreVisualizerConstants.COLOR_PROCESS_THREAD);
- gc.drawOval(x,y,w-1,h-1);
+ gc.drawOval(x, y, w - 1, h - 1);
}
// draw text annotations
gc.setBackground(IMulticoreVisualizerConstants.COLOR_THREAD_TEXT_BG);
gc.setForeground(IMulticoreVisualizerConstants.COLOR_THREAD_TEXT_FG);
-
+
// if it has an associated debugger, add a marker
// (for now, every thread is debugged.)
-// GUIUtils.drawText(gc, "D", x+w, y-8); //$NON-NLS-1$
-
+ // GUIUtils.drawText(gc, "D", x+w, y-8); //$NON-NLS-1$
+
// draw TID, in format "<gdb tid> - ( <os tid> )
String displayTID = m_thread.getGDBTID() + " - ( " + m_thread.getTID() + " )"; //$NON-NLS-1$ //$NON-NLS-2$
GUIUtils.drawText(gc, displayTID, x + w + 4, y + 2);
-
+
// draw selection marker, if any
- if (m_selected)
- {
+ if (m_selected) {
gc.setForeground(IMulticoreVisualizerConstants.COLOR_SELECTED);
- gc.drawOval(x-2,y-2,w+3,h+3);
- gc.drawOval(x-3,y-3,w+5,h+5);
+ gc.drawOval(x - 2, y - 2, w + 3, h + 3);
+ gc.drawOval(x - 3, y - 3, w + 5, h + 5);
}
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/DSFDebugModel.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/DSFDebugModel.java
index 7a385d4b3c8..d9a9ee571e9 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/DSFDebugModel.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/DSFDebugModel.java
@@ -49,14 +49,13 @@ import org.eclipse.cdt.dsf.gdb.service.IGDBHardwareAndOS2.ILoadInfo;
import org.eclipse.cdt.dsf.gdb.service.IGDBProcesses.IGdbThreadDMData;
import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext;
-
/** Debugger state information accessors.</br>
- *
+ *
* NOTE: The methods on this class perform asynchronous operations
* and the result is reported back via the received request monitor
*/
public class DSFDebugModel implements IDSFTargetDataProxy {
-
+
// --- static methods ---
@Override
@ConfinedToDsfExecutor("sessionState.getDsfSession().getExecutor()")
@@ -68,7 +67,8 @@ public class DSFDebugModel implements IDSFTargetDataProxy {
return;
}
- IHardwareTargetDMContext contextToUse = DMContexts.getAncestorOfType(controlService.getContext(), IHardwareTargetDMContext.class);
+ IHardwareTargetDMContext contextToUse = DMContexts.getAncestorOfType(controlService.getContext(),
+ IHardwareTargetDMContext.class);
hwService.getCPUs(contextToUse, new ImmediateDataRequestMonitor<ICPUDMContext[]>(rm) {
@Override
protected void handleCompleted() {
@@ -82,21 +82,19 @@ public class DSFDebugModel implements IDSFTargetDataProxy {
rm.done(cpuContexts);
}
});
- }
+ }
@Override
@ConfinedToDsfExecutor("sessionState.getDsfSession().getExecutor()")
- public void getLoad(DSFSessionState sessionState,
- final IDMContext context,
- final DataRequestMonitor<ILoadInfo> rm)
- {
+ public void getLoad(DSFSessionState sessionState, final IDMContext context,
+ final DataRequestMonitor<ILoadInfo> rm) {
IGDBHardwareAndOS2 hwService = sessionState.getService(IGDBHardwareAndOS2.class);
if (hwService == null) {
rm.setData(null);
rm.done();
return;
}
-
+
hwService.getLoadInfo(context, rm);
}
@@ -108,10 +106,8 @@ public class DSFDebugModel implements IDSFTargetDataProxy {
@Override
@ConfinedToDsfExecutor("sessionState.getDsfSession().getExecutor()")
- public void getCores(DSFSessionState sessionState,
- final ICPUDMContext cpuContext,
- final DataRequestMonitor<ICoreDMContext[]> rm)
- {
+ public void getCores(DSFSessionState sessionState, final ICPUDMContext cpuContext,
+ final DataRequestMonitor<ICoreDMContext[]> rm) {
IGDBHardwareAndOS hwService = sessionState.getService(IGDBHardwareAndOS.class);
if (hwService == null) {
rm.done(new ICoreDMContext[0]);
@@ -124,132 +120,123 @@ public class DSFDebugModel implements IDSFTargetDataProxy {
// use the hardware context (so we get all available cores)
ICommandControlService controlService = sessionState.getService(ICommandControlService.class);
targetContextToUse = DMContexts.getAncestorOfType(controlService.getContext(),
- IHardwareTargetDMContext.class);
+ IHardwareTargetDMContext.class);
}
-
- hwService.getCores(targetContextToUse,
- new ImmediateDataRequestMonitor<ICoreDMContext[]>() {
- @Override
- protected void handleCompleted() {
- ICoreDMContext[] coreContexts = getData();
- if (!isSuccess() || coreContexts == null || coreContexts.length < 1) {
- // Unable to get any core data
- rm.done(new ICoreDMContext[0]);
- } else {
- rm.done(coreContexts);
- }
+ hwService.getCores(targetContextToUse, new ImmediateDataRequestMonitor<ICoreDMContext[]>() {
+ @Override
+ protected void handleCompleted() {
+ ICoreDMContext[] coreContexts = getData();
+
+ if (!isSuccess() || coreContexts == null || coreContexts.length < 1) {
+ // Unable to get any core data
+ rm.done(new ICoreDMContext[0]);
+ } else {
+ rm.done(coreContexts);
}
}
- );
+ });
}
@Override
@ConfinedToDsfExecutor("sessionState.getDsfSession().getExecutor()")
- public void getThreads(DSFSessionState sessionState,
- final ICPUDMContext cpuContext,
- final ICoreDMContext coreContext,
- final DataRequestMonitor<IDMContext[]> rm)
- {
+ public void getThreads(DSFSessionState sessionState, final ICPUDMContext cpuContext,
+ final ICoreDMContext coreContext, final DataRequestMonitor<IDMContext[]> rm) {
// Get control DM context associated with the core
// Process/Thread Info service (GDBProcesses_X_Y_Z)
final IProcesses procService = sessionState.getService(IProcesses.class);
// Debugger control context (GDBControlDMContext)
- ICommandControlDMContext controlContext =
- DMContexts.getAncestorOfType(coreContext, ICommandControlDMContext.class);
+ ICommandControlDMContext controlContext = DMContexts.getAncestorOfType(coreContext,
+ ICommandControlDMContext.class);
if (procService == null || controlContext == null) {
rm.done(new IDMContext[0]);
return;
}
-
+
// Get debugged processes
- procService.getProcessesBeingDebugged(controlContext,
- new ImmediateDataRequestMonitor<IDMContext[]>() {
-
- @Override
- protected void handleCompleted() {
- IDMContext[] processContexts = getData();
-
- if (!isSuccess() || processContexts == null || processContexts.length < 1) {
- // Unable to get any process data for this core
- // Is this an issue? A core may have no processes/threads, right?
- rm.done(new IDMContext[0]);
- return;
- }
-
- final ArrayList<IDMContext> threadContextsList = new ArrayList<>();
-
- final ImmediateCountingRequestMonitor crm1 = new ImmediateCountingRequestMonitor(
+ procService.getProcessesBeingDebugged(controlContext, new ImmediateDataRequestMonitor<IDMContext[]>() {
+
+ @Override
+ protected void handleCompleted() {
+ IDMContext[] processContexts = getData();
+
+ if (!isSuccess() || processContexts == null || processContexts.length < 1) {
+ // Unable to get any process data for this core
+ // Is this an issue? A core may have no processes/threads, right?
+ rm.done(new IDMContext[0]);
+ return;
+ }
+
+ final ArrayList<IDMContext> threadContextsList = new ArrayList<>();
+
+ final ImmediateCountingRequestMonitor crm1 = new ImmediateCountingRequestMonitor(
new ImmediateRequestMonitor() {
@Override
protected void handleCompleted() {
- IDMContext[] threadContexts = threadContextsList.toArray(new IDMContext[threadContextsList.size()]);
+ IDMContext[] threadContexts = threadContextsList
+ .toArray(new IDMContext[threadContextsList.size()]);
rm.done(threadContexts);
}
});
- crm1.setDoneCount(processContexts.length);
-
- for (IDMContext processContext : processContexts) {
- IContainerDMContext containerContext =
- DMContexts.getAncestorOfType(processContext, IContainerDMContext.class);
-
- procService.getProcessesBeingDebugged(containerContext,
+ crm1.setDoneCount(processContexts.length);
+
+ for (IDMContext processContext : processContexts) {
+ IContainerDMContext containerContext = DMContexts.getAncestorOfType(processContext,
+ IContainerDMContext.class);
+
+ procService.getProcessesBeingDebugged(containerContext,
new ImmediateDataRequestMonitor<IDMContext[]>(crm1) {
@Override
protected void handleCompleted() {
IDMContext[] threadContexts = getData();
-
+
if (!isSuccess() || threadContexts == null || threadContexts.length < 1) {
crm1.done();
return;
}
-
- final ImmediateCountingRequestMonitor crm2 = new ImmediateCountingRequestMonitor(crm1);
+
+ final ImmediateCountingRequestMonitor crm2 = new ImmediateCountingRequestMonitor(
+ crm1);
crm2.setDoneCount(threadContexts.length);
-
+
for (final IDMContext threadContext : threadContexts) {
- IThreadDMContext threadContext2 =
- DMContexts.getAncestorOfType(threadContext, IThreadDMContext.class);
-
- procService.getExecutionData(threadContext2,
- new ImmediateDataRequestMonitor<IThreadDMData>(crm2) {
-
- @Override
- protected void handleCompleted() {
- IThreadDMData data = getData();
-
- // Check whether we know about cores
- if (data != null && data instanceof IGdbThreadDMData) {
- String[] cores = ((IGdbThreadDMData)data).getCores();
- if (cores != null && cores.length == 1) {
- if (coreContext.getId().equals(cores[0])) {
- // This thread belongs to the proper core
- threadContextsList.add(threadContext);
+ IThreadDMContext threadContext2 = DMContexts.getAncestorOfType(threadContext,
+ IThreadDMContext.class);
+
+ procService.getExecutionData(threadContext2,
+ new ImmediateDataRequestMonitor<IThreadDMData>(crm2) {
+
+ @Override
+ protected void handleCompleted() {
+ IThreadDMData data = getData();
+
+ // Check whether we know about cores
+ if (data != null && data instanceof IGdbThreadDMData) {
+ String[] cores = ((IGdbThreadDMData) data).getCores();
+ if (cores != null && cores.length == 1) {
+ if (coreContext.getId().equals(cores[0])) {
+ // This thread belongs to the proper core
+ threadContextsList.add(threadContext);
+ }
}
}
+ crm2.done();
}
- crm2.done();
- }
- }
- );
+ });
}
}
- }
- );
- }
+ });
}
}
- );
+ });
}
@Override
@ConfinedToDsfExecutor("sessionState.getDsfSession().getExecutor()")
- public void getThreadData(DSFSessionState sessionState,
- final ICPUDMContext cpuContext,
- final ICoreDMContext coreContext,
- final IMIExecutionDMContext execContext, final DataRequestMonitor<IThreadDMData> rm)
- {
+ public void getThreadData(DSFSessionState sessionState, final ICPUDMContext cpuContext,
+ final ICoreDMContext coreContext, final IMIExecutionDMContext execContext,
+ final DataRequestMonitor<IThreadDMData> rm) {
IProcesses procService = sessionState.getService(IProcesses.class);
if (procService == null) {
@@ -264,7 +251,8 @@ public class DSFDebugModel implements IDSFTargetDataProxy {
@Override
@ConfinedToDsfExecutor("sessionState.getDsfSession().getExecutor()")
- public void getTopFrameData(final DSFSessionState sessionState, final IMIExecutionDMContext execContext, final DataRequestMonitor<IFrameDMData> rm) {
+ public void getTopFrameData(final DSFSessionState sessionState, final IMIExecutionDMContext execContext,
+ final DataRequestMonitor<IFrameDMData> rm) {
final IFrameDMData nullFrameData = null;
// For a suspended thread, retrieve the current stack
final IStack stackService = sessionState.getService(IStack.class);
@@ -274,13 +262,14 @@ public class DSFDebugModel implements IDSFTargetDataProxy {
protected void handleCompleted() {
IFrameDMContext targetFrameContext = isSuccess() ? getData() : null;
if (targetFrameContext != null) {
- stackService.getFrameData(targetFrameContext, new ImmediateDataRequestMonitor<IFrameDMData>(null) {
- @Override
- protected void handleCompleted() {
- IFrameDMData frameData = isSuccess() ? getData() : null;
- rm.done(frameData);
- }
- });
+ stackService.getFrameData(targetFrameContext,
+ new ImmediateDataRequestMonitor<IFrameDMData>(null) {
+ @Override
+ protected void handleCompleted() {
+ IFrameDMData frameData = isSuccess() ? getData() : null;
+ rm.done(frameData);
+ }
+ });
} else {
rm.done(nullFrameData);
}
@@ -293,8 +282,9 @@ public class DSFDebugModel implements IDSFTargetDataProxy {
@Override
@ConfinedToDsfExecutor("sessionState.getDsfSession().getExecutor()")
- public void getThreadExecutionState(final DSFSessionState sessionState, final ICPUDMContext cpuContext, final ICoreDMContext coreContext,
- final IMIExecutionDMContext execContext, final IThreadDMData threadData, final DataRequestMonitor<VisualizerExecutionState> rm) {
+ public void getThreadExecutionState(final DSFSessionState sessionState, final ICPUDMContext cpuContext,
+ final ICoreDMContext coreContext, final IMIExecutionDMContext execContext, final IThreadDMData threadData,
+ final DataRequestMonitor<VisualizerExecutionState> rm) {
IRunControl runControl = sessionState.getService(IRunControl.class);
if (runControl == null) {
@@ -311,7 +301,7 @@ public class DSFDebugModel implements IDSFTargetDataProxy {
}
}
- /** For a suspended thread, let's see why it is suspended,
+ /** For a suspended thread, let's see why it is suspended,
* to find out if the thread is crashed */
@ConfinedToDsfExecutor("sessionState.getDsfSession().getExecutor()")
private static void getThreadSuspendReason(DSFSessionState sessionState, IMIExecutionDMContext execContext,
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/DSFSessionState.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/DSFSessionState.java
index 7709ed671e0..cff6e9ddfbc 100755
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/DSFSessionState.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/DSFSessionState.java
@@ -26,11 +26,10 @@ import org.eclipse.cdt.dsf.service.DsfSession;
/**
* DSF session state object.
- *
+ *
* Encapsulates and manages DsfSession we're currently tracking.
*/
-public class DSFSessionState
-{
+public class DSFSessionState {
// --- members ---
/** Current session ID. */
@@ -38,48 +37,43 @@ public class DSFSessionState
/** Current set of session event listeners. */
protected List<Object> m_sessionListeners;
-
+
/** Services tracker, used to access services. */
protected DsfServicesTracker m_servicesTracker;
// --- constructors/destructors ---
-
+
public DSFSessionState(String sessionId) {
m_sessionId = sessionId;
m_sessionListeners = new ArrayList<Object>();
m_servicesTracker = new DsfServicesTracker(MulticoreVisualizerUIPlugin.getBundleContext(), m_sessionId);
}
-
+
/** Dispose method. */
- public void dispose()
- {
+ public void dispose() {
if (m_sessionId != null) {
removeAllServiceEventListeners();
m_sessionId = null;
m_sessionListeners = null;
}
-
+
if (m_servicesTracker != null) {
- m_servicesTracker.dispose();
+ m_servicesTracker.dispose();
m_servicesTracker = null;
}
}
-
-
+
// --- accessors ---
-
+
/** Returns session ID. */
- public String getSessionID()
- {
+ public String getSessionID() {
return m_sessionId;
}
-
-
+
// --- listener management ---
/** Adds a service event listener. */
- public void addServiceEventListener(Object listener)
- {
+ public void addServiceEventListener(Object listener) {
final Object listener_f = listener;
final DsfSession session_f = getDsfSession();
if (session_f != null) {
@@ -91,15 +85,14 @@ public class DSFSessionState
m_sessionListeners.add(listener_f);
}
});
- } catch (RejectedExecutionException e) {
- // Session is shut down.
- }
+ } catch (RejectedExecutionException e) {
+ // Session is shut down.
+ }
}
}
-
+
/** Removes a service event listener. */
- public void removeServiceEventListener(Object listener)
- {
+ public void removeServiceEventListener(Object listener) {
final Object listener_f = listener;
final DsfSession session_f = getDsfSession();
if (session_f != null) {
@@ -113,15 +106,14 @@ public class DSFSessionState
}
}
});
- } catch (RejectedExecutionException e) {
- // Session is shut down.
- }
+ } catch (RejectedExecutionException e) {
+ // Session is shut down.
+ }
}
}
-
+
/** Removes all service event listeners. */
- public void removeAllServiceEventListeners()
- {
+ public void removeAllServiceEventListeners() {
final DsfSession session_f = getDsfSession();
if (session_f != null) {
try {
@@ -136,38 +128,34 @@ public class DSFSessionState
}
}
});
- } catch (RejectedExecutionException e) {
- // Session is shut down.
- }
+ } catch (RejectedExecutionException e) {
+ // Session is shut down.
+ }
}
}
-
-
+
// --- methods ---
-
+
/** Gets current DsfSession, if it's still active. */
protected DsfSession getDsfSession() {
return DsfSession.getSession(m_sessionId);
}
-
+
/** Executes DsfRunnable. */
- public void execute(DsfRunnable runnable)
- {
+ public void execute(DsfRunnable runnable) {
try {
DsfSession session = getDsfSession();
if (session == null) {
// TODO: log this?
- }
- else {
+ } else {
session.getExecutor().execute(runnable);
}
- }
- catch (RejectedExecutionException e) {
+ } catch (RejectedExecutionException e) {
// TODO: log or handle this properly.
System.err.println("DSFSessionState.execute(): session rejected execution request."); //$NON-NLS-1$
}
}
-
+
/** Gets service of the specified type. */
@ConfinedToDsfExecutor("getDsfSession().getExecutor()")
public <V> V getService(Class<V> serviceClass) {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/DebugViewTreeWalker.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/DebugViewTreeWalker.java
index 40545a00a8f..2e298f5e97c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/DebugViewTreeWalker.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/DebugViewTreeWalker.java
@@ -25,49 +25,43 @@ import org.eclipse.swt.widgets.TreeItem;
/**
* Base class that walks Debug View tree elements.
- *
+ *
* Intended to be subclassed by code that needs to walk the content
* of the Debug View (e.g. to find elements or construct model deltas).
- *
+ *
* In the simplest case, a derived class should only need to
* implement processElement(), and one should then only need
* to call walk() to walk the tree and get an appropriate delta.
*/
@SuppressWarnings("restriction") // allow access to internal classes
-public class DebugViewTreeWalker
-{
+public class DebugViewTreeWalker {
// --- members ---
/** Debug View tree viewer */
TreeModelViewer m_viewer = null;
-
// --- constructors/destructors ---
/** Constructor */
- public DebugViewTreeWalker()
- {
+ public DebugViewTreeWalker() {
m_viewer = DebugViewUtils.getDebugViewer();
}
-
+
/** Dispose method */
- public void dispose()
- {
+ public void dispose() {
m_viewer = null;
}
-
// --- methods ---
-
+
/** Walks the Debug View's tree,
* calling processElement for each element.
*/
- public void walk()
- {
+ public void walk() {
TreePath roots[] = getRootPaths();
- for(TreePath path : roots) {
- walk(path);
- }
+ for (TreePath path : roots) {
+ walk(path);
+ }
}
/**
@@ -75,25 +69,25 @@ public class DebugViewTreeWalker
* This method should invoke processElement on the element
* itself, and walkChildren() to process the children of the element.
*/
- public void walk(TreePath path)
- {
- if (path == null) return;
+ public void walk(TreePath path) {
+ if (path == null)
+ return;
boolean processChildren = processElement(path);
if (processChildren) {
walkChildren(path);
}
}
-
+
/** Walks children of the specified element.
* This method should invoke walk() to process
* each child element.
*/
- public void walkChildren(TreePath path)
- {
- if (path == null) return;
+ public void walkChildren(TreePath path) {
+ if (path == null)
+ return;
int children = m_viewer.getChildCount(path);
if (children > 0) {
- for (int i=0; i<children; ++i) {
+ for (int i = 0; i < children; ++i) {
Object child = m_viewer.getChildElement(path, i);
if (child != null) {
TreePath childPath = path.createChildPath(child);
@@ -102,35 +96,32 @@ public class DebugViewTreeWalker
}
}
}
-
+
/** Processes an element of the tree view.
* Returns true if children of this element should be processed,
* and false if they can be skipped.
*/
- public boolean processElement(TreePath path)
- {
+ public boolean processElement(TreePath path) {
return true;
}
-
// --- tree path utilities ---
- /**
- * Gets tree path of root element(s).
- * Note: each returned path is the root of a distinct debug session
+ /**
+ * Gets tree path of root element(s).
+ * Note: each returned path is the root of a distinct debug session
*/
- public TreePath[] getRootPaths()
- {
+ public TreePath[] getRootPaths() {
List<TreePath> paths = new ArrayList<TreePath>();
-
+
if (m_viewer != null) {
Tree tree = (Tree) m_viewer.getControl();
TreeItem[] items = tree.getItems();
-
+
for (TreeItem item : items) {
Object root = (item == null) ? null : item.getData();
if (root != null) {
- paths.add(new TreePath(new Object[] {root}));
+ paths.add(new TreePath(new Object[] { root }));
}
}
}
@@ -138,14 +129,12 @@ public class DebugViewTreeWalker
}
/** Gets tree path for child element. */
- public static TreePath getChildPath(TreePath path, Object childElement)
- {
+ public static TreePath getChildPath(TreePath path, Object childElement) {
return path.createChildPath(childElement);
}
-
+
/** Gets element from path. */
- public static Object getElement(TreePath path)
- {
+ public static Object getElement(TreePath path) {
return (path == null) ? null : path.getLastSegment();
}
} \ No newline at end of file
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/DebugViewUtils.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/DebugViewUtils.java
index 29f46853502..100ea8841ea 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/DebugViewUtils.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/DebugViewUtils.java
@@ -25,68 +25,66 @@ import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PlatformUI;
-
/** Assorted utilities for interacting with the Debug View (aka LaunchView). */
@SuppressWarnings("restriction") // allow access to internal classes
-public class DebugViewUtils
-{
+public class DebugViewUtils {
// --- static utility methods ---
-
- /**
- * Returns Debug View (a.k.a. LaunchView).
- */
- public static LaunchView getDebugView() {
+
+ /**
+ * Returns Debug View (a.k.a. LaunchView).
+ */
+ public static LaunchView getDebugView() {
return (LaunchView) getViewWithID(IDebugUIConstants.ID_DEBUG_VIEW);
- }
+ }
+
+ /**
+ * Returns tree model viewer for Debug View (a.k.a. LaunchView).
+ */
+ public static TreeModelViewer getDebugViewer() {
+ LaunchView debugView = getDebugView();
+ TreeModelViewer viewer = (debugView == null) ? null : (TreeModelViewer) debugView.getViewer();
+ return viewer;
+ }
- /**
- * Returns tree model viewer for Debug View (a.k.a. LaunchView).
- */
- public static TreeModelViewer getDebugViewer() {
- LaunchView debugView = getDebugView();
- TreeModelViewer viewer = (debugView == null) ? null : (TreeModelViewer) debugView.getViewer();
- return viewer;
- }
+ /** Gets workbench view (if any) with specified ID. */
+ public static IViewPart getViewWithID(String viewID) {
+ final String viewID_f = viewID;
+ RunnableWithResult<IViewPart> runnable = new RunnableWithResult<IViewPart>() {
+ @Override
+ public IViewPart call() {
+ IViewPart view = null;
+ IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ if (activePage != null) {
+ view = (viewID_f == null) ? null : activePage.findView(viewID_f);
+ }
+ return view;
+ }
+ };
+ // run on UI thread, wait for result
+ GUIUtils.execAndWait(runnable);
+ IViewPart result = runnable.getResult();
+ return result;
+ }
- /** Gets workbench view (if any) with specified ID. */
- public static IViewPart getViewWithID(String viewID) {
- final String viewID_f = viewID;
- RunnableWithResult<IViewPart> runnable =
- new RunnableWithResult<IViewPart>() {
- @Override
- public IViewPart call() {
- IViewPart view = null;
- IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- if (activePage != null) {
- view = (viewID_f == null) ? null : activePage.findView(viewID_f);
- }
- return view;
- }
- };
- // run on UI thread, wait for result
- GUIUtils.execAndWait(runnable);
- IViewPart result = runnable.getResult();
- return result;
- }
-
- /**
- * Sets debug view selection.
- * Specified selection is an IStructuredSelection containing a flat list
- * of the model objects (that is, _not_ the tree view nodes) to be selected.
- */
- public static boolean setDebugViewSelection(ISelection selection)
- {
+ /**
+ * Sets debug view selection.
+ * Specified selection is an IStructuredSelection containing a flat list
+ * of the model objects (that is, _not_ the tree view nodes) to be selected.
+ */
+ public static boolean setDebugViewSelection(ISelection selection) {
TreeModelViewer viewer = DebugViewUtils.getDebugViewer();
- if (viewer == null || selection == null) return false;
+ if (viewer == null || selection == null)
+ return false;
return viewer.trySelection(selection, true, true);
- }
-
- /**
- * Returns the debug view selection.
- */
- public static ISelection getDebugViewSelection() {
- TreeModelViewer viewer = DebugViewUtils.getDebugViewer();
- if (viewer == null) return null;
- return viewer.getSelection();
- }
+ }
+
+ /**
+ * Returns the debug view selection.
+ */
+ public static ISelection getDebugViewSelection() {
+ TreeModelViewer viewer = DebugViewUtils.getDebugViewer();
+ if (viewer == null)
+ return null;
+ return viewer.getSelection();
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/IDSFTargetDataProxy.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/IDSFTargetDataProxy.java
index e8c6e2d9492..2e2df13cd6c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/IDSFTargetDataProxy.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/IDSFTargetDataProxy.java
@@ -36,21 +36,25 @@ public interface IDSFTargetDataProxy {
public void getCores(DSFSessionState sessionState, DataRequestMonitor<ICoreDMContext[]> rm);
/** Requests list of Cores */
- public void getCores(DSFSessionState sessionState, ICPUDMContext cpuContext, DataRequestMonitor<ICoreDMContext[]> rm);
+ public void getCores(DSFSessionState sessionState, ICPUDMContext cpuContext,
+ DataRequestMonitor<ICoreDMContext[]> rm);
/** Requests list of Threads Related to the specified CPU and Core */
- public void getThreads(DSFSessionState sessionState, ICPUDMContext cpuContext, ICoreDMContext coreContext, DataRequestMonitor<IDMContext[]> rm);
+ public void getThreads(DSFSessionState sessionState, ICPUDMContext cpuContext, ICoreDMContext coreContext,
+ DataRequestMonitor<IDMContext[]> rm);
/** Requests data for the thread associated to the give execution context */
- public void getThreadData(DSFSessionState sessionState, ICPUDMContext cpuContext, ICoreDMContext coreContext, IMIExecutionDMContext execContext,
- DataRequestMonitor<IThreadDMData> rm);
+ public void getThreadData(DSFSessionState sessionState, ICPUDMContext cpuContext, ICoreDMContext coreContext,
+ IMIExecutionDMContext execContext, DataRequestMonitor<IThreadDMData> rm);
/** Requests frame data for a given thread */
- public void getTopFrameData(DSFSessionState sessionState, IMIExecutionDMContext execContext, DataRequestMonitor<IFrameDMData> rm);
+ public void getTopFrameData(DSFSessionState sessionState, IMIExecutionDMContext execContext,
+ DataRequestMonitor<IFrameDMData> rm);
/** Requests execution state of a thread. */
- public void getThreadExecutionState(DSFSessionState sessionState, ICPUDMContext cpuContext, ICoreDMContext coreContext,
- IMIExecutionDMContext execContext, IThreadDMData threadData, DataRequestMonitor<VisualizerExecutionState> rm);
+ public void getThreadExecutionState(DSFSessionState sessionState, ICPUDMContext cpuContext,
+ ICoreDMContext coreContext, IMIExecutionDMContext execContext, IThreadDMData threadData,
+ DataRequestMonitor<VisualizerExecutionState> rm);
/** Request load information for a single CPU or core */
public void getLoad(DSFSessionState sessionState, IDMContext context, DataRequestMonitor<ILoadInfo> rm);
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/MementoUtils.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/MementoUtils.java
index d1e29776728..927ed963c96 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/MementoUtils.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/MementoUtils.java
@@ -44,7 +44,6 @@ public class MementoUtils {
protected static final String ELEMENT_TAGNAME = "elem"; //$NON-NLS-1$
protected static final String ATTRIBUTE_KEY = "key"; //$NON-NLS-1$
protected static final String ATTRIBUTE_VALUE = "value"; //$NON-NLS-1$
-
/** Returns a XML memento, that encodes a single String parameter */
public static String encodeStringIntoMemento(String str) {
@@ -57,7 +56,7 @@ public class MementoUtils {
public static String decodeStringFromMemento(String memento) {
return decodeListFromMemento(memento).get(0);
}
-
+
/** Returns a XML memento, that encodes a Map of Strings */
public static String encodeMapIntoMemento(Map<String, String> keyPairValues) {
String returnValue = null;
@@ -96,8 +95,7 @@ public class MementoUtils {
}
return returnValue;
}
-
-
+
/** Returns a Map of Strings, decoded from a XML memento */
public static Map<String, String> decodeMapFromMemento(String memento) {
Map<String, String> keyPairValues = new HashMap<>();
@@ -116,22 +114,20 @@ public class MementoUtils {
NamedNodeMap nodeMap = elem.getAttributes();
String key = null;
String value = null;
- for(int idx = 0; idx < nodeMap.getLength(); idx++) {
+ for (int idx = 0; idx < nodeMap.getLength(); idx++) {
Node attrNode = nodeMap.item(idx);
if (attrNode.getNodeType() == Node.ATTRIBUTE_NODE) {
Attr attr = (Attr) attrNode;
if (attr.getName().equals(ATTRIBUTE_KEY)) {
key = attr.getValue();
- }
- else if (attr.getName().equals(ATTRIBUTE_VALUE)) {
+ } else if (attr.getName().equals(ATTRIBUTE_VALUE)) {
value = attr.getValue();
}
}
}
if (key != null && value != null) {
keyPairValues.put(key, value);
- }
- else {
+ } else {
throw new Exception();
}
}
@@ -142,7 +138,6 @@ public class MementoUtils {
return keyPairValues;
}
-
/** Returns a XML memento, that encodes a List of Strings */
public static String encodeListIntoMemento(List<String> labels) {
String returnValue = null;
@@ -198,8 +193,7 @@ public class MementoUtils {
String value = elem.getAttribute(ATTRIBUTE_VALUE);
if (value != null) {
list.add(value);
- }
- else {
+ } else {
throw new Exception();
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/PersistentSettingsManager.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/PersistentSettingsManager.java
index 813450241f7..878dfc4046a 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/PersistentSettingsManager.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/PersistentSettingsManager.java
@@ -15,7 +15,6 @@
package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.utils;
-
import java.security.InvalidParameterException;
import java.util.ArrayList;
import java.util.HashMap;
@@ -26,46 +25,45 @@ import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.MulticoreVisualiz
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.osgi.service.prefs.BackingStoreException;
-
-/**
- * This class manages one or more PersistentParameter, PersistentListParameter,
- * PersistentMapParameter objects, using a common name-space and optionally an
- * instance id so that multiple instances can each have their own version of
- * the parameter persisted
+/**
+ * This class manages one or more PersistentParameter, PersistentListParameter,
+ * PersistentMapParameter objects, using a common name-space and optionally an
+ * instance id so that multiple instances can each have their own version of
+ * the parameter persisted
*/
public class PersistentSettingsManager {
-
+
/** Base class for a persistent parameter */
private abstract class AbstractPersistentParameter<T> {
- protected final Class<T> myClazz;
+ protected final Class<T> myClazz;
protected final boolean m_perInstance;
protected final String m_storeKey;
-
+
/** Constructor */
public AbstractPersistentParameter(Class<T> clazz, boolean perInstance, String storeKey) {
myClazz = clazz;
m_perInstance = perInstance;
m_storeKey = storeKey;
}
-
+
// accessors
-
+
/** Returns whether this parameter is persisted independently for each client instance */
public boolean isPerInstance() {
return m_perInstance;
}
-
+
/** Returns the class of the parameter */
public Class<T> getClazz() {
return myClazz;
}
-
+
protected String getStoreKey() {
return m_storeKey;
}
-
+
// misc
-
+
@SuppressWarnings("unchecked")
/** Converts a value from a String to its expected generic type. This is a base
* implementation that converts some base types - Use/Override as needed for more complex
@@ -74,61 +72,57 @@ public class PersistentSettingsManager {
// TODO: Add other types? Float, etc
if (String.class.isAssignableFrom(getClazz())) {
return (T) val;
- }
- else if (Integer.class.isAssignableFrom(getClazz())) {
+ } else if (Integer.class.isAssignableFrom(getClazz())) {
return (T) Integer.valueOf(val);
- }
- else if (Boolean.class.isAssignableFrom(getClazz())) {
+ } else if (Boolean.class.isAssignableFrom(getClazz())) {
return (T) Boolean.valueOf(val);
}
return null;
}
-
+
/** Returns whether the wanted Class type is supported, to use as a persistent parameter */
protected boolean isTypeSupported(Class<T> clazz) {
// TODO: Add other types? Float, etc
- if (String.class.isAssignableFrom(clazz) ||
- Integer.class.isAssignableFrom(clazz) ||
- Boolean.class.isAssignableFrom(clazz))
- {
+ if (String.class.isAssignableFrom(clazz) || Integer.class.isAssignableFrom(clazz)
+ || Boolean.class.isAssignableFrom(clazz)) {
return true;
}
return false;
}
-
+
// TODO: add a way to notify clients that the value of a global (shared) parameter
// has been updated, and that they should re-read it.
}
-
+
/** Class for a persistent parameter */
public class PersistentParameter<T> extends AbstractPersistentParameter<T> {
private T m_value;
private T m_defaultValue;
-
+
/**
* Constructor
* @param name: unique (for the namespace) label that identifies this parameter
- * @param perInstance: whether the parameter's value is persisted per client instance or
- * globally (one common shared stored value for all instances)
+ * @param perInstance: whether the parameter's value is persisted per client instance or
+ * globally (one common shared stored value for all instances)
* @param storeKey : The key used to store the parameter in the store
*/
public PersistentParameter(Class<T> clazz, boolean perInstance, String storeKey) {
super(clazz, perInstance, storeKey);
}
-
- /** Sets the default value to use if no persistent
+
+ /** Sets the default value to use if no persistent
* value is found for this parameter */
public void setDefault(T defaultValue) {
m_defaultValue = defaultValue;
}
-
+
/** Sets the value to persist */
public void set(T value) {
m_value = value;
// save value in preference store
persistParameter(value);
}
-
+
/** Returns the persistent value, if found, else the default value */
public T value() {
if (m_value == null) {
@@ -136,17 +130,17 @@ public class PersistentSettingsManager {
m_value = restoreParameter();
}
// parameter has one value for any/all instances
- else if(!isPerInstance()) {
- // do not rely on cached value, since another instance might have
+ else if (!isPerInstance()) {
+ // do not rely on cached value, since another instance might have
// changed it - reread from data store
m_value = restoreParameter();
}
- return (m_value == null)? m_defaultValue : m_value;
+ return (m_value == null) ? m_defaultValue : m_value;
}
-
- /**
- * Gets the persistent value, optionally forcing re-reading stored value
- * @param forceRefresh whether to force to re-read memento in case value changed
+
+ /**
+ * Gets the persistent value, optionally forcing re-reading stored value
+ * @param forceRefresh whether to force to re-read memento in case value changed
*/
public T value(boolean forceRefresh) {
if (forceRefresh) {
@@ -154,23 +148,24 @@ public class PersistentSettingsManager {
}
return value();
}
-
+
/** Attempts to find the parameter in the preference store. Returns null if not found */
private T restoreParameter() {
IEclipsePreferences store = MulticoreVisualizerUIPlugin.getEclipsePreferenceStore();
String memento = store.get(getStoreKey(), null);
- if (memento == null) return null;
-
- String val = MementoUtils.decodeStringFromMemento(memento);
- T convertedVal = convertToT(val);
+ if (memento == null)
+ return null;
+
+ String val = MementoUtils.decodeStringFromMemento(memento);
+ T convertedVal = convertToT(val);
return convertedVal;
}
-
+
/** Saves parameter's value in preference store */
private void persistParameter(T value) {
// create memento
String memento = MementoUtils.encodeStringIntoMemento(value.toString());
-
+
// save memento in store
if (memento != null) {
IEclipsePreferences store = MulticoreVisualizerUIPlugin.getEclipsePreferenceStore();
@@ -183,29 +178,29 @@ public class PersistentSettingsManager {
}
}
}
-
+
/** Class for a persistent {@literal List<T>} parameter */
public class PersistentListParameter<T> extends AbstractPersistentParameter<T> {
private List<T> m_value;
private List<T> m_defaultValue;
-
+
public PersistentListParameter(Class<T> clazz, boolean perInstance, String storeKey) {
super(clazz, perInstance, storeKey);
}
-
- /** Sets the default value to use if no persistent
+
+ /** Sets the default value to use if no persistent
* value is found for this parameter */
public void setDefault(List<T> defaultValues) {
m_defaultValue = defaultValues;
}
-
+
/** Sets the value to persist */
public void set(List<T> values) {
m_value = values;
// save value in preference store
persistParameter(values);
}
-
+
/** Returns the persistent value, if found, else the default value */
public List<T> value() {
if (m_value == null) {
@@ -213,17 +208,17 @@ public class PersistentSettingsManager {
m_value = restoreParameter();
}
// parameter has one value for any/all instances
- else if(!isPerInstance()) {
- // do not rely on cached value, since another instance might have
+ else if (!isPerInstance()) {
+ // do not rely on cached value, since another instance might have
// changed it - reread from data store
m_value = restoreParameter();
}
- return (m_value == null)? m_defaultValue : m_value ;
+ return (m_value == null) ? m_defaultValue : m_value;
}
-
- /**
- * Gets the persistent value, optionally forcing re-reading stored value
- * @param forceRefresh whether to force to re-read memento in case value changed
+
+ /**
+ * Gets the persistent value, optionally forcing re-reading stored value
+ * @param forceRefresh whether to force to re-read memento in case value changed
*/
public List<T> value(boolean forceRefresh) {
if (forceRefresh) {
@@ -231,26 +226,27 @@ public class PersistentSettingsManager {
}
return value();
}
-
+
/** Attempts to find the parameter in the preference store. Returns null if not found */
private List<T> restoreParameter() {
IEclipsePreferences store = MulticoreVisualizerUIPlugin.getEclipsePreferenceStore();
String memento = store.get(getStoreKey(), null);
- if (memento == null) return null;
-
- List<String> vals = MementoUtils.decodeListFromMemento(memento);
+ if (memento == null)
+ return null;
+
+ List<String> vals = MementoUtils.decodeListFromMemento(memento);
// convert from List<String> to List<T>
- List<T> convertedVal = convertToT(vals);
+ List<T> convertedVal = convertToT(vals);
return convertedVal;
}
-
+
/** Saves parameter's value in preference store */
private void persistParameter(List<T> values) {
// Convert List<T> to List<String>
List<String> strList = convertTListToStringList(values);
// create memento from List<String>
String memento = MementoUtils.encodeListIntoMemento(strList);
-
+
// save memento in store
if (memento != null) {
IEclipsePreferences store = MulticoreVisualizerUIPlugin.getEclipsePreferenceStore();
@@ -262,97 +258,97 @@ public class PersistentSettingsManager {
}
}
}
-
- /** For list parameters, converts the restored values from String
+
+ /** For list parameters, converts the restored values from String
* to its expected generic type */
private List<T> convertToT(List<String> vals) {
List<T> convertedList = new ArrayList<>();
-
- for(String val : vals) {
+
+ for (String val : vals) {
convertedList.add(convertToT(val));
}
return convertedList;
}
-
+
/** Converts a list of generic type to a list of String */
private List<String> convertTListToStringList(List<T> tList) {
List<String> strList = new ArrayList<>();
// convert list to list of String
- for(T elem : tList) {
+ for (T elem : tList) {
strList.add(elem.toString());
}
return strList;
}
}
-
-
+
/** Class for a persistent {@literal Map<String,T>} parameter */
public class PersistentMapParameter<T> extends AbstractPersistentParameter<T> {
- private Map<String,T> m_value;
- private Map<String,T> m_defaultValue;
-
+ private Map<String, T> m_value;
+ private Map<String, T> m_defaultValue;
+
public PersistentMapParameter(Class<T> clazz, boolean perInstance, String storeKey) {
super(clazz, perInstance, storeKey);
}
-
- /** Sets the default value to use if no persistent
+
+ /** Sets the default value to use if no persistent
* value is found for this parameter */
- public void setDefault(Map<String,T> defaultValues) {
+ public void setDefault(Map<String, T> defaultValues) {
m_defaultValue = defaultValues;
}
-
+
/** Sets the value to persist */
- public void set(Map<String,T> values) {
+ public void set(Map<String, T> values) {
m_value = values;
// save value in preference store
persistParameter(values);
}
-
+
/** Returns the persistent value, if found, else the default value */
- public Map<String,T> value() {
+ public Map<String, T> value() {
if (m_value == null) {
// attempt to get the value from the preference store
m_value = restoreParameter();
}
// parameter has one value for any/all instances
- else if(!isPerInstance()) {
- // do not rely on cached value, since another instance might have
+ else if (!isPerInstance()) {
+ // do not rely on cached value, since another instance might have
// changed it - reread from data store
m_value = restoreParameter();
}
- return (m_value == null)? m_defaultValue : m_value ;
+ return (m_value == null) ? m_defaultValue : m_value;
}
-
- /**
- * Gets the persistent value, optionally forcing re-reading stored value
- * @param forceRefresh whether to force to re-read memento in case value changed
+
+ /**
+ * Gets the persistent value, optionally forcing re-reading stored value
+ * @param forceRefresh whether to force to re-read memento in case value changed
*/
- public Map<String,T> value(boolean forceRefresh) {
+ public Map<String, T> value(boolean forceRefresh) {
if (forceRefresh) {
m_value = null;
}
return value();
}
-
+
/** Attempts to find the parameter in the preference store. Returns null if not found */
- private Map<String,T> restoreParameter() {
+ private Map<String, T> restoreParameter() {
IEclipsePreferences store = MulticoreVisualizerUIPlugin.getEclipsePreferenceStore();
String memento = store.get(getStoreKey(), null);
- if (memento == null) return null;
-
- Map<String,String> vals = MementoUtils.decodeMapFromMemento(memento);
+ if (memento == null)
+ return null;
+
+ Map<String, String> vals = MementoUtils.decodeMapFromMemento(memento);
// convert from Map<String,String> to Map<String,T>
- Map<String,T> convertedVal = convertToT(vals);
+ Map<String, T> convertedVal = convertToT(vals);
return convertedVal;
}
-
+
/** Saves parameter's value in preference store */
- private void persistParameter(Map<String,T> values) {
+ private void persistParameter(Map<String, T> values) {
// Convert Map<String,T> to Map<String,String>
- Map<String,String> strMap = convertTMapToStringMap(values);
+ Map<String, String> strMap = convertTMapToStringMap(values);
// create memento from Map
String memento = MementoUtils.encodeMapIntoMemento(strMap);
-
+
// save memento in store
if (memento != null) {
IEclipsePreferences store = MulticoreVisualizerUIPlugin.getEclipsePreferenceStore();
@@ -364,74 +360,75 @@ public class PersistentSettingsManager {
}
}
}
-
- /** For Map parameters, converts the restored values from {@literal Map<String,String>}
+
+ /** For Map parameters, converts the restored values from {@literal Map<String,String>}
* to {@literal Map<String, T>} */
- private Map<String,T> convertToT(Map<String,String> vals) {
- Map<String,T> convertedMap = new HashMap<>();
-
- for(String key : vals.keySet()) {
+ private Map<String, T> convertToT(Map<String, String> vals) {
+ Map<String, T> convertedMap = new HashMap<>();
+
+ for (String key : vals.keySet()) {
convertedMap.put(key, convertToT(vals.get(key)));
}
return convertedMap;
}
-
+
/** Converts a {@literal Map<String,T>} to a {@literal Map<String,String>} */
- private Map<String,String> convertTMapToStringMap(Map<String,T> map) {
- Map<String,String> strMap = new HashMap<>();
+ private Map<String, String> convertTMapToStringMap(Map<String, T> map) {
+ Map<String, String> strMap = new HashMap<>();
// convert each entry
- for(String key : map.keySet()) {
+ for (String key : map.keySet()) {
strMap.put(key, map.get(key).toString());
}
return strMap;
}
}
-
+
/** String that is used to insulate the namespace for the parameters
* saved by a specific instance of the class */
private final String m_category;
-
- /** an identifier that differentiates different client instances. For example, to save the
+
+ /** an identifier that differentiates different client instances. For example, to save the
* value of a parameter that is applicable per-view, the view secondary id could be used so
* that each view has its own stored value */
private final String m_instance;
-
+
/**
* Constructor
* @param category : an optional id that is used to insulate the namespace for the parameters
- * saved by this instance of the class. Using different category values permits to distinguish
- * two or more parameters with the same label. Example: class name where the parameter is used.
+ * saved by this instance of the class. Using different category values permits to distinguish
+ * two or more parameters with the same label. Example: class name where the parameter is used.
* This can be set to null if unused.
- * @param instance : a unique id that identifies the client's instance. Used when
- * a parameter is defined as per-instance
+ * @param instance : a unique id that identifies the client's instance. Used when
+ * a parameter is defined as per-instance
*/
public PersistentSettingsManager(String category, String instance) {
m_category = category != null ? category : ""; //$NON-NLS-1$
m_instance = instance != null ? instance : ""; //$NON-NLS-1$
}
-
- /** Constructor
- * @param instance: a unique id that identifies the client's instance. Used when
+
+ /** Constructor
+ * @param instance: a unique id that identifies the client's instance. Used when
* a parameter is not global (i.e. meant to be persisted per instance).
*/
public PersistentSettingsManager(String instance) {
this(null, instance);
}
-
+
/** Constructor */
public PersistentSettingsManager() {
this(null, null);
}
-
+
/**
* Creates a new persistent parameter, using the namespace and instance id of this manager.
* @param clazz: the class of the persistent parameter. Supported types: String, Integer, Boolean
- * @param label: unique label that identifies this parameter.
- * @param perInstance: whether the parameter's value should be persisted per client instance or
+ * @param label: unique label that identifies this parameter.
+ * @param perInstance: whether the parameter's value should be persisted per client instance or
* globally (one common shared stored value for all instances)
* @param defaultValue: default value to use (mandatory)
*/
- public <T> PersistentParameter<T> getNewParameter(Class<T> clazz, String label, boolean perInstance, T defaultValue) {
+ public <T> PersistentParameter<T> getNewParameter(Class<T> clazz, String label, boolean perInstance,
+ T defaultValue) {
PersistentParameter<T> setting;
// build the final store key with category, parameter label and specific instance, if applicable
setting = new PersistentParameter<T>(clazz, perInstance, getStorageKey(perInstance) + "." + label); //$NON-NLS-1$
@@ -439,21 +436,21 @@ public class PersistentSettingsManager {
if (setting.isTypeSupported(clazz)) {
setting.setDefault(defaultValue);
return setting;
- }
- else {
+ } else {
throw new InvalidParameterException("Unsupported class type: " + clazz.toString()); //$NON-NLS-1$
}
}
-
+
/**
* Creates a new persistent {@literal List<T>} parameter, using the namespace and instance id of this manager.
* @param clazz: the class of the persistent parameter List (e.g. List of that type). Supported types: String, Integer, Boolean
- * @param label: unique label that identifies this parameter.
- * @param perInstance: whether the parameter's value should be persisted per client instance or
+ * @param label: unique label that identifies this parameter.
+ * @param perInstance: whether the parameter's value should be persisted per client instance or
* globally (one common shared stored value for all instances)
- * @param defaultValue: default value to use (mandatory).
+ * @param defaultValue: default value to use (mandatory).
*/
- public <T> PersistentListParameter<T> getNewListParameter(Class<T> clazz, String label, boolean perInstance, List<T> defaultValue) {
+ public <T> PersistentListParameter<T> getNewListParameter(Class<T> clazz, String label, boolean perInstance,
+ List<T> defaultValue) {
PersistentListParameter<T> setting;
// build the final store key with category, parameter label and specific instance, if applicable
setting = new PersistentListParameter<T>(clazz, perInstance, getStorageKey(perInstance) + "." + label); //$NON-NLS-1$
@@ -461,21 +458,21 @@ public class PersistentSettingsManager {
if (setting.isTypeSupported(clazz)) {
setting.setDefault(defaultValue);
return setting;
- }
- else {
+ } else {
throw new InvalidParameterException("Unsupported class type: " + clazz.toString()); //$NON-NLS-1$
}
}
-
+
/**
* Creates a new persistent {@literal Map<String,T>} parameter, using the namespace and instance id of this manager.
* @param clazz: the class of the persistent parameter List (e.g. List of that type). Supported types: String, Integer, Boolean
- * @param label: unique label that identifies this parameter.
- * @param perInstance: whether the parameter's value should be persisted per client instance or
+ * @param label: unique label that identifies this parameter.
+ * @param perInstance: whether the parameter's value should be persisted per client instance or
* globally (one common shared stored value for all instances)
- * @param defaultValue: default value to use (mandatory).
+ * @param defaultValue: default value to use (mandatory).
*/
- public <T> PersistentMapParameter<T> getNewMapParameter(Class<T> clazz, String label, boolean perInstance, Map<String,T> defaultValue) {
+ public <T> PersistentMapParameter<T> getNewMapParameter(Class<T> clazz, String label, boolean perInstance,
+ Map<String, T> defaultValue) {
PersistentMapParameter<T> setting;
// build the final store key with category, parameter label and specific instance, if applicable
setting = new PersistentMapParameter<T>(clazz, perInstance, getStorageKey(perInstance) + "." + label); //$NON-NLS-1$
@@ -483,17 +480,16 @@ public class PersistentSettingsManager {
if (setting.isTypeSupported(clazz)) {
setting.setDefault(defaultValue);
return setting;
- }
- else {
+ } else {
throw new InvalidParameterException("Unsupported class type: " + clazz.toString()); //$NON-NLS-1$
}
}
-
+
// ---- misc ----
-
- /** Returns the key to be used to save parameter, taking into account the
+
+ /** Returns the key to be used to save parameter, taking into account the
* instance id, if applicable */
private String getStorageKey(boolean perInstance) {
- return (perInstance ? m_instance : "") + (!m_category.isEmpty() ? "." + m_category : ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ return (perInstance ? m_instance : "") + (!m_category.isEmpty() ? "." + m_category : ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/service/CommonDsfTest.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/service/CommonDsfTest.java
index 036c39408d0..3508f95deab 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/service/CommonDsfTest.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/service/CommonDsfTest.java
@@ -37,51 +37,51 @@ import org.junit.BeforeClass;
* Helper base class for running DSF related tests
*/
public class CommonDsfTest extends CommonTest {
-
+
protected static DsfSession fSession = null;
-
+
/**
- * Setup the test.
+ * Setup the test.
* The session is typically configured once per class load, but we allow subclasses to override this,
- * and sometimes re-setup during a test (or interactive debugging).
- * Therefore {@link Before} is used, not {@link BeforeClass}.
+ * and sometimes re-setup during a test (or interactive debugging).
+ * Therefore {@link Before} is used, not {@link BeforeClass}.
*/
@Before
public void setup() {
- if(fSession != null) {
+ if (fSession != null) {
return; // Already set-up
}
-
+
doSetupSession();
}
-
+
protected void doSetupSession() {
fSession = DsfSession.startSession(new DefaultDsfExecutor(GdbPlugin.PLUGIN_ID), GdbPlugin.PLUGIN_ID);
-
+
registerLaunch();
}
@AfterClass
public static void tearDown() {
- if(fSession != null) {
+ if (fSession != null) {
DsfSession.endSession(fSession);
fSession = null;
}
}
-
+
protected ILaunchConfigurationType getCLaunchConfigType() {
return getLaunchManager().getLaunchConfigurationType(ICDTLaunchConfigurationConstants.ID_LAUNCH_C_APP);
}
-
+
protected ILaunchManager getLaunchManager() {
return DebugPlugin.getDefault().getLaunchManager();
}
-
+
protected void registerLaunch() {
ILaunchConfigurationWorkingCopy lc;
try {
lc = getCLaunchConfigType().newInstance(null, "TestLaunch");
- } catch(CoreException e) {
+ } catch (CoreException e) {
fail(e.getMessage());
return;
}
@@ -89,11 +89,11 @@ public class CommonDsfTest extends CommonTest {
DsfLaunch dsfLaunch = new DsfLaunch(lc, ILaunchManager.DEBUG_MODE, sourceLocator);
fSession.registerModelAdapter(ILaunch.class, dsfLaunch);
}
-
+
protected RequestMonitor newRequestMonitor() {
return new RequestMonitor(fSession.getExecutor(), null);
}
-
+
protected <T> DataRequestMonitor<T> newDataRequestMonitor() {
return new DataRequestMonitor<>(fSession.getExecutor(), null);
}
@@ -103,10 +103,10 @@ public class CommonDsfTest extends CommonTest {
* Misc test utilities.
*/
class CommonTest {
- /* ----------------- ----------------- */
+ /* ----------------- ----------------- */
- @SafeVarargs
- public static <T> T[] array(T... elems) {
- return elems;
- }
+ @SafeVarargs
+ public static <T> T[] array(T... elems) {
+ return elems;
+ }
} \ No newline at end of file
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/service/GDBRegisterTest.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/service/GDBRegisterTest.java
index 8c668e1204a..4b7a9dfe4f4 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/service/GDBRegisterTest.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/service/GDBRegisterTest.java
@@ -29,23 +29,22 @@ import org.eclipse.cdt.dsf.mi.service.command.MIControlDMContext;
import org.eclipse.core.runtime.Assert;
import org.junit.Test;
-
public class GDBRegisterTest extends CommonDsfTest {
-
+
public static final String PROCESS_A = "processA";
public static final String PROCESS_B = "processB";
-
+
protected MIProcesses miProcesses;
protected GDBRegisters gdbRegisters;
@Override
protected void doSetupSession() {
super.doSetupSession();
-
+
miProcesses = new MIProcesses(fSession);
gdbRegisters = createGdbRegisters();
}
-
+
protected GDBRegisters createGdbRegisters() {
return new GDBRegisters(fSession) {
@Override
@@ -54,56 +53,57 @@ public class GDBRegisterTest extends CommonDsfTest {
}
};
}
-
+
@Test
- public void testRegisterPersistence() throws Exception { testRegisterPersistence$(); }
+ public void testRegisterPersistence() throws Exception {
+ testRegisterPersistence$();
+ }
+
public void testRegisterPersistence$() throws Exception {
-
+
MIControlDMContext controlDmc = new MIControlDMContext(fSession.getId(), "TestControl");
IProcessDMContext processDmcA = miProcesses.createProcessContext(controlDmc, PROCESS_A);
IProcessDMContext processDmcB = miProcesses.createProcessContext(controlDmc, PROCESS_B);
IMIContainerDMContext containerA = miProcesses.createContainerContext(processDmcA, "containerA");
IMIContainerDMContext containerB = miProcesses.createContainerContext(processDmcB, "containerB");
-
-
+
MIRegisterGroupDMC[] initialRegisterGroups = gdbRegisters.readGroupsFromMemento(containerA);
Assert.isTrue(initialRegisterGroups.length == 0);
-
+
MIRegisterGroupDMC registerGroupA = addRegisterGroup(containerA, "RegGroupA", "register_foo");
// check build descriptors
IRegisterGroupDescriptor[] buildDescriptors = gdbRegisters.buildDescriptors();
- org.junit.Assert.assertEquals(buildDescriptors[0].getContainerId(), gdbRegisters.getPersistenceIdForRegisterGroupContainer(containerA));
-
+ org.junit.Assert.assertEquals(buildDescriptors[0].getContainerId(),
+ gdbRegisters.getPersistenceIdForRegisterGroupContainer(containerA));
+
// Save then check persistence
gdbRegisters.save();
checkAfterAdding_GroupA(containerA, containerB, registerGroupA);
-
+
// Now add a second register group to a different process context
MIRegisterGroupDMC registerGroupB = addRegisterGroup(containerB, "RegGroupB", "register_bar");
gdbRegisters.save();
checkAfterAdding_GroupB(containerA, containerB, registerGroupA, registerGroupB);
}
- protected void checkAfterAdding_GroupA(
- IMIContainerDMContext containerA, IMIContainerDMContext containerB, MIRegisterGroupDMC registerGroupA
- ) {
+ protected void checkAfterAdding_GroupA(IMIContainerDMContext containerA, IMIContainerDMContext containerB,
+ MIRegisterGroupDMC registerGroupA) {
checkRegisterGroupMemento(containerA, registerGroupA);
checkRegisterGroupsMemento(containerB, array());
}
-
- protected void checkAfterAdding_GroupB(
- IMIContainerDMContext containerA, IMIContainerDMContext containerB,
- MIRegisterGroupDMC registerGroupA, MIRegisterGroupDMC registerGroupB
- ) {
+
+ protected void checkAfterAdding_GroupB(IMIContainerDMContext containerA, IMIContainerDMContext containerB,
+ MIRegisterGroupDMC registerGroupA, MIRegisterGroupDMC registerGroupB) {
checkRegisterGroupMemento(containerA, registerGroupA);
checkRegisterGroupMemento(containerB, registerGroupB);
}
- protected MIRegisterGroupDMC addRegisterGroup(IMIContainerDMContext container, String groupName, String registerName) {
+ protected MIRegisterGroupDMC addRegisterGroup(IMIContainerDMContext container, String groupName,
+ String registerName) {
MIRegisterGroupDMC registerGroup = new MIRegisterGroupDMC(gdbRegisters, container, 1, groupName);
MIRegisterDMC rgFoo = new MIRegisterDMC(gdbRegisters, registerGroup, 1, registerName);
-
+
gdbRegisters.addRegisterGroup(container, registerGroup.getName(), array(rgFoo), newRequestMonitor());
return registerGroup;
}
@@ -111,33 +111,34 @@ public class GDBRegisterTest extends CommonDsfTest {
protected void checkRegisterGroupMemento(IMIContainerDMContext container, MIRegisterGroupDMC registerGroup) {
checkRegisterGroupsMemento(container, array(registerGroup));
}
-
- protected void checkRegisterGroupsMemento(IMIContainerDMContext container, MIRegisterGroupDMC[] expectedRegisterGroups) {
+
+ protected void checkRegisterGroupsMemento(IMIContainerDMContext container,
+ MIRegisterGroupDMC[] expectedRegisterGroups) {
MIRegisterGroupDMC[] savedRegisterGroups = gdbRegisters.readGroupsFromMemento(container);
- if(expectedRegisterGroups == null) {
+ if (expectedRegisterGroups == null) {
assertTrue(savedRegisterGroups == null);
return;
}
-
+
assertTrue(expectedRegisterGroups.length == savedRegisterGroups.length);
-
+
for (int ix = 0; ix < expectedRegisterGroups.length; ix++) {
MIRegisterGroupDMC expectedRG = expectedRegisterGroups[ix];
int groupNo = savedRegisterGroups[ix].getGroupNo(); // Don't check group number, so set expected to obtained value
expectedRegisterGroups[ix] = new MIRegisterGroupDMC(gdbRegisters, container, groupNo, expectedRG.getName());
}
-
+
assertTrue(Arrays.equals(expectedRegisterGroups, savedRegisterGroups));
}
-
+
/* ----------------- ----------------- */
-
+
/**
* Variant of {@link GDBRegisterTest} where register groups are saved without a container id.
* This is the default behavior for register group persistence.
*/
public static class GDBRegisterTest_NoContainerTest extends GDBRegisterTest {
-
+
@Override
protected GDBRegisters createGdbRegisters() {
return new GDBRegisters(fSession) {
@@ -147,27 +148,24 @@ public class GDBRegisterTest extends CommonDsfTest {
}
};
}
-
+
@Override
- protected void checkAfterAdding_GroupA(
- IMIContainerDMContext containerA, IMIContainerDMContext containerB, MIRegisterGroupDMC registerGroupA
- ) {
+ protected void checkAfterAdding_GroupA(IMIContainerDMContext containerA, IMIContainerDMContext containerB,
+ MIRegisterGroupDMC registerGroupA) {
checkRegisterGroupMemento(containerA, registerGroupA);
checkRegisterGroupMemento(containerB, registerGroupA);
}
-
+
@Override
- protected void checkAfterAdding_GroupB(
- IMIContainerDMContext containerA, IMIContainerDMContext containerB,
- MIRegisterGroupDMC registerGroupA, MIRegisterGroupDMC registerGroupB
- ) {
+ protected void checkAfterAdding_GroupB(IMIContainerDMContext containerA, IMIContainerDMContext containerB,
+ MIRegisterGroupDMC registerGroupA, MIRegisterGroupDMC registerGroupB) {
checkRegisterGroupsMemento(containerA, array(registerGroupA, registerGroupB));
checkRegisterGroupsMemento(containerB, array(registerGroupA, registerGroupB));
}
}
-
+
public static class GDBRegisterTest_WithAlternativeProcessIdTest extends GDBRegisterTest {
-
+
@Override
protected GDBRegisters createGdbRegisters() {
return new GDBRegisters(fSession) {
@@ -175,28 +173,29 @@ public class GDBRegisterTest extends CommonDsfTest {
protected boolean useProcessIdAsRegisterGroupPersistanceId() {
return true;
}
+
@Override
protected String getPersistenceIdForRegisterGroupContainer(IContainerDMContext contDmc) {
return super.getPersistenceIdForRegisterGroupContainer(contDmc) + "XXX";
}
};
}
-
+
}
-
-
+
public static class GDBRegisterTest_WithContainerDMContextTest extends GDBRegisterTest {
-
+
@Override
protected GDBRegisters createGdbRegisters() {
return new GDBRegisters(fSession) {
@Override
protected String getPersistenceIdForRegisterGroupContainer(IContainerDMContext contDmc) {
- IMIContainerDMContext contextDmc = DMContexts.getAncestorOfType(contDmc, IMIContainerDMContext.class);
+ IMIContainerDMContext contextDmc = DMContexts.getAncestorOfType(contDmc,
+ IMIContainerDMContext.class);
return contextDmc.getGroupId();
}
};
}
-
+
}
} \ No newline at end of file
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/tests/AutomatedIntegrationSuite.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/tests/AutomatedIntegrationSuite.java
index 7fbaea52155..9bdce96b080 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/tests/AutomatedIntegrationSuite.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/tests/AutomatedIntegrationSuite.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Alvaro Sanchez-Leon (Ericsson) - Initial Implementation
*******************************************************************************/
@@ -29,19 +29,10 @@ import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
// Add additional test case classes below
-@SuiteClasses({MIThreadTests.class,
- TestMIBreakInsertCommand.class,
- TestMICommandConstructCommand.class,
- TestMIGDBSetSysroot.class,
- LaunchUtilsTest.class,
- MIStringHandlerTests.class,
- ProcStatParserTest.class,
- FilePartsTest.class,
- GDBRegisterTest.class,
- GDBRegisterTest_NoContainerTest.class,
- GDBRegisterTest_WithAlternativeProcessIdTest.class,
- GDBRegisterTest_WithContainerDMContextTest.class,
-})
+@SuiteClasses({ MIThreadTests.class, TestMIBreakInsertCommand.class, TestMICommandConstructCommand.class,
+ TestMIGDBSetSysroot.class, LaunchUtilsTest.class, MIStringHandlerTests.class, ProcStatParserTest.class,
+ FilePartsTest.class, GDBRegisterTest.class, GDBRegisterTest_NoContainerTest.class,
+ GDBRegisterTest_WithAlternativeProcessIdTest.class, GDBRegisterTest_WithContainerDMContextTest.class, })
public class AutomatedIntegrationSuite {
// Often overriding BeforeClass method here
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/tests/FilePartsTest.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/tests/FilePartsTest.java
index bb4a35cade8..e46bddcc59a 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/tests/FilePartsTest.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/tests/FilePartsTest.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Jonah Graham (Kichwa Coders) - Initial Implementation
*******************************************************************************/
@@ -20,7 +20,7 @@ import org.junit.Test;
/**
* TODO: Move this test closer to the code it is testing.
- *
+ *
* At the time I wrote this test, there was no obvious place to put it, a test
* suite for org.eclipse.cdt.debug.core is needed.
*
@@ -31,59 +31,60 @@ public class FilePartsTest {
assertEquals("", CDebugUtils.getFileParts("").getFolder());
assertEquals("", CDebugUtils.getFileParts("").getFileName());
assertEquals("", CDebugUtils.getFileParts("").getExtension());
-
+
assertEquals("", CDebugUtils.getFileParts(".").getFolder());
assertEquals(".", CDebugUtils.getFileParts(".").getFileName());
assertEquals("", CDebugUtils.getFileParts(".").getExtension());
-
+
assertEquals("", CDebugUtils.getFileParts(".d").getFolder());
assertEquals(".d", CDebugUtils.getFileParts(".d").getFileName());
assertEquals("d", CDebugUtils.getFileParts(".d").getExtension());
-
+
assertEquals("", CDebugUtils.getFileParts(".dot").getFolder());
assertEquals(".dot", CDebugUtils.getFileParts(".dot").getFileName());
assertEquals("dot", CDebugUtils.getFileParts(".dot").getExtension());
-
+
assertEquals("", CDebugUtils.getFileParts("file").getFolder());
assertEquals("file", CDebugUtils.getFileParts("file").getFileName());
assertEquals("", CDebugUtils.getFileParts("file").getExtension());
-
+
assertEquals("", CDebugUtils.getFileParts("file.").getFolder());
assertEquals("file.", CDebugUtils.getFileParts("file.").getFileName());
assertEquals("", CDebugUtils.getFileParts("file.").getExtension());
-
+
assertEquals("", CDebugUtils.getFileParts("file.d").getFolder());
assertEquals("file.d", CDebugUtils.getFileParts("file.d").getFileName());
assertEquals("d", CDebugUtils.getFileParts("file.d").getExtension());
-
+
assertEquals("", CDebugUtils.getFileParts("file.dot").getFolder());
assertEquals("file.dot", CDebugUtils.getFileParts("file.dot").getFileName());
assertEquals("dot", CDebugUtils.getFileParts("file.dot").getExtension());
-
+
assertEquals("/folder/", CDebugUtils.getFileParts("/folder/file.dot").getFolder());
assertEquals("file.dot", CDebugUtils.getFileParts("/folder/file.dot").getFileName());
assertEquals("dot", CDebugUtils.getFileParts("/folder/file.dot").getExtension());
-
- assertEquals("/folder1/folder2/folder3/", CDebugUtils.getFileParts("/folder1/folder2/folder3/file.dot").getFolder());
+
+ assertEquals("/folder1/folder2/folder3/",
+ CDebugUtils.getFileParts("/folder1/folder2/folder3/file.dot").getFolder());
assertEquals("file.dot", CDebugUtils.getFileParts("/folder/file.dot").getFileName());
assertEquals("dot", CDebugUtils.getFileParts("/folder/file.dot").getExtension());
-
+
assertEquals("/folder/", CDebugUtils.getFileParts("/folder/.dot").getFolder());
assertEquals(".dot", CDebugUtils.getFileParts("/folder/.dot").getFileName());
assertEquals("dot", CDebugUtils.getFileParts("/folder/.dot").getExtension());
-
+
assertEquals("/folder/../other/", CDebugUtils.getFileParts("/folder/../other/.dot").getFolder());
assertEquals(".dot", CDebugUtils.getFileParts("/folder/../other/.dot").getFileName());
assertEquals("dot", CDebugUtils.getFileParts("/folder/../other/.dot").getExtension());
-
+
assertEquals("/folder//", CDebugUtils.getFileParts("/folder//.dot").getFolder());
assertEquals(".dot", CDebugUtils.getFileParts("/folder//.dot").getFileName());
assertEquals("dot", CDebugUtils.getFileParts("/folder//.dot").getExtension());
-
+
assertEquals("C:\\folder\\", CDebugUtils.getFileParts("C:\\folder\\.dot").getFolder());
assertEquals(".dot", CDebugUtils.getFileParts("C:\\folder\\.dot").getFileName());
assertEquals("dot", CDebugUtils.getFileParts("C:\\folder\\.dot").getExtension());
-
+
assertEquals("C:\\\\folder\\", CDebugUtils.getFileParts("C:\\\\folder\\.dot").getFolder());
assertEquals(".dot", CDebugUtils.getFileParts("C:\\\\folder\\.dot").getFileName());
assertEquals("dot", CDebugUtils.getFileParts("C:\\\\folder\\.dot").getExtension());
@@ -99,6 +100,6 @@ public class FilePartsTest {
assertEquals("\\\\unc\\path\\", CDebugUtils.getFileParts("\\\\unc\\path\\file.dot").getFolder());
assertEquals("file.dot", CDebugUtils.getFileParts("\\\\unc\\path\\file.dot").getFileName());
assertEquals("dot", CDebugUtils.getFileParts("\\\\unc\\path\\file.dot").getExtension());
-
+
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/tests/LaunchUtilsTest.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/tests/LaunchUtilsTest.java
index 2ad8336f1fc..15366f24212 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/tests/LaunchUtilsTest.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/tests/LaunchUtilsTest.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Marc-Andre Laperle - Added test for the gdb version string converter
* Alvaro Sanchez-Leon (Ericsson) - Bug 437562 - Split the dsf-gdb tests to a plug-in and fragment pair
@@ -27,12 +27,12 @@ import org.junit.Before;
import org.junit.Test;
public class LaunchUtilsTest {
-
+
private class Versions {
private String version1;
private String version2;
private int expectedResult;
-
+
public Versions(String v1, String v2, int result) {
version1 = v1;
version2 = v2;
@@ -40,144 +40,142 @@ public class LaunchUtilsTest {
}
}
- @Before
- public void init() {
- }
+ @Before
+ public void init() {
+ }
- @After
- public void shutdown() {
- }
-
- @Test
+ @After
+ public void shutdown() {
+ }
+
+ @Test
public void testGDBVersionFromText() {
- Map<String, String> versions = new HashMap<>(10);
-
- versions.put("GNU gdb 6.8.50.20080730", "6.8.50.20080730");
- versions.put("GNU gdb (GDB) 6.8.50.20080730-cvs", "6.8.50.20080730");
- versions.put("GNU gdb (Ericsson GDB 1.0-10) 6.8.50.20080730-cvs", "6.8.50.20080730");
- versions.put("GNU gdb (GDB) Fedora (7.0-3.fc12)", "7.0");
- versions.put("GNU gdb 6.8.0.20080328-cvs (cygwin-special)", "6.8"); // Special for cygwin
- versions.put("GNU gdb 7.0", "7.0");
- versions.put("GNU gdb Fedora (6.8-27.el5)", "6.8");
- versions.put("GNU gdb Red Hat Linux (6.3.0.0-1.162.el4rh)", "6.3.0.0");
- versions.put("GNU gdb (GDB) STMicroelectronics/Linux Base 7.4-71 [build Mar 1 2013]", "7.4");
-
- for (String key : versions.keySet()) {
- assertEquals("From \"" + key + "\"", versions.get(key), LaunchUtils.getGDBVersionFromText(key));
- }
- }
-
- /**
- * Verify that GDB version comparison is done properly.
- */
- @Test
- public void testGDBVersionComparison() {
- List<Versions> versions = new ArrayList<>(100);
-
- versions.add(new Versions("7", "6", 1));
- versions.add(new Versions("7", "6.1", 1));
- versions.add(new Versions("7", "6.1.1", 1));
- versions.add(new Versions("7", "7", 0));
- versions.add(new Versions("7", "7.0", 0));
- versions.add(new Versions("7", "7.0.0", 0));
- versions.add(new Versions("7", "7.1", -1));
- versions.add(new Versions("7", "7.1.1", -1));
- versions.add(new Versions("7", "8", -1));
- versions.add(new Versions("7", "8.0", -1));
- versions.add(new Versions("7", "8.1", -1));
- versions.add(new Versions("7", "8.1.1", -1));
- versions.add(new Versions("7", "10", -1));
- versions.add(new Versions("7", "10.0", -1));
- versions.add(new Versions("7", "10.1", -1));
- versions.add(new Versions("7", "10.1.1", -1));
- versions.add(new Versions("7", "70", -1));
- versions.add(new Versions("7", "70.1", -1));
- versions.add(new Versions("7", "70.1.1", -1));
- versions.add(new Versions("7", "72", -1));
- versions.add(new Versions("7", "72.1", -1));
- versions.add(new Versions("7", "72.1.1", -1));
-
- versions.add(new Versions("7.3", "6", 1));
- versions.add(new Versions("7.3", "6.4", 1));
- versions.add(new Versions("7.3", "6.4.4", 1));
- versions.add(new Versions("7.3", "7", 1));
- versions.add(new Versions("7.3", "7.0", 1));
- versions.add(new Versions("7.3", "7.3", 0));
- versions.add(new Versions("7.3", "7.3.0", 0));
- versions.add(new Versions("7.0", "7.0", 0));
- versions.add(new Versions("7.3", "7.3.3", -1));
- versions.add(new Versions("7.3", "7.30", -1));
- versions.add(new Versions("7.3", "7.30.3", -1));
- versions.add(new Versions("7.3", "8", -1));
- versions.add(new Versions("7.3", "8.0", -1));
- versions.add(new Versions("7.3", "8.1", -1));
- versions.add(new Versions("7.3", "8.1.1", -1));
- versions.add(new Versions("7.3", "8.4", -1));
- versions.add(new Versions("7.3", "8.4.4", -1));
- versions.add(new Versions("7.3", "10", -1));
- versions.add(new Versions("7.3", "10.0", -1));
- versions.add(new Versions("7.3", "10.1", -1));
- versions.add(new Versions("7.3", "10.1.1", -1));
- versions.add(new Versions("7.3", "10.4", -1));
- versions.add(new Versions("7.3", "10.4.4", -1));
- versions.add(new Versions("7.3", "70", -1));
- versions.add(new Versions("7.3", "70.1", -1));
- versions.add(new Versions("7.3", "70.1.1", -1));
- versions.add(new Versions("7.3", "72", -1));
- versions.add(new Versions("7.3", "72.1", -1));
- versions.add(new Versions("7.3", "72.1.1", -1));
-
- versions.add(new Versions("7.5.4", "6", 1));
- versions.add(new Versions("7.5.4", "6.4", 1));
- versions.add(new Versions("7.5.4", "6.4.4", 1));
- versions.add(new Versions("7.5.4", "6.5", 1));
- versions.add(new Versions("7.5.4", "6.5.4", 1));
- versions.add(new Versions("7.5.4", "7", 1));
- versions.add(new Versions("7.5.4", "7.0", 1));
- versions.add(new Versions("7.5.4", "7.3", 1));
- versions.add(new Versions("7.5.4", "7.3.0", 1));
- versions.add(new Versions("7.5.4", "7.5", 1));
- versions.add(new Versions("7.5.4", "7.5.3", 1));
- versions.add(new Versions("7.5.4", "7.5.4", 0));
- versions.add(new Versions("7.0.0", "7.0.0", 0));
- versions.add(new Versions("7.5.4", "7.7", -1));
- versions.add(new Versions("7.5.4", "7.7.6", -1));
- versions.add(new Versions("7.5.4", "7.50", -1));
- versions.add(new Versions("7.5.4", "7.50.3", -1));
- versions.add(new Versions("7.5.4", "7.50.4", -1));
- versions.add(new Versions("7.5.4", "8", -1));
- versions.add(new Versions("7.5.4", "8.0", -1));
- versions.add(new Versions("7.5.4", "8.1", -1));
- versions.add(new Versions("7.5.4", "8.1.1", -1));
- versions.add(new Versions("7.5.4", "8.5", -1));
- versions.add(new Versions("7.5.4", "8.5.4", -1));
- versions.add(new Versions("7.5.4", "10", -1));
- versions.add(new Versions("7.5.4", "10.0", -1));
- versions.add(new Versions("7.5.4", "10.1", -1));
- versions.add(new Versions("7.5.4", "10.1.1", -1));
- versions.add(new Versions("7.5.4", "10.5", -1));
- versions.add(new Versions("7.5.4", "10.5.4", -1));
- versions.add(new Versions("7.5.4", "10.7.4", -1));
- versions.add(new Versions("7.5.4", "7.10", -1));
- versions.add(new Versions("7.5.4", "7.10.1", -1));
- versions.add(new Versions("7.5.4", "7.10.5", -1));
- versions.add(new Versions("7.5.4", "72", -1));
- versions.add(new Versions("7.5.4", "72.1", -1));
- versions.add(new Versions("7.5.4", "72.1.1", -1));
-
- versions.add(new Versions("6.8.51", "6.8.50.20080730", 1));
- versions.add(new Versions("6.9.4", "6.8.50.20080730", 1));
- versions.add(new Versions("6.8.50.20080730", "6.8.50.20080730", 0));
- versions.add(new Versions("6.5.4", "6.8.50.20080730", -1));
- versions.add(new Versions("6.8.50", "6.8.50.20080730", -1));
-
- for (Versions v : versions) {
- assertEquals("Comparing " + v.version1 + " and " + v.version2,
- v.expectedResult,
- LaunchUtils.compareVersions(v.version1, v.version2));
- assertEquals("Comparing " + v.version2 + " and " + v.version1,
- -v.expectedResult,
- LaunchUtils.compareVersions(v.version2, v.version1));
- }
- }
+ Map<String, String> versions = new HashMap<>(10);
+
+ versions.put("GNU gdb 6.8.50.20080730", "6.8.50.20080730");
+ versions.put("GNU gdb (GDB) 6.8.50.20080730-cvs", "6.8.50.20080730");
+ versions.put("GNU gdb (Ericsson GDB 1.0-10) 6.8.50.20080730-cvs", "6.8.50.20080730");
+ versions.put("GNU gdb (GDB) Fedora (7.0-3.fc12)", "7.0");
+ versions.put("GNU gdb 6.8.0.20080328-cvs (cygwin-special)", "6.8"); // Special for cygwin
+ versions.put("GNU gdb 7.0", "7.0");
+ versions.put("GNU gdb Fedora (6.8-27.el5)", "6.8");
+ versions.put("GNU gdb Red Hat Linux (6.3.0.0-1.162.el4rh)", "6.3.0.0");
+ versions.put("GNU gdb (GDB) STMicroelectronics/Linux Base 7.4-71 [build Mar 1 2013]", "7.4");
+
+ for (String key : versions.keySet()) {
+ assertEquals("From \"" + key + "\"", versions.get(key), LaunchUtils.getGDBVersionFromText(key));
+ }
+ }
+
+ /**
+ * Verify that GDB version comparison is done properly.
+ */
+ @Test
+ public void testGDBVersionComparison() {
+ List<Versions> versions = new ArrayList<>(100);
+
+ versions.add(new Versions("7", "6", 1));
+ versions.add(new Versions("7", "6.1", 1));
+ versions.add(new Versions("7", "6.1.1", 1));
+ versions.add(new Versions("7", "7", 0));
+ versions.add(new Versions("7", "7.0", 0));
+ versions.add(new Versions("7", "7.0.0", 0));
+ versions.add(new Versions("7", "7.1", -1));
+ versions.add(new Versions("7", "7.1.1", -1));
+ versions.add(new Versions("7", "8", -1));
+ versions.add(new Versions("7", "8.0", -1));
+ versions.add(new Versions("7", "8.1", -1));
+ versions.add(new Versions("7", "8.1.1", -1));
+ versions.add(new Versions("7", "10", -1));
+ versions.add(new Versions("7", "10.0", -1));
+ versions.add(new Versions("7", "10.1", -1));
+ versions.add(new Versions("7", "10.1.1", -1));
+ versions.add(new Versions("7", "70", -1));
+ versions.add(new Versions("7", "70.1", -1));
+ versions.add(new Versions("7", "70.1.1", -1));
+ versions.add(new Versions("7", "72", -1));
+ versions.add(new Versions("7", "72.1", -1));
+ versions.add(new Versions("7", "72.1.1", -1));
+
+ versions.add(new Versions("7.3", "6", 1));
+ versions.add(new Versions("7.3", "6.4", 1));
+ versions.add(new Versions("7.3", "6.4.4", 1));
+ versions.add(new Versions("7.3", "7", 1));
+ versions.add(new Versions("7.3", "7.0", 1));
+ versions.add(new Versions("7.3", "7.3", 0));
+ versions.add(new Versions("7.3", "7.3.0", 0));
+ versions.add(new Versions("7.0", "7.0", 0));
+ versions.add(new Versions("7.3", "7.3.3", -1));
+ versions.add(new Versions("7.3", "7.30", -1));
+ versions.add(new Versions("7.3", "7.30.3", -1));
+ versions.add(new Versions("7.3", "8", -1));
+ versions.add(new Versions("7.3", "8.0", -1));
+ versions.add(new Versions("7.3", "8.1", -1));
+ versions.add(new Versions("7.3", "8.1.1", -1));
+ versions.add(new Versions("7.3", "8.4", -1));
+ versions.add(new Versions("7.3", "8.4.4", -1));
+ versions.add(new Versions("7.3", "10", -1));
+ versions.add(new Versions("7.3", "10.0", -1));
+ versions.add(new Versions("7.3", "10.1", -1));
+ versions.add(new Versions("7.3", "10.1.1", -1));
+ versions.add(new Versions("7.3", "10.4", -1));
+ versions.add(new Versions("7.3", "10.4.4", -1));
+ versions.add(new Versions("7.3", "70", -1));
+ versions.add(new Versions("7.3", "70.1", -1));
+ versions.add(new Versions("7.3", "70.1.1", -1));
+ versions.add(new Versions("7.3", "72", -1));
+ versions.add(new Versions("7.3", "72.1", -1));
+ versions.add(new Versions("7.3", "72.1.1", -1));
+
+ versions.add(new Versions("7.5.4", "6", 1));
+ versions.add(new Versions("7.5.4", "6.4", 1));
+ versions.add(new Versions("7.5.4", "6.4.4", 1));
+ versions.add(new Versions("7.5.4", "6.5", 1));
+ versions.add(new Versions("7.5.4", "6.5.4", 1));
+ versions.add(new Versions("7.5.4", "7", 1));
+ versions.add(new Versions("7.5.4", "7.0", 1));
+ versions.add(new Versions("7.5.4", "7.3", 1));
+ versions.add(new Versions("7.5.4", "7.3.0", 1));
+ versions.add(new Versions("7.5.4", "7.5", 1));
+ versions.add(new Versions("7.5.4", "7.5.3", 1));
+ versions.add(new Versions("7.5.4", "7.5.4", 0));
+ versions.add(new Versions("7.0.0", "7.0.0", 0));
+ versions.add(new Versions("7.5.4", "7.7", -1));
+ versions.add(new Versions("7.5.4", "7.7.6", -1));
+ versions.add(new Versions("7.5.4", "7.50", -1));
+ versions.add(new Versions("7.5.4", "7.50.3", -1));
+ versions.add(new Versions("7.5.4", "7.50.4", -1));
+ versions.add(new Versions("7.5.4", "8", -1));
+ versions.add(new Versions("7.5.4", "8.0", -1));
+ versions.add(new Versions("7.5.4", "8.1", -1));
+ versions.add(new Versions("7.5.4", "8.1.1", -1));
+ versions.add(new Versions("7.5.4", "8.5", -1));
+ versions.add(new Versions("7.5.4", "8.5.4", -1));
+ versions.add(new Versions("7.5.4", "10", -1));
+ versions.add(new Versions("7.5.4", "10.0", -1));
+ versions.add(new Versions("7.5.4", "10.1", -1));
+ versions.add(new Versions("7.5.4", "10.1.1", -1));
+ versions.add(new Versions("7.5.4", "10.5", -1));
+ versions.add(new Versions("7.5.4", "10.5.4", -1));
+ versions.add(new Versions("7.5.4", "10.7.4", -1));
+ versions.add(new Versions("7.5.4", "7.10", -1));
+ versions.add(new Versions("7.5.4", "7.10.1", -1));
+ versions.add(new Versions("7.5.4", "7.10.5", -1));
+ versions.add(new Versions("7.5.4", "72", -1));
+ versions.add(new Versions("7.5.4", "72.1", -1));
+ versions.add(new Versions("7.5.4", "72.1.1", -1));
+
+ versions.add(new Versions("6.8.51", "6.8.50.20080730", 1));
+ versions.add(new Versions("6.9.4", "6.8.50.20080730", 1));
+ versions.add(new Versions("6.8.50.20080730", "6.8.50.20080730", 0));
+ versions.add(new Versions("6.5.4", "6.8.50.20080730", -1));
+ versions.add(new Versions("6.8.50", "6.8.50.20080730", -1));
+
+ for (Versions v : versions) {
+ assertEquals("Comparing " + v.version1 + " and " + v.version2, v.expectedResult,
+ LaunchUtils.compareVersions(v.version1, v.version2));
+ assertEquals("Comparing " + v.version2 + " and " + v.version1, -v.expectedResult,
+ LaunchUtils.compareVersions(v.version2, v.version1));
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/tests/ProcStatParserTest.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/tests/ProcStatParserTest.java
index 075854f6ca2..e84026d4ccd 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/tests/ProcStatParserTest.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/tests/ProcStatParserTest.java
@@ -29,64 +29,51 @@ import org.junit.Test;
public class ProcStatParserTest {
- final static String stat_t0 = "cpu 27599070 16857 1627173 178832624 958471 10 21253 0 0 0\n" +
- "cpu0 7076626 3073 420740 44122942 620655 7 19123 0 0 0\n" +
- "cpu1 6839475 2644 480003 44885633 53738 2 1200 0 0 0\n" +
- "cpu2 6861775 9347 337505 44860715 195008 0 573 0 0 0\n" +
- "cpu3 6821192 1792 388924 44963332 89067 0 355 0 0 0\n" +
- "intr 255054962 1785 9 0 0 0 0 0 0 1 393 0 0 125 0 0 0 1861780 5056689 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3138534 3946219 2295808 199 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" +
- "ctxt 406954066\n" +
- "btime 1357642511\n" +
- "processes 187587\n" +
- "procs_running 2\n" +
- "procs_blocked 0\n" +
- "softirq 187777133 0 82842161 104536 3977894 3827626 0 3881246 12353598 94844 80695228";
+ final static String stat_t0 = "cpu 27599070 16857 1627173 178832624 958471 10 21253 0 0 0\n"
+ + "cpu0 7076626 3073 420740 44122942 620655 7 19123 0 0 0\n"
+ + "cpu1 6839475 2644 480003 44885633 53738 2 1200 0 0 0\n"
+ + "cpu2 6861775 9347 337505 44860715 195008 0 573 0 0 0\n"
+ + "cpu3 6821192 1792 388924 44963332 89067 0 355 0 0 0\n"
+ + "intr 255054962 1785 9 0 0 0 0 0 0 1 393 0 0 125 0 0 0 1861780 5056689 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3138534 3946219 2295808 199 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
+ + "ctxt 406954066\n" + "btime 1357642511\n" + "processes 187587\n" + "procs_running 2\n"
+ + "procs_blocked 0\n"
+ + "softirq 187777133 0 82842161 104536 3977894 3827626 0 3881246 12353598 94844 80695228";
final static String stat_t0_file = "/tmp/stat_t0";
- final static String stat_t1 = "cpu 27599216 16857 1627190 178835528 958483 10 21255 0 0 0\n" +
- "cpu0 7076664 3073 420751 44123650 620668 7 19125 0 0 0\n" +
- "cpu1 6839509 2644 480004 44886368 53738 2 1200 0 0 0\n" +
- "cpu2 6861813 9347 337507 44861445 195008 0 573 0 0 0\n" +
- "cpu3 6821229 1792 388926 44964063 89067 0 355 0 0 0\n" +
- "intr 255057230 1785 9 0 0 0 0 0 0 1 393 0 0 125 0 0 0 1861874 5056997 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3138618 3946264 2295808 199 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" +
- "ctxt 406958462\n" +
- "btime 1357642511\n" +
- "processes 187593\n" +
- "procs_running 5\n" +
- "procs_blocked 0\n" +
- "softirq 187779126 0 82842674 104538 3977978 3827690 0 3881346 12353760 94845 80696295";
+ final static String stat_t1 = "cpu 27599216 16857 1627190 178835528 958483 10 21255 0 0 0\n"
+ + "cpu0 7076664 3073 420751 44123650 620668 7 19125 0 0 0\n"
+ + "cpu1 6839509 2644 480004 44886368 53738 2 1200 0 0 0\n"
+ + "cpu2 6861813 9347 337507 44861445 195008 0 573 0 0 0\n"
+ + "cpu3 6821229 1792 388926 44964063 89067 0 355 0 0 0\n"
+ + "intr 255057230 1785 9 0 0 0 0 0 0 1 393 0 0 125 0 0 0 1861874 5056997 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3138618 3946264 2295808 199 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
+ + "ctxt 406958462\n" + "btime 1357642511\n" + "processes 187593\n" + "procs_running 5\n"
+ + "procs_blocked 0\n"
+ + "softirq 187779126 0 82842674 104538 3977978 3827690 0 3881346 12353760 94845 80696295";
final static String stat_t1_file = "/tmp/stat_t1";
- final static String stat_t2 = "cpu 27602962 16857 1627282 178835528 958483 10 21256 0 0 0\n" +
- "cpu0 7077593 3073 420781 44123650 620668 7 19126 0 0 0\n" +
- "cpu1 6840413 2644 480060 44886368 53738 2 1200 0 0 0\n" +
- "cpu2 6862773 9347 337507 44861445 195008 0 573 0 0 0\n" +
- "cpu3 6822181 1792 388933 44964063 89067 0 355 0 0 0\n" +
- "intr 255070028 1785 9 0 0 0 0 0 0 1 393 0 0 125 0 0 0 1861998 5057533 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3138674 3946472 2295808 199 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" +
- "ctxt 407001757\n" +
- "btime 1357642511\n" +
- "processes 187607\n" +
- "procs_running 5\n" +
- "procs_blocked 0\n" +
- "softirq 187794229 0 82852274 104540 3978034 3827918 0 3881474 12354181 94845 80700963";
+ final static String stat_t2 = "cpu 27602962 16857 1627282 178835528 958483 10 21256 0 0 0\n"
+ + "cpu0 7077593 3073 420781 44123650 620668 7 19126 0 0 0\n"
+ + "cpu1 6840413 2644 480060 44886368 53738 2 1200 0 0 0\n"
+ + "cpu2 6862773 9347 337507 44861445 195008 0 573 0 0 0\n"
+ + "cpu3 6822181 1792 388933 44964063 89067 0 355 0 0 0\n"
+ + "intr 255070028 1785 9 0 0 0 0 0 0 1 393 0 0 125 0 0 0 1861998 5057533 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3138674 3946472 2295808 199 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
+ + "ctxt 407001757\n" + "btime 1357642511\n" + "processes 187607\n" + "procs_running 5\n"
+ + "procs_blocked 0\n"
+ + "softirq 187794229 0 82852274 104540 3978034 3827918 0 3881474 12354181 94845 80700963";
final static String stat_t2_file = "/tmp/stat_t2";
-
+
// to trigger exception upon parsing
- final static String stat_wrong_content = "cpu 27602962 16857 1627282 178835528 958483 10 21256 0 0 0\n" +
- "cpu0 AAAAAAA 3073 420781 44123650 620668 7 19126 0 0 0\n" +
- "cpu1 AAAAAAA 2644 480060 44886368 53738 2 1200 0 0 0\n" +
- "cpu2 AAAAAAA 9347 337507 44861445 195008 0 573 0 0 0\n" +
- "cpu3 AAAAAAA 1792 388933 44964063 89067 0 355 0 0 0\n" +
- "intr 255070028 1785 9 0 0 0 0 0 0 1 393 0 0 125 0 0 0 1861998 5057533 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3138674 3946472 2295808 199 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" +
- "ctxt 407001757\n" +
- "btime 1357642511\n" +
- "processes 187607\n" +
- "procs_running 5\n" +
- "procs_blocked 0\n" +
- "softirq 187794229 0 82852274 104540 3978034 3827918 0 3881474 12354181 94845 80700963";
+ final static String stat_wrong_content = "cpu 27602962 16857 1627282 178835528 958483 10 21256 0 0 0\n"
+ + "cpu0 AAAAAAA 3073 420781 44123650 620668 7 19126 0 0 0\n"
+ + "cpu1 AAAAAAA 2644 480060 44886368 53738 2 1200 0 0 0\n"
+ + "cpu2 AAAAAAA 9347 337507 44861445 195008 0 573 0 0 0\n"
+ + "cpu3 AAAAAAA 1792 388933 44964063 89067 0 355 0 0 0\n"
+ + "intr 255070028 1785 9 0 0 0 0 0 0 1 393 0 0 125 0 0 0 1861998 5057533 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3138674 3946472 2295808 199 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
+ + "ctxt 407001757\n" + "btime 1357642511\n" + "processes 187607\n" + "procs_running 5\n"
+ + "procs_blocked 0\n"
+ + "softirq 187794229 0 82852274 104540 3978034 3827918 0 3881474 12354181 94845 80700963";
final static String stat_wrong_content_file = "/tmp/stat_wrong_content";
-
@BeforeClass
public static void init_once() {
// generate test input files once at beginning of tests
@@ -95,7 +82,7 @@ public class ProcStatParserTest {
writeStr2File(stat_t2, stat_t2_file);
writeStr2File(stat_wrong_content, stat_wrong_content_file);
}
-
+
@AfterClass
public static void cleanup() {
// cleanup at end of tests
@@ -105,95 +92,91 @@ public class ProcStatParserTest {
new File(stat_wrong_content_file).delete();
}
-
-
// testcases
-
-
+
@Test
public void testProcStatParse1() throws Exception {
ProcStatParser procStatParser = new ProcStatParser();
procStatParser.parseStatFile(stat_t0_file);
procStatParser.parseStatFile(stat_t1_file);
ProcStatCoreLoads load = procStatParser.getCpuLoad();
-
- int l0 = (int)load.getLoad("0").floatValue();
- assertEquals(8,l0);
- int l1 = (int)load.getLoad("1").floatValue();
- assertEquals(4,l1);
- int l2 = (int)load.getLoad("2").floatValue();
- assertEquals(5,l2);
- int l3 = (int)load.getLoad("3").floatValue();
- assertEquals(5,l3);
+
+ int l0 = (int) load.getLoad("0").floatValue();
+ assertEquals(8, l0);
+ int l1 = (int) load.getLoad("1").floatValue();
+ assertEquals(4, l1);
+ int l2 = (int) load.getLoad("2").floatValue();
+ assertEquals(5, l2);
+ int l3 = (int) load.getLoad("3").floatValue();
+ assertEquals(5, l3);
}
-
+
@Test
public void testProcStatParse2() throws Exception {
ProcStatParser procStatParser = new ProcStatParser();
procStatParser.parseStatFile(stat_t1_file);
procStatParser.parseStatFile(stat_t2_file);
ProcStatCoreLoads load = procStatParser.getCpuLoad();
-
- int l0 = (int)load.getLoad("0").floatValue();
- assertEquals(100,l0);
- int l1 = (int)load.getLoad("1").floatValue();
- assertEquals(100,l1);
- int l2 = (int)load.getLoad("2").floatValue();
- assertEquals(100,l2);
- int l3 = (int)load.getLoad("3").floatValue();
- assertEquals(100,l3);
+
+ int l0 = (int) load.getLoad("0").floatValue();
+ assertEquals(100, l0);
+ int l1 = (int) load.getLoad("1").floatValue();
+ assertEquals(100, l1);
+ int l2 = (int) load.getLoad("2").floatValue();
+ assertEquals(100, l2);
+ int l3 = (int) load.getLoad("3").floatValue();
+ assertEquals(100, l3);
}
-
+
@Test
public void testProcStatParse3() throws Exception {
ProcStatParser procStatParser = new ProcStatParser();
procStatParser.parseStatFile(stat_t0_file);
procStatParser.parseStatFile(stat_t2_file);
ProcStatCoreLoads load = procStatParser.getCpuLoad();
-
- int l0 = (int)load.getLoad("0").floatValue();
- assertEquals(59,l0);
- int l1 = (int)load.getLoad("1").floatValue();
- assertEquals(57,l1);
- int l2 = (int)load.getLoad("2").floatValue();
- assertEquals(57,l2);
- int l3 = (int)load.getLoad("3").floatValue();
- assertEquals(57,l3);
- }
-
+
+ int l0 = (int) load.getLoad("0").floatValue();
+ assertEquals(59, l0);
+ int l1 = (int) load.getLoad("1").floatValue();
+ assertEquals(57, l1);
+ int l2 = (int) load.getLoad("2").floatValue();
+ assertEquals(57, l2);
+ int l3 = (int) load.getLoad("3").floatValue();
+ assertEquals(57, l3);
+ }
+
@Test
public void testProcStatParseOneSetOfCounters() throws Exception {
ProcStatParser procStatParser = new ProcStatParser();
procStatParser.parseStatFile(stat_t0_file);
ProcStatCoreLoads load = procStatParser.getCpuLoad();
-
- int l0 = (int)load.getLoad("0").floatValue();
- assertEquals(15,l0);
- int l1 = (int)load.getLoad("1").floatValue();
- assertEquals(14,l1);
- int l2 = (int)load.getLoad("2").floatValue();
- assertEquals(14,l2);
- int l3 = (int)load.getLoad("3").floatValue();
- assertEquals(13,l3);
+
+ int l0 = (int) load.getLoad("0").floatValue();
+ assertEquals(15, l0);
+ int l1 = (int) load.getLoad("1").floatValue();
+ assertEquals(14, l1);
+ int l2 = (int) load.getLoad("2").floatValue();
+ assertEquals(14, l2);
+ int l3 = (int) load.getLoad("3").floatValue();
+ assertEquals(13, l3);
}
-
- @Test(expected=FileNotFoundException.class)
+
+ @Test(expected = FileNotFoundException.class)
public void testStatFileDoesNotExist() throws Exception {
ProcStatParser procStatParser = new ProcStatParser();
// read non-existing stat file
procStatParser.parseStatFile("/file/does/not/exist");
}
- @Test(expected=NumberFormatException.class)
+ @Test(expected = NumberFormatException.class)
public void testStatFileDoesntParse() throws Exception {
ProcStatParser procStatParser = new ProcStatParser();
// read non-existing stat file
procStatParser.parseStatFile(stat_wrong_content_file);
}
-
-
+
// util functions
-
+
private static void writeStr2File(String str, String fileName) {
FileWriter fileWriter = null;
File f = new File(fileName);
@@ -201,7 +184,7 @@ public class ProcStatParserTest {
fileWriter = new FileWriter(f);
fileWriter.write(str);
fileWriter.close();
-
+
} catch (IOException e) {
e.printStackTrace();
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/mi/service/command/commands/TestMIBreakInsertCommand.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/mi/service/command/commands/TestMIBreakInsertCommand.java
index 831c77aeb99..ce1490bddb2 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/mi/service/command/commands/TestMIBreakInsertCommand.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/mi/service/command/commands/TestMIBreakInsertCommand.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - Initial Implementation
* Marc Khouzam (Ericsson) - Fix NPE (bug 369583)
@@ -27,20 +27,19 @@ import org.junit.Test;
/**
* Verifies that the break insert MI command have the correct path substitution.
- *
+ *
* @author qtobsod
- *
+ *
*/
public class TestMIBreakInsertCommand {
@Test
public void pathWithSlashesShouldNotBeSubstituted() {
- MIBreakInsert target = new MIBreakInsert(new TestContext(), false,
- false, null, 1, "/test/this/path:14", "4", false);
+ MIBreakInsert target = new MIBreakInsert(new TestContext(), false, false, null, 1, "/test/this/path:14", "4",
+ false);
- assertEquals("Wrong syntax for command",
- "-break-insert -i 1 -p 4 /test/this/path:14\n", target
- .constructCommand());
+ assertEquals("Wrong syntax for command", "-break-insert -i 1 -p 4 /test/this/path:14\n",
+ target.constructCommand());
}
private class TestContext implements IBreakpointsTargetDMContext {
@@ -49,10 +48,10 @@ public class TestMIBreakInsertCommand {
public TestContext() {
session = DsfSession.startSession(new DefaultDsfExecutor(GdbPlugin.PLUGIN_ID), GdbPlugin.PLUGIN_ID);
}
-
+
@Override
public IDMContext[] getParents() {
- return new IDMContext[] {new GDBControlDMContext(getSessionId(), "1")};
+ return new IDMContext[] { new GDBControlDMContext(getSessionId(), "1") };
}
@Override
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/mi/service/command/commands/TestMICommandConstructCommand.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/mi/service/command/commands/TestMICommandConstructCommand.java
index 1dd2963096d..49ef3c2d2ad 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/mi/service/command/commands/TestMICommandConstructCommand.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/mi/service/command/commands/TestMICommandConstructCommand.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - Initial Implementation
* Marc Khouzam (Ericsson) - Fix NPE (bug 369583)
@@ -29,28 +29,24 @@ import org.junit.Test;
/**
* Test verifying that the construct command method handles separators and
* escaping correctly
- *
+ *
* @author qtobsod
- *
+ *
*/
public class TestMICommandConstructCommand {
@Test
public void multipleParametersShouldHaveCorrectSeparators() {
// Setup
- MICommand<MIInfo> target = new MICommand<MIInfo>(new TestContext(),
- "-test-operation");
- target.setOptions(new String[] { "-a a_test\\with slashes",
- "-b \"hello\"", "-c c_test" });
- target.setParameters(new String[] { "-param1 param", "param2",
- "-param3" });
+ MICommand<MIInfo> target = new MICommand<MIInfo>(new TestContext(), "-test-operation");
+ target.setOptions(new String[] { "-a a_test\\with slashes", "-b \"hello\"", "-c c_test" });
+ target.setParameters(new String[] { "-param1 param", "param2", "-param3" });
// Act
String result = target.constructCommand();
// Assert
- assertEquals(
- "Wrong syntax for command",
+ assertEquals("Wrong syntax for command",
"-test-operation \"-a a_test\\\\with slashes\" \"-b \\\"hello\\\"\" \"-c c_test\" -- \"-param1 param\" param2 -param3\n",
result);
}
@@ -61,10 +57,10 @@ public class TestMICommandConstructCommand {
public TestContext() {
session = DsfSession.startSession(new DefaultDsfExecutor(GdbPlugin.PLUGIN_ID), GdbPlugin.PLUGIN_ID);
}
-
+
@Override
public IDMContext[] getParents() {
- return new IDMContext[] {new GDBControlDMContext(getSessionId(), "1")};
+ return new IDMContext[] { new GDBControlDMContext(getSessionId(), "1") };
}
@Override
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/mi/service/command/commands/TestMIGDBSetSysroot.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/mi/service/command/commands/TestMIGDBSetSysroot.java
index 67c15fcf12c..681fb3b655c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/mi/service/command/commands/TestMIGDBSetSysroot.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/mi/service/command/commands/TestMIGDBSetSysroot.java
@@ -42,7 +42,6 @@ public class TestMIGDBSetSysroot {
assertEquals("Wrong syntax for command", "-gdb-set sysroot /tmp/test with\"double quotes/\n",
setSysrootCommand.constructCommand());
-
}
private class TestContext implements ICommandControlDMContext {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStringHandlerTests.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStringHandlerTests.java
index e16f07a8f7e..74aa656cb0b 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStringHandlerTests.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStringHandlerTests.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Mathias Kunter - Initial Implementation (Bug 307311)
* Alvaro Sanchez-Leon (Ericsson) - Bug 437562 - Split the dsf-gdb tests to a plug-in and fragment pair
@@ -24,405 +24,408 @@ import junit.framework.JUnit4TestAdapter;
import org.junit.Test;
public class MIStringHandlerTests {
- @Test
- public void testTranscodeString() {
- // Test transcoding of an empty string.
- assertEquals(MIStringHandler.transcodeString(""), ""); //$NON-NLS-1$ //$NON-NLS-2$
-
- // Test transcoding of an ASCII string.
- assertEquals(MIStringHandler.transcodeString("ASCII"), "ASCII"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // Test transcoding of Latin-1 strings.
- assertEquals(MIStringHandler.transcodeString("\344"), "\344"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.transcodeString("abc\344"), "abc\344"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.transcodeString("\344abc"), "\344abc"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.transcodeString("abc\344def"), "abc\344def"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.transcodeString("abc\ndef\344ghi\tjkl"), "abc\ndef\344ghi\tjkl"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // Test transcoding of UTF-8 strings.
- assertEquals(MIStringHandler.transcodeString("\303\244"), "\344"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.transcodeString("abc\303\244"), "abc\344"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.transcodeString("\303\244abc"), "\344abc"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.transcodeString("abc\303\244def"), "abc\344def"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.transcodeString("abc\ndef\303\244ghi\tjkl"), "abc\ndef\344ghi\tjkl"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // Test transcoding of a string with unsupported encoding (here: UTF-16).
- assertEquals(MIStringHandler.transcodeString("\u3090"), "\u3090"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- @Test
- public void testEscapeString() {
- // Test escaping of an empty string.
- assertEquals(MIStringHandler.escapeString(""), ""); //$NON-NLS-1$ //$NON-NLS-2$
-
- // Test escaping of a plain text string.
- assertEquals(MIStringHandler.escapeString("abc"), "abc"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // Test escaping of strings which contain special chars.
- assertEquals(MIStringHandler.escapeString("\n"), "\\n"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.escapeString("\n\b"), "\\n\\b"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.escapeString("\0\1\2\3\4\5\6\7\10\11\12\13\14\15\16\17"), "\\0\\001\\002\\003\\004\\005\\006\\a\\b\\t\\n\\v\\f\\r\\016\\017"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.escapeString("\33"), "\\e"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.escapeString("\\", true), "\\\\"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.escapeString("\\", false), "\\"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.escapeString("'\t\\", true), "\\'\\t\\\\"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.escapeString("'\t\\", false), "'\\t\\"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // Test escaping of strings which contain non-printable characters up to 0x7F.
- assertEquals(MIStringHandler.escapeString("\0"), "\\0"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.escapeString("\177"), "\\177"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.escapeString("abc\177"), "abc\\177"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.escapeString("\177abc"), "\\177abc"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.escapeString("abc\177def"), "abc\\177def"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // Test escaping of strings which contain non-printable characters up to 0xFF.
- assertEquals(MIStringHandler.escapeString("\230"), "\\230"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.escapeString("abc\230"), "abc\\230"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.escapeString("\230abc"), "\\230abc"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.escapeString("abc\230def"), "abc\\230def"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // Test escaping of strings which contain non-printable characters up to 0xFFFF.
- assertEquals(MIStringHandler.escapeString("\ud800"), "\\ud800"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.escapeString("abc\ud800"), "abc\\ud800"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.escapeString("\ud800abc"), "\\ud800abc"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.escapeString("abc\ud800def"), "abc\\ud800def"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // Test escaping of strings which contain non-printable characters up to 0x10FFFF.
- assertEquals(MIStringHandler.escapeString("\udbff\udfff"), "\\U0010ffff"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.escapeString("abc\udbff\udfff"), "abc\\U0010ffff"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.escapeString("\udbff\udfffabc"), "\\U0010ffffabc"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.escapeString("abc\udbff\udfffdef"), "abc\\U0010ffffdef"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // Test escaping of a string which contains all sorts of non-printable characters.
- assertEquals(MIStringHandler.escapeString("abc\n\tdef\\ghi\njkl\177\230\n\ud800\udbff\udfff?mno\"", true), "abc\\n\\tdef\\\\ghi\\njkl\\177\\230\\n\\ud800\\U0010ffff\\?mno\\\""); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.escapeString("abc\n\tdef\\ghi\njkl\177\230\n\ud800\udbff\udfff?mno\"", false), "abc\\n\\tdef\\ghi\\njkl\\177\\230\\n\\ud800\\U0010ffff?mno\""); //$NON-NLS-1$ //$NON-NLS-2$
-
- // Test escaping of an ill-formed UTF-16 Java string.
- assertEquals(MIStringHandler.escapeString("abc\udbff"), "abc\\udbff"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- @Test
- public void testIsSpecialChar() {
- // Testing non-special chars.
- assertEquals(MIStringHandler.isSpecialChar('i'), false);
- assertEquals(MIStringHandler.isSpecialChar('w'), false);
-
- // Testing special chars.
- assertEquals(MIStringHandler.isSpecialChar('a'), true);
- assertEquals(MIStringHandler.isSpecialChar('b'), true);
- assertEquals(MIStringHandler.isSpecialChar('e'), true);
- assertEquals(MIStringHandler.isSpecialChar('E'), true);
- assertEquals(MIStringHandler.isSpecialChar('f'), true);
- assertEquals(MIStringHandler.isSpecialChar('n'), true);
- assertEquals(MIStringHandler.isSpecialChar('r'), true);
- assertEquals(MIStringHandler.isSpecialChar('t'), true);
- assertEquals(MIStringHandler.isSpecialChar('v'), true);
- assertEquals(MIStringHandler.isSpecialChar('\''), true);
- assertEquals(MIStringHandler.isSpecialChar('"'), true);
- assertEquals(MIStringHandler.isSpecialChar('\\'), true);
- assertEquals(MIStringHandler.isSpecialChar('?'), true);
- }
-
- @Test
- public void testIsSpecialCodePoint() {
- // Testing non-special Unicode code points.
- assertEquals(MIStringHandler.isSpecialCodePoint(0x69), false); // 'i' character
- assertEquals(MIStringHandler.isSpecialCodePoint(0x77), false); // 'w' character
- assertEquals(MIStringHandler.isSpecialCodePoint(0x61), false); // 'a' character
- assertEquals(MIStringHandler.isSpecialCodePoint(0x6E), false); // 'n' character
-
- // Testing special Unicode code points.
- assertEquals(MIStringHandler.isSpecialCodePoint(0x07), true); // 'a' character
- assertEquals(MIStringHandler.isSpecialCodePoint(0x08), true); // 'b' character
- assertEquals(MIStringHandler.isSpecialCodePoint(0x1B), true); // 'e' character
- assertEquals(MIStringHandler.isSpecialCodePoint(0x1B), true); // 'E' character
- assertEquals(MIStringHandler.isSpecialCodePoint(0x0C), true); // 'f' character
- assertEquals(MIStringHandler.isSpecialCodePoint(0x0A), true); // 'n' character
- assertEquals(MIStringHandler.isSpecialCodePoint(0x0D), true); // 'r' character
- assertEquals(MIStringHandler.isSpecialCodePoint(0x09), true); // 't' character
- assertEquals(MIStringHandler.isSpecialCodePoint(0x0B), true); // 'v' character
- assertEquals(MIStringHandler.isSpecialCodePoint(0x27), true); // '\'' character
- assertEquals(MIStringHandler.isSpecialCodePoint(0x22), true); // '"' character
- assertEquals(MIStringHandler.isSpecialCodePoint(0x5C), true); // '\\' character
- assertEquals(MIStringHandler.isSpecialCodePoint(0x3F), true); // '?' character
- }
-
- @Test
- public void testParseSpecialChar() {
- // Testing non-special chars. This actually should throw ParseExceptions.
- try {
- MIStringHandler.parseSpecialChar('i');
- fail("No parsing exception thrown.");
- } catch (ParseException e) {
- }
-
- try {
- MIStringHandler.parseSpecialChar('w');
- fail("No parsing exception thrown.");
- } catch (ParseException e) {
- }
-
- try {
- // Testing special chars.
- assertEquals(MIStringHandler.parseSpecialChar('a'), 0x07);
- assertEquals(MIStringHandler.parseSpecialChar('b'), 0x08);
- assertEquals(MIStringHandler.parseSpecialChar('e'), 0x1B);
- assertEquals(MIStringHandler.parseSpecialChar('E'), 0x1B);
- assertEquals(MIStringHandler.parseSpecialChar('f'), 0x0C);
- assertEquals(MIStringHandler.parseSpecialChar('n'), 0x0A);
- assertEquals(MIStringHandler.parseSpecialChar('r'), 0x0D);
- assertEquals(MIStringHandler.parseSpecialChar('t'), 0x09);
- assertEquals(MIStringHandler.parseSpecialChar('v'), 0x0B);
- assertEquals(MIStringHandler.parseSpecialChar('\''), 0x27);
- assertEquals(MIStringHandler.parseSpecialChar('"'), 0x22);
- assertEquals(MIStringHandler.parseSpecialChar('\\'), 0x5C);
- assertEquals(MIStringHandler.parseSpecialChar('?'), 0x3F);
-
- } catch (ParseException e) {
- fail("Parsing exception thrown."); //$NON-NLS-1$
- }
- }
-
- @Test
- public void testParseSpecialCodePoint() {
- try {
- // Testing non-special Unicode code points. This actually should throw ParseExceptions.
- try {
- MIStringHandler.parseSpecialCodePoint(0x69);
- fail("No parsing exception thrown.");
- } catch (ParseException e) {
- }
-
- try {
- MIStringHandler.parseSpecialCodePoint(0x77);
- fail("No parsing exception thrown.");
- } catch (ParseException e) {
- }
-
- // Testing special Unicode code points.
- assertEquals(MIStringHandler.parseSpecialCodePoint(0x07), 'a');
- assertEquals(MIStringHandler.parseSpecialCodePoint(0x08), 'b');
- assertEquals(MIStringHandler.parseSpecialCodePoint(0x1B), 'e');
- assertEquals(MIStringHandler.parseSpecialCodePoint(0x0C), 'f');
- assertEquals(MIStringHandler.parseSpecialCodePoint(0x0A), 'n');
- assertEquals(MIStringHandler.parseSpecialCodePoint(0x0D), 'r');
- assertEquals(MIStringHandler.parseSpecialCodePoint(0x09), 't');
- assertEquals(MIStringHandler.parseSpecialCodePoint(0x0B), 'v');
- assertEquals(MIStringHandler.parseSpecialCodePoint(0x27), '\'');
- assertEquals(MIStringHandler.parseSpecialCodePoint(0x22), '"');
- assertEquals(MIStringHandler.parseSpecialCodePoint(0x5C), '\\');
- assertEquals(MIStringHandler.parseSpecialCodePoint(0x3F), '?');
-
- } catch (ParseException e) {
- fail("Parsing exception thrown."); //$NON-NLS-1$
- }
- }
-
- @Test
- public void testParseString() {
- // Test parsing of an empty string.
- assertEquals(MIStringHandler.parseString(""), ""); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString(""), ""); //$NON-NLS-1$ //$NON-NLS-2$
-
- // Test parsing of a plain text string.
- assertEquals(MIStringHandler.parseString("abc"), "abc"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // Test parsing of strings which contain valid special char escape notations.
- assertEquals(MIStringHandler.parseString("\\n"), "\n"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\\\"), "\\"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\'\\t\\\\"), "'\t\\"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // Test parsing of strings which contain invalid special char escape notations.
- assertEquals(MIStringHandler.parseString("\\w"), "\\w"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\"), "\\"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("abc\\"), "abc\\"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\www"), "\\www"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("abc\\www"), "abc\\www"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\'\\z\\\\"), "'\\z\\"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\'\\z\\"), "'\\z\\"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // Test parsing of strings which contain valid octal escape notations.
- assertEquals(MIStringHandler.parseString("\\141\\142\\143"), "abc"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\141\\142\\143\\0"), "abc\0"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\141\\142\\143\\12"), "abc\n"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\141\\\\142\\143\\\\"), "a\\142c\\"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\12"), "\n"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\012"), "\n"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("'\\011\\"), "'\t\\"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\177"), "\177"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\377"), "\377"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\3777"), "\3777"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("abc\\177"), "abc\177"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\177abc"), "\177abc"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("abc\\177def"), "abc\177def"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\0"), "\0"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\1"), "\001"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\1a"), "\001a"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\18"), "\0018"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\01"), "\001"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\01a"), "\001a"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\001"), "\001"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\001a"), "\001a"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\0011"), "\0011"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\0011a"), "\0011a"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\1111"), "\1111"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // Test parsing of strings which contain invalid octal escape notations.
- assertEquals(MIStringHandler.parseString("\\400"), "\\400"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\4000"), "\\4000"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\8"), "\\8"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\90"), "\\90"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\ 0"), "\\ 0"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\141\\142\\143\\"), "abc\\"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // Test parsing of strings which contain valid hexadecimal escape notations.
- assertEquals(MIStringHandler.parseString("\\x0"), "\0"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\xa"), "\n"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\xa0"), "\240"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\xag"), "\ng"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\x0a"), "\n"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\x0a0"), "\240"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\x0ag"), "\ng"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\x00a"), "\n"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\x00a0"), "\240"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\x00ag"), "\ng"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\x000a"), "\n"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\x000a0"), "\n0"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\x000ag"), "\ng"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\x0000a"), "\0a"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\x0000a0"), "\0a0"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\x0000ag"), "\0ag"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("abc\\x20def"), "abc\u20def"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("abc\\x20def\\xa"), "abc\u20def\n"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("abc\\x20ghi"), "abc ghi"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("abc\\x20ghi\\xa"), "abc ghi\n"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // Test parsing of strings which contain invalid hexadecimal escape notations.
- assertEquals(MIStringHandler.parseString("\\x"), "\\x"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("abc\\x"), "abc\\x"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\xwww"), "\\xwww"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\x\\"), "\\x\\"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\x 0"), "\\x 0"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\x\\0"), "\\x\0"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // Test parsing of strings which contain valid short Unicode escape notations.
- assertEquals(MIStringHandler.parseString("\\u0000"), "\0"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\u000f"), "\017"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\u00ff"), "\377"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\u0fff"), "\u0fff"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\uffff"), "\uffff"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // Test parsing of strings which contain invalid short Unicode escape notations.
- assertEquals(MIStringHandler.parseString("\\u"), "\\u"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("abc\\u"), "abc\\u"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\uwww"), "\\uwww"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\u\\"), "\\u\\"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\u 0"), "\\u 0"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\u\\0"), "\\u\0"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\u0"), "\\u0"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\u00"), "\\u00"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\u000"), "\\u000"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\u000g"), "\\u000g"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\ug"), "\\ug"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // Test parsing of strings which contain valid long Unicode escape notations.
- assertEquals(MIStringHandler.parseString("\\U00000000"), "\0"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\U0000000f"), "\017"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\U000000ff"), "\377"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\U00000fff"), "\u0fff"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\U0000ffff"), "\uffff"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\U000fffff"), "\udbbf\udfff"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\U0010ffff"), "\udbff\udfff"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // Test parsing of strings which contain invalid long Unicode escape notations.
- assertEquals(MIStringHandler.parseString("\\U"), "\\U"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("abc\\U"), "abc\\U"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\Uwww"), "\\Uwww"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\U\\"), "\\U\\"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\U 0"), "\\U 0"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\U\\0"), "\\U\0"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\U0"), "\\U0"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\U00"), "\\U00"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\U000"), "\\U000"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\U0000"), "\\U0000"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\U00000"), "\\U00000"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\U000000"), "\\U000000"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\U0000000"), "\\U0000000"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\U0000000g"), "\\U0000000g"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\U00110000"), "\\U00110000"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\U00f00000"), "\\U00f00000"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\U0f000000"), "\\U0f000000"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\Uf0000000"), "\\Uf0000000"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\Uffffffff"), "\\Uffffffff"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\Ufffffff"), "\\Ufffffff"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.parseString("\\Ug"), "\\Ug"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- @Test
- public void testTranslateCString() {
- // Test translating an empty string.
- assertEquals(MIStringHandler.translateCString("", false), ""); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("", true), ""); //$NON-NLS-1$ //$NON-NLS-2$
-
- // Test translating a plain text string.
- assertEquals(MIStringHandler.translateCString("abc", false), "abc"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("abc", true), "abc"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // Test translating strings which contain special chars and / or escaped special chars.
- assertEquals(MIStringHandler.translateCString("\t", true), "\\t"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("\t", false), "\t"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("\\t", true), "\\t"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("\\t", false), "\t"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("\t\\t", true), "\\t\\t"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("\t\\t", false), "\t\t"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("\\t\t", true), "\\t\\t"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("\\t\t", false), "\t\t"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("'\"", true), "'\""); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("'\"", false), "'\""); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("\\'\\\"", true), "\\'\\\""); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("\\'\\\"", false), "'\""); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("'\\\"", true), "'\\\""); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("'\\\"", false), "'\""); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("\\'\"", true), "\\'\""); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("\\'\"", false), "'\""); //$NON-NLS-1$ //$NON-NLS-2$
-
- // Test translating strings which contain hexadecimal escape notations.
- assertEquals(MIStringHandler.translateCString("\\x0000", true), "\\0"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("\\x0000", false), "\0"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("abc\\x31\\x32\\x33www", true), "abc123www"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("abc\\x0031\\x0032\\x0033www", true), "abc123www"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // Test translating strings which contain octal escape notations.
- assertEquals(MIStringHandler.translateCString("\\000", true), "\\0"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("\\000", false), "\0"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("\\0", true), "\\0"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("\\0", false), "\0"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("abc\\222def", true), "abc\\222def"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("abc\\222def", false), "abc\222def"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("abc\\303def", true), "abc\303def"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("abc\\303def", false), "abc\303def"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("abc\\303\\244def", true), "abc\344def"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("abc\"def", true), "abc\"def"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("abc\"def", false), "abc\"def"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("abc'def", true), "abc'def"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("abc'def", false), "abc'def"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("abc\\\"def", true), "abc\\\"def"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("abc\\\"def", false), "abc\"def"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("abc\\'def", true), "abc\\'def"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("abc\\'def", false), "abc'def"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // Test translating strings which contain short Unicode escape notations.
- assertEquals(MIStringHandler.translateCString("\\u0000", true), "\\0"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("\\u0000", false), "\0"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("abc\\u0031\\u0032\\u0033def", true), "abc123def"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // Test translating strings which contain long Unicode escape notations.
- assertEquals(MIStringHandler.translateCString("\\U00000000", true), "\\0"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("\\U00000000", false), "\0"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(MIStringHandler.translateCString("abc\\U00000031\\U00000032\\U00000033def", true), "abc123def"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public static junit.framework.Test suite() {
- return new JUnit4TestAdapter(MIStringHandlerTests.class);
- }
+ @Test
+ public void testTranscodeString() {
+ // Test transcoding of an empty string.
+ assertEquals(MIStringHandler.transcodeString(""), ""); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // Test transcoding of an ASCII string.
+ assertEquals(MIStringHandler.transcodeString("ASCII"), "ASCII"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // Test transcoding of Latin-1 strings.
+ assertEquals(MIStringHandler.transcodeString("\344"), "\344"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.transcodeString("abc\344"), "abc\344"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.transcodeString("\344abc"), "\344abc"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.transcodeString("abc\344def"), "abc\344def"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.transcodeString("abc\ndef\344ghi\tjkl"), "abc\ndef\344ghi\tjkl"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // Test transcoding of UTF-8 strings.
+ assertEquals(MIStringHandler.transcodeString("\303\244"), "\344"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.transcodeString("abc\303\244"), "abc\344"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.transcodeString("\303\244abc"), "\344abc"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.transcodeString("abc\303\244def"), "abc\344def"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.transcodeString("abc\ndef\303\244ghi\tjkl"), "abc\ndef\344ghi\tjkl"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // Test transcoding of a string with unsupported encoding (here: UTF-16).
+ assertEquals(MIStringHandler.transcodeString("\u3090"), "\u3090"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ @Test
+ public void testEscapeString() {
+ // Test escaping of an empty string.
+ assertEquals(MIStringHandler.escapeString(""), ""); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // Test escaping of a plain text string.
+ assertEquals(MIStringHandler.escapeString("abc"), "abc"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // Test escaping of strings which contain special chars.
+ assertEquals(MIStringHandler.escapeString("\n"), "\\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.escapeString("\n\b"), "\\n\\b"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.escapeString("\0\1\2\3\4\5\6\7\10\11\12\13\14\15\16\17"), //$NON-NLS-1$
+ "\\0\\001\\002\\003\\004\\005\\006\\a\\b\\t\\n\\v\\f\\r\\016\\017"); //$NON-NLS-1$
+ assertEquals(MIStringHandler.escapeString("\33"), "\\e"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.escapeString("\\", true), "\\\\"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.escapeString("\\", false), "\\"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.escapeString("'\t\\", true), "\\'\\t\\\\"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.escapeString("'\t\\", false), "'\\t\\"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // Test escaping of strings which contain non-printable characters up to 0x7F.
+ assertEquals(MIStringHandler.escapeString("\0"), "\\0"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.escapeString("\177"), "\\177"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.escapeString("abc\177"), "abc\\177"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.escapeString("\177abc"), "\\177abc"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.escapeString("abc\177def"), "abc\\177def"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // Test escaping of strings which contain non-printable characters up to 0xFF.
+ assertEquals(MIStringHandler.escapeString("\230"), "\\230"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.escapeString("abc\230"), "abc\\230"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.escapeString("\230abc"), "\\230abc"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.escapeString("abc\230def"), "abc\\230def"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // Test escaping of strings which contain non-printable characters up to 0xFFFF.
+ assertEquals(MIStringHandler.escapeString("\ud800"), "\\ud800"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.escapeString("abc\ud800"), "abc\\ud800"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.escapeString("\ud800abc"), "\\ud800abc"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.escapeString("abc\ud800def"), "abc\\ud800def"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // Test escaping of strings which contain non-printable characters up to 0x10FFFF.
+ assertEquals(MIStringHandler.escapeString("\udbff\udfff"), "\\U0010ffff"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.escapeString("abc\udbff\udfff"), "abc\\U0010ffff"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.escapeString("\udbff\udfffabc"), "\\U0010ffffabc"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.escapeString("abc\udbff\udfffdef"), "abc\\U0010ffffdef"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // Test escaping of a string which contains all sorts of non-printable characters.
+ assertEquals(MIStringHandler.escapeString("abc\n\tdef\\ghi\njkl\177\230\n\ud800\udbff\udfff?mno\"", true), //$NON-NLS-1$
+ "abc\\n\\tdef\\\\ghi\\njkl\\177\\230\\n\\ud800\\U0010ffff\\?mno\\\""); //$NON-NLS-1$
+ assertEquals(MIStringHandler.escapeString("abc\n\tdef\\ghi\njkl\177\230\n\ud800\udbff\udfff?mno\"", false), //$NON-NLS-1$
+ "abc\\n\\tdef\\ghi\\njkl\\177\\230\\n\\ud800\\U0010ffff?mno\""); //$NON-NLS-1$
+
+ // Test escaping of an ill-formed UTF-16 Java string.
+ assertEquals(MIStringHandler.escapeString("abc\udbff"), "abc\\udbff"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ @Test
+ public void testIsSpecialChar() {
+ // Testing non-special chars.
+ assertEquals(MIStringHandler.isSpecialChar('i'), false);
+ assertEquals(MIStringHandler.isSpecialChar('w'), false);
+
+ // Testing special chars.
+ assertEquals(MIStringHandler.isSpecialChar('a'), true);
+ assertEquals(MIStringHandler.isSpecialChar('b'), true);
+ assertEquals(MIStringHandler.isSpecialChar('e'), true);
+ assertEquals(MIStringHandler.isSpecialChar('E'), true);
+ assertEquals(MIStringHandler.isSpecialChar('f'), true);
+ assertEquals(MIStringHandler.isSpecialChar('n'), true);
+ assertEquals(MIStringHandler.isSpecialChar('r'), true);
+ assertEquals(MIStringHandler.isSpecialChar('t'), true);
+ assertEquals(MIStringHandler.isSpecialChar('v'), true);
+ assertEquals(MIStringHandler.isSpecialChar('\''), true);
+ assertEquals(MIStringHandler.isSpecialChar('"'), true);
+ assertEquals(MIStringHandler.isSpecialChar('\\'), true);
+ assertEquals(MIStringHandler.isSpecialChar('?'), true);
+ }
+
+ @Test
+ public void testIsSpecialCodePoint() {
+ // Testing non-special Unicode code points.
+ assertEquals(MIStringHandler.isSpecialCodePoint(0x69), false); // 'i' character
+ assertEquals(MIStringHandler.isSpecialCodePoint(0x77), false); // 'w' character
+ assertEquals(MIStringHandler.isSpecialCodePoint(0x61), false); // 'a' character
+ assertEquals(MIStringHandler.isSpecialCodePoint(0x6E), false); // 'n' character
+
+ // Testing special Unicode code points.
+ assertEquals(MIStringHandler.isSpecialCodePoint(0x07), true); // 'a' character
+ assertEquals(MIStringHandler.isSpecialCodePoint(0x08), true); // 'b' character
+ assertEquals(MIStringHandler.isSpecialCodePoint(0x1B), true); // 'e' character
+ assertEquals(MIStringHandler.isSpecialCodePoint(0x1B), true); // 'E' character
+ assertEquals(MIStringHandler.isSpecialCodePoint(0x0C), true); // 'f' character
+ assertEquals(MIStringHandler.isSpecialCodePoint(0x0A), true); // 'n' character
+ assertEquals(MIStringHandler.isSpecialCodePoint(0x0D), true); // 'r' character
+ assertEquals(MIStringHandler.isSpecialCodePoint(0x09), true); // 't' character
+ assertEquals(MIStringHandler.isSpecialCodePoint(0x0B), true); // 'v' character
+ assertEquals(MIStringHandler.isSpecialCodePoint(0x27), true); // '\'' character
+ assertEquals(MIStringHandler.isSpecialCodePoint(0x22), true); // '"' character
+ assertEquals(MIStringHandler.isSpecialCodePoint(0x5C), true); // '\\' character
+ assertEquals(MIStringHandler.isSpecialCodePoint(0x3F), true); // '?' character
+ }
+
+ @Test
+ public void testParseSpecialChar() {
+ // Testing non-special chars. This actually should throw ParseExceptions.
+ try {
+ MIStringHandler.parseSpecialChar('i');
+ fail("No parsing exception thrown.");
+ } catch (ParseException e) {
+ }
+
+ try {
+ MIStringHandler.parseSpecialChar('w');
+ fail("No parsing exception thrown.");
+ } catch (ParseException e) {
+ }
+
+ try {
+ // Testing special chars.
+ assertEquals(MIStringHandler.parseSpecialChar('a'), 0x07);
+ assertEquals(MIStringHandler.parseSpecialChar('b'), 0x08);
+ assertEquals(MIStringHandler.parseSpecialChar('e'), 0x1B);
+ assertEquals(MIStringHandler.parseSpecialChar('E'), 0x1B);
+ assertEquals(MIStringHandler.parseSpecialChar('f'), 0x0C);
+ assertEquals(MIStringHandler.parseSpecialChar('n'), 0x0A);
+ assertEquals(MIStringHandler.parseSpecialChar('r'), 0x0D);
+ assertEquals(MIStringHandler.parseSpecialChar('t'), 0x09);
+ assertEquals(MIStringHandler.parseSpecialChar('v'), 0x0B);
+ assertEquals(MIStringHandler.parseSpecialChar('\''), 0x27);
+ assertEquals(MIStringHandler.parseSpecialChar('"'), 0x22);
+ assertEquals(MIStringHandler.parseSpecialChar('\\'), 0x5C);
+ assertEquals(MIStringHandler.parseSpecialChar('?'), 0x3F);
+
+ } catch (ParseException e) {
+ fail("Parsing exception thrown."); //$NON-NLS-1$
+ }
+ }
+
+ @Test
+ public void testParseSpecialCodePoint() {
+ try {
+ // Testing non-special Unicode code points. This actually should throw ParseExceptions.
+ try {
+ MIStringHandler.parseSpecialCodePoint(0x69);
+ fail("No parsing exception thrown.");
+ } catch (ParseException e) {
+ }
+
+ try {
+ MIStringHandler.parseSpecialCodePoint(0x77);
+ fail("No parsing exception thrown.");
+ } catch (ParseException e) {
+ }
+
+ // Testing special Unicode code points.
+ assertEquals(MIStringHandler.parseSpecialCodePoint(0x07), 'a');
+ assertEquals(MIStringHandler.parseSpecialCodePoint(0x08), 'b');
+ assertEquals(MIStringHandler.parseSpecialCodePoint(0x1B), 'e');
+ assertEquals(MIStringHandler.parseSpecialCodePoint(0x0C), 'f');
+ assertEquals(MIStringHandler.parseSpecialCodePoint(0x0A), 'n');
+ assertEquals(MIStringHandler.parseSpecialCodePoint(0x0D), 'r');
+ assertEquals(MIStringHandler.parseSpecialCodePoint(0x09), 't');
+ assertEquals(MIStringHandler.parseSpecialCodePoint(0x0B), 'v');
+ assertEquals(MIStringHandler.parseSpecialCodePoint(0x27), '\'');
+ assertEquals(MIStringHandler.parseSpecialCodePoint(0x22), '"');
+ assertEquals(MIStringHandler.parseSpecialCodePoint(0x5C), '\\');
+ assertEquals(MIStringHandler.parseSpecialCodePoint(0x3F), '?');
+
+ } catch (ParseException e) {
+ fail("Parsing exception thrown."); //$NON-NLS-1$
+ }
+ }
+
+ @Test
+ public void testParseString() {
+ // Test parsing of an empty string.
+ assertEquals(MIStringHandler.parseString(""), ""); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString(""), ""); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // Test parsing of a plain text string.
+ assertEquals(MIStringHandler.parseString("abc"), "abc"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // Test parsing of strings which contain valid special char escape notations.
+ assertEquals(MIStringHandler.parseString("\\n"), "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\\\"), "\\"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\'\\t\\\\"), "'\t\\"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // Test parsing of strings which contain invalid special char escape notations.
+ assertEquals(MIStringHandler.parseString("\\w"), "\\w"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\"), "\\"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("abc\\"), "abc\\"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\www"), "\\www"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("abc\\www"), "abc\\www"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\'\\z\\\\"), "'\\z\\"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\'\\z\\"), "'\\z\\"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // Test parsing of strings which contain valid octal escape notations.
+ assertEquals(MIStringHandler.parseString("\\141\\142\\143"), "abc"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\141\\142\\143\\0"), "abc\0"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\141\\142\\143\\12"), "abc\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\141\\\\142\\143\\\\"), "a\\142c\\"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\12"), "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\012"), "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("'\\011\\"), "'\t\\"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\177"), "\177"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\377"), "\377"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\3777"), "\3777"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("abc\\177"), "abc\177"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\177abc"), "\177abc"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("abc\\177def"), "abc\177def"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\0"), "\0"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\1"), "\001"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\1a"), "\001a"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\18"), "\0018"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\01"), "\001"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\01a"), "\001a"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\001"), "\001"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\001a"), "\001a"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\0011"), "\0011"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\0011a"), "\0011a"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\1111"), "\1111"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // Test parsing of strings which contain invalid octal escape notations.
+ assertEquals(MIStringHandler.parseString("\\400"), "\\400"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\4000"), "\\4000"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\8"), "\\8"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\90"), "\\90"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\ 0"), "\\ 0"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\141\\142\\143\\"), "abc\\"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // Test parsing of strings which contain valid hexadecimal escape notations.
+ assertEquals(MIStringHandler.parseString("\\x0"), "\0"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\xa"), "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\xa0"), "\240"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\xag"), "\ng"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\x0a"), "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\x0a0"), "\240"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\x0ag"), "\ng"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\x00a"), "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\x00a0"), "\240"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\x00ag"), "\ng"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\x000a"), "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\x000a0"), "\n0"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\x000ag"), "\ng"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\x0000a"), "\0a"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\x0000a0"), "\0a0"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\x0000ag"), "\0ag"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("abc\\x20def"), "abc\u20def"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("abc\\x20def\\xa"), "abc\u20def\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("abc\\x20ghi"), "abc ghi"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("abc\\x20ghi\\xa"), "abc ghi\n"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // Test parsing of strings which contain invalid hexadecimal escape notations.
+ assertEquals(MIStringHandler.parseString("\\x"), "\\x"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("abc\\x"), "abc\\x"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\xwww"), "\\xwww"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\x\\"), "\\x\\"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\x 0"), "\\x 0"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\x\\0"), "\\x\0"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // Test parsing of strings which contain valid short Unicode escape notations.
+ assertEquals(MIStringHandler.parseString("\\u0000"), "\0"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\u000f"), "\017"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\u00ff"), "\377"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\u0fff"), "\u0fff"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\uffff"), "\uffff"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // Test parsing of strings which contain invalid short Unicode escape notations.
+ assertEquals(MIStringHandler.parseString("\\u"), "\\u"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("abc\\u"), "abc\\u"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\uwww"), "\\uwww"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\u\\"), "\\u\\"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\u 0"), "\\u 0"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\u\\0"), "\\u\0"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\u0"), "\\u0"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\u00"), "\\u00"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\u000"), "\\u000"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\u000g"), "\\u000g"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\ug"), "\\ug"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // Test parsing of strings which contain valid long Unicode escape notations.
+ assertEquals(MIStringHandler.parseString("\\U00000000"), "\0"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\U0000000f"), "\017"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\U000000ff"), "\377"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\U00000fff"), "\u0fff"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\U0000ffff"), "\uffff"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\U000fffff"), "\udbbf\udfff"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\U0010ffff"), "\udbff\udfff"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // Test parsing of strings which contain invalid long Unicode escape notations.
+ assertEquals(MIStringHandler.parseString("\\U"), "\\U"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("abc\\U"), "abc\\U"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\Uwww"), "\\Uwww"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\U\\"), "\\U\\"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\U 0"), "\\U 0"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\U\\0"), "\\U\0"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\U0"), "\\U0"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\U00"), "\\U00"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\U000"), "\\U000"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\U0000"), "\\U0000"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\U00000"), "\\U00000"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\U000000"), "\\U000000"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\U0000000"), "\\U0000000"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\U0000000g"), "\\U0000000g"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\U00110000"), "\\U00110000"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\U00f00000"), "\\U00f00000"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\U0f000000"), "\\U0f000000"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\Uf0000000"), "\\Uf0000000"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\Uffffffff"), "\\Uffffffff"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\Ufffffff"), "\\Ufffffff"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.parseString("\\Ug"), "\\Ug"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ @Test
+ public void testTranslateCString() {
+ // Test translating an empty string.
+ assertEquals(MIStringHandler.translateCString("", false), ""); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("", true), ""); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // Test translating a plain text string.
+ assertEquals(MIStringHandler.translateCString("abc", false), "abc"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("abc", true), "abc"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // Test translating strings which contain special chars and / or escaped special chars.
+ assertEquals(MIStringHandler.translateCString("\t", true), "\\t"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("\t", false), "\t"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("\\t", true), "\\t"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("\\t", false), "\t"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("\t\\t", true), "\\t\\t"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("\t\\t", false), "\t\t"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("\\t\t", true), "\\t\\t"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("\\t\t", false), "\t\t"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("'\"", true), "'\""); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("'\"", false), "'\""); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("\\'\\\"", true), "\\'\\\""); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("\\'\\\"", false), "'\""); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("'\\\"", true), "'\\\""); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("'\\\"", false), "'\""); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("\\'\"", true), "\\'\""); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("\\'\"", false), "'\""); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // Test translating strings which contain hexadecimal escape notations.
+ assertEquals(MIStringHandler.translateCString("\\x0000", true), "\\0"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("\\x0000", false), "\0"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("abc\\x31\\x32\\x33www", true), "abc123www"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("abc\\x0031\\x0032\\x0033www", true), "abc123www"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // Test translating strings which contain octal escape notations.
+ assertEquals(MIStringHandler.translateCString("\\000", true), "\\0"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("\\000", false), "\0"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("\\0", true), "\\0"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("\\0", false), "\0"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("abc\\222def", true), "abc\\222def"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("abc\\222def", false), "abc\222def"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("abc\\303def", true), "abc\303def"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("abc\\303def", false), "abc\303def"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("abc\\303\\244def", true), "abc\344def"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("abc\"def", true), "abc\"def"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("abc\"def", false), "abc\"def"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("abc'def", true), "abc'def"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("abc'def", false), "abc'def"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("abc\\\"def", true), "abc\\\"def"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("abc\\\"def", false), "abc\"def"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("abc\\'def", true), "abc\\'def"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("abc\\'def", false), "abc'def"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // Test translating strings which contain short Unicode escape notations.
+ assertEquals(MIStringHandler.translateCString("\\u0000", true), "\\0"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("\\u0000", false), "\0"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("abc\\u0031\\u0032\\u0033def", true), "abc123def"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // Test translating strings which contain long Unicode escape notations.
+ assertEquals(MIStringHandler.translateCString("\\U00000000", true), "\\0"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("\\U00000000", false), "\0"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(MIStringHandler.translateCString("abc\\U00000031\\U00000032\\U00000033def", true), "abc123def"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ public static junit.framework.Test suite() {
+ return new JUnit4TestAdapter(MIStringHandlerTests.class);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/mi/service/command/output/MIThreadTests.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/mi/service/command/output/MIThreadTests.java
index 4e8e7925b70..86765b4796f 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/mi/service/command/output/MIThreadTests.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/mi/service/command/output/MIThreadTests.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Freescale - Initial API and Implementation
* Alvaro Sanchez-Leon (Ericsson) - Moved from cdt.tests.dsf.gdb (Bug 437562)
@@ -21,14 +21,14 @@ import org.junit.Test;
public class MIThreadTests {
@Test
public void testOsIdParsing() {
- assertEquals("7010", MIThread.parseOsId("Thread 0xb7c8ab90 (LWP 7010)"));
+ assertEquals("7010", MIThread.parseOsId("Thread 0xb7c8ab90 (LWP 7010)"));
assertEquals("32942", MIThread.parseOsId("Thread 162.32942"));
assertEquals("abc123", MIThread.parseOsId("Thread abc123"));
assertEquals("abc123", MIThread.parseOsId("thread abc123"));
- assertEquals("abc123", MIThread.parseOsId("THREAD abc123"));
- assertEquals("abc123", MIThread.parseOsId("process abc123"));
+ assertEquals("abc123", MIThread.parseOsId("THREAD abc123"));
+ assertEquals("abc123", MIThread.parseOsId("process abc123"));
}
-
+
@Test
public void testParentIdParsing() {
assertEquals("162", MIThread.parseParentId("Thread 162.32942"));
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbAdapterFactory.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbAdapterFactory.java
index 86b27ad36dd..1aa91a4f768 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbAdapterFactory.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbAdapterFactory.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* Navid Mehregani (TI) - Bug 289526 - Migrate the Restart feature to the new one, as supported by the platform
@@ -43,140 +43,135 @@ import org.eclipse.debug.ui.contexts.ISuspendTrigger;
* for the launch object. But it also manages the creation and destruction
* of the session-based adapters which are returned by the
* IDMContext.getAdapter() methods.
- *
+ *
* When extending the GdbAdapterFactory, it is important to register all the
* types declaratively (in the plugin.xml) that the factory can adapt the
* extended launch to.
- *
+ *
* See the plugin.xml that references GdbAdapterFactory for the current list,
* and it should match {@link #getAdapterList()}.
*/
@ThreadSafe
public class GdbAdapterFactory implements IAdapterFactory, ILaunchesListener2 {
- /**
- * Active adapter sets. They are accessed using the launch instance
- * which owns the debug services session.
- */
- private static Map<GdbLaunch, GdbSessionAdapters> fgLaunchAdapterSets =
- Collections.synchronizedMap(new HashMap<>());
-
- /**
- * Map of launches for which adapter sets have already been disposed.
- * This map (used as a set) is maintained in order to avoid re-creating an
- * adapter set after the launch was removed from the launch manager, but
- * while the launch is still being held by other classes which may
- * request its adapters. A weak map is used to avoid leaking
- * memory once the launches are no longer referenced.
- * <p>
- * Access to this map is synchronized using the fgLaunchAdapterSets
- * instance.
- * </p>
- */
- private static Map<ILaunch, GdbSessionAdapters> fgDisposedLaunchAdapterSets = new WeakHashMap<>();
-
- static void disposeAdapterSet(ILaunch launch) {
- synchronized(fgLaunchAdapterSets) {
- if (fgLaunchAdapterSets.containsKey(launch)) {
- fgLaunchAdapterSets.remove(launch).dispose();
- fgDisposedLaunchAdapterSets.put(launch, null);
- }
- }
- }
-
- public GdbAdapterFactory() {
- DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this);
- }
-
- /**
- * This method only actually returns adapters for the launch object.
- */
- @Override
+ /**
+ * Active adapter sets. They are accessed using the launch instance
+ * which owns the debug services session.
+ */
+ private static Map<GdbLaunch, GdbSessionAdapters> fgLaunchAdapterSets = Collections
+ .synchronizedMap(new HashMap<>());
+
+ /**
+ * Map of launches for which adapter sets have already been disposed.
+ * This map (used as a set) is maintained in order to avoid re-creating an
+ * adapter set after the launch was removed from the launch manager, but
+ * while the launch is still being held by other classes which may
+ * request its adapters. A weak map is used to avoid leaking
+ * memory once the launches are no longer referenced.
+ * <p>
+ * Access to this map is synchronized using the fgLaunchAdapterSets
+ * instance.
+ * </p>
+ */
+ private static Map<ILaunch, GdbSessionAdapters> fgDisposedLaunchAdapterSets = new WeakHashMap<>();
+
+ static void disposeAdapterSet(ILaunch launch) {
+ synchronized (fgLaunchAdapterSets) {
+ if (fgLaunchAdapterSets.containsKey(launch)) {
+ fgLaunchAdapterSets.remove(launch).dispose();
+ fgDisposedLaunchAdapterSets.put(launch, null);
+ }
+ }
+ }
+
+ public GdbAdapterFactory() {
+ DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this);
+ }
+
+ /**
+ * This method only actually returns adapters for the launch object.
+ */
+ @Override
public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
- if (!(adaptableObject instanceof GdbLaunch)) return null;
-
- GdbLaunch launch = (GdbLaunch)adaptableObject;
-
- // Check for valid session.
- // Note: even if the session is no longer active, the adapter set
- // should still be returned. This is because the view model may still
- // need to show elements representing a terminated process/thread/etc.
- DsfSession session = launch.getSession();
- if (session == null) return null;
-
- // Find the correct set of adapters based on the launch session-ID. If not found
- // it means that we have a new launch and new session, and we have to create a
- // new set of adapters.
-
- GdbSessionAdapters adapterSet;
- synchronized(fgLaunchAdapterSets) {
- // The adapter set for the given launch was already disposed.
- // Return a null adapter.
- if (fgDisposedLaunchAdapterSets.containsKey(launch)) {
- return null;
- }
- adapterSet = fgLaunchAdapterSets.get(launch);
- if (adapterSet == null) {
- // If the first time we attempt to create an adapterSet is once the session is
- // already inactive, we should not create it and return null.
- // This can happen, for example, when we run JUnit tests and we don't actually
- // have a need for any adapters until the launch is actually being removed.
- // Note that we must do this here because fgDisposedLaunchAdapterSets
- // may not already know that the launch has been removed because of a race
- // condition with the caller which is also processing a launchRemoved method.
- // Bug 334687
- if (session.isActive() == false) {
- return null;
- }
- adapterSet = createGdbSessionAdapters(launch, session);
- fgLaunchAdapterSets.put(launch, adapterSet);
- }
- }
-
- // Returns the adapter type for the launch object.
- return adapterSet.getLaunchAdapter(adapterType);
- }
-
- /**
- * This list must match the list in the plugin.xml. See class comment.
- */
- @Override
- public Class<?>[] getAdapterList() {
- return new Class<?>[] {
- IElementContentProvider.class,
- IModelProxyFactory.class,
- ISuspendTrigger.class,
- IColumnPresentationFactory.class,
- ITerminateHandler.class,
- IConnectHandler.class,
- IDisconnectHandler.class,
- IDebugNewExecutableHandler.class,
- };
- }
-
- @Override
- public void launchesRemoved(ILaunch[] launches) {
- // Dispose the set of adapters for a launch only after the launch is
- // removed.
- for (ILaunch launch : launches) {
- if (launch instanceof GdbLaunch) {
- disposeAdapterSet(launch);
- }
- }
- }
-
- @Override
- public void launchesTerminated(ILaunch[] launches) {
- }
-
- @Override
- public void launchesAdded(ILaunch[] launches) {
- }
-
- @Override
- public void launchesChanged(ILaunch[] launches) {
- }
-
- protected GdbSessionAdapters createGdbSessionAdapters(ILaunch launch, DsfSession session) {
- return new GdbSessionAdapters(launch, session, getAdapterList());
- }
+ if (!(adaptableObject instanceof GdbLaunch))
+ return null;
+
+ GdbLaunch launch = (GdbLaunch) adaptableObject;
+
+ // Check for valid session.
+ // Note: even if the session is no longer active, the adapter set
+ // should still be returned. This is because the view model may still
+ // need to show elements representing a terminated process/thread/etc.
+ DsfSession session = launch.getSession();
+ if (session == null)
+ return null;
+
+ // Find the correct set of adapters based on the launch session-ID. If not found
+ // it means that we have a new launch and new session, and we have to create a
+ // new set of adapters.
+
+ GdbSessionAdapters adapterSet;
+ synchronized (fgLaunchAdapterSets) {
+ // The adapter set for the given launch was already disposed.
+ // Return a null adapter.
+ if (fgDisposedLaunchAdapterSets.containsKey(launch)) {
+ return null;
+ }
+ adapterSet = fgLaunchAdapterSets.get(launch);
+ if (adapterSet == null) {
+ // If the first time we attempt to create an adapterSet is once the session is
+ // already inactive, we should not create it and return null.
+ // This can happen, for example, when we run JUnit tests and we don't actually
+ // have a need for any adapters until the launch is actually being removed.
+ // Note that we must do this here because fgDisposedLaunchAdapterSets
+ // may not already know that the launch has been removed because of a race
+ // condition with the caller which is also processing a launchRemoved method.
+ // Bug 334687
+ if (session.isActive() == false) {
+ return null;
+ }
+ adapterSet = createGdbSessionAdapters(launch, session);
+ fgLaunchAdapterSets.put(launch, adapterSet);
+ }
+ }
+
+ // Returns the adapter type for the launch object.
+ return adapterSet.getLaunchAdapter(adapterType);
+ }
+
+ /**
+ * This list must match the list in the plugin.xml. See class comment.
+ */
+ @Override
+ public Class<?>[] getAdapterList() {
+ return new Class<?>[] { IElementContentProvider.class, IModelProxyFactory.class, ISuspendTrigger.class,
+ IColumnPresentationFactory.class, ITerminateHandler.class, IConnectHandler.class,
+ IDisconnectHandler.class, IDebugNewExecutableHandler.class, };
+ }
+
+ @Override
+ public void launchesRemoved(ILaunch[] launches) {
+ // Dispose the set of adapters for a launch only after the launch is
+ // removed.
+ for (ILaunch launch : launches) {
+ if (launch instanceof GdbLaunch) {
+ disposeAdapterSet(launch);
+ }
+ }
+ }
+
+ @Override
+ public void launchesTerminated(ILaunch[] launches) {
+ }
+
+ @Override
+ public void launchesAdded(ILaunch[] launches) {
+ }
+
+ @Override
+ public void launchesChanged(ILaunch[] launches) {
+ }
+
+ protected GdbSessionAdapters createGdbSessionAdapters(ILaunch launch, DsfSession session) {
+ return new GdbSessionAdapters(launch, session, getAdapterList());
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbDebugTextHover.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbDebugTextHover.java
index 923603dcc56..2ed7803e2b4 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbDebugTextHover.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbDebugTextHover.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* Ericsson - Updated hover to use the new Details format
@@ -23,30 +23,29 @@ import org.eclipse.core.runtime.Platform;
/**
* Debug editor text hover for GDB.
- *
+ *
* @since 2.1
*/
public class GdbDebugTextHover extends AbstractDsfDebugTextHover {
- @Override
- protected String getModelId() {
- return GdbLaunchDelegate.GDB_DEBUG_MODEL_ID;
- }
+ @Override
+ protected String getModelId() {
+ return GdbLaunchDelegate.GDB_DEBUG_MODEL_ID;
+ }
- @Override
+ @Override
protected String getHoverFormat() {
- return MIExpressions.DETAILS_FORMAT;
- }
+ return MIExpressions.DETAILS_FORMAT;
+ }
- @Override
- protected boolean useExpressionExplorer() {
- // The preference is part of the GdbPlugin preference store
- // Bug 414622
- if (Platform.getPreferencesService().getBoolean(GdbPlugin.PLUGIN_ID,
- IGdbDebugPreferenceConstants.PREF_USE_INSPECTOR_HOVER,
- true, null)) {
- return true;
- }
- return false;
- }
+ @Override
+ protected boolean useExpressionExplorer() {
+ // The preference is part of the GdbPlugin preference store
+ // Bug 414622
+ if (Platform.getPreferencesService().getBoolean(GdbPlugin.PLUGIN_ID,
+ IGdbDebugPreferenceConstants.PREF_USE_INSPECTOR_HOVER, true, null)) {
+ return true;
+ }
+ return false;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbPinColorTracker.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbPinColorTracker.java
index b497df1e3f1..42d021179b9 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbPinColorTracker.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbPinColorTracker.java
@@ -26,27 +26,30 @@ class GdbPinColorTracker {
private class Pair {
Integer refCount;
String context;
+
Pair(String context, Integer refCount) {
this.context = context;
this.refCount = refCount;
}
}
-
- private static List<Pair> gsColorBuckets = Collections.synchronizedList( new ArrayList<Pair>() );
-
+
+ private static List<Pair> gsColorBuckets = Collections.synchronizedList(new ArrayList<Pair>());
+
/**
* The static instance.
*/
static GdbPinColorTracker INSTANCE = new GdbPinColorTracker();
-
+
/**
* Singleton object - make constructor private.
*/
- private GdbPinColorTracker() {}
-
+ private GdbPinColorTracker() {
+ }
+
int addRef(String context) {
- if (context == null) return IPinElementColorDescriptor.UNDEFINED;
-
+ if (context == null)
+ return IPinElementColorDescriptor.UNDEFINED;
+
// look in the buckets and see if it is already exist
for (int i = 0; i < gsColorBuckets.size(); ++i) {
Pair pair = gsColorBuckets.get(i);
@@ -55,10 +58,10 @@ class GdbPinColorTracker {
return i % IPinElementColorDescriptor.DEFAULT_COLOR_COUNT;
}
}
-
+
// if not exist in the buckets, then add to the bucket collection
int size = gsColorBuckets.size();
- int index = size;
+ int index = size;
for (int i = 0; i < size; ++i) {
Pair pair = gsColorBuckets.get(i);
if (pair.refCount <= 0) {
@@ -70,15 +73,16 @@ class GdbPinColorTracker {
gsColorBuckets.add(index, new Pair(context, 1));
return (index) % IPinElementColorDescriptor.DEFAULT_COLOR_COUNT;
}
-
+
void removeRef(String context) {
- if (context == null) return;
-
+ if (context == null)
+ return;
+
for (int i = 0; i < gsColorBuckets.size(); ++i) {
Pair pair = gsColorBuckets.get(i);
if (pair.context.equals(context)) {
pair.refCount--;
-
+
return;
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbPinProvider.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbPinProvider.java
index 0da015fb802..286c2cd92ef 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbPinProvider.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbPinProvider.java
@@ -60,54 +60,56 @@ import org.eclipse.ui.IWorkbenchPart;
public class GdbPinProvider implements IPinProvider {
private static class GdbPinElementColorDescriptor implements IPinElementColorDescriptor {
int fColor = GREEN;
-
+
GdbPinElementColorDescriptor(int color) {
fColor = color;
}
- @Override
+
+ @Override
public int getOverlayColor() {
return fColor;
}
- @Override
+
+ @Override
public ImageDescriptor getToolbarIconDescriptor() {
return null;
}
}
-
+
/**
* A set of pinned element handles and their callback.
*/
- private static Map<IPinElementHandle, IPinModelListener> gsPinnedHandles =
- Collections.synchronizedMap(new HashMap<IPinElementHandle, IPinModelListener>());
-
+ private static Map<IPinElementHandle, IPinModelListener> gsPinnedHandles = Collections
+ .synchronizedMap(new HashMap<IPinElementHandle, IPinModelListener>());
+
/**
* Dsf session.
*/
private final DsfSession fSession;
-
+
/**
* Constructor.
- *
+ *
* @param session
*/
public GdbPinProvider(DsfSession session) {
fSession = session;
-
- session.getExecutor().execute(new Runnable() {
- @Override
+
+ session.getExecutor().execute(new Runnable() {
+ @Override
public void run() {
fSession.addServiceEventListener(GdbPinProvider.this, null);
}
- });
+ });
}
-
+
/**
* Dispose all resources.
*/
public void dispose() {
try {
- fSession.getExecutor().execute(new Runnable() {
- @Override
+ fSession.getExecutor().execute(new Runnable() {
+ @Override
public void run() {
fSession.removeServiceEventListener(GdbPinProvider.this);
}
@@ -116,31 +118,31 @@ public class GdbPinProvider implements IPinProvider {
// Session already gone.
}
}
-
+
/**
* Returns the pinned element handles.
- *
+ *
* @return the element handles.
*/
public static Set<IPinElementHandle> getPinnedHandles() {
return gsPinnedHandles.keySet();
}
-
- private static IMIExecutionDMContext getExecutionDmc(IDMContext dmc) {
- return DMContexts.getAncestorOfType(dmc, IMIExecutionDMContext.class);
+
+ private static IMIExecutionDMContext getExecutionDmc(IDMContext dmc) {
+ return DMContexts.getAncestorOfType(dmc, IMIExecutionDMContext.class);
}
-
+
private static IProcessDMContext getProcessDmc(IDMContext dmc) {
return DMContexts.getAncestorOfType(dmc, IProcessDMContext.class);
}
-
+
private IThreadDMData getData(final IThreadDMContext threadDmc) {
- if (threadDmc == null || !fSession.isActive())
- return null;
-
+ if (threadDmc == null || !fSession.isActive())
+ return null;
+
IThreadDMData data = null;
final DsfServicesTracker tracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), fSession.getId());
- try {
+ try {
Query<IThreadDMData> query = new Query<IThreadDMData>() {
@Override
protected void execute(final DataRequestMonitor<IThreadDMData> rm) {
@@ -153,10 +155,10 @@ public class GdbPinProvider implements IPinProvider {
}
}
};
-
- ImmediateInDsfExecutor immediateExecutor = new ImmediateInDsfExecutor(fSession.getExecutor());
+
+ ImmediateInDsfExecutor immediateExecutor = new ImmediateInDsfExecutor(fSession.getExecutor());
immediateExecutor.execute(query);
- data = query.get(2, TimeUnit.SECONDS); // timeout in 2 seconds, in case the call to execute got stuck
+ data = query.get(2, TimeUnit.SECONDS); // timeout in 2 seconds, in case the call to execute got stuck
} catch (Exception e) {
GdbUIPlugin.log(e);
} finally {
@@ -165,7 +167,7 @@ public class GdbPinProvider implements IPinProvider {
}
return data;
}
-
+
private String getLabel(IThreadDMData data) {
String label = ""; //$NON-NLS-1$
if (data != null) {
@@ -178,72 +180,72 @@ public class GdbPinProvider implements IPinProvider {
}
return label;
}
-
+
private String getCombinedLabels(IThreadDMContext processDmc, IMIExecutionDMContext execDmc) {
// get the process label
IThreadDMData processData = getData(processDmc);
String label = getLabel(processData);
-
+
// get the execution (thread) context label
if (execDmc != null) {
String threadId = execDmc.getThreadId();
- label += !label.isEmpty() ? ": " : ""; //$NON-NLS-1$//$NON-NLS-2$
- label += "Thread [" + threadId + "]"; //$NON-NLS-1$//$NON-NLS-2$
+ label += !label.isEmpty() ? ": " : ""; //$NON-NLS-1$//$NON-NLS-2$
+ label += "Thread [" + threadId + "]"; //$NON-NLS-1$//$NON-NLS-2$
}
return label;
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.cdt.debug.ui.IPinProvider#isPinnable(org.eclipse.ui.IWorkbenchPart, java.lang.Object)
*/
- @Override
+ @Override
public boolean isPinnable(IWorkbenchPart part, Object debugContext) {
if (debugContext instanceof IAdaptable) {
return ((IAdaptable) debugContext).getAdapter(IDMContext.class) != null;
}
return false;
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.cdt.debug.ui.IPinProvider#pin(org.eclipse.ui.IWorkbenchPart, java.lang.Object, org.eclipse.cdt.debug.ui.IPinModelListener)
*/
- @Override
+ @Override
public IPinElementHandle pin(IWorkbenchPart part, Object debugContext, IPinModelListener listener) {
Object pinContext = debugContext;
String label = ""; //$NON-NLS-1$
String sessionId = ""; //$NON-NLS-1$
-
+
IDMContext dmc = null;
if (debugContext instanceof IAdaptable) {
dmc = ((IAdaptable) debugContext).getAdapter(IDMContext.class);
-
+
if (dmc != null) {
sessionId = dmc.getSessionId() + "."; //$NON-NLS-1$
IMIExecutionDMContext execDmc = getExecutionDmc(dmc);
IProcessDMContext processDmc = getProcessDmc(dmc);
-
+
label = getCombinedLabels(processDmc, execDmc);
-
+
// set the pin context to a thread if it exist
if (execDmc != null) {
dmc = execDmc;
pinContext = execDmc;
-
- // otherwise, set it to the DM context
+
+ // otherwise, set it to the DM context
} else {
pinContext = dmc;
}
}
}
- IPinElementColorDescriptor colorDesc =
- new GdbPinElementColorDescriptor(GdbPinColorTracker.INSTANCE.addRef(sessionId + label));
+ IPinElementColorDescriptor colorDesc = new GdbPinElementColorDescriptor(
+ GdbPinColorTracker.INSTANCE.addRef(sessionId + label));
PinElementHandle handle = new PinElementHandle(pinContext, label, colorDesc);
gsPinnedHandles.put(handle, listener);
dispatchChangedEvent(dmc);
-
+
return handle;
}
@@ -251,18 +253,18 @@ public class GdbPinProvider implements IPinProvider {
* (non-Javadoc)
* @see org.eclipse.cdt.debug.ui.IPinProvider#unpin(org.eclipse.ui.IWorkbenchPart, org.eclipse.cdt.debug.ui.IPinProvider.IPinElementHandle)
*/
- @Override
+ @Override
public void unpin(IWorkbenchPart part, IPinElementHandle handle) {
// remove the handle from the cache
- gsPinnedHandles.remove(handle);
-
+ gsPinnedHandles.remove(handle);
+
// dispatch the event to update the handle DM context
Object debugContext = handle.getDebugContext();
if (debugContext instanceof IAdaptable) {
IDMContext dmc = ((IAdaptable) debugContext).getAdapter(IDMContext.class);
GdbPinColorTracker.INSTANCE.removeRef(dmc.getSessionId() + "." + handle.getLabel()); //$NON-NLS-1$
dispatchChangedEvent(dmc);
-
+
}
}
@@ -270,37 +272,37 @@ public class GdbPinProvider implements IPinProvider {
* (non-Javadoc)
* @see org.eclipse.cdt.debug.ui.IPinProvider#isPinnedTo(java.lang.Object, org.eclipse.cdt.debug.ui.IPinProvider.IPinElementHandle)
*/
- @Override
+ @Override
public boolean isPinnedTo(Object debugContext, IPinElementHandle handle) {
Object handleDebugContext = handle.getDebugContext();
-
- if (debugContext instanceof IAdaptable && handleDebugContext instanceof IAdaptable) {
+
+ if (debugContext instanceof IAdaptable && handleDebugContext instanceof IAdaptable) {
IDMContext dmc = ((IAdaptable) debugContext).getAdapter(IDMContext.class);
IDMContext hDmc = ((IAdaptable) handleDebugContext).getAdapter(IDMContext.class);
-
+
if (dmc != null && hDmc != null) {
- if (dmc.getSessionId().equals(hDmc.getSessionId())) {
+ if (dmc.getSessionId().equals(hDmc.getSessionId())) {
IMIExecutionDMContext execDmc = getExecutionDmc(dmc);
IProcessDMContext processDmc = getProcessDmc(dmc);
-
+
String label = getCombinedLabels(processDmc, execDmc);
- return label.equals(handle.getLabel());
+ return label.equals(handle.getLabel());
}
}
}
return false;
}
-
+
/**
* Dispatch the change event for the given DM context.
- *
+ *
* @param dmc the DM context
*/
private void dispatchChangedEvent(IDMContext dmc) {
if (dmc == null)
return;
-
- try {
+
+ try {
DsfSession session = DsfSession.getSession(dmc.getSessionId());
if (session != null && session.isActive())
session.dispatchEvent(new StateChangedEvent(dmc), null);
@@ -308,34 +310,37 @@ public class GdbPinProvider implements IPinProvider {
// Session already gone.
}
}
-
+
/**
* Handle start event and re-attach the DM context to the pinned handles. The DM context
* is used for dispatching event to update the element label.
*/
@DsfServiceEventHandler
- public void handleEvent(final IStartedDMEvent event) {
- final IDMContext eventDmc = event.getDMContext();
- final IMIExecutionDMContext eventExecDmc = getExecutionDmc(eventDmc);
- final IProcessDMContext eventProcessDmc = getProcessDmc(eventDmc);
-
- if (eventProcessDmc != null) {
+ public void handleEvent(final IStartedDMEvent event) {
+ final IDMContext eventDmc = event.getDMContext();
+ final IMIExecutionDMContext eventExecDmc = getExecutionDmc(eventDmc);
+ final IProcessDMContext eventProcessDmc = getProcessDmc(eventDmc);
+
+ if (eventProcessDmc != null) {
for (final IPinElementHandle h : getPinnedHandles()) {
new Job("Updating pin handler debug context") { //$NON-NLS-1$
- {setPriority(INTERACTIVE);}
+ {
+ setPriority(INTERACTIVE);
+ }
+
@Override
- protected IStatus run(IProgressMonitor monitor) {
+ protected IStatus run(IProgressMonitor monitor) {
// only attach to the same pin handle if the session is not active
- PinElementHandle handle = ((PinElementHandle)h);
+ PinElementHandle handle = ((PinElementHandle) h);
Object handleDebugContext = handle.getDebugContext();
- if (handleDebugContext instanceof IAdaptable) {
+ if (handleDebugContext instanceof IAdaptable) {
IDMContext handleDmc = ((IAdaptable) handleDebugContext).getAdapter(IDMContext.class);
if (handleDmc != null) {
DsfSession session = DsfSession.getSession(handleDmc.getSessionId());
- if (session == null || !session.isActive()) {
+ if (session == null || !session.isActive()) {
String handleLabel = handle.getLabel();
String label = getCombinedLabels(eventProcessDmc, eventExecDmc);
-
+
if (label.equals(handleLabel)) {
IDMContext newDmc = eventExecDmc != null ? eventExecDmc : eventDmc;
handle.setDebugContext(newDmc);
@@ -350,7 +355,7 @@ public class GdbPinProvider implements IPinProvider {
}
}
}
-
+
@DsfServiceEventHandler
public void handleEvent(final ICommandControlShutdownDMEvent event) {
handleInvalidModelContext(event);
@@ -360,29 +365,31 @@ public class GdbPinProvider implements IPinProvider {
public void handleEvent(final IExitedDMEvent event) {
handleInvalidModelContext(event);
}
-
+
@DsfServiceEventHandler
public void handleEvent(final IResumedDMEvent event) {
handleInvalidModelContext(event);
}
-
+
private void handleInvalidModelContext(IDMEvent<?> event) {
Set<Entry<IPinElementHandle, IPinModelListener>> entries = gsPinnedHandles.entrySet();
- for (final Entry<IPinElementHandle, IPinModelListener> e : entries) {
+ for (final Entry<IPinElementHandle, IPinModelListener> e : entries) {
final IPinModelListener listener = e.getValue();
if (listener != null) {
IPinElementHandle handle = e.getKey();
-
+
Object handleObject = handle.getDebugContext();
if (handleObject instanceof IDMContext) {
- IDMContext handleDmc = (IDMContext)handleObject;
+ IDMContext handleDmc = (IDMContext) handleObject;
IDMContext eventDmc = event.getDMContext();
-
+
// First check if we have a thread. We must use IMIExecutionDMContext and not
// IExecutionDMContext because IExecutionDMContext also represents a process
- IMIExecutionDMContext execEventDmc = DMContexts.getAncestorOfType(eventDmc, IMIExecutionDMContext.class);
- IMIExecutionDMContext execHandleDmc = DMContexts.getAncestorOfType(handleDmc, IMIExecutionDMContext.class);
-
+ IMIExecutionDMContext execEventDmc = DMContexts.getAncestorOfType(eventDmc,
+ IMIExecutionDMContext.class);
+ IMIExecutionDMContext execHandleDmc = DMContexts.getAncestorOfType(handleDmc,
+ IMIExecutionDMContext.class);
+
// Make sure both dmcs are not null to know if we should compare thread dmcs or container dmcs
if (execEventDmc != null && execHandleDmc != null) {
// It is a thread event, but is it the same as the pin handle?
@@ -391,19 +398,21 @@ public class GdbPinProvider implements IPinProvider {
}
continue;
}
-
+
// If we weren't dealing with a thread for either the event or the handle,
// let's check for IMIContainerDMContext
- IMIContainerDMContext procEventDmc = DMContexts.getAncestorOfType(eventDmc, IMIContainerDMContext.class);
- IMIContainerDMContext procHandleDmc = DMContexts.getAncestorOfType(handleDmc, IMIContainerDMContext.class);
+ IMIContainerDMContext procEventDmc = DMContexts.getAncestorOfType(eventDmc,
+ IMIContainerDMContext.class);
+ IMIContainerDMContext procHandleDmc = DMContexts.getAncestorOfType(handleDmc,
+ IMIContainerDMContext.class);
if (procEventDmc != null && procHandleDmc != null) {
if (procEventDmc.equals(procHandleDmc)) {
fireModleChangeEvent(listener, null);
}
continue;
}
-
- // If we got a shutdown event
+
+ // If we got a shutdown event
if (eventDmc instanceof ICommandControlDMContext) {
fireModleChangeEvent(listener, null);
continue;
@@ -412,15 +421,18 @@ public class GdbPinProvider implements IPinProvider {
}
}
}
-
+
private void fireModleChangeEvent(final IPinModelListener listener, final ISelection selection) {
new Job("Model Changed") { //$NON-NLS-1$
- { setSystem(true); }
+ {
+ setSystem(true);
+ }
+
@Override
protected IStatus run(IProgressMonitor arg0) {
listener.modelChanged(selection);
return Status.OK_STATUS;
- }
+ }
}.schedule();
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbSessionAdapters.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbSessionAdapters.java
index e8aa96b06d8..236478ae874 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbSessionAdapters.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbSessionAdapters.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Marc Khouzam (Ericsson) - initial API and implementation
* Mikhail Khodjaiants (Mentor Graphics) - initial API and implementation
@@ -103,254 +103,225 @@ import org.eclipse.debug.ui.sourcelookup.ISourceDisplay;
*/
@Immutable
public class GdbSessionAdapters {
- private final ILaunch fLaunch;
- private final DsfSession fSession;
+ private final ILaunch fLaunch;
+ private final DsfSession fSession;
+
+ private final Map<Class<?>, Object> fLaunchAdapters = new HashMap<>();
+ private final Class<?>[] fLaunchAdapterTypes;
- private final Map<Class<?>, Object> fLaunchAdapters = new HashMap<>();
- private final Class<?>[] fLaunchAdapterTypes;
-
- public GdbSessionAdapters(ILaunch launch, DsfSession session, Class<?>[] launchAdapterTypes) {
+ public GdbSessionAdapters(ILaunch launch, DsfSession session, Class<?>[] launchAdapterTypes) {
fLaunch = launch;
fSession = session;
fLaunchAdapterTypes = launchAdapterTypes;
createAdapters();
- }
+ }
- /**
- * Creates all model and launch adapters.
- */
- protected void createAdapters() {
- for (Class<?> adapterType : getModelAdapters()) {
- Object adapter = createModelAdapter(adapterType, getLaunch(), getSession());
- if (adapter != null) {
- getSession().registerModelAdapter(adapterType, adapter);
- }
- }
- for (Class<?> adapterType : fLaunchAdapterTypes) {
- Object adapter = createLaunchAdapter(adapterType, getLaunch(), getSession());
- if (adapter != null) {
- fLaunchAdapters.put(adapterType, adapter);
- }
- }
- }
+ /**
+ * Creates all model and launch adapters.
+ */
+ protected void createAdapters() {
+ for (Class<?> adapterType : getModelAdapters()) {
+ Object adapter = createModelAdapter(adapterType, getLaunch(), getSession());
+ if (adapter != null) {
+ getSession().registerModelAdapter(adapterType, adapter);
+ }
+ }
+ for (Class<?> adapterType : fLaunchAdapterTypes) {
+ Object adapter = createLaunchAdapter(adapterType, getLaunch(), getSession());
+ if (adapter != null) {
+ fLaunchAdapters.put(adapterType, adapter);
+ }
+ }
+ }
- /**
- * Returns the adapter object registered with the session for the given adapter type
- * or null if no adapter is registered.
- */
- @SuppressWarnings("unchecked")
+ /**
+ * Returns the adapter object registered with the session for the given adapter type
+ * or null if no adapter is registered.
+ */
+ @SuppressWarnings("unchecked")
public <T> T getModelAdapter(Class<T> adapterType) {
- return (T)fSession.getModelAdapter(adapterType);
- }
+ return (T) fSession.getModelAdapter(adapterType);
+ }
- /**
- * Returns the adapter object registered with {@link ILaunch} for the given adapter type
- * or null if no adapter is registered.
- */
- @SuppressWarnings("unchecked")
+ /**
+ * Returns the adapter object registered with {@link ILaunch} for the given adapter type
+ * or null if no adapter is registered.
+ */
+ @SuppressWarnings("unchecked")
public <T> T getLaunchAdapter(Class<T> adapterType) {
- if (adapterType.equals(ITerminateHandler.class) ||
- adapterType.equals(IConnectHandler.class) ||
- adapterType.equals(IDisconnectHandler.class) ||
- adapterType.equals(IDebugNewExecutableHandler.class)) {
- // These launch adapters re-use the session adapters.
- // Return them directly instead of including them
- // in fLaunchAdapters to avoid trying to dispose of them
- // twice when dispose() is called.
- return (T)fSession.getModelAdapter(adapterType);
- }
+ if (adapterType.equals(ITerminateHandler.class) || adapterType.equals(IConnectHandler.class)
+ || adapterType.equals(IDisconnectHandler.class)
+ || adapterType.equals(IDebugNewExecutableHandler.class)) {
+ // These launch adapters re-use the session adapters.
+ // Return them directly instead of including them
+ // in fLaunchAdapters to avoid trying to dispose of them
+ // twice when dispose() is called.
+ return (T) fSession.getModelAdapter(adapterType);
+ }
- return (T)fLaunchAdapters.get(adapterType);
- }
+ return (T) fLaunchAdapters.get(adapterType);
+ }
- public void dispose() {
- for (Class<?> adapterType : getModelAdapters()) {
- Object adapter = getSession().getModelAdapter(adapterType);
- if (adapter != null) {
- getSession().unregisterModelAdapter(adapterType);
- disposeAdapter(adapter);
- }
- }
- for (Class<?> adapterType : fLaunchAdapterTypes) {
- Object adapter = fLaunchAdapters.remove(adapterType);
- if (adapter != null) {
- disposeAdapter(adapter);
- }
- }
- }
+ public void dispose() {
+ for (Class<?> adapterType : getModelAdapters()) {
+ Object adapter = getSession().getModelAdapter(adapterType);
+ if (adapter != null) {
+ getSession().unregisterModelAdapter(adapterType);
+ disposeAdapter(adapter);
+ }
+ }
+ for (Class<?> adapterType : fLaunchAdapterTypes) {
+ Object adapter = fLaunchAdapters.remove(adapterType);
+ if (adapter != null) {
+ disposeAdapter(adapter);
+ }
+ }
+ }
- /**
- * Returns all adapter types registered with the session.
- * Clients can override this method to add a new adapter type and
- * then override {@link GdbSessionAdapters.createModelAdapter()}
- * to provide the adapter object.
- */
- protected List<Class<?>> getModelAdapters() {
- // Return a list to which elements can be added
- return new ArrayList<>(Arrays.asList(
- SteppingController.class,
- IViewerInputProvider.class,
- ISteppingModeTarget.class,
- ISourceDisplay.class,
- IStepIntoHandler.class,
- IStepIntoSelectionHandler.class,
- IReverseStepIntoHandler.class,
- IStepOverHandler.class,
- IReverseStepOverHandler.class,
- IStepReturnHandler.class,
- IUncallHandler.class,
- ISuspendHandler.class,
- IResumeHandler.class,
- IReverseResumeHandler.class,
- IResumeWithoutSignalHandler.class,
- IRestartHandler.class,
- ITerminateHandler.class,
- IDebugNewExecutableHandler.class,
- IConnectHandler.class,
- IDisconnectHandler.class,
- IModelSelectionPolicyFactory.class,
- IRefreshAllTarget.class,
- IReverseToggleHandler.class,
- IStartTracingHandler.class,
- IStopTracingHandler.class,
- ISaveTraceDataHandler.class,
- ISelectNextTraceRecordHandler.class,
- ISelectPrevTraceRecordHandler.class,
- IPinProvider.class,
- IDebugModelProvider.class,
- ILaunch.class,
- ICEditorTextHover.class,
- IMemoryBlockAddressInfoRetrieval.class));
- }
+ /**
+ * Returns all adapter types registered with the session.
+ * Clients can override this method to add a new adapter type and
+ * then override {@link GdbSessionAdapters.createModelAdapter()}
+ * to provide the adapter object.
+ */
+ protected List<Class<?>> getModelAdapters() {
+ // Return a list to which elements can be added
+ return new ArrayList<>(Arrays.asList(SteppingController.class, IViewerInputProvider.class,
+ ISteppingModeTarget.class, ISourceDisplay.class, IStepIntoHandler.class,
+ IStepIntoSelectionHandler.class, IReverseStepIntoHandler.class, IStepOverHandler.class,
+ IReverseStepOverHandler.class, IStepReturnHandler.class, IUncallHandler.class, ISuspendHandler.class,
+ IResumeHandler.class, IReverseResumeHandler.class, IResumeWithoutSignalHandler.class,
+ IRestartHandler.class, ITerminateHandler.class, IDebugNewExecutableHandler.class, IConnectHandler.class,
+ IDisconnectHandler.class, IModelSelectionPolicyFactory.class, IRefreshAllTarget.class,
+ IReverseToggleHandler.class, IStartTracingHandler.class, IStopTracingHandler.class,
+ ISaveTraceDataHandler.class, ISelectNextTraceRecordHandler.class, ISelectPrevTraceRecordHandler.class,
+ IPinProvider.class, IDebugModelProvider.class, ILaunch.class, ICEditorTextHover.class,
+ IMemoryBlockAddressInfoRetrieval.class));
+ }
- /**
- * Creates the adapter object for the given adapter type to register it with {@link ILaunch}.
- * Clients can override this method to provide their own adapters.
- */
- @SuppressWarnings("unchecked")
+ /**
+ * Creates the adapter object for the given adapter type to register it with {@link ILaunch}.
+ * Clients can override this method to provide their own adapters.
+ */
+ @SuppressWarnings("unchecked")
protected <T> T createLaunchAdapter(Class<T> adapterType, ILaunch launch, DsfSession session) {
- if (adapterType.equals(IElementContentProvider.class) ||
- adapterType.equals(IModelProxyFactory.class) ||
- adapterType.equals(IColumnPresentationFactory.class)) {
- return (T)getViewModelAdapter();
- }
-
- if (adapterType.equals(ISuspendTrigger.class)) {
- return (T)new GdbSuspendTrigger(session, launch);
- }
+ if (adapterType.equals(IElementContentProvider.class) || adapterType.equals(IModelProxyFactory.class)
+ || adapterType.equals(IColumnPresentationFactory.class)) {
+ return (T) getViewModelAdapter();
+ }
- return null;
- }
+ if (adapterType.equals(ISuspendTrigger.class)) {
+ return (T) new GdbSuspendTrigger(session, launch);
+ }
- /**
- * Creates the adapter object for the given adapter type to register it with the model.
- * Clients can override this method to provide their own adapters.
- */
- @SuppressWarnings("unchecked")
+ return null;
+ }
+
+ /**
+ * Creates the adapter object for the given adapter type to register it with the model.
+ * Clients can override this method to provide their own adapters.
+ */
+ @SuppressWarnings("unchecked")
protected <T> T createModelAdapter(Class<T> adapterType, ILaunch launch, DsfSession session) {
if (SteppingController.class.equals(adapterType)) {
- return (T)new SteppingController(session);
+ return (T) new SteppingController(session);
}
if (IViewerInputProvider.class.equals(adapterType)) {
- return (T)new GdbViewModelAdapter(session, getSteppingController());
+ return (T) new GdbViewModelAdapter(session, getSteppingController());
}
if (ISteppingModeTarget.class.equals(adapterType)) {
- return (T)new GdbSteppingModeTarget(session);
+ return (T) new GdbSteppingModeTarget(session);
}
- if (ISourceDisplay.class.equals(adapterType)) {
- return launch.getSourceLocator() instanceof ISourceLookupDirector ?
- (T)new DsfSourceDisplayAdapter(
- session,
- (ISourceLookupDirector)launch.getSourceLocator(),
- getSteppingController()
- ) : null;
+ if (ISourceDisplay.class.equals(adapterType)) {
+ return launch.getSourceLocator() instanceof ISourceLookupDirector
+ ? (T) new DsfSourceDisplayAdapter(session, (ISourceLookupDirector) launch.getSourceLocator(),
+ getSteppingController())
+ : null;
}
if (IStepIntoHandler.class.equals(adapterType)) {
- return (T)new DsfStepIntoCommand(session, getSteppingModeTarget());
+ return (T) new DsfStepIntoCommand(session, getSteppingModeTarget());
}
if (IStepIntoSelectionHandler.class.equals(adapterType)) {
- return (T)new DsfStepIntoSelectionCommand(session);
+ return (T) new DsfStepIntoSelectionCommand(session);
}
if (IReverseStepIntoHandler.class.equals(adapterType)) {
- return (T)new GdbReverseStepIntoCommand(session, getSteppingModeTarget());
+ return (T) new GdbReverseStepIntoCommand(session, getSteppingModeTarget());
}
if (IStepOverHandler.class.equals(adapterType)) {
- return (T)new DsfStepOverCommand(session, getSteppingModeTarget());
+ return (T) new DsfStepOverCommand(session, getSteppingModeTarget());
}
if (IReverseStepOverHandler.class.equals(adapterType)) {
- return (T)new GdbReverseStepOverCommand(session, getSteppingModeTarget());
+ return (T) new GdbReverseStepOverCommand(session, getSteppingModeTarget());
}
if (IStepReturnHandler.class.equals(adapterType)) {
- return (T)new DsfStepReturnCommand(session);
+ return (T) new DsfStepReturnCommand(session);
}
if (IUncallHandler.class.equals(adapterType)) {
- return (T)new GdbUncallCommand(session, getSteppingModeTarget());
+ return (T) new GdbUncallCommand(session, getSteppingModeTarget());
}
if (ISuspendHandler.class.equals(adapterType)) {
- return (T)new DsfSuspendCommand(session);
+ return (T) new DsfSuspendCommand(session);
}
if (IResumeHandler.class.equals(adapterType)) {
- return (T)new DsfResumeCommand(session);
+ return (T) new DsfResumeCommand(session);
}
if (IReverseResumeHandler.class.equals(adapterType)) {
- return (T)new GdbReverseResumeCommand(session);
+ return (T) new GdbReverseResumeCommand(session);
}
if (IResumeWithoutSignalHandler.class.equals(adapterType)) {
- return (T)new GdbResumeWithoutSignalCommand(session);
+ return (T) new GdbResumeWithoutSignalCommand(session);
}
if (IRestartHandler.class.equals(adapterType)) {
- return (T)new GdbRestartCommand(session, getLaunch());
+ return (T) new GdbRestartCommand(session, getLaunch());
}
- if (ITerminateHandler.class.equals(adapterType)) {
- return (T)new DsfTerminateCommand(session);
+ if (ITerminateHandler.class.equals(adapterType)) {
+ return (T) new DsfTerminateCommand(session);
}
if (IDebugNewExecutableHandler.class.equals(adapterType)) {
- return (T)new GdbDebugNewExecutableCommand(session, launch);
+ return (T) new GdbDebugNewExecutableCommand(session, launch);
}
- if (IConnectHandler.class.equals(adapterType)) {
- return (T)new GdbConnectCommand(session, launch);
+ if (IConnectHandler.class.equals(adapterType)) {
+ return (T) new GdbConnectCommand(session, launch);
}
- if (IDisconnectHandler.class.equals(adapterType)) {
- return (T)new GdbDisconnectCommand(session);
+ if (IDisconnectHandler.class.equals(adapterType)) {
+ return (T) new GdbDisconnectCommand(session);
}
- if (IModelSelectionPolicyFactory.class.equals(adapterType)) {
- return (T)new DefaultDsfModelSelectionPolicyFactory();
+ if (IModelSelectionPolicyFactory.class.equals(adapterType)) {
+ return (T) new DefaultDsfModelSelectionPolicyFactory();
}
- if (IRefreshAllTarget.class.equals(adapterType)) {
- return (T)new DefaultRefreshAllTarget();
+ if (IRefreshAllTarget.class.equals(adapterType)) {
+ return (T) new DefaultRefreshAllTarget();
}
if (IReverseToggleHandler.class.equals(adapterType)) {
- return (T)new GdbReverseToggleCommand(session);
+ return (T) new GdbReverseToggleCommand(session);
}
- if (IStartTracingHandler.class.equals(adapterType)) {
- return (T)new GdbStartTracingCommand(session);
+ if (IStartTracingHandler.class.equals(adapterType)) {
+ return (T) new GdbStartTracingCommand(session);
}
if (IStopTracingHandler.class.equals(adapterType)) {
- return (T)new GdbStopTracingCommand(session);
+ return (T) new GdbStopTracingCommand(session);
}
- if (ISaveTraceDataHandler.class.equals(adapterType)) {
- return (T)new GdbSaveTraceDataCommand(session);
+ if (ISaveTraceDataHandler.class.equals(adapterType)) {
+ return (T) new GdbSaveTraceDataCommand(session);
}
- if (ISelectNextTraceRecordHandler.class.equals(adapterType)) {
- return (T)new GdbSelectNextTraceRecordCommand(session);
+ if (ISelectNextTraceRecordHandler.class.equals(adapterType)) {
+ return (T) new GdbSelectNextTraceRecordCommand(session);
}
- if (ISelectPrevTraceRecordHandler.class.equals(adapterType)) {
- return (T)new GdbSelectPrevTraceRecordCommand(session);
+ if (ISelectPrevTraceRecordHandler.class.equals(adapterType)) {
+ return (T) new GdbSelectPrevTraceRecordCommand(session);
}
- if (IPinProvider.class.equals(adapterType)) {
- return (T)new GdbPinProvider(session);
+ if (IPinProvider.class.equals(adapterType)) {
+ return (T) new GdbPinProvider(session);
}
if (IDebugModelProvider.class.equals(adapterType)) {
- return (T)new IDebugModelProvider() {
- // @see org.eclipse.debug.core.model.IDebugModelProvider#getModelIdentifiers()
- @Override
- public String[] getModelIdentifiers() {
- return new String[] {
- GdbLaunchDelegate.GDB_DEBUG_MODEL_ID,
- ICBreakpoint.C_BREAKPOINTS_DEBUG_MODEL_ID,
- "org.eclipse.cdt.gdb" //$NON-NLS-1$
- };
- }
+ return (T) new IDebugModelProvider() {
+ // @see org.eclipse.debug.core.model.IDebugModelProvider#getModelIdentifiers()
+ @Override
+ public String[] getModelIdentifiers() {
+ return new String[] { GdbLaunchDelegate.GDB_DEBUG_MODEL_ID,
+ ICBreakpoint.C_BREAKPOINTS_DEBUG_MODEL_ID, "org.eclipse.cdt.gdb" //$NON-NLS-1$
+ };
+ }
};
}
@@ -360,83 +331,80 @@ public class GdbSessionAdapters {
* session.
*/
if (ILaunch.class.equals(adapterType)) {
- return (T)launch;
+ return (T) launch;
}
/*
* Register debug hover adapter (bug 309001).
*/
if (ICEditorTextHover.class.equals(adapterType)) {
- return (T)new GdbDebugTextHover();
+ return (T) new GdbDebugTextHover();
}
if (IMemoryBlockAddressInfoRetrieval.class.equals(adapterType)) {
return (T) new GdbMemoryBlockAddressInfoRetrieval(session);
}
- return null;
- }
+ return null;
+ }
- /**
- * Returns the method that will be called to dispose the given object.
- *
- * @param adapter the object to dispose
- * @return "dispose()" method or null if the given object doesn't have "dispose()" method
- *
- * Clients can override this method to provide dispose methods different than "dispose()"
- * for specific adapters.
- */
- protected Method getDisposeMethod(Object adapter) {
- if (adapter != null) {
+ /**
+ * Returns the method that will be called to dispose the given object.
+ *
+ * @param adapter the object to dispose
+ * @return "dispose()" method or null if the given object doesn't have "dispose()" method
+ *
+ * Clients can override this method to provide dispose methods different than "dispose()"
+ * for specific adapters.
+ */
+ protected Method getDisposeMethod(Object adapter) {
+ if (adapter != null) {
try {
return adapter.getClass().getMethod("dispose"); //$NON-NLS-1$
- }
- catch(NoSuchMethodException | SecurityException e) {
+ } catch (NoSuchMethodException | SecurityException e) {
// ignore
}
- }
+ }
return null;
- }
+ }
+
+ protected DsfSession getSession() {
+ return fSession;
+ }
- protected DsfSession getSession() {
- return fSession;
- }
-
- protected ILaunch getLaunch() {
- return fLaunch;
- }
+ protected ILaunch getLaunch() {
+ return fLaunch;
+ }
- private void disposeAdapter(Object adapter) {
+ private void disposeAdapter(Object adapter) {
try {
Method dispose = getDisposeMethod(adapter);
if (dispose != null) {
dispose.invoke(adapter);
}
- }
- catch(SecurityException | IllegalAccessException | IllegalArgumentException e) {
+ } catch (SecurityException | IllegalAccessException | IllegalArgumentException e) {
// ignore
- }
- catch(InvocationTargetException e) {
+ } catch (InvocationTargetException e) {
GdbPlugin.log(e.getTargetException());
}
- }
-
- protected DsfSteppingModeTarget getSteppingModeTarget() {
- ISteppingModeTarget target = (ISteppingModeTarget)fSession.getModelAdapter(ISteppingModeTarget.class);
- if (target instanceof DsfSteppingModeTarget) {
- return (DsfSteppingModeTarget)target;
- }
- return null;
- }
+ }
+
+ protected DsfSteppingModeTarget getSteppingModeTarget() {
+ ISteppingModeTarget target = (ISteppingModeTarget) fSession.getModelAdapter(ISteppingModeTarget.class);
+ if (target instanceof DsfSteppingModeTarget) {
+ return (DsfSteppingModeTarget) target;
+ }
+ return null;
+ }
protected SteppingController getSteppingController() {
- return (SteppingController)fSession.getModelAdapter(SteppingController.class);
+ return (SteppingController) fSession.getModelAdapter(SteppingController.class);
}
protected IVMAdapter getViewModelAdapter() {
- IViewerInputProvider provider = (IViewerInputProvider)fSession.getModelAdapter(IViewerInputProvider.class);
+ IViewerInputProvider provider = (IViewerInputProvider) fSession.getModelAdapter(IViewerInputProvider.class);
if (provider instanceof IVMAdapter) {
- return (IVMAdapter)provider;
+ return (IVMAdapter) provider;
}
return null;
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbStatusHandler.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbStatusHandler.java
index 85029dc01b9..de5cd3c62a5 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbStatusHandler.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbStatusHandler.java
@@ -27,43 +27,42 @@ public class GdbStatusHandler implements IStatusHandler {
* @see org.eclipse.debug.core.IStatusHandler#handleStatus(org.eclipse.core.runtime.IStatus, java.lang.Object)
*/
@Override
- public Object handleStatus( final IStatus status, Object source ) throws CoreException {
+ public Object handleStatus(final IStatus status, Object source) throws CoreException {
Runnable runnable = null;
- if ( status.getSeverity() == IStatus.ERROR ) {
+ if (status.getSeverity() == IStatus.ERROR) {
runnable = new Runnable() {
-
+
@Override
public void run() {
Shell parent = GdbUIPlugin.getActiveWorkbenchShell();
- if ( parent != null )
- MessageDialog.openError( parent, Messages.GdbStatusHandler_Error, status.getMessage() );
+ if (parent != null)
+ MessageDialog.openError(parent, Messages.GdbStatusHandler_Error, status.getMessage());
}
};
- }
- else if ( status.getSeverity() == IStatus.WARNING ) {
+ } else if (status.getSeverity() == IStatus.WARNING) {
runnable = new Runnable() {
-
+
@Override
public void run() {
Shell parent = GdbUIPlugin.getActiveWorkbenchShell();
- if ( parent != null )
- MessageDialog.openWarning( parent, Messages.GdbStatusHandler_Warning, status.getMessage() );
+ if (parent != null)
+ MessageDialog.openWarning(parent, Messages.GdbStatusHandler_Warning, status.getMessage());
}
};
- }
- else if ( status.getSeverity() == IStatus.INFO ) {
+ } else if (status.getSeverity() == IStatus.INFO) {
runnable = new Runnable() {
-
+
@Override
public void run() {
Shell parent = GdbUIPlugin.getActiveWorkbenchShell();
- if ( parent != null )
- MessageDialog.openInformation( parent, Messages.GdbStatusHandler_Information, status.getMessage() );
+ if (parent != null)
+ MessageDialog.openInformation(parent, Messages.GdbStatusHandler_Information,
+ status.getMessage());
}
};
}
- if ( runnable != null )
- Display.getDefault().asyncExec( runnable );
+ if (runnable != null)
+ Display.getDefault().asyncExec(runnable);
return null;
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbSuspendTrigger.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbSuspendTrigger.java
index 072fc4c4465..20ae5786cd0 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbSuspendTrigger.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbSuspendTrigger.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -33,53 +33,55 @@ import org.eclipse.debug.core.ILaunch;
* @since 2.1
*/
public class GdbSuspendTrigger extends DsfSuspendTrigger {
-
- public GdbSuspendTrigger(DsfSession session, ILaunch launch) {
- super(session, launch);
- }
-
- @Override
- protected void getLaunchTopContainers(final DataRequestMonitor<IContainerDMContext[]> rm) {
- try {
- getSession().getExecutor().execute(new DsfRunnable() {
- @Override
+
+ public GdbSuspendTrigger(DsfSession session, ILaunch launch) {
+ super(session, launch);
+ }
+
+ @Override
+ protected void getLaunchTopContainers(final DataRequestMonitor<IContainerDMContext[]> rm) {
+ try {
+ getSession().getExecutor().execute(new DsfRunnable() {
+ @Override
public void run() {
- IProcesses processService = getServicesTracker().getService(IProcesses.class);
- ICommandControlService controlService = getServicesTracker().getService(ICommandControlService.class);
- if (processService == null || controlService == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE, "Not available", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
+ IProcesses processService = getServicesTracker().getService(IProcesses.class);
+ ICommandControlService controlService = getServicesTracker()
+ .getService(ICommandControlService.class);
+ if (processService == null || controlService == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE,
+ "Not available", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ processService.getProcessesBeingDebugged(controlService.getContext(),
+ new ImmediateDataRequestMonitor<IDMContext[]>(rm) {
+ @Override
+ public void handleSuccess() {
+ IContainerDMContext[] containers = new IContainerDMContext[getData().length];
+ for (int i = 0; i < containers.length; i++) {
+ if (getData()[i] instanceof IContainerDMContext) {
+ containers[i] = (IContainerDMContext) getData()[i];
+ } else {
+ // By convention the processes should be containers, but the API
+ // does not enforce this.
+ assert false;
+ rm.setData(new IContainerDMContext[0]);
+ rm.done();
+ return;
+ }
- processService.getProcessesBeingDebugged(
- controlService.getContext(),
- new ImmediateDataRequestMonitor<IDMContext[]>(rm) {
- @Override
- public void handleSuccess() {
- IContainerDMContext[] containers = new IContainerDMContext[getData().length];
- for (int i = 0; i < containers.length; i++) {
- if (getData()[i] instanceof IContainerDMContext) {
- containers[i] = (IContainerDMContext)getData()[i];
- } else {
- // By convention the processes should be containers, but the API
- // does not enforce this.
- assert false;
- rm.setData(new IContainerDMContext[0]);
- rm.done();
- return;
- }
-
- }
- rm.setData(containers);
- rm.done();
- }
- });
- }
- });
- } catch (RejectedExecutionException e) {
- rm.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE, "Not available", e)); //$NON-NLS-1$
- rm.done();
- }
- }
+ }
+ rm.setData(containers);
+ rm.done();
+ }
+ });
+ }
+ });
+ } catch (RejectedExecutionException e) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE,
+ "Not available", e)); //$NON-NLS-1$
+ rm.done();
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbUIPlugin.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbUIPlugin.java
index 95e9d2a2f91..b9603b93f59 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbUIPlugin.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbUIPlugin.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* Ericsson - modified to remove dependency on cdt.launch
@@ -47,16 +47,16 @@ public class GdbUIPlugin extends AbstractUIPlugin {
// The shared instance
private static GdbUIPlugin plugin;
-
- private static BundleContext fgBundleContext;
- private static TracingConsoleManager fTracingConsoleManager;
- private static GdbCliConsoleManager fGdbConsoleManager;
+ private static BundleContext fgBundleContext;
+
+ private static TracingConsoleManager fTracingConsoleManager;
+ private static GdbCliConsoleManager fGdbConsoleManager;
+
+ private static GdbDebugContextSyncManager fGdbSelectionSyncManager;
+
+ private static IPreferenceStore fCorePreferenceStore;
- private static GdbDebugContextSyncManager fGdbSelectionSyncManager;
-
- private static IPreferenceStore fCorePreferenceStore;
-
/**
* The constructor
*/
@@ -68,17 +68,17 @@ public class GdbUIPlugin extends AbstractUIPlugin {
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
@Override
- public void start(BundleContext context) throws Exception {
- fgBundleContext = context;
+ public void start(BundleContext context) throws Exception {
+ fgBundleContext = context;
super.start(context);
plugin = this;
-
+
fTracingConsoleManager = new TracingConsoleManager();
fTracingConsoleManager.startup();
-
+
fGdbConsoleManager = new GdbCliConsoleManager();
fGdbConsoleManager.startup();
-
+
fGdbSelectionSyncManager = new GdbDebugContextSyncManager();
fGdbSelectionSyncManager.startup();
}
@@ -88,7 +88,7 @@ public class GdbUIPlugin extends AbstractUIPlugin {
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
@Override
- public void stop(BundleContext context) throws Exception {
+ public void stop(BundleContext context) throws Exception {
fTracingConsoleManager.shutdown();
fGdbConsoleManager.shutdown();
fGdbSelectionSyncManager.shutdown();
@@ -96,13 +96,13 @@ public class GdbUIPlugin extends AbstractUIPlugin {
disposeAdapterSets();
plugin = null;
super.stop(context);
- fgBundleContext = null;
+ fgBundleContext = null;
}
public static GdbCliConsoleManager getCliConsoleManager() {
return fGdbConsoleManager;
}
-
+
public static GdbDebugContextSyncManager getGdbSelectionSyncManager() {
return fGdbSelectionSyncManager;
}
@@ -111,11 +111,11 @@ public class GdbUIPlugin extends AbstractUIPlugin {
* Dispose adapter sets for all launches.
*/
private void disposeAdapterSets() {
- for (ILaunch launch : DebugPlugin.getDefault().getLaunchManager().getLaunches()) {
- if (launch instanceof GdbLaunch) {
- GdbAdapterFactory.disposeAdapterSet(launch);
- }
- }
+ for (ILaunch launch : DebugPlugin.getDefault().getLaunchManager().getLaunches()) {
+ if (launch instanceof GdbLaunch) {
+ GdbAdapterFactory.disposeAdapterSet(launch);
+ }
+ }
}
/**
@@ -127,25 +127,25 @@ public class GdbUIPlugin extends AbstractUIPlugin {
return plugin;
}
- public static BundleContext getBundleContext() {
- return fgBundleContext;
- }
-
+ public static BundleContext getBundleContext() {
+ return fgBundleContext;
+ }
+
/**
* Returns the preference store for this UI plug-in.
* It actually uses the preference store of the core plug-in.
*/
- @Override
+ @Override
public IPreferenceStore getPreferenceStore() {
if (fCorePreferenceStore == null) {
fCorePreferenceStore = new ScopedPreferenceStore(InstanceScope.INSTANCE, GdbPlugin.PLUGIN_ID);
}
return fCorePreferenceStore;
}
-
- /**
- * copied from org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin
- */
+
+ /**
+ * copied from org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin
+ */
private static Shell debugDialogShell;
public static Shell getShell() {
@@ -180,16 +180,17 @@ public class GdbUIPlugin extends AbstractUIPlugin {
/**
* Logs the specified status with this plug-in's log.
- *
+ *
* @param status
* status to log
*/
public static void log(IStatus status) {
getDefault().getLog().log(status);
}
+
/**
* Logs an internal error with the specified message.
- *
+ *
* @param message
* the error message to log
*/
@@ -199,7 +200,7 @@ public class GdbUIPlugin extends AbstractUIPlugin {
/**
* Logs an internal error with the specified throwable
- *
+ *
* @param e
* the exception to be logged
*/
@@ -209,7 +210,7 @@ public class GdbUIPlugin extends AbstractUIPlugin {
/**
* Returns the active workbench window
- *
+ *
* @return the active workbench window
*/
public static IWorkbenchWindow getActiveWorkbenchWindow() {
@@ -226,7 +227,7 @@ public class GdbUIPlugin extends AbstractUIPlugin {
/**
* Returns the active workbench shell or <code>null</code> if none
- *
+ *
* @return the active workbench shell or <code>null</code> if none
*/
public static Shell getActiveWorkbenchShell() {
@@ -254,32 +255,32 @@ public class GdbUIPlugin extends AbstractUIPlugin {
}
}
- /* (non-Javadoc)
+ /* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#initializeImageRegistry(org.eclipse.jface.resource.ImageRegistry)
*/
@Override
- protected void initializeImageRegistry( ImageRegistry reg ) {
- super.initializeImageRegistry( reg );
- declareImages( reg );
+ protected void initializeImageRegistry(ImageRegistry reg) {
+ super.initializeImageRegistry(reg);
+ declareImages(reg);
}
/**
- * Returns an image descriptor for the image file at the given
- * plug-in relative path
- *
- * @param path the path
- * @return the image descriptor
- */
- public static ImageDescriptor getImageDescriptor(String path) {
- return imageDescriptorFromPlugin(PLUGIN_ID, path);
- }
-
- public static Image getImage( String key ) {
- return getDefault().getImageRegistry().get( key );
- }
-
- private void declareImages( ImageRegistry reg ) {
- reg.put( IGdbUIConstants.IMG_WIZBAN_ADVANCED_TIMEOUT_SETTINGS,
- getImageDescriptor( "icons/full/wizban/advtosettings_wiz.png" ) ); //$NON-NLS-1$
- }
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+
+ public static Image getImage(String key) {
+ return getDefault().getImageRegistry().get(key);
+ }
+
+ private void declareImages(ImageRegistry reg) {
+ reg.put(IGdbUIConstants.IMG_WIZBAN_ADVANCED_TIMEOUT_SETTINGS,
+ getImageDescriptor("icons/full/wizban/advtosettings_wiz.png")); //$NON-NLS-1$
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/IGdbUIConstants.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/IGdbUIConstants.java
index 4a9dc9c4746..8a082297c7b 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/IGdbUIConstants.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/IGdbUIConstants.java
@@ -16,7 +16,7 @@ package org.eclipse.cdt.dsf.gdb.internal.ui;
/**
* @noimplement This interface is not intended to be implemented by clients.
- *
+ *
* @since 4.1
*/
public interface IGdbUIConstants {
@@ -24,8 +24,8 @@ public interface IGdbUIConstants {
/**
* Plug-in identifier (value <code>"org.eclipse.cdt.dsf.gdb.ui"</code>).
*/
- public static final String PLUGIN_ID = GdbUIPlugin.PLUGIN_ID;
-
+ public static final String PLUGIN_ID = GdbUIPlugin.PLUGIN_ID;
+
/** image identifier. */
public static final String IMG_WIZBAN_ADVANCED_TIMEOUT_SETTINGS = PLUGIN_ID + ".imageAdvancedTimeoutSettings"; //$NON-NLS-1$
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/Messages.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/Messages.java
index 06ca62e109b..05690ef5b55 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/Messages.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/Messages.java
@@ -24,7 +24,7 @@ public class Messages extends NLS {
public static String GdbStatusHandler_Warning;
static {
// initialize resource bundle
- NLS.initializeMessages( Messages.class.getName(), Messages.class );
+ NLS.initializeMessages(Messages.class.getName(), Messages.class);
}
private Messages() {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/DsfLoadSymbolsCommandHandler.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/DsfLoadSymbolsCommandHandler.java
index 5a1fc270854..a078446cefd 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/DsfLoadSymbolsCommandHandler.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/DsfLoadSymbolsCommandHandler.java
@@ -46,7 +46,9 @@ public class DsfLoadSymbolsCommandHandler extends AbstractHandler {
@Override
public Object execute(final ExecutionEvent event) {
final ISelection iselection = HandlerUtil.getCurrentSelection(event);
- final IStructuredSelection selection = (iselection instanceof IStructuredSelection) ? (IStructuredSelection) iselection : null;
+ final IStructuredSelection selection = (iselection instanceof IStructuredSelection)
+ ? (IStructuredSelection) iselection
+ : null;
boolean all = event.getCommand().getId().equals("org.eclipse.cdt.debug.ui.command.loadAllSymbols");//$NON-NLS-1$
String sessionId = getSessionIdFromContext(selection);
loadSymbols(selection, sessionId, all);
@@ -86,7 +88,7 @@ public class DsfLoadSymbolsCommandHandler extends AbstractHandler {
try {
IModules2 modules = tracker.getService(IModules2.class);
if (modules != null) {
- modules.loadSymbols((IModuleDMContext)context, new RequestMonitor(session.getExecutor(), null) {
+ modules.loadSymbols((IModuleDMContext) context, new RequestMonitor(session.getExecutor(), null) {
@Override
protected void handleSuccess() {
doRefresh(session, module);
@@ -124,15 +126,15 @@ public class DsfLoadSymbolsCommandHandler extends AbstractHandler {
/**
* Refresh all VMProviders applying to element, as they could each need to change due to the new symbols.
- *
- * @param element The element used to establish which VMProviders should refresh
+ *
+ * @param element The element used to establish which VMProviders should refresh
*/
private void doRefresh(DsfSession session, Object element) {
if (element != null) {
try {
- IRefreshAllTarget refreshTarget = (IRefreshAllTarget)session.getModelAdapter(IRefreshAllTarget.class);
+ IRefreshAllTarget refreshTarget = (IRefreshAllTarget) session.getModelAdapter(IRefreshAllTarget.class);
if (refreshTarget != null) {
- refreshTarget.refresh(new StructuredSelection(element));
+ refreshTarget.refresh(new StructuredSelection(element));
}
} catch (CoreException e) {
// refresh failed, sad
@@ -150,7 +152,7 @@ public class DsfLoadSymbolsCommandHandler extends AbstractHandler {
if (sessionId != null)
return sessionId;
}
-
+
IAdaptable debugContext = DebugUITools.getDebugContext();
String sessionId = null;
if (debugContext instanceof IDMVMContext) {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/DsfTerminateCommand.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/DsfTerminateCommand.java
index 50b612a0963..8f83bac2471 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/DsfTerminateCommand.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/DsfTerminateCommand.java
@@ -7,10 +7,10 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
- * Nokia - create and use backend service.
+ * Nokia - create and use backend service.
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.actions;
@@ -48,153 +48,147 @@ import org.eclipse.debug.core.model.IProcess;
public class DsfTerminateCommand implements ITerminateHandler {
private final DsfSession fSession;
private final DsfExecutor fExecutor;
- private final DsfServicesTracker fTracker;
-
- public DsfTerminateCommand(DsfSession session) {
- fSession = session;
- fExecutor = session.getExecutor();
- fTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
- }
+ private final DsfServicesTracker fTracker;
+
+ public DsfTerminateCommand(DsfSession session) {
+ fSession = session;
+ fExecutor = session.getExecutor();
+ fTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
+ }
- public void dispose() {
- fTracker.dispose();
- }
+ public void dispose() {
+ fTracker.dispose();
+ }
- @Override
- public void canExecute(final IEnabledStateRequest request) {
- if (request.getElements().length == 0) {
- request.setEnabled(false);
- request.done();
- return;
- }
+ @Override
+ public void canExecute(final IEnabledStateRequest request) {
+ if (request.getElements().length == 0) {
+ request.setEnabled(false);
+ request.done();
+ return;
+ }
- final GdbLaunch launch = getLaunch(request);
- if (launch != null) {
- fExecutor.execute(new DsfRunnable() {
+ final GdbLaunch launch = getLaunch(request);
+ if (launch != null) {
+ fExecutor.execute(new DsfRunnable() {
@Override
public void run() {
- request.setEnabled(false);
- IGDBControl gdbControl = fTracker.getService(IGDBControl.class);
- if (gdbControl != null && gdbControl.isActive()) {
- request.setEnabled(true);
- }
- else {
- // The GDB session may be terminated at this moment but if there
- // are processes in this launch that are not controlled by GDB
- // we need to check them as well.
- for (IProcess p : launch.getProcesses()) {
- if (p.canTerminate()) {
- request.setEnabled(true);
- break;
- }
- }
- }
- request.done();
+ request.setEnabled(false);
+ IGDBControl gdbControl = fTracker.getService(IGDBControl.class);
+ if (gdbControl != null && gdbControl.isActive()) {
+ request.setEnabled(true);
+ } else {
+ // The GDB session may be terminated at this moment but if there
+ // are processes in this launch that are not controlled by GDB
+ // we need to check them as well.
+ for (IProcess p : launch.getProcesses()) {
+ if (p.canTerminate()) {
+ request.setEnabled(true);
+ break;
+ }
+ }
+ }
+ request.done();
}
});
- }
- else {
- fExecutor.execute(new DsfRunnable() {
+ } else {
+ fExecutor.execute(new DsfRunnable() {
@Override
public void run() {
- IProcessDMContext[] procDmcs = getProcessDMContexts(request.getElements());
+ IProcessDMContext[] procDmcs = getProcessDMContexts(request.getElements());
canTerminate(procDmcs, new DataRequestMonitor<Boolean>(fExecutor, null) {
@Override
protected void handleCompleted() {
- if (!isSuccess()) {
- request.setEnabled(false);
- }
- else {
- request.setEnabled(getData());
- }
- request.done();
+ if (!isSuccess()) {
+ request.setEnabled(false);
+ } else {
+ request.setEnabled(getData());
+ }
+ request.done();
}
});
}
});
- }
- }
+ }
+ }
- @Override
- public boolean execute(final IDebugCommandRequest request) {
- if (request.getElements().length == 0) {
- request.done();
- return false;
- }
+ @Override
+ public boolean execute(final IDebugCommandRequest request) {
+ if (request.getElements().length == 0) {
+ request.done();
+ return false;
+ }
- final GdbLaunch launch = getLaunch(request);
- if (launch != null) {
- fExecutor.execute(new DsfRunnable() {
+ final GdbLaunch launch = getLaunch(request);
+ if (launch != null) {
+ fExecutor.execute(new DsfRunnable() {
@Override
public void run() {
- IGDBControl gdbControl = fTracker.getService(IGDBControl.class);
- if (gdbControl != null && gdbControl.isActive()) {
- gdbControl.terminate(new RequestMonitor(fExecutor, null) {
- @Override
+ IGDBControl gdbControl = fTracker.getService(IGDBControl.class);
+ if (gdbControl != null && gdbControl.isActive()) {
+ gdbControl.terminate(new RequestMonitor(fExecutor, null) {
+ @Override
protected void handleCompleted() {
- if (!isSuccess()) {
- request.setStatus(getStatus());
- request.done();
- }
- else {
- waitForTermination(request);
- }
- }
- });
- }
- else {
- terminateRemainingProcesses(launch, request);
- }
+ if (!isSuccess()) {
+ request.setStatus(getStatus());
+ request.done();
+ } else {
+ waitForTermination(request);
+ }
+ }
+ });
+ } else {
+ terminateRemainingProcesses(launch, request);
+ }
}
});
- }
- else {
- fExecutor.execute(new DsfRunnable() {
+ } else {
+ fExecutor.execute(new DsfRunnable() {
@Override
public void run() {
- IProcessDMContext[] procDmcs = getProcessDMContexts(request.getElements());
+ IProcessDMContext[] procDmcs = getProcessDMContexts(request.getElements());
terminate(procDmcs, new RequestMonitor(fExecutor, null) {
@Override
protected void handleCompleted() {
- if (!isSuccess()) {
- request.setStatus(getStatus());
- request.done();
- }
- else {
- waitForTermination(request);
- }
+ if (!isSuccess()) {
+ request.setStatus(getStatus());
+ request.done();
+ } else {
+ waitForTermination(request);
+ }
}
});
}
- });
- }
- return false;
- }
-
- /**
- * Wait for the debug session to be fully shutdown before reporting
- * that the terminate was completed. This is important for the
- * 'Terminate and remove' operation.
- * The wait time is limited with a timeout so as to eventually complete the
- * request in the case of termination error, or when terminating
- * a single process in a multi-process session.
- * See bug 377447
- */
- private void waitForTermination(final IDebugCommandRequest request) {
- class ScheduledFutureWrapper {
- ScheduledFuture<?> fFuture;
- };
-
- final ScheduledFutureWrapper fFutureWrapper = new ScheduledFutureWrapper();
-
- // It is possible that the session already had time to terminate
+ });
+ }
+ return false;
+ }
+
+ /**
+ * Wait for the debug session to be fully shutdown before reporting
+ * that the terminate was completed. This is important for the
+ * 'Terminate and remove' operation.
+ * The wait time is limited with a timeout so as to eventually complete the
+ * request in the case of termination error, or when terminating
+ * a single process in a multi-process session.
+ * See bug 377447
+ */
+ private void waitForTermination(final IDebugCommandRequest request) {
+ class ScheduledFutureWrapper {
+ ScheduledFuture<?> fFuture;
+ }
+ ;
+
+ final ScheduledFutureWrapper fFutureWrapper = new ScheduledFutureWrapper();
+
+ // It is possible that the session already had time to terminate
if (!DsfSession.isSessionActive(fSession.getId())) {
request.done();
return;
}
// Listener that will indicate when the shutdown is complete
- final SessionEndedListener endedListener = new SessionEndedListener () {
+ final SessionEndedListener endedListener = new SessionEndedListener() {
@Override
public void sessionEnded(DsfSession session) {
if (fSession.equals(session)) {
@@ -204,15 +198,14 @@ public class DsfTerminateCommand implements ITerminateHandler {
GdbLaunch launch = getLaunch(request);
if (launch != null) {
terminateRemainingProcesses(launch, request);
- }
- else {
+ } else {
request.done();
}
}
}
};
- DsfSession.addSessionEndedListener(endedListener);
+ DsfSession.addSessionEndedListener(endedListener);
// Create the timeout
// For a multi-process session, if a single process is
@@ -220,7 +213,7 @@ public class DsfTerminateCommand implements ITerminateHandler {
// session is also terminated before the timeout).
// We haven't found a problem with delaying the completion
// of the request that way.
- fFutureWrapper.fFuture = fExecutor.schedule(new Runnable() {
+ fFutureWrapper.fFuture = fExecutor.schedule(new Runnable() {
@Override
public void run() {
// Check that the session is still active when the timeout hits.
@@ -228,113 +221,106 @@ public class DsfTerminateCommand implements ITerminateHandler {
if (DsfSession.isSessionActive(fSession.getId())) {
DsfSession.removeSessionEndedListener(endedListener);
- // Marking the request as cancelled will prevent the removal of
+ // Marking the request as cancelled will prevent the removal of
// the launch from the Debug view in case of "Terminate and Remove".
// This is important for multi-process sessions when "Terminate and Remove"
// is applied to one of the running processes. In this case the selected
- // process will be terminated but the associated launch will not be removed
+ // process will be terminated but the associated launch will not be removed
// from the Debug view.
request.setStatus(Status.CANCEL_STATUS);
request.done();
}
- }},
- 1, TimeUnit.MINUTES);
- }
+ }
+ }, 1, TimeUnit.MINUTES);
+ }
- private IProcessDMContext[] getProcessDMContexts(Object[] elements) {
- final Set<IProcessDMContext> procDmcs = new HashSet<IProcessDMContext>();
- for (Object obj : elements) {
- if (obj instanceof IDMVMContext) {
- IProcessDMContext procDmc =
- DMContexts.getAncestorOfType(((IDMVMContext)obj).getDMContext(), IProcessDMContext.class);
+ private IProcessDMContext[] getProcessDMContexts(Object[] elements) {
+ final Set<IProcessDMContext> procDmcs = new HashSet<IProcessDMContext>();
+ for (Object obj : elements) {
+ if (obj instanceof IDMVMContext) {
+ IProcessDMContext procDmc = DMContexts.getAncestorOfType(((IDMVMContext) obj).getDMContext(),
+ IProcessDMContext.class);
if (procDmc != null) {
procDmcs.add(procDmc);
}
- }
- }
+ }
+ }
return procDmcs.toArray(new IProcessDMContext[procDmcs.size()]);
- }
+ }
- private void canTerminate(IProcessDMContext[] procDmcs, DataRequestMonitor<Boolean> rm) {
- if (procDmcs.length == 0) {
- IGDBControl gdbControl = fTracker.getService(IGDBControl.class);
- if (gdbControl != null) {
- rm.setData(gdbControl.isActive());
- }
- else {
- rm.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, "Service is not available.")); //$NON-NLS-1$
- }
- rm.done();
- return;
- }
-
- IMultiTerminate multiTerminate = fTracker.getService(IMultiTerminate.class);
- if (multiTerminate != null) {
- multiTerminate.canTerminateSome(procDmcs, rm);
+ private void canTerminate(IProcessDMContext[] procDmcs, DataRequestMonitor<Boolean> rm) {
+ if (procDmcs.length == 0) {
+ IGDBControl gdbControl = fTracker.getService(IGDBControl.class);
+ if (gdbControl != null) {
+ rm.setData(gdbControl.isActive());
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, "Service is not available.")); //$NON-NLS-1$
+ }
+ rm.done();
+ return;
}
- else {
+
+ IMultiTerminate multiTerminate = fTracker.getService(IMultiTerminate.class);
+ if (multiTerminate != null) {
+ multiTerminate.canTerminateSome(procDmcs, rm);
+ } else {
IProcesses procService = fTracker.getService(IProcesses.class);
if (procService != null && procDmcs.length == 1) {
procService.canTerminate(procDmcs[0], rm);
- }
- else {
+ } else {
rm.setData(false);
rm.done();
}
- }
- }
-
- private void terminate(IProcessDMContext[] procDmcs, RequestMonitor rm) {
- if (procDmcs.length == 0) {
- IGDBControl gdbControl = fTracker.getService(IGDBControl.class);
- if (gdbControl != null) {
- gdbControl.terminate(rm);
- }
- else {
- rm.done();
- }
- return;
- }
+ }
+ }
+
+ private void terminate(IProcessDMContext[] procDmcs, RequestMonitor rm) {
+ if (procDmcs.length == 0) {
+ IGDBControl gdbControl = fTracker.getService(IGDBControl.class);
+ if (gdbControl != null) {
+ gdbControl.terminate(rm);
+ } else {
+ rm.done();
+ }
+ return;
+ }
- IMultiTerminate multiTerminate = fTracker.getService(IMultiTerminate.class);
- if (multiTerminate != null) {
- multiTerminate.terminate(procDmcs, rm);
- }
- else {
- IProcesses procService = fTracker.getService(IProcesses.class);
- if (procService != null && procDmcs.length == 1) {
- procService.terminate(procDmcs[0], rm);
- }
- else {
- rm.done();
- }
- }
- }
-
- private GdbLaunch getLaunch(IDebugCommandRequest request) {
- for (Object el : request.getElements()) {
- if (el instanceof GdbLaunch) {
- return (GdbLaunch)el;
- }
- }
- return null;
- }
-
- private void terminateRemainingProcesses(final GdbLaunch launch, final IDebugCommandRequest request) {
- // Run this in a separate job since this method is called from
- // the executor thread. The job is scheduled with a delay to make
- // sure that MIInferiorProcess is terminated. See MIInferiorProcess.waitForSync()
- new Job("Terminate Job") { //$NON-NLS-1$
+ IMultiTerminate multiTerminate = fTracker.getService(IMultiTerminate.class);
+ if (multiTerminate != null) {
+ multiTerminate.terminate(procDmcs, rm);
+ } else {
+ IProcesses procService = fTracker.getService(IProcesses.class);
+ if (procService != null && procDmcs.length == 1) {
+ procService.terminate(procDmcs[0], rm);
+ } else {
+ rm.done();
+ }
+ }
+ }
+
+ private GdbLaunch getLaunch(IDebugCommandRequest request) {
+ for (Object el : request.getElements()) {
+ if (el instanceof GdbLaunch) {
+ return (GdbLaunch) el;
+ }
+ }
+ return null;
+ }
+
+ private void terminateRemainingProcesses(final GdbLaunch launch, final IDebugCommandRequest request) {
+ // Run this in a separate job since this method is called from
+ // the executor thread. The job is scheduled with a delay to make
+ // sure that MIInferiorProcess is terminated. See MIInferiorProcess.waitForSync()
+ new Job("Terminate Job") { //$NON-NLS-1$
@Override
protected IStatus run(IProgressMonitor monitor) {
- MultiStatus status =
- new MultiStatus(GdbUIPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, Messages.DsfTerminateCommand_Terminate_failed, null);
+ MultiStatus status = new MultiStatus(GdbUIPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED,
+ Messages.DsfTerminateCommand_Terminate_failed, null);
for (IProcess p : launch.getProcesses()) {
if (p.canTerminate()) {
try {
p.terminate();
- }
- catch(DebugException e) {
+ } catch (DebugException e) {
status.merge(e.getStatus());
}
}
@@ -346,5 +332,5 @@ public class DsfTerminateCommand implements ITerminateHandler {
return Status.OK_STATUS;
}
}.schedule(100);
- }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/FetchMoreChildrenAction.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/FetchMoreChildrenAction.java
index a70d7d0832c..134efbe8993 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/FetchMoreChildrenAction.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/FetchMoreChildrenAction.java
@@ -36,12 +36,11 @@ import org.eclipse.ui.IWorkbenchPart;
/**
* @since 3.0
*/
-public class FetchMoreChildrenAction extends AbstractVMProviderActionDelegate
- implements IObjectActionDelegate {
+public class FetchMoreChildrenAction extends AbstractVMProviderActionDelegate implements IObjectActionDelegate {
private ISelection selection;
-
- @Override
+
+ @Override
public void run(IAction action) {
IncompleteChildrenVMC incompleteChildrenVmc = getIncompleteChildrenVMC();
@@ -57,7 +56,7 @@ public class FetchMoreChildrenAction extends AbstractVMProviderActionDelegate
final FetchMoreChildrenEvent fetchMoreChildrenEvent = new FetchMoreChildrenEvent(exprCtx, path);
final AbstractVMProvider vmProvider = (AbstractVMProvider) getVMProvider();
vmProvider.getExecutor().execute(new DsfRunnable() {
- @Override
+ @Override
public void run() {
vmProvider.handleEvent(fetchMoreChildrenEvent);
}
@@ -66,19 +65,19 @@ public class FetchMoreChildrenAction extends AbstractVMProviderActionDelegate
}
}
- @Override
- public void init(IViewPart view) {
- super.init(view);
+ @Override
+ public void init(IViewPart view) {
+ super.init(view);
updateEnablement();
- }
-
- @Override
- public void debugContextChanged(DebugContextEvent event) {
- super.debugContextChanged(event);
+ }
+
+ @Override
+ public void debugContextChanged(DebugContextEvent event) {
+ super.debugContextChanged(event);
updateEnablement();
- }
+ }
- @Override
+ @Override
public void selectionChanged(IAction action, ISelection selection) {
super.selectionChanged(action, selection);
this.selection = selection;
@@ -94,17 +93,17 @@ public class FetchMoreChildrenAction extends AbstractVMProviderActionDelegate
getAction().setEnabled(enabled);
}
- @Override
+ @Override
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
if (targetPart instanceof IViewPart) {
init((IViewPart) targetPart);
}
}
-
+
private IncompleteChildrenVMC getIncompleteChildrenVMC() {
if (selection instanceof IStructuredSelection) {
IStructuredSelection ss = (IStructuredSelection) selection;
-
+
if (ss.size() == 1) {
// Only single selection is supported.
Object selectedObject = ss.getFirstElement();
@@ -113,7 +112,7 @@ public class FetchMoreChildrenAction extends AbstractVMProviderActionDelegate
}
}
}
-
+
return null;
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbDisconnectCommand.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbDisconnectCommand.java
index e14ed0742eb..1f8ced9e17f 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbDisconnectCommand.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbDisconnectCommand.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
@@ -45,114 +45,111 @@ import org.eclipse.debug.core.commands.IEnabledStateRequest;
public class GdbDisconnectCommand implements IDisconnectHandler {
private final DsfSession fSession;
private final DsfExecutor fExecutor;
- private final DsfServicesTracker fTracker;
+ private final DsfServicesTracker fTracker;
public GdbDisconnectCommand(DsfSession session) {
super();
fSession = session;
fExecutor = session.getExecutor();
- fTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
+ fTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
}
- public void dispose() {
- fTracker.dispose();
- }
+ public void dispose() {
+ fTracker.dispose();
+ }
@Override
public void canExecute(final IEnabledStateRequest request) {
- if (request.getElements().length == 0) {
- request.setEnabled(false);
- request.done();
- return;
- }
+ if (request.getElements().length == 0) {
+ request.setEnabled(false);
+ request.done();
+ return;
+ }
- getContainerDMContexts(request.getElements(), new DataRequestMonitor<IContainerDMContext[]>(fExecutor, null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- request.setEnabled(false);
- request.done();
- }
- else {
- canDisconnect(getData(), new ImmediateDataRequestMonitor<Boolean>() {
- @Override
+ getContainerDMContexts(request.getElements(), new DataRequestMonitor<IContainerDMContext[]>(fExecutor, null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ request.setEnabled(false);
+ request.done();
+ } else {
+ canDisconnect(getData(), new ImmediateDataRequestMonitor<Boolean>() {
+ @Override
protected void handleCompleted() {
- if (!isSuccess()) {
- request.setEnabled(false);
- }
- else {
- request.setEnabled(getData());;
- }
- request.done();
- }
- });
- }
- }
- });
+ if (!isSuccess()) {
+ request.setEnabled(false);
+ } else {
+ request.setEnabled(getData());
+ ;
+ }
+ request.done();
+ }
+ });
+ }
+ }
+ });
}
@Override
public boolean execute(final IDebugCommandRequest request) {
- if (request.getElements().length == 0) {
- request.done();
- return false;
- }
-
- getContainerDMContexts(request.getElements(), new DataRequestMonitor<IContainerDMContext[]>(fExecutor, null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- request.setStatus(getStatus());
- request.done();
- }
- else {
- disconnect(getData(), new ImmediateRequestMonitor() {
- @Override
+ if (request.getElements().length == 0) {
+ request.done();
+ return false;
+ }
+
+ getContainerDMContexts(request.getElements(), new DataRequestMonitor<IContainerDMContext[]>(fExecutor, null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ request.setStatus(getStatus());
+ request.done();
+ } else {
+ disconnect(getData(), new ImmediateRequestMonitor() {
+ @Override
protected void handleCompleted() {
- if (!isSuccess()) {
- request.setStatus(getStatus());
- request.done();
- }
- else {
- waitForTermination(request);
- }
- }
- });
- }
- }
- });
-
- return false;
+ if (!isSuccess()) {
+ request.setStatus(getStatus());
+ request.done();
+ } else {
+ waitForTermination(request);
+ }
+ }
+ });
+ }
+ }
+ });
+
+ return false;
}
-
- /**
- * Wait for the debug session to be fully shutdown before reporting
- * that the terminate was completed. This is important for the
- * 'Terminate and remove' operation.
- * The wait time is limited with a timeout so as to eventually complete the
- * request in the case of termination error, or when terminating
- * a single process in a multi-process session.
- * See bug 377447
- */
- private void waitForTermination(final IDebugCommandRequest request) {
- // It is possible that the session already had time to terminate
+
+ /**
+ * Wait for the debug session to be fully shutdown before reporting
+ * that the terminate was completed. This is important for the
+ * 'Terminate and remove' operation.
+ * The wait time is limited with a timeout so as to eventually complete the
+ * request in the case of termination error, or when terminating
+ * a single process in a multi-process session.
+ * See bug 377447
+ */
+ private void waitForTermination(final IDebugCommandRequest request) {
+ // It is possible that the session already had time to terminate
if (!DsfSession.isSessionActive(fSession.getId())) {
request.done();
return;
}
// Listener that will indicate when the shutdown is complete
- final SessionEndedListener endedListener = new SessionEndedListener () {
+ final SessionEndedListener endedListener = new SessionEndedListener() {
@Override
public void sessionEnded(DsfSession session) {
if (fSession.equals(session)) {
DsfSession.removeSessionEndedListener(this);
- request.done();
+ request.done();
}
}
};
- DsfSession.addSessionEndedListener(endedListener);
+ DsfSession.addSessionEndedListener(endedListener);
// Create the timeout
// For a multi-process session, if a single process is
@@ -164,7 +161,7 @@ public class GdbDisconnectCommand implements IDisconnectHandler {
// need it anymore, once the session has terminated;
// instead, we let it timeout and ignore it if the session
// is already terminated.
- fExecutor.schedule(new Runnable() {
+ fExecutor.schedule(new Runnable() {
@Override
public void run() {
// Check that the session is still active when the timeout hits.
@@ -172,122 +169,115 @@ public class GdbDisconnectCommand implements IDisconnectHandler {
if (DsfSession.isSessionActive(fSession.getId())) {
DsfSession.removeSessionEndedListener(endedListener);
- // Marking the request as cancelled will prevent the removal of
+ // Marking the request as cancelled will prevent the removal of
// the launch from the Debug view in case of "Terminate and Remove".
// This is important for multi-process sessions when "Terminate and Remove"
// is applied to one of the running processes. In this case the selected
- // process will be terminated but the associated launch will not be removed
+ // process will be terminated but the associated launch will not be removed
// from the Debug view.
request.setStatus(Status.CANCEL_STATUS);
request.done();
}
- }},
- 1, TimeUnit.MINUTES);
- }
+ }
+ }, 1, TimeUnit.MINUTES);
+ }
- private void getContainerDMContexts(Object[] elements, final DataRequestMonitor<IContainerDMContext[]> rm) {
- GdbLaunch launch = null;
- final Set<IContainerDMContext> contDmcs = new HashSet<IContainerDMContext>();
- for (Object obj : elements) {
- if (obj instanceof GdbLaunch) {
- launch = (GdbLaunch)obj;
- break;
- }
- if (obj instanceof IDMVMContext) {
- IContainerDMContext contDmc =
- DMContexts.getAncestorOfType(((IDMVMContext)obj).getDMContext(), IContainerDMContext.class);
+ private void getContainerDMContexts(Object[] elements, final DataRequestMonitor<IContainerDMContext[]> rm) {
+ GdbLaunch launch = null;
+ final Set<IContainerDMContext> contDmcs = new HashSet<IContainerDMContext>();
+ for (Object obj : elements) {
+ if (obj instanceof GdbLaunch) {
+ launch = (GdbLaunch) obj;
+ break;
+ }
+ if (obj instanceof IDMVMContext) {
+ IContainerDMContext contDmc = DMContexts.getAncestorOfType(((IDMVMContext) obj).getDMContext(),
+ IContainerDMContext.class);
if (contDmc != null) {
contDmcs.add(contDmc);
}
- }
- }
- if (launch == null) {
- rm.setData(contDmcs.toArray(new IContainerDMContext[contDmcs.size()]));
- rm.done();
- }
- else {
- try {
- fExecutor.execute(new DsfRunnable() {
- @Override
- public void run() {
- ICommandControlService commandControl = fTracker.getService(ICommandControlService.class);
- final IProcesses procService = fTracker.getService(IProcesses.class);
- if (commandControl != null && procService != null) {
- procService.getProcessesBeingDebugged(
- commandControl.getContext(),
- new ImmediateDataRequestMonitor<IDMContext[]>() {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- rm.setStatus(getStatus());
- }
- else {
- for (IDMContext ctx : getData()) {
- IContainerDMContext contDmc = DMContexts.getAncestorOfType(ctx, IContainerDMContext.class);
- if (contDmc != null) {
- contDmcs.add(contDmc);
- }
- }
- rm.setData(contDmcs.toArray(new IContainerDMContext[contDmcs.size()]));
- }
- rm.done();
- };
- });
- }
- else {
- rm.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, "Service is not available.")); //$NON-NLS-1$
- rm.done();
- }
- }
- });
- } catch (RejectedExecutionException e) {
- rm.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, e.getLocalizedMessage()));
- rm.done();
- }
- }
- }
+ }
+ }
+ if (launch == null) {
+ rm.setData(contDmcs.toArray(new IContainerDMContext[contDmcs.size()]));
+ rm.done();
+ } else {
+ try {
+ fExecutor.execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ ICommandControlService commandControl = fTracker.getService(ICommandControlService.class);
+ final IProcesses procService = fTracker.getService(IProcesses.class);
+ if (commandControl != null && procService != null) {
+ procService.getProcessesBeingDebugged(commandControl.getContext(),
+ new ImmediateDataRequestMonitor<IDMContext[]>() {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ rm.setStatus(getStatus());
+ } else {
+ for (IDMContext ctx : getData()) {
+ IContainerDMContext contDmc = DMContexts.getAncestorOfType(ctx,
+ IContainerDMContext.class);
+ if (contDmc != null) {
+ contDmcs.add(contDmc);
+ }
+ }
+ rm.setData(contDmcs.toArray(new IContainerDMContext[contDmcs.size()]));
+ }
+ rm.done();
+ };
+ });
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, "Service is not available.")); //$NON-NLS-1$
+ rm.done();
+ }
+ }
+ });
+ } catch (RejectedExecutionException e) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, e.getLocalizedMessage()));
+ rm.done();
+ }
+ }
+ }
- private void canDisconnect(IContainerDMContext[] contDmcs, DataRequestMonitor<Boolean> rm) {
- if (contDmcs.length == 0) {
- rm.setData(false);
- rm.done();
- return;
- }
+ private void canDisconnect(IContainerDMContext[] contDmcs, DataRequestMonitor<Boolean> rm) {
+ if (contDmcs.length == 0) {
+ rm.setData(false);
+ rm.done();
+ return;
+ }
- IMultiDetach multiDetach = fTracker.getService(IMultiDetach.class);
+ IMultiDetach multiDetach = fTracker.getService(IMultiDetach.class);
if (multiDetach != null) {
- multiDetach.canDetachDebuggerFromSomeProcesses(contDmcs, rm);
- }
- else {
+ multiDetach.canDetachDebuggerFromSomeProcesses(contDmcs, rm);
+ } else {
IProcesses procService = fTracker.getService(IProcesses.class);
if (procService != null && contDmcs.length == 1) {
procService.canDetachDebuggerFromProcess(contDmcs[0], rm);
- }
- else {
+ } else {
rm.setData(false);
rm.done();
}
- }
- }
+ }
+ }
- private void disconnect(IContainerDMContext[] contDmcs, RequestMonitor rm) {
- if (contDmcs.length == 0) {
- rm.done();
- return;
- }
+ private void disconnect(IContainerDMContext[] contDmcs, RequestMonitor rm) {
+ if (contDmcs.length == 0) {
+ rm.done();
+ return;
+ }
- IMultiDetach multiDetach = fTracker.getService(IMultiDetach.class);
- if (multiDetach != null) {
- multiDetach.detachDebuggerFromProcesses(contDmcs, rm);
- }
- else {
- IProcesses procService = fTracker.getService(IProcesses.class);
- if (procService != null && contDmcs.length == 1) {
- procService.detachDebuggerFromProcess(contDmcs[0], rm);
- }
- else {
- rm.done();
- }
- }
- }
+ IMultiDetach multiDetach = fTracker.getService(IMultiDetach.class);
+ if (multiDetach != null) {
+ multiDetach.detachDebuggerFromProcesses(contDmcs, rm);
+ } else {
+ IProcesses procService = fTracker.getService(IProcesses.class);
+ if (procService != null && contDmcs.length == 1) {
+ procService.detachDebuggerFromProcess(contDmcs[0], rm);
+ } else {
+ rm.done();
+ }
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbRestartCommand.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbRestartCommand.java
index 85e89ed6791..60fa974eacf 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbRestartCommand.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbRestartCommand.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* Navid Mehregani (TI) - Bug 289526 - Migrate the Restart feature to the new one, as supported by the platform
@@ -34,91 +34,91 @@ import org.eclipse.debug.core.commands.IEnabledStateRequest;
import org.eclipse.debug.core.commands.IRestartHandler;
public class GdbRestartCommand implements IRestartHandler {
- private final DsfExecutor fExecutor;
- private final DsfServicesTracker fTracker;
- private final ILaunch fLaunch;
-
- public GdbRestartCommand(DsfSession session, ILaunch launch) {
- fExecutor = session.getExecutor();
- fLaunch = launch;
- fTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
- }
+ private final DsfExecutor fExecutor;
+ private final DsfServicesTracker fTracker;
+ private final ILaunch fLaunch;
+
+ public GdbRestartCommand(DsfSession session, ILaunch launch) {
+ fExecutor = session.getExecutor();
+ fLaunch = launch;
+ fTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
+ }
- public void dispose() {
- fTracker.dispose();
- }
+ public void dispose() {
+ fTracker.dispose();
+ }
- @Override
- public void canExecute(final IEnabledStateRequest request) {
- if (request.getElements().length != 1) {
- request.setEnabled(false);
- request.done();
- return;
- }
+ @Override
+ public void canExecute(final IEnabledStateRequest request) {
+ if (request.getElements().length != 1) {
+ request.setEnabled(false);
+ request.done();
+ return;
+ }
- fExecutor.submit(new DsfCommandRunnable(fTracker, request.getElements()[0], request) {
- @Override public void doExecute() {
- IContainerDMContext containerDmc = DMContexts.getAncestorOfType(getContext(), IContainerDMContext.class);
- IGDBProcesses procService = fTracker.getService(IGDBProcesses.class);
+ fExecutor.submit(new DsfCommandRunnable(fTracker, request.getElements()[0], request) {
+ @Override
+ public void doExecute() {
+ IContainerDMContext containerDmc = DMContexts.getAncestorOfType(getContext(),
+ IContainerDMContext.class);
+ IGDBProcesses procService = fTracker.getService(IGDBProcesses.class);
- if (procService != null) {
- procService.canRestart(
- containerDmc,
- new DataRequestMonitor<Boolean>(fExecutor, null) {
- @Override
- protected void handleCompleted() {
- request.setEnabled(isSuccess() && getData());
- request.done();
- }
- });
- } else {
- request.setEnabled(false);
+ if (procService != null) {
+ procService.canRestart(containerDmc, new DataRequestMonitor<Boolean>(fExecutor, null) {
+ @Override
+ protected void handleCompleted() {
+ request.setEnabled(isSuccess() && getData());
+ request.done();
+ }
+ });
+ } else {
+ request.setEnabled(false);
request.done();
- }
- }
- });
+ }
+ }
+ });
}
-
- @Override
- public boolean execute(final IDebugCommandRequest request) {
- if (request.getElements().length != 1) {
- request.done();
- return false;
- }
-
- Object element = request.getElements()[0];
- if (!(element instanceof IDMVMContext)) {
- request.done();
- return false;
- }
-
- final IContainerDMContext containerDmc = DMContexts.getAncestorOfType(((IDMVMContext)element).getDMContext(),
- IContainerDMContext.class);
-
- fExecutor.submit(new DsfRunnable() {
- @Override
+
+ @Override
+ public boolean execute(final IDebugCommandRequest request) {
+ if (request.getElements().length != 1) {
+ request.done();
+ return false;
+ }
+
+ Object element = request.getElements()[0];
+ if (!(element instanceof IDMVMContext)) {
+ request.done();
+ return false;
+ }
+
+ final IContainerDMContext containerDmc = DMContexts.getAncestorOfType(((IDMVMContext) element).getDMContext(),
+ IContainerDMContext.class);
+
+ fExecutor.submit(new DsfRunnable() {
+ @Override
public void run() {
- IGDBProcesses procService = fTracker.getService(IGDBProcesses.class);
+ IGDBProcesses procService = fTracker.getService(IGDBProcesses.class);
- if (procService != null) {
- Map<String, Object> attributes = null;
+ if (procService != null) {
+ Map<String, Object> attributes = null;
try {
attributes = fLaunch.getLaunchConfiguration().getAttributes();
- } catch (CoreException e) {}
-
- procService.restart(containerDmc, attributes,
- new DataRequestMonitor<IContainerDMContext>(fExecutor, null) {
- @Override
- protected void handleCompleted() {
- request.done();
- };
- });
- } else {
- request.done();
- }
+ } catch (CoreException e) {
+ }
+
+ procService.restart(containerDmc, attributes,
+ new DataRequestMonitor<IContainerDMContext>(fExecutor, null) {
+ @Override
+ protected void handleCompleted() {
+ request.done();
+ };
+ });
+ } else {
+ request.done();
+ }
}
- });
- return false;
- }
+ });
+ return false;
+ }
}
-
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbSteppingModeTarget.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbSteppingModeTarget.java
index 71c0b1cb709..d279ba86875 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbSteppingModeTarget.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbSteppingModeTarget.java
@@ -25,48 +25,48 @@ import org.eclipse.cdt.dsf.gdb.service.SessionType;
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
import org.eclipse.cdt.dsf.service.DsfSession;
-/**
+/**
* SteppingModeTarget that allows to disable the button when dealing
* with a post-mortem debugging session.
- *
+ *
* @since 2.0
*/
public class GdbSteppingModeTarget extends DsfSteppingModeTarget {
- private final DsfExecutor fExecutor;
- private final DsfServicesTracker fTracker;
-
- public GdbSteppingModeTarget(DsfSession session) {
- fExecutor = session.getExecutor();
- fTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
- }
+ private final DsfExecutor fExecutor;
+ private final DsfServicesTracker fTracker;
- public void dispose() {
- fTracker.dispose();
- }
+ public GdbSteppingModeTarget(DsfSession session) {
+ fExecutor = session.getExecutor();
+ fTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
+ }
+
+ public void dispose() {
+ fTracker.dispose();
+ }
@Override
public boolean supportsInstructionStepping() {
- Query<Boolean> supportInstructionStepping = new Query<Boolean>() {
- @Override
- protected void execute(DataRequestMonitor<Boolean> rm) {
- IGDBBackend backend = fTracker.getService(IGDBBackend.class);
+ Query<Boolean> supportInstructionStepping = new Query<Boolean>() {
+ @Override
+ protected void execute(DataRequestMonitor<Boolean> rm) {
+ IGDBBackend backend = fTracker.getService(IGDBBackend.class);
if (backend != null) {
// PostMortem sessions do not support instruction stepping
rm.setData(backend.getSessionType() != SessionType.CORE);
} else {
rm.setData(false);
}
-
+
rm.done();
- }
- };
+ }
+ };
- fExecutor.execute(supportInstructionStepping);
- try {
- return supportInstructionStepping.get();
- } catch (InterruptedException e1) {
- } catch (ExecutionException e1) {
- }
- return false;
+ fExecutor.execute(supportInstructionStepping);
+ try {
+ return supportInstructionStepping.get();
+ } catch (InterruptedException e1) {
+ } catch (ExecutionException e1) {
+ }
+ return false;
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/ProcessInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/ProcessInfo.java
index 894cf82d9b6..5bdad1071d2 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/ProcessInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/ProcessInfo.java
@@ -7,9 +7,9 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
- * Ericsson - initial API and implementation
+ * Ericsson - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.actions;
@@ -23,11 +23,11 @@ public class ProcessInfo implements IProcessExtendedInfo, Comparable<ProcessInfo
private final String[] cores;
private final String ownerId;
private final String description;
-
+
public ProcessInfo(int pid, String name) {
this(pid, name, null, null);
}
-
+
/** @since 2.2 */
public ProcessInfo(int pid, String name, String[] cores, String owner) {
this(pid, name, cores, owner, null);
@@ -44,41 +44,42 @@ public class ProcessInfo implements IProcessExtendedInfo, Comparable<ProcessInfo
this.description = description;
}
-
- @Override
+ @Override
public String getName() {
return name;
}
- @Override
+ @Override
public int getPid() {
return pid;
}
- @Override
+ @Override
public String[] getCores() {
return cores;
}
- @Override
+ @Override
public String getOwner() {
return ownerId;
}
- @Override
- public String getDescription() {
- return description;
- }
+ @Override
+ public String getDescription() {
+ return description;
+ }
/**
* Sort by name, then by pid.
* No need to sort any further since pids are unique.
*/
- @Override
+ @Override
public int compareTo(ProcessInfo other) {
- int nameCompare = getName().compareTo(other.getName());
- if (nameCompare != 0) return nameCompare;
- else return (getPid() < other.getPid()) ? -1 : 1;
+ int nameCompare = getName().compareTo(other.getName());
+ if (nameCompare != 0)
+ return nameCompare;
+ else
+ return (getPid() < other.getPid()) ? -1 : 1;
}
} \ No newline at end of file
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/ReverseDebuggingPropertyTester.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/ReverseDebuggingPropertyTester.java
index 4a53833953c..097bb4fefdb 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/ReverseDebuggingPropertyTester.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/ReverseDebuggingPropertyTester.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
@@ -20,33 +20,34 @@ import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext;
import org.eclipse.core.expressions.PropertyTester;
/**
- * Property tester for reverse debugging information available through the given
+ * Property tester for reverse debugging information available through the given
* object. The object being tested is an {@link IDMVMContext}.
* <p>
* One property is supported:
* <ul>
- * <li> "isReverseDebuggingEnabled" - Checks whether reverse debugging is currently
+ * <li> "isReverseDebuggingEnabled" - Checks whether reverse debugging is currently
* enabled given the receiver.</li>
* </ul>
* </p>
*/
public class ReverseDebuggingPropertyTester extends PropertyTester {
- private static final String ENABLED = "isReverseDebuggingEnabled"; //$NON-NLS-1$
+ private static final String ENABLED = "isReverseDebuggingEnabled"; //$NON-NLS-1$
+
+ @Override
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+ if (ENABLED.equals(property)) {
+ if (receiver instanceof IDMVMContext) {
+ return test((IDMVMContext) receiver);
+ }
+ }
+ return false;
+ }
- @Override
- public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- if (ENABLED.equals(property)) {
- if (receiver instanceof IDMVMContext) {
- return test((IDMVMContext)receiver);
- }
- }
- return false;
- }
-
- private boolean test(IDMVMContext context) {
- boolean result = false;
- ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(context.getDMContext(), ICommandControlDMContext.class);
+ private boolean test(IDMVMContext context) {
+ boolean result = false;
+ ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(context.getDMContext(),
+ ICommandControlDMContext.class);
if (controlDmc != null) {
IReverseToggleHandler toggle = (controlDmc.getAdapter(IReverseToggleHandler.class));
if (toggle != null) {
@@ -54,5 +55,5 @@ public class ReverseDebuggingPropertyTester extends PropertyTester {
}
}
return result;
- }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/CBreakpointGdbThreadFilterPage.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/CBreakpointGdbThreadFilterPage.java
index f68483b91d6..1f8aa4daef0 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/CBreakpointGdbThreadFilterPage.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/CBreakpointGdbThreadFilterPage.java
@@ -12,7 +12,7 @@
* QNX Software Systems - Initial API and implementation
* Marc Khouzam (Ericsson) - Use IDsfBreakpointExtension directly (Bug 355833)
*******************************************************************************/
-package org.eclipse.cdt.dsf.gdb.internal.ui.breakpoints;
+package org.eclipse.cdt.dsf.gdb.internal.ui.breakpoints;
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
import org.eclipse.cdt.dsf.debug.service.IDsfBreakpointExtension;
@@ -34,36 +34,37 @@ public class CBreakpointGdbThreadFilterPage extends PropertyPage {
* @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
*/
@Override
- protected Control createContents( Composite parent ) {
+ protected Control createContents(Composite parent) {
noDefaultAndApplyButton();
- Composite mainComposite = new Composite( parent, SWT.NONE );
- mainComposite.setFont( parent.getFont() );
- mainComposite.setLayout( new GridLayout() );
- mainComposite.setLayoutData( new GridData( GridData.FILL_BOTH ) );
- createThreadFilterEditor( mainComposite );
- setValid( true );
+ Composite mainComposite = new Composite(parent, SWT.NONE);
+ mainComposite.setFont(parent.getFont());
+ mainComposite.setLayout(new GridLayout());
+ mainComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ createThreadFilterEditor(mainComposite);
+ setValid(true);
return mainComposite;
}
- public ICBreakpoint getBreakpoint() {
- return getElement().getAdapter(ICBreakpoint.class);
- }
+ public ICBreakpoint getBreakpoint() {
+ return getElement().getAdapter(ICBreakpoint.class);
+ }
public IDsfBreakpointExtension getFilterExtension() {
- ICBreakpoint bp = getBreakpoint();
- if (bp != null) {
- try {
- IDsfBreakpointExtension filter = bp.getExtension(GdbLaunchDelegate.GDB_DEBUG_MODEL_ID,
- CBreakpointGdbThreadsFilterExtension.class);
- filter.initialize(bp);
- return filter;
- } catch (CoreException e) {}
- }
- return null;
+ ICBreakpoint bp = getBreakpoint();
+ if (bp != null) {
+ try {
+ IDsfBreakpointExtension filter = bp.getExtension(GdbLaunchDelegate.GDB_DEBUG_MODEL_ID,
+ CBreakpointGdbThreadsFilterExtension.class);
+ filter.initialize(bp);
+ return filter;
+ } catch (CoreException e) {
+ }
+ }
+ return null;
}
- protected void createThreadFilterEditor( Composite parent ) {
- fThreadFilterEditor = new GdbThreadFilterEditor( parent, this );
+ protected void createThreadFilterEditor(Composite parent) {
+ fThreadFilterEditor = new GdbThreadFilterEditor(parent, this);
}
protected GdbThreadFilterEditor getThreadFilterEditor() {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/DisassemblyToggleDynamicPrintfTarget.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/DisassemblyToggleDynamicPrintfTarget.java
index d332cfb98a7..e42e3247f43 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/DisassemblyToggleDynamicPrintfTarget.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/DisassemblyToggleDynamicPrintfTarget.java
@@ -37,29 +37,30 @@ public class DisassemblyToggleDynamicPrintfTarget extends AbstractDisassemblyBre
*/
@Override
protected void createLineBreakpoint(String sourceHandle, IResource resource, int lineNumber) throws CoreException {
- // We provide a default printf string to make the dynamic printf useful automatically
- String printfStr = NLS.bind(Messages.Default_LineDynamicPrintf_String, escapeBackslashes(sourceHandle), lineNumber);
-
- CDIDebugModel.createLineDynamicPrintf(sourceHandle, resource, getBreakpointType(), lineNumber, true, 0, "", printfStr, true); //$NON-NLS-1$
+ // We provide a default printf string to make the dynamic printf useful automatically
+ String printfStr = NLS.bind(Messages.Default_LineDynamicPrintf_String, escapeBackslashes(sourceHandle),
+ lineNumber);
+
+ CDIDebugModel.createLineDynamicPrintf(sourceHandle, resource, getBreakpointType(), lineNumber, true, 0, "", //$NON-NLS-1$
+ printfStr, true);
}
-
+
@Override
- protected void createLineBreakpointInteractive(IWorkbenchPart part, String sourceHandle, IResource resource, int lineNumber)
- throws CoreException
- {
- ICDynamicPrintf dprintf = (ICDynamicPrintf)CDIDebugModel.createBlankLineDynamicPrintf();
+ protected void createLineBreakpointInteractive(IWorkbenchPart part, String sourceHandle, IResource resource,
+ int lineNumber) throws CoreException {
+ ICDynamicPrintf dprintf = (ICDynamicPrintf) CDIDebugModel.createBlankLineDynamicPrintf();
Map<String, Object> attributes = new HashMap<String, Object>();
- CDIDebugModel.setLineBreakpointAttributes(
- attributes, sourceHandle, getBreakpointType(), lineNumber, true, 0, "" ); //$NON-NLS-1$
+ CDIDebugModel.setLineBreakpointAttributes(attributes, sourceHandle, getBreakpointType(), lineNumber, true, 0,
+ ""); //$NON-NLS-1$
- // Although the user will be given the opportunity to provide the printf string
- // in the properties dialog, we pre-fill it with the default string to be nice.
- attributes.put(ICDynamicPrintf.PRINTF_STRING,
- NLS.bind(Messages.Default_LineDynamicPrintf_String, escapeBackslashes(sourceHandle), lineNumber));
+ // Although the user will be given the opportunity to provide the printf string
+ // in the properties dialog, we pre-fill it with the default string to be nice.
+ attributes.put(ICDynamicPrintf.PRINTF_STRING,
+ NLS.bind(Messages.Default_LineDynamicPrintf_String, escapeBackslashes(sourceHandle), lineNumber));
openBreakpointPropertiesDialog(dprintf, part, resource, attributes);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.AbstractDisassemblyBreakpointsTarget#createAddressBreakpoint(org.eclipse.core.resources.IResource, org.eclipse.cdt.core.IAddress)
*/
@@ -68,8 +69,9 @@ public class DisassemblyToggleDynamicPrintfTarget extends AbstractDisassemblyBre
// We provide a default printf string to make the dynamic printf useful automatically
String format = getAddressFormat(address);
String printfStr = NLS.bind(Messages.Default_AddressDynamicPrintf_String, address, format);
-
- CDIDebugModel.createAddressDynamicPrintf(null, null, resource, getBreakpointType(), -1, address, true, 0, "", printfStr, true); //$NON-NLS-1$
+
+ CDIDebugModel.createAddressDynamicPrintf(null, null, resource, getBreakpointType(), -1, address, true, 0, "", //$NON-NLS-1$
+ printfStr, true);
}
/**
@@ -83,21 +85,20 @@ public class DisassemblyToggleDynamicPrintfTarget extends AbstractDisassemblyBre
return format;
}
- @Override
- protected void createAddressBreakpointInteractive(IWorkbenchPart part, IResource resource, IAddress address)
- throws CoreException
- {
- ICDynamicPrintf dprintf = (ICDynamicPrintf)CDIDebugModel.createBlankAddressDynamicPrintf();
- Map<String, Object> attributes = new HashMap<String, Object>();
- CDIDebugModel.setAddressBreakpointAttributes(
- attributes, null, null, getBreakpointType(), -1, address, true, 0, "" ); //$NON-NLS-1$
+ @Override
+ protected void createAddressBreakpointInteractive(IWorkbenchPart part, IResource resource, IAddress address)
+ throws CoreException {
+ ICDynamicPrintf dprintf = (ICDynamicPrintf) CDIDebugModel.createBlankAddressDynamicPrintf();
+ Map<String, Object> attributes = new HashMap<String, Object>();
+ CDIDebugModel.setAddressBreakpointAttributes(attributes, null, null, getBreakpointType(), -1, address, true, 0,
+ ""); //$NON-NLS-1$
- String format = getAddressFormat(address);
+ String format = getAddressFormat(address);
String printfStr = NLS.bind(Messages.Default_AddressDynamicPrintf_String, address, format);
- attributes.put(ICDynamicPrintf.PRINTF_STRING, printfStr);
+ attributes.put(ICDynamicPrintf.PRINTF_STRING, printfStr);
- openBreakpointPropertiesDialog(dprintf, part, resource, attributes);
- }
+ openBreakpointPropertiesDialog(dprintf, part, resource, attributes);
+ }
protected int getBreakpointType() {
return ICBreakpointType.REGULAR;
@@ -107,7 +108,7 @@ public class DisassemblyToggleDynamicPrintfTarget extends AbstractDisassemblyBre
* Escape embedded backslashes for inclusion in C string.
*/
private static String escapeBackslashes(String str) {
- return str.replaceAll(Pattern.quote("\\"), "\\\\\\\\"); //$NON-NLS-1$//$NON-NLS-2$
+ return str.replaceAll(Pattern.quote("\\"), "\\\\\\\\"); //$NON-NLS-1$//$NON-NLS-2$
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/DisassemblyToggleTracepointsTarget.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/DisassemblyToggleTracepointsTarget.java
index 87c156d47f0..f2d4d80f32e 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/DisassemblyToggleTracepointsTarget.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/DisassemblyToggleTracepointsTarget.java
@@ -39,36 +39,35 @@ public class DisassemblyToggleTracepointsTarget extends AbstractDisassemblyBreak
protected void createLineBreakpoint(String sourceHandle, IResource resource, int lineNumber) throws CoreException {
CDIDebugModel.createLineTracepoint(sourceHandle, resource, getBreakpointType(), lineNumber, true, 0, "", true); //$NON-NLS-1$
}
-
+
@Override
- protected void createLineBreakpointInteractive(IWorkbenchPart part, String sourceHandle, IResource resource, int lineNumber)
- throws CoreException
- {
+ protected void createLineBreakpointInteractive(IWorkbenchPart part, String sourceHandle, IResource resource,
+ int lineNumber) throws CoreException {
ICLineBreakpoint lineBp = CDIDebugModel.createBlankLineTracepoint();
Map<String, Object> attributes = new HashMap<String, Object>();
- CDIDebugModel.setLineBreakpointAttributes(
- attributes, sourceHandle, getBreakpointType(), lineNumber, true, 0, "" ); //$NON-NLS-1$
+ CDIDebugModel.setLineBreakpointAttributes(attributes, sourceHandle, getBreakpointType(), lineNumber, true, 0,
+ ""); //$NON-NLS-1$
openBreakpointPropertiesDialog(lineBp, part, resource, attributes);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.AbstractDisassemblyBreakpointsTarget#createAddressBreakpoint(org.eclipse.core.resources.IResource, org.eclipse.cdt.core.IAddress)
*/
@Override
protected void createAddressBreakpoint(IResource resource, IAddress address) throws CoreException {
- CDIDebugModel.createAddressTracepoint(null, null, resource, getBreakpointType(), -1, address, true, 0, "", true); //$NON-NLS-1$
+ CDIDebugModel.createAddressTracepoint(null, null, resource, getBreakpointType(), -1, address, true, 0, "", //$NON-NLS-1$
+ true);
}
- @Override
- protected void createAddressBreakpointInteractive(IWorkbenchPart part, IResource resource, IAddress address)
- throws CoreException
- {
- ICLineBreakpoint lineBp = CDIDebugModel.createBlankAddressTracepoint();
- Map<String, Object> attributes = new HashMap<String, Object>();
- CDIDebugModel.setAddressBreakpointAttributes(
- attributes, null, null, getBreakpointType(), -1, address, true, 0, "" ); //$NON-NLS-1$
- openBreakpointPropertiesDialog(lineBp, part, resource, attributes);
- }
+ @Override
+ protected void createAddressBreakpointInteractive(IWorkbenchPart part, IResource resource, IAddress address)
+ throws CoreException {
+ ICLineBreakpoint lineBp = CDIDebugModel.createBlankAddressTracepoint();
+ Map<String, Object> attributes = new HashMap<String, Object>();
+ CDIDebugModel.setAddressBreakpointAttributes(attributes, null, null, getBreakpointType(), -1, address, true, 0,
+ ""); //$NON-NLS-1$
+ openBreakpointPropertiesDialog(lineBp, part, resource, attributes);
+ }
protected int getBreakpointType() {
return ICBreakpointType.REGULAR;
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/GDBDynamicPrintfPropertyPage.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/GDBDynamicPrintfPropertyPage.java
index 6c650f93a48..0ceb1eae21c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/GDBDynamicPrintfPropertyPage.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/GDBDynamicPrintfPropertyPage.java
@@ -11,7 +11,7 @@
* Contributors:
* Marc Khouzam (Ericsson) - Initial API and implementation
*******************************************************************************/
-package org.eclipse.cdt.dsf.gdb.internal.ui.breakpoints;
+package org.eclipse.cdt.dsf.gdb.internal.ui.breakpoints;
import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
@@ -49,7 +49,7 @@ import org.eclipse.ui.IWorkbenchPropertyPage;
import org.eclipse.ui.model.IWorkbenchAdapter;
/**
- * The preference page used to present the properties of a GDB dynamic printf as preferences.
+ * The preference page used to present the properties of a GDB dynamic printf as preferences.
*/
public class GDBDynamicPrintfPropertyPage extends FieldEditorPreferencePage implements IWorkbenchPropertyPage {
@@ -75,7 +75,7 @@ public class GDBDynamicPrintfPropertyPage extends FieldEditorPreferencePage impl
/**
* Only store if the text control is enabled
- *
+ *
* @see FieldEditor#doStore()
*/
@Override
@@ -93,12 +93,11 @@ public class GDBDynamicPrintfPropertyPage extends FieldEditorPreferencePage impl
protected void clearErrorMessage() {
if (getPage() != null) {
String message = getPage().getErrorMessage();
- if ( message != null ) {
+ if (message != null) {
if (getErrorMessage().equals(message)) {
super.clearErrorMessage();
}
- }
- else {
+ } else {
super.clearErrorMessage();
}
}
@@ -131,11 +130,11 @@ public class GDBDynamicPrintfPropertyPage extends FieldEditorPreferencePage impl
super.doStore();
}
}
-
+
@Override
- protected void doLoad() {
+ protected void doLoad() {
String value = getPreferenceStore().getString(getPreferenceName());
- setStringValue(value);
+ setStringValue(value);
}
/**
@@ -145,12 +144,11 @@ public class GDBDynamicPrintfPropertyPage extends FieldEditorPreferencePage impl
protected void clearErrorMessage() {
if (getPage() != null) {
String message = getPage().getErrorMessage();
- if ( message != null ) {
+ if (message != null) {
if (getErrorMessage().equals(message)) {
super.clearErrorMessage();
}
- }
- else {
+ } else {
super.clearErrorMessage();
}
}
@@ -171,6 +169,7 @@ public class GDBDynamicPrintfPropertyPage extends FieldEditorPreferencePage impl
textField.setText(fValue);
}
}
+
@Override
protected void doLoadDefault() {
// nothing
@@ -185,22 +184,21 @@ public class GDBDynamicPrintfPropertyPage extends FieldEditorPreferencePage impl
private Text fIgnoreCountTextControl;
private DynamicPrintfIntegerFieldEditor fLineEditor;
private DynamicPrintfIntegerFieldEditor fIgnoreCount;
-
- /**
+
+ /**
* Indicates if the page currently aims to create
* a breakpoint that already exits.
*/
private boolean fDuplicateBreakpoint;
-
private DynamicPrintfStringFieldEditor fPrintString;
private IAdaptable fElement;
/**
- * The preference store used to interface between the dynamic printf and the
+ * The preference store used to interface between the dynamic printf and the
* dynamic printf preference page. This preference store is initialized only
- * when the preference store cannot be retrieved from the preference
+ * when the preference store cannot be retrieved from the preference
* dialog's element.
* @see #getPreferenceStore()
*/
@@ -223,24 +221,21 @@ public class GDBDynamicPrintfPropertyPage extends FieldEditorPreferencePage impl
}
private void createMainLabel(ICDynamicPrintf dprintf) {
- addField(createLabelEditor(getFieldEditorParent(),
- Messages.PropertyPage_Class,
- getDynamicPrintfMainLabel(dprintf)));
+ addField(createLabelEditor(getFieldEditorParent(), Messages.PropertyPage_Class,
+ getDynamicPrintfMainLabel(dprintf)));
}
private void createTypeSpecificLabelFieldEditors(ICDynamicPrintf dprintf) {
if (dprintf instanceof ICFunctionBreakpoint) {
- createFunctionEditor(getFieldEditorParent());
- }
- else if (dprintf instanceof ICAddressBreakpoint) {
+ createFunctionEditor(getFieldEditorParent());
+ } else if (dprintf instanceof ICAddressBreakpoint) {
String address = getPreferenceStore().getString(ICLineBreakpoint.ADDRESS);
if (address == null || address.trim().length() == 0) {
address = Messages.PropertyPage_NotAvailable;
}
addField(createLabelEditor(getFieldEditorParent(), Messages.PropertyPage_Address, address));
- }
- else { // LineDprintf
- String fileName = getPreferenceStore().getString(ICBreakpoint.SOURCE_HANDLE);
+ } else { // LineDprintf
+ String fileName = getPreferenceStore().getString(ICBreakpoint.SOURCE_HANDLE);
if (fileName != null) {
addField(createLabelEditor(getFieldEditorParent(), Messages.PropertyPage_File, fileName));
}
@@ -252,70 +247,74 @@ public class GDBDynamicPrintfPropertyPage extends FieldEditorPreferencePage impl
}
private String getDynamicPrintfMainLabel(ICDynamicPrintf dprintf) {
- IWorkbenchAdapter labelProvider = getElement().getAdapter(IWorkbenchAdapter.class);
- if (labelProvider != null) {
- return labelProvider.getLabel(getElement());
- }
- // default main label is the label of marker type for the dynamic printf
- return CDIDebugModel.calculateMarkerType(dprintf);
+ IWorkbenchAdapter labelProvider = getElement().getAdapter(IWorkbenchAdapter.class);
+ if (labelProvider != null) {
+ return labelProvider.getLabel(getElement());
+ }
+ // default main label is the label of marker type for the dynamic printf
+ return CDIDebugModel.calculateMarkerType(dprintf);
+ }
+
+ protected void createFunctionEditor(Composite parent) {
+ ICDynamicPrintf dprintf = getDprintf();
+ if (dprintf == null || dprintf.getMarker() == null) {
+ DynamicPrintfStringFieldEditor expressionEditor = new DynamicPrintfStringFieldEditor(
+ ICLineBreakpoint.FUNCTION, Messages.PropertyPage_FunctionName, parent);
+ expressionEditor.setErrorMessage(Messages.PropertyPage_function_value_errorMessage);
+ expressionEditor.setEmptyStringAllowed(false);
+ addField(expressionEditor);
+ } else {
+ String function = getPreferenceStore().getString(ICLineBreakpoint.FUNCTION);
+ if (function == null) {
+ function = Messages.PropertyPage_NotAvailable;
+ }
+ addField(createLabelEditor(getFieldEditorParent(), Messages.PropertyPage_FunctionName, function));
+ }
}
-
- protected void createFunctionEditor(Composite parent) {
- ICDynamicPrintf dprintf = getDprintf();
- if (dprintf == null || dprintf.getMarker() == null) {
- DynamicPrintfStringFieldEditor expressionEditor = new DynamicPrintfStringFieldEditor(
- ICLineBreakpoint.FUNCTION, Messages.PropertyPage_FunctionName, parent);
- expressionEditor.setErrorMessage(Messages.PropertyPage_function_value_errorMessage);
- expressionEditor.setEmptyStringAllowed(false);
- addField(expressionEditor);
- } else {
- String function = getPreferenceStore().getString(ICLineBreakpoint.FUNCTION);
- if (function == null) {
- function = Messages.PropertyPage_NotAvailable;
- }
- addField(createLabelEditor(getFieldEditorParent(), Messages.PropertyPage_FunctionName, function));
- }
- }
+
protected void createLineNumberEditor(Composite parent) {
- String title = Messages.PropertyPage_LineNumber;
- fLineEditor = new DynamicPrintfIntegerFieldEditor(IMarker.LINE_NUMBER, title, parent);
- fLineEditor.setValidRange(1, Integer.MAX_VALUE);
- fLineEditor.setErrorMessage(Messages.PropertyPage_lineNumber_errorMessage);
- addField(fLineEditor);
+ String title = Messages.PropertyPage_LineNumber;
+ fLineEditor = new DynamicPrintfIntegerFieldEditor(IMarker.LINE_NUMBER, title, parent);
+ fLineEditor.setValidRange(1, Integer.MAX_VALUE);
+ fLineEditor.setErrorMessage(Messages.PropertyPage_lineNumber_errorMessage);
+ addField(fLineEditor);
}
-
+
protected void createEnabledField(Composite parent) {
fEnabled = new BooleanFieldEditor(ICBreakpoint.ENABLED, Messages.PropertyPage_Enabled, parent);
addField(fEnabled);
}
protected void createConditionEditor(Composite parent) {
- fCondition = new DynamicPrintfStringFieldEditor(ICBreakpoint.CONDITION, Messages.PropertyPage_Condition, parent);
+ fCondition = new DynamicPrintfStringFieldEditor(ICBreakpoint.CONDITION, Messages.PropertyPage_Condition,
+ parent);
fCondition.setEmptyStringAllowed(true);
fCondition.setErrorMessage(Messages.PropertyPage_InvalidCondition);
addField(fCondition);
}
protected void createIgnoreCountEditor(Composite parent) {
- fIgnoreCount = new DynamicPrintfIntegerFieldEditor(ICBreakpoint.IGNORE_COUNT, Messages.PropertyPage_IgnoreCount, parent);
+ fIgnoreCount = new DynamicPrintfIntegerFieldEditor(ICBreakpoint.IGNORE_COUNT, Messages.PropertyPage_IgnoreCount,
+ parent);
fIgnoreCount.setValidRange(0, Integer.MAX_VALUE);
fIgnoreCountTextControl = fIgnoreCount.getTextControl(parent);
- fIgnoreCountTextControl.setEnabled( getPreferenceStore().getInt(ICBreakpoint.IGNORE_COUNT) >= 0 );
+ fIgnoreCountTextControl.setEnabled(getPreferenceStore().getInt(ICBreakpoint.IGNORE_COUNT) >= 0);
addField(fIgnoreCount);
}
protected void createPrintStringEditor(Composite parent) {
- fPrintString = new DynamicPrintfStringFieldEditor(ICDynamicPrintf.PRINTF_STRING, Messages.DynamicPrintfPropertyPage_PrintString, parent) {
+ fPrintString = new DynamicPrintfStringFieldEditor(ICDynamicPrintf.PRINTF_STRING,
+ Messages.DynamicPrintfPropertyPage_PrintString, parent) {
@Override
protected boolean doCheckState() {
- GDBDynamicPrintfUtils.GDBDynamicPrintfString parsedStr =
- new GDBDynamicPrintfUtils.GDBDynamicPrintfString(getTextControl().getText());
-
+ GDBDynamicPrintfUtils.GDBDynamicPrintfString parsedStr = new GDBDynamicPrintfUtils.GDBDynamicPrintfString(
+ getTextControl().getText());
+
boolean valid = parsedStr.isValid();
if (!valid) {
setErrorMessage(parsedStr.getErrorMessage());
}
-
+
return valid;
}
};
@@ -327,14 +326,13 @@ public class GDBDynamicPrintfPropertyPage extends FieldEditorPreferencePage impl
// Don't allow to create a duplicate breakpoint
return super.isValid() && !fDuplicateBreakpoint;
}
-
+
@Override
public void propertyChange(PropertyChangeEvent event) {
super.propertyChange(event);
ICBreakpoint currentBp = getDprintf();
- if (!(currentBp instanceof ICFunctionBreakpoint) &&
- !(currentBp instanceof ICAddressBreakpoint)) {
+ if (!(currentBp instanceof ICFunctionBreakpoint) && !(currentBp instanceof ICAddressBreakpoint)) {
// Check for duplication of line dprintf
if (event.getProperty().equals(FieldEditor.VALUE)) {
if (super.isValid()) {
@@ -345,7 +343,8 @@ public class GDBDynamicPrintfPropertyPage extends FieldEditorPreferencePage impl
fDuplicateBreakpoint = isDuplicateBreakpoint();
if (oldValue != fDuplicateBreakpoint) {
if (fDuplicateBreakpoint) {
- setErrorMessage(BreakpointsMessages.getString("CBreakpointPropertyPage.breakpoint_already_exists_errorMessage")); //$NON-NLS-1$
+ setErrorMessage(BreakpointsMessages
+ .getString("CBreakpointPropertyPage.breakpoint_already_exists_errorMessage")); //$NON-NLS-1$
} else {
setErrorMessage(null);
}
@@ -356,11 +355,11 @@ public class GDBDynamicPrintfPropertyPage extends FieldEditorPreferencePage impl
// update page state
updateApplyButton();
}
- }
+ }
}
}
}
-
+
private boolean isDuplicateBreakpoint() {
String source = getPreferenceStore().getString(ICBreakpoint.SOURCE_HANDLE);
int line = fLineEditor.getIntValue();
@@ -386,7 +385,7 @@ public class GDBDynamicPrintfPropertyPage extends FieldEditorPreferencePage impl
}
return false;
}
-
+
protected FieldEditor createLabelEditor(Composite parent, String title, String value) {
return new LabelFieldEditor(parent, title, value);
}
@@ -394,13 +393,13 @@ public class GDBDynamicPrintfPropertyPage extends FieldEditorPreferencePage impl
protected ICDynamicPrintf getDprintf() {
IAdaptable element = getElement();
if (element instanceof ICDynamicPrintf) {
- return (ICDynamicPrintf)element;
+ return (ICDynamicPrintf) element;
}
-
+
if (element instanceof ICBreakpointContext) {
- ICBreakpoint breakpoint =((ICBreakpointContext)element).getBreakpoint();
+ ICBreakpoint breakpoint = ((ICBreakpointContext) element).getBreakpoint();
if (breakpoint instanceof ICDynamicPrintf) {
- return (ICDynamicPrintf)breakpoint;
+ return (ICDynamicPrintf) breakpoint;
}
assert false : "Should always have a dprintf"; //$NON-NLS-1$
}
@@ -409,68 +408,66 @@ public class GDBDynamicPrintfPropertyPage extends FieldEditorPreferencePage impl
}
protected Object getDebugContext() {
- IDebugContextProvider provider = getElement().getAdapter(IDebugContextProvider.class);
- if (provider != null) {
- ISelection selection = provider.getActiveContext();
- if (selection instanceof IStructuredSelection) {
- return ((IStructuredSelection) selection).getFirstElement();
- }
- return null;
- }
- return DebugUITools.getDebugContext();
+ IDebugContextProvider provider = getElement().getAdapter(IDebugContextProvider.class);
+ if (provider != null) {
+ ISelection selection = provider.getActiveContext();
+ if (selection instanceof IStructuredSelection) {
+ return ((IStructuredSelection) selection).getFirstElement();
+ }
+ return null;
+ }
+ return DebugUITools.getDebugContext();
}
-
protected IResource getResource() {
- IAdaptable element = getElement();
- if (element instanceof ICDynamicPrintf) {
- IMarker marker = ((ICDynamicPrintf)element).getMarker();
- if (marker != null) {
- return marker.getResource();
- }
- } else if (element instanceof ICBreakpointContext) {
- return ((ICBreakpointContext)element).getResource();
- }
- return null;
+ IAdaptable element = getElement();
+ if (element instanceof ICDynamicPrintf) {
+ IMarker marker = ((ICDynamicPrintf) element).getMarker();
+ if (marker != null) {
+ return marker.getResource();
+ }
+ } else if (element instanceof ICBreakpointContext) {
+ return ((ICBreakpointContext) element).getResource();
+ }
+ return null;
}
@Override
public IPreferenceStore getPreferenceStore() {
- IAdaptable element = getElement();
- if (element instanceof ICBreakpointContext) {
- return ((ICBreakpointContext)element).getPreferenceStore();
- }
-
- if (fDynamicPrintfPreferenceStore == null) {
- CBreakpointContext bpContext = element instanceof CBreakpointContext ?
- (CBreakpointContext)element : null;
- fDynamicPrintfPreferenceStore = new CBreakpointPreferenceStore(bpContext, null);
- }
- return fDynamicPrintfPreferenceStore;
+ IAdaptable element = getElement();
+ if (element instanceof ICBreakpointContext) {
+ return ((ICBreakpointContext) element).getPreferenceStore();
+ }
+
+ if (fDynamicPrintfPreferenceStore == null) {
+ CBreakpointContext bpContext = element instanceof CBreakpointContext ? (CBreakpointContext) element : null;
+ fDynamicPrintfPreferenceStore = new CBreakpointPreferenceStore(bpContext, null);
+ }
+ return fDynamicPrintfPreferenceStore;
}
@Override
public boolean performCancel() {
- IPreferenceStore store = getPreferenceStore();
- if (store instanceof CBreakpointPreferenceStore) {
- ((CBreakpointPreferenceStore)store).setCanceled(true);
- }
- return super.performCancel();
+ IPreferenceStore store = getPreferenceStore();
+ if (store instanceof CBreakpointPreferenceStore) {
+ ((CBreakpointPreferenceStore) store).setCanceled(true);
+ }
+ return super.performCancel();
}
@Override
- public boolean performOk() {
- IPreferenceStore store = getPreferenceStore();
- if (store instanceof CBreakpointPreferenceStore) {
- ((CBreakpointPreferenceStore)store).setCanceled(false);
- }
- return super.performOk();
- }
-
+ public boolean performOk() {
+ IPreferenceStore store = getPreferenceStore();
+ if (store instanceof CBreakpointPreferenceStore) {
+ ((CBreakpointPreferenceStore) store).setCanceled(false);
+ }
+ return super.performOk();
+ }
+
/* (non-Javadoc)
* @see org.eclipse.ui.IWorkbenchPropertyPage#getElement()
*/
- @Override
+ @Override
public IAdaptable getElement() {
return fElement;
}
@@ -478,26 +475,25 @@ public class GDBDynamicPrintfPropertyPage extends FieldEditorPreferencePage impl
/* (non-Javadoc)
* @see org.eclipse.ui.IWorkbenchPropertyPage#setElement(org.eclipse.core.runtime.IAdaptable)
*/
- @Override
+ @Override
public void setElement(IAdaptable element) {
- if (element instanceof ICBreakpoint) {
- fElement = new CBreakpointContext((ICBreakpoint)element, null);
- }
- else {
+ if (element instanceof ICBreakpoint) {
+ fElement = new CBreakpointContext((ICBreakpoint) element, null);
+ } else {
fElement = element;
}
}
protected String[] getDebugModelIds() {
- String[] debugModelIds = null;
- Object debugContext = getDebugContext();
- IDebugModelProvider debugModelProvider = (IDebugModelProvider)
- DebugPlugin.getAdapter(debugContext, IDebugModelProvider.class);
- if (debugModelProvider != null) {
- debugModelIds = debugModelProvider.getModelIdentifiers();
- } else if (debugContext instanceof IDebugElement) {
- debugModelIds = new String[] { ((IDebugElement)debugContext).getModelIdentifier() };
- }
- return debugModelIds;
+ String[] debugModelIds = null;
+ Object debugContext = getDebugContext();
+ IDebugModelProvider debugModelProvider = (IDebugModelProvider) DebugPlugin.getAdapter(debugContext,
+ IDebugModelProvider.class);
+ if (debugModelProvider != null) {
+ debugModelIds = debugModelProvider.getModelIdentifiers();
+ } else if (debugContext instanceof IDebugElement) {
+ debugModelIds = new String[] { ((IDebugElement) debugContext).getModelIdentifier() };
+ }
+ return debugModelIds;
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/GDBTracepointPropertyPage.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/GDBTracepointPropertyPage.java
index 57a8fbe356d..15acced2a7c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/GDBTracepointPropertyPage.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/GDBTracepointPropertyPage.java
@@ -14,7 +14,7 @@
* before creating the tracepoint (Bug 376116)
* Marc Khouzam (Ericsson) - Support for dynamic printf (bug 400628)
*******************************************************************************/
-package org.eclipse.cdt.dsf.gdb.internal.ui.breakpoints;
+package org.eclipse.cdt.dsf.gdb.internal.ui.breakpoints;
import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
@@ -51,7 +51,7 @@ import org.eclipse.ui.IWorkbenchPropertyPage;
import org.eclipse.ui.model.IWorkbenchAdapter;
/**
- * The preference page used to present the properties of a GDB tracepoint as preferences.
+ * The preference page used to present the properties of a GDB tracepoint as preferences.
*/
public class GDBTracepointPropertyPage extends FieldEditorPreferencePage implements IWorkbenchPropertyPage {
@@ -77,7 +77,7 @@ public class GDBTracepointPropertyPage extends FieldEditorPreferencePage impleme
/**
* Only store if the text control is enabled
- *
+ *
* @see FieldEditor#doStore()
*/
@Override
@@ -95,12 +95,11 @@ public class GDBTracepointPropertyPage extends FieldEditorPreferencePage impleme
protected void clearErrorMessage() {
if (getPage() != null) {
String message = getPage().getErrorMessage();
- if ( message != null ) {
+ if (message != null) {
if (getErrorMessage().equals(message)) {
super.clearErrorMessage();
}
- }
- else {
+ } else {
super.clearErrorMessage();
}
}
@@ -133,11 +132,11 @@ public class GDBTracepointPropertyPage extends FieldEditorPreferencePage impleme
super.doStore();
}
}
-
+
@Override
- protected void doLoad() {
+ protected void doLoad() {
String value = getPreferenceStore().getString(getPreferenceName());
- setStringValue(value);
+ setStringValue(value);
}
/**
@@ -147,12 +146,11 @@ public class GDBTracepointPropertyPage extends FieldEditorPreferencePage impleme
protected void clearErrorMessage() {
if (getPage() != null) {
String message = getPage().getErrorMessage();
- if ( message != null ) {
+ if (message != null) {
if (getErrorMessage().equals(message)) {
super.clearErrorMessage();
}
- }
- else {
+ } else {
super.clearErrorMessage();
}
}
@@ -173,6 +171,7 @@ public class GDBTracepointPropertyPage extends FieldEditorPreferencePage impleme
textField.setText(fValue);
}
}
+
@Override
protected void doLoadDefault() {
// nothing
@@ -185,11 +184,11 @@ public class GDBTracepointPropertyPage extends FieldEditorPreferencePage impleme
private TracepointStringFieldEditor fCondition;
private Text fIgnoreCountTextControl;
-
+
private TracepointIntegerFieldEditor fLineEditor;
private TracepointIntegerFieldEditor fIgnoreCount;
-
- /**
+
+ /**
* Indicates if the page currently aims to create
* a breakpoint that already exits.
*/
@@ -201,9 +200,9 @@ public class GDBTracepointPropertyPage extends FieldEditorPreferencePage impleme
private IAdaptable fElement;
/**
- * The preference store used to interface between the tracepoint and the
+ * The preference store used to interface between the tracepoint and the
* tracepoint preference page. This preference store is initialized only
- * when the preference store cannot be retrieved from the preference
+ * when the preference store cannot be retrieved from the preference
* dialog's element.
* @see #getPreferenceStore()
*/
@@ -211,7 +210,7 @@ public class GDBTracepointPropertyPage extends FieldEditorPreferencePage impleme
/**
* Constructor for GDBTracepointPropertyPage.
- *
+ *
*/
public GDBTracepointPropertyPage() {
super(GRID);
@@ -231,24 +230,21 @@ public class GDBTracepointPropertyPage extends FieldEditorPreferencePage impleme
}
private void createMainLabel(ICTracepoint tracepoint) {
- addField(createLabelEditor(getFieldEditorParent(),
- Messages.PropertyPage_Class,
- getTracepointMainLabel(tracepoint)));
+ addField(createLabelEditor(getFieldEditorParent(), Messages.PropertyPage_Class,
+ getTracepointMainLabel(tracepoint)));
}
private void createTypeSpecificLabelFieldEditors(ICTracepoint tracepoint) {
if (tracepoint instanceof ICFunctionBreakpoint) {
- createFunctionEditor(getFieldEditorParent());
- }
- else if (tracepoint instanceof ICAddressBreakpoint) {
+ createFunctionEditor(getFieldEditorParent());
+ } else if (tracepoint instanceof ICAddressBreakpoint) {
String address = getPreferenceStore().getString(ICLineBreakpoint.ADDRESS);
if (address == null || address.trim().length() == 0) {
address = Messages.PropertyPage_NotAvailable;
}
addField(createLabelEditor(getFieldEditorParent(), Messages.PropertyPage_Address, address));
- }
- else { // LineTracepoint
- String fileName = getPreferenceStore().getString(ICBreakpoint.SOURCE_HANDLE);
+ } else { // LineTracepoint
+ String fileName = getPreferenceStore().getString(ICBreakpoint.SOURCE_HANDLE);
if (fileName != null) {
addField(createLabelEditor(getFieldEditorParent(), Messages.PropertyPage_File, fileName));
}
@@ -260,38 +256,39 @@ public class GDBTracepointPropertyPage extends FieldEditorPreferencePage impleme
}
private String getTracepointMainLabel(ICTracepoint tracepoint) {
- IWorkbenchAdapter labelProvider = getElement().getAdapter(IWorkbenchAdapter.class);
- if (labelProvider != null) {
- return labelProvider.getLabel(getElement());
- }
- // default main label is the label of marker type for the tracepoint
- return CDIDebugModel.calculateMarkerType(tracepoint);
+ IWorkbenchAdapter labelProvider = getElement().getAdapter(IWorkbenchAdapter.class);
+ if (labelProvider != null) {
+ return labelProvider.getLabel(getElement());
+ }
+ // default main label is the label of marker type for the tracepoint
+ return CDIDebugModel.calculateMarkerType(tracepoint);
}
-
- protected void createFunctionEditor(Composite parent) {
- ICTracepoint tracepoint = getTracepoint();
- if (tracepoint == null || tracepoint.getMarker() == null) {
- TracepointStringFieldEditor expressionEditor = new TracepointStringFieldEditor(
- ICLineBreakpoint.FUNCTION, Messages.PropertyPage_FunctionName, parent);
- expressionEditor.setErrorMessage(Messages.PropertyPage_function_value_errorMessage);
- expressionEditor.setEmptyStringAllowed(false);
- addField(expressionEditor);
- } else {
- String function = getPreferenceStore().getString(ICLineBreakpoint.FUNCTION);
- if (function == null) {
- function = Messages.PropertyPage_NotAvailable;
- }
- addField(createLabelEditor(getFieldEditorParent(), Messages.PropertyPage_FunctionName, function));
- }
- }
+
+ protected void createFunctionEditor(Composite parent) {
+ ICTracepoint tracepoint = getTracepoint();
+ if (tracepoint == null || tracepoint.getMarker() == null) {
+ TracepointStringFieldEditor expressionEditor = new TracepointStringFieldEditor(ICLineBreakpoint.FUNCTION,
+ Messages.PropertyPage_FunctionName, parent);
+ expressionEditor.setErrorMessage(Messages.PropertyPage_function_value_errorMessage);
+ expressionEditor.setEmptyStringAllowed(false);
+ addField(expressionEditor);
+ } else {
+ String function = getPreferenceStore().getString(ICLineBreakpoint.FUNCTION);
+ if (function == null) {
+ function = Messages.PropertyPage_NotAvailable;
+ }
+ addField(createLabelEditor(getFieldEditorParent(), Messages.PropertyPage_FunctionName, function));
+ }
+ }
+
protected void createLineNumberEditor(Composite parent) {
- String title = Messages.PropertyPage_LineNumber;
- fLineEditor = new TracepointIntegerFieldEditor(IMarker.LINE_NUMBER, title, parent);
- fLineEditor.setValidRange(1, Integer.MAX_VALUE);
- fLineEditor.setErrorMessage(Messages.PropertyPage_lineNumber_errorMessage);
- addField(fLineEditor);
+ String title = Messages.PropertyPage_LineNumber;
+ fLineEditor = new TracepointIntegerFieldEditor(IMarker.LINE_NUMBER, title, parent);
+ fLineEditor.setValidRange(1, Integer.MAX_VALUE);
+ fLineEditor.setErrorMessage(Messages.PropertyPage_lineNumber_errorMessage);
+ addField(fLineEditor);
}
-
+
protected void createEnabledField(Composite parent) {
fEnabled = new BooleanFieldEditor(ICBreakpoint.ENABLED, Messages.PropertyPage_Enabled, parent);
addField(fEnabled);
@@ -305,15 +302,17 @@ public class GDBTracepointPropertyPage extends FieldEditorPreferencePage impleme
}
protected void createIgnoreCountEditor(Composite parent) {
- fIgnoreCount = new TracepointIntegerFieldEditor(ICBreakpoint.IGNORE_COUNT, Messages.PropertyPage_IgnoreCount, parent);
+ fIgnoreCount = new TracepointIntegerFieldEditor(ICBreakpoint.IGNORE_COUNT, Messages.PropertyPage_IgnoreCount,
+ parent);
fIgnoreCount.setValidRange(0, Integer.MAX_VALUE);
fIgnoreCountTextControl = fIgnoreCount.getTextControl(parent);
- fIgnoreCountTextControl.setEnabled( getPreferenceStore().getInt(ICBreakpoint.IGNORE_COUNT) >= 0 );
+ fIgnoreCountTextControl.setEnabled(getPreferenceStore().getInt(ICBreakpoint.IGNORE_COUNT) >= 0);
addField(fIgnoreCount);
}
protected void createPassCountEditor(Composite parent) {
- fPassCount = new TracepointIntegerFieldEditor(ICTracepoint.PASS_COUNT, Messages.TracepointPropertyPage_PassCount, parent);
+ fPassCount = new TracepointIntegerFieldEditor(ICTracepoint.PASS_COUNT,
+ Messages.TracepointPropertyPage_PassCount, parent);
fPassCount.setValidRange(0, Integer.MAX_VALUE);
fPassCountTextControl = fPassCount.getTextControl(parent);
fPassCountTextControl.setEnabled(getPreferenceStore().getInt(ICTracepoint.PASS_COUNT) >= 0);
@@ -329,14 +328,13 @@ public class GDBTracepointPropertyPage extends FieldEditorPreferencePage impleme
// Don't allow to create a duplicate breakpoint
return super.isValid() && !fDuplicateBreakpoint;
}
-
+
@Override
public void propertyChange(PropertyChangeEvent event) {
super.propertyChange(event);
ICBreakpoint currentBp = getTracepoint();
- if (!(currentBp instanceof ICFunctionBreakpoint) &&
- !(currentBp instanceof ICAddressBreakpoint)) {
+ if (!(currentBp instanceof ICFunctionBreakpoint) && !(currentBp instanceof ICAddressBreakpoint)) {
// Check for duplication of line tracepoints
if (event.getProperty().equals(FieldEditor.VALUE)) {
@@ -348,7 +346,8 @@ public class GDBTracepointPropertyPage extends FieldEditorPreferencePage impleme
fDuplicateBreakpoint = isDuplicateBreakpoint();
if (oldValue != fDuplicateBreakpoint) {
if (fDuplicateBreakpoint) {
- setErrorMessage(BreakpointsMessages.getString("CBreakpointPropertyPage.breakpoint_already_exists_errorMessage")); //$NON-NLS-1$
+ setErrorMessage(BreakpointsMessages
+ .getString("CBreakpointPropertyPage.breakpoint_already_exists_errorMessage")); //$NON-NLS-1$
} else {
setErrorMessage(null);
}
@@ -363,7 +362,7 @@ public class GDBTracepointPropertyPage extends FieldEditorPreferencePage impleme
}
}
}
-
+
private boolean isDuplicateBreakpoint() {
String source = getPreferenceStore().getString(ICBreakpoint.SOURCE_HANDLE);
int line = fLineEditor.getIntValue();
@@ -389,17 +388,17 @@ public class GDBTracepointPropertyPage extends FieldEditorPreferencePage impleme
}
return false;
}
-
+
protected ICTracepoint getTracepoint() {
IAdaptable element = getElement();
if (element instanceof ICTracepoint) {
- return (ICTracepoint)element;
+ return (ICTracepoint) element;
}
-
+
if (element instanceof ICBreakpointContext) {
- ICBreakpoint breakpoint =((ICBreakpointContext)element).getBreakpoint();
+ ICBreakpoint breakpoint = ((ICBreakpointContext) element).getBreakpoint();
if (breakpoint instanceof ICTracepoint) {
- return (ICTracepoint)breakpoint;
+ return (ICTracepoint) breakpoint;
}
assert false : "Should always have a tracepoint"; //$NON-NLS-1$
}
@@ -408,68 +407,66 @@ public class GDBTracepointPropertyPage extends FieldEditorPreferencePage impleme
}
protected Object getDebugContext() {
- IDebugContextProvider provider = getElement().getAdapter(IDebugContextProvider.class);
- if (provider != null) {
- ISelection selection = provider.getActiveContext();
- if (selection instanceof IStructuredSelection) {
- return ((IStructuredSelection) selection).getFirstElement();
- }
- return null;
- }
- return DebugUITools.getDebugContext();
+ IDebugContextProvider provider = getElement().getAdapter(IDebugContextProvider.class);
+ if (provider != null) {
+ ISelection selection = provider.getActiveContext();
+ if (selection instanceof IStructuredSelection) {
+ return ((IStructuredSelection) selection).getFirstElement();
+ }
+ return null;
+ }
+ return DebugUITools.getDebugContext();
}
-
protected IResource getResource() {
- IAdaptable element = getElement();
- if (element instanceof ICTracepoint) {
- IMarker marker = ((ICTracepoint)element).getMarker();
- if (marker != null) {
- return marker.getResource();
- }
- } else if (element instanceof ICBreakpointContext) {
- return ((ICBreakpointContext)element).getResource();
- }
- return null;
+ IAdaptable element = getElement();
+ if (element instanceof ICTracepoint) {
+ IMarker marker = ((ICTracepoint) element).getMarker();
+ if (marker != null) {
+ return marker.getResource();
+ }
+ } else if (element instanceof ICBreakpointContext) {
+ return ((ICBreakpointContext) element).getResource();
+ }
+ return null;
}
@Override
public IPreferenceStore getPreferenceStore() {
- IAdaptable element = getElement();
- if (element instanceof ICBreakpointContext) {
- return ((ICBreakpointContext)element).getPreferenceStore();
- }
-
- if (fTracepointPreferenceStore == null) {
- CBreakpointContext bpContext = element instanceof CBreakpointContext ?
- (CBreakpointContext)element : null;
- fTracepointPreferenceStore = new CBreakpointPreferenceStore(bpContext, null);
- }
- return fTracepointPreferenceStore;
+ IAdaptable element = getElement();
+ if (element instanceof ICBreakpointContext) {
+ return ((ICBreakpointContext) element).getPreferenceStore();
+ }
+
+ if (fTracepointPreferenceStore == null) {
+ CBreakpointContext bpContext = element instanceof CBreakpointContext ? (CBreakpointContext) element : null;
+ fTracepointPreferenceStore = new CBreakpointPreferenceStore(bpContext, null);
+ }
+ return fTracepointPreferenceStore;
}
@Override
public boolean performCancel() {
- IPreferenceStore store = getPreferenceStore();
- if (store instanceof CBreakpointPreferenceStore) {
- ((CBreakpointPreferenceStore)store).setCanceled(true);
- }
- return super.performCancel();
+ IPreferenceStore store = getPreferenceStore();
+ if (store instanceof CBreakpointPreferenceStore) {
+ ((CBreakpointPreferenceStore) store).setCanceled(true);
+ }
+ return super.performCancel();
}
@Override
- public boolean performOk() {
- IPreferenceStore store = getPreferenceStore();
- if (store instanceof CBreakpointPreferenceStore) {
- ((CBreakpointPreferenceStore)store).setCanceled(false);
- }
- return super.performOk();
- }
-
+ public boolean performOk() {
+ IPreferenceStore store = getPreferenceStore();
+ if (store instanceof CBreakpointPreferenceStore) {
+ ((CBreakpointPreferenceStore) store).setCanceled(false);
+ }
+ return super.performOk();
+ }
+
/* (non-Javadoc)
* @see org.eclipse.ui.IWorkbenchPropertyPage#getElement()
*/
- @Override
+ @Override
public IAdaptable getElement() {
return fElement;
}
@@ -477,26 +474,25 @@ public class GDBTracepointPropertyPage extends FieldEditorPreferencePage impleme
/* (non-Javadoc)
* @see org.eclipse.ui.IWorkbenchPropertyPage#setElement(org.eclipse.core.runtime.IAdaptable)
*/
- @Override
+ @Override
public void setElement(IAdaptable element) {
- if (element instanceof ICBreakpoint) {
- fElement = new CBreakpointContext((ICBreakpoint)element, null);
- }
- else {
+ if (element instanceof ICBreakpoint) {
+ fElement = new CBreakpointContext((ICBreakpoint) element, null);
+ } else {
fElement = element;
}
}
protected String[] getDebugModelIds() {
- String[] debugModelIds = null;
- Object debugContext = getDebugContext();
- IDebugModelProvider debugModelProvider = (IDebugModelProvider)
- DebugPlugin.getAdapter(debugContext, IDebugModelProvider.class);
- if (debugModelProvider != null) {
- debugModelIds = debugModelProvider.getModelIdentifiers();
- } else if (debugContext instanceof IDebugElement) {
- debugModelIds = new String[] { ((IDebugElement)debugContext).getModelIdentifier() };
- }
- return debugModelIds;
+ String[] debugModelIds = null;
+ Object debugContext = getDebugContext();
+ IDebugModelProvider debugModelProvider = (IDebugModelProvider) DebugPlugin.getAdapter(debugContext,
+ IDebugModelProvider.class);
+ if (debugModelProvider != null) {
+ debugModelIds = debugModelProvider.getModelIdentifiers();
+ } else if (debugContext instanceof IDebugElement) {
+ debugModelIds = new String[] { ((IDebugElement) debugContext).getModelIdentifier() };
+ }
+ return debugModelIds;
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/GdbThreadFilterEditor.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/GdbThreadFilterEditor.java
index 3110afef116..10e2e8663bd 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/GdbThreadFilterEditor.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/GdbThreadFilterEditor.java
@@ -65,498 +65,497 @@ import org.eclipse.swt.widgets.Label;
public class GdbThreadFilterEditor {
- public class CheckHandler implements ICheckStateListener {
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ICheckStateListener#checkStateChanged(org.eclipse.jface.viewers.CheckStateChangedEvent)
- */
- @Override
- public void checkStateChanged(CheckStateChangedEvent event) {
- Object element = event.getElement();
- if (element instanceof IContainerDMContext) {
- checkTarget((IContainerDMContext) element, event.getChecked());
- } else if (element instanceof IExecutionDMContext) {
- checkThread((IExecutionDMContext) element, event.getChecked());
- }
- }
-
- /**
- * Check or uncheck a debug target in the tree viewer. When a debug
- * target is checked, attempt to check all of the target's threads by
- * default. When a debug target is unchecked, uncheck all its threads.
- */
- protected void checkTarget(IContainerDMContext target, boolean checked) {
- getThreadViewer().setChecked(target, checked);
- getThreadViewer().setGrayed(target, false);
- getThreadViewer().expandToLevel(target, AbstractTreeViewer.ALL_LEVELS);
- IExecutionDMContext[] threads = syncGetThreads(target);
- for (int i = 0; i < threads.length; i++) {
- getThreadViewer().setChecked(threads[i], checked);
- getThreadViewer().setGrayed(threads[i], false);
- }
- }
-
- /**
- * Check or uncheck a thread. Update the thread's debug target.
- */
- protected void checkThread(IExecutionDMContext thread, boolean checked) {
- getThreadViewer().setChecked(thread, checked);
- IContainerDMContext target = DMContexts.getAncestorOfType(thread, IContainerDMContext.class);
- IExecutionDMContext[] threads = syncGetThreads(target);
- int checkedNumber = 0;
- for (int i = 0; i < threads.length; i++) {
- if (getThreadViewer().getChecked(threads[i])) {
- ++checkedNumber;
- }
- }
- if (checkedNumber == 0) {
- getThreadViewer().setChecked(target, false);
- getThreadViewer().setGrayed(target, false);
- } else if (checkedNumber == threads.length) {
- getThreadViewer().setChecked(target, true);
- getThreadViewer().setGrayed(target, false);
- } else {
- getThreadViewer().setGrayChecked(target, true);
- }
- }
- }
-
- public class ThreadFilterContentProvider implements ITreeContentProvider {
-
- public ThreadFilterContentProvider() {
- super();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
- */
- @Override
- public Object[] getChildren(Object parent) {
- if (parent instanceof IContainerDMContext) {
- return syncGetThreads((IContainerDMContext) parent);
- }
-
- if (parent instanceof ILaunchManager) {
- List<Object> children = new ArrayList<Object>();
- ILaunch[] launches = ((ILaunchManager) parent).getLaunches();
- IContainerDMContext[] targetArray;
- for (int i = 0; i < launches.length; i++) {
- if (launches[i] instanceof GdbLaunch) {
- targetArray = syncGetContainers((GdbLaunch) launches[i]);
- children.addAll(Arrays.asList(targetArray));
- }
- }
- return children.toArray();
- }
- return new Object[0];
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
- */
- @Override
- public Object getParent(Object element) {
- if (element instanceof IContainerDMContext) {
- return DebugPlugin.getDefault().getLaunchManager();
- }
- if (element instanceof IExecutionDMContext) {
- return DMContexts.getAncestorOfType((IExecutionDMContext) element, IContainerDMContext.class);
- }
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
- */
- @Override
- public boolean hasChildren(Object element) {
- return getChildren(element).length > 0;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
- */
- @Override
- public Object[] getElements(Object inputElement) {
- return getChildren(inputElement);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
- @Override
- public void dispose() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer,
- * java.lang.Object, java.lang.Object)
- */
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
- }
-
- public class ThreadFilterLabelProvider extends LabelProvider {
-
- @Override
- public Image getImage(Object element) {
- if (element instanceof IContainerDMContext) {
- return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_DEBUG_TARGET);
- } else {
- return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_THREAD_RUNNING);
- }
- }
-
- @Override
- public String getText(Object element) {
- if (element instanceof IContainerDMContext) {
- return syncGetContainerLabel((IContainerDMContext)element);
- } else {
- return syncGetThreadLabel((IExecutionDMContext)element);
- }
- }
- }
-
-
- private CBreakpointGdbThreadFilterPage fPage;
-
- private CheckboxTreeViewer fThreadViewer;
-
- private ThreadFilterContentProvider fContentProvider;
-
- private CheckHandler fCheckHandler;
-
- public GdbThreadFilterEditor(Composite parent, CBreakpointGdbThreadFilterPage page) {
- fPage = page;
- fContentProvider = new ThreadFilterContentProvider();
- fCheckHandler = new CheckHandler();
- createThreadViewer(parent);
- }
-
- protected CBreakpointGdbThreadFilterPage getPage() {
- return fPage;
- }
-
- private void createThreadViewer(Composite parent) {
- Label label = new Label(parent, SWT.NONE);
- label.setText(Messages.GdbThreadFilterEditor_RestrictToSelected);
- label.setFont(parent.getFont());
- label.setLayoutData(new GridData());
- GridData data = new GridData(GridData.FILL_BOTH);
- data.heightHint = 100;
- fThreadViewer = new CheckboxTreeViewer(parent, SWT.BORDER);
- fThreadViewer.addCheckStateListener(fCheckHandler);
- fThreadViewer.getTree().setLayoutData(data);
- fThreadViewer.getTree().setFont(parent.getFont());
- fThreadViewer.setContentProvider(fContentProvider);
- fThreadViewer.setLabelProvider(new ThreadFilterLabelProvider());
- fThreadViewer.setInput(DebugPlugin.getDefault().getLaunchManager());
- setInitialCheckedState();
- }
-
- /**
- * Returns the debug targets that appear in the tree
- */
- protected IContainerDMContext[] getDebugTargets() {
- Object input = fThreadViewer.getInput();
- if (!(input instanceof ILaunchManager)) {
- return new IContainerDMContext[0];
- }
- List<Object> targets = new ArrayList<Object>();
- ILaunch[] launches = ((ILaunchManager) input).getLaunches();
- IContainerDMContext[] targetArray;
- for (int i = 0; i < launches.length; i++) {
- if (launches[i] instanceof GdbLaunch) {
- targetArray = syncGetContainers((GdbLaunch) launches[i]);
- targets.addAll(Arrays.asList(targetArray));
- }
- }
- return targets.toArray(new IContainerDMContext[targets.size()]);
- }
-
- protected CheckboxTreeViewer getThreadViewer() {
- return fThreadViewer;
- }
-
- /**
- * Sets the initial checked state of the tree viewer. The initial state
- * should reflect the current state of the breakpoint. If the breakpoint has
- * a thread filter in a given thread, that thread should be checked.
- */
- protected void setInitialCheckedState() {
- IDsfBreakpointExtension filterExtension = fPage.getFilterExtension();
- try {
- IContainerDMContext[] targets = filterExtension.getTargetFilters();
-
- for (int i = 0; i < targets.length; i++) {
- IExecutionDMContext[] filteredThreads = filterExtension.getThreadFilters(targets[i]);
- if (filteredThreads != null) {
- for (int j = 0; j < filteredThreads.length; ++j) {
- // Mark this thread as selected
- fCheckHandler.checkThread(filteredThreads[j], true);
- }
- } else {
- // Mark the entire process as selected
- fCheckHandler.checkTarget(targets[i], true);
- }
- }
- } catch (CoreException e) {
- CDebugUIPlugin.log(e);
- }
- }
-
- protected void doStore() {
- IDsfBreakpointExtension filterExtension = fPage.getFilterExtension();
- IContainerDMContext[] targets = getDebugTargets();
- for (int i = 0; i < targets.length; ++i) {
- try {
- if (getThreadViewer().getChecked(targets[i])) {
- if (getThreadViewer().getGrayed(targets[i])) {
- IExecutionDMContext[] threads = getTargetThreadFilters(targets[i]);
- filterExtension.setThreadFilters(threads);
- } else {
- filterExtension.setTargetFilter(targets[i]);
- }
- } else {
- filterExtension.removeTargetFilter(targets[i]);
- }
- DebugPlugin.getDefault().getBreakpointManager().fireBreakpointChanged(fPage.getBreakpoint());
- } catch (CoreException e) {
- CDebugUIPlugin.log(e);
- }
- }
- }
-
- private IExecutionDMContext[] getTargetThreadFilters(IContainerDMContext target) {
- Object[] threads = ((ITreeContentProvider) getThreadViewer().getContentProvider()).getChildren(target);
- ArrayList<Object> list = new ArrayList<Object>(threads.length);
- for (int i = 0; i < threads.length; ++i) {
- if (getThreadViewer().getChecked(threads[i]))
- list.add(threads[i]);
- }
- return list.toArray(new IExecutionDMContext[list.size()]);
- }
-
- private IContainerDMContext[] syncGetContainers(final GdbLaunch launch) {
- final DsfSession session = launch.getSession();
-
- class ContainerQuery extends Query<IContainerDMContext[]> {
- @Override
- protected void execute(final DataRequestMonitor<IContainerDMContext[]> rm) {
- if (!session.isActive()) {
- rm.setStatus(getFailStatus(IDsfStatusConstants.INVALID_STATE, "Launch's session not active.")); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- DsfServicesTracker tracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
- ICommandControlService commandControl = tracker.getService(ICommandControlService.class);
- IMIProcesses procService = tracker.getService(IMIProcesses.class);
-
- if (commandControl != null && procService != null) {
- procService.getProcessesBeingDebugged(
- commandControl.getContext(),
- new DataRequestMonitor<IDMContext[]>(session.getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- if (getData() instanceof IContainerDMContext[]) {
- IContainerDMContext[] containerDmcs = (IContainerDMContext[])getData();
- rm.setData(containerDmcs);
- } else {
- rm.setStatus(getFailStatus(IDsfStatusConstants.INVALID_STATE, "Wrong type of container contexts.")); //$NON-NLS-1$
- }
- rm.done();
- }
- });
- } else {
- rm.setStatus(getFailStatus(IDsfStatusConstants.INVALID_STATE, "GDB Control or Process service not accessible.")); //$NON-NLS-1$
- rm.done();
- }
- tracker.dispose();
- }
- }
-
- ContainerQuery query = new ContainerQuery();
- try {
- session.getExecutor().execute(query);
- return query.get();
- } catch (RejectedExecutionException e) {
- } catch (InterruptedException e) {
- } catch (ExecutionException e) {
- }
- return new IContainerDMContext[0];
- }
-
- private IExecutionDMContext[] syncGetThreads(final IContainerDMContext container) {
- final DsfSession session = DsfSession.getSession(container.getSessionId());
- if (session == null) {
- return new IExecutionDMContext[0];
- }
-
- class ThreadsQuery extends Query<IExecutionDMContext[]> {
- @Override
- protected void execute(DataRequestMonitor<IExecutionDMContext[]> rm) {
- if (!session.isActive()) {
- rm.setStatus(getFailStatus(IDsfStatusConstants.INVALID_STATE, "Container's session not active.")); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- DsfServicesTracker tracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
- IRunControl runControl = tracker.getService(IRunControl.class);
- if (runControl != null) {
- runControl.getExecutionContexts(container, rm);
- } else {
- rm.setStatus(getFailStatus(IDsfStatusConstants.INVALID_STATE, "GDB Control not accessible.")); //$NON-NLS-1$
- rm.done();
- }
- tracker.dispose();
- }
- }
-
- ThreadsQuery query = new ThreadsQuery();
- try {
- session.getExecutor().execute(query);
- return query.get();
- } catch (RejectedExecutionException e) {
- } catch (InterruptedException e) {
- } catch (ExecutionException e) {
- }
- return new IExecutionDMContext[0];
- }
-
- private String syncGetContainerLabel(final IContainerDMContext container) {
- final DsfSession session = DsfSession.getSession(container.getSessionId());
- if (session == null) {
- return "Error reading data"; //$NON-NLS-1$
- }
-
- class ContainerLabelQuery extends Query<String> {
- @Override
- protected void execute(final DataRequestMonitor<String> rm) {
- if (!session.isActive()) {
- rm.setStatus(getFailStatus(IDsfStatusConstants.INVALID_STATE, "Container's session not active.")); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- DsfServicesTracker tracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
- IProcesses processService = tracker.getService(IProcesses.class);
- IProcessDMContext procDmc = DMContexts.getAncestorOfType(container, IProcessDMContext.class);
- if (processService != null && procDmc != null) {
- processService.getExecutionData(
- procDmc,
- new ImmediateDataRequestMonitor<IThreadDMData>(rm) {
- @Override
- public void handleSuccess() {
- final StringBuilder builder = new StringBuilder(getData().getName());
- String containerId = getData().getId();
- if (containerId != null) {
- builder.append(" ["); //$NON-NLS-1$
- builder.append(containerId);
- builder.append("]"); //$NON-NLS-1$
- }
-
- rm.setData(builder.toString());
- rm.done();
- }
- });
- } else {
- rm.setStatus(getFailStatus(IDsfStatusConstants.INVALID_STATE, "Processes service not accessible.")); //$NON-NLS-1$
- rm.done();
- }
- tracker.dispose();
- }
- }
-
- ContainerLabelQuery query = new ContainerLabelQuery();
- try {
- session.getExecutor().execute(query);
- return query.get();
- } catch (RejectedExecutionException e) {
- } catch (InterruptedException e) {
- } catch (ExecutionException e) {
- }
- return "Error reading data"; //$NON-NLS-1$
- }
-
- private String syncGetThreadLabel(final IExecutionDMContext thread) {
- final DsfSession session = DsfSession.getSession(thread.getSessionId());
- if (session == null) {
- return "Error reading data"; //$NON-NLS-1$
- }
-
- class ThreadLabelQuery extends Query<String> {
- @Override
- protected void execute(final DataRequestMonitor<String> rm) {
- if (!session.isActive()) {
- rm.setStatus(getFailStatus(IDsfStatusConstants.INVALID_STATE, "Container's session not active.")); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- DsfServicesTracker tracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
- IProcesses procService = tracker.getService(IProcesses.class);
- if (procService != null) {
- IThreadDMContext threadDmc = DMContexts.getAncestorOfType(thread, IThreadDMContext.class);
- procService.getExecutionData(threadDmc, new ImmediateDataRequestMonitor<IThreadDMData>(rm) {
- @Override
- protected void handleSuccess() {
- final StringBuilder builder = new StringBuilder(Messages.GdbThreadFilterEditor_Thread);
- builder.append(" #"); //$NON-NLS-1$
- builder.append(((IMIExecutionDMContext)thread).getThreadId());
-
- String threadName = getData().getName();
- if (threadName != null) {
- builder.append(" ["); //$NON-NLS-1$
- builder.append(threadName);
- builder.append("] "); //$NON-NLS-1$
- }
-
- String threadId = getData().getId();
- if (threadId != null) {
- builder.append(threadId);
- }
-
- rm.setData(builder.toString());
- rm.done();
- }
- });
- } else {
- rm.setStatus(getFailStatus(IDsfStatusConstants.INVALID_STATE, "IProcesses service not accessible.")); //$NON-NLS-1$
- rm.done();
- }
- tracker.dispose();
- }
- }
-
- ThreadLabelQuery query = new ThreadLabelQuery();
- try {
- session.getExecutor().execute(query);
- return query.get();
- } catch (RejectedExecutionException e) {
- } catch (InterruptedException e) {
- } catch (ExecutionException e) {
- }
- return "Error reading data"; //$NON-NLS-1$
- }
-
- private Status getFailStatus(int code, String message) {
- return new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, code, message, null);
- }
+ public class CheckHandler implements ICheckStateListener {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.ICheckStateListener#checkStateChanged(org.eclipse.jface.viewers.CheckStateChangedEvent)
+ */
+ @Override
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ Object element = event.getElement();
+ if (element instanceof IContainerDMContext) {
+ checkTarget((IContainerDMContext) element, event.getChecked());
+ } else if (element instanceof IExecutionDMContext) {
+ checkThread((IExecutionDMContext) element, event.getChecked());
+ }
+ }
+
+ /**
+ * Check or uncheck a debug target in the tree viewer. When a debug
+ * target is checked, attempt to check all of the target's threads by
+ * default. When a debug target is unchecked, uncheck all its threads.
+ */
+ protected void checkTarget(IContainerDMContext target, boolean checked) {
+ getThreadViewer().setChecked(target, checked);
+ getThreadViewer().setGrayed(target, false);
+ getThreadViewer().expandToLevel(target, AbstractTreeViewer.ALL_LEVELS);
+ IExecutionDMContext[] threads = syncGetThreads(target);
+ for (int i = 0; i < threads.length; i++) {
+ getThreadViewer().setChecked(threads[i], checked);
+ getThreadViewer().setGrayed(threads[i], false);
+ }
+ }
+
+ /**
+ * Check or uncheck a thread. Update the thread's debug target.
+ */
+ protected void checkThread(IExecutionDMContext thread, boolean checked) {
+ getThreadViewer().setChecked(thread, checked);
+ IContainerDMContext target = DMContexts.getAncestorOfType(thread, IContainerDMContext.class);
+ IExecutionDMContext[] threads = syncGetThreads(target);
+ int checkedNumber = 0;
+ for (int i = 0; i < threads.length; i++) {
+ if (getThreadViewer().getChecked(threads[i])) {
+ ++checkedNumber;
+ }
+ }
+ if (checkedNumber == 0) {
+ getThreadViewer().setChecked(target, false);
+ getThreadViewer().setGrayed(target, false);
+ } else if (checkedNumber == threads.length) {
+ getThreadViewer().setChecked(target, true);
+ getThreadViewer().setGrayed(target, false);
+ } else {
+ getThreadViewer().setGrayChecked(target, true);
+ }
+ }
+ }
+
+ public class ThreadFilterContentProvider implements ITreeContentProvider {
+
+ public ThreadFilterContentProvider() {
+ super();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
+ */
+ @Override
+ public Object[] getChildren(Object parent) {
+ if (parent instanceof IContainerDMContext) {
+ return syncGetThreads((IContainerDMContext) parent);
+ }
+
+ if (parent instanceof ILaunchManager) {
+ List<Object> children = new ArrayList<Object>();
+ ILaunch[] launches = ((ILaunchManager) parent).getLaunches();
+ IContainerDMContext[] targetArray;
+ for (int i = 0; i < launches.length; i++) {
+ if (launches[i] instanceof GdbLaunch) {
+ targetArray = syncGetContainers((GdbLaunch) launches[i]);
+ children.addAll(Arrays.asList(targetArray));
+ }
+ }
+ return children.toArray();
+ }
+ return new Object[0];
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
+ */
+ @Override
+ public Object getParent(Object element) {
+ if (element instanceof IContainerDMContext) {
+ return DebugPlugin.getDefault().getLaunchManager();
+ }
+ if (element instanceof IExecutionDMContext) {
+ return DMContexts.getAncestorOfType((IExecutionDMContext) element, IContainerDMContext.class);
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
+ */
+ @Override
+ public boolean hasChildren(Object element) {
+ return getChildren(element).length > 0;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+ */
+ @Override
+ public Object[] getElements(Object inputElement) {
+ return getChildren(inputElement);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+ */
+ @Override
+ public void dispose() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer,
+ * java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+ }
+
+ public class ThreadFilterLabelProvider extends LabelProvider {
+
+ @Override
+ public Image getImage(Object element) {
+ if (element instanceof IContainerDMContext) {
+ return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_DEBUG_TARGET);
+ } else {
+ return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_THREAD_RUNNING);
+ }
+ }
+
+ @Override
+ public String getText(Object element) {
+ if (element instanceof IContainerDMContext) {
+ return syncGetContainerLabel((IContainerDMContext) element);
+ } else {
+ return syncGetThreadLabel((IExecutionDMContext) element);
+ }
+ }
+ }
+
+ private CBreakpointGdbThreadFilterPage fPage;
+
+ private CheckboxTreeViewer fThreadViewer;
+
+ private ThreadFilterContentProvider fContentProvider;
+
+ private CheckHandler fCheckHandler;
+
+ public GdbThreadFilterEditor(Composite parent, CBreakpointGdbThreadFilterPage page) {
+ fPage = page;
+ fContentProvider = new ThreadFilterContentProvider();
+ fCheckHandler = new CheckHandler();
+ createThreadViewer(parent);
+ }
+
+ protected CBreakpointGdbThreadFilterPage getPage() {
+ return fPage;
+ }
+
+ private void createThreadViewer(Composite parent) {
+ Label label = new Label(parent, SWT.NONE);
+ label.setText(Messages.GdbThreadFilterEditor_RestrictToSelected);
+ label.setFont(parent.getFont());
+ label.setLayoutData(new GridData());
+ GridData data = new GridData(GridData.FILL_BOTH);
+ data.heightHint = 100;
+ fThreadViewer = new CheckboxTreeViewer(parent, SWT.BORDER);
+ fThreadViewer.addCheckStateListener(fCheckHandler);
+ fThreadViewer.getTree().setLayoutData(data);
+ fThreadViewer.getTree().setFont(parent.getFont());
+ fThreadViewer.setContentProvider(fContentProvider);
+ fThreadViewer.setLabelProvider(new ThreadFilterLabelProvider());
+ fThreadViewer.setInput(DebugPlugin.getDefault().getLaunchManager());
+ setInitialCheckedState();
+ }
+
+ /**
+ * Returns the debug targets that appear in the tree
+ */
+ protected IContainerDMContext[] getDebugTargets() {
+ Object input = fThreadViewer.getInput();
+ if (!(input instanceof ILaunchManager)) {
+ return new IContainerDMContext[0];
+ }
+ List<Object> targets = new ArrayList<Object>();
+ ILaunch[] launches = ((ILaunchManager) input).getLaunches();
+ IContainerDMContext[] targetArray;
+ for (int i = 0; i < launches.length; i++) {
+ if (launches[i] instanceof GdbLaunch) {
+ targetArray = syncGetContainers((GdbLaunch) launches[i]);
+ targets.addAll(Arrays.asList(targetArray));
+ }
+ }
+ return targets.toArray(new IContainerDMContext[targets.size()]);
+ }
+
+ protected CheckboxTreeViewer getThreadViewer() {
+ return fThreadViewer;
+ }
+
+ /**
+ * Sets the initial checked state of the tree viewer. The initial state
+ * should reflect the current state of the breakpoint. If the breakpoint has
+ * a thread filter in a given thread, that thread should be checked.
+ */
+ protected void setInitialCheckedState() {
+ IDsfBreakpointExtension filterExtension = fPage.getFilterExtension();
+ try {
+ IContainerDMContext[] targets = filterExtension.getTargetFilters();
+
+ for (int i = 0; i < targets.length; i++) {
+ IExecutionDMContext[] filteredThreads = filterExtension.getThreadFilters(targets[i]);
+ if (filteredThreads != null) {
+ for (int j = 0; j < filteredThreads.length; ++j) {
+ // Mark this thread as selected
+ fCheckHandler.checkThread(filteredThreads[j], true);
+ }
+ } else {
+ // Mark the entire process as selected
+ fCheckHandler.checkTarget(targets[i], true);
+ }
+ }
+ } catch (CoreException e) {
+ CDebugUIPlugin.log(e);
+ }
+ }
+
+ protected void doStore() {
+ IDsfBreakpointExtension filterExtension = fPage.getFilterExtension();
+ IContainerDMContext[] targets = getDebugTargets();
+ for (int i = 0; i < targets.length; ++i) {
+ try {
+ if (getThreadViewer().getChecked(targets[i])) {
+ if (getThreadViewer().getGrayed(targets[i])) {
+ IExecutionDMContext[] threads = getTargetThreadFilters(targets[i]);
+ filterExtension.setThreadFilters(threads);
+ } else {
+ filterExtension.setTargetFilter(targets[i]);
+ }
+ } else {
+ filterExtension.removeTargetFilter(targets[i]);
+ }
+ DebugPlugin.getDefault().getBreakpointManager().fireBreakpointChanged(fPage.getBreakpoint());
+ } catch (CoreException e) {
+ CDebugUIPlugin.log(e);
+ }
+ }
+ }
+
+ private IExecutionDMContext[] getTargetThreadFilters(IContainerDMContext target) {
+ Object[] threads = ((ITreeContentProvider) getThreadViewer().getContentProvider()).getChildren(target);
+ ArrayList<Object> list = new ArrayList<Object>(threads.length);
+ for (int i = 0; i < threads.length; ++i) {
+ if (getThreadViewer().getChecked(threads[i]))
+ list.add(threads[i]);
+ }
+ return list.toArray(new IExecutionDMContext[list.size()]);
+ }
+
+ private IContainerDMContext[] syncGetContainers(final GdbLaunch launch) {
+ final DsfSession session = launch.getSession();
+
+ class ContainerQuery extends Query<IContainerDMContext[]> {
+ @Override
+ protected void execute(final DataRequestMonitor<IContainerDMContext[]> rm) {
+ if (!session.isActive()) {
+ rm.setStatus(getFailStatus(IDsfStatusConstants.INVALID_STATE, "Launch's session not active.")); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ DsfServicesTracker tracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
+ ICommandControlService commandControl = tracker.getService(ICommandControlService.class);
+ IMIProcesses procService = tracker.getService(IMIProcesses.class);
+
+ if (commandControl != null && procService != null) {
+ procService.getProcessesBeingDebugged(commandControl.getContext(),
+ new DataRequestMonitor<IDMContext[]>(session.getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ if (getData() instanceof IContainerDMContext[]) {
+ IContainerDMContext[] containerDmcs = (IContainerDMContext[]) getData();
+ rm.setData(containerDmcs);
+ } else {
+ rm.setStatus(getFailStatus(IDsfStatusConstants.INVALID_STATE,
+ "Wrong type of container contexts.")); //$NON-NLS-1$
+ }
+ rm.done();
+ }
+ });
+ } else {
+ rm.setStatus(getFailStatus(IDsfStatusConstants.INVALID_STATE,
+ "GDB Control or Process service not accessible.")); //$NON-NLS-1$
+ rm.done();
+ }
+ tracker.dispose();
+ }
+ }
+
+ ContainerQuery query = new ContainerQuery();
+ try {
+ session.getExecutor().execute(query);
+ return query.get();
+ } catch (RejectedExecutionException e) {
+ } catch (InterruptedException e) {
+ } catch (ExecutionException e) {
+ }
+ return new IContainerDMContext[0];
+ }
+
+ private IExecutionDMContext[] syncGetThreads(final IContainerDMContext container) {
+ final DsfSession session = DsfSession.getSession(container.getSessionId());
+ if (session == null) {
+ return new IExecutionDMContext[0];
+ }
+
+ class ThreadsQuery extends Query<IExecutionDMContext[]> {
+ @Override
+ protected void execute(DataRequestMonitor<IExecutionDMContext[]> rm) {
+ if (!session.isActive()) {
+ rm.setStatus(getFailStatus(IDsfStatusConstants.INVALID_STATE, "Container's session not active.")); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ DsfServicesTracker tracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
+ IRunControl runControl = tracker.getService(IRunControl.class);
+ if (runControl != null) {
+ runControl.getExecutionContexts(container, rm);
+ } else {
+ rm.setStatus(getFailStatus(IDsfStatusConstants.INVALID_STATE, "GDB Control not accessible.")); //$NON-NLS-1$
+ rm.done();
+ }
+ tracker.dispose();
+ }
+ }
+
+ ThreadsQuery query = new ThreadsQuery();
+ try {
+ session.getExecutor().execute(query);
+ return query.get();
+ } catch (RejectedExecutionException e) {
+ } catch (InterruptedException e) {
+ } catch (ExecutionException e) {
+ }
+ return new IExecutionDMContext[0];
+ }
+
+ private String syncGetContainerLabel(final IContainerDMContext container) {
+ final DsfSession session = DsfSession.getSession(container.getSessionId());
+ if (session == null) {
+ return "Error reading data"; //$NON-NLS-1$
+ }
+
+ class ContainerLabelQuery extends Query<String> {
+ @Override
+ protected void execute(final DataRequestMonitor<String> rm) {
+ if (!session.isActive()) {
+ rm.setStatus(getFailStatus(IDsfStatusConstants.INVALID_STATE, "Container's session not active.")); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ DsfServicesTracker tracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
+ IProcesses processService = tracker.getService(IProcesses.class);
+ IProcessDMContext procDmc = DMContexts.getAncestorOfType(container, IProcessDMContext.class);
+ if (processService != null && procDmc != null) {
+ processService.getExecutionData(procDmc, new ImmediateDataRequestMonitor<IThreadDMData>(rm) {
+ @Override
+ public void handleSuccess() {
+ final StringBuilder builder = new StringBuilder(getData().getName());
+ String containerId = getData().getId();
+ if (containerId != null) {
+ builder.append(" ["); //$NON-NLS-1$
+ builder.append(containerId);
+ builder.append("]"); //$NON-NLS-1$
+ }
+
+ rm.setData(builder.toString());
+ rm.done();
+ }
+ });
+ } else {
+ rm.setStatus(getFailStatus(IDsfStatusConstants.INVALID_STATE, "Processes service not accessible.")); //$NON-NLS-1$
+ rm.done();
+ }
+ tracker.dispose();
+ }
+ }
+
+ ContainerLabelQuery query = new ContainerLabelQuery();
+ try {
+ session.getExecutor().execute(query);
+ return query.get();
+ } catch (RejectedExecutionException e) {
+ } catch (InterruptedException e) {
+ } catch (ExecutionException e) {
+ }
+ return "Error reading data"; //$NON-NLS-1$
+ }
+
+ private String syncGetThreadLabel(final IExecutionDMContext thread) {
+ final DsfSession session = DsfSession.getSession(thread.getSessionId());
+ if (session == null) {
+ return "Error reading data"; //$NON-NLS-1$
+ }
+
+ class ThreadLabelQuery extends Query<String> {
+ @Override
+ protected void execute(final DataRequestMonitor<String> rm) {
+ if (!session.isActive()) {
+ rm.setStatus(getFailStatus(IDsfStatusConstants.INVALID_STATE, "Container's session not active.")); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ DsfServicesTracker tracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
+ IProcesses procService = tracker.getService(IProcesses.class);
+ if (procService != null) {
+ IThreadDMContext threadDmc = DMContexts.getAncestorOfType(thread, IThreadDMContext.class);
+ procService.getExecutionData(threadDmc, new ImmediateDataRequestMonitor<IThreadDMData>(rm) {
+ @Override
+ protected void handleSuccess() {
+ final StringBuilder builder = new StringBuilder(Messages.GdbThreadFilterEditor_Thread);
+ builder.append(" #"); //$NON-NLS-1$
+ builder.append(((IMIExecutionDMContext) thread).getThreadId());
+
+ String threadName = getData().getName();
+ if (threadName != null) {
+ builder.append(" ["); //$NON-NLS-1$
+ builder.append(threadName);
+ builder.append("] "); //$NON-NLS-1$
+ }
+
+ String threadId = getData().getId();
+ if (threadId != null) {
+ builder.append(threadId);
+ }
+
+ rm.setData(builder.toString());
+ rm.done();
+ }
+ });
+ } else {
+ rm.setStatus(
+ getFailStatus(IDsfStatusConstants.INVALID_STATE, "IProcesses service not accessible.")); //$NON-NLS-1$
+ rm.done();
+ }
+ tracker.dispose();
+ }
+ }
+
+ ThreadLabelQuery query = new ThreadLabelQuery();
+ try {
+ session.getExecutor().execute(query);
+ return query.get();
+ } catch (RejectedExecutionException e) {
+ } catch (InterruptedException e) {
+ } catch (ExecutionException e) {
+ }
+ return "Error reading data"; //$NON-NLS-1$
+ }
+
+ private Status getFailStatus(int code, String message) {
+ return new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, code, message, null);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/Messages.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/Messages.java
index c999542996b..258672542f4 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/Messages.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/Messages.java
@@ -43,7 +43,7 @@ public class Messages extends NLS {
public static String GdbThreadFilterEditor_Thread;
public static String GdbThreadFilterEditor_RestrictToSelected;
-
+
static {
// initialize resource bundle
NLS.initializeMessages(Messages.class.getName(), Messages.class);
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/ToggleDynamicPrintfTargetFactory.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/ToggleDynamicPrintfTargetFactory.java
index dbf705145dd..6a9f1193941 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/ToggleDynamicPrintfTargetFactory.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/ToggleDynamicPrintfTargetFactory.java
@@ -28,7 +28,7 @@ import org.eclipse.ui.IWorkbenchPart;
* Toggle DynamicPrintf target factory for disassembly parts.
* We use a separate factory because the tracepoint factory is controlled
* through an action set, while the breakpoint factory is down in DSF (not DSF-GDB).
- *
+ *
* @since 2.4
*/
public class ToggleDynamicPrintfTargetFactory implements IToggleBreakpointsTargetFactory {
@@ -45,8 +45,9 @@ public class ToggleDynamicPrintfTargetFactory implements IToggleBreakpointsTarge
* leaving <code>ToggleCDynamicPrintfTargetFactory</code> to return the same id
* for the editor.
*/
- public static final String TOGGLE_C_DYNAMICPRINTF_TARGET_ID = CDebugUIPlugin.PLUGIN_ID + ".toggleCDynamicPrintfTarget"; //$NON-NLS-1$
-
+ public static final String TOGGLE_C_DYNAMICPRINTF_TARGET_ID = CDebugUIPlugin.PLUGIN_ID
+ + ".toggleCDynamicPrintfTarget"; //$NON-NLS-1$
+
private static final Set<String> TOGGLE_TARGET_IDS_ALL = new HashSet<String>(1);
static {
TOGGLE_TARGET_IDS_ALL.add(TOGGLE_C_DYNAMICPRINTF_TARGET_ID);
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/ToggleTracepointsTargetFactory.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/ToggleTracepointsTargetFactory.java
index 72935b52442..1a81de7abf5 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/ToggleTracepointsTargetFactory.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/ToggleTracepointsTargetFactory.java
@@ -45,7 +45,7 @@ public class ToggleTracepointsTargetFactory implements IToggleBreakpointsTargetF
* for the editor.
*/
public static final String TOGGLE_C_TRACEPOINT_TARGET_ID = CDebugUIPlugin.PLUGIN_ID + ".toggleCTracepointTarget"; //$NON-NLS-1$
-
+
private static final Set<String> TOGGLE_TARGET_IDS_ALL = new HashSet<String>(1);
static {
TOGGLE_TARGET_IDS_ALL.add(TOGGLE_C_TRACEPOINT_TARGET_ID);
@@ -56,7 +56,7 @@ public class ToggleTracepointsTargetFactory implements IToggleBreakpointsTargetF
public ToggleTracepointsTargetFactory() {
}
- @Override
+ @Override
public IToggleBreakpointsTarget createToggleTarget(String targetID) {
if (TOGGLE_C_TRACEPOINT_TARGET_ID.equals(targetID)) {
return fgDisassemblyToggleTracepointsTarget;
@@ -64,12 +64,12 @@ public class ToggleTracepointsTargetFactory implements IToggleBreakpointsTargetF
return null;
}
- @Override
+ @Override
public String getDefaultToggleTarget(IWorkbenchPart part, ISelection selection) {
return null;
}
- @Override
+ @Override
public String getToggleTargetDescription(String targetID) {
if (TOGGLE_C_TRACEPOINT_TARGET_ID.equals(targetID)) {
return Messages.ToggleTracepointsTargetFactory_description;
@@ -77,7 +77,7 @@ public class ToggleTracepointsTargetFactory implements IToggleBreakpointsTargetF
return null;
}
- @Override
+ @Override
public String getToggleTargetName(String targetID) {
if (TOGGLE_C_TRACEPOINT_TARGET_ID.equals(targetID)) {
return Messages.ToggleTracepointsTargetFactory_name;
@@ -85,7 +85,7 @@ public class ToggleTracepointsTargetFactory implements IToggleBreakpointsTargetF
return null;
}
- @Override
+ @Override
public Set<String> getToggleTargets(IWorkbenchPart part, ISelection selection) {
if (part instanceof IDisassemblyPart) {
return TOGGLE_TARGET_IDS_ALL;
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/AddLocalsExpressionCommandHandler.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/AddLocalsExpressionCommandHandler.java
index ebcea69d60c..0f1129f2a5e 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/AddLocalsExpressionCommandHandler.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/AddLocalsExpressionCommandHandler.java
@@ -21,7 +21,7 @@ import org.eclipse.debug.core.IExpressionManager;
/**
* Handling of adding group of locals into expression view
- *
+ *
* @since 2.4
*/
public class AddLocalsExpressionCommandHandler extends AbstractHandler {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/AddRegistersExpressionCommandHandler.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/AddRegistersExpressionCommandHandler.java
index 2ec7390f257..467d776829c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/AddRegistersExpressionCommandHandler.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/AddRegistersExpressionCommandHandler.java
@@ -15,7 +15,7 @@ package org.eclipse.cdt.dsf.gdb.internal.ui.commands;
/**
* Handling of adding group of registers into expression view
- *
+ *
* @since 2.4
*/
public class AddRegistersExpressionCommandHandler extends AddLocalsExpressionCommandHandler {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbAbstractReverseStepCommand.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbAbstractReverseStepCommand.java
index 614a18ee4ce..eacb2c268f5 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbAbstractReverseStepCommand.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbAbstractReverseStepCommand.java
@@ -7,13 +7,12 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.commands;
-
import java.util.concurrent.ExecutionException;
import java.util.concurrent.RejectedExecutionException;
@@ -39,7 +38,7 @@ import org.eclipse.debug.core.commands.IEnabledStateRequest;
/**
* Base class handling the work of a Reverse Step command.
- *
+ *
* @since 2.1
*/
@Immutable
@@ -49,66 +48,68 @@ public abstract class GdbAbstractReverseStepCommand extends AbstractDebugCommand
private final DsfServicesTracker fTracker;
private final DsfSteppingModeTarget fSteppingMode;
- protected DsfSteppingModeTarget getSteppingMode() { return fSteppingMode; }
+ protected DsfSteppingModeTarget getSteppingMode() {
+ return fSteppingMode;
+ }
public GdbAbstractReverseStepCommand(DsfSession session, DsfSteppingModeTarget steppingMode) {
fExecutor = session.getExecutor();
fTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
fSteppingMode = steppingMode;
- }
+ }
public void dispose() {
fTracker.dispose();
}
- @Override
+ @Override
protected void doExecute(Object[] targets, IProgressMonitor monitor, IRequest request) throws CoreException {
- if (targets.length != 1) {
- return;
- }
-
- final IExecutionDMContext dmc = DMContexts.getAncestorOfType(((IDMVMContext)targets[0]).getDMContext(), IExecutionDMContext.class);
- if (dmc == null) {
- return;
- }
-
- final StepType stepType = getStepType();
- Query<Object> reverseStepQuery = new Query<Object>() {
- @Override
- public void execute(DataRequestMonitor<Object> rm) {
- IReverseRunControl runControl = fTracker.getService(IReverseRunControl.class);
-
- if (runControl != null) {
- runControl.reverseStep(dmc, stepType, rm);
- } else {
- rm.done();
- }
- }
- };
- try {
- fExecutor.execute(reverseStepQuery);
- reverseStepQuery.get();
- } catch (InterruptedException e) {
- } catch (ExecutionException e) {
- } catch (RejectedExecutionException e) {
- // Can be thrown if the session is shutdown
- }
- }
-
- @Override
+ if (targets.length != 1) {
+ return;
+ }
+
+ final IExecutionDMContext dmc = DMContexts.getAncestorOfType(((IDMVMContext) targets[0]).getDMContext(),
+ IExecutionDMContext.class);
+ if (dmc == null) {
+ return;
+ }
+
+ final StepType stepType = getStepType();
+ Query<Object> reverseStepQuery = new Query<Object>() {
+ @Override
+ public void execute(DataRequestMonitor<Object> rm) {
+ IReverseRunControl runControl = fTracker.getService(IReverseRunControl.class);
+
+ if (runControl != null) {
+ runControl.reverseStep(dmc, stepType, rm);
+ } else {
+ rm.done();
+ }
+ }
+ };
+ try {
+ fExecutor.execute(reverseStepQuery);
+ reverseStepQuery.get();
+ } catch (InterruptedException e) {
+ } catch (ExecutionException e) {
+ } catch (RejectedExecutionException e) {
+ // Can be thrown if the session is shutdown
+ }
+ }
+
+ @Override
protected boolean isExecutable(Object[] targets, IProgressMonitor monitor, IEnabledStateRequest request)
- throws CoreException
- {
- if (targets.length != 1) {
- return false;
- }
-
- final IExecutionDMContext dmc = DMContexts.getAncestorOfType(((IDMVMContext)targets[0]).getDMContext(), IExecutionDMContext.class);
- if (dmc == null) {
- return false;
- }
-
-
+ throws CoreException {
+ if (targets.length != 1) {
+ return false;
+ }
+
+ final IExecutionDMContext dmc = DMContexts.getAncestorOfType(((IDMVMContext) targets[0]).getDMContext(),
+ IExecutionDMContext.class);
+ if (dmc == null) {
+ return false;
+ }
+
final StepType stepType = getStepType();
Query<Boolean> canReverseQuery = new Query<Boolean>() {
@Override
@@ -133,17 +134,17 @@ public abstract class GdbAbstractReverseStepCommand extends AbstractDebugCommand
}
return false;
- }
-
- @Override
+ }
+
+ @Override
protected Object getTarget(Object element) {
- if (element instanceof IDMVMContext) {
- return element;
- }
- return null;
- }
-
- @Override
+ if (element instanceof IDMVMContext) {
+ return element;
+ }
+ return null;
+ }
+
+ @Override
protected boolean isRemainEnabled(IDebugCommandRequest request) {
return true;
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbConnectCommand.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbConnectCommand.java
index b86826a70b9..f825dd5a1fa 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbConnectCommand.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbConnectCommand.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
* Marc Khouzam (Ericsson) - Add support for multi-attach (Bug 293679)
@@ -80,264 +80,271 @@ public class GdbConnectCommand extends RefreshableDebugCommand implements IConne
private final ILaunch fLaunch;
private final DsfExecutor fExecutor;
- private final DsfServicesTracker fTracker;
-
- // A map of processName to path, that allows us to remember the path to the binary file
- // for a process with a particular name. We can then re-use the same binary for another
- // process with the same name. This allows a user to connect to multiple processes
- // with the same name without having to be prompted each time for a path.
- // This map is associated to the current debug session only, therefore the user can
- // reset it by using a new debug session.
- // This map is only needed for remote sessions, since we don't need to specify
- // the binary location for a local attach session.
- private Map<String, String> fProcessNameToBinaryMap = new HashMap<String, String>();
-
- public GdbConnectCommand(DsfSession session, ILaunch launch) {
- fLaunch = launch;
- fExecutor = session.getExecutor();
- fTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
- }
-
- public void dispose() {
- fTracker.dispose();
- }
-
- @Override
+ private final DsfServicesTracker fTracker;
+
+ // A map of processName to path, that allows us to remember the path to the binary file
+ // for a process with a particular name. We can then re-use the same binary for another
+ // process with the same name. This allows a user to connect to multiple processes
+ // with the same name without having to be prompted each time for a path.
+ // This map is associated to the current debug session only, therefore the user can
+ // reset it by using a new debug session.
+ // This map is only needed for remote sessions, since we don't need to specify
+ // the binary location for a local attach session.
+ private Map<String, String> fProcessNameToBinaryMap = new HashMap<String, String>();
+
+ public GdbConnectCommand(DsfSession session, ILaunch launch) {
+ fLaunch = launch;
+ fExecutor = session.getExecutor();
+ fTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
+ }
+
+ public void dispose() {
+ fTracker.dispose();
+ }
+
+ @Override
protected boolean isExecutable(Object[] targets, IProgressMonitor monitor, IEnabledStateRequest request)
- throws CoreException
- {
- return canConnect();
- }
-
- /*
- * This method should not be called from the UI thread.
- * (non-Javadoc)
- * @see org.eclipse.cdt.dsf.gdb.actions.IConnect#canConnect()
- */
+ throws CoreException {
+ return canConnect();
+ }
+
+ /*
+ * This method should not be called from the UI thread.
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.dsf.gdb.actions.IConnect#canConnect()
+ */
@Override
public boolean canConnect() {
- Query<Boolean> canConnectQuery = new Query<Boolean>() {
- @Override
- public void execute(DataRequestMonitor<Boolean> rm) {
- IProcesses procService = fTracker.getService(IProcesses.class);
- ICommandControlService commandControl = fTracker.getService(ICommandControlService.class);
-
- if (procService != null && commandControl != null) {
- procService.isDebuggerAttachSupported(commandControl.getContext(), rm);
- } else {
- rm.setData(false);
- rm.done();
- }
- }
- };
- try {
- fExecutor.execute(canConnectQuery);
+ Query<Boolean> canConnectQuery = new Query<Boolean>() {
+ @Override
+ public void execute(DataRequestMonitor<Boolean> rm) {
+ IProcesses procService = fTracker.getService(IProcesses.class);
+ ICommandControlService commandControl = fTracker.getService(ICommandControlService.class);
+
+ if (procService != null && commandControl != null) {
+ procService.isDebuggerAttachSupported(commandControl.getContext(), rm);
+ } else {
+ rm.setData(false);
+ rm.done();
+ }
+ }
+ };
+ try {
+ fExecutor.execute(canConnectQuery);
return canConnectQuery.get();
} catch (InterruptedException e) {
} catch (ExecutionException e) {
- } catch (RejectedExecutionException e) {
- // Can be thrown if the session is shutdown
- }
+ } catch (RejectedExecutionException e) {
+ // Can be thrown if the session is shutdown
+ }
return false;
- }
-
- /**
- * This job will prompt the user to select a set of processes
- * to attach too.
- * We need a job because the ProcessPrompter will block and
- * we don't want to block the executor.
- */
- protected class PromptForPidJob extends UIJob {
-
- // The list of processes used in the case of an ATTACH session
- IProcessExtendedInfo[] fProcessList = null;
- DataRequestMonitor<Object> fRequestMonitor;
+ }
+
+ /**
+ * This job will prompt the user to select a set of processes
+ * to attach too.
+ * We need a job because the ProcessPrompter will block and
+ * we don't want to block the executor.
+ */
+ protected class PromptForPidJob extends UIJob {
+
+ // The list of processes used in the case of an ATTACH session
+ IProcessExtendedInfo[] fProcessList = null;
+ DataRequestMonitor<Object> fRequestMonitor;
private List<String> fDebuggedProcesses;
- public PromptForPidJob(String name, IProcessExtendedInfo[] procs, List<String> debuggedProcesses, DataRequestMonitor<Object> rm) {
- super(name);
- fProcessList = procs;
- fRequestMonitor = rm;
- fDebuggedProcesses = debuggedProcesses;
- }
-
- @Override
- public IStatus runInUIThread(IProgressMonitor monitor) {
- final Status NO_PID_STATUS = new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, -1,
- LaunchMessages.getString("LocalAttachLaunchDelegate.No_Process_ID_selected"), //$NON-NLS-1$
- null);
-
- try {
- PrompterInfo info = new PrompterInfo(fProcessList, fDebuggedProcesses);
- Object result = new ProcessPrompter().handleStatus(null, info);
- if (result == null) {
- fRequestMonitor.cancel();
- } else if (result instanceof IProcessExtendedInfo[]) {
- fRequestMonitor.setData(result);
- } else if (result instanceof Integer) {
- // This is the case where the user typed in a pid number directly
- fRequestMonitor.setData(new IProcessExtendedInfo[] { new ProcessInfo((Integer)result, "")}); //$NON-NLS-1$
- } else {
- fRequestMonitor.setStatus(NO_PID_STATUS);
- }
- } catch (CoreException e) {
- fRequestMonitor.setStatus(NO_PID_STATUS);
- }
- fRequestMonitor.done();
-
- return Status.OK_STATUS;
- }
- };
-
- /**
- * This job will prompt the user for a path to the binary to use,
- * and then will attach to the process.
- * We need a job to free the executor while we prompt the user for
- * a binary path. Bug 344892
- */
- private class PromptAndAttachToProcessJob extends UIJob {
- private final String fPid;
- private final RequestMonitor fRm;
- private final String fTitle;
- private final String fProcName;
-
- public PromptAndAttachToProcessJob(String pid, String title, String procName, RequestMonitor rm) {
- super(""); //$NON-NLS-1$
- fPid = pid;
- fTitle = title;
- fProcName = procName;
- fRm = rm;
- }
-
- @Override
- public IStatus runInUIThread(IProgressMonitor monitor) {
-
- // Have we already see the binary for a process with this name?
- String binaryPath = fProcessNameToBinaryMap.get(fProcName);
-
- if (binaryPath == null) {
- // prompt for the binary path
- Shell shell = GdbUIPlugin.getShell();
-
- if (shell != null) {
- FileDialog fd = new FileDialog(shell, SWT.NONE);
- fd.setText(fTitle);
- binaryPath = fd.open();
- }
- }
-
- if (binaryPath == null) {
- // The user pressed the cancel button, so we cancel the attach gracefully
- fRm.done();
- } else {
-
- final String finalBinaryPath = binaryPath;
- fExecutor.execute(new DsfRunnable() {
- @Override
- public void run() {
- IGDBProcesses procService = fTracker.getService(IGDBProcesses.class);
- ICommandControlService commandControl = fTracker.getService(ICommandControlService.class);
-
- if (procService != null && commandControl != null) {
- IProcessDMContext procDmc = procService.createProcessContext(commandControl.getContext(), fPid);
- procService.attachDebuggerToProcess(procDmc, finalBinaryPath, new DataRequestMonitor<IDMContext>(fExecutor, fRm) {
- @Override
- protected void handleSuccess() {
- // Store the path of the binary so we can use it again for another process
- // with the same name. Only do this on success, to avoid being stuck with
- // a path that is invalid.
- if (fProcName != null && !fProcName.isEmpty()) {
- fProcessNameToBinaryMap.put(fProcName, finalBinaryPath);
- }
- fRm.done();
- };
- });
-
- } else {
- fRm.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR, "Cannot find services", null)); //$NON-NLS-1$
- fRm.done();
- }
- }
- });
- }
-
- return Status.OK_STATUS;
- }
- }
-
- @Override
+ public PromptForPidJob(String name, IProcessExtendedInfo[] procs, List<String> debuggedProcesses,
+ DataRequestMonitor<Object> rm) {
+ super(name);
+ fProcessList = procs;
+ fRequestMonitor = rm;
+ fDebuggedProcesses = debuggedProcesses;
+ }
+
+ @Override
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ final Status NO_PID_STATUS = new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, -1,
+ LaunchMessages.getString("LocalAttachLaunchDelegate.No_Process_ID_selected"), //$NON-NLS-1$
+ null);
+
+ try {
+ PrompterInfo info = new PrompterInfo(fProcessList, fDebuggedProcesses);
+ Object result = new ProcessPrompter().handleStatus(null, info);
+ if (result == null) {
+ fRequestMonitor.cancel();
+ } else if (result instanceof IProcessExtendedInfo[]) {
+ fRequestMonitor.setData(result);
+ } else if (result instanceof Integer) {
+ // This is the case where the user typed in a pid number directly
+ fRequestMonitor.setData(new IProcessExtendedInfo[] { new ProcessInfo((Integer) result, "") }); //$NON-NLS-1$
+ } else {
+ fRequestMonitor.setStatus(NO_PID_STATUS);
+ }
+ } catch (CoreException e) {
+ fRequestMonitor.setStatus(NO_PID_STATUS);
+ }
+ fRequestMonitor.done();
+
+ return Status.OK_STATUS;
+ }
+ };
+
+ /**
+ * This job will prompt the user for a path to the binary to use,
+ * and then will attach to the process.
+ * We need a job to free the executor while we prompt the user for
+ * a binary path. Bug 344892
+ */
+ private class PromptAndAttachToProcessJob extends UIJob {
+ private final String fPid;
+ private final RequestMonitor fRm;
+ private final String fTitle;
+ private final String fProcName;
+
+ public PromptAndAttachToProcessJob(String pid, String title, String procName, RequestMonitor rm) {
+ super(""); //$NON-NLS-1$
+ fPid = pid;
+ fTitle = title;
+ fProcName = procName;
+ fRm = rm;
+ }
+
+ @Override
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+
+ // Have we already see the binary for a process with this name?
+ String binaryPath = fProcessNameToBinaryMap.get(fProcName);
+
+ if (binaryPath == null) {
+ // prompt for the binary path
+ Shell shell = GdbUIPlugin.getShell();
+
+ if (shell != null) {
+ FileDialog fd = new FileDialog(shell, SWT.NONE);
+ fd.setText(fTitle);
+ binaryPath = fd.open();
+ }
+ }
+
+ if (binaryPath == null) {
+ // The user pressed the cancel button, so we cancel the attach gracefully
+ fRm.done();
+ } else {
+
+ final String finalBinaryPath = binaryPath;
+ fExecutor.execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ IGDBProcesses procService = fTracker.getService(IGDBProcesses.class);
+ ICommandControlService commandControl = fTracker.getService(ICommandControlService.class);
+
+ if (procService != null && commandControl != null) {
+ IProcessDMContext procDmc = procService.createProcessContext(commandControl.getContext(),
+ fPid);
+ procService.attachDebuggerToProcess(procDmc, finalBinaryPath,
+ new DataRequestMonitor<IDMContext>(fExecutor, fRm) {
+ @Override
+ protected void handleSuccess() {
+ // Store the path of the binary so we can use it again for another process
+ // with the same name. Only do this on success, to avoid being stuck with
+ // a path that is invalid.
+ if (fProcName != null && !fProcName.isEmpty()) {
+ fProcessNameToBinaryMap.put(fProcName, finalBinaryPath);
+ }
+ fRm.done();
+ };
+ });
+
+ } else {
+ fRm.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID,
+ IDsfStatusConstants.INTERNAL_ERROR, "Cannot find services", null)); //$NON-NLS-1$
+ fRm.done();
+ }
+ }
+ });
+ }
+
+ return Status.OK_STATUS;
+ }
+ }
+
+ @Override
protected void doExecute(Object[] targets, IProgressMonitor monitor, final IRequest request) throws CoreException {
- Query<Boolean> connectQuery = new Query<Boolean>() {
- @Override
- public void execute(final DataRequestMonitor<Boolean> rm) {
- connect(new RequestMonitor(fExecutor, rm) {
- @Override
- protected void handleCompleted() {
- // pass any error to the caller
- if (!isSuccess()) {
- request.setStatus(getStatus());
- }
- rm.done();
- }
- });
- }
- };
- try {
- fExecutor.execute(connectQuery);
+ Query<Boolean> connectQuery = new Query<Boolean>() {
+ @Override
+ public void execute(final DataRequestMonitor<Boolean> rm) {
+ connect(new RequestMonitor(fExecutor, rm) {
+ @Override
+ protected void handleCompleted() {
+ // pass any error to the caller
+ if (!isSuccess()) {
+ request.setStatus(getStatus());
+ }
+ rm.done();
+ }
+ });
+ }
+ };
+ try {
+ fExecutor.execute(connectQuery);
connectQuery.get();
} catch (InterruptedException e) {
} catch (ExecutionException e) {
} catch (CancellationException e) {
// Nothing to do, just ignore the command since the user
// cancelled it.
- } catch (RejectedExecutionException e) {
- // Can be thrown if the session is shutdown
- } finally {
- updateEnablement();
- }
- }
-
- /**
- * Get already debugged processes from all compatible sessions.
- * "compatible" in current implementation means all sessions on local machine.
- *
- * @param currentCtx current session context
- * @param allSessions true if all session to be queried, false to return result only for current execution session context
- * @param drm where result to be returned
- */
- private void getAllDebuggedProcesses(final IDMContext currentCtx, boolean allSessions, final DataRequestMonitor<List<String>> drm) {
- SessionType sessionType = fTracker.getService(IGDBBackend.class).getSessionType();
-
- final List<String> result = new LinkedList<>();
- final List<DsfSession> sessions = new LinkedList<>();
- // Only for local session types search in all debug sessions
- if (allSessions && sessionType == SessionType.LOCAL) {
- sessions.addAll(Arrays.asList(DsfSession.getActiveSessions()));
- } else {
- // For remote session just query current context.
- //
- // cannot reliably match two remote debug session that are connected to same target machine.
- // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=486408#c7
-
- sessions.add(DsfSession.getSession(currentCtx.getSessionId()));
- }
-
- // Query each sessions for existing processes in a sequential fashion.
- // We must do this as each session will require different executor.
- final class ProcessRequestMonitor extends DataRequestMonitor<IDMContext[]> {
- public ProcessRequestMonitor(Executor executor) { super(executor, null);}
+ } catch (RejectedExecutionException e) {
+ // Can be thrown if the session is shutdown
+ } finally {
+ updateEnablement();
+ }
+ }
+
+ /**
+ * Get already debugged processes from all compatible sessions.
+ * "compatible" in current implementation means all sessions on local machine.
+ *
+ * @param currentCtx current session context
+ * @param allSessions true if all session to be queried, false to return result only for current execution session context
+ * @param drm where result to be returned
+ */
+ private void getAllDebuggedProcesses(final IDMContext currentCtx, boolean allSessions,
+ final DataRequestMonitor<List<String>> drm) {
+ SessionType sessionType = fTracker.getService(IGDBBackend.class).getSessionType();
+
+ final List<String> result = new LinkedList<>();
+ final List<DsfSession> sessions = new LinkedList<>();
+ // Only for local session types search in all debug sessions
+ if (allSessions && sessionType == SessionType.LOCAL) {
+ sessions.addAll(Arrays.asList(DsfSession.getActiveSessions()));
+ } else {
+ // For remote session just query current context.
+ //
+ // cannot reliably match two remote debug session that are connected to same target machine.
+ // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=486408#c7
+
+ sessions.add(DsfSession.getSession(currentCtx.getSessionId()));
+ }
+
+ // Query each sessions for existing processes in a sequential fashion.
+ // We must do this as each session will require different executor.
+ final class ProcessRequestMonitor extends DataRequestMonitor<IDMContext[]> {
+ public ProcessRequestMonitor(Executor executor) {
+ super(executor, null);
+ }
+
public ProcessRequestMonitor(DsfExecutor executor) {
super(new ImmediateInDsfExecutor(executor), null);
}
+
@Override
protected void handleCompleted() {
- // if succeeded and has data, add process ids to result,
+ // if succeeded and has data, add process ids to result,
// otherwise proceed to next debug session (aka DsfSession)
if (isSuccess() && getData() != null) {
for (IDMContext dmc : getData()) {
- IMIProcessDMContext procDmc = DMContexts.getAncestorOfType(dmc,
- IMIProcessDMContext.class);
+ IMIProcessDMContext procDmc = DMContexts.getAncestorOfType(dmc, IMIProcessDMContext.class);
if (procDmc != null) {
result.add(procDmc.getProcId());
}
@@ -349,95 +356,109 @@ public class GdbConnectCommand extends RefreshableDebugCommand implements IConne
nextSession.getExecutor().execute(new DsfRunnable() {
@Override
public void run() {
- DsfServicesTracker nextTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), nextSession.getId());
- IGDBBackend nextSessionBackend = nextTracker.getService(IGDBBackend.class);
- if (sameSession || nextSessionBackend.getSessionType() == SessionType.LOCAL) {
- ICommandControlService nextCommandControl = nextTracker.getService(ICommandControlService.class);
- IProcesses nextProcService = nextTracker.getService(IProcesses.class);
- nextProcService.getProcessesBeingDebugged(
- nextCommandControl.getContext(), new ProcessRequestMonitor(nextSession.getExecutor()));
- } else {
- // proceed to next session context query passing an error (that will be ignored)
- new ProcessRequestMonitor(nextSession.getExecutor()).done(
- new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "Only local session", null)); //$NON-NLS-1$
- }
- nextTracker.dispose();
- }
+ DsfServicesTracker nextTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(),
+ nextSession.getId());
+ IGDBBackend nextSessionBackend = nextTracker.getService(IGDBBackend.class);
+ if (sameSession || nextSessionBackend.getSessionType() == SessionType.LOCAL) {
+ ICommandControlService nextCommandControl = nextTracker
+ .getService(ICommandControlService.class);
+ IProcesses nextProcService = nextTracker.getService(IProcesses.class);
+ nextProcService.getProcessesBeingDebugged(nextCommandControl.getContext(),
+ new ProcessRequestMonitor(nextSession.getExecutor()));
+ } else {
+ // proceed to next session context query passing an error (that will be ignored)
+ new ProcessRequestMonitor(nextSession.getExecutor())
+ .done(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID,
+ IDsfStatusConstants.NOT_SUPPORTED, "Only local session", null)); //$NON-NLS-1$
+ }
+ nextTracker.dispose();
+ }
});
} else {
// done with querying all session. Copy the result
drm.done(result);
}
}
- };
- // Trigger the first query
- new ProcessRequestMonitor(ImmediateExecutor.getInstance()).done();
- }
- /*
- * This method should not be called from the UI thread.
- * (non-Javadoc)
- * @see org.eclipse.cdt.dsf.gdb.actions.IConnect#canConnect()
- */
- @Override
- public void connect(final RequestMonitor rm)
- {
- fExecutor.execute(new DsfRunnable() {
- @Override
- public void run() {
- final IProcesses procService = fTracker.getService(IProcesses.class);
- ICommandControlService commandControl = fTracker.getService(ICommandControlService.class);
- IGDBBackend backend = fTracker.getService(IGDBBackend.class);
-
- if (procService != null && commandControl != null && backend != null) {
- final ICommandControlDMContext controlCtx = commandControl.getContext();
-
- // Now get the list of all processes
- procService.getRunningProcesses(
- controlCtx,
- new DataRequestMonitor<IProcessDMContext[]>(fExecutor, rm) {
- @Override
- protected void handleSuccess() {
-
- final List<IProcessExtendedInfo> procInfoList = new ArrayList<IProcessExtendedInfo>();
-
- final CountingRequestMonitor countingRm =
- new CountingRequestMonitor(fExecutor, rm) {
+ }
+ ;
+ // Trigger the first query
+ new ProcessRequestMonitor(ImmediateExecutor.getInstance()).done();
+ }
+
+ /*
+ * This method should not be called from the UI thread.
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.dsf.gdb.actions.IConnect#canConnect()
+ */
+ @Override
+ public void connect(final RequestMonitor rm) {
+ fExecutor.execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ final IProcesses procService = fTracker.getService(IProcesses.class);
+ ICommandControlService commandControl = fTracker.getService(ICommandControlService.class);
+ IGDBBackend backend = fTracker.getService(IGDBBackend.class);
+
+ if (procService != null && commandControl != null && backend != null) {
+ final ICommandControlDMContext controlCtx = commandControl.getContext();
+
+ // Now get the list of all processes
+ procService.getRunningProcesses(controlCtx,
+ new DataRequestMonitor<IProcessDMContext[]>(fExecutor, rm) {
+ @Override
+ protected void handleSuccess() {
+
+ final List<IProcessExtendedInfo> procInfoList = new ArrayList<IProcessExtendedInfo>();
+
+ final CountingRequestMonitor countingRm = new CountingRequestMonitor(fExecutor,
+ rm) {
@Override
protected void handleSuccess() {
- getAllDebuggedProcesses(controlCtx, true, new ImmediateDataRequestMonitor<List<String>>(rm) {
- @Override
- protected void handleSuccess() {
- List<String> dbgPids = getData();
-
- // Prompt the user to choose one or more processes
- new PromptForPidJob(
- LaunchUIMessages.getString("ProcessPrompter.PromptJob"), //$NON-NLS-1$
- procInfoList.toArray(new IProcessExtendedInfo[procInfoList.size()]),
- dbgPids,
- new DataRequestMonitor<Object>(fExecutor, rm) {
- @Override
- protected void handleCancel() {
- rm.cancel();
- rm.done();
- }
- @Override
- protected void handleSuccess() {
- Object data = getData();
- if (data instanceof IProcessExtendedInfo[]) {
- attachToProcesses(controlCtx, (IProcessExtendedInfo[])data, rm);
- } else {
- rm.done(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR, "Invalid return type for process prompter", null)); //$NON-NLS-1$
- }
- }
- }).schedule();
- }
- });
+ getAllDebuggedProcesses(controlCtx, true,
+ new ImmediateDataRequestMonitor<List<String>>(rm) {
+ @Override
+ protected void handleSuccess() {
+ List<String> dbgPids = getData();
+
+ // Prompt the user to choose one or more processes
+ new PromptForPidJob(
+ LaunchUIMessages
+ .getString("ProcessPrompter.PromptJob"), //$NON-NLS-1$
+ procInfoList.toArray(
+ new IProcessExtendedInfo[procInfoList
+ .size()]),
+ dbgPids,
+ new DataRequestMonitor<Object>(fExecutor, rm) {
+ @Override
+ protected void handleCancel() {
+ rm.cancel();
+ rm.done();
+ }
+
+ @Override
+ protected void handleSuccess() {
+ Object data = getData();
+ if (data instanceof IProcessExtendedInfo[]) {
+ attachToProcesses(controlCtx,
+ (IProcessExtendedInfo[]) data,
+ rm);
+ } else {
+ rm.done(new Status(IStatus.ERROR,
+ GdbUIPlugin.PLUGIN_ID,
+ IDsfStatusConstants.INTERNAL_ERROR,
+ "Invalid return type for process prompter", //$NON-NLS-1$
+ null));
+ }
+ }
+ }).schedule();
+ }
+ });
}
};
- if (getData().length > 0 && getData()[0] instanceof IThreadDMData) {
- // The list of running processes also contains the name of the processes
- // This is much more efficient. Let's use it.
+ if (getData().length > 0 && getData()[0] instanceof IThreadDMData) {
+ // The list of running processes also contains the name of the processes
+ // This is much more efficient. Let's use it.
for (IProcessDMContext processCtx : getData()) {
IThreadDMData processData = (IThreadDMData) processCtx;
int pid = 0;
@@ -448,198 +469,207 @@ public class GdbConnectCommand extends RefreshableDebugCommand implements IConne
String[] cores = null;
String owner = null;
if (processData instanceof IGdbThreadDMData) {
- cores = ((IGdbThreadDMData)processData).getCores();
- owner = ((IGdbThreadDMData)processData).getOwner();
+ cores = ((IGdbThreadDMData) processData).getCores();
+ owner = ((IGdbThreadDMData) processData).getOwner();
}
String description = null;
if (processData instanceof IGdbThreadDMData2) {
- description = ((IGdbThreadDMData2)processData).getDescription();
+ description = ((IGdbThreadDMData2) processData).getDescription();
}
- procInfoList.add(new ProcessInfo(pid, processData.getName(), cores, owner, description));
+ procInfoList.add(new ProcessInfo(pid, processData.getName(), cores, owner,
+ description));
}
// Re-use the counting monitor and trigger it right away.
// No need to call done() in this case.
countingRm.setDoneCount(0);
- } else {
- // The list of running processes does not contain the names, so
- // we must obtain it individually
-
- // For each process, obtain its name
- // Once all the names are obtained, prompt the user for the pid to use
-
- // New cycle, look for service again
- final IProcesses procService = fTracker.getService(IProcesses.class);
-
- if (procService != null) {
- countingRm.setDoneCount(getData().length);
-
- for (IProcessDMContext processCtx : getData()) {
- procService.getExecutionData(
- processCtx,
- new DataRequestMonitor<IThreadDMData> (fExecutor, countingRm) {
- @Override
- protected void handleSuccess() {
- IThreadDMData processData = getData();
- int pid = 0;
- try {
- pid = Integer.parseInt(processData.getId());
- } catch (NumberFormatException e) {
- }
- String[] cores = null;
- String owner = null;
- if (processData instanceof IGdbThreadDMData) {
- cores = ((IGdbThreadDMData)processData).getCores();
- owner = ((IGdbThreadDMData)processData).getOwner();
- }
- String description = null;
- if (processData instanceof IGdbThreadDMData2) {
- description = ((IGdbThreadDMData2)processData).getDescription();
- }
- procInfoList.add(new ProcessInfo(pid, processData.getName(), cores, owner, description));
- countingRm.done();
- }
- });
- }
- } else {
- // Trigger right away. No need to call done() in this case.
- countingRm.setDoneCount(0);
- }
- }
- }
- });
- } else {
- rm.done();
- }
- }
- });
- }
-
- private void attachToProcesses(final ICommandControlDMContext controlDmc, IProcessExtendedInfo[] processes, final RequestMonitor rm) {
-
- // For a local attach, GDB can figure out the binary automatically,
- // so we don't need to prompt for it.
- final IGDBProcesses procService = fTracker.getService(IGDBProcesses.class);
- final IGDBBackend backend = fTracker.getService(IGDBBackend.class);
- final StringBuilder errors = new StringBuilder();
-
- if (procService != null && backend != null) {
- // Attach to each process in a sequential fashion. We must do this
- // to be able to check if we are allowed to attach to the next process.
- // Attaching to all of them in parallel would assume that all attach are supported.
-
- // Create a list of all our processes so we can attach to one at a time.
- // We need to create a new list so that we can remove elements from it.
- final List<IProcessExtendedInfo> procList = new ArrayList<IProcessExtendedInfo>(Arrays.asList(processes));
- // Create a one element array to remember what process we are trying to attach to, so that we can
- // use it in case of error.
- final IProcessExtendedInfo[] previousProcAttempt = new IProcessExtendedInfo[1];
-
- class AttachToProcessRequestMonitor extends ImmediateDataRequestMonitor<IDMContext> {
- public AttachToProcessRequestMonitor() {
- super();
- }
-
- @Override
- protected void handleCompleted() {
- // Failed to attach to a process. Remember the error message.
- if (!isSuccess()) {
- formatErrorMessage(errors, previousProcAttempt[0], getStatus().getMessage());
- }
-
- // Check that we have a process to attach to
- if (!procList.isEmpty()) {
-
- // Check that we can actually attach to the process.
- // This is because some backends may not support multi-process.
- // If the backend does not support multi-process, we only attach to the first process.
- procService.isDebuggerAttachSupported(controlDmc, new ImmediateDataRequestMonitor<Boolean>() {
- @Override
- protected void handleCompleted() {
- if (isSuccess() && getData()) {
- // Can attach to process
-
- // Remove process from list and attach to it.
- IProcessExtendedInfo process = procList.remove(0);
- // Store process in case of error
- previousProcAttempt[0] = process;
- String pidStr = Integer.toString(process.getPid());
-
- if (backend.getSessionType() == SessionType.REMOTE) {
- // For remote attach, we must set the binary first so we need to prompt the user.
-
- // If this is the very first attach of a remote session, check if the user
- // specified the binary in the launch. If so, let's add it to our map to
- // avoid having to prompt the user for that binary.
- // This would be particularly annoying since we didn't use to have
- // to do that before we supported multi-process.
- // Must do this here to be in the executor
- // Bug 350365
- if (fProcessNameToBinaryMap.isEmpty()) {
- IPath binaryPath = backend.getProgramPath();
- if (binaryPath != null && !binaryPath.isEmpty()) {
- fProcessNameToBinaryMap.put(binaryPath.lastSegment(), binaryPath.toOSString());
- }
- }
-
- // Because the prompt is a very long operation, we need to run outside the
- // executor, so we don't lock it.
- // Bug 344892
- IPath processPath = new Path(process.getName());
- String processShortName = processPath.lastSegment();
- new PromptAndAttachToProcessJob(pidStr,
- LaunchUIMessages.getString("ProcessPrompterDialog.TitlePrefix") + process.getName(), //$NON-NLS-1$
- processShortName, new AttachToProcessRequestMonitor()).schedule();
- } else {
- // For a local attach, we can attach directly without looking for the binary
- // since GDB will figure it out by itself
- IProcessDMContext procDmc = procService.createProcessContext(controlDmc, pidStr);
- procService.attachDebuggerToProcess(procDmc, null, new AttachToProcessRequestMonitor());
- }
- } else {
- // Not allowed to attach to another process. Just stop.
- rm.done();
- }
- }
- });
- } else {
- // If there were errors, pass them-on to the caller
- if (errors.length() != 0) {
- rm.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, errors.toString()));
- }
- // No other process to attach to
- rm.done();
- }
- }
- };
-
- // Trigger the first attach.
- new AttachToProcessRequestMonitor().done();
-
- } else {
- rm.done(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR, "Cannot find service", null)); //$NON-NLS-1$
- }
-
- }
-
- @Override
+ } else {
+ // The list of running processes does not contain the names, so
+ // we must obtain it individually
+
+ // For each process, obtain its name
+ // Once all the names are obtained, prompt the user for the pid to use
+
+ // New cycle, look for service again
+ final IProcesses procService = fTracker.getService(IProcesses.class);
+
+ if (procService != null) {
+ countingRm.setDoneCount(getData().length);
+
+ for (IProcessDMContext processCtx : getData()) {
+ procService.getExecutionData(processCtx,
+ new DataRequestMonitor<IThreadDMData>(fExecutor, countingRm) {
+ @Override
+ protected void handleSuccess() {
+ IThreadDMData processData = getData();
+ int pid = 0;
+ try {
+ pid = Integer.parseInt(processData.getId());
+ } catch (NumberFormatException e) {
+ }
+ String[] cores = null;
+ String owner = null;
+ if (processData instanceof IGdbThreadDMData) {
+ cores = ((IGdbThreadDMData) processData).getCores();
+ owner = ((IGdbThreadDMData) processData).getOwner();
+ }
+ String description = null;
+ if (processData instanceof IGdbThreadDMData2) {
+ description = ((IGdbThreadDMData2) processData)
+ .getDescription();
+ }
+ procInfoList
+ .add(new ProcessInfo(pid, processData.getName(),
+ cores, owner, description));
+ countingRm.done();
+ }
+ });
+ }
+ } else {
+ // Trigger right away. No need to call done() in this case.
+ countingRm.setDoneCount(0);
+ }
+ }
+ }
+ });
+ } else {
+ rm.done();
+ }
+ }
+ });
+ }
+
+ private void attachToProcesses(final ICommandControlDMContext controlDmc, IProcessExtendedInfo[] processes,
+ final RequestMonitor rm) {
+
+ // For a local attach, GDB can figure out the binary automatically,
+ // so we don't need to prompt for it.
+ final IGDBProcesses procService = fTracker.getService(IGDBProcesses.class);
+ final IGDBBackend backend = fTracker.getService(IGDBBackend.class);
+ final StringBuilder errors = new StringBuilder();
+
+ if (procService != null && backend != null) {
+ // Attach to each process in a sequential fashion. We must do this
+ // to be able to check if we are allowed to attach to the next process.
+ // Attaching to all of them in parallel would assume that all attach are supported.
+
+ // Create a list of all our processes so we can attach to one at a time.
+ // We need to create a new list so that we can remove elements from it.
+ final List<IProcessExtendedInfo> procList = new ArrayList<IProcessExtendedInfo>(Arrays.asList(processes));
+ // Create a one element array to remember what process we are trying to attach to, so that we can
+ // use it in case of error.
+ final IProcessExtendedInfo[] previousProcAttempt = new IProcessExtendedInfo[1];
+
+ class AttachToProcessRequestMonitor extends ImmediateDataRequestMonitor<IDMContext> {
+ public AttachToProcessRequestMonitor() {
+ super();
+ }
+
+ @Override
+ protected void handleCompleted() {
+ // Failed to attach to a process. Remember the error message.
+ if (!isSuccess()) {
+ formatErrorMessage(errors, previousProcAttempt[0], getStatus().getMessage());
+ }
+
+ // Check that we have a process to attach to
+ if (!procList.isEmpty()) {
+
+ // Check that we can actually attach to the process.
+ // This is because some backends may not support multi-process.
+ // If the backend does not support multi-process, we only attach to the first process.
+ procService.isDebuggerAttachSupported(controlDmc, new ImmediateDataRequestMonitor<Boolean>() {
+ @Override
+ protected void handleCompleted() {
+ if (isSuccess() && getData()) {
+ // Can attach to process
+
+ // Remove process from list and attach to it.
+ IProcessExtendedInfo process = procList.remove(0);
+ // Store process in case of error
+ previousProcAttempt[0] = process;
+ String pidStr = Integer.toString(process.getPid());
+
+ if (backend.getSessionType() == SessionType.REMOTE) {
+ // For remote attach, we must set the binary first so we need to prompt the user.
+
+ // If this is the very first attach of a remote session, check if the user
+ // specified the binary in the launch. If so, let's add it to our map to
+ // avoid having to prompt the user for that binary.
+ // This would be particularly annoying since we didn't use to have
+ // to do that before we supported multi-process.
+ // Must do this here to be in the executor
+ // Bug 350365
+ if (fProcessNameToBinaryMap.isEmpty()) {
+ IPath binaryPath = backend.getProgramPath();
+ if (binaryPath != null && !binaryPath.isEmpty()) {
+ fProcessNameToBinaryMap.put(binaryPath.lastSegment(),
+ binaryPath.toOSString());
+ }
+ }
+
+ // Because the prompt is a very long operation, we need to run outside the
+ // executor, so we don't lock it.
+ // Bug 344892
+ IPath processPath = new Path(process.getName());
+ String processShortName = processPath.lastSegment();
+ new PromptAndAttachToProcessJob(pidStr,
+ LaunchUIMessages.getString("ProcessPrompterDialog.TitlePrefix") //$NON-NLS-1$
+ + process.getName(),
+ processShortName, new AttachToProcessRequestMonitor()).schedule();
+ } else {
+ // For a local attach, we can attach directly without looking for the binary
+ // since GDB will figure it out by itself
+ IProcessDMContext procDmc = procService.createProcessContext(controlDmc,
+ pidStr);
+ procService.attachDebuggerToProcess(procDmc, null,
+ new AttachToProcessRequestMonitor());
+ }
+ } else {
+ // Not allowed to attach to another process. Just stop.
+ rm.done();
+ }
+ }
+ });
+ } else {
+ // If there were errors, pass them-on to the caller
+ if (errors.length() != 0) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, errors.toString()));
+ }
+ // No other process to attach to
+ rm.done();
+ }
+ }
+ }
+ ;
+
+ // Trigger the first attach.
+ new AttachToProcessRequestMonitor().done();
+
+ } else {
+ rm.done(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR,
+ "Cannot find service", null)); //$NON-NLS-1$
+ }
+
+ }
+
+ @Override
protected Object getTarget(Object element) {
- if (element instanceof GdbLaunch ||
- element instanceof IDMVMContext) {
- return element;
- }
- return null;
- }
-
- @Override
+ if (element instanceof GdbLaunch || element instanceof IDMVMContext) {
+ return element;
+ }
+ return null;
+ }
+
+ @Override
protected boolean isRemainEnabled(IDebugCommandRequest request) {
return false;
}
-
+
private void formatErrorMessage(StringBuilder errors, IProcessExtendedInfo process, String errorMsg) {
// Extract process name from full path.
- // On windows host, paths of style "sendmail:", "udisk-daemon:"
- // is treated as device id with no path segments
+ // On windows host, paths of style "sendmail:", "udisk-daemon:"
+ // is treated as device id with no path segments
String name;
IPath path = new Path(process.getName());
if (path.lastSegment() == null) {
@@ -647,17 +677,14 @@ public class GdbConnectCommand extends RefreshableDebugCommand implements IConne
} else {
name = path.lastSegment();
}
-
+
if (errors.length() != 0) {
errors.append(System.lineSeparator()).append(System.lineSeparator());
}
-
+
errors.append(Messages.GdbConnectCommand_FailureMessage).append(" ") //$NON-NLS-1$
- .append(name).append(" [").append(process.getPid()).append("]") //$NON-NLS-1$ //$NON-NLS-2$
- .append(System.lineSeparator())
- .append(Messages.GdbConnectCommand_Error)
- .append(System.lineSeparator())
- .append(errorMsg);
+ .append(name).append(" [").append(process.getPid()).append("]") //$NON-NLS-1$ //$NON-NLS-2$
+ .append(System.lineSeparator()).append(Messages.GdbConnectCommand_Error).append(System.lineSeparator())
+ .append(errorMsg);
}
}
-
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbDebugNewExecutableCommand.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbDebugNewExecutableCommand.java
index 6ff300885c9..ea1be6b6d12 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbDebugNewExecutableCommand.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbDebugNewExecutableCommand.java
@@ -55,29 +55,29 @@ public class GdbDebugNewExecutableCommand extends RefreshableDebugCommand implem
private DataRequestMonitor<NewExecutableInfo> fRequestMonitor;
final private SessionType fSessionType;
-
- private PromptJob( SessionType sessionType, DataRequestMonitor<NewExecutableInfo> rm ) {
- super( Messages.GdbDebugNewExecutableCommand_New_Executable_Prompt_Job );
+
+ private PromptJob(SessionType sessionType, DataRequestMonitor<NewExecutableInfo> rm) {
+ super(Messages.GdbDebugNewExecutableCommand_New_Executable_Prompt_Job);
fSessionType = sessionType;
fRequestMonitor = rm;
}
@Override
- public IStatus runInUIThread( IProgressMonitor monitor ) {
+ public IStatus runInUIThread(IProgressMonitor monitor) {
final NewExecutableInfo info = new NewExecutableInfo(fSessionType);
NewExecutableDialog dialog = new NewExecutableDialog(GdbUIPlugin.getShell(), info);
final boolean canceled = dialog.open() == Window.CANCEL;
- fExecutor.execute( new DsfRunnable() {
-
+ fExecutor.execute(new DsfRunnable() {
+
@Override
public void run() {
- if ( canceled )
+ if (canceled)
fRequestMonitor.cancel();
else
- fRequestMonitor.setData( info );
+ fRequestMonitor.setData(info);
fRequestMonitor.done();
}
- } );
+ });
return Status.OK_STATUS;
}
}
@@ -86,99 +86,89 @@ public class GdbDebugNewExecutableCommand extends RefreshableDebugCommand implem
private final DsfExecutor fExecutor;
private final DsfServicesTracker fTracker;
- public GdbDebugNewExecutableCommand( DsfSession session, ILaunch launch ) {
+ public GdbDebugNewExecutableCommand(DsfSession session, ILaunch launch) {
super();
fLaunch = launch;
fExecutor = session.getExecutor();
- fTracker = new DsfServicesTracker( GdbUIPlugin.getBundleContext(), session.getId() );
+ fTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
}
public boolean canDebugNewExecutable() {
-
- Query<Boolean> canDebugQuery = new Query<Boolean>() {
- @Override
- public void execute( DataRequestMonitor<Boolean> rm ) {
- IProcesses procService = fTracker.getService( IProcesses.class );
- ICommandControlService commandControl = fTracker.getService( ICommandControlService.class );
-
- if ( procService == null || commandControl == null ) {
- rm.setData( false );
+
+ Query<Boolean> canDebugQuery = new Query<Boolean>() {
+ @Override
+ public void execute(DataRequestMonitor<Boolean> rm) {
+ IProcesses procService = fTracker.getService(IProcesses.class);
+ ICommandControlService commandControl = fTracker.getService(ICommandControlService.class);
+
+ if (procService == null || commandControl == null) {
+ rm.setData(false);
rm.done();
return;
}
- procService.isDebugNewProcessSupported( commandControl.getContext(), rm );
- }
- };
+ procService.isDebugNewProcessSupported(commandControl.getContext(), rm);
+ }
+ };
try {
- fExecutor.execute( canDebugQuery );
+ fExecutor.execute(canDebugQuery);
return canDebugQuery.get();
- }
- catch( InterruptedException e ) {
- }
- catch( ExecutionException e ) {
- }
- catch( RejectedExecutionException e ) {
+ } catch (InterruptedException e) {
+ } catch (ExecutionException e) {
+ } catch (RejectedExecutionException e) {
// Can be thrown if the session is shutdown
}
return false;
}
- public void debugNewExecutable( final RequestMonitor rm ) {
- IGDBBackend backend = fTracker.getService( IGDBBackend.class );
- final IProcesses procService = fTracker.getService( IProcesses.class );
- final ICommandControlService commandControl = fTracker.getService( ICommandControlService.class );
- if ( backend == null || procService == null || commandControl == null ) {
- rm.setStatus( new Status( IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, "Service is not available" ) ); //$NON-NLS-1$
+ public void debugNewExecutable(final RequestMonitor rm) {
+ IGDBBackend backend = fTracker.getService(IGDBBackend.class);
+ final IProcesses procService = fTracker.getService(IProcesses.class);
+ final ICommandControlService commandControl = fTracker.getService(ICommandControlService.class);
+ if (backend == null || procService == null || commandControl == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, "Service is not available")); //$NON-NLS-1$
rm.done();
return;
}
- PromptJob job = new PromptJob(
- backend.getSessionType(),
- new DataRequestMonitor<NewExecutableInfo>( fExecutor, rm ){
-
- @Override
- protected void handleCancel() {
- rm.cancel();
- rm.done();
- };
+ PromptJob job = new PromptJob(backend.getSessionType(),
+ new DataRequestMonitor<NewExecutableInfo>(fExecutor, rm) {
- @Override
- protected void handleSuccess() {
- try {
- Map<String, Object> attributes = getLaunchConfiguration().getAttributes();
- attributes.putAll(getData().getAttributes());
- procService.debugNewProcess(
- commandControl.getContext(),
- getData().getHostPath(),
- attributes,
- new ImmediateDataRequestMonitor<IDMContext>( rm ) );
- }
- catch( CoreException e ) {
- rm.setStatus( e.getStatus() );
+ @Override
+ protected void handleCancel() {
+ rm.cancel();
rm.done();
- }
- };
- } );
+ };
+
+ @Override
+ protected void handleSuccess() {
+ try {
+ Map<String, Object> attributes = getLaunchConfiguration().getAttributes();
+ attributes.putAll(getData().getAttributes());
+ procService.debugNewProcess(commandControl.getContext(), getData().getHostPath(),
+ attributes, new ImmediateDataRequestMonitor<IDMContext>(rm));
+ } catch (CoreException e) {
+ rm.setStatus(e.getStatus());
+ rm.done();
+ }
+ };
+ });
job.schedule();
}
@Override
- protected void doExecute( Object[] targets, IProgressMonitor monitor, IRequest request ) throws CoreException {
+ protected void doExecute(Object[] targets, IProgressMonitor monitor, IRequest request) throws CoreException {
Query<Boolean> query = new Query<Boolean>() {
@Override
- protected void execute( DataRequestMonitor<Boolean> rm ) {
- debugNewExecutable( rm );
+ protected void execute(DataRequestMonitor<Boolean> rm) {
+ debugNewExecutable(rm);
}
};
try {
- fExecutor.execute( query );
+ fExecutor.execute(query);
query.get();
- }
- catch( InterruptedException e ) {
- }
- catch( ExecutionException e ) {
+ } catch (InterruptedException e) {
+ } catch (ExecutionException e) {
// There was an error. Propagate it to the user
String errorMessage;
if (e.getCause() != null) {
@@ -186,13 +176,11 @@ public class GdbDebugNewExecutableCommand extends RefreshableDebugCommand implem
} else {
errorMessage = e.getMessage();
}
- request.setStatus( new Status( IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, errorMessage ) );
- }
- catch( CancellationException e ) {
+ request.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, errorMessage));
+ } catch (CancellationException e) {
// Nothing to do, just ignore the command since the user
// cancelled it.
- }
- catch( RejectedExecutionException e ) {
+ } catch (RejectedExecutionException e) {
// Can be thrown if the session is shutdown
} finally {
updateEnablement();
@@ -200,13 +188,14 @@ public class GdbDebugNewExecutableCommand extends RefreshableDebugCommand implem
}
@Override
- protected boolean isExecutable( Object[] targets, IProgressMonitor monitor, IEnabledStateRequest request ) throws CoreException {
+ protected boolean isExecutable(Object[] targets, IProgressMonitor monitor, IEnabledStateRequest request)
+ throws CoreException {
return canDebugNewExecutable();
}
@Override
- protected Object getTarget( Object element ) {
- if ( element instanceof GdbLaunch || element instanceof IDMVMContext )
+ protected Object getTarget(Object element) {
+ if (element instanceof GdbLaunch || element instanceof IDMVMContext)
return element;
return null;
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbResumeWithoutSignalCommand.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbResumeWithoutSignalCommand.java
index 22d3e9eb370..80f2c0e05a5 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbResumeWithoutSignalCommand.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbResumeWithoutSignalCommand.java
@@ -36,108 +36,109 @@ import org.eclipse.debug.core.commands.IEnabledStateRequest;
/**
* Command performing a resume without signal.
- *
+ *
* @since 2.1
*/
public class GdbResumeWithoutSignalCommand extends AbstractDebugCommand implements IResumeWithoutSignalHandler {
- private final DsfExecutor fExecutor;
- private final DsfServicesTracker fTracker;
-
- public GdbResumeWithoutSignalCommand(DsfSession session) {
- fExecutor = session.getExecutor();
- fTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
- }
-
- public void dispose() {
- fTracker.dispose();
- }
-
- @Override
+ private final DsfExecutor fExecutor;
+ private final DsfServicesTracker fTracker;
+
+ public GdbResumeWithoutSignalCommand(DsfSession session) {
+ fExecutor = session.getExecutor();
+ fTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
+ }
+
+ public void dispose() {
+ fTracker.dispose();
+ }
+
+ @Override
protected void doExecute(Object[] targets, IProgressMonitor monitor, IRequest request) throws CoreException {
- if (targets.length != 1) {
- return;
- }
-
- final IExecutionDMContext dmc = DMContexts.getAncestorOfType(((IDMVMContext)targets[0]).getDMContext(), IExecutionDMContext.class);
- if (dmc == null) {
- return;
- }
-
- Query<Object> query = new Query<Object>() {
- @Override
- public void execute(DataRequestMonitor<Object> rm) {
- IRunControl runControl = fTracker.getService(IRunControl.class);
-
- if (runControl != null) {
- // This call must be replaced by a new 'resumeWithoutSignal' or even better
- // resumeWithSignal(0) which does not exist in the runControl service yet.
- // But this method is currently disabled anyway, until proper support is available.
- rm.done();
- } else {
- rm.done();
- }
- }
- };
- try {
- fExecutor.execute(query);
- query.get();
+ if (targets.length != 1) {
+ return;
+ }
+
+ final IExecutionDMContext dmc = DMContexts.getAncestorOfType(((IDMVMContext) targets[0]).getDMContext(),
+ IExecutionDMContext.class);
+ if (dmc == null) {
+ return;
+ }
+
+ Query<Object> query = new Query<Object>() {
+ @Override
+ public void execute(DataRequestMonitor<Object> rm) {
+ IRunControl runControl = fTracker.getService(IRunControl.class);
+
+ if (runControl != null) {
+ // This call must be replaced by a new 'resumeWithoutSignal' or even better
+ // resumeWithSignal(0) which does not exist in the runControl service yet.
+ // But this method is currently disabled anyway, until proper support is available.
+ rm.done();
+ } else {
+ rm.done();
+ }
+ }
+ };
+ try {
+ fExecutor.execute(query);
+ query.get();
} catch (InterruptedException e) {
} catch (ExecutionException e) {
- } catch (RejectedExecutionException e) {
- // Can be thrown if the session is shutdown
- }
- }
+ } catch (RejectedExecutionException e) {
+ // Can be thrown if the session is shutdown
+ }
+ }
- @Override
+ @Override
protected boolean isExecutable(Object[] targets, IProgressMonitor monitor, IEnabledStateRequest request)
- throws CoreException
- {
- if (targets.length != 1) {
- return false;
- }
-
- final IExecutionDMContext dmc = DMContexts.getAncestorOfType(((IDMVMContext)targets[0]).getDMContext(), IExecutionDMContext.class);
- if (dmc == null) {
- return false;
- }
-
-// Currently, we don't properly support the handling of signal in DSF-GDB, so we cannot
-// really enable this command
-
-// Query<Boolean> query = new Query<Boolean>() {
-// @Override
-// public void execute(DataRequestMonitor<Boolean> rm) {
-// IRunControl runControl = fTracker.getService(IRunControl.class);
-//
-// if (runControl != null) {
-// runControl.canResume(dmc, rm);
-// } else {
-// rm.setData(false);
-// rm.done();
-// }
-// }
-// };
-// try {
-// fExecutor.execute(query);
-// return query.get();
-// } catch (InterruptedException e) {
-// } catch (ExecutionException e) {
-// } catch (RejectedExecutionException e) {
-// // Can be thrown if the session is shutdown
-// }
+ throws CoreException {
+ if (targets.length != 1) {
+ return false;
+ }
+
+ final IExecutionDMContext dmc = DMContexts.getAncestorOfType(((IDMVMContext) targets[0]).getDMContext(),
+ IExecutionDMContext.class);
+ if (dmc == null) {
+ return false;
+ }
+
+ // Currently, we don't properly support the handling of signal in DSF-GDB, so we cannot
+ // really enable this command
+
+ // Query<Boolean> query = new Query<Boolean>() {
+ // @Override
+ // public void execute(DataRequestMonitor<Boolean> rm) {
+ // IRunControl runControl = fTracker.getService(IRunControl.class);
+ //
+ // if (runControl != null) {
+ // runControl.canResume(dmc, rm);
+ // } else {
+ // rm.setData(false);
+ // rm.done();
+ // }
+ // }
+ // };
+ // try {
+ // fExecutor.execute(query);
+ // return query.get();
+ // } catch (InterruptedException e) {
+ // } catch (ExecutionException e) {
+ // } catch (RejectedExecutionException e) {
+ // // Can be thrown if the session is shutdown
+ // }
return false;
- }
-
- @Override
+ }
+
+ @Override
protected Object getTarget(Object element) {
- if (element instanceof IDMVMContext) {
- return element;
- }
- return null;
- }
+ if (element instanceof IDMVMContext) {
+ return element;
+ }
+ return null;
+ }
- @Override
+ @Override
protected boolean isRemainEnabled(IDebugCommandRequest request) {
return false;
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbReverseResumeCommand.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbReverseResumeCommand.java
index 3f66519840f..3a1a57092f8 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbReverseResumeCommand.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbReverseResumeCommand.java
@@ -36,102 +36,103 @@ import org.eclipse.debug.core.commands.IEnabledStateRequest;
/**
* Command performing a reverse resume.
- *
+ *
* @since 2.1
*/
public class GdbReverseResumeCommand extends AbstractDebugCommand implements IReverseResumeHandler {
- private final DsfExecutor fExecutor;
- private final DsfServicesTracker fTracker;
-
- public GdbReverseResumeCommand(DsfSession session) {
- fExecutor = session.getExecutor();
- fTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
- }
-
- public void dispose() {
- fTracker.dispose();
- }
-
- @Override
+ private final DsfExecutor fExecutor;
+ private final DsfServicesTracker fTracker;
+
+ public GdbReverseResumeCommand(DsfSession session) {
+ fExecutor = session.getExecutor();
+ fTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
+ }
+
+ public void dispose() {
+ fTracker.dispose();
+ }
+
+ @Override
protected void doExecute(Object[] targets, IProgressMonitor monitor, IRequest request) throws CoreException {
- if (targets.length != 1) {
- return;
- }
-
- final IExecutionDMContext dmc = DMContexts.getAncestorOfType(((IDMVMContext)targets[0]).getDMContext(), IExecutionDMContext.class);
- if (dmc == null) {
- return;
- }
-
- Query<Object> reverseResume = new Query<Object>() {
- @Override
- public void execute(DataRequestMonitor<Object> rm) {
- IReverseRunControl runControl = fTracker.getService(IReverseRunControl.class);
-
- if (runControl != null) {
- runControl.reverseResume(dmc, rm);
- } else {
- rm.done();
- }
- }
- };
- try {
- fExecutor.execute(reverseResume);
- reverseResume.get();
+ if (targets.length != 1) {
+ return;
+ }
+
+ final IExecutionDMContext dmc = DMContexts.getAncestorOfType(((IDMVMContext) targets[0]).getDMContext(),
+ IExecutionDMContext.class);
+ if (dmc == null) {
+ return;
+ }
+
+ Query<Object> reverseResume = new Query<Object>() {
+ @Override
+ public void execute(DataRequestMonitor<Object> rm) {
+ IReverseRunControl runControl = fTracker.getService(IReverseRunControl.class);
+
+ if (runControl != null) {
+ runControl.reverseResume(dmc, rm);
+ } else {
+ rm.done();
+ }
+ }
+ };
+ try {
+ fExecutor.execute(reverseResume);
+ reverseResume.get();
} catch (InterruptedException e) {
} catch (ExecutionException e) {
- } catch (RejectedExecutionException e) {
- // Can be thrown if the session is shutdown
- }
- }
+ } catch (RejectedExecutionException e) {
+ // Can be thrown if the session is shutdown
+ }
+ }
- @Override
+ @Override
protected boolean isExecutable(Object[] targets, IProgressMonitor monitor, IEnabledStateRequest request)
- throws CoreException
- {
- if (targets.length != 1) {
- return false;
- }
-
- final IExecutionDMContext dmc = DMContexts.getAncestorOfType(((IDMVMContext)targets[0]).getDMContext(), IExecutionDMContext.class);
- if (dmc == null) {
- return false;
- }
-
- Query<Boolean> canReverseResume = new Query<Boolean>() {
- @Override
- public void execute(DataRequestMonitor<Boolean> rm) {
- IReverseRunControl runControl = fTracker.getService(IReverseRunControl.class);
-
- if (runControl != null) {
- runControl.canReverseResume(dmc, rm);
- } else {
- rm.setData(false);
- rm.done();
- }
- }
- };
- try {
- fExecutor.execute(canReverseResume);
+ throws CoreException {
+ if (targets.length != 1) {
+ return false;
+ }
+
+ final IExecutionDMContext dmc = DMContexts.getAncestorOfType(((IDMVMContext) targets[0]).getDMContext(),
+ IExecutionDMContext.class);
+ if (dmc == null) {
+ return false;
+ }
+
+ Query<Boolean> canReverseResume = new Query<Boolean>() {
+ @Override
+ public void execute(DataRequestMonitor<Boolean> rm) {
+ IReverseRunControl runControl = fTracker.getService(IReverseRunControl.class);
+
+ if (runControl != null) {
+ runControl.canReverseResume(dmc, rm);
+ } else {
+ rm.setData(false);
+ rm.done();
+ }
+ }
+ };
+ try {
+ fExecutor.execute(canReverseResume);
return canReverseResume.get();
} catch (InterruptedException e) {
} catch (ExecutionException e) {
- } catch (RejectedExecutionException e) {
- // Can be thrown if the session is shutdown
- }
+ } catch (RejectedExecutionException e) {
+ // Can be thrown if the session is shutdown
+ }
return false;
- }
-
- @Override
+ }
+
+ @Override
protected Object getTarget(Object element) {
- if (element instanceof IDMVMContext) {
- return element;
- }
- return null;
- }
+ if (element instanceof IDMVMContext) {
+ return element;
+ }
+ return null;
+ }
- @Override
+ @Override
protected boolean isRemainEnabled(IDebugCommandRequest request) {
return false;
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbReverseStepIntoCommand.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbReverseStepIntoCommand.java
index ed94d4cdb5f..d16c1fc4a2d 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbReverseStepIntoCommand.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbReverseStepIntoCommand.java
@@ -25,11 +25,12 @@ import org.eclipse.cdt.dsf.service.DsfSession;
public class GdbReverseStepIntoCommand extends GdbAbstractReverseStepCommand implements IReverseStepIntoHandler {
public GdbReverseStepIntoCommand(DsfSession session, DsfSteppingModeTarget steppingMode) {
super(session, steppingMode);
- }
+ }
@Override
protected final StepType getStepType() {
- boolean instructionSteppingEnabled = getSteppingMode() != null && getSteppingMode().isInstructionSteppingEnabled();
+ boolean instructionSteppingEnabled = getSteppingMode() != null
+ && getSteppingMode().isInstructionSteppingEnabled();
return instructionSteppingEnabled ? StepType.INSTRUCTION_STEP_INTO : StepType.STEP_INTO;
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbReverseStepOverCommand.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbReverseStepOverCommand.java
index c8a8b231f3a..32b0b2600fb 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbReverseStepOverCommand.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbReverseStepOverCommand.java
@@ -29,7 +29,8 @@ public class GdbReverseStepOverCommand extends GdbAbstractReverseStepCommand imp
@Override
protected final StepType getStepType() {
- boolean instructionSteppingEnabled = getSteppingMode() != null && getSteppingMode().isInstructionSteppingEnabled();
+ boolean instructionSteppingEnabled = getSteppingMode() != null
+ && getSteppingMode().isInstructionSteppingEnabled();
return instructionSteppingEnabled ? StepType.INSTRUCTION_STEP_OVER : StepType.STEP_OVER;
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbReverseToggleCommand.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbReverseToggleCommand.java
index 3028e903a11..c69d5105bae 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbReverseToggleCommand.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbReverseToggleCommand.java
@@ -58,350 +58,357 @@ import org.eclipse.ui.services.IEvaluationService;
/**
* Command that toggles the Reverse Debugging feature
- *
+ *
* @since 2.1
*/
public class GdbReverseToggleCommand extends AbstractDebugCommand implements IChangeReverseMethodHandler {
- private final DsfExecutor fExecutor;
- private final DsfServicesTracker fTracker;
- private final DsfSession fSession;
-
- /** The reverse debugging method that was last returned by the service **/
- private ReverseDebugMethod fCurrentMethod;
- /** The reverse debugging method that was used before the new method was selected **/
- private ReverseDebugMethod fPreviousMethod;
- /** The reverse debugging method to be used when the toggle button is selected */
- private ReverseDebugMethod fNextMethod;
-
- public GdbReverseToggleCommand(DsfSession session) {
- fExecutor = session.getExecutor();
- fTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
- fSession = session;
- fCurrentMethod = ReverseDebugMethod.OFF;
- fPreviousMethod = ReverseDebugMethod.OFF;
- fNextMethod = ReverseDebugMethod.OFF;
-
- try {
- fExecutor.execute(new DsfRunnable() {
- @Override
- public void run() {
- fSession.addServiceEventListener(GdbReverseToggleCommand.this, null);
- }
- });
- } catch(RejectedExecutionException e) {}
- }
-
- public void dispose() {
- try {
- fExecutor.execute(new DsfRunnable() {
- @Override
- public void run() {
- fSession.removeServiceEventListener(GdbReverseToggleCommand.this);
- }
- });
- } catch (RejectedExecutionException e) {
- // Session already gone.
- }
- fTracker.dispose();
- }
-
- @Override
- protected void doExecute(Object[] targets, IProgressMonitor monitor, final IRequest request) throws CoreException {
- if (targets.length != 1) {
- return;
- }
-
- IDMContext dmc = ((IDMVMContext)targets[0]).getDMContext();
- final ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
- if (controlDmc == null) {
- return;
- }
-
- Query<Object> setReverseMode = new Query<Object>() {
- @Override
- public void execute(final DataRequestMonitor<Object> rm) {
- final IReverseRunControl2 runControl = fTracker.getService(IReverseRunControl2.class);
-
- if (runControl != null) {
- final ReverseDebugMethod newMethod;
- if (fNextMethod == ReverseDebugMethod.HARDWARE) {
- String defaultValue = Platform.getPreferencesService().getString(GdbPlugin.PLUGIN_ID,
- IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_HARDWARE,
- IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_GDB_TRACE, null);
-
- if (defaultValue.equals(IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_BRANCH_TRACE)) {
- newMethod = ReverseDebugMethod.BRANCH_TRACE;
- } else if (defaultValue.equals(IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_PROCESSOR_TRACE)) {
- newMethod = ReverseDebugMethod.PROCESSOR_TRACE;
- } else {
- newMethod = ReverseDebugMethod.GDB_TRACE;
- }
- } else {
- newMethod = fNextMethod;
- }
- runControl.enableReverseMode(controlDmc, newMethod, new RequestMonitor(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
- if (newMethod == ReverseDebugMethod.PROCESSOR_TRACE) {
- request.setStatus(new Status(IStatus.OK, GdbPlugin.PLUGIN_ID, 1, Messages.GdbReverseDebugging_ProcessorTraceReverseDebugNotAvailable, null));
- } else if (newMethod == ReverseDebugMethod.BRANCH_TRACE || newMethod == ReverseDebugMethod.GDB_TRACE) {
- request.setStatus(new Status(IStatus.OK, GdbPlugin.PLUGIN_ID, 1, Messages.GdbReverseDebugging_HardwareReverseDebugNotAvailable, null));
- } else {
- request.setStatus(new Status(IStatus.OK, GdbPlugin.PLUGIN_ID, 1, Messages.GdbReverseDebugging_ReverseDebugNotAvailable, null));
- }
- }
- });
- } else {
- final IReverseRunControl runControl_old = fTracker.getService(IReverseRunControl.class);
- if (runControl_old != null) {
- if (fCurrentMethod != ReverseDebugMethod.OFF && fCurrentMethod != ReverseDebugMethod.SOFTWARE) {
- runControl_old.enableReverseMode(controlDmc, false, rm); // Switch Off tracing
- request.setStatus(new Status(IStatus.OK, GdbPlugin.PLUGIN_ID, 1, Messages.GdbReverseDebugging_HardwareReverseDebugNotAvailable, null));
- return;
- }
- runControl_old.isReverseModeEnabled(controlDmc, new DataRequestMonitor<Boolean>(fExecutor, rm) {
- @Override
- public void handleSuccess() {
- runControl_old.enableReverseMode(controlDmc, !getData(), rm);
- }
- });
- } else {
- rm.done();
- }
- }
- }
- };
- try {
- fExecutor.execute(setReverseMode);
- setReverseMode.get();
+ private final DsfExecutor fExecutor;
+ private final DsfServicesTracker fTracker;
+ private final DsfSession fSession;
+
+ /** The reverse debugging method that was last returned by the service **/
+ private ReverseDebugMethod fCurrentMethod;
+ /** The reverse debugging method that was used before the new method was selected **/
+ private ReverseDebugMethod fPreviousMethod;
+ /** The reverse debugging method to be used when the toggle button is selected */
+ private ReverseDebugMethod fNextMethod;
+
+ public GdbReverseToggleCommand(DsfSession session) {
+ fExecutor = session.getExecutor();
+ fTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
+ fSession = session;
+ fCurrentMethod = ReverseDebugMethod.OFF;
+ fPreviousMethod = ReverseDebugMethod.OFF;
+ fNextMethod = ReverseDebugMethod.OFF;
+
+ try {
+ fExecutor.execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ fSession.addServiceEventListener(GdbReverseToggleCommand.this, null);
+ }
+ });
+ } catch (RejectedExecutionException e) {
+ }
+ }
+
+ public void dispose() {
+ try {
+ fExecutor.execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ fSession.removeServiceEventListener(GdbReverseToggleCommand.this);
+ }
+ });
+ } catch (RejectedExecutionException e) {
+ // Session already gone.
+ }
+ fTracker.dispose();
+ }
+
+ @Override
+ protected void doExecute(Object[] targets, IProgressMonitor monitor, final IRequest request) throws CoreException {
+ if (targets.length != 1) {
+ return;
+ }
+
+ IDMContext dmc = ((IDMVMContext) targets[0]).getDMContext();
+ final ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
+ if (controlDmc == null) {
+ return;
+ }
+
+ Query<Object> setReverseMode = new Query<Object>() {
+ @Override
+ public void execute(final DataRequestMonitor<Object> rm) {
+ final IReverseRunControl2 runControl = fTracker.getService(IReverseRunControl2.class);
+
+ if (runControl != null) {
+ final ReverseDebugMethod newMethod;
+ if (fNextMethod == ReverseDebugMethod.HARDWARE) {
+ String defaultValue = Platform.getPreferencesService().getString(GdbPlugin.PLUGIN_ID,
+ IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_HARDWARE,
+ IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_GDB_TRACE, null);
+
+ if (defaultValue.equals(IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_BRANCH_TRACE)) {
+ newMethod = ReverseDebugMethod.BRANCH_TRACE;
+ } else if (defaultValue
+ .equals(IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_PROCESSOR_TRACE)) {
+ newMethod = ReverseDebugMethod.PROCESSOR_TRACE;
+ } else {
+ newMethod = ReverseDebugMethod.GDB_TRACE;
+ }
+ } else {
+ newMethod = fNextMethod;
+ }
+ runControl.enableReverseMode(controlDmc, newMethod, new RequestMonitor(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
+ if (newMethod == ReverseDebugMethod.PROCESSOR_TRACE) {
+ request.setStatus(new Status(IStatus.OK, GdbPlugin.PLUGIN_ID, 1,
+ Messages.GdbReverseDebugging_ProcessorTraceReverseDebugNotAvailable, null));
+ } else if (newMethod == ReverseDebugMethod.BRANCH_TRACE
+ || newMethod == ReverseDebugMethod.GDB_TRACE) {
+ request.setStatus(new Status(IStatus.OK, GdbPlugin.PLUGIN_ID, 1,
+ Messages.GdbReverseDebugging_HardwareReverseDebugNotAvailable, null));
+ } else {
+ request.setStatus(new Status(IStatus.OK, GdbPlugin.PLUGIN_ID, 1,
+ Messages.GdbReverseDebugging_ReverseDebugNotAvailable, null));
+ }
+ }
+ });
+ } else {
+ final IReverseRunControl runControl_old = fTracker.getService(IReverseRunControl.class);
+ if (runControl_old != null) {
+ if (fCurrentMethod != ReverseDebugMethod.OFF && fCurrentMethod != ReverseDebugMethod.SOFTWARE) {
+ runControl_old.enableReverseMode(controlDmc, false, rm); // Switch Off tracing
+ request.setStatus(new Status(IStatus.OK, GdbPlugin.PLUGIN_ID, 1,
+ Messages.GdbReverseDebugging_HardwareReverseDebugNotAvailable, null));
+ return;
+ }
+ runControl_old.isReverseModeEnabled(controlDmc, new DataRequestMonitor<Boolean>(fExecutor, rm) {
+ @Override
+ public void handleSuccess() {
+ runControl_old.enableReverseMode(controlDmc, !getData(), rm);
+ }
+ });
+ } else {
+ rm.done();
+ }
+ }
+ }
+ };
+ try {
+ fExecutor.execute(setReverseMode);
+ setReverseMode.get();
} catch (InterruptedException e) {
} catch (ExecutionException e) {
- } catch (RejectedExecutionException e) {
- // Can be thrown if the session is shutdown
- }
- }
+ } catch (RejectedExecutionException e) {
+ // Can be thrown if the session is shutdown
+ }
+ }
- @Override
+ @Override
protected boolean isExecutable(Object[] targets, IProgressMonitor monitor, IEnabledStateRequest request)
- throws CoreException
- {
- if (targets.length != 1) {
- return false;
- }
-
- IDMContext dmc = ((IDMVMContext)targets[0]).getDMContext();
- final ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
- final IExecutionDMContext execDmc = DMContexts.getAncestorOfType(dmc, IExecutionDMContext.class);
- if (controlDmc == null && execDmc == null) {
- return false;
- }
-
- Query<Boolean> canSetReverseMode = new Query<Boolean>() {
- @Override
- public void execute(DataRequestMonitor<Boolean> rm) {
- IReverseRunControl runControl = fTracker.getService(IReverseRunControl.class);
-
- // Only allow to toggle reverse if the program is suspended.
- // When the program is running, GDB will not answer our command
- // in toggleReverse() and since it is blocking, it will hang the entire UI!
- if (runControl != null &&
- runControl instanceof IRunControl && ((IRunControl)runControl).isSuspended(execDmc)) {
- runControl.canEnableReverseMode(controlDmc, rm);
- } else {
- rm.setData(false);
- rm.done();
- }
- }
- };
- try {
- fExecutor.execute(canSetReverseMode);
- return canSetReverseMode.get();
- } catch (InterruptedException e) {
- } catch (ExecutionException e) {
- } catch (RejectedExecutionException e) {
- // Can be thrown if the session is shutdown
- }
+ throws CoreException {
+ if (targets.length != 1) {
+ return false;
+ }
+
+ IDMContext dmc = ((IDMVMContext) targets[0]).getDMContext();
+ final ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
+ final IExecutionDMContext execDmc = DMContexts.getAncestorOfType(dmc, IExecutionDMContext.class);
+ if (controlDmc == null && execDmc == null) {
+ return false;
+ }
+
+ Query<Boolean> canSetReverseMode = new Query<Boolean>() {
+ @Override
+ public void execute(DataRequestMonitor<Boolean> rm) {
+ IReverseRunControl runControl = fTracker.getService(IReverseRunControl.class);
+
+ // Only allow to toggle reverse if the program is suspended.
+ // When the program is running, GDB will not answer our command
+ // in toggleReverse() and since it is blocking, it will hang the entire UI!
+ if (runControl != null && runControl instanceof IRunControl
+ && ((IRunControl) runControl).isSuspended(execDmc)) {
+ runControl.canEnableReverseMode(controlDmc, rm);
+ } else {
+ rm.setData(false);
+ rm.done();
+ }
+ }
+ };
+ try {
+ fExecutor.execute(canSetReverseMode);
+ return canSetReverseMode.get();
+ } catch (InterruptedException e) {
+ } catch (ExecutionException e) {
+ } catch (RejectedExecutionException e) {
+ // Can be thrown if the session is shutdown
+ }
return false;
- }
-
- @Override
+ }
+
+ @Override
protected Object getTarget(Object element) {
- if (element instanceof IDMVMContext) {
- return element;
- }
- return null;
- }
+ if (element instanceof IDMVMContext) {
+ return element;
+ }
+ return null;
+ }
- @Override
+ @Override
protected boolean isRemainEnabled(IDebugCommandRequest request) {
return true;
}
-
- @Override
- public boolean toggleNeedsUpdating() {
- return true;
- }
-
- @Override
- public boolean isReverseToggled(Object context) {
- IDMContext dmc;
-
- if (context instanceof IDMContext) {
- dmc = (IDMContext)context;
- } else if (context instanceof IDMVMContext) {
- dmc = ((IDMVMContext)context).getDMContext();
- } else {
- return false;
- }
-
- final ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
- if (controlDmc == null) {
- return false;
- }
-
- Query<Boolean> isToggledQuery = new Query<Boolean>() {
- @Override
- public void execute(final DataRequestMonitor<Boolean> rm) {
- final IReverseRunControl runControl = fTracker.getService(IReverseRunControl.class);
-
- if (runControl != null) {
- runControl.isReverseModeEnabled(controlDmc, rm);
- } else {
- rm.setData(false);
- rm.done();
- }
- }
- };
- try {
- fExecutor.execute(isToggledQuery);
- return isToggledQuery.get(500, TimeUnit.MILLISECONDS);
- } catch (InterruptedException e) {
- } catch (ExecutionException e) {
- } catch (RejectedExecutionException e) {
- // Can be thrown if the session is shutdown
- } catch (TimeoutException e) {
- // If we timeout, we default to false.
- // This is to avoid a deadlock
- }
-
- return false;
- }
-
- /**
- * @noreference This method is not intended to be referenced by clients.
- */
- @DsfServiceEventHandler
- public void eventDispatched(IReverseModeChangedDMEvent e) {
- new WorkbenchJob("") { //$NON-NLS-1$
+
+ @Override
+ public boolean toggleNeedsUpdating() {
+ return true;
+ }
+
+ @Override
+ public boolean isReverseToggled(Object context) {
+ IDMContext dmc;
+
+ if (context instanceof IDMContext) {
+ dmc = (IDMContext) context;
+ } else if (context instanceof IDMVMContext) {
+ dmc = ((IDMVMContext) context).getDMContext();
+ } else {
+ return false;
+ }
+
+ final ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
+ if (controlDmc == null) {
+ return false;
+ }
+
+ Query<Boolean> isToggledQuery = new Query<Boolean>() {
+ @Override
+ public void execute(final DataRequestMonitor<Boolean> rm) {
+ final IReverseRunControl runControl = fTracker.getService(IReverseRunControl.class);
+
+ if (runControl != null) {
+ runControl.isReverseModeEnabled(controlDmc, rm);
+ } else {
+ rm.setData(false);
+ rm.done();
+ }
+ }
+ };
+ try {
+ fExecutor.execute(isToggledQuery);
+ return isToggledQuery.get(500, TimeUnit.MILLISECONDS);
+ } catch (InterruptedException e) {
+ } catch (ExecutionException e) {
+ } catch (RejectedExecutionException e) {
+ // Can be thrown if the session is shutdown
+ } catch (TimeoutException e) {
+ // If we timeout, we default to false.
+ // This is to avoid a deadlock
+ }
+
+ return false;
+ }
+
+ /**
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ @DsfServiceEventHandler
+ public void eventDispatched(IReverseModeChangedDMEvent e) {
+ 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("org.eclipse.cdt.debug.ui.command.reverseToggle", null); //$NON-NLS-1$
- }
-
+ // 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("org.eclipse.cdt.debug.ui.command.reverseToggle", null); //$NON-NLS-1$
+ }
+
return Status.OK_STATUS;
}
}.schedule();
- }
-
- @Override
- public void setReverseDebugMethod(ReverseDebugMethod traceMethod) {
- fNextMethod = traceMethod;
- }
-
- @Override
- public ReverseDebugMethod getReverseDebugMethod(final Object context) {
- IDMContext dmc;
-
- if (context instanceof IDMContext) {
- dmc = (IDMContext)context;
- } else if (context instanceof IDMVMContext) {
- dmc = ((IDMVMContext)context).getDMContext();
- } else {
- return ReverseDebugMethod.OFF;
- }
-
- final ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
- if (controlDmc == null) {
- return ReverseDebugMethod.OFF;
- }
-
- Query<ReverseDebugMethod> reverseMethodQuery = new Query<ReverseDebugMethod>() {
- @Override
- public void execute(DataRequestMonitor<ReverseDebugMethod> rm) {
- IReverseRunControl2 runControl = fTracker.getService(IReverseRunControl2.class);
- if (runControl != null) {
- runControl.getReverseTraceMethod(controlDmc, new ImmediateDataRequestMonitor<ReverseDebugMethod>(rm) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- rm.done(ReverseDebugMethod.OFF);
- } else {
- ReverseDebugMethod method = getData();
- if (method == ReverseDebugMethod.BRANCH_TRACE ||
- method == ReverseDebugMethod.PROCESSOR_TRACE ||
- method == ReverseDebugMethod.GDB_TRACE) {
- method = ReverseDebugMethod.HARDWARE;
- }
- rm.done(method);
- }
- }
- });
- } else {
- IReverseRunControl runControl_old = fTracker.getService(IReverseRunControl.class);
- if (runControl_old != null) {
- runControl_old.isReverseModeEnabled(controlDmc, new ImmediateDataRequestMonitor<Boolean>(rm) {
- @Override
- protected void handleCompleted() {
- if (isSuccess() && getData()) {
- rm.done(ReverseDebugMethod.SOFTWARE);
- } else {
- rm.done(ReverseDebugMethod.OFF);
- }
- }
- });
- } else {
- rm.done(ReverseDebugMethod.OFF);
- }
- }
- }
- };
- try {
- fExecutor.execute(reverseMethodQuery);
- ReverseDebugMethod currMethod = reverseMethodQuery.get(500, TimeUnit.MILLISECONDS);
-
- if (currMethod != fCurrentMethod) {
- fPreviousMethod = fCurrentMethod;
- fCurrentMethod = currMethod;
- }
- return fCurrentMethod;
- } catch (InterruptedException e) {
- } catch (ExecutionException e) {
- } catch (RejectedExecutionException e) {
- } catch (TimeoutException e) {
- // If we timeout, we default to OFF.
- // This is to avoid a deadlock
- }
-
- return ReverseDebugMethod.OFF;
- }
+ }
+
+ @Override
+ public void setReverseDebugMethod(ReverseDebugMethod traceMethod) {
+ fNextMethod = traceMethod;
+ }
+
+ @Override
+ public ReverseDebugMethod getReverseDebugMethod(final Object context) {
+ IDMContext dmc;
+
+ if (context instanceof IDMContext) {
+ dmc = (IDMContext) context;
+ } else if (context instanceof IDMVMContext) {
+ dmc = ((IDMVMContext) context).getDMContext();
+ } else {
+ return ReverseDebugMethod.OFF;
+ }
+
+ final ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
+ if (controlDmc == null) {
+ return ReverseDebugMethod.OFF;
+ }
+
+ Query<ReverseDebugMethod> reverseMethodQuery = new Query<ReverseDebugMethod>() {
+ @Override
+ public void execute(DataRequestMonitor<ReverseDebugMethod> rm) {
+ IReverseRunControl2 runControl = fTracker.getService(IReverseRunControl2.class);
+ if (runControl != null) {
+ runControl.getReverseTraceMethod(controlDmc,
+ new ImmediateDataRequestMonitor<ReverseDebugMethod>(rm) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ rm.done(ReverseDebugMethod.OFF);
+ } else {
+ ReverseDebugMethod method = getData();
+ if (method == ReverseDebugMethod.BRANCH_TRACE
+ || method == ReverseDebugMethod.PROCESSOR_TRACE
+ || method == ReverseDebugMethod.GDB_TRACE) {
+ method = ReverseDebugMethod.HARDWARE;
+ }
+ rm.done(method);
+ }
+ }
+ });
+ } else {
+ IReverseRunControl runControl_old = fTracker.getService(IReverseRunControl.class);
+ if (runControl_old != null) {
+ runControl_old.isReverseModeEnabled(controlDmc, new ImmediateDataRequestMonitor<Boolean>(rm) {
+ @Override
+ protected void handleCompleted() {
+ if (isSuccess() && getData()) {
+ rm.done(ReverseDebugMethod.SOFTWARE);
+ } else {
+ rm.done(ReverseDebugMethod.OFF);
+ }
+ }
+ });
+ } else {
+ rm.done(ReverseDebugMethod.OFF);
+ }
+ }
+ }
+ };
+ try {
+ fExecutor.execute(reverseMethodQuery);
+ ReverseDebugMethod currMethod = reverseMethodQuery.get(500, TimeUnit.MILLISECONDS);
+
+ if (currMethod != fCurrentMethod) {
+ fPreviousMethod = fCurrentMethod;
+ fCurrentMethod = currMethod;
+ }
+ return fCurrentMethod;
+ } catch (InterruptedException e) {
+ } catch (ExecutionException e) {
+ } catch (RejectedExecutionException e) {
+ } catch (TimeoutException e) {
+ // If we timeout, we default to OFF.
+ // This is to avoid a deadlock
+ }
+
+ return ReverseDebugMethod.OFF;
+ }
@Override
public ReverseDebugMethod getPreviousReverseDebugMethod(Object context) {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbSaveTraceDataCommand.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbSaveTraceDataCommand.java
index d29c6b1ffa5..a54f8528aea 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbSaveTraceDataCommand.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbSaveTraceDataCommand.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
@@ -41,43 +41,43 @@ import org.eclipse.ui.PlatformUI;
/**
* Command to save the trace data to file
- *
+ *
* @since 2.1
*/
public class GdbSaveTraceDataCommand extends AbstractDebugCommand implements ISaveTraceDataHandler {
-
+
private final DsfExecutor fExecutor;
private final DsfServicesTracker fTracker;
public GdbSaveTraceDataCommand(DsfSession session) {
fExecutor = session.getExecutor();
fTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
- }
+ }
public void dispose() {
fTracker.dispose();
}
@Override
- protected void doExecute(Object[] targets, IProgressMonitor monitor, IRequest request)
- throws CoreException {
+ protected void doExecute(Object[] targets, IProgressMonitor monitor, IRequest request) throws CoreException {
if (targets.length != 1) {
return;
}
- final ITraceTargetDMContext dmc = DMContexts.getAncestorOfType(((IDMVMContext)targets[0]).getDMContext(), ITraceTargetDMContext.class);
+ final ITraceTargetDMContext dmc = DMContexts.getAncestorOfType(((IDMVMContext) targets[0]).getDMContext(),
+ ITraceTargetDMContext.class);
if (dmc == null) {
return;
}
final String[] fileName = new String[1];
PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
- @Override
+ @Override
public void run() {
fileName[0] = promptForFileName();
};
});
-
+
if (fileName[0] != null) {
Query<Object> saveTraceDataQuery = new Query<Object>() {
@Override
@@ -104,29 +104,30 @@ public class GdbSaveTraceDataCommand extends AbstractDebugCommand implements ISa
@Override
protected boolean isExecutable(Object[] targets, IProgressMonitor monitor, IEnabledStateRequest request)
- throws CoreException {
+ throws CoreException {
if (targets.length != 1) {
return false;
}
- final ITraceTargetDMContext dmc = DMContexts.getAncestorOfType(((IDMVMContext)targets[0]).getDMContext(), ITraceTargetDMContext.class);
+ final ITraceTargetDMContext dmc = DMContexts.getAncestorOfType(((IDMVMContext) targets[0]).getDMContext(),
+ ITraceTargetDMContext.class);
if (dmc == null) {
return false;
}
- Query<Boolean> canSaveQuery = new Query<Boolean>() {
- @Override
- public void execute(DataRequestMonitor<Boolean> rm) {
- IGDBTraceControl traceControl = fTracker.getService(IGDBTraceControl.class);
-
- if (traceControl != null) {
- traceControl.canSaveTraceData(dmc, rm);
- } else {
- rm.setData(false);
- rm.done();
- }
- }
- };
+ Query<Boolean> canSaveQuery = new Query<Boolean>() {
+ @Override
+ public void execute(DataRequestMonitor<Boolean> rm) {
+ IGDBTraceControl traceControl = fTracker.getService(IGDBTraceControl.class);
+
+ if (traceControl != null) {
+ traceControl.canSaveTraceData(dmc, rm);
+ } else {
+ rm.setData(false);
+ rm.done();
+ }
+ }
+ };
try {
fExecutor.execute(canSaveQuery);
return canSaveQuery.get();
@@ -151,7 +152,7 @@ public class GdbSaveTraceDataCommand extends AbstractDebugCommand implements ISa
* Keep the command enabled since there is no automatic re-selection of the debug
* context for this command. If not, it will remain disabled until something causes
* the debug context to change.
- *
+ *
* (non-Javadoc)
* @see org.eclipse.debug.core.commands.AbstractDebugCommand#isRemainEnabled(org.eclipse.debug.core.commands.IDebugCommandRequest)
*/
@@ -159,9 +160,9 @@ public class GdbSaveTraceDataCommand extends AbstractDebugCommand implements ISa
protected boolean isRemainEnabled(IDebugCommandRequest request) {
return true;
}
-
+
private String promptForFileName() {
- Shell shell = Display.getDefault().getActiveShell();
+ Shell shell = Display.getDefault().getActiveShell();
if (shell == null) {
return null;
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbSelectNextTraceRecordCommand.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbSelectNextTraceRecordCommand.java
index ed97eda5ef9..8adbe0769f4 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbSelectNextTraceRecordCommand.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbSelectNextTraceRecordCommand.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
@@ -41,7 +41,7 @@ import org.eclipse.debug.core.commands.IEnabledStateRequest;
/**
* Command to select the next trace record
- *
+ *
* @since 2.1
*/
public class GdbSelectNextTraceRecordCommand extends AbstractDebugCommand implements ISelectNextTraceRecordHandler {
@@ -53,7 +53,7 @@ public class GdbSelectNextTraceRecordCommand extends AbstractDebugCommand implem
fExecutor = session.getExecutor();
fTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
fSession = session;
- }
+ }
public void dispose() {
fTracker.dispose();
@@ -65,103 +65,105 @@ public class GdbSelectNextTraceRecordCommand extends AbstractDebugCommand implem
return;
}
- final ITraceTargetDMContext dmc = DMContexts.getAncestorOfType(((IDMVMContext)targets[0]).getDMContext(), ITraceTargetDMContext.class);
+ final ITraceTargetDMContext dmc = DMContexts.getAncestorOfType(((IDMVMContext) targets[0]).getDMContext(),
+ ITraceTargetDMContext.class);
if (dmc == null) {
return;
}
- Query<Object> selectRecordQuery = new Query<Object>() {
- @Override
- public void execute(final DataRequestMonitor<Object> rm) {
- final IGDBTraceControl traceControl = fTracker.getService(IGDBTraceControl.class);
-
- if (traceControl != null) {
- traceControl.getCurrentTraceRecordContext(
- dmc,
- new DataRequestMonitor<ITraceRecordDMContext>(fExecutor, rm) {
- @Override
- protected void handleSuccess() {
- final ITraceRecordDMContext previousDmc = getData();
- ITraceRecordDMContext nextDmc = traceControl.createNextRecordContext(previousDmc);
- // Must send the event right away to tell the services we are starting visualization
- // If we don't, the services won't behave accordingly soon enough
- // Bug 347514
- fSession.dispatchEvent(new TraceRecordSelectedChangedEvent(nextDmc), new Hashtable<String, String>());
-
- traceControl.selectTraceRecord(nextDmc, new ImmediateRequestMonitor(rm) {
- @Override
- protected void handleError() {
- // If we weren't able to select the next record, we must notify that we are still on the previous one
- // since we have already sent a TraceRecordSelectedChangedEvent early, but it didn't happen.
- fSession.dispatchEvent(new TraceRecordSelectedChangedEvent(previousDmc), new Hashtable<String, String>());
- rm.done();
- }
- });
- };
- });
- } else {
- rm.done();
- }
- }
- };
- try {
- fExecutor.execute(selectRecordQuery);
- selectRecordQuery.get();
+ Query<Object> selectRecordQuery = new Query<Object>() {
+ @Override
+ public void execute(final DataRequestMonitor<Object> rm) {
+ final IGDBTraceControl traceControl = fTracker.getService(IGDBTraceControl.class);
+
+ if (traceControl != null) {
+ traceControl.getCurrentTraceRecordContext(dmc,
+ new DataRequestMonitor<ITraceRecordDMContext>(fExecutor, rm) {
+ @Override
+ protected void handleSuccess() {
+ final ITraceRecordDMContext previousDmc = getData();
+ ITraceRecordDMContext nextDmc = traceControl.createNextRecordContext(previousDmc);
+ // Must send the event right away to tell the services we are starting visualization
+ // If we don't, the services won't behave accordingly soon enough
+ // Bug 347514
+ fSession.dispatchEvent(new TraceRecordSelectedChangedEvent(nextDmc),
+ new Hashtable<String, String>());
+
+ traceControl.selectTraceRecord(nextDmc, new ImmediateRequestMonitor(rm) {
+ @Override
+ protected void handleError() {
+ // If we weren't able to select the next record, we must notify that we are still on the previous one
+ // since we have already sent a TraceRecordSelectedChangedEvent early, but it didn't happen.
+ fSession.dispatchEvent(new TraceRecordSelectedChangedEvent(previousDmc),
+ new Hashtable<String, String>());
+ rm.done();
+ }
+ });
+ };
+ });
+ } else {
+ rm.done();
+ }
+ }
+ };
+ try {
+ fExecutor.execute(selectRecordQuery);
+ selectRecordQuery.get();
} catch (InterruptedException e) {
} catch (ExecutionException e) {
- } catch (RejectedExecutionException e) {
- // Can be thrown if the session is shutdown
- }
+ } catch (RejectedExecutionException e) {
+ // Can be thrown if the session is shutdown
+ }
}
@Override
protected boolean isExecutable(Object[] targets, IProgressMonitor monitor, IEnabledStateRequest request)
- throws CoreException
- {
+ throws CoreException {
if (targets.length != 1) {
return false;
}
- final ITraceTargetDMContext dmc = DMContexts.getAncestorOfType(((IDMVMContext)targets[0]).getDMContext(), ITraceTargetDMContext.class);
+ final ITraceTargetDMContext dmc = DMContexts.getAncestorOfType(((IDMVMContext) targets[0]).getDMContext(),
+ ITraceTargetDMContext.class);
if (dmc == null) {
return false;
}
- Query<Boolean> canSelectRecordQuery = new Query<Boolean>() {
- @Override
- public void execute(final DataRequestMonitor<Boolean> rm) {
- IGDBTraceControl traceControl = fTracker.getService(IGDBTraceControl.class);
-
- if (traceControl != null) {
- traceControl.getTraceStatus(dmc, new DataRequestMonitor<ITraceStatusDMData>(fExecutor, rm) {
- @Override
- protected void handleSuccess() {
- if (getData().getNumberOfCollectedFrame() > 0) {
- IGDBTraceControl traceControl = fTracker.getService(IGDBTraceControl.class);
- if (traceControl != null) {
- traceControl.isTracing(dmc, new DataRequestMonitor<Boolean>(fExecutor, rm) {
- @Override
- protected void handleSuccess() {
- rm.setData(!getData());
- rm.done();
- };
- });
- } else {
- rm.setData(false);
- rm.done();
- }
- } else {
- rm.setData(false);
- rm.done();
- }
- };
- });
- } else {
- rm.setData(false);
- rm.done();
- }
- }
- };
+ Query<Boolean> canSelectRecordQuery = new Query<Boolean>() {
+ @Override
+ public void execute(final DataRequestMonitor<Boolean> rm) {
+ IGDBTraceControl traceControl = fTracker.getService(IGDBTraceControl.class);
+
+ if (traceControl != null) {
+ traceControl.getTraceStatus(dmc, new DataRequestMonitor<ITraceStatusDMData>(fExecutor, rm) {
+ @Override
+ protected void handleSuccess() {
+ if (getData().getNumberOfCollectedFrame() > 0) {
+ IGDBTraceControl traceControl = fTracker.getService(IGDBTraceControl.class);
+ if (traceControl != null) {
+ traceControl.isTracing(dmc, new DataRequestMonitor<Boolean>(fExecutor, rm) {
+ @Override
+ protected void handleSuccess() {
+ rm.setData(!getData());
+ rm.done();
+ };
+ });
+ } else {
+ rm.setData(false);
+ rm.done();
+ }
+ } else {
+ rm.setData(false);
+ rm.done();
+ }
+ };
+ });
+ } else {
+ rm.setData(false);
+ rm.done();
+ }
+ }
+ };
try {
fExecutor.execute(canSelectRecordQuery);
return canSelectRecordQuery.get();
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbSelectPrevTraceRecordCommand.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbSelectPrevTraceRecordCommand.java
index 0fdc5232bc7..d5bf4b79c55 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbSelectPrevTraceRecordCommand.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbSelectPrevTraceRecordCommand.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
* Marc Khouzam (Ericsson) - Disable button when no trace record is selected
@@ -43,7 +43,7 @@ import org.eclipse.debug.core.commands.IEnabledStateRequest;
/**
* Command to select the previous trace record
- *
+ *
* @since 2.1
*/
public class GdbSelectPrevTraceRecordCommand extends AbstractDebugCommand implements ISelectPrevTraceRecordHandler {
@@ -55,7 +55,7 @@ public class GdbSelectPrevTraceRecordCommand extends AbstractDebugCommand implem
fExecutor = session.getExecutor();
fTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
fSession = session;
- }
+ }
public void dispose() {
fTracker.dispose();
@@ -67,97 +67,99 @@ public class GdbSelectPrevTraceRecordCommand extends AbstractDebugCommand implem
return;
}
- final ITraceTargetDMContext dmc = DMContexts.getAncestorOfType(((IDMVMContext)targets[0]).getDMContext(), ITraceTargetDMContext.class);
+ final ITraceTargetDMContext dmc = DMContexts.getAncestorOfType(((IDMVMContext) targets[0]).getDMContext(),
+ ITraceTargetDMContext.class);
if (dmc == null) {
return;
}
- Query<Object> selectRecordQuery = new Query<Object>() {
- @Override
- public void execute(final DataRequestMonitor<Object> rm) {
- final IGDBTraceControl traceControl = fTracker.getService(IGDBTraceControl.class);
-
- if (traceControl != null) {
- traceControl.getCurrentTraceRecordContext(
- dmc,
- new DataRequestMonitor<ITraceRecordDMContext>(fExecutor, rm) {
- @Override
- protected void handleSuccess() {
- final ITraceRecordDMContext prevDmc = traceControl.createPrevRecordContext(getData());
- traceControl.selectTraceRecord(prevDmc, new ImmediateRequestMonitor(rm) {
- @Override
- protected void handleSuccess() {
- fSession.dispatchEvent(new TraceRecordSelectedChangedEvent(prevDmc), new Hashtable<String, String>());
- rm.done();
- }
- });
- };
- });
- } else {
- rm.done();
- }
- }
- };
- try {
- fExecutor.execute(selectRecordQuery);
- selectRecordQuery.get();
+ Query<Object> selectRecordQuery = new Query<Object>() {
+ @Override
+ public void execute(final DataRequestMonitor<Object> rm) {
+ final IGDBTraceControl traceControl = fTracker.getService(IGDBTraceControl.class);
+
+ if (traceControl != null) {
+ traceControl.getCurrentTraceRecordContext(dmc,
+ new DataRequestMonitor<ITraceRecordDMContext>(fExecutor, rm) {
+ @Override
+ protected void handleSuccess() {
+ final ITraceRecordDMContext prevDmc = traceControl
+ .createPrevRecordContext(getData());
+ traceControl.selectTraceRecord(prevDmc, new ImmediateRequestMonitor(rm) {
+ @Override
+ protected void handleSuccess() {
+ fSession.dispatchEvent(new TraceRecordSelectedChangedEvent(prevDmc),
+ new Hashtable<String, String>());
+ rm.done();
+ }
+ });
+ };
+ });
+ } else {
+ rm.done();
+ }
+ }
+ };
+ try {
+ fExecutor.execute(selectRecordQuery);
+ selectRecordQuery.get();
} catch (InterruptedException e) {
} catch (ExecutionException e) {
- } catch (RejectedExecutionException e) {
- // Can be thrown if the session is shutdown
- }
+ } catch (RejectedExecutionException e) {
+ // Can be thrown if the session is shutdown
+ }
}
@Override
protected boolean isExecutable(Object[] targets, IProgressMonitor monitor, IEnabledStateRequest request)
- throws CoreException
- {
+ throws CoreException {
if (targets.length != 1) {
return false;
}
- final ITraceTargetDMContext dmc = DMContexts.getAncestorOfType(((IDMVMContext)targets[0]).getDMContext(), ITraceTargetDMContext.class);
+ final ITraceTargetDMContext dmc = DMContexts.getAncestorOfType(((IDMVMContext) targets[0]).getDMContext(),
+ ITraceTargetDMContext.class);
if (dmc == null) {
return false;
}
- Query<Boolean> canSelectRecordQuery = new Query<Boolean>() {
- @Override
- public void execute(final DataRequestMonitor<Boolean> rm) {
- final IGDBTraceControl traceControl = fTracker.getService(IGDBTraceControl.class);
-
- if (traceControl != null) {
- traceControl.getTraceStatus(dmc, new DataRequestMonitor<ITraceStatusDMData>(fExecutor, rm) {
- @Override
- protected void handleSuccess() {
- if (getData().getNumberOfCollectedFrame() <= 0) {
- // No frames to look at.
- rm.done(false);
- return;
- }
-
- if (getData() instanceof ITraceStatusDMData2) {
- if (((ITraceStatusDMData2)getData()).getCurrentTraceFrameId() == null) {
- // Haven't started looking at frames, so don't enable the "Previous" button
- rm.done(false);
- return;
- }
- }
-
- traceControl.isTracing(dmc, new DataRequestMonitor<Boolean>(fExecutor, rm) {
- @Override
- protected void handleSuccess() {
- // Can do visualization if we are tracing.
- rm.done(!getData());
- };
- });
- };
- });
- } else {
- rm.done(false);
- }
- }
- };
+ Query<Boolean> canSelectRecordQuery = new Query<Boolean>() {
+ @Override
+ public void execute(final DataRequestMonitor<Boolean> rm) {
+ final IGDBTraceControl traceControl = fTracker.getService(IGDBTraceControl.class);
+
+ if (traceControl != null) {
+ traceControl.getTraceStatus(dmc, new DataRequestMonitor<ITraceStatusDMData>(fExecutor, rm) {
+ @Override
+ protected void handleSuccess() {
+ if (getData().getNumberOfCollectedFrame() <= 0) {
+ // No frames to look at.
+ rm.done(false);
+ return;
+ }
+
+ if (getData() instanceof ITraceStatusDMData2) {
+ if (((ITraceStatusDMData2) getData()).getCurrentTraceFrameId() == null) {
+ // Haven't started looking at frames, so don't enable the "Previous" button
+ rm.done(false);
+ return;
+ }
+ }
+
+ traceControl.isTracing(dmc, new DataRequestMonitor<Boolean>(fExecutor, rm) {
+ @Override
+ protected void handleSuccess() {
+ // Can do visualization if we are tracing.
+ rm.done(!getData());
+ };
+ });
+ };
+ });
+ } else {
+ rm.done(false);
+ }
+ }
+ };
try {
fExecutor.execute(canSelectRecordQuery);
return canSelectRecordQuery.get();
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbStartTracingCommand.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbStartTracingCommand.java
index f5af9d4ca87..2260aee8f77 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbStartTracingCommand.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbStartTracingCommand.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
@@ -38,7 +38,7 @@ import org.eclipse.debug.core.commands.IEnabledStateRequest;
/**
* Command to start the tracing experiment
- *
+ *
* @since 2.1
*/
public class GdbStartTracingCommand extends AbstractDebugCommand implements IStartTracingHandler {
@@ -48,80 +48,81 @@ public class GdbStartTracingCommand extends AbstractDebugCommand implements ISta
public GdbStartTracingCommand(DsfSession session) {
fExecutor = session.getExecutor();
fTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
- }
+ }
public void dispose() {
fTracker.dispose();
}
@Override
- protected void doExecute(Object[] targets, IProgressMonitor monitor, IRequest request)
- throws CoreException {
+ protected void doExecute(Object[] targets, IProgressMonitor monitor, IRequest request) throws CoreException {
if (targets.length != 1) {
return;
}
- final ITraceTargetDMContext dmc = DMContexts.getAncestorOfType(((IDMVMContext)targets[0]).getDMContext(), ITraceTargetDMContext.class);
+ final ITraceTargetDMContext dmc = DMContexts.getAncestorOfType(((IDMVMContext) targets[0]).getDMContext(),
+ ITraceTargetDMContext.class);
if (dmc == null) {
return;
}
- Query<Object> startTracingQuery = new Query<Object>() {
- @Override
- public void execute(final DataRequestMonitor<Object> rm) {
- final IGDBTraceControl traceControl = fTracker.getService(IGDBTraceControl.class);
- if (traceControl != null) {
- String user = System.getProperty("user.name"); //$NON-NLS-1$
- if (user != null && !user.isEmpty() && traceControl instanceof IGDBTraceControl2) {
- ((IGDBTraceControl2)traceControl).setTraceUser(dmc, user, new ImmediateRequestMonitor() {
- @Override
- protected void handleCompleted() {
- traceControl.startTracing(dmc, rm);
- };
- });
- } else {
- traceControl.startTracing(dmc, rm);
- }
- } else {
- rm.done();
- }
- }
- };
- try {
- fExecutor.execute(startTracingQuery);
- startTracingQuery.get();
+ Query<Object> startTracingQuery = new Query<Object>() {
+ @Override
+ public void execute(final DataRequestMonitor<Object> rm) {
+ final IGDBTraceControl traceControl = fTracker.getService(IGDBTraceControl.class);
+ if (traceControl != null) {
+ String user = System.getProperty("user.name"); //$NON-NLS-1$
+ if (user != null && !user.isEmpty() && traceControl instanceof IGDBTraceControl2) {
+ ((IGDBTraceControl2) traceControl).setTraceUser(dmc, user, new ImmediateRequestMonitor() {
+ @Override
+ protected void handleCompleted() {
+ traceControl.startTracing(dmc, rm);
+ };
+ });
+ } else {
+ traceControl.startTracing(dmc, rm);
+ }
+ } else {
+ rm.done();
+ }
+ }
+ };
+ try {
+ fExecutor.execute(startTracingQuery);
+ startTracingQuery.get();
} catch (InterruptedException e) {
} catch (ExecutionException e) {
- } catch (RejectedExecutionException e) {
- // Can be thrown if the session is shutdown
- }
+ } catch (RejectedExecutionException e) {
+ // Can be thrown if the session is shutdown
+ }
}
@Override
protected boolean isExecutable(Object[] targets, IProgressMonitor monitor, IEnabledStateRequest request)
- throws CoreException {
+ throws CoreException {
if (targets.length != 1) {
return false;
}
- final ITraceTargetDMContext dmc = DMContexts.getAncestorOfType(((IDMVMContext)targets[0]).getDMContext(), ITraceTargetDMContext.class);
+ final ITraceTargetDMContext dmc = DMContexts.getAncestorOfType(((IDMVMContext) targets[0]).getDMContext(),
+ ITraceTargetDMContext.class);
if (dmc == null) {
return false;
}
- Query<Boolean> canStartTracingQuery = new Query<Boolean>() {
- @Override
- public void execute(DataRequestMonitor<Boolean> rm) {
- IGDBTraceControl traceControl = fTracker.getService(IGDBTraceControl.class);
+ Query<Boolean> canStartTracingQuery = new Query<Boolean>() {
+ @Override
+ public void execute(DataRequestMonitor<Boolean> rm) {
+ IGDBTraceControl traceControl = fTracker.getService(IGDBTraceControl.class);
- if (traceControl != null) {
- traceControl.canStartTracing(dmc, rm);
- } else {
- rm.setData(false);
- rm.done();
- }
- }
- };
+ if (traceControl != null) {
+ traceControl.canStartTracing(dmc, rm);
+ } else {
+ rm.setData(false);
+ rm.done();
+ }
+ }
+ };
try {
fExecutor.execute(canStartTracingQuery);
return canStartTracingQuery.get();
@@ -146,7 +147,7 @@ public class GdbStartTracingCommand extends AbstractDebugCommand implements ISta
* Re-selection of the debug context will be forced by the Debug Model through a StartTracing event.
* Therefore, the enablement of this command will be refreshed, so we don't need to keep it enabled.
* In fact, it is better to have it disabled right after selection to avoid a double-click
- *
+ *
* (non-Javadoc)
* @see org.eclipse.debug.core.commands.AbstractDebugCommand#isRemainEnabled(org.eclipse.debug.core.commands.IDebugCommandRequest)
*/
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbStopTracingCommand.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbStopTracingCommand.java
index 4ce287e2d1f..b6c2de62f74 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbStopTracingCommand.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbStopTracingCommand.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
@@ -36,7 +36,7 @@ import org.eclipse.debug.core.commands.IEnabledStateRequest;
/**
* Command to stop the tracing experiment
- *
+ *
* @since 2.1
*/
public class GdbStopTracingCommand extends AbstractDebugCommand implements IStopTracingHandler {
@@ -46,71 +46,72 @@ public class GdbStopTracingCommand extends AbstractDebugCommand implements IStop
public GdbStopTracingCommand(DsfSession session) {
fExecutor = session.getExecutor();
fTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
- }
+ }
public void dispose() {
fTracker.dispose();
}
@Override
- protected void doExecute(Object[] targets, IProgressMonitor monitor, IRequest request)
- throws CoreException {
+ protected void doExecute(Object[] targets, IProgressMonitor monitor, IRequest request) throws CoreException {
if (targets.length != 1) {
return;
}
- final ITraceTargetDMContext dmc = DMContexts.getAncestorOfType(((IDMVMContext)targets[0]).getDMContext(), ITraceTargetDMContext.class);
+ final ITraceTargetDMContext dmc = DMContexts.getAncestorOfType(((IDMVMContext) targets[0]).getDMContext(),
+ ITraceTargetDMContext.class);
if (dmc == null) {
return;
}
- Query<Object> stopTracingQuery = new Query<Object>() {
- @Override
- public void execute(final DataRequestMonitor<Object> rm) {
- IGDBTraceControl traceControl = fTracker.getService(IGDBTraceControl.class);
-
- if (traceControl != null) {
- traceControl.stopTracing(dmc, rm);
- } else {
- rm.done();
- }
- }
- };
- try {
- fExecutor.execute(stopTracingQuery);
- stopTracingQuery.get();
+ Query<Object> stopTracingQuery = new Query<Object>() {
+ @Override
+ public void execute(final DataRequestMonitor<Object> rm) {
+ IGDBTraceControl traceControl = fTracker.getService(IGDBTraceControl.class);
+
+ if (traceControl != null) {
+ traceControl.stopTracing(dmc, rm);
+ } else {
+ rm.done();
+ }
+ }
+ };
+ try {
+ fExecutor.execute(stopTracingQuery);
+ stopTracingQuery.get();
} catch (InterruptedException e) {
} catch (ExecutionException e) {
- } catch (RejectedExecutionException e) {
- // Can be thrown if the session is shutdown
- }
+ } catch (RejectedExecutionException e) {
+ // Can be thrown if the session is shutdown
+ }
}
@Override
protected boolean isExecutable(Object[] targets, IProgressMonitor monitor, IEnabledStateRequest request)
- throws CoreException {
+ throws CoreException {
if (targets.length != 1) {
return false;
}
- final ITraceTargetDMContext dmc = DMContexts.getAncestorOfType(((IDMVMContext)targets[0]).getDMContext(), ITraceTargetDMContext.class);
+ final ITraceTargetDMContext dmc = DMContexts.getAncestorOfType(((IDMVMContext) targets[0]).getDMContext(),
+ ITraceTargetDMContext.class);
if (dmc == null) {
return false;
}
- Query<Boolean> canStopTracingQuery = new Query<Boolean>() {
- @Override
- public void execute(DataRequestMonitor<Boolean> rm) {
- IGDBTraceControl traceControl = fTracker.getService(IGDBTraceControl.class);
-
- if (traceControl != null) {
- traceControl.canStopTracing(dmc, rm);
- } else {
- rm.setData(false);
- rm.done();
- }
- }
- };
+ Query<Boolean> canStopTracingQuery = new Query<Boolean>() {
+ @Override
+ public void execute(DataRequestMonitor<Boolean> rm) {
+ IGDBTraceControl traceControl = fTracker.getService(IGDBTraceControl.class);
+
+ if (traceControl != null) {
+ traceControl.canStopTracing(dmc, rm);
+ } else {
+ rm.setData(false);
+ rm.done();
+ }
+ }
+ };
try {
fExecutor.execute(canStopTracingQuery);
return canStopTracingQuery.get();
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbUncallCommand.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbUncallCommand.java
index cd6cea889ef..be3fcaa7f31 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbUncallCommand.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbUncallCommand.java
@@ -24,12 +24,12 @@ import org.eclipse.cdt.dsf.service.DsfSession;
* @since 2.1
*/
public class GdbUncallCommand extends GdbAbstractReverseStepCommand implements IUncallHandler {
- public GdbUncallCommand(DsfSession session, DsfSteppingModeTarget steppingMode) {
+ public GdbUncallCommand(DsfSession session, DsfSteppingModeTarget steppingMode) {
super(session, steppingMode);
- }
-
- @Override
- protected final StepType getStepType() {
- return StepType.STEP_RETURN;
- }
+ }
+
+ @Override
+ protected final StepType getStepType() {
+ return StepType.STEP_RETURN;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/Messages.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/Messages.java
index f37189e05dd..71db50d4f20 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/Messages.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/Messages.java
@@ -51,20 +51,20 @@ public class Messages extends NLS {
public static String GdbDebugNewExecutableCommand_Select_Binary;
public static String GdbDebugNewExecutableCommand_Select_binary_and_specify_arguments;
-
+
public static String GdbReverseDebugging_HardwareReverseDebugNotAvailable;
public static String GdbReverseDebugging_ProcessorTraceReverseDebugNotAvailable;
-
+
public static String GdbReverseDebugging_ReverseDebugNotAvailable;
public static String GdbConnectCommand_Error;
-
+
public static String GdbConnectCommand_FailureMessage;
static {
// initialize resource bundle
- NLS.initializeMessages( Messages.class.getName(), Messages.class );
+ NLS.initializeMessages(Messages.class.getName(), Messages.class);
}
private Messages() {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/RefreshableDebugCommand.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/RefreshableDebugCommand.java
index cd3c9ec7e42..ece6a62d4aa 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/RefreshableDebugCommand.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/RefreshableDebugCommand.java
@@ -28,8 +28,8 @@ import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.progress.UIJob;
/**
- * The enablement of a {@link AbstractDebugCommand} is updated only when the current
- * debug context is changed. In some cases we need to force an update without changing
+ * The enablement of a {@link AbstractDebugCommand} is updated only when the current
+ * debug context is changed. In some cases we need to force an update without changing
* the context. This class provides such a functionality.
* The proper way is to modify {@link AbstractDebugCommand}.
*/
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/SelectNextTraceRecordCommandHandler.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/SelectNextTraceRecordCommandHandler.java
index 87d0e71c280..f4401d478b8 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/SelectNextTraceRecordCommandHandler.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/SelectNextTraceRecordCommandHandler.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
@@ -18,7 +18,7 @@ import org.eclipse.debug.ui.actions.DebugCommandHandler;
/**
* Command handler to select the next trace record
- *
+ *
* @since 2.1
*/
public class SelectNextTraceRecordCommandHandler extends DebugCommandHandler {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/SelectPrevTraceRecordCommandHandler.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/SelectPrevTraceRecordCommandHandler.java
index 76a3a00c279..196475f7ae1 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/SelectPrevTraceRecordCommandHandler.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/SelectPrevTraceRecordCommandHandler.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
@@ -18,7 +18,7 @@ import org.eclipse.debug.ui.actions.DebugCommandHandler;
/**
* Command handler to select the previous trace record
- *
+ *
* @since 2.1
*/
public class SelectPrevTraceRecordCommandHandler extends DebugCommandHandler {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/ConsoleMessages.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/ConsoleMessages.java
index 7c5cf30678f..5a2c7a21e08 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/ConsoleMessages.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/ConsoleMessages.java
@@ -36,13 +36,13 @@ public class ConsoleMessages extends NLS {
public static String ConsoleScrollLockAction_name;
public static String ConsoleScrollLockAction_description;
-
+
public static String ConsoleCopyAction_name;
public static String ConsoleCopyAction_description;
-
+
public static String ConsolePasteAction_name;
public static String ConsolePasteAction_description;
-
+
public static String ConsoleSelectAllAction_name;
public static String ConsoleSelectAllAction_description;
@@ -50,12 +50,12 @@ public class ConsoleMessages extends NLS {
public static String ConsoleAutoTerminateAction_description;
public static String GdbConsolePreferences_name;
-
+
static {
// initialize resource bundle
NLS.initializeMessages(ConsoleMessages.class.getName(), ConsoleMessages.class);
}
-
+
private ConsoleMessages() {
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/ConsolePageParticipant.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/ConsolePageParticipant.java
index df3c92d8935..7be5b4b751e 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/ConsolePageParticipant.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/ConsolePageParticipant.java
@@ -41,26 +41,27 @@ import org.eclipse.ui.part.IPageBookViewPage;
* It adds a save button to the gdb tracing console.
* It also brings to the front the proper inferior console when an element of the
* debug view is selected.
- *
+ *
* @since 2.1
*/
public class ConsolePageParticipant implements IConsolePageParticipant, IDebugContextListener {
-
- private IConsole fConsole;
- private IPageBookViewPage fPage;
- private IConsoleView fView;
- @Override
+ private IConsole fConsole;
+ private IPageBookViewPage fPage;
+ private IConsoleView fView;
+
+ @Override
public void init(IPageBookViewPage page, IConsole console) {
- fPage = page;
- fConsole = console;
- fView = (IConsoleView)fPage.getSite().getPage().findView(IConsoleConstants.ID_CONSOLE_VIEW);
+ fPage = page;
+ fConsole = console;
+ fView = (IConsoleView) fPage.getSite().getPage().findView(IConsoleConstants.ID_CONSOLE_VIEW);
- if (isConsoleInferior(console)) {
- // This console participant will affect all consoles, even those not for DSF-GDB.
- // Only consoles for InferiorRuntimeProcess are what we care about for DSF-GDB
- DebugUITools.getDebugContextManager().getContextService(fPage.getSite().getWorkbenchWindow()).addDebugContextListener(this);
- }
+ if (isConsoleInferior(console)) {
+ // This console participant will affect all consoles, even those not for DSF-GDB.
+ // Only consoles for InferiorRuntimeProcess are what we care about for DSF-GDB
+ DebugUITools.getDebugContextManager().getContextService(fPage.getSite().getWorkbenchWindow())
+ .addDebugContextListener(this);
+ }
if (console instanceof TracingConsole) {
TextConsole textConsole = (TextConsole) console;
@@ -76,84 +77,85 @@ public class ConsolePageParticipant implements IConsolePageParticipant, IDebugCo
/**
* Checks if the the console is for an inferior.
- *
+ *
* @param console The console to check
* @return true if the the console is for an inferior
*/
private boolean isConsoleInferior(IConsole console) {
if (console instanceof org.eclipse.debug.ui.console.IConsole) {
- org.eclipse.debug.ui.console.IConsole debugConsole = (org.eclipse.debug.ui.console.IConsole)console;
+ org.eclipse.debug.ui.console.IConsole debugConsole = (org.eclipse.debug.ui.console.IConsole) console;
return (debugConsole.getProcess() instanceof InferiorRuntimeProcess);
}
return false;
}
-
- @Override
- public <T> T getAdapter(Class<T> adapter) {
+
+ @Override
+ public <T> T getAdapter(Class<T> adapter) {
return null;
}
-
- @Override
+
+ @Override
public void dispose() {
- if (isConsoleInferior(fConsole)) {
- DebugUITools.getDebugContextManager().getContextService(fPage.getSite().getWorkbenchWindow()).removeDebugContextListener(this);
+ if (isConsoleInferior(fConsole)) {
+ DebugUITools.getDebugContextManager().getContextService(fPage.getSite().getWorkbenchWindow())
+ .removeDebugContextListener(this);
}
fConsole = null;
}
- @Override
+ @Override
public void activated() {
}
- @Override
+ @Override
public void deactivated() {
}
- protected IProcess getConsoleProcess() {
- if (fConsole instanceof org.eclipse.debug.ui.console.IConsole) {
- return ((org.eclipse.debug.ui.console.IConsole)fConsole).getProcess();
- }
- return null;
- }
-
+ protected IProcess getConsoleProcess() {
+ if (fConsole instanceof org.eclipse.debug.ui.console.IConsole) {
+ return ((org.eclipse.debug.ui.console.IConsole) fConsole).getProcess();
+ }
+ return null;
+ }
+
protected IProcess getCurrentProcess() {
IAdaptable context = DebugUITools.getDebugContext();
-
+
// If the launch is selected, we should choose the first inferior being debugged
// If the GDB process is selected, and since the GDB console is not in the standard
// console view, we should show a console that is part of the same launch as the
// GDB process, so we can treat it the same as the launch selection case
- if (context instanceof ILaunch || context instanceof GDBProcess) {
- ILaunch launch;
- if (context instanceof ILaunch) {
- launch = (ILaunch)context;
- } else {
- launch = ((GDBProcess)context).getLaunch();
- }
-
- // Note that ProcessConsolePageParticipant also handles the case
- // of ILaunch being selected. Usually, that class gets called
- // after our current class, so the console it chooses wins in the
- // case of ILaunch.
- // So, for consistency, when GDBProcess is selected, we choose the
- // same inferior chosen by ProcessConsolePageParticipant when
- // ILaunch is selected, which is the last (not the first) inferior
- // process.
- // Note that we could ignore the ILaunch case in this class
- // since it is already handled by ProcessConsolePageParticipant,
- // but just to be safe and future-proof, we also handle it.
- IProcess[] processes = launch.getProcesses();
- if (processes != null && processes.length > 0) {
- for (int i = processes.length-1; i >= 0; i--) {
- IProcess process = processes[i];
- if (process instanceof InferiorRuntimeProcess) {
- return process;
- }
- }
- }
-
- return null;
- }
+ if (context instanceof ILaunch || context instanceof GDBProcess) {
+ ILaunch launch;
+ if (context instanceof ILaunch) {
+ launch = (ILaunch) context;
+ } else {
+ launch = ((GDBProcess) context).getLaunch();
+ }
+
+ // Note that ProcessConsolePageParticipant also handles the case
+ // of ILaunch being selected. Usually, that class gets called
+ // after our current class, so the console it chooses wins in the
+ // case of ILaunch.
+ // So, for consistency, when GDBProcess is selected, we choose the
+ // same inferior chosen by ProcessConsolePageParticipant when
+ // ILaunch is selected, which is the last (not the first) inferior
+ // process.
+ // Note that we could ignore the ILaunch case in this class
+ // since it is already handled by ProcessConsolePageParticipant,
+ // but just to be safe and future-proof, we also handle it.
+ IProcess[] processes = launch.getProcesses();
+ if (processes != null && processes.length > 0) {
+ for (int i = processes.length - 1; i >= 0; i--) {
+ IProcess process = processes[i];
+ if (process instanceof InferiorRuntimeProcess) {
+ return process;
+ }
+ }
+ }
+
+ return null;
+ }
if (context != null) {
// Look for the process that this context refers to, so we can select its console
@@ -162,42 +164,41 @@ public class ConsolePageParticipant implements IConsolePageParticipant, IDebugCo
if (container != null) {
ILaunch launch = context.getAdapter(ILaunch.class);
if (launch != null) {
- IProcess[] processes = launch.getProcesses();
- if (processes != null && processes.length > 0) {
- for (IProcess process : processes) {
- if (process instanceof InferiorRuntimeProcess) {
- String groupId = process.getAttribute(IGdbDebugConstants.INFERIOR_GROUPID_ATTR);
-
- if (groupId == null || groupId.equals(MIProcesses.UNIQUE_GROUP_ID) ||
- container.getGroupId().equals(groupId)) {
- // if the groupId is not set in the process we know we are dealing
- // with single process debugging and we can just return the inferior.
- // If the groupId is set, then we must find the proper inferior
- return process;
- }
- }
- }
-
- // No inferior? return the gdb process
- if (processes[0] instanceof GDBProcess) {
- return processes[0];
- }
- }
+ IProcess[] processes = launch.getProcesses();
+ if (processes != null && processes.length > 0) {
+ for (IProcess process : processes) {
+ if (process instanceof InferiorRuntimeProcess) {
+ String groupId = process.getAttribute(IGdbDebugConstants.INFERIOR_GROUPID_ATTR);
+
+ if (groupId == null || groupId.equals(MIProcesses.UNIQUE_GROUP_ID)
+ || container.getGroupId().equals(groupId)) {
+ // if the groupId is not set in the process we know we are dealing
+ // with single process debugging and we can just return the inferior.
+ // If the groupId is set, then we must find the proper inferior
+ return process;
+ }
+ }
+ }
+
+ // No inferior? return the gdb process
+ if (processes[0] instanceof GDBProcess) {
+ return processes[0];
+ }
+ }
}
}
}
return null;
}
-
- @Override
+
+ @Override
public void debugContextChanged(DebugContextEvent event) {
if ((event.getFlags() & DebugContextEvent.ACTIVATED) > 0) {
IProcess consoleProcess = getConsoleProcess();
if (fView != null && consoleProcess != null && consoleProcess.equals(getCurrentProcess())) {
- fView.display(fConsole);
- }
+ fView.display(fConsole);
+ }
}
}
}
-
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbAbstractConsolePreferenceListener.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbAbstractConsolePreferenceListener.java
index 109ef2fe08a..4d7a4c7ad0d 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbAbstractConsolePreferenceListener.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbAbstractConsolePreferenceListener.java
@@ -27,15 +27,21 @@ public abstract class GdbAbstractConsolePreferenceListener implements IPropertyC
boolean terminate = terminateStr.equals(Boolean.FALSE.toString()) ? false : true;
handleAutoTerminatePref(terminate);
} else if (property.equals(IGdbDebugPreferenceConstants.PREF_CONSOLE_INVERTED_COLORS)) {
- boolean enabled = Platform.getPreferencesService().getBoolean(GdbPlugin.PLUGIN_ID, IGdbDebugPreferenceConstants.PREF_CONSOLE_INVERTED_COLORS, IGdbDebugPreferenceConstants.CONSOLE_INVERTED_COLORS_DEFAULT, null);
+ boolean enabled = Platform.getPreferencesService().getBoolean(GdbPlugin.PLUGIN_ID,
+ IGdbDebugPreferenceConstants.PREF_CONSOLE_INVERTED_COLORS,
+ IGdbDebugPreferenceConstants.CONSOLE_INVERTED_COLORS_DEFAULT, null);
handleInvertColorsPref(enabled);
} else if (property.equals(IGdbDebugPreferenceConstants.PREF_CONSOLE_BUFFERLINES)) {
- int bufferLines = Platform.getPreferencesService().getInt(GdbPlugin.PLUGIN_ID, IGdbDebugPreferenceConstants.PREF_CONSOLE_BUFFERLINES, IGdbDebugPreferenceConstants.CONSOLE_BUFFERLINES_DEFAULT, null);
+ int bufferLines = Platform.getPreferencesService().getInt(GdbPlugin.PLUGIN_ID,
+ IGdbDebugPreferenceConstants.PREF_CONSOLE_BUFFERLINES,
+ IGdbDebugPreferenceConstants.CONSOLE_BUFFERLINES_DEFAULT, null);
handleBufferLinesPref(bufferLines);
}
}
-
+
protected abstract void handleAutoTerminatePref(boolean enabled);
+
protected abstract void handleInvertColorsPref(boolean enabled);
+
protected abstract void handleBufferLinesPref(int bufferLines);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbBasicCliConsole.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbBasicCliConsole.java
index 4c4d2531237..0037eef758c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbBasicCliConsole.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbBasicCliConsole.java
@@ -44,7 +44,7 @@ import org.eclipse.ui.part.IPageBookViewPage;
public class GdbBasicCliConsole extends IOConsole implements IGDBDebuggerConsole {
/**
- * A conversion factor used to resolve number of characters from number of lines
+ * A conversion factor used to resolve number of characters from number of lines
*/
private final static int CHARS_PER_LINE_AVG = 80;
private final static int HIGH_WATERMARK_OFFSET_CHARS = 8000;
@@ -54,7 +54,7 @@ public class GdbBasicCliConsole extends IOConsole implements IGDBDebuggerConsole
private final Process fProcess;
private final IOConsoleOutputStream fOutputStream;
private final IOConsoleOutputStream fErrorStream;
-
+
private GdbAbstractConsolePreferenceListener fPreferenceListener = new GdbAbstractConsolePreferenceListener() {
@Override
@@ -76,21 +76,21 @@ public class GdbBasicCliConsole extends IOConsole implements IGDBDebuggerConsole
public GdbBasicCliConsole(ILaunch launch, String label, Process process) {
super("", "GdbBasicCliConsole", null, false); //$NON-NLS-1$ //$NON-NLS-2$
fLaunch = launch;
- fLabel = label;
- fProcess = process;
- fOutputStream = newOutputStream();
- fErrorStream = newOutputStream();
-
- assert(process != null);
-
- // Create a lifecycle listener to call init() and dispose()
- new GdbConsoleLifecycleListener(this);
-
+ fLabel = label;
+ fProcess = process;
+ fOutputStream = newOutputStream();
+ fErrorStream = newOutputStream();
+
+ assert (process != null);
+
+ // Create a lifecycle listener to call init() and dispose()
+ new GdbConsoleLifecycleListener(this);
+
GdbUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(fPreferenceListener);
- resetName();
- setDefaults();
-
+ resetName();
+ setDefaults();
+
new InputReadJob().schedule();
new OutputReadJob().schedule();
new ErrorReadJob().schedule();
@@ -106,11 +106,11 @@ public class GdbBasicCliConsole extends IOConsole implements IGDBDebuggerConsole
public void stop() {
// Closing the streams will trigger the termination of the associated reading jobs
try {
- fOutputStream.close();
+ fOutputStream.close();
} catch (IOException e) {
}
- try {
- fErrorStream.close();
+ try {
+ fErrorStream.close();
} catch (IOException e) {
}
@@ -135,177 +135,177 @@ public class GdbBasicCliConsole extends IOConsole implements IGDBDebuggerConsole
if (inputStream != null) {
inputStream.setColor(Display.getDefault().getSystemColor(SWT.COLOR_GREEN));
}
- fErrorStream.setColor(Display.getDefault().getSystemColor(SWT.COLOR_RED));
+ fErrorStream.setColor(Display.getDefault().getSystemColor(SWT.COLOR_RED));
- setInvertedColors(enabled);
- setBufferLineLimit(bufferLines);
- });
+ setInvertedColors(enabled);
+ setBufferLineLimit(bufferLines);
+ });
}
@Override
public ILaunch getLaunch() {
return fLaunch;
}
-
- @Override
+
+ @Override
public void resetName() {
- String newName = computeName();
- String name = getName();
- if (!name.equals(newName)) {
- try {
- PlatformUI.getWorkbench().getDisplay().asyncExec(() -> setName(newName));
+ String newName = computeName();
+ String name = getName();
+ if (!name.equals(newName)) {
+ try {
+ PlatformUI.getWorkbench().getDisplay().asyncExec(() -> setName(newName));
} catch (SWTException e) {
// display may be disposed, so ignore the exception
if (e.code != SWT.ERROR_WIDGET_DISPOSED) {
throw e;
}
}
- }
- }
-
- protected String computeName() {
- if (fLaunch == null) {
- return ""; //$NON-NLS-1$
- }
-
- String label = fLabel;
-
- ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
- if (config != null && !DebugUITools.isPrivate(config)) {
- String type = null;
- try {
- type = config.getType().getName();
- } catch (CoreException e) {
- }
- StringBuffer buffer = new StringBuffer();
- buffer.append(config.getName());
- if (type != null) {
- buffer.append(" ["); //$NON-NLS-1$
- buffer.append(type);
- buffer.append("] "); //$NON-NLS-1$
- }
- buffer.append(label);
- label = buffer.toString();
- }
-
- if (fLaunch.isTerminated()) {
- return ConsoleMessages.ConsoleMessages_console_terminated + label;
- }
-
- return label;
- }
-
- @Override
+ }
+ }
+
+ protected String computeName() {
+ if (fLaunch == null) {
+ return ""; //$NON-NLS-1$
+ }
+
+ String label = fLabel;
+
+ ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
+ if (config != null && !DebugUITools.isPrivate(config)) {
+ String type = null;
+ try {
+ type = config.getType().getName();
+ } catch (CoreException e) {
+ }
+ StringBuffer buffer = new StringBuffer();
+ buffer.append(config.getName());
+ if (type != null) {
+ buffer.append(" ["); //$NON-NLS-1$
+ buffer.append(type);
+ buffer.append("] "); //$NON-NLS-1$
+ }
+ buffer.append(label);
+ label = buffer.toString();
+ }
+
+ if (fLaunch.isTerminated()) {
+ return ConsoleMessages.ConsoleMessages_console_terminated + label;
+ }
+
+ return label;
+ }
+
+ @Override
public IPageBookViewPage createPage(IConsoleView view) {
- return new GdbBasicCliConsolePage(this, view);
- }
+ return new GdbBasicCliConsolePage(this, view);
+ }
@Override
public IPageBookViewPage createDebuggerPage(IDebuggerConsoleView view) {
if (view instanceof IConsoleView) {
- return createPage((IConsoleView)view);
+ return createPage((IConsoleView) view);
}
return null;
}
-
+
private void setInvertedColors(boolean enable) {
if (enable) {
setBackground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
fOutputStream.setColor(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
} else {
- setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
+ setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
fOutputStream.setColor(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
}
}
private void setBufferLineLimit(int bufferLines) {
int chars = bufferLines * CHARS_PER_LINE_AVG;
- // The buffer will be allowed to grow up-to the high watermark.
+ // The buffer will be allowed to grow up-to the high watermark.
// When high watermark is passed, it will be trimmed-down to the low watermark.
// So here add an extra buffer for high watermark.
setWaterMarks(chars, chars + HIGH_WATERMARK_OFFSET_CHARS);
}
-
- private class InputReadJob extends Job {
- {
- setSystem(true);
- }
-
- InputReadJob() {
- super("GDB CLI Input Job"); //$NON-NLS-1$
- }
-
- @Override
+
+ private class InputReadJob extends Job {
+ {
+ setSystem(true);
+ }
+
+ InputReadJob() {
+ super("GDB CLI Input Job"); //$NON-NLS-1$
+ }
+
+ @Override
protected IStatus run(IProgressMonitor monitor) {
- try {
- byte[] b = new byte[1024];
- int read = 0;
- do {
- IOConsoleInputStream inputStream = getInputStream();
- if (inputStream == null) {
- break;
- }
- read = inputStream.read(b);
- if (read > 0) {
- fProcess.getOutputStream().write(b, 0, read);
- }
-
- } while (read >= 0);
- } catch (IOException e) {
- }
- return Status.OK_STATUS;
- }
- }
-
- private class OutputReadJob extends Job {
- {
- setSystem(true);
- }
-
- OutputReadJob() {
- super("GDB CLI output Job"); //$NON-NLS-1$
- }
-
- @Override
+ try {
+ byte[] b = new byte[1024];
+ int read = 0;
+ do {
+ IOConsoleInputStream inputStream = getInputStream();
+ if (inputStream == null) {
+ break;
+ }
+ read = inputStream.read(b);
+ if (read > 0) {
+ fProcess.getOutputStream().write(b, 0, read);
+ }
+
+ } while (read >= 0);
+ } catch (IOException e) {
+ }
+ return Status.OK_STATUS;
+ }
+ }
+
+ private class OutputReadJob extends Job {
+ {
+ setSystem(true);
+ }
+
+ OutputReadJob() {
+ super("GDB CLI output Job"); //$NON-NLS-1$
+ }
+
+ @Override
protected IStatus run(IProgressMonitor monitor) {
- try {
- byte[] b = new byte[1024];
- int read = 0;
- do {
- read = fProcess.getInputStream().read(b);
- if (read > 0) {
- fOutputStream.write(b, 0, read);
- }
- } while (read >= 0);
- } catch (IOException e) {
- }
- return Status.OK_STATUS;
- }
- }
-
- private class ErrorReadJob extends Job {
- {
- setSystem(true);
- }
-
- ErrorReadJob() {
- super("GDB CLI error output Job"); //$NON-NLS-1$
- }
-
- @Override
+ try {
+ byte[] b = new byte[1024];
+ int read = 0;
+ do {
+ read = fProcess.getInputStream().read(b);
+ if (read > 0) {
+ fOutputStream.write(b, 0, read);
+ }
+ } while (read >= 0);
+ } catch (IOException e) {
+ }
+ return Status.OK_STATUS;
+ }
+ }
+
+ private class ErrorReadJob extends Job {
+ {
+ setSystem(true);
+ }
+
+ ErrorReadJob() {
+ super("GDB CLI error output Job"); //$NON-NLS-1$
+ }
+
+ @Override
protected IStatus run(IProgressMonitor monitor) {
- try {
- byte[] b = new byte[1024];
- int read = 0;
- do {
- read = fProcess.getErrorStream().read(b);
- if (read > 0) {
- fErrorStream.write(b, 0, read);
- }
- } while (read >= 0);
- } catch (IOException e) {
- }
- return Status.OK_STATUS;
- }
- }
+ try {
+ byte[] b = new byte[1024];
+ int read = 0;
+ do {
+ read = fProcess.getErrorStream().read(b);
+ if (read > 0) {
+ fErrorStream.write(b, 0, read);
+ }
+ } while (read >= 0);
+ } catch (IOException e) {
+ }
+ return Status.OK_STATUS;
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbBasicCliConsolePage.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbBasicCliConsolePage.java
index 3b124aeb2b0..99ea06a4770 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbBasicCliConsolePage.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbBasicCliConsolePage.java
@@ -30,7 +30,7 @@ import org.eclipse.ui.internal.console.IOConsolePage;
/**
* Page used for a basic GDB console. Each Debug session which uses the basic GDB console will
* use its own instance of this page. The basic console is used for older GDB versions.
- *
+ *
* Contributions to this page's context menu can be done using id "GdbBasicCliConsole.#ContextMenu".
* For example, using the extension point:<br>
* <code>
@@ -43,7 +43,7 @@ public class GdbBasicCliConsolePage extends IOConsolePage implements IDebugConte
private final ILaunch fLaunch;
private final IConsoleView fView;
private final IDebuggerConsole fConsole;
-
+
private GdbConsoleTerminateLaunchAction fTerminateLaunchAction;
private GdbConsoleShowPreferencesAction fShowPreferencePageAction;
@@ -57,13 +57,15 @@ public class GdbBasicCliConsolePage extends IOConsolePage implements IDebugConte
@Override
public void dispose() {
super.dispose();
- DebugUITools.getDebugContextManager().getContextService(getSite().getWorkbenchWindow()).removeDebugContextListener(this);
+ DebugUITools.getDebugContextManager().getContextService(getSite().getWorkbenchWindow())
+ .removeDebugContextListener(this);
}
-
+
@Override
public void createControl(Composite parent) {
super.createControl(parent);
- DebugUITools.getDebugContextManager().getContextService(getSite().getWorkbenchWindow()).addDebugContextListener(this);
+ DebugUITools.getDebugContextManager().getContextService(getSite().getWorkbenchWindow())
+ .addDebugContextListener(this);
}
@Override
@@ -81,16 +83,16 @@ public class GdbBasicCliConsolePage extends IOConsolePage implements IDebugConte
protected void contextMenuAboutToShow(IMenuManager menuManager) {
menuManager.add(fTerminateLaunchAction);
menuManager.add(new Separator());
-
+
// Other plug-ins can contribute their actions here
menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
menuManager.add(fShowPreferencePageAction);
}
-
+
/**
* Returns the launch to which the current selection belongs.
- *
+ *
* @return the launch to which the current selection belongs.
*/
protected ILaunch getCurrentLaunch() {
@@ -100,7 +102,7 @@ public class GdbBasicCliConsolePage extends IOConsolePage implements IDebugConte
}
return null;
}
-
+
@Override
public void debugContextChanged(DebugContextEvent event) {
if ((event.getFlags() & DebugContextEvent.ACTIVATED) > 0) {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbCliConsoleManager.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbCliConsoleManager.java
index 00f6b3fdb12..c27f15f0ddd 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbCliConsoleManager.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbCliConsoleManager.java
@@ -35,7 +35,7 @@ import org.eclipse.debug.core.ILaunchesListener2;
/**
* A console manager for GDB sessions which adds and removes
* gdb cli consoles.
- *
+ *
* There is a single such console per debug session.
* This console interacts directly with the GDB process using
* the standard GDB CLI interface.
@@ -59,36 +59,36 @@ public class GdbCliConsoleManager implements ILaunchesListener2 {
DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(this);
}
- @Override
+ @Override
public void launchesAdded(ILaunch[] launches) {
for (ILaunch launch : launches) {
handleConsoleForLaunch(launch);
}
}
- @Override
+ @Override
public void launchesChanged(ILaunch[] launches) {
}
- @Override
+ @Override
public void launchesRemoved(ILaunch[] launches) {
for (ILaunch launch : launches) {
removeConsole(launch);
}
}
-
- @Override
+
+ @Override
public void launchesTerminated(ILaunch[] launches) {
for (ILaunch launch : launches) {
renameConsole(launch);
stopConsole(launch);
}
}
-
+
protected void handleConsoleForLaunch(ILaunch launch) {
// Full CLI GDB consoles are only added for GdbLaunches
if (launch instanceof GdbLaunch) {
- new GdbConsoleCreator((GdbLaunch)launch).init();
+ new GdbConsoleCreator((GdbLaunch) launch).init();
}
}
@@ -111,11 +111,11 @@ public class GdbCliConsoleManager implements ILaunchesListener2 {
IDebuggerConsole console = getConsole(launch);
if (console != null) {
console.resetName();
- }
+ }
}
private IDebuggerConsole getConsole(ILaunch launch) {
- IDebuggerConsoleManager manager = CDebugUIPlugin.getDebuggerConsoleManager();
+ IDebuggerConsoleManager manager = CDebugUIPlugin.getDebuggerConsoleManager();
for (IDebuggerConsole console : manager.getConsoles()) {
if (console.getLaunch().equals(launch)) {
return console;
@@ -127,15 +127,15 @@ public class GdbCliConsoleManager implements ILaunchesListener2 {
private void addConsole(IDebuggerConsole console) {
getDebuggerConsoleManager().addConsole(console);
}
-
+
private void removeConsole(IDebuggerConsole console) {
getDebuggerConsoleManager().removeConsole(console);
}
-
+
private IDebuggerConsoleManager getDebuggerConsoleManager() {
return CDebugUIPlugin.getDebuggerConsoleManager();
}
-
+
/**
* Class that determines what type of console should be created
* for this particular Gdblaunch. It figures this out by asking the
@@ -145,41 +145,42 @@ public class GdbCliConsoleManager implements ILaunchesListener2 {
private class GdbConsoleCreator {
private GdbLaunch fLaunch;
private DsfSession fSession;
-
+
public GdbConsoleCreator(GdbLaunch launch) {
fLaunch = launch;
fSession = launch.getSession();
}
-
+
public void init() {
try {
fSession.getExecutor().submit(new DsfRunnable() {
- @Override
- public void run() {
- // Look for backend service right away. It probably
- // won't be available yet but we must make sure.
- DsfServicesTracker tracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), fSession.getId());
- // Use the lowest level service name in case those are created but don't implement
- // the most specialized classes IGDBControl or IGDBBackend.
- ICommandControlService control = tracker.getService(ICommandControlService.class);
- IMIBackend backend = tracker.getService(IMIBackend.class);
- tracker.dispose();
-
- // If we use the old console we not only need the backend service but
- // also the control service. For simplicity, always wait for both.
- if (backend != null && control != null) {
- // Backend and Control services already available, we can start!
- verifyAndCreateCliConsole();
- } else {
- // Backend service or Control service not available yet, let's wait for them to start.
- new GdbServiceStartedListener(GdbConsoleCreator.this, fSession);
- }
- }
- });
+ @Override
+ public void run() {
+ // Look for backend service right away. It probably
+ // won't be available yet but we must make sure.
+ DsfServicesTracker tracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(),
+ fSession.getId());
+ // Use the lowest level service name in case those are created but don't implement
+ // the most specialized classes IGDBControl or IGDBBackend.
+ ICommandControlService control = tracker.getService(ICommandControlService.class);
+ IMIBackend backend = tracker.getService(IMIBackend.class);
+ tracker.dispose();
+
+ // If we use the old console we not only need the backend service but
+ // also the control service. For simplicity, always wait for both.
+ if (backend != null && control != null) {
+ // Backend and Control services already available, we can start!
+ verifyAndCreateCliConsole();
+ } else {
+ // Backend service or Control service not available yet, let's wait for them to start.
+ new GdbServiceStartedListener(GdbConsoleCreator.this, fSession);
+ }
+ }
+ });
} catch (RejectedExecutionException e) {
}
}
-
+
@ConfinedToDsfExecutor("fSession.getExecutor()")
private void verifyAndCreateCliConsole() {
String gdbVersion;
@@ -189,14 +190,14 @@ public class GdbCliConsoleManager implements ILaunchesListener2 {
gdbVersion = "???"; //$NON-NLS-1$
assert false : "Should not happen since the gdb version is cached"; //$NON-NLS-1$
}
- String consoleTitle = fLaunch.getGDBPath().toOSString().trim() + " (" + gdbVersion +")"; //$NON-NLS-1$ //$NON-NLS-2$
+ String consoleTitle = fLaunch.getGDBPath().toOSString().trim() + " (" + gdbVersion + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- DsfServicesTracker tracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), fSession.getId());
- IGDBControl control = tracker.getService(IGDBControl.class);
- IGDBBackend backend = tracker.getService(IGDBBackend.class);
- tracker.dispose();
+ DsfServicesTracker tracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), fSession.getId());
+ IGDBControl control = tracker.getService(IGDBControl.class);
+ IGDBBackend backend = tracker.getService(IGDBBackend.class);
+ tracker.dispose();
- IDebuggerConsole console;
+ IDebuggerConsole console;
if (backend != null && backend.isFullGdbConsoleSupported()) {
// Create a full GDB cli console
console = new GdbFullCliConsole(fLaunch, consoleTitle, backend.getProcess(), backend.getProcessPty());
@@ -208,18 +209,18 @@ public class GdbCliConsoleManager implements ILaunchesListener2 {
assert false;
return;
}
-
+
addConsole(console);
-
-// No need to open the view manually as it is associated with the Debug view
-// and is handled through the automatic view management system.
-// It will be opened by the platform.
-// See http://eclip.se/509897
+
+ // No need to open the view manually as it is associated with the Debug view
+ // and is handled through the automatic view management system.
+ // It will be opened by the platform.
+ // See http://eclip.se/509897
// Make sure the Debugger Console view is visible but do not force it to the top
// getDebuggerConsoleManager().openConsoleView();
}
}
-
+
/**
* Class used to listen for started events for the services we need.
* This class must be public to receive the event.
@@ -227,13 +228,13 @@ public class GdbCliConsoleManager implements ILaunchesListener2 {
public class GdbServiceStartedListener {
private DsfSession fSession;
private GdbConsoleCreator fCreator;
-
+
public GdbServiceStartedListener(GdbConsoleCreator creator, DsfSession session) {
- fCreator = creator;
+ fCreator = creator;
fSession = session;
fSession.addServiceEventListener(this, null);
}
-
+
@DsfServiceEventHandler
public final void eventDispatched(ICommandControlInitializedDMEvent event) {
// With the commandControl service started, we know the backend service
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbConsoleLifecycleListener.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbConsoleLifecycleListener.java
index 1d1213f308c..c0c72221dae 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbConsoleLifecycleListener.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbConsoleLifecycleListener.java
@@ -20,14 +20,14 @@ import org.eclipse.ui.console.IConsoleListener;
* and <code>dispose()</code>.
*/
public class GdbConsoleLifecycleListener implements IConsoleListener {
-
+
private final AbstractConsole fConsole;
-
+
public GdbConsoleLifecycleListener(AbstractConsole console) {
fConsole = console;
CDebugUIPlugin.getDebuggerConsoleManager().addConsoleListener(this);
}
-
+
@Override
public void consolesAdded(IConsole[] consoles) {
for (IConsole console : consoles) {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbFullCliConsole.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbFullCliConsole.java
index 51ea26ba32b..1e3c392bd20 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbFullCliConsole.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbFullCliConsole.java
@@ -25,7 +25,7 @@ import org.eclipse.ui.part.IPageBookViewPage;
/**
* A GDB CLI console.
- * This console actually runs a GDB process in CLI mode to achieve a
+ * This console actually runs a GDB process in CLI mode to achieve a
* full-featured CLI interface. This is only supported with GDB >= 7.12
* and if IGDBBackend.isFullGdbConsoleSupported() returns true.
*/
@@ -33,23 +33,23 @@ public class GdbFullCliConsole extends AbstractConsole implements IGDBDebuggerCo
private final ILaunch fLaunch;
private final String fLabel;
private final PTY fGdbPty;
-
+
private GdbFullCliConsolePage fConsolePage;
- private final GdbTerminalConnector fTerminalConnector;
+ private final GdbTerminalConnector fTerminalConnector;
public GdbFullCliConsole(ILaunch launch, String label, Process process, PTY pty) {
super(label, null, false);
fLaunch = launch;
- fLabel = label;
- fGdbPty = pty;
-
- // Create a lifecycle listener to call init() and dispose()
- new GdbConsoleLifecycleListener(this);
- fTerminalConnector = new GdbTerminalConnector(process);
-
- resetName();
+ fLabel = label;
+ fGdbPty = pty;
+
+ // Create a lifecycle listener to call init() and dispose()
+ new GdbConsoleLifecycleListener(this);
+ fTerminalConnector = new GdbTerminalConnector(process);
+
+ resetName();
}
-
+
@Override
protected void dispose() {
fTerminalConnector.dispose();
@@ -57,62 +57,64 @@ public class GdbFullCliConsole extends AbstractConsole implements IGDBDebuggerCo
}
@Override
- public ILaunch getLaunch() { return fLaunch; }
-
- @Override
+ public ILaunch getLaunch() {
+ return fLaunch;
+ }
+
+ @Override
public void resetName() {
- String newName = computeName();
- String name = getName();
- if (!name.equals(newName)) {
- try {
- PlatformUI.getWorkbench().getDisplay().asyncExec(() -> setName(newName));
- } catch (SWTException e) {
- // display may be disposed, so ignore the exception
- if (e.code != SWT.ERROR_WIDGET_DISPOSED && e.code != SWT.ERROR_DEVICE_DISPOSED) {
- throw e;
- }
- }
- }
- }
-
- protected String computeName() {
- if (fLaunch == null) {
- return ""; //$NON-NLS-1$
- }
-
- String label = fLabel;
-
- ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
- if (config != null && !DebugUITools.isPrivate(config)) {
- String type = null;
- try {
- type = config.getType().getName();
- } catch (CoreException e) {
- }
- StringBuffer buffer = new StringBuffer();
- buffer.append(config.getName());
- if (type != null) {
- buffer.append(" ["); //$NON-NLS-1$
- buffer.append(type);
- buffer.append("] "); //$NON-NLS-1$
- }
- buffer.append(label);
- label = buffer.toString();
- }
-
- if (fLaunch.isTerminated()) {
- return ConsoleMessages.ConsoleMessages_console_terminated + label;
- }
-
- return label;
- }
-
+ String newName = computeName();
+ String name = getName();
+ if (!name.equals(newName)) {
+ try {
+ PlatformUI.getWorkbench().getDisplay().asyncExec(() -> setName(newName));
+ } catch (SWTException e) {
+ // display may be disposed, so ignore the exception
+ if (e.code != SWT.ERROR_WIDGET_DISPOSED && e.code != SWT.ERROR_DEVICE_DISPOSED) {
+ throw e;
+ }
+ }
+ }
+ }
+
+ protected String computeName() {
+ if (fLaunch == null) {
+ return ""; //$NON-NLS-1$
+ }
+
+ String label = fLabel;
+
+ ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
+ if (config != null && !DebugUITools.isPrivate(config)) {
+ String type = null;
+ try {
+ type = config.getType().getName();
+ } catch (CoreException e) {
+ }
+ StringBuffer buffer = new StringBuffer();
+ buffer.append(config.getName());
+ if (type != null) {
+ buffer.append(" ["); //$NON-NLS-1$
+ buffer.append(type);
+ buffer.append("] "); //$NON-NLS-1$
+ }
+ buffer.append(label);
+ label = buffer.toString();
+ }
+
+ if (fLaunch.isTerminated()) {
+ return ConsoleMessages.ConsoleMessages_console_terminated + label;
+ }
+
+ return label;
+ }
+
@Override
public IPageBookViewPage createPage(IConsoleView view) {
// This console is not meant for the standard console view
return null;
}
-
+
@Override
public IPageBookViewPage createDebuggerPage(IDebuggerConsoleView view) {
view.setFocus();
@@ -123,5 +125,5 @@ public class GdbFullCliConsole extends AbstractConsole implements IGDBDebuggerCo
public IGdbTerminalControlConnector getTerminalControlConnector() {
return fTerminalConnector;
}
-
+
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbFullCliConsolePage.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbFullCliConsolePage.java
index 180bca9c283..9740bb409d1 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbFullCliConsolePage.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbFullCliConsolePage.java
@@ -55,7 +55,7 @@ import org.eclipse.ui.part.Page;
/**
* Page used for a full GDB console. Each Debug session which uses the full GDB console will
* use its own instance of this page. GDB 7.12 is required to use the full GDB console.
- *
+ *
* Contributions to this page's context menu can be done using id "GdbFullCliConsole.#ContextMenu".
* For example, using the extension point:<br>
* <code>
@@ -71,7 +71,7 @@ public class GdbFullCliConsolePage extends Page implements IDebugContextListener
private final IDebuggerConsoleView fView;
private final IDebuggerConsole fConsole;
private final IGdbTerminalControlConnector fGdbTerminalControlConnector;
-
+
private MenuManager fMenuManager;
private GdbConsoleTerminateLaunchAction fTerminateLaunchAction;
@@ -114,28 +114,28 @@ public class GdbFullCliConsolePage extends Page implements IDebugContextListener
fView = view;
fLaunch = gdbConsole.getLaunch();
fGdbPty = pty;
-
+
GdbUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(fPreferenceListener);
}
@Override
public void dispose() {
super.dispose();
- DebugUITools.getDebugContextManager().getContextService(
- getSite().getWorkbenchWindow()).removeDebugContextListener(this);
+ DebugUITools.getDebugContextManager().getContextService(getSite().getWorkbenchWindow())
+ .removeDebugContextListener(this);
fTerminalControl.disposeTerminal();
fMenuManager.dispose();
GdbUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(fPreferenceListener);
}
-
+
@Override
public void createControl(Composite parent) {
fMainComposite = new Composite(parent, SWT.NONE);
fMainComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
fMainComposite.setLayout(new FillLayout());
- DebugUITools.getDebugContextManager().getContextService(
- getSite().getWorkbenchWindow()).addDebugContextListener(this);
+ DebugUITools.getDebugContextManager().getContextService(getSite().getWorkbenchWindow())
+ .addDebugContextListener(this);
createTerminalControl();
createContextMenu();
@@ -152,27 +152,27 @@ public class GdbFullCliConsolePage extends Page implements IDebugContextListener
// Create the terminal control that will be used to interact with GDB
// Don't use common terminal preferences as GDB consoles are having their own
boolean useCommonPrefs = false;
- fTerminalControl = TerminalViewControlFactory.makeControl(
- new ITerminalListener() {
- @Override public void setState(TerminalState state) {}
- @Override public void setTerminalTitle(final String title) {}
- },
- fMainComposite,
- new ITerminalConnector[] {},
- useCommonPrefs);
+ fTerminalControl = TerminalViewControlFactory.makeControl(new ITerminalListener() {
+ @Override
+ public void setState(TerminalState state) {
+ }
+
+ @Override
+ public void setTerminalTitle(final String title) {
+ }
+ }, fMainComposite, new ITerminalConnector[] {}, useCommonPrefs);
fTerminalControl.setConnector(new GdbTerminalPageConnector(fGdbTerminalControlConnector, fGdbPty));
-
+
try {
fTerminalControl.setEncoding(Charset.defaultCharset().name());
} catch (UnsupportedEncodingException e) {
}
if (fTerminalControl instanceof ITerminalControl) {
- ((ITerminalControl)fTerminalControl).setConnectOnEnterIfClosed(false);
- ((ITerminalControl)fTerminalControl).setVT100LineWrapping(true);
+ ((ITerminalControl) fTerminalControl).setConnectOnEnterIfClosed(false);
+ ((ITerminalControl) fTerminalControl).setVT100LineWrapping(true);
}
-
// Must use syncExec because the logic within must complete before the rest
// of the class methods (specifically getProcess()) is called
fMainComposite.getDisplay().syncExec(new Runnable() {
@@ -181,7 +181,7 @@ public class GdbFullCliConsolePage extends Page implements IDebugContextListener
if (fTerminalControl != null && !fTerminalControl.isDisposed()) {
fTerminalControl.clearTerminal();
fTerminalControl.connectTerminal();
-
+
// The actual terminal widget initializes its defaults in the line above,
// lets override them with our application defaults right after.
setDefaults();
@@ -191,12 +191,14 @@ public class GdbFullCliConsolePage extends Page implements IDebugContextListener
}
protected void createContextMenu() {
- // Choose the id to be similar in format to what
+ // Choose the id to be similar in format to what
// the GdbBasicCliConsole has as id, for consistency
String id = "GdbFullCliConsole.#ContextMenu"; //$NON-NLS-1$
fMenuManager = new MenuManager(id, id);
fMenuManager.setRemoveAllWhenShown(true);
- fMenuManager.addMenuListener((menuManager) -> { contextMenuAboutToShow(menuManager); });
+ fMenuManager.addMenuListener((menuManager) -> {
+ contextMenuAboutToShow(menuManager);
+ });
Menu menu = fMenuManager.createContextMenu(fTerminalControl.getControl());
fTerminalControl.getControl().setMenu(menu);
@@ -230,17 +232,17 @@ public class GdbFullCliConsolePage extends Page implements IDebugContextListener
menuManager.add(fClearAction);
menuManager.add(new Separator());
-
+
menuManager.add(fScrollLockAction);
menuManager.add(new Separator());
-
+
menuManager.add(fTerminateLaunchAction);
menuManager.add(fAutoTerminateAction);
menuManager.add(new Separator());
-
+
// Other plug-ins can contribute their actions here
menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
-
+
menuManager.add(fShowPreferencePageAction);
}
@@ -253,11 +255,10 @@ public class GdbFullCliConsolePage extends Page implements IDebugContextListener
public void setFocus() {
fTerminalControl.setFocus();
}
-
/**
* Returns the launch to which the current selection belongs.
- *
+ *
* @return the launch to which the current selection belongs.
*/
protected ILaunch getCurrentLaunch() {
@@ -267,7 +268,7 @@ public class GdbFullCliConsolePage extends Page implements IDebugContextListener
}
return null;
}
-
+
@Override
public void debugContextChanged(DebugContextEvent event) {
if ((event.getFlags() & DebugContextEvent.ACTIVATED) > 0) {
@@ -290,7 +291,7 @@ public class GdbFullCliConsolePage extends Page implements IDebugContextListener
fTerminalControl.setBufferLineLimit(bufferLines);
}
}
-
+
public ITerminalViewControl getTerminalViewControl() {
return fTerminalControl;
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbTerminalConnector.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbTerminalConnector.java
index 93411d24305..78999c893b3 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbTerminalConnector.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbTerminalConnector.java
@@ -33,9 +33,9 @@ import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl;
* This class will read from the GDB process output and error streams and will write it to any registered
* ITerminalControl. It must continue reading from the streams, even if there are no ITerminalControl to write
* to. This is important to prevent GDB's output buffer from getting full and then completely stopping.
- *
- * In addition this class manages a history buffer which will be used to populate a new console with history
- * information already collected for the same session. Used for example when closing an re-opening a console.
+ *
+ * In addition this class manages a history buffer which will be used to populate a new console with history
+ * information already collected for the same session. Used for example when closing an re-opening a console.
*/
public class GdbTerminalConnector implements IGdbTerminalControlConnector {
/**
@@ -58,25 +58,24 @@ public class GdbTerminalConnector implements IGdbTerminalControlConnector {
public GdbTerminalConnector(Process process) {
fProcess = process;
- // Using a history buffer size aligned with the preferences for console buffering
+ // Using a history buffer size aligned with the preferences for console buffering
// but not exceeding the internal maximum
- // We cap the history buffer to an internal maximum in order to prevent excessive use
+ // We cap the history buffer to an internal maximum in order to prevent excessive use
// of memory, the preference value applies to the console (not the history buffer) and can be specified
// to billions of lines.
- // Handling billion of lines for the history buffer would require a completely different approach
+ // Handling billion of lines for the history buffer would require a completely different approach
// to this implementation, possibly making use of the hard disk instead of in memory.
IPreferenceStore store = GdbUIPlugin.getDefault().getPreferenceStore();
int prefBufferLines = store.getInt(IGdbDebugPreferenceConstants.PREF_CONSOLE_BUFFERLINES);
- int history_buffer_size = prefBufferLines < HIST_BUFFER_MAX_SIZE ? prefBufferLines
- : HIST_BUFFER_MAX_SIZE;
+ int history_buffer_size = prefBufferLines < HIST_BUFFER_MAX_SIZE ? prefBufferLines : HIST_BUFFER_MAX_SIZE;
fHistoryBuffer = new ConsoleHistoryLinesBuffer(history_buffer_size);
-
+
// Start the jobs that read the GDB process output streams
String jobSuffix = ""; //$NON-NLS-1$
fOutputStreamJob = new OutputReadJob(process.getInputStream(), jobSuffix);
fOutputStreamJob.schedule();
-
+
jobSuffix = "-Error"; //$NON-NLS-1$
fErrorStreamJob = new OutputReadJob(process.getErrorStream(), jobSuffix);
fErrorStreamJob.schedule();
@@ -87,7 +86,7 @@ public class GdbTerminalConnector implements IGdbTerminalControlConnector {
* the maximum is being exceeded.</br>
* It also keeps track of partial text at the end of the receiving input i.e. not yet forming a complete
* line, once it forms a complete line it gets integrated in the queue
- *
+ *
* In addition the API used in this implementation are synchronized to allow consistent information among
* the Jobs using it
*/
@@ -111,13 +110,14 @@ public class GdbTerminalConnector implements IGdbTerminalControlConnector {
*/
private class HistorySnapShot {
private final String[] fHistoryLinesSnapShot;
- private final String fHistoryRemainderSnapShot;
+ private final String fHistoryRemainderSnapShot;
+
private HistorySnapShot(String[] historyLines, String historyRemainder) {
fHistoryLinesSnapShot = historyLines;
fHistoryRemainderSnapShot = historyRemainder;
}
}
-
+
@Override
public synchronized int size() {
return super.size();
@@ -150,7 +150,7 @@ public class GdbTerminalConnector implements IGdbTerminalControlConnector {
/**
* Writes complete lines to the history buffer, and accumulates incomplete lines "remainder" until
* they form a full line.
- *
+ *
* Adding complete lines to the buffer is needed to respect a specified maximum number of buffered
* lines
*/
@@ -191,7 +191,7 @@ public class GdbTerminalConnector implements IGdbTerminalControlConnector {
}
@Override
- public synchronized String[] toArray() {
+ public synchronized String[] toArray() {
return super.toArray(new String[size()]);
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbTerminalPageConnector.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbTerminalPageConnector.java
index e121e474862..c6e43fb43ed 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbTerminalPageConnector.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbTerminalPageConnector.java
@@ -24,24 +24,24 @@ import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
*/
public class GdbTerminalPageConnector extends PlatformObject implements ITerminalConnector {
- private int fTerminalWidth, fTerminalHeight;
- private ITerminalControl fControl;
- private final PTY fPty;
- private final IGdbTerminalControlConnector fGdbTerminalCtrlConnector;
-
- public GdbTerminalPageConnector(IGdbTerminalControlConnector gdbTerminalCtrlConnector, PTY pty) {
- fPty = pty;
- fGdbTerminalCtrlConnector = gdbTerminalCtrlConnector;
+ private int fTerminalWidth, fTerminalHeight;
+ private ITerminalControl fControl;
+ private final PTY fPty;
+ private final IGdbTerminalControlConnector fGdbTerminalCtrlConnector;
+
+ public GdbTerminalPageConnector(IGdbTerminalControlConnector gdbTerminalCtrlConnector, PTY pty) {
+ fPty = pty;
+ fGdbTerminalCtrlConnector = gdbTerminalCtrlConnector;
}
-
- @Override
+
+ @Override
public void disconnect() {
- fGdbTerminalCtrlConnector.removePageTerminalControl(fControl);
+ fGdbTerminalCtrlConnector.removePageTerminalControl(fControl);
- if (fControl != null) {
- fControl.setState(TerminalState.CLOSED);
- }
- }
+ if (fControl != null) {
+ fControl.setState(TerminalState.CLOSED);
+ }
+ }
@Override
public OutputStream getTerminalToRemoteStream() {
@@ -50,9 +50,9 @@ public class GdbTerminalPageConnector extends PlatformObject implements ITermina
@Override
public void connect(ITerminalControl control) {
- if (control == null) {
- throw new IllegalArgumentException("Invalid ITerminalControl"); //$NON-NLS-1$
- }
+ if (control == null) {
+ throw new IllegalArgumentException("Invalid ITerminalControl"); //$NON-NLS-1$
+ }
fControl = control;
fGdbTerminalCtrlConnector.addPageTerminalControl(fControl);
@@ -61,69 +61,68 @@ public class GdbTerminalPageConnector extends PlatformObject implements ITermina
fControl.setState(TerminalState.CONNECTED);
}
+ @Override
+ public void setTerminalSize(int newWidth, int newHeight) {
+ if (newWidth != fTerminalWidth || newHeight != fTerminalHeight) {
+ fTerminalWidth = newWidth;
+ fTerminalHeight = newHeight;
+ if (fPty != null) {
+ fPty.setTerminalSize(newWidth, newHeight);
+ }
+ }
+ }
+
+ @Override
+ public String getId() {
+ // No need for an id, as we're are just used locally
+ return null;
+ }
+
+ @Override
+ public String getName() {
+ // No name
+ return null;
+ }
+
+ @Override
+ public boolean isHidden() {
+ // in case we do leak into the TM world, we shouldn't be visible
+ return true;
+ }
+
+ @Override
+ public boolean isInitialized() {
+ return true;
+ }
+
+ @Override
+ public String getInitializationErrorMessage() {
+ return null;
+ }
+
+ @Override
+ public boolean isLocalEcho() {
+ return false;
+ }
+
+ @Override
+ public void setDefaultSettings() {
+ // we don't do settings
+ }
- @Override
- public void setTerminalSize(int newWidth, int newHeight) {
- if (newWidth != fTerminalWidth || newHeight != fTerminalHeight) {
- fTerminalWidth = newWidth;
- fTerminalHeight = newHeight;
- if (fPty != null) {
- fPty.setTerminalSize(newWidth, newHeight);
- }
- }
- }
-
- @Override
- public String getId() {
- // No need for an id, as we're are just used locally
- return null;
- }
-
- @Override
- public String getName() {
- // No name
- return null;
- }
-
- @Override
- public boolean isHidden() {
- // in case we do leak into the TM world, we shouldn't be visible
- return true;
- }
-
- @Override
- public boolean isInitialized() {
- return true;
- }
-
- @Override
- public String getInitializationErrorMessage() {
- return null;
- }
-
- @Override
- public boolean isLocalEcho() {
- return false;
- }
-
- @Override
- public void setDefaultSettings() {
- // we don't do settings
- }
-
- @Override
- public String getSettingsSummary() {
- // we don't do settings
- return null;
- }
-
- @Override
- public void load(ISettingsStore arg0) {
- // we don't do settings
- }
-
- @Override
- public void save(ISettingsStore arg0) {
- // we don't do settings
- }
+ @Override
+ public String getSettingsSummary() {
+ // we don't do settings
+ return null;
+ }
+
+ @Override
+ public void load(ISettingsStore arg0) {
+ // we don't do settings
+ }
+
+ @Override
+ public void save(ISettingsStore arg0) {
+ // we don't do settings
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/IGDBDebuggerConsole.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/IGDBDebuggerConsole.java
index 0e235a8d58f..424010227c3 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/IGDBDebuggerConsole.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/IGDBDebuggerConsole.java
@@ -27,19 +27,21 @@ import org.eclipse.debug.ui.DebugUITools;
public interface IGDBDebuggerConsole extends IDebuggerConsole {
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.cdt.debug.ui.debuggerconsole.IDebuggerConsole#consoleSelected()
*/
@Override
public default void consoleSelected() {
- DsfSession session = ((GdbLaunch)getLaunch()).getSession();
- if (!session.isActive()) {return;}
+ DsfSession session = ((GdbLaunch) getLaunch()).getSession();
+ if (!session.isActive()) {
+ return;
+ }
// only trigger the DV selection if the current selection is in
// a different session
IAdaptable context = DebugUITools.getDebugContext();
if (context != null) {
- ILaunch selectedLaunch = context.getAdapter(ILaunch.class);
+ ILaunch selectedLaunch = context.getAdapter(ILaunch.class);
if (getLaunch().equals(selectedLaunch)) {
return;
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/IGdbTerminalControlConnector.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/IGdbTerminalControlConnector.java
index 5f883051630..fafd9dfbcd7 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/IGdbTerminalControlConnector.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/IGdbTerminalControlConnector.java
@@ -21,14 +21,14 @@ public interface IGdbTerminalControlConnector {
/**
* Adds a terminal control which is ready to receive the process output
- *
+ *
* @param terminalControl
*/
void addPageTerminalControl(ITerminalControl terminalControl);
/**
* Removes a registered terminal control
- *
+ *
* @param terminalControl
*/
void removePageTerminalControl(ITerminalControl terminalControl);
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/TracingConsole.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/TracingConsole.java
index 0f93f7dbac1..56569b929e4 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/TracingConsole.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/TracingConsole.java
@@ -43,7 +43,7 @@ import org.eclipse.ui.console.IOConsole;
* Any input to this console is read and discarded, since this console should be
* read-only. We don't actually make the console read-only because it is nice
* for the user to be able to add delimiters such as empty lines within the traces.
- *
+ *
* @since 2.1
* This class was moved from package org.eclipse.cdt.dsf.gdb.internal.ui.tracing
*/
@@ -56,148 +56,151 @@ public class TracingConsole extends IOConsole {
public TracingConsole(ILaunch launch, String label) {
super("", null, null, false); //$NON-NLS-1$
fLaunch = launch;
- fTracingStream = newOutputStream();
- fSession = ((GdbLaunch)launch).getSession();
- fLabel = label;
+ fTracingStream = newOutputStream();
+ fSession = ((GdbLaunch) launch).getSession();
+ fLabel = label;
resetName();
- // Start a job to swallow all the input from the user
+ // Start a job to swallow all the input from the user
new InputReadJob().schedule();
- // This is needed if the service has already been created.
- // For example, if we turn on tracing after a launch is started.
- setStreamInService();
+ // This is needed if the service has already been created.
+ // For example, if we turn on tracing after a launch is started.
+ setStreamInService();
}
-
- @Override
+
+ @Override
protected void init() {
- super.init();
- fSession.getExecutor().submit(new DsfRunnable() {
- @Override
- public void run() {
- fSession.addServiceEventListener(TracingConsole.this, null);
- }
- });
- }
-
+ super.init();
+ fSession.getExecutor().submit(new DsfRunnable() {
+ @Override
+ public void run() {
+ fSession.addServiceEventListener(TracingConsole.this, null);
+ }
+ });
+ }
+
@Override
protected void dispose() {
- try {
+ try {
fTracingStream.close();
} catch (IOException e) {
}
- try {
- fSession.getExecutor().submit(new DsfRunnable() {
- @Override
- public void run() {
- fSession.removeServiceEventListener(TracingConsole.this);
- }
- });
+ try {
+ fSession.getExecutor().submit(new DsfRunnable() {
+ @Override
+ public void run() {
+ fSession.removeServiceEventListener(TracingConsole.this);
+ }
+ });
} catch (RejectedExecutionException e) {
// Session already disposed
}
super.dispose();
}
-
- public ILaunch getLaunch() { return fLaunch; }
-
- private void setStreamInService() {
- try {
- fSession.getExecutor().submit(new DsfRunnable() {
- @Override
- public void run() {
- DsfServicesTracker tracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), fSession.getId());
- IGDBControl control = tracker.getService(IGDBControl.class);
- tracker.dispose();
- if (control != null) {
- // Special method that need not be called on the executor
- control.setTracingStream(fTracingStream);
- }
- }
- });
- } catch (RejectedExecutionException e) {
- }
+
+ public ILaunch getLaunch() {
+ return fLaunch;
+ }
+
+ private void setStreamInService() {
+ try {
+ fSession.getExecutor().submit(new DsfRunnable() {
+ @Override
+ public void run() {
+ DsfServicesTracker tracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(),
+ fSession.getId());
+ IGDBControl control = tracker.getService(IGDBControl.class);
+ tracker.dispose();
+ if (control != null) {
+ // Special method that need not be called on the executor
+ control.setTracingStream(fTracingStream);
+ }
+ }
+ });
+ } catch (RejectedExecutionException e) {
+ }
+ }
+
+ protected String computeName() {
+ String label = fLabel;
+
+ ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
+ if (config != null && !DebugUITools.isPrivate(config)) {
+ String type = null;
+ try {
+ type = config.getType().getName();
+ } catch (CoreException e) {
+ }
+ StringBuilder buffer = new StringBuilder();
+ buffer.append(config.getName());
+ if (type != null) {
+ buffer.append(" ["); //$NON-NLS-1$
+ buffer.append(type);
+ buffer.append("] "); //$NON-NLS-1$
+ }
+ buffer.append(label);
+ label = buffer.toString();
+ }
+
+ if (fLaunch.isTerminated()) {
+ return ConsoleMessages.ConsoleMessages_console_terminated + label;
+ }
+
+ return label;
+ }
+
+ public void resetName() {
+ final String newName = computeName();
+ String name = getName();
+ if (!name.equals(newName)) {
+ Display display = PlatformUI.getWorkbench().getDisplay();
+ if (!display.isDisposed()) {
+ display.asyncExec(() -> setName(newName));
+ }
+ }
+ }
+
+ @DsfServiceEventHandler
+ public final void eventDispatched(ICommandControlInitializedDMEvent event) {
+ // Now that the service is started, we can set the stream.
+ // We won't receive this event if we enable tracing after a launch
+ // has been started.
+ setStreamInService();
}
-
- protected String computeName() {
- String label = fLabel;
-
- ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
- if (config != null && !DebugUITools.isPrivate(config)) {
- String type = null;
- try {
- type = config.getType().getName();
- } catch (CoreException e) {
- }
- StringBuilder buffer = new StringBuilder();
- buffer.append(config.getName());
- if (type != null) {
- buffer.append(" ["); //$NON-NLS-1$
- buffer.append(type);
- buffer.append("] "); //$NON-NLS-1$
- }
- buffer.append(label);
- label = buffer.toString();
- }
-
- if (fLaunch.isTerminated()) {
- return ConsoleMessages.ConsoleMessages_console_terminated + label;
- }
-
- return label;
- }
-
- public void resetName() {
- final String newName = computeName();
- String name = getName();
- if (!name.equals(newName)) {
- Display display = PlatformUI.getWorkbench().getDisplay();
- if (!display.isDisposed()) {
- display.asyncExec(() -> setName(newName));
- }
- }
- }
-
- @DsfServiceEventHandler
- public final void eventDispatched(ICommandControlInitializedDMEvent event) {
- // Now that the service is started, we can set the stream.
- // We won't receive this event if we enable tracing after a launch
- // has been started.
- setStreamInService();
- }
/**
* A reading Job which will prevent the input stream
* from filling up. We don't actually do anything with
* the data we read, since the Trace console should not
* accept input.
- *
+ *
* But instead of making the console read-only, we allow
* the user to type things to allow for comments to be
* inserted within the traces.
*/
- private class InputReadJob extends Job {
- {
- setSystem(true);
- }
-
- InputReadJob() {
- super("Traces Input Job"); //$NON-NLS-1$
- }
-
- @Override
+ private class InputReadJob extends Job {
+ {
+ setSystem(true);
+ }
+
+ InputReadJob() {
+ super("Traces Input Job"); //$NON-NLS-1$
+ }
+
+ @Override
protected IStatus run(IProgressMonitor monitor) {
- try {
- byte[] b = new byte[1024];
- int read = 0;
- while (getInputStream() != null && read >= 0) {
- // Read the input and swallow it.
- read = getInputStream().read(b);
- }
- } catch (IOException e) {
- }
- return Status.OK_STATUS;
- }
- }
+ try {
+ byte[] b = new byte[1024];
+ int read = 0;
+ while (getInputStream() != null && read >= 0) {
+ // Read the input and swallow it.
+ read = getInputStream().read(b);
+ }
+ } catch (IOException e) {
+ }
+ return Status.OK_STATUS;
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/TracingConsoleManager.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/TracingConsoleManager.java
index 2955fbafe44..5bfb10771e8 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/TracingConsoleManager.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/TracingConsoleManager.java
@@ -32,7 +32,7 @@ import org.eclipse.ui.console.IConsole;
* based on launch events and preference events.
* TracingConsoles are always running but are only shown in the console
* view if enabled by the user preference.
- *
+ *
* @since 2.1
* This class was moved from package org.eclipse.cdt.dsf.gdb.internal.ui.tracing
*/
@@ -46,7 +46,7 @@ public class TracingConsoleManager implements ILaunchesListener2, IPropertyChang
/**
* The minimum number of characters that should be kept when truncating
- * the console output.
+ * the console output.
*/
private static final int MIN_NUMBER_OF_CHARS_TO_KEEP = 5000;
@@ -55,37 +55,37 @@ public class TracingConsoleManager implements ILaunchesListener2, IPropertyChang
* We keep it up-to-date by registering as an IPropertyChangeListener
*/
private boolean fTracingEnabled = false;
-
+
/**
* The maximum number of characters that are allowed per console
*/
private int fMaxNumCharacters = 500000;
-
+
/**
* The number of characters that will be kept in the console once we
* go over fMaxNumCharacters and that we must remove some characters
*/
private int fMinNumCharacters = fMaxNumCharacters - NUMBER_OF_CHARS_TO_DELETE;
-
+
/**
* A map of all TracingConsoles for their corresponding launch.
* We keep this list because TracingConsoles may not be registered
* with the ConsoleManager, so we need another way to find them.
*/
private HashMap<ITracedLaunch, TracingConsole> fTracingConsoles = new HashMap<>();
-
+
/**
* Start the tracing console. We don't do this in a constructor, because
* we need to use <code>this</code>.
*/
public void startup() {
IPreferenceStore store = GdbUIPlugin.getDefault().getPreferenceStore();
-
+
store.addPropertyChangeListener(this);
fTracingEnabled = store.getBoolean(IGdbDebugPreferenceConstants.PREF_TRACES_ENABLE);
int maxChars = store.getInt(IGdbDebugPreferenceConstants.PREF_MAX_GDB_TRACES);
setWaterMarks(maxChars);
-
+
DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this);
}
@@ -97,14 +97,14 @@ public class TracingConsoleManager implements ILaunchesListener2, IPropertyChang
protected void toggleTracingVisibility(boolean visible) {
if (visible) {
- ConsolePlugin.getDefault().getConsoleManager().addConsoles(
- fTracingConsoles.values().toArray(new IConsole[fTracingConsoles.size()]));
+ ConsolePlugin.getDefault().getConsoleManager()
+ .addConsoles(fTracingConsoles.values().toArray(new IConsole[fTracingConsoles.size()]));
} else {
- ConsolePlugin.getDefault().getConsoleManager().removeConsoles(
- fTracingConsoles.values().toArray(new IConsole[fTracingConsoles.size()]));
+ ConsolePlugin.getDefault().getConsoleManager()
+ .removeConsoles(fTracingConsoles.values().toArray(new IConsole[fTracingConsoles.size()]));
}
}
-
+
protected void removeAllConsoles() {
ILaunch[] launches = DebugPlugin.getDefault().getLaunchManager().getLaunches();
for (ILaunch launch : launches) {
@@ -112,25 +112,25 @@ public class TracingConsoleManager implements ILaunchesListener2, IPropertyChang
}
}
- @Override
+ @Override
public void launchesAdded(ILaunch[] launches) {
for (ILaunch launch : launches) {
addConsole(launch);
}
}
- @Override
+ @Override
public void launchesChanged(ILaunch[] launches) {
}
- @Override
+ @Override
public void launchesRemoved(ILaunch[] launches) {
for (ILaunch launch : launches) {
removeConsole(launch);
}
}
-
- @Override
+
+ @Override
public void launchesTerminated(ILaunch[] launches) {
for (ILaunch launch : launches) {
// Since we already had a console, don't get rid of it
@@ -138,14 +138,14 @@ public class TracingConsoleManager implements ILaunchesListener2, IPropertyChang
renameConsole(launch);
}
}
-
- @Override
+
+ @Override
public void propertyChange(PropertyChangeEvent event) {
if (event.getProperty().equals(IGdbDebugPreferenceConstants.PREF_TRACES_ENABLE)) {
- fTracingEnabled = (Boolean)event.getNewValue();
+ fTracingEnabled = (Boolean) event.getNewValue();
toggleTracingVisibility(fTracingEnabled);
} else if (event.getProperty().equals(IGdbDebugPreferenceConstants.PREF_MAX_GDB_TRACES)) {
- int maxChars = (Integer)event.getNewValue();
+ int maxChars = (Integer) event.getNewValue();
updateAllConsoleWaterMarks(maxChars);
}
}
@@ -157,13 +157,14 @@ public class TracingConsoleManager implements ILaunchesListener2, IPropertyChang
if (getConsole(launch) == null) {
if (!launch.isTerminated()) {
// Create a new tracing console.
- TracingConsole console = new TracingConsole(launch, ConsoleMessages.ConsoleMessages_trace_console_name);
+ TracingConsole console = new TracingConsole(launch,
+ ConsoleMessages.ConsoleMessages_trace_console_name);
console.initialize();
console.setWaterMarks(fMinNumCharacters, fMaxNumCharacters);
-
- fTracingConsoles.put((ITracedLaunch)launch, console);
+
+ fTracingConsoles.put((ITracedLaunch) launch, console);
if (fTracingEnabled) {
- ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[]{console});
+ ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] { console });
}
} // else we don't display a new console for a terminated launch
}
@@ -175,7 +176,7 @@ public class TracingConsoleManager implements ILaunchesListener2, IPropertyChang
if (console != null) {
console.destroy();
if (fTracingEnabled) {
- ConsolePlugin.getDefault().getConsoleManager().removeConsoles(new IConsole[]{console});
+ ConsolePlugin.getDefault().getConsoleManager().removeConsoles(new IConsole[] { console });
}
}
}
@@ -186,24 +187,25 @@ public class TracingConsoleManager implements ILaunchesListener2, IPropertyChang
console.resetName();
}
}
-
+
private TracingConsole getConsole(ILaunch launch) {
return fTracingConsoles.get(launch);
}
-
+
/** @since 2.2 */
protected void setWaterMarks(int maxChars) {
if (maxChars < (MIN_NUMBER_OF_CHARS_TO_KEEP * 2)) {
maxChars = MIN_NUMBER_OF_CHARS_TO_KEEP * 2;
}
-
+
fMaxNumCharacters = maxChars;
// If the max number of chars is anything below the number of chars we are going to delete
// (plus our minimum buffer), we only keep the minimum.
// If the max number of chars is bigger than the number of chars we are going to delete (plus
// the minimum buffer), we truncate a fixed amount chars.
- fMinNumCharacters = maxChars < (NUMBER_OF_CHARS_TO_DELETE + MIN_NUMBER_OF_CHARS_TO_KEEP)
- ? MIN_NUMBER_OF_CHARS_TO_KEEP : maxChars - NUMBER_OF_CHARS_TO_DELETE;
+ fMinNumCharacters = maxChars < (NUMBER_OF_CHARS_TO_DELETE + MIN_NUMBER_OF_CHARS_TO_KEEP)
+ ? MIN_NUMBER_OF_CHARS_TO_KEEP
+ : maxChars - NUMBER_OF_CHARS_TO_DELETE;
}
/** @since 2.2 */
@@ -214,12 +216,12 @@ public class TracingConsoleManager implements ILaunchesListener2, IPropertyChang
updateConsoleWaterMarks(launch);
}
}
-
+
/** @since 2.2 */
protected void updateConsoleWaterMarks(ILaunch launch) {
TracingConsole console = getConsole(launch);
if (console != null) {
console.setWaterMarks(fMinNumCharacters, fMaxNumCharacters);
- }
+ }
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/actions/ConsoleSaveAction.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/actions/ConsoleSaveAction.java
index 072103a7a15..60b5392eea2 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/actions/ConsoleSaveAction.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/actions/ConsoleSaveAction.java
@@ -31,59 +31,60 @@ import org.eclipse.ui.console.TextConsole;
/**
* An action to save the gdb traces. Inspired by MiConsoleSaveAction
- *
+ *
* @since 2.1
*/
-public class ConsoleSaveAction extends Action{
+public class ConsoleSaveAction extends Action {
private TextConsole fConsole;
-
+
public ConsoleSaveAction(TextConsole console) {
- super();
- setToolTipText( ConsoleMessages.ConsoleMessages_save_action_tooltip);
- setImageDescriptor(GdbUIPlugin.imageDescriptorFromPlugin(GdbUIPlugin.PLUGIN_ID,IConsoleImagesConst.IMG_SAVE_CONSOLE));
- fConsole = console;
+ super();
+ setToolTipText(ConsoleMessages.ConsoleMessages_save_action_tooltip);
+ setImageDescriptor(
+ GdbUIPlugin.imageDescriptorFromPlugin(GdbUIPlugin.PLUGIN_ID, IConsoleImagesConst.IMG_SAVE_CONSOLE));
+ fConsole = console;
}
-
+
@Override
public void run() {
FileDialog fileDialog = new FileDialog(Display.getCurrent().getActiveShell(), SWT.SAVE);
final String fileName = fileDialog.open();
- if(fileName==null) {
+ if (fileName == null) {
return;
}
Runnable saveJob = new Runnable() {
- @Override
+ @Override
public void run() {
saveContent(fileName);
}
};
BusyIndicator.showWhile(Display.getCurrent(), saveJob);
}
-
+
/**
* Save the content from the tracing console to a file
- *
+ *
* @param fileName The fileName of the File to save to
*/
- protected void saveContent(String fileName) {
+ protected void saveContent(String fileName) {
try {
boolean confirmed = true;
-
+
File file = new File(fileName);
- if(file.exists()) {
- confirmed = MessageDialog.openQuestion(Display.getCurrent().getActiveShell(),
- ConsoleMessages.ConsoleMessages_save_confirm_overwrite_title,
+ if (file.exists()) {
+ confirmed = MessageDialog.openQuestion(Display.getCurrent().getActiveShell(),
+ ConsoleMessages.ConsoleMessages_save_confirm_overwrite_title,
ConsoleMessages.ConsoleMessages_save_confirm_overwrite_desc);
}
- if(confirmed) {
+ if (confirmed) {
BufferedWriter out = new BufferedWriter(new FileWriter(fileName));
out.write(fConsole.getDocument().get());
out.close();
}
} catch (IOException e) {
MessageDialog.openError(Display.getCurrent().getActiveShell(),
- ConsoleMessages.ConsoleMessages_save_info_io_error_title,
+ ConsoleMessages.ConsoleMessages_save_info_io_error_title,
ConsoleMessages.ConsoleMessages_save_info_io_error_desc);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/actions/GdbAutoTerminateAction.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/actions/GdbAutoTerminateAction.java
index 1f9aa1285ea..6dbc1683928 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/actions/GdbAutoTerminateAction.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/actions/GdbAutoTerminateAction.java
@@ -35,8 +35,7 @@ public class GdbAutoTerminateAction extends Action {
private boolean readState() {
return Platform.getPreferencesService().getBoolean(GdbPlugin.PLUGIN_ID,
- IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB,
- true, null);
+ IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, true, null);
}
@Override
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/actions/GdbConsoleClearAction.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/actions/GdbConsoleClearAction.java
index b1532602cfa..5dc3f9e2ae5 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/actions/GdbConsoleClearAction.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/actions/GdbConsoleClearAction.java
@@ -22,6 +22,7 @@ import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
public class GdbConsoleClearAction extends Action {
private final ITerminalViewControl fTerminalCtrl;
+
public GdbConsoleClearAction(ITerminalViewControl terminalControl) {
fTerminalCtrl = terminalControl;
if (fTerminalCtrl == null || fTerminalCtrl.isDisposed()) {
@@ -31,7 +32,8 @@ public class GdbConsoleClearAction extends Action {
setText(ConsoleMessages.ConsoleClearAction_name);
setToolTipText(ConsoleMessages.ConsoleClearAction_description);
setImageDescriptor(GdbUIPlugin.getImageDescriptor(IConsoleImagesConst.IMG_CONSOLE_CLEAR_ACTIVE_COLOR));
- setDisabledImageDescriptor(GdbUIPlugin.getImageDescriptor(IConsoleImagesConst.IMG_CONSOLE_CLEAR_DISABLED_COLOR));
+ setDisabledImageDescriptor(
+ GdbUIPlugin.getImageDescriptor(IConsoleImagesConst.IMG_CONSOLE_CLEAR_DISABLED_COLOR));
}
@Override
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/actions/GdbConsolePasteAction.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/actions/GdbConsolePasteAction.java
index 049969d30e4..5274b98696e 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/actions/GdbConsolePasteAction.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/actions/GdbConsolePasteAction.java
@@ -22,6 +22,7 @@ import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
public class GdbConsolePasteAction extends Action {
private final ITerminalViewControl fTerminalCtrl;
+
public GdbConsolePasteAction(ITerminalViewControl terminalControl) {
fTerminalCtrl = terminalControl;
if (fTerminalCtrl == null || fTerminalCtrl.isDisposed()) {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/actions/GdbConsoleScrollLockAction.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/actions/GdbConsoleScrollLockAction.java
index 7adabc6c36e..17138f04ebc 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/actions/GdbConsoleScrollLockAction.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/actions/GdbConsoleScrollLockAction.java
@@ -24,10 +24,10 @@ public class GdbConsoleScrollLockAction extends Action {
private final ITerminalViewControl fTerminalCtrl;
private Boolean fScrollLocked = false;
-
+
public GdbConsoleScrollLockAction(ITerminalViewControl terminalControl) {
super(ConsoleMessages.ConsoleScrollLockAction_name, IAction.AS_CHECK_BOX);
-
+
fTerminalCtrl = terminalControl;
if (fTerminalCtrl == null || fTerminalCtrl.isDisposed()) {
setEnabled(false);
@@ -37,7 +37,8 @@ public class GdbConsoleScrollLockAction extends Action {
setToolTipText(ConsoleMessages.ConsoleScrollLockAction_description);
setImageDescriptor(GdbUIPlugin.getImageDescriptor(IConsoleImagesConst.IMG_CONSOLE_SCROLL_LOCK_ACTIVE_COLOR));
- setDisabledImageDescriptor(GdbUIPlugin.getImageDescriptor(IConsoleImagesConst.IMG_CONSOLE_SCROLL_LOCK_DISABLED_COLOR));
+ setDisabledImageDescriptor(
+ GdbUIPlugin.getImageDescriptor(IConsoleImagesConst.IMG_CONSOLE_SCROLL_LOCK_DISABLED_COLOR));
}
@Override
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/actions/GdbConsoleTerminateLaunchAction.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/actions/GdbConsoleTerminateLaunchAction.java
index c2e9fb16963..364d009d7f3 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/actions/GdbConsoleTerminateLaunchAction.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/actions/GdbConsoleTerminateLaunchAction.java
@@ -22,15 +22,16 @@ import org.eclipse.debug.core.ILaunchesListener2;
import org.eclipse.jface.action.Action;
public class GdbConsoleTerminateLaunchAction extends Action implements ILaunchesListener2 {
-
+
private final ILaunch fLaunch;
-
+
public GdbConsoleTerminateLaunchAction(ILaunch launch) {
fLaunch = launch;
setText(ConsoleMessages.ConsoleTerminateLaunchAction_name);
setToolTipText(ConsoleMessages.ConsoleTerminateLaunchAction_description);
setImageDescriptor(GdbUIPlugin.getImageDescriptor(IConsoleImagesConst.IMG_CONSOLE_TERMINATE_ACTIVE_COLOR));
- setDisabledImageDescriptor(GdbUIPlugin.getImageDescriptor(IConsoleImagesConst.IMG_CONSOLE_TERMINATE_DISABLED_COLOR));
+ setDisabledImageDescriptor(
+ GdbUIPlugin.getImageDescriptor(IConsoleImagesConst.IMG_CONSOLE_TERMINATE_DISABLED_COLOR));
if (fLaunch.isTerminated()) {
// Launch already terminated
@@ -62,7 +63,7 @@ public class GdbConsoleTerminateLaunchAction extends Action implements ILaunches
}
}
}
-
+
@Override
public void launchesRemoved(ILaunch[] launches) {
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/disassembly/AddDynamicPrintfRulerAction.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/disassembly/AddDynamicPrintfRulerAction.java
index 2e59cbacff8..3bf36bb3800 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/disassembly/AddDynamicPrintfRulerAction.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/disassembly/AddDynamicPrintfRulerAction.java
@@ -44,14 +44,14 @@ import org.eclipse.ui.IWorkbenchPart;
* Ruler action to add dynamic printf with a dialog properties.
*/
public class AddDynamicPrintfRulerAction extends AbstractDisassemblyBreakpointRulerAction {
-
+
private IToggleBreakpointsTargetCExtension fDynamicPrintfBreakpointsTarget;
protected AddDynamicPrintfRulerAction(IDisassemblyPart disassemblyPart, IVerticalRulerInfo rulerInfo) {
super(disassemblyPart, rulerInfo);
setText(DisassemblyMessages.Disassembly_action_AddDynamicPrintf_label);
}
-
+
/*
* @see org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions.AbstractDisassemblyAction#run()
*/
@@ -60,107 +60,106 @@ public class AddDynamicPrintfRulerAction extends AbstractDisassemblyBreakpointRu
if (fDynamicPrintfBreakpointsTarget != null) {
IWorkbenchPart part = getDisassemblyPart();
ISelection selection = getSelection();
- try {
- if (fDynamicPrintfBreakpointsTarget.canCreateLineBreakpointsInteractive(part, selection)) {
- fDynamicPrintfBreakpointsTarget.createLineBreakpointsInteractive(part, selection);
- }
- } catch (CoreException e) {
- reportException(e);
- }
- }
+ try {
+ if (fDynamicPrintfBreakpointsTarget.canCreateLineBreakpointsInteractive(part, selection)) {
+ fDynamicPrintfBreakpointsTarget.createLineBreakpointsInteractive(part, selection);
+ }
+ } catch (CoreException e) {
+ reportException(e);
+ }
+ }
}
@Override
public void update() {
- IDisassemblyPart part = getDisassemblyPart();
- if (part != null && part.isConnected()) {
- ISelection selection = getSelection();
+ IDisassemblyPart part = getDisassemblyPart();
+ if (part != null && part.isConnected()) {
+ ISelection selection = getSelection();
if (fDynamicPrintfBreakpointsTarget == null) {
fDynamicPrintfBreakpointsTarget = fetchDynamicPrintfBreakpointsTarget(selection);
}
- if (fDynamicPrintfBreakpointsTarget == null) {
- setEnabled(false);
- return;
- }
- if (fDynamicPrintfBreakpointsTarget.canCreateLineBreakpointsInteractive(part, selection)) {
- setEnabled(true);
- return;
- }
- }
- setEnabled(false);
+ if (fDynamicPrintfBreakpointsTarget == null) {
+ setEnabled(false);
+ return;
+ }
+ if (fDynamicPrintfBreakpointsTarget.canCreateLineBreakpointsInteractive(part, selection)) {
+ setEnabled(true);
+ return;
+ }
+ }
+ setEnabled(false);
}
-
/**
- * Report an error to the user.
- *
- * @param e underlying exception
- */
- private void reportException(Exception e) {
- IStatus status= new Status(IStatus.ERROR, CDebugUIPlugin.PLUGIN_ID, "Error creating dynamic printf: ", e); //$NON-NLS-1$
- ErrorDialog.openError(
- getDisassemblyPart().getSite().getShell(),
- DisassemblyMessages.Disassembly_action_AddDynamicPrintf_errorTitle,
- DisassemblyMessages.Disassembly_action_AddDynamicPrintf_errorMessage,
- status);
- CDebugUIPlugin.log(status);
- }
+ * Report an error to the user.
+ *
+ * @param e underlying exception
+ */
+ private void reportException(Exception e) {
+ IStatus status = new Status(IStatus.ERROR, CDebugUIPlugin.PLUGIN_ID, "Error creating dynamic printf: ", e); //$NON-NLS-1$
+ ErrorDialog.openError(getDisassemblyPart().getSite().getShell(),
+ DisassemblyMessages.Disassembly_action_AddDynamicPrintf_errorTitle,
+ DisassemblyMessages.Disassembly_action_AddDynamicPrintf_errorMessage, status);
+ CDebugUIPlugin.log(status);
+ }
/**
- * Determines the text selection for the breakpoint action. If clicking on the ruler inside
- * the highlighted text, return the text selection for the highlighted text. Otherwise,
- * return a text selection representing the start of the line.
- *
- * @return An ISelection as described.
- * @throws BadLocationException If underlying operations throw.
- */
- private ISelection getSelection() {
- IDocument document = getDocument();
- if (document != null) {
- int line = getRulerInfo().getLineOfLastMouseButtonActivity();
-
- try {
- IRegion region = getDocument().getLineInformation(line);
- ITextSelection textSelection = new TextSelection(document, region.getOffset(), 0);
- ISelectionProvider provider = getDisassemblyPart().getSite().getSelectionProvider();
- if (provider != null){
- ISelection selection = provider.getSelection();
- if (selection instanceof ITextSelection
- && ((ITextSelection) selection).getStartLine() <= line
- && ((ITextSelection) selection).getEndLine() >= line) {
- textSelection = (ITextSelection) selection;
- }
- }
- return textSelection;
- } catch (BadLocationException e) {
- }
- }
- return StructuredSelection.EMPTY;
- }
+ * Determines the text selection for the breakpoint action. If clicking on the ruler inside
+ * the highlighted text, return the text selection for the highlighted text. Otherwise,
+ * return a text selection representing the start of the line.
+ *
+ * @return An ISelection as described.
+ * @throws BadLocationException If underlying operations throw.
+ */
+ private ISelection getSelection() {
+ IDocument document = getDocument();
+ if (document != null) {
+ int line = getRulerInfo().getLineOfLastMouseButtonActivity();
+
+ try {
+ IRegion region = getDocument().getLineInformation(line);
+ ITextSelection textSelection = new TextSelection(document, region.getOffset(), 0);
+ ISelectionProvider provider = getDisassemblyPart().getSite().getSelectionProvider();
+ if (provider != null) {
+ ISelection selection = provider.getSelection();
+ if (selection instanceof ITextSelection && ((ITextSelection) selection).getStartLine() <= line
+ && ((ITextSelection) selection).getEndLine() >= line) {
+ textSelection = (ITextSelection) selection;
+ }
+ }
+ return textSelection;
+ } catch (BadLocationException e) {
+ }
+ }
+ return StructuredSelection.EMPTY;
+ }
private IToggleBreakpointsTargetCExtension fetchDynamicPrintfBreakpointsTarget(ISelection selection) {
- if (fDynamicPrintfBreakpointsTarget == null){
- IExtensionPoint ep = Platform.getExtensionRegistry().getExtensionPoint(IDebugUIConstants.PLUGIN_ID, IDebugUIConstants.EXTENSION_POINT_TOGGLE_BREAKPOINTS_TARGET_FACTORIES);
+ if (fDynamicPrintfBreakpointsTarget == null) {
+ IExtensionPoint ep = Platform.getExtensionRegistry().getExtensionPoint(IDebugUIConstants.PLUGIN_ID,
+ IDebugUIConstants.EXTENSION_POINT_TOGGLE_BREAKPOINTS_TARGET_FACTORIES);
IConfigurationElement[] elements = ep.getConfigurationElements();
- for (int i= 0; i < elements.length; i++) {
- String id = elements[i].getAttribute("id"); //$NON-NLS-1$
+ for (int i = 0; i < elements.length; i++) {
+ String id = elements[i].getAttribute("id"); //$NON-NLS-1$
if (id != null && id.equals("org.eclipse.cdt.dsf.gdb.ui.ToggleDynamicPrintfTargetFactory")) { //$NON-NLS-1$
- try{
+ try {
Object obj = elements[i].createExecutableExtension("class"); //$NON-NLS-1$
- if(obj instanceof IToggleBreakpointsTargetFactory) {
- IToggleBreakpointsTarget target = ((IToggleBreakpointsTargetFactory)obj).createToggleTarget(ToggleDynamicPrintfTargetFactory.TOGGLE_C_DYNAMICPRINTF_TARGET_ID);
+ if (obj instanceof IToggleBreakpointsTargetFactory) {
+ IToggleBreakpointsTarget target = ((IToggleBreakpointsTargetFactory) obj)
+ .createToggleTarget(
+ ToggleDynamicPrintfTargetFactory.TOGGLE_C_DYNAMICPRINTF_TARGET_ID);
if (target instanceof IToggleBreakpointsTargetCExtension) {
- fDynamicPrintfBreakpointsTarget = (IToggleBreakpointsTargetCExtension)target;
+ fDynamicPrintfBreakpointsTarget = (IToggleBreakpointsTargetCExtension) target;
}
- }
- } catch (CoreException e){
+ }
+ } catch (CoreException e) {
}
break;
}
}
}
return fDynamicPrintfBreakpointsTarget;
- }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/disassembly/DisassemblyMessages.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/disassembly/DisassemblyMessages.java
index b6dbb119ada..059b179186a 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/disassembly/DisassemblyMessages.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/disassembly/DisassemblyMessages.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Marc Khouzam (Ericsson) - Support for dynamic printf (Bug 400628)
*******************************************************************************/
@@ -16,11 +16,11 @@ package org.eclipse.cdt.dsf.gdb.internal.ui.disassembly;
import org.eclipse.osgi.util.NLS;
public final class DisassemblyMessages extends NLS {
- public static String Disassembly_action_AddDynamicPrintf_label;
- public static String Disassembly_action_AddDynamicPrintf_errorMessage;
- public static String Disassembly_action_AddDynamicPrintf_errorTitle;
- public static String Disassembly_action_AddDynamicPrintf_accelerator;
-
+ public static String Disassembly_action_AddDynamicPrintf_label;
+ public static String Disassembly_action_AddDynamicPrintf_errorMessage;
+ public static String Disassembly_action_AddDynamicPrintf_errorTitle;
+ public static String Disassembly_action_AddDynamicPrintf_accelerator;
+
static {
NLS.initializeMessages(DisassemblyMessages.class.getName(), DisassemblyMessages.class);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/AttachCDebuggerTab.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/AttachCDebuggerTab.java
index 1176da21ac6..1a80d7054f9 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/AttachCDebuggerTab.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/AttachCDebuggerTab.java
@@ -7,22 +7,21 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.launching;
-
/**
* Debugger tab to use for an attach launch configuration.
- *
+ *
* @since 2.0
*/
public class AttachCDebuggerTab extends CDebuggerTab {
- public AttachCDebuggerTab() {
- // We don't know yet if we are going to do a remote or local session
- super(null, true);
- }
+ public AttachCDebuggerTab() {
+ // We don't know yet if we are going to do a remote or local session
+ super(null, true);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CArgumentsTab.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CArgumentsTab.java
index a5f726ad635..9efcea5f2a1 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CArgumentsTab.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CArgumentsTab.java
@@ -49,82 +49,82 @@ import org.eclipse.swt.widgets.Text;
* </p>
*/
public class CArgumentsTab extends CLaunchConfigurationTab {
- /**
- * Tab identifier used for ordering of tabs added using the
- * <code>org.eclipse.debug.ui.launchConfigurationTabs</code>
- * extension point.
- *
- * @since 2.0
- */
- public static final String TAB_ID = "org.eclipse.cdt.dsf.gdb.launch.argumentsTab"; //$NON-NLS-1$
-
+ /**
+ * Tab identifier used for ordering of tabs added using the
+ * <code>org.eclipse.debug.ui.launchConfigurationTabs</code>
+ * extension point.
+ *
+ * @since 2.0
+ */
+ public static final String TAB_ID = "org.eclipse.cdt.dsf.gdb.launch.argumentsTab"; //$NON-NLS-1$
+
// Program arguments UI widgets
protected Label fPrgmArgumentsLabel;
protected Text fPrgmArgumentsText;
protected Button fArgumentVariablesButton;
-
+
// Working directory
protected WorkingDirectoryBlock fWorkingDirectoryBlock = new WorkingDirectoryBlock();
- @Override
+ @Override
public void createControl(Composite parent) {
- Font font = parent.getFont();
- Composite comp = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(1, true);
- comp.setLayout(layout);
- comp.setFont(font);
-
- GridData gd = new GridData(GridData.FILL_BOTH);
- comp.setLayoutData(gd);
- setControl(comp);
-
- GdbUIPlugin.getDefault().getWorkbench().getHelpSystem().setHelp(getControl(), ICDTLaunchHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_ARGUMNETS_TAB);
-
+ Font font = parent.getFont();
+ Composite comp = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(1, true);
+ comp.setLayout(layout);
+ comp.setFont(font);
+
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ comp.setLayoutData(gd);
+ setControl(comp);
+
+ GdbUIPlugin.getDefault().getWorkbench().getHelpSystem().setHelp(getControl(),
+ ICDTLaunchHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_ARGUMNETS_TAB);
+
createArgumentComponent(comp, 1);
fWorkingDirectoryBlock.createControl(comp);
}
- protected void createArgumentComponent(Composite comp, int horizontalSpan) {
- Font font = comp.getFont();
- Group group = new Group(comp, SWT.NONE);
- group.setFont(font);
- group.setLayout(new GridLayout());
- GridData gd = new GridData(GridData.FILL_BOTH);
- gd.horizontalSpan = horizontalSpan;
- group.setLayoutData(gd);
+ protected void createArgumentComponent(Composite comp, int horizontalSpan) {
+ Font font = comp.getFont();
+ Group group = new Group(comp, SWT.NONE);
+ group.setFont(font);
+ group.setLayout(new GridLayout());
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ gd.horizontalSpan = horizontalSpan;
+ group.setLayoutData(gd);
- group.setText(LaunchMessages.getString("CArgumentsTab.C/C++_Program_Arguments")); //$NON-NLS-1$
- fPrgmArgumentsText = new Text(group, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL);
- fPrgmArgumentsText.getAccessible().addAccessibleListener(
- new AccessibleAdapter() {
- @Override
- public void getName(AccessibleEvent e) {
- e.result = LaunchMessages.getString("CArgumentsTab.C/C++_Program_Arguments"); //$NON-NLS-1$
- }
- });
- gd = new GridData(GridData.FILL_BOTH);
- gd.heightHint = 40;
- gd.widthHint = 100;
- fPrgmArgumentsText.setLayoutData(gd);
- fPrgmArgumentsText.setFont(font);
- fPrgmArgumentsText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent evt) {
- updateLaunchConfigurationDialog();
- }
- });
- fArgumentVariablesButton= createPushButton(group, LaunchMessages.getString("CArgumentsTab.Variables"), null); //$NON-NLS-1$
- gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
- fArgumentVariablesButton.setLayoutData(gd);
- fArgumentVariablesButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent arg0) {
- handleVariablesButtonSelected(fPrgmArgumentsText);
- }
- });
- addControlAccessibleListener(fArgumentVariablesButton, fArgumentVariablesButton.getText()); // need to strip the mnemonic from buttons
- }
+ group.setText(LaunchMessages.getString("CArgumentsTab.C/C++_Program_Arguments")); //$NON-NLS-1$
+ fPrgmArgumentsText = new Text(group, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL);
+ fPrgmArgumentsText.getAccessible().addAccessibleListener(new AccessibleAdapter() {
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = LaunchMessages.getString("CArgumentsTab.C/C++_Program_Arguments"); //$NON-NLS-1$
+ }
+ });
+ gd = new GridData(GridData.FILL_BOTH);
+ gd.heightHint = 40;
+ gd.widthHint = 100;
+ fPrgmArgumentsText.setLayoutData(gd);
+ fPrgmArgumentsText.setFont(font);
+ fPrgmArgumentsText.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent evt) {
+ updateLaunchConfigurationDialog();
+ }
+ });
+ fArgumentVariablesButton = createPushButton(group, LaunchMessages.getString("CArgumentsTab.Variables"), null); //$NON-NLS-1$
+ gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
+ fArgumentVariablesButton.setLayoutData(gd);
+ fArgumentVariablesButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent arg0) {
+ handleVariablesButtonSelected(fPrgmArgumentsText);
+ }
+ });
+ addControlAccessibleListener(fArgumentVariablesButton, fArgumentVariablesButton.getText()); // need to strip the mnemonic from buttons
+ }
/**
* A variable entry button has been pressed for the given text
@@ -147,7 +147,7 @@ public class CArgumentsTab extends CLaunchConfigurationTab {
dialog.open();
return dialog.getVariableExpression();
}
-
+
public void addControlAccessibleListener(Control control, String controlName) {
// Strip mnemonic (&)
String[] strs = controlName.split("&"); //$NON-NLS-1$
@@ -157,7 +157,7 @@ public class CArgumentsTab extends CLaunchConfigurationTab {
}
control.getAccessible().addAccessibleListener(new ControlAccessibleListener(stripped.toString()));
}
-
+
private class ControlAccessibleListener extends AccessibleAdapter {
private String controlName;
@@ -170,59 +170,59 @@ public class CArgumentsTab extends CLaunchConfigurationTab {
e.result = controlName;
}
}
-
+
@Override
public boolean isValid(ILaunchConfiguration config) {
return fWorkingDirectoryBlock.isValid(config);
}
- @Override
+ @Override
public void setDefaults(ILaunchConfigurationWorkingCopy config) {
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, (String) null);
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, (String) null);
}
- @Override
+ @Override
public void initializeFrom(ILaunchConfiguration configuration) {
try {
- fPrgmArgumentsText.setText(configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, "")); //$NON-NLS-1$
+ fPrgmArgumentsText
+ .setText(configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, "")); //$NON-NLS-1$
fWorkingDirectoryBlock.initializeFrom(configuration);
- }
- catch (CoreException e) {
- setErrorMessage(LaunchMessages.getFormattedString("Launch.common.Exception_occurred_reading_configuration_EXCEPTION", e.getStatus().getMessage())); //$NON-NLS-1$
+ } catch (CoreException e) {
+ setErrorMessage(LaunchMessages.getFormattedString(
+ "Launch.common.Exception_occurred_reading_configuration_EXCEPTION", e.getStatus().getMessage())); //$NON-NLS-1$
GdbUIPlugin.log(e);
}
}
- @Override
+ @Override
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
- configuration.setAttribute(
- ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
- getAttributeValueFrom(fPrgmArgumentsText));
+ configuration.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
+ getAttributeValueFrom(fPrgmArgumentsText));
fWorkingDirectoryBlock.performApply(configuration);
}
/**
* Returns the string in the text widget, or <code>null</code> if empty.
- *
+ *
* @return text or <code>null</code>
*/
protected String getAttributeValueFrom(Text text) {
String content = text.getText().trim();
// Bug #131513 - eliminate Windows \r line delimiter
- content = content.replaceAll("\r\n", "\n"); //$NON-NLS-1$//$NON-NLS-2$
+ content = content.replaceAll("\r\n", "\n"); //$NON-NLS-1$//$NON-NLS-2$
if (!content.isEmpty()) {
return content;
}
return null;
}
- @Override
- public String getId() {
- return TAB_ID;
- }
-
- @Override
+ @Override
+ public String getId() {
+ return TAB_ID;
+ }
+
+ @Override
public String getName() {
return LaunchMessages.getString("CArgumentsTab.Arguments"); //$NON-NLS-1$
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CDebuggerTab.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CDebuggerTab.java
index b61108dd836..84a9499f1b9 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CDebuggerTab.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CDebuggerTab.java
@@ -56,14 +56,14 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
public class CDebuggerTab extends CLaunchConfigurationTab {
- /**
- * Tab identifier used for ordering of tabs added using
- * the <code>org.eclipse.debug.ui.launchConfigurationTabs</code>
- * extension point.
- *
- * @since 2.0
- */
- public static final String TAB_ID = "org.eclipse.cdt.dsf.gdb.launch.debuggerTab"; //$NON-NLS-1$
+ /**
+ * Tab identifier used for ordering of tabs added using
+ * the <code>org.eclipse.debug.ui.launchConfigurationTabs</code>
+ * extension point.
+ *
+ * @since 2.0
+ */
+ public static final String TAB_ID = "org.eclipse.cdt.dsf.gdb.launch.debuggerTab"; //$NON-NLS-1$
private final static String LOCAL_DEBUGGER_ID = "gdb";//$NON-NLS-1$
private final static String REMOTE_DEBUGGER_ID = "gdbserver";//$NON-NLS-1$
@@ -90,12 +90,12 @@ public class CDebuggerTab extends CLaunchConfigurationTab {
private Composite fContents;
- private IContentChangeListener fContentListener = new IContentChangeListener() {
- @Override
- public void contentChanged() {
- contentsChanged();
- }
- };
+ private IContentChangeListener fContentListener = new IContentChangeListener() {
+ @Override
+ public void contentChanged() {
+ contentsChanged();
+ }
+ };
public CDebuggerTab(SessionType sessionType, boolean attach) {
if (sessionType == SessionType.REMOTE) {
@@ -108,10 +108,10 @@ public class CDebuggerTab extends CLaunchConfigurationTab {
@Override
public String getId() {
- return TAB_ID;
+ return TAB_ID;
}
- @Override
+ @Override
public void createControl(Composite parent) {
fContainer = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
fContainer.setLayoutData(new GridData(GridData.FILL_BOTH));
@@ -158,7 +158,7 @@ public class CDebuggerTab extends CLaunchConfigurationTab {
}
}
- @Override
+ @Override
public void setDefaults(ILaunchConfigurationWorkingCopy config) {
setLaunchConfigurationWorkingCopy(config);
ICDebuggerPage dynamicTab = getDynamicTab();
@@ -177,9 +177,9 @@ public class CDebuggerTab extends CLaunchConfigurationTab {
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, LOCAL_DEBUGGER_ID);
} else if (fRemoteMode) {
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
- IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE);
+ IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE);
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, REMOTE_DEBUGGER_ID);
- } else if (fCoreMode){
+ } else if (fCoreMode) {
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE);
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, LOCAL_DEBUGGER_ID);
@@ -198,7 +198,7 @@ public class CDebuggerTab extends CLaunchConfigurationTab {
}
}
- @Override
+ @Override
public void initializeFrom(ILaunchConfiguration config) {
setInitializing(true);
@@ -217,14 +217,13 @@ public class CDebuggerTab extends CLaunchConfigurationTab {
setInitializing(false);
}
- @Override
+ @Override
public void performApply(ILaunchConfigurationWorkingCopy config) {
if (getDebuggerId() != null) {
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, getDebuggerId());
ICDebuggerPage dynamicTab = getDynamicTab();
if (dynamicTab == null) {
- config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_SPECIFIC_ATTRS_MAP,
- (Map)null);
+ config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_SPECIFIC_ATTRS_MAP, (Map) null);
} else {
dynamicTab.performApply(config);
}
@@ -238,8 +237,8 @@ public class CDebuggerTab extends CLaunchConfigurationTab {
ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH);
} else if (fRemoteMode) {
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
- IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE);
- } else if (fCoreMode){
+ IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE);
+ } else if (fCoreMode) {
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE);
} else {
@@ -250,7 +249,7 @@ public class CDebuggerTab extends CLaunchConfigurationTab {
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN,
fStopInMain.getSelection());
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL,
- fStopInMainSymbol.getText());
+ fStopInMainSymbol.getText());
}
}
@@ -310,7 +309,8 @@ public class CDebuggerTab extends CLaunchConfigurationTab {
optionsComp.setLayout(layout);
optionsComp.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, true, false, 1, 1));
if (!fAttachMode && !fCoreMode) {
- fStopInMain = createCheckButton(optionsComp, LaunchMessages.getString("CDebuggerTab.Stop_at_main_on_startup")); //$NON-NLS-1$
+ fStopInMain = createCheckButton(optionsComp,
+ LaunchMessages.getString("CDebuggerTab.Stop_at_main_on_startup")); //$NON-NLS-1$
fStopInMain.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
@@ -323,19 +323,17 @@ public class CDebuggerTab extends CLaunchConfigurationTab {
gridData.widthHint = 100;
fStopInMainSymbol.setLayoutData(gridData);
fStopInMainSymbol.addModifyListener(new ModifyListener() {
- @Override
+ @Override
public void modifyText(ModifyEvent evt) {
update();
}
});
- fStopInMainSymbol.getAccessible().addAccessibleListener(
- new AccessibleAdapter() {
- @Override
- public void getName(AccessibleEvent e) {
- e.result = LaunchMessages.getString("CDebuggerTab.Stop_at_main_on_startup"); //$NON-NLS-1$
- }
+ fStopInMainSymbol.getAccessible().addAccessibleListener(new AccessibleAdapter() {
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = LaunchMessages.getString("CDebuggerTab.Stop_at_main_on_startup"); //$NON-NLS-1$
}
- );
+ });
}
}
@@ -361,10 +359,12 @@ public class CDebuggerTab extends CLaunchConfigurationTab {
try {
if (!fAttachMode && !fCoreMode) {
IPreferenceStore preferences = GdbUIPlugin.getDefault().getPreferenceStore();
- fStopInMain.setSelection(config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN,
- preferences.getBoolean(IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN)));
- fStopInMainSymbol.setText(config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL,
- preferences.getString(IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN_SYMBOL)));
+ fStopInMain
+ .setSelection(config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN,
+ preferences.getBoolean(IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN)));
+ fStopInMainSymbol
+ .setText(config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL,
+ preferences.getString(IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN_SYMBOL)));
fStopInMainSymbol.setEnabled(fStopInMain.getSelection());
} else if (fAttachMode) {
// In attach mode, figure out if we are doing a remote connect based on
@@ -434,11 +434,11 @@ public class CDebuggerTab extends CLaunchConfigurationTab {
}
protected void setDynamicTab(ICDebuggerPage tab) {
- if (fDynamicTab instanceof ICDebuggerPageExtension)
- ((ICDebuggerPageExtension) fDynamicTab).removeContentChangeListener(fContentListener);
- fDynamicTab = tab;
- if (fDynamicTab instanceof ICDebuggerPageExtension)
- ((ICDebuggerPageExtension) fDynamicTab).addContentChangeListener(fContentListener);
+ if (fDynamicTab instanceof ICDebuggerPageExtension)
+ ((ICDebuggerPageExtension) fDynamicTab).removeContentChangeListener(fContentListener);
+ fDynamicTab = tab;
+ if (fDynamicTab instanceof ICDebuggerPageExtension)
+ ((ICDebuggerPageExtension) fDynamicTab).addContentChangeListener(fContentListener);
}
protected Composite getDynamicTabHolder() {
@@ -497,8 +497,7 @@ public class CDebuggerTab extends CLaunchConfigurationTab {
}
}
if (wc != null) {
- wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_SPECIFIC_ATTRS_MAP,
- (Map) null);
+ wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_SPECIFIC_ATTRS_MAP, (Map) null);
}
} else {
if (wc == null) {
@@ -538,7 +537,7 @@ public class CDebuggerTab extends CLaunchConfigurationTab {
return LaunchImages.get(LaunchImages.IMG_VIEW_DEBUGGER_TAB);
}
- @Override
+ @Override
public String getName() {
return LaunchMessages.getString("AbstractCDebuggerTab.Debugger"); //$NON-NLS-1$
}
@@ -554,17 +553,17 @@ public class CDebuggerTab extends CLaunchConfigurationTab {
fDCombo = new Combo(comboComp, SWT.READ_ONLY | SWT.DROP_DOWN);
fDCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
fDCombo.addSelectionListener(new SelectionListener() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (!isInitializing()) {
- setInitializeDefault(true);
- updateComboFromSelection();
- }
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- }
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (!isInitializing()) {
+ setInitializeDefault(true);
+ updateComboFromSelection();
+ }
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
});
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CLaunchConfigurationTab.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CLaunchConfigurationTab.java
index 3c7655f6645..106cca5e000 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CLaunchConfigurationTab.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CLaunchConfigurationTab.java
@@ -46,7 +46,7 @@ public abstract class CLaunchConfigurationTab extends AbstractLaunchConfiguratio
* settings, or <code>null</code> if none. Note, if possible we will
* return the IBinary based on config entry as this may be more usefull then
* just the project.
- *
+ *
* @return C element context.
*/
protected ICElement getContext(ILaunchConfiguration config, String platform) {
@@ -57,9 +57,10 @@ public abstract class CLaunchConfigurationTab extends AbstractLaunchConfiguratio
try {
projectName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String) null);
programName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, (String) null);
- if (programName != null) {
- programName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(programName);
- }
+ if (programName != null) {
+ programName = VariablesPlugin.getDefault().getStringVariableManager()
+ .performStringSubstitution(programName);
+ }
} catch (CoreException e) {
}
@@ -73,7 +74,7 @@ public abstract class CLaunchConfigurationTab extends AbstractLaunchConfiguratio
if (page != null) {
ISelection selection = page.getSelection();
if (selection instanceof IStructuredSelection) {
- IStructuredSelection ss = (IStructuredSelection)selection;
+ IStructuredSelection ss = (IStructuredSelection) selection;
if (!ss.isEmpty()) {
obj = ss.getFirstElement();
}
@@ -81,9 +82,9 @@ public abstract class CLaunchConfigurationTab extends AbstractLaunchConfiguratio
}
}
if (obj instanceof IResource) {
- ICElement ce = CoreModel.getDefault().create((IResource)obj);
+ ICElement ce = CoreModel.getDefault().create((IResource) obj);
if (ce == null) {
- IProject pro = ((IResource)obj).getProject();
+ IProject pro = ((IResource) obj).getProject();
ce = CoreModel.getDefault().create(pro);
}
obj = ce;
@@ -92,8 +93,8 @@ public abstract class CLaunchConfigurationTab extends AbstractLaunchConfiguratio
if (platform != null && !platform.equals("*")) { //$NON-NLS-1$
ICDescriptor descriptor;
try {
- descriptor = CCorePlugin.getDefault().getCProjectDescription( ((ICElement)obj).getCProject().getProject(),
- false);
+ descriptor = CCorePlugin.getDefault()
+ .getCProjectDescription(((ICElement) obj).getCProject().getProject(), false);
if (descriptor != null) {
String projectPlatform = descriptor.getPlatform();
if (!projectPlatform.equals(platform) && !projectPlatform.equals("*")) { //$NON-NLS-1$
@@ -105,17 +106,17 @@ public abstract class CLaunchConfigurationTab extends AbstractLaunchConfiguratio
}
if (obj != null) {
if (programName == null || programName.isEmpty()) {
- return (ICElement)obj;
+ return (ICElement) obj;
}
- ICElement ce = (ICElement)obj;
+ ICElement ce = (ICElement) obj;
IProject project;
- project = (IProject)ce.getCProject().getResource();
+ project = (IProject) ce.getCProject().getResource();
IPath programFile = project.getFile(programName).getLocation();
ce = CCorePlugin.getDefault().getCoreModel().create(programFile);
if (ce != null && ce.exists()) {
return ce;
}
- return (ICElement)obj;
+ return (ICElement) obj;
}
}
if (page != null) {
@@ -123,7 +124,7 @@ public abstract class CLaunchConfigurationTab extends AbstractLaunchConfiguratio
if (part != null) {
IEditorInput input = part.getEditorInput();
if (input instanceof IFileEditorInput) {
- IFile file = ((IFileEditorInput)input).getFile();
+ IFile file = ((IFileEditorInput) input).getFile();
if (file != null) {
ICElement ce = CoreModel.getDefault().create(file);
if (ce == null) {
@@ -146,7 +147,7 @@ public abstract class CLaunchConfigurationTab extends AbstractLaunchConfiguratio
String name = null;
if (cProject != null && cProject.exists()) {
name = cProject.getElementName();
- config.setMappedResources(new IResource[] {cProject.getProject()});
+ config.setMappedResources(new IResource[] { cProject.getProject() });
ICProjectDescription projDes = CCorePlugin.getDefault().getProjectDescription(cProject.getProject());
String buildConfigID = projDes.getActiveConfiguration().getId();
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CMainAttachTab.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CMainAttachTab.java
index d1461f216a5..1f098a007c1 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CMainAttachTab.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CMainAttachTab.java
@@ -7,20 +7,19 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.launching;
-
/**
* Main tab to use for an attach launch configuration.
- *
+ *
* @since 2.0
*/
public class CMainAttachTab extends CMainTab {
- public CMainAttachTab() {
- super(CMainTab.DONT_CHECK_PROGRAM | CMainTab.INCLUDE_BUILD_SETTINGS);
- }
+ public CMainAttachTab() {
+ super(CMainTab.DONT_CHECK_PROGRAM | CMainTab.INCLUDE_BUILD_SETTINGS);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CMainCoreTab.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CMainCoreTab.java
index 30736cdb9e5..991c704376c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CMainCoreTab.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CMainCoreTab.java
@@ -7,20 +7,19 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.launching;
-
/**
* Main tab to use for an attach launch configuration.
- *
+ *
* @since 2.0
*/
public class CMainCoreTab extends CMainTab {
- public CMainCoreTab() {
- super(CMainTab.SPECIFY_CORE_FILE | CMainTab.INCLUDE_BUILD_SETTINGS);
- }
+ public CMainCoreTab() {
+ super(CMainTab.SPECIFY_CORE_FILE | CMainTab.INCLUDE_BUILD_SETTINGS);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CMainTab.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CMainTab.java
index 7ce8bc49c76..3417b8bbf87 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CMainTab.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CMainTab.java
@@ -14,10 +14,11 @@
package org.eclipse.cdt.dsf.gdb.internal.ui.launching;
import org.eclipse.cdt.launch.ui.CMainTab2;
+
/**
* A launch configuration tab that displays and edits project and main type name launch
* configuration attributes.
- *
+ *
* @deprecated Replaced with org.eclipse.cdt.launch.ui.CMainTab2
*/
@Deprecated
@@ -30,9 +31,9 @@ public class CMainTab extends CMainTab2 {
super(flags);
}
- @Override
- public String getId() {
- // Return the old id as to be backwards compatible
- return "org.eclipse.cdt.dsf.gdb.launch.mainTab"; //$NON-NLS-1$
- }
+ @Override
+ public String getId() {
+ // Return the old id as to be backwards compatible
+ return "org.eclipse.cdt.dsf.gdb.launch.mainTab"; //$NON-NLS-1$
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CoreFileDebuggerTab.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CoreFileDebuggerTab.java
index e7f488d3437..8adfa95150c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CoreFileDebuggerTab.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CoreFileDebuggerTab.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
@@ -19,7 +19,7 @@ import org.eclipse.cdt.dsf.gdb.service.SessionType;
* @since 2.0
*/
public class CoreFileDebuggerTab extends CDebuggerTab {
- public CoreFileDebuggerTab() {
- super(SessionType.CORE, false);
- }
+ public CoreFileDebuggerTab() {
+ super(SessionType.CORE, false);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CoreFilePrompter.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CoreFilePrompter.java
index ce878e2b4b9..92a573653e7 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CoreFilePrompter.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CoreFilePrompter.java
@@ -34,11 +34,11 @@ public class CoreFilePrompter implements IStatusHandler {
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.debug.core.IStatusHandler#handleStatus(org.eclipse.core.runtime.IStatus,
* java.lang.Object)
*/
- @Override
+ @Override
public Object handleStatus(IStatus status, Object params) throws CoreException {
final Shell shell = GdbUIPlugin.getShell();
if (shell == null) {
@@ -47,20 +47,21 @@ public class CoreFilePrompter implements IStatusHandler {
LaunchMessages.getString("CoreFileLaunchDelegate.No_Shell_available_in_Launch"), null); //$NON-NLS-1$
throw new CoreException(error);
}
-
+
FileDialog dialog = new FileDialog(shell);
dialog.setText(LaunchMessages.getString("CoreFileLaunchDelegate.Select_Corefile")); //$NON-NLS-1$
- String initialPath = (String)params;
+ String initialPath = (String) params;
if (initialPath != null && initialPath.length() != 0) {
dialog.setFilterPath(initialPath);
}
-
+
String res = dialog.open();
if (res != null) {
File file = new File(res);
if (!file.exists() || !file.canRead()) {
- ErrorDialog.openError(shell, LaunchMessages.getString("CoreFileLaunchDelegate.postmortem_debugging_failed"), //$NON-NLS-1$
+ ErrorDialog.openError(shell,
+ LaunchMessages.getString("CoreFileLaunchDelegate.postmortem_debugging_failed"), //$NON-NLS-1$
LaunchMessages.getString("CoreFileLaunchDelegate.Corefile_not_accessible"), //$NON-NLS-1$
new Status(IStatus.ERROR, GdbUIPlugin.getUniqueIdentifier(),
ICDTLaunchConfigurationConstants.ERR_NO_COREFILE,
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/GDBSolibBlock.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/GDBSolibBlock.java
index 8c4bcef1d55..023be02689d 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/GDBSolibBlock.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/GDBSolibBlock.java
@@ -41,9 +41,9 @@ public class GDBSolibBlock extends Observable implements IMILaunchConfigurationC
private Button fAutoSoLibButton;
private Button fUseSolibForAppButton;
-
+
private Composite fControl;
-
+
private boolean fAutoSolib = false;
// Bug 314536 and Bug 314554
@@ -51,104 +51,112 @@ public class GDBSolibBlock extends Observable implements IMILaunchConfigurationC
// Since this option was added for multi-process but it has not been completed for Linux yet, just hide it completely for now
private boolean fUseSolibForApp = false;
- public GDBSolibBlock( IMILaunchConfigurationComponent solibSearchBlock, boolean autoSolib, boolean stopOnSolibEvents ) {
+ public GDBSolibBlock(IMILaunchConfigurationComponent solibSearchBlock, boolean autoSolib,
+ boolean stopOnSolibEvents) {
super();
fSolibSearchPathBlock = solibSearchBlock;
fAutoSolib = autoSolib;
}
- @Override
- public void createControl( Composite parent ) {
- Composite subComp = ControlFactory.createCompositeEx( parent, 1, GridData.FILL_HORIZONTAL );
- ((GridLayout)subComp.getLayout()).makeColumnsEqualWidth = false;
- ((GridLayout)subComp.getLayout()).marginHeight = 0;
- ((GridLayout)subComp.getLayout()).marginWidth = 0;
- if ( fSolibSearchPathBlock != null ) {
- fSolibSearchPathBlock.createControl( subComp );
- if ( fSolibSearchPathBlock instanceof Observable )
- ((Observable)fSolibSearchPathBlock).addObserver( this );
+ @Override
+ public void createControl(Composite parent) {
+ Composite subComp = ControlFactory.createCompositeEx(parent, 1, GridData.FILL_HORIZONTAL);
+ ((GridLayout) subComp.getLayout()).makeColumnsEqualWidth = false;
+ ((GridLayout) subComp.getLayout()).marginHeight = 0;
+ ((GridLayout) subComp.getLayout()).marginWidth = 0;
+ if (fSolibSearchPathBlock != null) {
+ fSolibSearchPathBlock.createControl(subComp);
+ if (fSolibSearchPathBlock instanceof Observable)
+ ((Observable) fSolibSearchPathBlock).addObserver(this);
}
- if ( fAutoSolib ) {
- fAutoSoLibButton = ControlFactory.createCheckBox( subComp, LaunchUIMessages.getString( "GDBSolibBlock.0" ) ); //$NON-NLS-1$
- fAutoSoLibButton.addSelectionListener( new SelectionAdapter() {
+ if (fAutoSolib) {
+ fAutoSoLibButton = ControlFactory.createCheckBox(subComp, LaunchUIMessages.getString("GDBSolibBlock.0")); //$NON-NLS-1$
+ fAutoSoLibButton.addSelectionListener(new SelectionAdapter() {
@Override
- public void widgetSelected( SelectionEvent e ) {
+ public void widgetSelected(SelectionEvent e) {
updateButtons();
changed();
}
- } );
+ });
}
- if ( fUseSolibForApp ) {
- fUseSolibForAppButton = ControlFactory.createCheckBox( subComp, LaunchUIMessages.getString( "GDBSolibBlock.2" ) ); //$NON-NLS-1$
- fUseSolibForAppButton.addSelectionListener( new SelectionAdapter() {
+ if (fUseSolibForApp) {
+ fUseSolibForAppButton = ControlFactory.createCheckBox(subComp,
+ LaunchUIMessages.getString("GDBSolibBlock.2")); //$NON-NLS-1$
+ fUseSolibForAppButton.addSelectionListener(new SelectionAdapter() {
@Override
- public void widgetSelected( SelectionEvent e ) {
+ public void widgetSelected(SelectionEvent e) {
updateButtons();
changed();
}
- } );
+ });
}
fControl = subComp;
}
- @Override
- public void initializeFrom( ILaunchConfiguration configuration ) {
- if ( fSolibSearchPathBlock != null )
- fSolibSearchPathBlock.initializeFrom( configuration );
+ @Override
+ public void initializeFrom(ILaunchConfiguration configuration) {
+ if (fSolibSearchPathBlock != null)
+ fSolibSearchPathBlock.initializeFrom(configuration);
try {
- if ( fAutoSoLibButton != null )
- fAutoSoLibButton.setSelection( configuration.getAttribute( IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, IGDBLaunchConfigurationConstants.DEBUGGER_AUTO_SOLIB_DEFAULT ) );
- if ( fUseSolibForAppButton != null )
- fUseSolibForAppButton.setSelection( configuration.getAttribute( IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_USE_SOLIB_SYMBOLS_FOR_APP, IGDBLaunchConfigurationConstants.DEBUGGER_USE_SOLIB_SYMBOLS_FOR_APP_DEFAULT ) );
- initializeButtons( configuration );
+ if (fAutoSoLibButton != null)
+ fAutoSoLibButton.setSelection(
+ configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB,
+ IGDBLaunchConfigurationConstants.DEBUGGER_AUTO_SOLIB_DEFAULT));
+ if (fUseSolibForAppButton != null)
+ fUseSolibForAppButton.setSelection(configuration.getAttribute(
+ IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_USE_SOLIB_SYMBOLS_FOR_APP,
+ IGDBLaunchConfigurationConstants.DEBUGGER_USE_SOLIB_SYMBOLS_FOR_APP_DEFAULT));
+ initializeButtons(configuration);
updateButtons();
- }
- catch( CoreException e ) {
+ } catch (CoreException e) {
}
}
- @Override
- public void performApply( ILaunchConfigurationWorkingCopy configuration ) {
- if ( fSolibSearchPathBlock != null )
- fSolibSearchPathBlock.performApply( configuration );
+ @Override
+ public void performApply(ILaunchConfigurationWorkingCopy configuration) {
+ if (fSolibSearchPathBlock != null)
+ fSolibSearchPathBlock.performApply(configuration);
try {
Map attrs = configuration.getAttributes();
-
- if ( fAutoSoLibButton != null )
- attrs.put( IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, Boolean.valueOf( fAutoSoLibButton.getSelection() ) );
- if ( fUseSolibForAppButton != null )
- attrs.put( IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_USE_SOLIB_SYMBOLS_FOR_APP, Boolean.valueOf( fUseSolibForAppButton.getSelection() ) );
- configuration.setAttributes( attrs );
- }
- catch( CoreException e ) {
+
+ if (fAutoSoLibButton != null)
+ attrs.put(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB,
+ Boolean.valueOf(fAutoSoLibButton.getSelection()));
+ if (fUseSolibForAppButton != null)
+ attrs.put(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_USE_SOLIB_SYMBOLS_FOR_APP,
+ Boolean.valueOf(fUseSolibForAppButton.getSelection()));
+ configuration.setAttributes(attrs);
+ } catch (CoreException e) {
}
}
- @Override
- public void setDefaults( ILaunchConfigurationWorkingCopy configuration ) {
- if ( fSolibSearchPathBlock != null )
- fSolibSearchPathBlock.setDefaults( configuration );
- configuration.setAttribute( IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, IGDBLaunchConfigurationConstants.DEBUGGER_AUTO_SOLIB_DEFAULT );
- configuration.setAttribute( IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_USE_SOLIB_SYMBOLS_FOR_APP, IGDBLaunchConfigurationConstants.DEBUGGER_USE_SOLIB_SYMBOLS_FOR_APP_DEFAULT );
+ @Override
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+ if (fSolibSearchPathBlock != null)
+ fSolibSearchPathBlock.setDefaults(configuration);
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB,
+ IGDBLaunchConfigurationConstants.DEBUGGER_AUTO_SOLIB_DEFAULT);
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_USE_SOLIB_SYMBOLS_FOR_APP,
+ IGDBLaunchConfigurationConstants.DEBUGGER_USE_SOLIB_SYMBOLS_FOR_APP_DEFAULT);
}
protected void updateButtons() {
}
- @Override
+ @Override
public void dispose() {
deleteObservers();
- if ( fSolibSearchPathBlock != null ) {
- if ( fSolibSearchPathBlock instanceof Observable )
- ((Observable)fSolibSearchPathBlock).deleteObserver( this );
+ if (fSolibSearchPathBlock != null) {
+ if (fSolibSearchPathBlock instanceof Observable)
+ ((Observable) fSolibSearchPathBlock).deleteObserver(this);
fSolibSearchPathBlock.dispose();
}
}
- @Override
- public void update( Observable o, Object arg ) {
+ @Override
+ public void update(Observable o, Object arg) {
changed();
}
@@ -157,25 +165,25 @@ public class GDBSolibBlock extends Observable implements IMILaunchConfigurationC
notifyObservers();
}
- protected void initializeButtons( ILaunchConfiguration configuration ) {
+ protected void initializeButtons(ILaunchConfiguration configuration) {
try {
- boolean enable = !ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE.equals( configuration.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, "" ) ); //$NON-NLS-1$
- if ( fAutoSoLibButton != null )
- fAutoSoLibButton.setEnabled( enable );
- if ( fUseSolibForAppButton != null )
- fUseSolibForAppButton.setEnabled( enable );
- }
- catch( CoreException e ) {
+ boolean enable = !ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE
+ .equals(configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, "")); //$NON-NLS-1$
+ if (fAutoSoLibButton != null)
+ fAutoSoLibButton.setEnabled(enable);
+ if (fUseSolibForAppButton != null)
+ fUseSolibForAppButton.setEnabled(enable);
+ } catch (CoreException e) {
}
}
- @Override
+ @Override
public Control getControl() {
return fControl;
}
- @Override
- public boolean isValid( ILaunchConfiguration launchConfig ) {
+ @Override
+ public boolean isValid(ILaunchConfiguration launchConfig) {
// TODO Auto-generated method stub
return false;
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/GdbCoreDebuggerPage.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/GdbCoreDebuggerPage.java
index f7cee54548a..34fb813539f 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/GdbCoreDebuggerPage.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/GdbCoreDebuggerPage.java
@@ -56,7 +56,7 @@ public class GdbCoreDebuggerPage extends AbstractCDebuggerPage implements Observ
private IMILaunchConfigurationComponent fSolibBlock;
private boolean fIsInitializing = false;
- @Override
+ @Override
public void createControl(Composite parent) {
Composite comp = new Composite(parent, SWT.NONE);
comp.setLayout(new GridLayout());
@@ -68,7 +68,7 @@ public class GdbCoreDebuggerPage extends AbstractCDebuggerPage implements Observ
setControl(parent);
}
- @Override
+ @Override
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
IPreferenceStore preferenceStore = GdbUIPlugin.getDefault().getPreferenceStore();
String defaultGdbCommand = preferenceStore.getString(IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND);
@@ -93,45 +93,44 @@ public class GdbCoreDebuggerPage extends AbstractCDebuggerPage implements Observ
return valid;
}
- @Override
+ @Override
public void initializeFrom(ILaunchConfiguration configuration) {
setInitializing(true);
IPreferenceStore preferenceStore = GdbUIPlugin.getDefault().getPreferenceStore();
String defaultGdbCommand = preferenceStore.getString(IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND);
String defaultGdbInit = preferenceStore.getString(IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_INIT);
-
+
String gdbCommand = defaultGdbCommand;
String gdbInit = defaultGdbInit;
-
+
try {
- gdbCommand = configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, defaultGdbCommand);
- } catch(CoreException e) {
+ gdbCommand = configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME,
+ defaultGdbCommand);
+ } catch (CoreException e) {
}
try {
gdbInit = configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_GDB_INIT, defaultGdbInit);
- } catch(CoreException e) {
+ } catch (CoreException e) {
}
if (fSolibBlock != null)
fSolibBlock.initializeFrom(configuration);
fGDBCommandText.setText(gdbCommand);
fGDBInitText.setText(gdbInit);
-
- setInitializing(false);
+
+ setInitializing(false);
}
- @Override
+ @Override
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
- configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME,
- fGDBCommandText.getText().trim());
- configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_GDB_INIT,
- fGDBInitText.getText().trim());
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, fGDBCommandText.getText().trim());
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_GDB_INIT, fGDBInitText.getText().trim());
if (fSolibBlock != null)
fSolibBlock.performApply(configuration);
}
- @Override
+ @Override
public String getName() {
return LaunchUIMessages.getString("GDBDebuggerPage.tab_name"); //$NON-NLS-1$
}
@@ -154,17 +153,17 @@ public class GdbCoreDebuggerPage extends AbstractCDebuggerPage implements Observ
/*
* (non-Javadoc)
- *
+ *
* @see java.util.Observer#update(java.util.Observable, java.lang.Object)
*/
- @Override
+ @Override
public void update(Observable o, Object arg) {
if (!isInitializing())
updateLaunchConfigurationDialog();
}
public IMILaunchConfigurationComponent createSolibBlock(Composite parent) {
- IMILaunchConfigurationComponent block = new GDBSolibBlock( new SolibSearchPathBlock(), true, true);
+ IMILaunchConfigurationComponent block = new GDBSolibBlock(new SolibSearchPathBlock(), true, true);
block.createControl(parent);
return block;
}
@@ -178,11 +177,11 @@ public class GdbCoreDebuggerPage extends AbstractCDebuggerPage implements Observ
TabItem tabItem = new TabItem(tabFolder, SWT.NONE);
tabItem.setText(LaunchUIMessages.getString("GDBDebuggerPage.main_tab_name")); //$NON-NLS-1$
Composite comp = ControlFactory.createCompositeEx(tabFolder, 1, GridData.FILL_BOTH);
- ((GridLayout)comp.getLayout()).makeColumnsEqualWidth = false;
+ ((GridLayout) comp.getLayout()).makeColumnsEqualWidth = false;
comp.setFont(tabFolder.getFont());
tabItem.setControl(comp);
Composite subComp = ControlFactory.createCompositeEx(comp, 3, GridData.FILL_HORIZONTAL);
- ((GridLayout)subComp.getLayout()).makeColumnsEqualWidth = false;
+ ((GridLayout) subComp.getLayout()).makeColumnsEqualWidth = false;
subComp.setFont(tabFolder.getFont());
Label label = ControlFactory.createLabel(subComp, LaunchUIMessages.getString("GDBDebuggerPage.gdb_debugger")); //$NON-NLS-1$
GridData gd = new GridData();
@@ -190,7 +189,7 @@ public class GdbCoreDebuggerPage extends AbstractCDebuggerPage implements Observ
label.setLayoutData(gd);
fGDBCommandText = ControlFactory.createTextField(subComp, SWT.SINGLE | SWT.BORDER);
fGDBCommandText.addModifyListener(new ModifyListener() {
- @Override
+ @Override
public void modifyText(ModifyEvent evt) {
if (!isInitializing())
updateLaunchConfigurationDialog();
@@ -211,16 +210,16 @@ public class GdbCoreDebuggerPage extends AbstractCDebuggerPage implements Observ
int lastSeparatorIndex = gdbCommand.lastIndexOf(File.separator);
if (lastSeparatorIndex != -1) {
String cmd = gdbCommand.substring(0, lastSeparatorIndex);
- // remove double quotes, since they interfere with
+ // remove double quotes, since they interfere with
// "setFilterPath()" below
- cmd = cmd.replaceAll("\\\"", ""); //$NON-NLS-1$//$NON-NLS-2$
+ cmd = cmd.replaceAll("\\\"", ""); //$NON-NLS-1$//$NON-NLS-2$
dialog.setFilterPath(cmd);
}
String res = dialog.open();
if (res == null) {
return;
}
- // path contains space(s)?
+ // path contains space(s)?
if (res.contains(" ")) { //$NON-NLS-1$
// surround it in double quotes
res = '"' + res + '"';
@@ -236,7 +235,7 @@ public class GdbCoreDebuggerPage extends AbstractCDebuggerPage implements Observ
gd = new GridData(GridData.FILL_HORIZONTAL);
fGDBInitText.setLayoutData(gd);
fGDBInitText.addModifyListener(new ModifyListener() {
- @Override
+ @Override
public void modifyText(ModifyEvent evt) {
if (!isInitializing())
updateLaunchConfigurationDialog();
@@ -272,7 +271,7 @@ public class GdbCoreDebuggerPage extends AbstractCDebuggerPage implements Observ
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 3;
gd.widthHint = 200;
- label.setLayoutData(gd);
+ label.setLayoutData(gd);
}
public void createSolibTab(TabFolder tabFolder) {
@@ -283,19 +282,19 @@ public class GdbCoreDebuggerPage extends AbstractCDebuggerPage implements Observ
tabItem.setControl(comp);
fSolibBlock = createSolibBlock(comp);
if (fSolibBlock instanceof Observable)
- ((Observable)fSolibBlock).addObserver(this);
+ ((Observable) fSolibBlock).addObserver(this);
}
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#dispose()
*/
@Override
public void dispose() {
if (fSolibBlock != null) {
if (fSolibBlock instanceof Observable)
- ((Observable)fSolibBlock).deleteObserver(this);
+ ((Observable) fSolibBlock).deleteObserver(this);
fSolibBlock.dispose();
}
super.dispose();
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/GdbDebuggerPage.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/GdbDebuggerPage.java
index 8c480420152..b6ae17ac6c6 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/GdbDebuggerPage.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/GdbDebuggerPage.java
@@ -56,19 +56,21 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
protected Text fGDBCommandText;
protected Text fGDBInitText;
protected Button fNonStopCheckBox;
-
+
protected Button fReverseCheckBox;
protected Combo fReverseDebugMode;
- protected static final String HW_REVERSE_MODE = LaunchUIMessages.getString("GDBDebuggerPage.reverse_Debuggingmodehard"); //$NON-NLS-1$
- protected static final String SW_REVERSE_MODE = LaunchUIMessages.getString("GDBDebuggerPage.reverse_Debuggingmodesoft"); //$NON-NLS-1$
-
+ protected static final String HW_REVERSE_MODE = LaunchUIMessages
+ .getString("GDBDebuggerPage.reverse_Debuggingmodehard"); //$NON-NLS-1$
+ protected static final String SW_REVERSE_MODE = LaunchUIMessages
+ .getString("GDBDebuggerPage.reverse_Debuggingmodesoft"); //$NON-NLS-1$
+
protected Button fUpdateThreadlistOnSuspend;
protected Button fDebugOnFork;
/**
* Checkbox for using GDB's new-console -- only displayed on Windows. Will be null if unsupported.
*/
private Button fExternalConsole;
-
+
/**
* A combo box to let the user choose if fast tracepoints should be used or not.
*/
@@ -80,7 +82,7 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
private IMILaunchConfigurationComponent fSolibBlock;
private boolean fIsInitializing = false;
- @Override
+ @Override
public void createControl(Composite parent) {
Composite comp = new Composite(parent, SWT.NONE);
comp.setLayout(new GridLayout());
@@ -92,7 +94,7 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
setControl(parent);
}
- @Override
+ @Override
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
IPreferenceStore preferenceStore = GdbUIPlugin.getDefault().getPreferenceStore();
configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME,
@@ -113,7 +115,7 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
preferenceStore.getBoolean(IGdbDebugPreferenceConstants.PREF_EXTERNAL_CONSOLE));
configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_TRACEPOINT_MODE,
IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_MODE_DEFAULT);
-
+
if (fSolibBlock != null)
fSolibBlock.setDefaults(configuration);
}
@@ -139,6 +141,7 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
return defaultValue;
}
}
+
/** utility method to cut down on clutter */
private boolean getBooleanAttr(ILaunchConfiguration config, String attributeName, boolean defaultValue) {
try {
@@ -148,7 +151,7 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
}
}
- @Override
+ @Override
public void initializeFrom(ILaunchConfiguration configuration) {
setInitializing(true);
IPreferenceStore preferenceStore = GdbUIPlugin.getDefault().getPreferenceStore();
@@ -163,11 +166,14 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
updateReverseDebugModeFromConfig(configuration);
- boolean updateThreadsOnSuspend = getBooleanAttr(configuration, IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND,
+ 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,
+ boolean debugOnFork = getBooleanAttr(configuration,
+ IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_DEBUG_ON_FORK,
IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_ON_FORK_DEFAULT);
- boolean externalConsole = getBooleanAttr(configuration, IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_EXTERNAL_CONSOLE,
+ boolean externalConsole = getBooleanAttr(configuration,
+ IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_EXTERNAL_CONSOLE,
preferenceStore.getBoolean(IGdbDebugPreferenceConstants.PREF_EXTERNAL_CONSOLE));
if (fSolibBlock != null)
@@ -181,16 +187,17 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
if (fExternalConsole != null) {
fExternalConsole.setSelection(externalConsole);
}
-
+
updateTracepointModeFromConfig(configuration);
-
+
setInitializing(false);
}
protected void updateTracepointModeFromConfig(ILaunchConfiguration config) {
if (fTracepointModeCombo != null) {
- String tracepointMode = getStringAttr(config, IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_TRACEPOINT_MODE,
- IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_MODE_DEFAULT);
+ String tracepointMode = getStringAttr(config,
+ IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_TRACEPOINT_MODE,
+ IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_MODE_DEFAULT);
if (tracepointMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_NORMAL_ONLY)) {
fTracepointModeCombo.setText(TP_NORMAL_ONLY);
@@ -205,12 +212,12 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
// Bug 375256
//
// assert false : "Unknown Tracepoint Mode: " + tracepointMode; //$NON-NLS-1$
- fTracepointModeCombo.setText(TP_NORMAL_ONLY);
+ fTracepointModeCombo.setText(TP_NORMAL_ONLY);
}
}
}
- protected void updateReverseDebugModeFromConfig(ILaunchConfiguration config){
+ protected void updateReverseDebugModeFromConfig(ILaunchConfiguration config) {
if (fReverseDebugMode != null) {
String debugMode = getStringAttr(config, IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE_MODE,
IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_MODE_DEFAULT);
@@ -253,40 +260,38 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
return IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_MODE_DEFAULT;
}
- @Override
+ @Override
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
- configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME,
- fGDBCommandText.getText().trim());
- configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_GDB_INIT,
- fGDBInitText.getText().trim());
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, fGDBCommandText.getText().trim());
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_GDB_INIT, fGDBInitText.getText().trim());
configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP,
fNonStopCheckBox.getSelection());
configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE,
- fReverseCheckBox.getSelection());
+ fReverseCheckBox.getSelection());
configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND,
- fUpdateThreadlistOnSuspend.getSelection());
+ fUpdateThreadlistOnSuspend.getSelection());
configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_DEBUG_ON_FORK,
fDebugOnFork.getSelection());
if (fExternalConsole != null) {
configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_EXTERNAL_CONSOLE,
fExternalConsole.getSelection());
}
-
+
if (fTracepointModeCombo != null) {
configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_TRACEPOINT_MODE,
- getSelectedTracepointMode());
+ getSelectedTracepointMode());
}
if (fReverseDebugMode != null) {
configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE_MODE,
- getSelectedReverseDebugMode());
+ getSelectedReverseDebugMode());
}
if (fSolibBlock != null)
fSolibBlock.performApply(configuration);
}
- @Override
+ @Override
public String getName() {
return LaunchUIMessages.getString("GDBDebuggerPage.tab_name"); //$NON-NLS-1$
}
@@ -312,14 +317,14 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
*
* @see java.util.Observer#update(java.util.Observable, java.lang.Object)
*/
- @Override
+ @Override
public void update(Observable o, Object arg) {
if (!isInitializing())
updateLaunchConfigurationDialog();
}
public IMILaunchConfigurationComponent createSolibBlock(Composite parent) {
- IMILaunchConfigurationComponent block = new GDBSolibBlock( new SolibSearchPathBlock(), true, true);
+ IMILaunchConfigurationComponent block = new GDBSolibBlock(new SolibSearchPathBlock(), true, true);
block.createControl(parent);
return block;
}
@@ -335,9 +340,9 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
Composite comp = ControlFactory.createCompositeEx(tabFolder, 1, GridData.FILL_BOTH);
((GridLayout) comp.getLayout()).makeColumnsEqualWidth = false;
tabItem.setControl(comp);
-
+
createGdbContent(comp);
-
+
ControlFactory.createLabel(comp, LaunchUIMessages.getString("GDBDebuggerPage.cmdfile_warning"), //$NON-NLS-1$
200, SWT.DEFAULT, SWT.WRAP);
@@ -347,15 +352,19 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
createReverseDebugModeCombo(comp);
- fUpdateThreadlistOnSuspend = addCheckbox(comp, LaunchUIMessages.getString("GDBDebuggerPage.update_thread_list_on_suspend")); //$NON-NLS-1$
+ fUpdateThreadlistOnSuspend = addCheckbox(comp,
+ 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$
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(fUpdateThreadlistOnSuspend,
+ GdbUIPlugin.PLUGIN_ID + ".update_threadlist_button_context"); //$NON-NLS-1$
+
+ fDebugOnFork = addCheckbox(comp,
+ LaunchUIMessages.getString("GDBDebuggerPage.Automatically_debug_forked_processes")); //$NON-NLS-1$
+ if (Platform.getOS().startsWith("win")) { //$NON-NLS-1$
+ fExternalConsole = addCheckbox(comp,
+ LaunchUIMessages.getString("GDBDebuggerPage.use_new_console_for_process")); //$NON-NLS-1$
+ }
- fDebugOnFork = addCheckbox(comp, LaunchUIMessages.getString("GDBDebuggerPage.Automatically_debug_forked_processes")); //$NON-NLS-1$
- if (Platform.getOS().startsWith("win")) { //$NON-NLS-1$
- fExternalConsole = addCheckbox(comp, LaunchUIMessages.getString("GDBDebuggerPage.use_new_console_for_process")); //$NON-NLS-1$
- }
-
createTracepointModeCombo(comp);
}
@@ -367,7 +376,7 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
ControlFactory.createLabel(subComp, LaunchUIMessages.getString("GDBDebuggerPage.gdb_debugger")); //$NON-NLS-1$
fGDBCommandText = ControlFactory.createTextField(subComp, SWT.SINGLE | SWT.BORDER);
fGDBCommandText.addModifyListener(new ModifyListener() {
- @Override
+ @Override
public void modifyText(ModifyEvent evt) {
if (!isInitializing())
updateLaunchConfigurationDialog();
@@ -388,16 +397,16 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
int lastSeparatorIndex = gdbCommand.lastIndexOf(File.separator);
if (lastSeparatorIndex != -1) {
String cmd = gdbCommand.substring(0, lastSeparatorIndex);
- // remove double quotes, since they interfere with
+ // remove double quotes, since they interfere with
// "setFilterPath()" below
- cmd = cmd.replaceAll("\\\"", ""); //$NON-NLS-1$//$NON-NLS-2$
+ cmd = cmd.replaceAll("\\\"", ""); //$NON-NLS-1$//$NON-NLS-2$
dialog.setFilterPath(cmd);
}
String res = dialog.open();
if (res == null) {
return;
}
- // path contains space(s)?
+ // path contains space(s)?
if (res.contains(" ")) { //$NON-NLS-1$
// surround it in double quotes
res = '"' + res + '"';
@@ -405,11 +414,11 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
fGDBCommandText.setText(res);
}
});
-
+
ControlFactory.createLabel(subComp, LaunchUIMessages.getString("GDBDebuggerPage.gdb_command_file")); //$NON-NLS-1$
fGDBInitText = ControlFactory.createTextField(subComp, SWT.SINGLE | SWT.BORDER);
fGDBInitText.addModifyListener(new ModifyListener() {
- @Override
+ @Override
public void modifyText(ModifyEvent evt) {
if (!isInitializing())
updateLaunchConfigurationDialog();
@@ -455,7 +464,7 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
fTracepointModeCombo.add(TP_AUTOMATIC);
fTracepointModeCombo.addSelectionListener(new SelectionAdapter() {
- @Override
+ @Override
public void widgetSelected(SelectionEvent e) {
updateLaunchConfigurationDialog();
}
@@ -474,11 +483,11 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
fReverseCheckBox = addCheckbox(subComp, LaunchUIMessages.getString("GDBDebuggerPage.reverse_Debugging")); //$NON-NLS-1$
- fReverseDebugMode = new Combo(subComp, SWT.READ_ONLY | SWT.DROP_DOWN );
+ fReverseDebugMode = new Combo(subComp, SWT.READ_ONLY | SWT.DROP_DOWN);
fReverseDebugMode.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false));
fReverseDebugMode.add(HW_REVERSE_MODE);
fReverseDebugMode.add(SW_REVERSE_MODE);
-
+
fReverseDebugMode.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
@@ -502,7 +511,7 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
/** Used to add a checkbox to the tab. Each checkbox has its own line. */
private Button addCheckbox(Composite parent, String label) {
Button button = ControlFactory.createCheckBox(parent, label);
- button .addSelectionListener(new SelectionAdapter() {
+ button.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updateLaunchConfigurationDialog();
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/GdbServerDebuggerPage.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/GdbServerDebuggerPage.java
index a9cb610432e..05c6e415fab 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/GdbServerDebuggerPage.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/GdbServerDebuggerPage.java
@@ -51,7 +51,7 @@ public class GdbServerDebuggerPage extends GdbDebuggerPage {
protected StringDialogField fRemoteTimeoutValueField;
- private String[] fConnections = new String[]{ CONNECTION_TCP, CONNECTION_SERIAL };
+ private String[] fConnections = new String[] { CONNECTION_TCP, CONNECTION_SERIAL };
private TCPSettingsBlock fTCPBlock;
@@ -75,28 +75,33 @@ public class GdbServerDebuggerPage extends GdbDebuggerPage {
TabItem tabItem = new TabItem(tabFolder, SWT.NONE);
tabItem.setText(LaunchUIMessages.getString("GDBServerDebuggerPage.10")); //$NON-NLS-1$
Composite comp1 = ControlFactory.createCompositeEx(tabFolder, 1, GridData.FILL_BOTH);
- ((GridLayout)comp1.getLayout()).makeColumnsEqualWidth = false;
+ ((GridLayout) comp1.getLayout()).makeColumnsEqualWidth = false;
comp1.setFont(tabFolder.getFont());
tabItem.setControl(comp1);
Composite comp = ControlFactory.createCompositeEx(comp1, 3, GridData.FILL_BOTH);
- ((GridLayout)comp.getLayout()).makeColumnsEqualWidth = false;
+ ((GridLayout) comp.getLayout()).makeColumnsEqualWidth = false;
comp.setFont(comp1.getFont());
fConnectionField.doFillIntoGrid(comp, 3);
- ((GridData)fConnectionField.getComboControl(null).getLayoutData()).horizontalAlignment = GridData.BEGINNING;
+ ((GridData) fConnectionField.getComboControl(null).getLayoutData()).horizontalAlignment = GridData.BEGINNING;
fRemoteTimeoutEnabledField.doFillIntoGrid(comp, 1);
- fRemoteTimeoutEnabledField.getSelectionButton(comp).setToolTipText(LaunchUIMessages.getString("GDBServerDebuggerPage.12")); //$NON-NLS-1$
+ fRemoteTimeoutEnabledField.getSelectionButton(comp)
+ .setToolTipText(LaunchUIMessages.getString("GDBServerDebuggerPage.12")); //$NON-NLS-1$
fRemoteTimeoutValueField.doFillIntoGrid(comp, 2);
- ((GridData)fRemoteTimeoutValueField.getTextControl(null).getLayoutData()).horizontalAlignment = GridData.BEGINNING;
+ ((GridData) fRemoteTimeoutValueField.getTextControl(null)
+ .getLayoutData()).horizontalAlignment = GridData.BEGINNING;
PixelConverter converter = new PixelConverter(comp);
- LayoutUtil.setWidthHint(fRemoteTimeoutValueField.getTextControl(null), converter.convertWidthInCharsToPixels(10));
- fRemoteTimeoutValueField.getLabelControl(comp).setToolTipText(LaunchUIMessages.getString("GDBServerDebuggerPage.12")); //$NON-NLS-1$
- fRemoteTimeoutValueField.getTextControl(comp).setToolTipText(LaunchUIMessages.getString("GDBServerDebuggerPage.12")); //$NON-NLS-1$
+ LayoutUtil.setWidthHint(fRemoteTimeoutValueField.getTextControl(null),
+ converter.convertWidthInCharsToPixels(10));
+ fRemoteTimeoutValueField.getLabelControl(comp)
+ .setToolTipText(LaunchUIMessages.getString("GDBServerDebuggerPage.12")); //$NON-NLS-1$
+ fRemoteTimeoutValueField.getTextControl(comp)
+ .setToolTipText(LaunchUIMessages.getString("GDBServerDebuggerPage.12")); //$NON-NLS-1$
fConnectionStack = ControlFactory.createCompositeEx(comp, 1, GridData.FILL_BOTH);
StackLayout stackLayout = new StackLayout();
fConnectionStack.setLayout(stackLayout);
- ((GridData)fConnectionStack.getLayoutData()).horizontalSpan = 3;
+ ((GridData) fConnectionStack.getLayoutData()).horizontalSpan = 3;
fTCPBlock.createBlock(fConnectionStack);
- fSerialBlock.createBlock(fConnectionStack);
+ fSerialBlock.createBlock(fConnectionStack);
}
private ComboDialogField createConnectionField() {
@@ -133,7 +138,7 @@ public class GdbServerDebuggerPage extends GdbDebuggerPage {
}
});
fRemoteTimeoutEnabledField.attachDialogField(fRemoteTimeoutValueField);
- }
+ }
protected void connectionTypeChanged() {
connectionTypeChanged0();
@@ -141,14 +146,14 @@ public class GdbServerDebuggerPage extends GdbDebuggerPage {
}
private void connectionTypeChanged0() {
- ((StackLayout)fConnectionStack.getLayout()).topControl = null;
+ ((StackLayout) fConnectionStack.getLayout()).topControl = null;
int index = fConnectionField.getSelectionIndex();
if (index >= 0 && index < fConnections.length) {
String[] connTypes = fConnectionField.getItems();
if (CONNECTION_TCP.equals(connTypes[index]))
- ((StackLayout)fConnectionStack.getLayout()).topControl = fTCPBlock.getControl();
+ ((StackLayout) fConnectionStack.getLayout()).topControl = fTCPBlock.getControl();
else if (CONNECTION_SERIAL.equals(connTypes[index]))
- ((StackLayout)fConnectionStack.getLayout()).topControl = fSerialBlock.getControl();
+ ((StackLayout) fConnectionStack.getLayout()).topControl = fSerialBlock.getControl();
}
fConnectionStack.layout();
}
@@ -166,8 +171,7 @@ public class GdbServerDebuggerPage extends GdbDebuggerPage {
setErrorMessage(fTCPBlock.getErrorMessage());
return false;
}
- }
- else if (CONNECTION_SERIAL.equals(connTypes[index])) {
+ } else if (CONNECTION_SERIAL.equals(connTypes[index])) {
if (!fSerialBlock.isValid(launchConfig)) {
setErrorMessage(fSerialBlock.getErrorMessage());
return false;
@@ -194,8 +198,7 @@ public class GdbServerDebuggerPage extends GdbDebuggerPage {
boolean isTcp = true;
try {
isTcp = configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP, true);
- }
- catch(CoreException e) {
+ } catch (CoreException e) {
}
fTCPBlock.initializeFrom(configuration);
fSerialBlock.initializeFrom(configuration);
@@ -223,13 +226,16 @@ public class GdbServerDebuggerPage extends GdbDebuggerPage {
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
super.performApply(configuration);
if (fConnectionField != null)
- configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP, fConnectionField.getSelectionIndex() == 0);
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP,
+ fConnectionField.getSelectionIndex() == 0);
fTCPBlock.performApply(configuration);
fSerialBlock.performApply(configuration);
if (fRemoteTimeoutEnabledField != null)
- configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_ENABLED, fRemoteTimeoutEnabledField.isSelected());
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_ENABLED,
+ fRemoteTimeoutEnabledField.isSelected());
if (fRemoteTimeoutValueField != null)
- configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_VALUE, fRemoteTimeoutValueField.getText().trim());
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_VALUE,
+ fRemoteTimeoutValueField.getText().trim());
}
@Override
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/ICDTLaunchHelpContextIds.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/ICDTLaunchHelpContextIds.java
index 2d410219065..3c7da303a85 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/ICDTLaunchHelpContextIds.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/ICDTLaunchHelpContextIds.java
@@ -20,10 +20,14 @@ public interface ICDTLaunchHelpContextIds {
public static final String PREFIX = GdbUIPlugin.PLUGIN_ID + "."; //$NON-NLS-1$
// Launch configuration dialog pages
- public static final String LAUNCH_CONFIGURATION_DIALOG_MAIN_TAB = PREFIX + "launch_configuration_dialog_main_tab"; //$NON-NLS-1$
- public static final String LAUNCH_CONFIGURATION_DIALOG_ARGUMNETS_TAB = PREFIX + "launch_configuration_dialog_arguments_tab"; //$NON-NLS-1$
- public static final String LAUNCH_CONFIGURATION_DIALOG_ENVIRONMENT_TAB = PREFIX + "launch_configuration_dialog_environment_tab"; //$NON-NLS-1$
- public static final String LAUNCH_CONFIGURATION_DIALOG_DEBBUGER_TAB = PREFIX + "launch_configuration_dialog_debugger_tab"; //$NON-NLS-1$
- public static final String LAUNCH_CONFIGURATION_DIALOG_SOURCELOOKUP_TAB = PREFIX + "launch_configuration_dialog_source_tab"; //$NON-NLS-1$
+ public static final String LAUNCH_CONFIGURATION_DIALOG_MAIN_TAB = PREFIX + "launch_configuration_dialog_main_tab"; //$NON-NLS-1$
+ public static final String LAUNCH_CONFIGURATION_DIALOG_ARGUMNETS_TAB = PREFIX
+ + "launch_configuration_dialog_arguments_tab"; //$NON-NLS-1$
+ public static final String LAUNCH_CONFIGURATION_DIALOG_ENVIRONMENT_TAB = PREFIX
+ + "launch_configuration_dialog_environment_tab"; //$NON-NLS-1$
+ public static final String LAUNCH_CONFIGURATION_DIALOG_DEBBUGER_TAB = PREFIX
+ + "launch_configuration_dialog_debugger_tab"; //$NON-NLS-1$
+ public static final String LAUNCH_CONFIGURATION_DIALOG_SOURCELOOKUP_TAB = PREFIX
+ + "launch_configuration_dialog_source_tab"; //$NON-NLS-1$
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/IMILaunchConfigurationComponent.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/IMILaunchConfigurationComponent.java
index 917dd2f44ed..7b2e248906a 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/IMILaunchConfigurationComponent.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/IMILaunchConfigurationComponent.java
@@ -28,56 +28,56 @@ public interface IMILaunchConfigurationComponent {
* <p>
* Implementors are responsible for ensuring that the created control can be accessed via <code>getControl</code>
* </p>
- *
+ *
* @param parent the parent composite
*/
- public void createControl( Composite parent );
+ public void createControl(Composite parent);
/**
* Returns the top level control for this component.
* <p>
* May return <code>null</code> if the control has not been created yet.
* </p>
- *
+ *
* @return the top level control or <code>null</code>
*/
public Control getControl();
/**
- * Initializes the given component with default values.
+ * Initializes the given component with default values.
* This method may be called before this tab's control is created.
- *
+ *
* @param configuration launch configuration
*/
- public void setDefaults( ILaunchConfigurationWorkingCopy configuration );
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration);
/**
- * Initializes this component's controls with values from the given
+ * Initializes this component's controls with values from the given
* launch configuration.
- *
+ *
* @param configuration launch configuration
*/
- public void initializeFrom( ILaunchConfiguration configuration );
+ public void initializeFrom(ILaunchConfiguration configuration);
/**
- * Notifies this component that it has been disposed.
- * Marks the end of this component's lifecycle, allowing
+ * Notifies this component that it has been disposed.
+ * Marks the end of this component's lifecycle, allowing
* to perform any cleanup required.
*/
public void dispose();
/**
* Copies values from this component into the given launch configuration.
- *
+ *
* @param configuration launch configuration
*/
- public void performApply( ILaunchConfigurationWorkingCopy configuration );
+ public void performApply(ILaunchConfigurationWorkingCopy configuration);
/**
- * Returns whether this component is in a valid state in the context
+ * Returns whether this component is in a valid state in the context
* of the specified launch configuration.
*
- * @param launchConfig launch configuration which provides context
+ * @param launchConfig launch configuration which provides context
* for validating this component.
* This value must not be <code>null</code>.
*
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/LaunchImages.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/LaunchImages.java
index f1448ce76c3..3102a08e011 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/LaunchImages.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/LaunchImages.java
@@ -24,17 +24,17 @@ import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.swt.graphics.Image;
public class LaunchImages {
- private static final String NAME_PREFIX= GdbUIPlugin.PLUGIN_ID + '.';
- private static final int NAME_PREFIX_LENGTH= NAME_PREFIX.length();
-
+ private static final String NAME_PREFIX = GdbUIPlugin.PLUGIN_ID + '.';
+ private static final int NAME_PREFIX_LENGTH = NAME_PREFIX.length();
+
// The plugin registry
private static ImageRegistry imageRegistry = new ImageRegistry();
// Subdirectory (under the package containing this class) where 16 color images are
private static URL fgIconBaseURL;
static {
- fgIconBaseURL= Platform.getBundle(GdbUIPlugin.PLUGIN_ID).getEntry("/icons/"); //$NON-NLS-1$
- }
+ fgIconBaseURL = Platform.getBundle(GdbUIPlugin.PLUGIN_ID).getEntry("/icons/"); //$NON-NLS-1$
+ }
private static final String T_TABS = "full/view16/"; //$NON-NLS-1$
private static final String T_OBJS = "full/obj16/"; //$NON-NLS-1$
@@ -43,33 +43,33 @@ public class LaunchImages {
public static String IMG_VIEW_ARGUMENTS_TAB = NAME_PREFIX + "arguments_tab.gif"; //$NON-NLS-1$
public static String IMG_VIEW_DEBUGGER_TAB = NAME_PREFIX + "debugger_tab.gif"; //$NON-NLS-1$
- public static final ImageDescriptor DESC_TAB_MAIN= createManaged(T_TABS, IMG_VIEW_MAIN_TAB);
+ public static final ImageDescriptor DESC_TAB_MAIN = createManaged(T_TABS, IMG_VIEW_MAIN_TAB);
public static final ImageDescriptor DESC_TAB_ARGUMENTS = createManaged(T_TABS, IMG_VIEW_ARGUMENTS_TAB);
public static final ImageDescriptor DESC_TAB_DEBUGGER = createManaged(T_TABS, IMG_VIEW_DEBUGGER_TAB);
- public static String IMG_OBJS_EXEC= NAME_PREFIX + "exec_obj.gif"; //$NON-NLS-1$
+ public static String IMG_OBJS_EXEC = NAME_PREFIX + "exec_obj.gif"; //$NON-NLS-1$
public static final ImageDescriptor DESC_OBJS_EXEC = createManaged(T_OBJS, IMG_OBJS_EXEC);
public static void initialize() {
}
-
+
private static ImageDescriptor createManaged(String prefix, String name) {
return createManaged(imageRegistry, prefix, name);
}
-
+
private static ImageDescriptor createManaged(ImageRegistry registry, String prefix, String name) {
- ImageDescriptor result= ImageDescriptor.createFromURL(makeIconFileURL(prefix, name.substring(NAME_PREFIX_LENGTH)));
+ ImageDescriptor result = ImageDescriptor
+ .createFromURL(makeIconFileURL(prefix, name.substring(NAME_PREFIX_LENGTH)));
registry.put(name, result);
return result;
}
-
+
public static Image get(String key) {
return imageRegistry.get(key);
}
-
private static URL makeIconFileURL(String prefix, String name) {
- StringBuilder buffer= new StringBuilder(prefix);
+ StringBuilder buffer = new StringBuilder(prefix);
buffer.append(name);
try {
return new URL(fgIconBaseURL, buffer.toString());
@@ -78,7 +78,7 @@ public class LaunchImages {
return null;
}
}
-
+
/**
* Helper method to access the image registry from the JavaPlugin class.
*/
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/LaunchUIMessages.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/LaunchUIMessages.java
index a2ed94adfe9..da7d91e0d97 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/LaunchUIMessages.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/LaunchUIMessages.java
@@ -25,25 +25,26 @@ public class LaunchUIMessages {
private static ResourceBundle RESOURCE_BUNDLE = null;
static {
- try {
- RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
- }
- catch (MissingResourceException x) {
- }
+ try {
+ RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
+ } catch (MissingResourceException x) {
+ }
}
- private LaunchUIMessages() {}
+ private LaunchUIMessages() {
+ }
public static String getFormattedString(String key, String arg) {
- return MessageFormat.format(getString(key), new Object[]{arg});
+ return MessageFormat.format(getString(key), new Object[] { arg });
}
public static String getFormattedString(String key, String[] args) {
- return MessageFormat.format(getString(key), (Object[])args);
+ return MessageFormat.format(getString(key), (Object[]) args);
}
public static String getString(String key) {
- if (RESOURCE_BUNDLE == null) return '!' + key + '!';
+ if (RESOURCE_BUNDLE == null)
+ return '!' + key + '!';
return RESOURCE_BUNDLE.getString(key);
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/LocalApplicationCDebuggerTab.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/LocalApplicationCDebuggerTab.java
index 15553c79bb6..6a02c7804bd 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/LocalApplicationCDebuggerTab.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/LocalApplicationCDebuggerTab.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -20,7 +20,7 @@ import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
/**
* Debugger tab to use for a local application launch configuration.
- *
+ *
* @since 2.0
*/
public class LocalApplicationCDebuggerTab extends CDebuggerTab {
@@ -38,30 +38,30 @@ public class LocalApplicationCDebuggerTab extends CDebuggerTab {
* Bug 281970
*/
private final static String DEFAULTS_SET = "org.eclipse.cdt.dsf.gdb.internal.ui.launching.LocalApplicationCDebuggerTab.DEFAULTS_SET"; //$NON-NLS-1$
-
- public LocalApplicationCDebuggerTab() {
- super(SessionType.LOCAL, false);
- }
-
- @Override
- public void setDefaults(ILaunchConfigurationWorkingCopy config) {
+
+ public LocalApplicationCDebuggerTab() {
+ super(SessionType.LOCAL, false);
+ }
+
+ @Override
+ public void setDefaults(ILaunchConfigurationWorkingCopy config) {
config.setAttribute(DEFAULTS_SET, true);
-
- super.setDefaults(config);
- }
-
- @Override
- public void initializeFrom(ILaunchConfiguration config) {
- try {
- if (config.hasAttribute(DEFAULTS_SET) == false) {
- ILaunchConfigurationWorkingCopy wc;
- wc = config.getWorkingCopy();
- setDefaults(wc);
- wc.doSave();
- }
- } catch (CoreException e) {
- }
+
+ super.setDefaults(config);
+ }
+
+ @Override
+ public void initializeFrom(ILaunchConfiguration config) {
+ try {
+ if (config.hasAttribute(DEFAULTS_SET) == false) {
+ ILaunchConfigurationWorkingCopy wc;
+ wc = config.getWorkingCopy();
+ setDefaults(wc);
+ wc.doSave();
+ }
+ } catch (CoreException e) {
+ }
super.initializeFrom(config);
- }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/NewExecutableDialog.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/NewExecutableDialog.java
index ba0d999cc8f..aece4365ef5 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/NewExecutableDialog.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/NewExecutableDialog.java
@@ -44,7 +44,7 @@ import org.eclipse.swt.widgets.Text;
public class NewExecutableDialog extends TitleAreaDialog {
private NewExecutableInfo fInfo = null;
-
+
private Text fHostBinaryText;
private Text fTargetBinaryText;
private Text fArgumentsText;
@@ -52,82 +52,82 @@ public class NewExecutableDialog extends TitleAreaDialog {
private Button fStopInMain;
private Text fStopInMainSymbol;
- public NewExecutableDialog( Shell parentShell, NewExecutableInfo info ) {
- super( parentShell );
+ public NewExecutableDialog(Shell parentShell, NewExecutableInfo info) {
+ super(parentShell);
assert info != null;
- setShellStyle( getShellStyle() | SWT.RESIZE );
+ setShellStyle(getShellStyle() | SWT.RESIZE);
fInfo = info;
}
@Override
- protected Control createContents( Composite parent ) {
- Control control = super.createContents( parent );
+ protected Control createContents(Composite parent) {
+ Control control = super.createContents(parent);
initialize();
validate();
return control;
}
@Override
- protected Control createDialogArea( Composite parent ) {
+ protected Control createDialogArea(Composite parent) {
boolean remote = fInfo.getSessionType() == SessionType.REMOTE;
- getShell().setText( Messages.GdbDebugNewExecutableCommand_Debug_New_Executable );
- setTitle( Messages.GdbDebugNewExecutableCommand_Select_Binary );
- String message = ( remote ) ?
- Messages.GdbDebugNewExecutableCommand_Select_binaries_on_host_and_target :
- Messages.GdbDebugNewExecutableCommand_Select_binary_and_specify_arguments;
- setMessage( message );
-
- Composite control = (Composite)super.createDialogArea( parent );
- Composite comp = new Composite( control, SWT.NONE );
- GridData gd = new GridData( SWT.FILL, SWT.FILL, true, true );
- GridLayout layout = new GridLayout( 3, false );
- comp.setLayout( layout );
- comp.setLayoutData( gd );
-
- new Label( comp, SWT.None ).setText( remote ? Messages.GdbDebugNewExecutableCommand_Binary_on_host : Messages.GdbDebugNewExecutableCommand_Binary );
- fHostBinaryText = new Text( comp, SWT.BORDER );
- fHostBinaryText.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false ) );
- fHostBinaryText.addModifyListener( new ModifyListener() {
-
+ getShell().setText(Messages.GdbDebugNewExecutableCommand_Debug_New_Executable);
+ setTitle(Messages.GdbDebugNewExecutableCommand_Select_Binary);
+ String message = (remote) ? Messages.GdbDebugNewExecutableCommand_Select_binaries_on_host_and_target
+ : Messages.GdbDebugNewExecutableCommand_Select_binary_and_specify_arguments;
+ setMessage(message);
+
+ Composite control = (Composite) super.createDialogArea(parent);
+ Composite comp = new Composite(control, SWT.NONE);
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ GridLayout layout = new GridLayout(3, false);
+ comp.setLayout(layout);
+ comp.setLayoutData(gd);
+
+ new Label(comp, SWT.None).setText(remote ? Messages.GdbDebugNewExecutableCommand_Binary_on_host
+ : Messages.GdbDebugNewExecutableCommand_Binary);
+ fHostBinaryText = new Text(comp, SWT.BORDER);
+ fHostBinaryText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ fHostBinaryText.addModifyListener(new ModifyListener() {
+
@Override
- public void modifyText( ModifyEvent e ) {
+ public void modifyText(ModifyEvent e) {
validate();
}
- } );
- Button browseButton = new Button( comp, SWT.PUSH );
- browseButton.setText( Messages.GdbDebugNewExecutableCommand_Browse );
- browseButton.setFont( JFaceResources.getDialogFont() );
- setButtonLayoutData( browseButton );
- browseButton.addSelectionListener( new SelectionAdapter() {
+ });
+ Button browseButton = new Button(comp, SWT.PUSH);
+ browseButton.setText(Messages.GdbDebugNewExecutableCommand_Browse);
+ browseButton.setFont(JFaceResources.getDialogFont());
+ setButtonLayoutData(browseButton);
+ browseButton.addSelectionListener(new SelectionAdapter() {
@Override
- public void widgetSelected( SelectionEvent e ) {
- FileDialog dialog = new FileDialog( getShell() );
- dialog.setFileName( fHostBinaryText.getText() );
+ public void widgetSelected(SelectionEvent e) {
+ FileDialog dialog = new FileDialog(getShell());
+ dialog.setFileName(fHostBinaryText.getText());
String result = dialog.open();
- if ( result != null ) {
- fHostBinaryText.setText( result );
+ if (result != null) {
+ fHostBinaryText.setText(result);
}
}
- } );
-
- if ( remote ) {
- new Label( comp, SWT.None ).setText( Messages.GdbDebugNewExecutableCommand_Binary_on_target );
- fTargetBinaryText = new Text( comp, SWT.BORDER );
- fTargetBinaryText.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false, 2, 1 ) );
- fTargetBinaryText.addModifyListener( new ModifyListener() {
-
+ });
+
+ if (remote) {
+ new Label(comp, SWT.None).setText(Messages.GdbDebugNewExecutableCommand_Binary_on_target);
+ fTargetBinaryText = new Text(comp, SWT.BORDER);
+ fTargetBinaryText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
+ fTargetBinaryText.addModifyListener(new ModifyListener() {
+
@Override
- public void modifyText( ModifyEvent e ) {
+ public void modifyText(ModifyEvent e) {
validate();
}
- } );
+ });
}
- new Label( comp, SWT.None ).setText( Messages.GdbDebugNewExecutableCommand_Arguments );
- fArgumentsText = new Text( comp, SWT.BORDER );
- fArgumentsText.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false, 2, 1 ) );
+ new Label(comp, SWT.None).setText(Messages.GdbDebugNewExecutableCommand_Arguments);
+ fArgumentsText = new Text(comp, SWT.BORDER);
+ fArgumentsText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
createOptionsArea(comp);
@@ -160,15 +160,13 @@ public class NewExecutableDialog extends TitleAreaDialog {
validate();
}
});
- fStopInMainSymbol.getAccessible().addAccessibleListener(
- new AccessibleAdapter() {
- @Override
- public void getName(AccessibleEvent e) {
- e.result = LaunchMessages.getString("CDebuggerTab.Stop_at_main_on_startup"); //$NON-NLS-1$
- }
+ fStopInMainSymbol.getAccessible().addAccessibleListener(new AccessibleAdapter() {
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = LaunchMessages.getString("CDebuggerTab.Stop_at_main_on_startup"); //$NON-NLS-1$
}
- );
-
+ });
+
}
@Override
@@ -190,8 +188,10 @@ public class NewExecutableDialog extends TitleAreaDialog {
}
fArgumentsText.setText(fInfo.getArguments());
if (fStopInMain != null && fStopInMainSymbol != null) {
- fStopInMain.setSelection((Boolean)fInfo.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN));
- fStopInMainSymbol.setText((String)fInfo.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL));
+ fStopInMain.setSelection(
+ (Boolean) fInfo.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN));
+ fStopInMainSymbol.setText(
+ (String) fInfo.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL));
}
}
@@ -199,30 +199,25 @@ public class NewExecutableDialog extends TitleAreaDialog {
boolean remote = fInfo.getSessionType() == SessionType.REMOTE;
StringBuilder sb = new StringBuilder();
String hostBinary = fHostBinaryText.getText().trim();
- if ( hostBinary.isEmpty() ) {
- sb.append( ( remote ) ?
- Messages.GdbDebugNewExecutableCommand_Host_binary_must_be_specified :
- Messages.GdbDebugNewExecutableCommand_Binary_must_be_specified );
- }
- else {
- File file = new File( hostBinary );
- if ( !file.exists() ) {
- sb.append( ( remote ) ?
- Messages.GdbDebugNewExecutableCommand_Host_binary_file_does_not_exist :
- Messages.GdbDebugNewExecutableCommand_Binary_file_does_not_exist );
- }
- else if ( file.isDirectory() ) {
- sb.append( ( remote ) ?
- Messages.GdbDebugNewExecutableCommand_Invalid_host_binary :
- Messages.GdbDebugNewExecutableCommand_Invalid_binary );
+ if (hostBinary.isEmpty()) {
+ sb.append((remote) ? Messages.GdbDebugNewExecutableCommand_Host_binary_must_be_specified
+ : Messages.GdbDebugNewExecutableCommand_Binary_must_be_specified);
+ } else {
+ File file = new File(hostBinary);
+ if (!file.exists()) {
+ sb.append((remote) ? Messages.GdbDebugNewExecutableCommand_Host_binary_file_does_not_exist
+ : Messages.GdbDebugNewExecutableCommand_Binary_file_does_not_exist);
+ } else if (file.isDirectory()) {
+ sb.append((remote) ? Messages.GdbDebugNewExecutableCommand_Invalid_host_binary
+ : Messages.GdbDebugNewExecutableCommand_Invalid_binary);
}
}
- if ( fTargetBinaryText != null ) {
- if ( fTargetBinaryText.getText().trim().length() == 0 ) {
- if ( sb.length() != 0 ) {
- sb.append( "\n " ); //$NON-NLS-1$
+ if (fTargetBinaryText != null) {
+ if (fTargetBinaryText.getText().trim().length() == 0) {
+ if (sb.length() != 0) {
+ sb.append("\n "); //$NON-NLS-1$
}
- sb.append( Messages.GdbDebugNewExecutableCommand_Binary_on_target_must_be_specified );
+ sb.append(Messages.GdbDebugNewExecutableCommand_Binary_on_target_must_be_specified);
}
}
if (fStopInMain != null && fStopInMainSymbol != null) {
@@ -236,14 +231,16 @@ public class NewExecutableDialog extends TitleAreaDialog {
}
}
- setErrorMessage( ( sb.length() != 0 ) ? sb.toString() : null );
- getButton( IDialogConstants.OK_ID ).setEnabled( getErrorMessage() == null );
+ setErrorMessage((sb.length() != 0) ? sb.toString() : null);
+ getButton(IDialogConstants.OK_ID).setEnabled(getErrorMessage() == null);
}
-
+
protected void saveOptions() {
if (fStopInMain != null && fStopInMainSymbol != null) {
- fInfo.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, Boolean.valueOf(fStopInMain.getSelection()));
- fInfo.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, fStopInMainSymbol.getText().trim());
+ fInfo.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN,
+ Boolean.valueOf(fStopInMain.getSelection()));
+ fInfo.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL,
+ fStopInMainSymbol.getText().trim());
}
}
} \ No newline at end of file
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/NewExecutableInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/NewExecutableInfo.java
index f8b77f37299..cc5ae917434 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/NewExecutableInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/NewExecutableInfo.java
@@ -25,30 +25,30 @@ import org.eclipse.cdt.dsf.gdb.service.SessionType;
import org.eclipse.jface.preference.IPreferenceStore;
/**
- * This class provides information required to start
- * debugging an executable.
+ * This class provides information required to start
+ * debugging an executable.
*/
public class NewExecutableInfo {
-
+
public static final String ATTR_SESSION_TYPE = "sessionType"; //$NON-NLS-1$
- final private SessionType fSessionType;
+ final private SessionType fSessionType;
private String fHostPath = ""; //$NON-NLS-1$
private Map<String, Object> fAttributes = new HashMap<String, Object>();
- public NewExecutableInfo(SessionType sessionType) {
+ public NewExecutableInfo(SessionType sessionType) {
super();
fSessionType = sessionType;
setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_BINARY, ""); //$NON-NLS-1$
setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, ""); //$NON-NLS-1$
IPreferenceStore preferences = GdbUIPlugin.getDefault().getPreferenceStore();
setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN,
- preferences.getBoolean(IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN));
+ preferences.getBoolean(IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN));
setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL,
- preferences.getString(IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN_SYMBOL));
+ preferences.getString(IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN_SYMBOL));
}
-
+
/**
* Returns the path of the executable on the host
*/
@@ -64,20 +64,20 @@ public class NewExecutableInfo {
}
/**
- * For remote sessions returns the path of the executable
+ * For remote sessions returns the path of the executable
* on the target. Otherwise returns null.
*/
public String getTargetPath() {
- return (String)fAttributes.get(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_BINARY);
+ return (String) fAttributes.get(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_BINARY);
}
-
+
/**
* Returns the arguments to pass to the executable, or null
*/
public String getArguments() {
- return (String)fAttributes.get(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS);
+ return (String) fAttributes.get(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS);
}
-
+
/**
* Returns the attribute map
*/
@@ -95,7 +95,7 @@ public class NewExecutableInfo {
public Object getAttribute(String name) {
return fAttributes.get(name);
}
-
+
public void setAttribute(String name, Object value) {
fAttributes.put(name, value);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/ProcessPrompter.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/ProcessPrompter.java
index 01a7a2d3b21..770db858d63 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/ProcessPrompter.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/ProcessPrompter.java
@@ -43,14 +43,14 @@ public class ProcessPrompter implements IStatusHandler {
public static class PrompterInfo {
public IProcessExtendedInfo[] processList;
public List<String> debuggedProcesses;
-
+
public PrompterInfo(IProcessExtendedInfo[] list, List<String> debuggedProcs) {
processList = list;
debuggedProcesses = debuggedProcs;
}
}
-
- @Override
+
+ @Override
public Object handleStatus(IStatus status, Object info) throws CoreException {
Shell shell = GdbUIPlugin.getShell();
if (shell == null) {
@@ -61,20 +61,19 @@ public class ProcessPrompter implements IStatusHandler {
}
final PrompterInfo prompterInfo = (PrompterInfo) info;
- IProcessExtendedInfo[] plist = prompterInfo.processList;
+ IProcessExtendedInfo[] plist = prompterInfo.processList;
if (plist == null) {
- MessageDialog.openError(
- shell,
- LaunchMessages.getString("LocalAttachLaunchDelegate.CDT_Launch_Error"), LaunchMessages.getString("LocalAttachLaunchDelegate.Platform_cannot_list_processes")); //$NON-NLS-1$ //$NON-NLS-2$
+ MessageDialog.openError(shell, LaunchMessages.getString("LocalAttachLaunchDelegate.CDT_Launch_Error"), //$NON-NLS-1$
+ LaunchMessages.getString("LocalAttachLaunchDelegate.Platform_cannot_list_processes")); //$NON-NLS-1$
return null;
}
-
+
if (plist.length == 0) {
// No list available, just let the user put in a pid directly
- InputDialog dialog = new InputDialog(shell,
- LaunchMessages.getString("LocalAttachLaunchDelegate.Select_Process"), //$NON-NLS-1$
- LaunchMessages.getString("LocalAttachLaunchDelegate.Select_Process_to_attach_debugger_to"), //$NON-NLS-1$
- null, null);
+ InputDialog dialog = new InputDialog(shell,
+ LaunchMessages.getString("LocalAttachLaunchDelegate.Select_Process"), //$NON-NLS-1$
+ LaunchMessages.getString("LocalAttachLaunchDelegate.Select_Process_to_attach_debugger_to"), //$NON-NLS-1$
+ null, null);
if (dialog.open() == Window.OK) {
String pidStr = dialog.getValue();
@@ -87,7 +86,7 @@ public class ProcessPrompter implements IStatusHandler {
ILabelProvider provider = new LabelProvider() {
@Override
public String getText(Object element) {
- IProcessExtendedInfo info = (IProcessExtendedInfo)element;
+ IProcessExtendedInfo info = (IProcessExtendedInfo) element;
// Sometimes, if we are not getting the list of processes from GDB,
// we use CCorePlugin.getDefault().getProcessList(); which returns
// the process and its arguments. If the arguments contain a /
@@ -99,44 +98,44 @@ public class ProcessPrompter implements IStatusHandler {
// Bug 374823
return null;
}
-
+
name = name.split("\\s", 2)[0]; //$NON-NLS-1$
-
- // on windows host, paths of style "sendmail:", "udisk-daemon:"
- // would be treated as device id with no path segments
+
+ // on windows host, paths of style "sendmail:", "udisk-daemon:"
+ // would be treated as device id with no path segments
IPath path = new Path(name);
StringBuilder text = new StringBuilder();
- if (path.lastSegment() == null ) {
+ if (path.lastSegment() == null) {
text.append(name);
} else {
text.append(path.lastSegment());
}
-
+
String owner = info.getOwner();
if (owner != null && !owner.isEmpty()) {
- text.append(" (").append(owner).append(")"); //$NON-NLS-1$//$NON-NLS-2$
+ text.append(" (").append(owner).append(")"); //$NON-NLS-1$//$NON-NLS-2$
}
-
+
text.append(" - ").append(info.getPid()); //$NON-NLS-1$
String[] cores = info.getCores();
if (cores != null && cores.length > 0) {
String coreStr;
if (cores.length == 1) {
- coreStr = LaunchUIMessages.getString("ProcessPrompter.Core"); //$NON-NLS-1$
+ coreStr = LaunchUIMessages.getString("ProcessPrompter.Core"); //$NON-NLS-1$
} else {
- coreStr = LaunchUIMessages.getString("ProcessPrompter.Cores"); //$NON-NLS-1$
+ coreStr = LaunchUIMessages.getString("ProcessPrompter.Cores"); //$NON-NLS-1$
}
- text.append(" [").append(coreStr).append(": "); //$NON-NLS-1$//$NON-NLS-2$
-
+ text.append(" [").append(coreStr).append(": "); //$NON-NLS-1$//$NON-NLS-2$
+
for (String core : cores) {
text.append(core).append(", "); //$NON-NLS-1$
}
// Remove the last comma and space
- text.replace(text.length()-2, text.length(), "]"); //$NON-NLS-1$
+ text.replace(text.length() - 2, text.length(), "]"); //$NON-NLS-1$
}
-
- String description = info.getDescription();
+
+ String description = info.getDescription();
if (description != null) {
text.append(" : " + description); //$NON-NLS-1$
}
@@ -152,8 +151,8 @@ public class ProcessPrompter implements IStatusHandler {
ILabelProvider qprovider = new LabelProvider() {
@Override
public String getText(Object element) {
- IProcessExtendedInfo info = (IProcessExtendedInfo)element;
- String description = info.getDescription();
+ IProcessExtendedInfo info = (IProcessExtendedInfo) element;
+ String description = info.getDescription();
if (description != null) {
return description;
}
@@ -167,23 +166,23 @@ public class ProcessPrompter implements IStatusHandler {
};
// Display the list of processes and have the user choose
- ProcessPrompterDialog dialog =
- new ProcessPrompterDialog(shell, provider, qprovider);
+ ProcessPrompterDialog dialog = new ProcessPrompterDialog(shell, provider, qprovider);
dialog.setTitle(LaunchUIMessages.getString("LocalAttachLaunchDelegate.Select_Process")); //$NON-NLS-1$
- dialog.setMessage(LaunchUIMessages.getString("LocalAttachLaunchDelegate.Select_Process_to_attach_debugger_to")); //$NON-NLS-1$
+ dialog.setMessage(
+ LaunchUIMessages.getString("LocalAttachLaunchDelegate.Select_Process_to_attach_debugger_to")); //$NON-NLS-1$
// Allow for multiple selection
dialog.setMultipleSelection(true);
dialog.setStatusLineAboveButtons(true);
-
+
dialog.setValidator(new ISelectionStatusValidator() {
@Override
public IStatus validate(Object[] selection) {
for (Object sel : selection) {
- String pid = Integer.toString(((IProcessExtendedInfo)sel).getPid(), 10);
+ String pid = Integer.toString(((IProcessExtendedInfo) sel).getPid(), 10);
if (prompterInfo.debuggedProcesses.contains(pid)) {
- return new Status(IStatus.ERROR, GdbUIPlugin.getUniqueIdentifier(),
- MessageFormat.format(LaunchUIMessages.getString("ProcessPrompter.ErrProcessConected"), pid)); //$NON-NLS-1$
+ return new Status(IStatus.ERROR, GdbUIPlugin.getUniqueIdentifier(), MessageFormat
+ .format(LaunchUIMessages.getString("ProcessPrompter.ErrProcessConected"), pid)); //$NON-NLS-1$
}
}
return new Status(IStatus.OK, GdbUIPlugin.getUniqueIdentifier(), ""); //$NON-NLS-1$
@@ -194,14 +193,14 @@ public class ProcessPrompter implements IStatusHandler {
Object[] results = dialog.getResult();
if (results != null) {
IProcessExtendedInfo[] processes = new IProcessExtendedInfo[results.length];
- for (int i=0; i<processes.length; i++) {
- processes[i] = (IProcessExtendedInfo)results[i];
+ for (int i = 0; i < processes.length; i++) {
+ processes[i] = (IProcessExtendedInfo) results[i];
}
return processes;
}
}
}
-
+
return null;
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/ProcessPrompterDialog.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/ProcessPrompterDialog.java
index a11e22f424f..7cfeabb43ff 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/ProcessPrompterDialog.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/ProcessPrompterDialog.java
@@ -50,14 +50,13 @@ public class ProcessPrompterDialog extends TwoPaneElementSelector {
private final ILabelProvider elementRenderer;
- public ProcessPrompterDialog(Shell parent, ILabelProvider elementRenderer,
- ILabelProvider qualifierRenderer) {
+ public ProcessPrompterDialog(Shell parent, ILabelProvider elementRenderer, ILabelProvider qualifierRenderer) {
super(parent, elementRenderer, qualifierRenderer);
this.elementRenderer = elementRenderer;
setDialogBoundsSettings(getDialogBoundsSettings(), Dialog.DIALOG_PERSISTSIZE);
setFilter(getFilterFromDialogSetting());
}
-
+
@Override
protected FilteredList createFilteredList(Composite parent) {
FilteredList list = super.createFilteredList(parent);
@@ -72,16 +71,16 @@ public class ProcessPrompterDialog extends TwoPaneElementSelector {
pattern = ""; //$NON-NLS-1$
}
- if (! pattern.startsWith("*")) { //$NON-NLS-1$
+ if (!pattern.startsWith("*")) { //$NON-NLS-1$
pattern = "*" + pattern; //$NON-NLS-1$
}
int rules = SearchPattern.RULE_BLANK_MATCH | SearchPattern.RULE_PREFIX_MATCH;
- if (! ignoreCase) {
+ if (!ignoreCase) {
rules |= SearchPattern.RULE_CASE_SENSITIVE;
}
- if (! ignoreWildCards) {
+ if (!ignoreWildCards) {
rules |= SearchPattern.RULE_PATTERN_MATCH;
}
matcher = new SearchPattern(rules);
@@ -100,59 +99,59 @@ public class ProcessPrompterDialog extends TwoPaneElementSelector {
/*
* The result should be every selected element.
*/
- @Override
- protected void computeResult() {
- setResult(Arrays.asList(getSelectedElements()));
- }
-
- /*
- * Disable the ability to select items in the bottom pane.
- */
- @Override
- protected Table createLowerList(Composite parent) {
- final Table list = super.createLowerList(parent);
-
- // First remove listeners such as the double click.
- // We don't want the user to trigger the action by
- // double-clicking on the bottom pane.
- int[] events = { SWT.Selection, SWT.MouseDoubleClick };
- for (int event : events) {
- Listener[] selectionListeners = list.getListeners(event);
- for (Listener listener : selectionListeners) {
- list.removeListener(event, listener);
- }
- }
-
- // Now add a listener to prevent selection
- list.addListener(SWT.EraseItem, new Listener() {
- @Override
- public void handleEvent(Event event) {
- if ((event.detail & SWT.SELECTED) != 0) {
- event.detail &= ~SWT.SELECTED;
- // Removing the SELECTED event did not work properly.
- // The foreground text became invisible.
- // Let's simply deselect everything
- list.deselectAll();
- }
- }
- });
- return list;
- }
-
- /*
- * Allow a double-click to work without any selection
- * in the bottom list.
- */
- @Override
+ @Override
+ protected void computeResult() {
+ setResult(Arrays.asList(getSelectedElements()));
+ }
+
+ /*
+ * Disable the ability to select items in the bottom pane.
+ */
+ @Override
+ protected Table createLowerList(Composite parent) {
+ final Table list = super.createLowerList(parent);
+
+ // First remove listeners such as the double click.
+ // We don't want the user to trigger the action by
+ // double-clicking on the bottom pane.
+ int[] events = { SWT.Selection, SWT.MouseDoubleClick };
+ for (int event : events) {
+ Listener[] selectionListeners = list.getListeners(event);
+ for (Listener listener : selectionListeners) {
+ list.removeListener(event, listener);
+ }
+ }
+
+ // Now add a listener to prevent selection
+ list.addListener(SWT.EraseItem, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ if ((event.detail & SWT.SELECTED) != 0) {
+ event.detail &= ~SWT.SELECTED;
+ // Removing the SELECTED event did not work properly.
+ // The foreground text became invisible.
+ // Let's simply deselect everything
+ list.deselectAll();
+ }
+ }
+ });
+ return list;
+ }
+
+ /*
+ * Allow a double-click to work without any selection
+ * in the bottom list.
+ */
+ @Override
protected void handleDefaultSelected() {
- if (validateCurrentSelection()) {
+ if (validateCurrentSelection()) {
buttonPressed(IDialogConstants.OK_ID);
}
- }
-
+ }
+
/**
* Validate only upper selected elements. Lower list is always disabled.
- *
+ *
* @see #createLowerList(Composite)
*/
@Override
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/RemoteApplicationCDebuggerTab.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/RemoteApplicationCDebuggerTab.java
index d929a541351..f8eef0aa0b1 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/RemoteApplicationCDebuggerTab.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/RemoteApplicationCDebuggerTab.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -20,7 +20,7 @@ import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
/**
* Debugger tab to use for a remote application launch configuration.
- *
+ *
* @since 2.0
*/
public class RemoteApplicationCDebuggerTab extends CDebuggerTab {
@@ -38,30 +38,30 @@ public class RemoteApplicationCDebuggerTab extends CDebuggerTab {
* Bug 281970
*/
private final static String DEFAULTS_SET = "org.eclipse.cdt.dsf.gdb.internal.ui.launching.RemoteApplicationCDebuggerTab.DEFAULTS_SET"; //$NON-NLS-1$
-
- public RemoteApplicationCDebuggerTab() {
- super(SessionType.REMOTE, false);
- }
-
- @Override
- public void setDefaults(ILaunchConfigurationWorkingCopy config) {
+
+ public RemoteApplicationCDebuggerTab() {
+ super(SessionType.REMOTE, false);
+ }
+
+ @Override
+ public void setDefaults(ILaunchConfigurationWorkingCopy config) {
config.setAttribute(DEFAULTS_SET, true);
-
- super.setDefaults(config);
- }
-
- @Override
- public void initializeFrom(ILaunchConfiguration config) {
- try {
- if (config.hasAttribute(DEFAULTS_SET) == false) {
- ILaunchConfigurationWorkingCopy wc;
- wc = config.getWorkingCopy();
- setDefaults(wc);
- wc.doSave();
- }
- } catch (CoreException e) {
- }
+
+ super.setDefaults(config);
+ }
+
+ @Override
+ public void initializeFrom(ILaunchConfiguration config) {
+ try {
+ if (config.hasAttribute(DEFAULTS_SET) == false) {
+ ILaunchConfigurationWorkingCopy wc;
+ wc = config.getWorkingCopy();
+ setDefaults(wc);
+ wc.doSave();
+ }
+ } catch (CoreException e) {
+ }
super.initializeFrom(config);
- }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/SerialPortSettingsBlock.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/SerialPortSettingsBlock.java
index 2ea8e8b34fe..d6872e5562e 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/SerialPortSettingsBlock.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/SerialPortSettingsBlock.java
@@ -46,11 +46,10 @@ public class SerialPortSettingsBlock extends Observable {
private ComboDialogField fSpeedField;
- private String fSpeedChoices[] = {
- "9600", "19200", "38400", "57600", "115200", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- "230400", "460800", "921600", "1000000", "1152000", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- "1500000", "2000000", "2500000", "3000000", "3500000", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- "4000000" //$NON-NLS-1$
+ private String fSpeedChoices[] = { "9600", "19200", "38400", "57600", "115200", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ "230400", "460800", "921600", "1000000", "1152000", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ "1500000", "2000000", "2500000", "3000000", "3500000", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ "4000000" //$NON-NLS-1$
};
private Control fControl;
@@ -65,15 +64,15 @@ public class SerialPortSettingsBlock extends Observable {
public void createBlock(Composite parent) {
fShell = parent.getShell();
Composite comp = ControlFactory.createCompositeEx(parent, 2, GridData.FILL_BOTH);
- ((GridLayout)comp.getLayout()).makeColumnsEqualWidth = false;
- ((GridLayout)comp.getLayout()).marginHeight = 0;
- ((GridLayout)comp.getLayout()).marginWidth = 0;
+ ((GridLayout) comp.getLayout()).makeColumnsEqualWidth = false;
+ ((GridLayout) comp.getLayout()).marginHeight = 0;
+ ((GridLayout) comp.getLayout()).marginWidth = 0;
comp.setFont(parent.getFont());
PixelConverter converter = new PixelConverter(comp);
fDeviceField.doFillIntoGrid(comp, 2);
LayoutUtil.setWidthHint(fDeviceField.getTextControl(null), converter.convertWidthInCharsToPixels(20));
fSpeedField.doFillIntoGrid(comp, 2);
- ((GridData)fSpeedField.getComboControl(null).getLayoutData()).horizontalAlignment = GridData.BEGINNING;
+ ((GridData) fSpeedField.getComboControl(null).getLayoutData()).horizontalAlignment = GridData.BEGINNING;
setControl(comp);
}
@@ -146,9 +145,9 @@ public class SerialPortSettingsBlock extends Observable {
private void initializeDevice(ILaunchConfiguration configuration) {
if (fDeviceField != null) {
try {
- fDeviceField.setText(configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEV, DEFAULT_ASYNC_DEVICE));
- }
- catch(CoreException e) {
+ fDeviceField.setText(
+ configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEV, DEFAULT_ASYNC_DEVICE));
+ } catch (CoreException e) {
}
}
}
@@ -157,9 +156,9 @@ public class SerialPortSettingsBlock extends Observable {
if (fSpeedField != null) {
int index = 0;
try {
- index = getSpeedItemIndex(configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEV_SPEED, DEFAULT_ASYNC_DEVICE_SPEED));
- }
- catch(CoreException e) {
+ index = getSpeedItemIndex(configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEV_SPEED,
+ DEFAULT_ASYNC_DEVICE_SPEED));
+ } catch (CoreException e) {
}
fSpeedField.selectItem(index);
}
@@ -170,7 +169,7 @@ public class SerialPortSettingsBlock extends Observable {
}
private int getSpeedItemIndex(String item) {
- for(int i = 0; i < fSpeedChoices.length; ++i)
+ for (int i = 0; i < fSpeedChoices.length; ++i)
if (fSpeedChoices[i].equals(item))
return i;
return 0;
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/SolibSearchPathBlock.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/SolibSearchPathBlock.java
index cf3f66e80da..965e4f943d7 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/SolibSearchPathBlock.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/SolibSearchPathBlock.java
@@ -84,13 +84,13 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu
class AddDirectoryDialog extends Dialog {
protected Text fText;
-
+
private Button fBrowseButton;
private IPath fValue;
- /**
- * Constructor for AddDirectoryDialog.
+ /**
+ * Constructor for AddDirectoryDialog.
*/
public AddDirectoryDialog(Shell parentShell) {
super(parentShell);
@@ -98,11 +98,12 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu
@Override
protected Control createDialogArea(Composite parent) {
- Composite composite = (Composite)super.createDialogArea(parent);
+ Composite composite = (Composite) super.createDialogArea(parent);
Composite subComp = ControlFactory.createCompositeEx(composite, 2, GridData.FILL_HORIZONTAL);
- ((GridLayout)subComp.getLayout()).makeColumnsEqualWidth = false;
- GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
+ ((GridLayout) subComp.getLayout()).makeColumnsEqualWidth = false;
+ GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL
+ | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
subComp.setLayoutData(data);
subComp.setFont(parent.getFont());
@@ -117,7 +118,8 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu
}
});
- fBrowseButton = ControlFactory.createPushButton(subComp, LaunchUIMessages.getString("GDBServerDebuggerPage.7")); //$NON-NLS-1$
+ fBrowseButton = ControlFactory.createPushButton(subComp,
+ LaunchUIMessages.getString("GDBServerDebuggerPage.7")); //$NON-NLS-1$
data = new GridData();
data.horizontalAlignment = GridData.FILL;
fBrowseButton.setLayoutData(data);
@@ -156,8 +158,7 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu
protected void buttonPressed(int buttonId) {
if (buttonId == IDialogConstants.OK_ID) {
setValue(fText.getText());
- }
- else {
+ } else {
setValue(null);
}
super.buttonPressed(buttonId);
@@ -211,14 +212,13 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu
}
}
- private static String[] fgStaticButtonLabels = new String[] {
- LaunchUIMessages.getString("SolibSearchPathBlock.0"), //$NON-NLS-1$
+ private static String[] fgStaticButtonLabels = new String[] { LaunchUIMessages.getString("SolibSearchPathBlock.0"), //$NON-NLS-1$
LaunchUIMessages.getString("SolibSearchPathBlock.1"), //$NON-NLS-1$
LaunchUIMessages.getString("SolibSearchPathBlock.2"), //$NON-NLS-1$
LaunchUIMessages.getString("SolibSearchPathBlock.3"), //$NON-NLS-1$
LaunchUIMessages.getString("SolibSearchPathBlock.6"), //$NON-NLS-1$
null, // separator
- };
+ };
private IProject fProject;
@@ -229,7 +229,7 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu
private IListAdapter fCustomListAdapter;
private File[] fAutoSolibs = new File[0];
-
+
public SolibSearchPathBlock() {
this(new String[0], null);
}
@@ -251,6 +251,7 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu
public void customButtonPressed(DialogField field, int index) {
buttonPressed(index);
}
+
@Override
public void selectionChanged(DialogField field) {
}
@@ -259,7 +260,7 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu
@Override
public String getText(Object element) {
if (element instanceof IPath)
- return ((IPath)element).toOSString();
+ return ((IPath) element).toOSString();
return super.getText(element);
}
};
@@ -268,20 +269,20 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu
fDirList.setUpButtonIndex(1);
fDirList.setDownButtonIndex(2);
fDirList.setRemoveButtonIndex(3);
-
+
fDirList.setDialogFieldListener(this);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#createControl(org.eclipse.swt.widgets.Composite)
*/
- @Override
+ @Override
public void createControl(Composite parent) {
fShell = parent.getShell();
Composite comp = ControlFactory.createCompositeEx(parent, 2, GridData.FILL_BOTH);
- ((GridLayout)comp.getLayout()).makeColumnsEqualWidth = false;
- ((GridLayout)comp.getLayout()).marginHeight = 0;
- ((GridLayout)comp.getLayout()).marginWidth = 0;
+ ((GridLayout) comp.getLayout()).makeColumnsEqualWidth = false;
+ ((GridLayout) comp.getLayout()).marginHeight = 0;
+ ((GridLayout) comp.getLayout()).marginWidth = 0;
comp.setFont(parent.getFont());
PixelConverter converter = new PixelConverter(comp);
fDirList.doFillIntoGrid(comp, 3);
@@ -294,52 +295,51 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
*/
- @Override
+ @Override
public void initializeFrom(ILaunchConfiguration configuration) {
IProject project = null;
try {
- String projectName = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String)null);
+ String projectName = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME,
+ (String) null);
if (projectName != null) {
projectName = projectName.trim();
if (!projectName.isEmpty()) {
project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
}
}
- }
- catch(CoreException e) {
+ } catch (CoreException e) {
}
setProject(project);
if (fDirList != null) {
try {
@SuppressWarnings("unchecked")
- List<String> values = configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_SOLIB_PATH,
- Collections.EMPTY_LIST);
+ List<String> values = configuration.getAttribute(
+ IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_SOLIB_PATH, Collections.EMPTY_LIST);
ArrayList<Path> paths = new ArrayList<Path>(values.size());
Iterator<String> it = values.iterator();
- while(it.hasNext()) {
+ while (it.hasNext()) {
paths.add(new Path(it.next()));
}
fDirList.addElements(paths);
- }
- catch(CoreException e) {
+ } catch (CoreException e) {
}
}
try {
fAutoSolibs = getAutoSolibs(configuration);
- }
- catch(CoreException e) {
+ } catch (CoreException e) {
}
}
public static File[] getAutoSolibs(ILaunchConfiguration configuration) throws CoreException {
@SuppressWarnings("unchecked")
- List<String> autoSolibs = configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB_LIST, Collections.EMPTY_LIST );
+ List<String> autoSolibs = configuration
+ .getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB_LIST, Collections.EMPTY_LIST);
List<File> list = new ArrayList<File>(autoSolibs.size());
Iterator<String> it = autoSolibs.iterator();
- while(it.hasNext()) {
+ while (it.hasNext()) {
list.add(new File(it.next()));
}
return list.toArray(new File[list.size()]);
@@ -348,7 +348,7 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
*/
- @Override
+ @Override
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_SOLIB_PATH, Collections.EMPTY_LIST);
}
@@ -356,16 +356,16 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
*/
- @Override
+ @Override
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
if (fDirList != null) {
-
+
@SuppressWarnings("unchecked")
List<IPath> elements = fDirList.getElements();
-
+
ArrayList<String> values = new ArrayList<String>(elements.size());
Iterator<IPath> it = elements.iterator();
- while(it.hasNext()) {
+ while (it.hasNext()) {
values.add((it.next()).toOSString());
}
configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_SOLIB_PATH, values);
@@ -373,18 +373,16 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu
ArrayList<String> autoLibs = new ArrayList<String>(fAutoSolibs.length);
for (int i = 0; i < fAutoSolibs.length; ++i)
autoLibs.add(fAutoSolibs[i].getPath());
- configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB_LIST, autoLibs);
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB_LIST, autoLibs);
}
protected void buttonPressed(int index) {
- boolean changed = false;
+ boolean changed = false;
if (index == 0) { // Add button
changed = addDirectory();
- }
- else if (index == 4) { //Select from list
+ } else if (index == 4) { //Select from list
changed = selectFromList();
- }
- else if (index >= fgStaticButtonLabels.length && fCustomListAdapter != null) {
+ } else if (index >= fgStaticButtonLabels.length && fCustomListAdapter != null) {
fCustomListAdapter.customButtonPressed(fDirList, index);
changed = true;
}
@@ -412,7 +410,7 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu
IPath result = dialog.getValue();
if (result != null && !contains(result)) {
fDirList.addElement(result);
- changed = true;
+ changed = true;
}
return changed;
}
@@ -420,7 +418,7 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#dispose()
*/
- @Override
+ @Override
public void dispose() {
deleteObservers();
}
@@ -428,7 +426,7 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#getControl()
*/
- @Override
+ @Override
public Control getControl() {
return fControl;
}
@@ -436,7 +434,7 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#isValid(org.eclipse.debug.core.ILaunchConfiguration)
*/
- @Override
+ @Override
public boolean isValid(ILaunchConfiguration launchConfig) {
// TODO Auto-generated method stub
return false;
@@ -445,9 +443,9 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu
private boolean contains(IPath path) {
@SuppressWarnings("unchecked")
List<IPath> list = fDirList.getElements();
-
+
Iterator<IPath> it = list.iterator();
- while(it.hasNext()) {
+ while (it.hasNext()) {
IPath p = it.next();
if (p.toFile().equals(path.toFile()))
return true;
@@ -465,48 +463,53 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu
protected boolean selectFromList() {
boolean changed = false;
-
+
@SuppressWarnings("unchecked")
List<IPath> dirList = fDirList.getSelectedElements();
-
+
final HashSet<IPath> libs = new HashSet<IPath>(10);
if (generateLibraryList(dirList.toArray(new IPath[dirList.size()]), libs)) {
ITreeContentProvider cp = new ITreeContentProvider() {
- @Override
+ @Override
public Object[] getChildren(Object parentElement) {
return getElements(parentElement);
}
- @Override
+
+ @Override
public Object getParent(Object element) {
if (libs.contains(element))
return libs;
return null;
}
- @Override
+
+ @Override
public boolean hasChildren(Object element) {
return false;
}
- @Override
+
+ @Override
public Object[] getElements(Object inputElement) {
if (inputElement instanceof Set) {
- return ((Set)inputElement).toArray();
+ return ((Set) inputElement).toArray();
}
return new Object[0];
}
- @Override
+
+ @Override
public void dispose() {
}
- @Override
+
+ @Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
+ }
};
-
+
LabelProvider lp = new LabelProvider() {
-
+
@Override
public String getText(Object element) {
if (element instanceof File)
- return ((File)element).getName();
+ return ((File) element).getName();
return super.getText(element);
}
};
@@ -530,7 +533,7 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu
boolean result = true;
IRunnableWithProgress runnable = new IRunnableWithProgress() {
- @Override
+ @Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
for (int i = 0; i < paths.length; ++i) {
@@ -551,13 +554,11 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu
}
}
};
- try {
- IRunnableContext context = new ProgressMonitorDialog(getShell());
+ try {
+ IRunnableContext context = new ProgressMonitorDialog(getShell());
context.run(true, true, runnable);
- }
- catch(InvocationTargetException e) {
- }
- catch(InterruptedException e) {
+ } catch (InvocationTargetException e) {
+ } catch (InterruptedException e) {
result = false;
}
return result;
@@ -570,21 +571,20 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu
if (project != null) {
IPath fullPath = new Path(file.getPath());
try {
- ICConfigExtensionReference[] binaryParsersExt = CCorePlugin.getDefault().getDefaultBinaryParserExtensions(project);
- for(int i = 0; i < binaryParsersExt.length; i++) {
+ ICConfigExtensionReference[] binaryParsersExt = CCorePlugin.getDefault()
+ .getDefaultBinaryParserExtensions(project);
+ for (int i = 0; i < binaryParsersExt.length; i++) {
IBinaryParser parser = CoreModelUtil.getBinaryParser(binaryParsersExt[i]);
try {
IBinaryFile bin = parser.getBinary(fullPath);
if (bin instanceof IBinaryShared) {
- String soname = ((IBinaryShared)bin).getSoName();
+ String soname = ((IBinaryShared) bin).getSoName();
return (soname.length() != 0) ? soname : file.getName();
}
- }
- catch(IOException e) {
+ } catch (IOException e) {
}
}
- }
- catch(CoreException e) {
+ } catch (CoreException e) {
}
return null;
}
@@ -604,18 +604,17 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu
if (project != null) {
IPath fullPath = new Path(file.getPath());
try {
- ICConfigExtensionReference[] binaryParsersExt = CCorePlugin.getDefault().getDefaultBinaryParserExtensions(project);
- for(int i = 0; i < binaryParsersExt.length; i++) {
+ ICConfigExtensionReference[] binaryParsersExt = CCorePlugin.getDefault()
+ .getDefaultBinaryParserExtensions(project);
+ for (int i = 0; i < binaryParsersExt.length; i++) {
IBinaryParser parser = CoreModelUtil.getBinaryParser(binaryParsersExt[i]);
try {
IBinaryFile bin = parser.getBinary(fullPath);
return (bin instanceof IBinaryShared);
- }
- catch(IOException e) {
+ } catch (IOException e) {
}
}
- }
- catch(CoreException e) {
+ } catch (CoreException e) {
}
return false;
}
@@ -628,7 +627,7 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu
return (name.indexOf(".so.") >= 0); //$NON-NLS-1$
}
- @Override
+ @Override
public void dialogFieldChanged(DialogField field) {
setChanged();
notifyObservers();
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/TCPSettingsBlock.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/TCPSettingsBlock.java
index 4b04774ff22..5bf5d2ac9ff 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/TCPSettingsBlock.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/TCPSettingsBlock.java
@@ -57,15 +57,15 @@ public class TCPSettingsBlock extends Observable {
public void createBlock(Composite parent) {
fShell = parent.getShell();
Composite comp = ControlFactory.createCompositeEx(parent, 2, GridData.FILL_BOTH);
- ((GridLayout)comp.getLayout()).makeColumnsEqualWidth = false;
- ((GridLayout)comp.getLayout()).marginHeight = 0;
- ((GridLayout)comp.getLayout()).marginWidth = 0;
+ ((GridLayout) comp.getLayout()).makeColumnsEqualWidth = false;
+ ((GridLayout) comp.getLayout()).marginHeight = 0;
+ ((GridLayout) comp.getLayout()).marginWidth = 0;
comp.setFont(parent.getFont());
PixelConverter converter = new PixelConverter(comp);
fHostNameField.doFillIntoGrid(comp, 2);
LayoutUtil.setWidthHint(fHostNameField.getTextControl(null), converter.convertWidthInCharsToPixels(20));
fPortNumberField.doFillIntoGrid(comp, 2);
- ((GridData)fPortNumberField.getTextControl(null).getLayoutData()).horizontalAlignment = GridData.BEGINNING;
+ ((GridData) fPortNumberField.getTextControl(null).getLayoutData()).horizontalAlignment = GridData.BEGINNING;
LayoutUtil.setWidthHint(fPortNumberField.getTextControl(null), converter.convertWidthInCharsToPixels(10));
setControl(comp);
}
@@ -136,9 +136,9 @@ public class TCPSettingsBlock extends Observable {
private void initializeHostName(ILaunchConfiguration configuration) {
if (fHostNameField != null) {
try {
- fHostNameField.setText(configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_HOST, DEFAULT_HOST_NAME));
- }
- catch(CoreException e) {
+ fHostNameField.setText(
+ configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_HOST, DEFAULT_HOST_NAME));
+ } catch (CoreException e) {
}
}
}
@@ -146,9 +146,9 @@ public class TCPSettingsBlock extends Observable {
private void initializePortNumber(ILaunchConfiguration configuration) {
if (fPortNumberField != null) {
try {
- fPortNumberField.setText(configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_PORT, DEFAULT_PORT_NUMBER));
- }
- catch(CoreException e) {
+ fPortNumberField.setText(
+ configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_PORT, DEFAULT_PORT_NUMBER));
+ } catch (CoreException e) {
}
}
}
@@ -196,8 +196,7 @@ public class TCPSettingsBlock extends Observable {
try {
int port = Integer.parseInt(portNumber);
return (port > 0 && port <= 0xFFFF);
- }
- catch(NumberFormatException e) {
+ } catch (NumberFormatException e) {
return false;
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/WorkingDirectoryBlock.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/WorkingDirectoryBlock.java
index e981c4d25da..3910400655a 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/WorkingDirectoryBlock.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/WorkingDirectoryBlock.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Ericsson - Updated for DSF
@@ -48,7 +48,6 @@ import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.dialogs.ContainerSelectionDialog;
-
/**
* A control for setting the working directory associated with a launch
* configuration.
@@ -74,7 +73,7 @@ public class WorkingDirectoryBlock extends CLaunchConfigurationTab {
*/
private class WidgetListener extends SelectionAdapter implements ModifyListener {
- @Override
+ @Override
public void modifyText(ModifyEvent e) {
updateLaunchConfigurationDialog();
}
@@ -98,14 +97,14 @@ public class WorkingDirectoryBlock extends CLaunchConfigurationTab {
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
*/
- @Override
+ @Override
public void createControl(Composite parent) {
Font font = parent.getFont();
- Group group = new Group(parent, SWT.NONE);
+ Group group = new Group(parent, SWT.NONE);
// WorkbenchHelp.setHelp(group,
// IJavaDebugHelpContextIds.WORKING_DIRECTORY_BLOCK);
GridLayout workingDirLayout = new GridLayout();
@@ -116,17 +115,15 @@ public class WorkingDirectoryBlock extends CLaunchConfigurationTab {
group.setFont(font);
setControl(group);
- group.setText(LaunchUIMessages.getString("WorkingDirectoryBlock.Working_directory")); //$NON-NLS-1$
-
- fWorkingDirText = new Text(group, SWT.SINGLE | SWT.BORDER);
- fWorkingDirText.getAccessible().addAccessibleListener(
- new AccessibleAdapter() {
- @Override
- public void getName(AccessibleEvent e) {
- e.result = LaunchUIMessages.getString("WorkingDirectoryBlock.Working_directory"); //$NON-NLS-1$
- }
- }
- );
+ group.setText(LaunchUIMessages.getString("WorkingDirectoryBlock.Working_directory")); //$NON-NLS-1$
+
+ fWorkingDirText = new Text(group, SWT.SINGLE | SWT.BORDER);
+ fWorkingDirText.getAccessible().addAccessibleListener(new AccessibleAdapter() {
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = LaunchUIMessages.getString("WorkingDirectoryBlock.Working_directory"); //$NON-NLS-1$
+ }
+ });
gd = new GridData(GridData.FILL_HORIZONTAL);
fWorkingDirText.setLayoutData(gd);
fWorkingDirText.setFont(font);
@@ -159,7 +156,7 @@ public class WorkingDirectoryBlock extends CLaunchConfigurationTab {
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#dispose()
*/
@Override
@@ -191,13 +188,13 @@ public class WorkingDirectoryBlock extends CLaunchConfigurationTab {
* workspace
*/
protected void handleWorkspaceDirBrowseButtonSelected() {
- ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), ResourcesPlugin.getWorkspace().getRoot(), false,
- LaunchUIMessages.getString("WorkingDirectoryBlock.4")); //$NON-NLS-1$
+ ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(),
+ ResourcesPlugin.getWorkspace().getRoot(), false, LaunchUIMessages.getString("WorkingDirectoryBlock.4")); //$NON-NLS-1$
IContainer currentContainer = getContainer();
if (currentContainer != null) {
IPath path = currentContainer.getFullPath();
- dialog.setInitialSelections(new Object[] { path});
+ dialog.setInitialSelections(new Object[] { path });
}
dialog.showClosedProjects(false);
@@ -272,7 +269,7 @@ public class WorkingDirectoryBlock extends CLaunchConfigurationTab {
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#isValid(org.eclipse.debug.core.ILaunchConfiguration)
*/
@Override
@@ -307,10 +304,10 @@ public class WorkingDirectoryBlock extends CLaunchConfigurationTab {
/**
* Defaults are empty.
- *
+ *
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
*/
- @Override
+ @Override
public void setDefaults(ILaunchConfigurationWorkingCopy config) {
// config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY,
// (String)null);
@@ -318,14 +315,15 @@ public class WorkingDirectoryBlock extends CLaunchConfigurationTab {
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
*/
- @Override
+ @Override
public void initializeFrom(ILaunchConfiguration configuration) {
setLaunchConfiguration(configuration);
try {
- String wd = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, (String) null);
+ String wd = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY,
+ (String) null);
fWorkingDirText.setText(""); //$NON-NLS-1$
if (wd == null) {
fUseDefaultWorkingDirButton.setSelection(true);
@@ -335,17 +333,19 @@ public class WorkingDirectoryBlock extends CLaunchConfigurationTab {
}
handleUseDefaultWorkingDirButtonSelected();
} catch (CoreException e) {
- setErrorMessage(LaunchUIMessages.getString("WorkingDirectoryBlock.Exception_occurred_reading_configuration___15") + e.getStatus().getMessage()); //$NON-NLS-1$
+ setErrorMessage(
+ LaunchUIMessages.getString("WorkingDirectoryBlock.Exception_occurred_reading_configuration___15") //$NON-NLS-1$
+ + e.getStatus().getMessage());
GdbUIPlugin.log(e);
}
}
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
*/
- @Override
+ @Override
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
String wd = null;
if (!isDefaultWorkingDirectory()) {
@@ -356,7 +356,7 @@ public class WorkingDirectoryBlock extends CLaunchConfigurationTab {
/**
* Retuns the string in the text widget, or <code>null</code> if empty.
- *
+ *
* @return text or <code>null</code>
*/
protected String getAttributeValueFrom(Text text) {
@@ -369,10 +369,10 @@ public class WorkingDirectoryBlock extends CLaunchConfigurationTab {
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
*/
- @Override
+ @Override
public String getName() {
return LaunchUIMessages.getString("WorkingDirectoryBlock.Working_Directory_8"); //$NON-NLS-1$
}
@@ -400,4 +400,3 @@ public class WorkingDirectoryBlock extends CLaunchConfigurationTab {
}
}
-
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/memory/GdbMemoryBlockAddressInfoRetrieval.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/memory/GdbMemoryBlockAddressInfoRetrieval.java
index e806ee48dc5..bfd23622594 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/memory/GdbMemoryBlockAddressInfoRetrieval.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/memory/GdbMemoryBlockAddressInfoRetrieval.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
@@ -37,137 +37,139 @@ import org.eclipse.debug.core.model.IMemoryBlock;
public class GdbMemoryBlockAddressInfoRetrieval implements IMemoryBlockAddressInfoRetrieval {
- private final DsfSession fSession;
- private final Set<IAddressInfoUpdateListener> fListeners = new HashSet<>();
-
- public GdbMemoryBlockAddressInfoRetrieval(DsfSession session) {
- fSession = session;
- fSession.getExecutor().execute(new DsfRunnable() {
- @Override
- public void run() {
- fSession.addServiceEventListener(GdbMemoryBlockAddressInfoRetrieval.this, null);
- }
- });
- }
-
- protected IGdbMemoryAddressInfoTypeRetrieval[] resolveMemoryAddressInfoProviders() {
- return new IGdbMemoryAddressInfoTypeRetrieval[] {new GdbMemoryAddressInfoVariablesRetrieval(fSession), new GdbMemoryAddressInfoRegistersRetrieval(fSession)};
- }
-
- @Override
- public void getMemoryBlockAddressInfo(Object selection, final IMemoryBlock memBlock,
- final IGetMemoryBlockAddressInfoReq request) {
- IDMContext memBlockContext = null;
- if (memBlock instanceof DsfMemoryBlock) {
- memBlockContext = ((DsfMemoryBlock) memBlock).getContext();
-
- if (selection instanceof IDMVMContext) {
- IDMContext context = ((IDMVMContext) selection).getDMContext();
- final IFrameDMContext frameCtx = DMContexts.getAncestorOfType(context, IFrameDMContext.class);
- if (frameCtx != null) {
- // Resolve container context of selection
- IContainerDMContext selectedContainerCtx = DMContexts.getAncestorOfType(frameCtx,
- IContainerDMContext.class);
-
- // Resolve container context of memory block
- IContainerDMContext memoryContainerCtx = DMContexts.getAncestorOfType(memBlockContext,
- IContainerDMContext.class);
-
- // Continue if the selected container matches the container for the memory context
- if (memoryContainerCtx != null && memoryContainerCtx.equals(selectedContainerCtx)) {
- fSession.getExecutor().execute(new DsfRunnable() {
- @Override
- public void run() {
- // Resolve the memory address info providers
- IGdbMemoryAddressInfoTypeRetrieval[] infoTypeProviders = resolveMemoryAddressInfoProviders();
- if (infoTypeProviders == null || infoTypeProviders.length == 0) {
- // No providers available
- request.done();
- return;
- }
-
- final CountingRequestMonitor crm = new CountingRequestMonitor(fSession.getExecutor(),
- null) {
- // mark the request done when all available infoTypeProviders have
- // returned its information
- @Override
- protected void handleCompleted() {
- request.done();
- };
- };
-
- for (final IGdbMemoryAddressInfoTypeRetrieval infoProvider : infoTypeProviders) {
- infoProvider.itemsRequest(frameCtx, memBlock,
- new DataRequestMonitor<IMemoryBlockAddressInfoItem[]>(
- fSession.getExecutor(), crm) {
- @Override
- protected void handleCompleted() {
- if (isSuccess()) {
- // Load the information from this provider
- request.setAddressInfoItems(infoProvider.getInfoType(), getData());
- } else {
- request.setStatus(getStatus());
- }
- crm.done();
- }
- });
- }
-
- crm.setDoneCount(infoTypeProviders.length);
- }
-
- });
- } else {
- request.done();
- }
- } else {
- // The selection context does not match the block memory context,
- // Simply close the request
- request.done();
- }
- } else {
- request.done();
- }
- } else {
- request.done();
- }
- }
-
- // The GdbSessionAdapters class will call this method automatically when it cleans up
- public void dispose() {
- fListeners.clear();
- }
-
- @Override
- public void addAddressInfoUpdateListener(IAddressInfoUpdateListener listener) {
- synchronized(fListeners) {
- fListeners.add(listener);
- }
- }
-
- @Override
- public void removeAddressInfoUpdateListener(IAddressInfoUpdateListener listener) {
- synchronized(fListeners) {
- fListeners.remove(listener);
- }
- }
-
- @DsfServiceEventHandler
- public void eventDispatched(IRegisterChangedDMEvent e) {
- synchronized(fListeners) {
- for (IAddressInfoUpdateListener listener : fListeners) {
- listener.handleAddressInfoUpdate(EventType.VALUE_CHANGED, null);
- }
- }
-
- }
-
- @DsfServiceEventHandler
- public void eventDispatched(IExpressionChangedDMEvent e) {
- synchronized(fListeners) {
- for (IAddressInfoUpdateListener listener : fListeners) {
- listener.handleAddressInfoUpdate(EventType.VALUE_CHANGED, null);
- }
- }
- }
+ private final DsfSession fSession;
+ private final Set<IAddressInfoUpdateListener> fListeners = new HashSet<>();
+
+ public GdbMemoryBlockAddressInfoRetrieval(DsfSession session) {
+ fSession = session;
+ fSession.getExecutor().execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ fSession.addServiceEventListener(GdbMemoryBlockAddressInfoRetrieval.this, null);
+ }
+ });
+ }
+
+ protected IGdbMemoryAddressInfoTypeRetrieval[] resolveMemoryAddressInfoProviders() {
+ return new IGdbMemoryAddressInfoTypeRetrieval[] { new GdbMemoryAddressInfoVariablesRetrieval(fSession),
+ new GdbMemoryAddressInfoRegistersRetrieval(fSession) };
+ }
+
+ @Override
+ public void getMemoryBlockAddressInfo(Object selection, final IMemoryBlock memBlock,
+ final IGetMemoryBlockAddressInfoReq request) {
+ IDMContext memBlockContext = null;
+ if (memBlock instanceof DsfMemoryBlock) {
+ memBlockContext = ((DsfMemoryBlock) memBlock).getContext();
+
+ if (selection instanceof IDMVMContext) {
+ IDMContext context = ((IDMVMContext) selection).getDMContext();
+ final IFrameDMContext frameCtx = DMContexts.getAncestorOfType(context, IFrameDMContext.class);
+ if (frameCtx != null) {
+ // Resolve container context of selection
+ IContainerDMContext selectedContainerCtx = DMContexts.getAncestorOfType(frameCtx,
+ IContainerDMContext.class);
+
+ // Resolve container context of memory block
+ IContainerDMContext memoryContainerCtx = DMContexts.getAncestorOfType(memBlockContext,
+ IContainerDMContext.class);
+
+ // Continue if the selected container matches the container for the memory context
+ if (memoryContainerCtx != null && memoryContainerCtx.equals(selectedContainerCtx)) {
+ fSession.getExecutor().execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ // Resolve the memory address info providers
+ IGdbMemoryAddressInfoTypeRetrieval[] infoTypeProviders = resolveMemoryAddressInfoProviders();
+ if (infoTypeProviders == null || infoTypeProviders.length == 0) {
+ // No providers available
+ request.done();
+ return;
+ }
+
+ final CountingRequestMonitor crm = new CountingRequestMonitor(fSession.getExecutor(),
+ null) {
+ // mark the request done when all available infoTypeProviders have
+ // returned its information
+ @Override
+ protected void handleCompleted() {
+ request.done();
+ };
+ };
+
+ for (final IGdbMemoryAddressInfoTypeRetrieval infoProvider : infoTypeProviders) {
+ infoProvider.itemsRequest(frameCtx, memBlock,
+ new DataRequestMonitor<IMemoryBlockAddressInfoItem[]>(
+ fSession.getExecutor(), crm) {
+ @Override
+ protected void handleCompleted() {
+ if (isSuccess()) {
+ // Load the information from this provider
+ request.setAddressInfoItems(infoProvider.getInfoType(),
+ getData());
+ } else {
+ request.setStatus(getStatus());
+ }
+ crm.done();
+ }
+ });
+ }
+
+ crm.setDoneCount(infoTypeProviders.length);
+ }
+
+ });
+ } else {
+ request.done();
+ }
+ } else {
+ // The selection context does not match the block memory context,
+ // Simply close the request
+ request.done();
+ }
+ } else {
+ request.done();
+ }
+ } else {
+ request.done();
+ }
+ }
+
+ // The GdbSessionAdapters class will call this method automatically when it cleans up
+ public void dispose() {
+ fListeners.clear();
+ }
+
+ @Override
+ public void addAddressInfoUpdateListener(IAddressInfoUpdateListener listener) {
+ synchronized (fListeners) {
+ fListeners.add(listener);
+ }
+ }
+
+ @Override
+ public void removeAddressInfoUpdateListener(IAddressInfoUpdateListener listener) {
+ synchronized (fListeners) {
+ fListeners.remove(listener);
+ }
+ }
+
+ @DsfServiceEventHandler
+ public void eventDispatched(IRegisterChangedDMEvent e) {
+ synchronized (fListeners) {
+ for (IAddressInfoUpdateListener listener : fListeners) {
+ listener.handleAddressInfoUpdate(EventType.VALUE_CHANGED, null);
+ }
+ }
+
+ }
+
+ @DsfServiceEventHandler
+ public void eventDispatched(IExpressionChangedDMEvent e) {
+ synchronized (fListeners) {
+ for (IAddressInfoUpdateListener listener : fListeners) {
+ listener.handleAddressInfoUpdate(EventType.VALUE_CHANGED, null);
+ }
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/AttachProcessHandler.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/AttachProcessHandler.java
index 404d086a319..a6d78b9f6ba 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/AttachProcessHandler.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/AttachProcessHandler.java
@@ -119,7 +119,7 @@ public class AttachProcessHandler extends AbstractHandler implements IHandler {
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.
* ExecutionEvent)
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/ColumnLayout.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/ColumnLayout.java
index 459ed90b724..097c760b3ac 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/ColumnLayout.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/ColumnLayout.java
@@ -23,8 +23,7 @@ import org.eclipse.jface.dialogs.IDialogSettings;
/* Hold information about which columns in a table are visible, and what
* width they have. Stores that information inside preferences store.
*/
-class ColumnLayout
-{
+class ColumnLayout {
private String fResourceClass;
private Map<String, Boolean> fVisible = new HashMap<String, Boolean>();
private Map<String, Integer> fWidth = new HashMap<String, Integer>();
@@ -32,8 +31,8 @@ class ColumnLayout
private Integer fSortDirection = null;
private static IDialogSettings settings;
- private static IDialogSettings getDialogSettings()
- {
+
+ private static IDialogSettings getDialogSettings() {
if (settings != null)
return settings;
@@ -45,31 +44,26 @@ class ColumnLayout
return settings;
}
- private static void setDefaultSetting(String key, boolean value)
- {
+ private static void setDefaultSetting(String key, boolean value) {
IDialogSettings s = getDialogSettings();
if (s.get(key) == null)
s.put(key, value);
}
- private static void setDefaultSetting(String key, int value)
- {
+ private static void setDefaultSetting(String key, int value) {
IDialogSettings s = getDialogSettings();
if (s.get(key) == null)
s.put(key, value);
}
- public ColumnLayout(String resourceClass)
- {
+ public ColumnLayout(String resourceClass) {
fResourceClass = resourceClass;
}
- public boolean getVisible(String column)
- {
+ public boolean getVisible(String column) {
if (fVisible.containsKey(column))
return fVisible.get(column);
- else
- {
+ else {
setDefaultSetting(columnKey(column, "v"), true); //$NON-NLS-1$
boolean b = getDialogSettings().getBoolean(columnKey(column, "v")); //$NON-NLS-1$
fVisible.put(column, b);
@@ -77,18 +71,15 @@ class ColumnLayout
}
}
- public void setVisible(String column, boolean visible)
- {
+ public void setVisible(String column, boolean visible) {
fVisible.put(column, visible);
getDialogSettings().put(columnKey(column, "v"), visible); //$NON-NLS-1$
}
- public int getWidth(String column)
- {
+ public int getWidth(String column) {
if (fWidth.containsKey(column))
return fWidth.get(column);
- else
- {
+ else {
setDefaultSetting(columnKey(column, "w"), -1); //$NON-NLS-1$
int w = getDialogSettings().getInt(columnKey(column, "w")); //$NON-NLS-1$
fWidth.put(column, w);
@@ -96,51 +87,42 @@ class ColumnLayout
}
}
- public void setWidth(String column, int width)
- {
+ public void setWidth(String column, int width) {
fWidth.put(column, width);
getDialogSettings().put(columnKey(column, "w"), width); //$NON-NLS-1$
}
- public int getSortColumn()
- {
- if (fSortColumn == null)
- {
+ public int getSortColumn() {
+ if (fSortColumn == null) {
setDefaultSetting(globalKey("sortColumn"), 0); //$NON-NLS-1$
- fSortColumn = getDialogSettings().getInt(globalKey("sortColumn")); //$NON-NLS-1$
+ fSortColumn = getDialogSettings().getInt(globalKey("sortColumn")); //$NON-NLS-1$
}
return fSortColumn;
}
- public void setSortColumn(int column)
- {
+ public void setSortColumn(int column) {
fSortColumn = column;
getDialogSettings().put(globalKey("sortColumn"), fSortColumn); //$NON-NLS-1$
}
- public int getSortDirection()
- {
- if (fSortDirection == null)
- {
+ public int getSortDirection() {
+ if (fSortDirection == null) {
setDefaultSetting(globalKey("sortDirection"), 1); //$NON-NLS-1$
fSortDirection = getDialogSettings().getInt(globalKey("sortDirection")); //$NON-NLS-1$
}
return fSortDirection;
}
- public void setSortDirection(int direction)
- {
+ public void setSortDirection(int direction) {
fSortDirection = direction;
getDialogSettings().put(globalKey("sortDirection"), fSortDirection); //$NON-NLS-1$
}
- private String columnKey(String column, String what)
- {
+ private String columnKey(String column, String what) {
return "columnLayout." + fResourceClass + "." + column + "." + what; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- private String globalKey(String what)
- {
+ private String globalKey(String what) {
return "columnLayout." + fResourceClass + "." + what; //$NON-NLS-1$ //$NON-NLS-2$
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/ContentLabelProviderWrapper.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/ContentLabelProviderWrapper.java
index 6ee3577af03..289fae64221 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/ContentLabelProviderWrapper.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/ContentLabelProviderWrapper.java
@@ -30,25 +30,21 @@ import org.eclipse.swt.graphics.Image;
*
* This class is wrapping our real content provider, and can be retargeted in one call -- after which
* refresh of TreeViewer sees consistent data.
- *
+ *
* @since 2.4
* */
public class ContentLabelProviderWrapper<U extends ITableLabelProvider & IStructuredContentProvider>
-implements ITableLabelProvider, IStructuredContentProvider
-{
+ implements ITableLabelProvider, IStructuredContentProvider {
- public ContentLabelProviderWrapper(U realProvider)
- {
+ public ContentLabelProviderWrapper(U realProvider) {
this.realProvider = realProvider;
}
- public void setData(U realProvider)
- {
+ public void setData(U realProvider) {
this.realProvider = realProvider;
}
- public U getData()
- {
+ public U getData() {
return realProvider;
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/OSData.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/OSData.java
index 0993de21581..4ab8142f4b6 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/OSData.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/OSData.java
@@ -29,10 +29,7 @@ import org.eclipse.swt.graphics.Image;
* of specific class. Constructed from MI output. Once constructed,
* this class is immutable.
*/
-class OSData
-extends LabelProvider
-implements ITableLabelProvider, IStructuredContentProvider
-{
+class OSData extends LabelProvider implements ITableLabelProvider, IStructuredContentProvider {
private IResourcesInformation data;
private boolean[] columnIsInteger;
private List<Integer> remap;
@@ -45,19 +42,18 @@ implements ITableLabelProvider, IStructuredContentProvider
for (int i = 0; i < data.getColumnNames().length; ++i)
remap.add(i);
- if (resourceClass.equals("processes")) //$NON-NLS-1$
- sendToEnd("Command"); //$NON-NLS-1$
+ if (resourceClass.equals("processes")) //$NON-NLS-1$
+ sendToEnd("Command"); //$NON-NLS-1$
- if (resourceClass.equals("threads")) //$NON-NLS-1$
- sendToEnd("Command"); //$NON-NLS-1$
+ if (resourceClass.equals("threads")) //$NON-NLS-1$
+ sendToEnd("Command"); //$NON-NLS-1$
- if (resourceClass.equals("modules")) //$NON-NLS-1$
- sendToEnd("Dependencies"); //$NON-NLS-1$
+ if (resourceClass.equals("modules")) //$NON-NLS-1$
+ sendToEnd("Dependencies"); //$NON-NLS-1$
}
// Determine column types, for the purpose of proper sorting
- private void determineColumnTypes()
- {
+ private void determineColumnTypes() {
String[] columnNames = data.getColumnNames();
String[][] content = data.getContent();
@@ -67,22 +63,19 @@ implements ITableLabelProvider, IStructuredContentProvider
boolean[] columnHasOther = new boolean[columnNames.length];
for (int i = 0; i < content.length; ++i) {
- for (int j = 0; j < content[i].length; ++j) {
- if (!columnHasOther[j])
- {
- try {
- Integer.parseInt(content[i][j]);
- columnHasInteger[j] = true;
- }
- catch(NumberFormatException e) {
- columnHasOther[j] = true;
- }
- catch(Throwable e) {
- e.printStackTrace();
- }
+ for (int j = 0; j < content[i].length; ++j) {
+ if (!columnHasOther[j]) {
+ try {
+ Integer.parseInt(content[i][j]);
+ columnHasInteger[j] = true;
+ } catch (NumberFormatException e) {
+ columnHasOther[j] = true;
+ } catch (Throwable e) {
+ e.printStackTrace();
}
-
}
+
+ }
}
for (int j = 0; j < data.getColumnNames().length; ++j) {
@@ -91,8 +84,7 @@ implements ITableLabelProvider, IStructuredContentProvider
}
/* Make column named 'column' appear last in UI. */
- private void sendToEnd(String column)
- {
+ private void sendToEnd(String column) {
// Find index in the remap array (which is equal to index in UI)
// at which column named 'column' is found.
int index = -1;
@@ -108,13 +100,11 @@ implements ITableLabelProvider, IStructuredContentProvider
remap.add(remap.remove(index));
}
- public int getColumnCount()
- {
+ public int getColumnCount() {
return remap.size();
}
- public String getColumnName(int i)
- {
+ public String getColumnName(int i) {
return data.getColumnNames()[remap.get(i)];
}
@@ -150,14 +140,15 @@ implements ITableLabelProvider, IStructuredContentProvider
// split into array of resource information for each raw
String[][] content = data.getContent();
IResourcesInformation[] split_ri = new IResourcesInformation[content.length];
- for (int i = 0; i< content.length; ++i) {
+ for (int i = 0; i < content.length; ++i) {
final String[][] row_content = new String[1][content[i].length];
row_content[0] = content[i];
- split_ri[i]=new IResourcesInformation() {
+ split_ri[i] = new IResourcesInformation() {
@Override
public String[] getColumnNames() {
return data.getColumnNames();
}
+
@Override
public String[][] getContent() {
return row_content;
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/OSResourcesView.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/OSResourcesView.java
index 86d5312e6c7..a6d7a98415c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/OSResourcesView.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/OSResourcesView.java
@@ -92,18 +92,17 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
// selected.
private SessionOSData fSessionData;
private Map<String, SessionOSData> fSessionDataCache = new HashMap<String, SessionOSData>();
- // The data presently shown by table viewer.
+ // The data presently shown by table viewer.
private OSData fTableShownData = null;
// The data which was used to populate column selector menu
private OSData fMenuShownData = null;
private String fResourceClass = null;
-
+
// Indicates that we've selected objects from different debug sessions.
boolean fMultiple = false;
// Indicates that we have selected object with a wrong type
boolean fWrongType = false;
-
// UI objects
private TableViewer fViewer;
private Comparator fComparator;
@@ -128,8 +127,7 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
topLayout.marginHeight = 0;
parent.setLayout(topLayout);
- fViewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL
- | SWT.V_SCROLL);
+ fViewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
GridData viewerData = new GridData(GridData.FILL_BOTH);
viewerData.exclude = true;
fViewer.getControl().setLayoutData(viewerData);
@@ -150,9 +148,8 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
fNothingLabel = new Link(fNothingLabelContainer, SWT.BORDER);
fNothingLabel.setText(Messages.OSView_4);
- fNothingLabel.setBackground(fNothingLabel.getDisplay().getSystemColor(
- SWT.COLOR_LIST_BACKGROUND));
- fNothingLabel.addListener (SWT.Selection, new Listener () {
+ fNothingLabel.setBackground(fNothingLabel.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
+ fNothingLabel.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
if (event.text.equals("fetch")) //$NON-NLS-1$
@@ -189,34 +186,32 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
};
fRefreshAction.setText(Messages.OSView_3);
fRefreshAction.setToolTipText(Messages.OSView_3);
- try {
- Bundle bundle= Platform.getBundle("org.eclipse.ui"); //$NON-NLS-1$
- URL url = bundle.getEntry("/"); //$NON-NLS-1$
- url = new URL(url, "icons/full/elcl16/refresh_nav.png"); //$NON-NLS-1$
- ImageDescriptor candidate = ImageDescriptor.createFromURL(url);
- if (candidate != null && candidate.getImageData() != null) {
- fRefreshAction.setImageDescriptor(candidate);
- }
- } catch (Exception e) {
- }
- bars.getToolBarManager().add(fRefreshAction);
- bars.setGlobalActionHandler(ActionFactory.COPY.getId(), new CopyAction());
- bars.updateActionBars();
-
- createContextMenu();
+ try {
+ Bundle bundle = Platform.getBundle("org.eclipse.ui"); //$NON-NLS-1$
+ URL url = bundle.getEntry("/"); //$NON-NLS-1$
+ url = new URL(url, "icons/full/elcl16/refresh_nav.png"); //$NON-NLS-1$
+ ImageDescriptor candidate = ImageDescriptor.createFromURL(url);
+ if (candidate != null && candidate.getImageData() != null) {
+ fRefreshAction.setImageDescriptor(candidate);
+ }
+ } catch (Exception e) {
+ }
+ bars.getToolBarManager().add(fRefreshAction);
+ bars.setGlobalActionHandler(ActionFactory.COPY.getId(), new CopyAction());
+ bars.updateActionBars();
+
+ createContextMenu();
getSite().setSelectionProvider(fViewer);
-
- setResourceClass(fResourceClassEditor.getResourceClassId());
+ setResourceClass(fResourceClassEditor.getResourceClassId());
setupContextListener();
DsfSession.addSessionEndedListener(this);
-
}
private void createContextMenu() {
- MenuManager menuMgr= new MenuManager("#PopUp"); //$NON-NLS-1$
+ MenuManager menuMgr = new MenuManager("#PopUp"); //$NON-NLS-1$
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
@Override
@@ -225,7 +220,7 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
});
- Menu menu= menuMgr.createContextMenu(fViewer.getControl());
+ Menu menu = menuMgr.createContextMenu(fViewer.getControl());
fViewer.getControl().setMenu(menu);
// register the context menu such that other plug-ins may contribute to it
@@ -234,8 +229,7 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
private void setupContextListener() {
IDebugContextManager contextManager = DebugUITools.getDebugContextManager();
- IDebugContextService contextService = contextManager
- .getContextService(getSite().getWorkbenchWindow());
+ IDebugContextService contextService = contextManager.getContextService(getSite().getWorkbenchWindow());
fDebugContextListener = new IDebugContextListener() {
@@ -251,22 +245,21 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
contextService.addDebugContextListener(fDebugContextListener);
setDebugContext(contextService.getActiveContext());
}
-
+
@Override
public void dispose() {
super.dispose();
IDebugContextManager contextManager = DebugUITools.getDebugContextManager();
- IDebugContextService contextService = contextManager
- .getContextService(getSite().getWorkbenchWindow());
+ IDebugContextService contextService = contextManager.getContextService(getSite().getWorkbenchWindow());
contextService.removeDebugContextListener(fDebugContextListener);
- setDebugContext((ICommandControlDMContext)null);
+ setDebugContext((ICommandControlDMContext) null);
DsfSession.removeSessionEndedListener(this);
}
private void setDebugContext(ISelection s) {
-
+
ICommandControlDMContext context = null;
fMultiple = false;
fWrongType = false;
@@ -278,15 +271,13 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
context = getCommandControlContext(i.next());
if (context == null)
fWrongType = true;
-
+
while (i.hasNext()) {
ICommandControlDMContext nextContext = getCommandControlContext(i.next());
if (nextContext == null)
fWrongType = true;
- if (nextContext == null && context != null
- || nextContext != null && context == null
- || nextContext != null && context != null && !nextContext.equals(context))
- {
+ if (nextContext == null && context != null || nextContext != null && context == null
+ || nextContext != null && context != null && !nextContext.equals(context)) {
context = null;
fMultiple = true;
break;
@@ -294,24 +285,24 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
}
}
}
-
+
setDebugContext(context);
}
private ICommandControlDMContext getCommandControlContext(Object obj) {
IDMContext context = null;
if (obj instanceof IDMVMContext)
- context = ((IDMVMContext)obj).getDMContext();
+ context = ((IDMVMContext) obj).getDMContext();
else if (obj instanceof GdbLaunch) {
- GdbLaunch l = (GdbLaunch)obj;
- final DsfServicesTracker tracker = new DsfServicesTracker(GdbPlugin.getBundleContext(), l.getSession().getId());
+ GdbLaunch l = (GdbLaunch) obj;
+ final DsfServicesTracker tracker = new DsfServicesTracker(GdbPlugin.getBundleContext(),
+ l.getSession().getId());
Query<IDMContext> contextQuery = new Query<IDMContext>() {
@Override
protected void execute(DataRequestMonitor<IDMContext> rm) {
ICommandControlService commandControl = tracker.getService(ICommandControlService.class);
tracker.dispose();
- if (commandControl != null)
- {
+ if (commandControl != null) {
rm.setData(commandControl.getContext());
}
rm.done();
@@ -326,21 +317,17 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
return DMContexts.getAncestorOfType(context, ICommandControlDMContext.class);
}
- private void setDebugContext(ICommandControlDMContext context)
- {
+ private void setDebugContext(ICommandControlDMContext context) {
DsfSession newSession = null;
SessionOSData newSessionData = null;
-
- if (context != null)
- {
+
+ if (context != null) {
newSession = DsfSession.getSession(context.getSessionId());
}
-
- if (newSession != null)
- {
+
+ if (newSession != null) {
newSessionData = fSessionDataCache.get(newSession.getId());
- if (newSessionData == null)
- {
+ if (newSessionData == null) {
newSessionData = new SessionOSData(newSession, context);
fSessionDataCache.put(newSession.getId(), newSessionData);
@@ -370,58 +357,56 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
// Update UI to showing new session data. If this session data is already
// shown, does nothing.
- private void update(SessionOSData newSessionData)
- {
+ private void update(SessionOSData newSessionData) {
if (fViewer == null || fViewer.getControl() == null)
return;
if (fViewer.getControl().isDisposed())
return;
-
- if (newSessionData == null)
- {
+
+ if (newSessionData == null) {
fSessionData = null;
if (fMultiple)
hideTable(Messages.OSView_14);
else if (fWrongType)
hideTable(Messages.OSView_4);
- else
+ else
hideTable(Messages.OSView_15);
fResourceClassEditor.setEnabled(false);
fRefreshAction.setEnabled(false);
return;
}
-
+
if (newSessionData != fSessionData) {
fSessionData = newSessionData;
updateSessionDataContents();
}
}
-
+
// Update the UI according to actual content of fSessionData,
// which must be not null.
private void updateSessionDataContents() {
if (fSessionData == null)
return;
-
+
if (fViewer == null || fViewer.getControl() == null)
return;
if (fViewer.getControl().isDisposed())
return;
- boolean enable = fSessionData.canFetchData();
+ boolean enable = fSessionData.canFetchData();
fRefreshAction.setEnabled(enable);
setResourceClass(fResourceClassEditor.updateClasses(fSessionData.getResourceClasses()));
fResourceClassEditor.setEnabled(enable);
-
+
if (!fSessionData.osResourcesSupported()) {
fRefreshAction.setEnabled(false);
fResourceClassEditor.setEnabled(false);
hideTable(Messages.OSView_10);
return;
}
-
+
if (fSessionData.waitingForSessionInitialization()) {
fRefreshAction.setEnabled(false);
fResourceClassEditor.setEnabled(false);
@@ -436,38 +421,30 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
return;
}
- if (getResourceClass() == null)
- {
+ if (getResourceClass() == null) {
fRefreshAction.setEnabled(false);
fResourceClassEditor.setEnabled(true);
hideTable(Messages.OSView_5);
return;
}
-
final OSData data = fSessionData.existingData(getResourceClass());
- if (fSessionData.fetchingContent())
- {
+ if (fSessionData.fetchingContent()) {
hideTable(Messages.OSView_6);
- }
- else if (data == null)
- {
+ } else if (data == null) {
if (fSessionData.canFetchData())
hideTable(NLS.bind(Messages.OSView_7, FETCH_LINK_TAG));
else
hideTable(Messages.OSView_12);
- }
- else
- {
+ } else {
SimpleDateFormat format = new SimpleDateFormat(Messages.OSView_8);
fRefreshAction.setToolTipText(format.format(fSessionData.timestamp(getResourceClass())));
- if (data != fTableShownData)
- {
+ if (data != fTableShownData) {
Job job = new UIJob(Messages.OSView_9) {
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
- fTableShownData = data;
+ fTableShownData = data;
populateTable(data);
showTable();
return Status.OK_STATUS;
@@ -476,9 +453,7 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
};
job.setPriority(Job.INTERACTIVE);
job.schedule();
- }
- else
- {
+ } else {
assert fViewer.getTable().getColumnCount() == data.getColumnCount();
showTable();
}
@@ -511,7 +486,7 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
private void showTable() {
assert fTableShownData != null;
-
+
fViewer.getControl().setVisible(true);
((GridData) fViewer.getControl().getLayoutData()).exclude = false;
fNothingLabelContainer.setVisible(false);
@@ -521,20 +496,18 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
populateViewMenu(fTableShownData);
}
- private void populateTable(final OSData data)
- {
+ private void populateTable(final OSData data) {
final Table table = fViewer.getTable();
while (table.getColumnCount() > 0)
table.getColumns()[0].dispose();
fColumnLayout = fColumnLayouts.get(getResourceClass());
- if (fColumnLayout == null)
- {
+ if (fColumnLayout == null) {
fColumnLayout = new ColumnLayout(getResourceClass());
fColumnLayouts.put(getResourceClass(), fColumnLayout);
}
-
+
for (int i = 0; i < data.getColumnCount(); ++i) {
final String cn = data.getColumnName(i);
final TableColumn c = new TableColumn(table, SWT.LEFT);
@@ -572,35 +545,29 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
populateViewMenu(data);
int sortColumn = fColumnLayout.getSortColumn();
- if (sortColumn < data.getColumnCount())
- {
+ if (sortColumn < data.getColumnCount()) {
fComparator.configure(sortColumn, data);
}
fComparator.setDirection(fColumnLayout.getSortDirection());
fViewer.getTable().setEnabled(true);
-
- if (fViewer.getContentProvider() == null)
- {
- ContentLabelProviderWrapper<OSData> wrapper =
- new ContentLabelProviderWrapper<OSData>(data);
+ if (fViewer.getContentProvider() == null) {
+ ContentLabelProviderWrapper<OSData> wrapper = new ContentLabelProviderWrapper<OSData>(data);
fViewer.setContentProvider(wrapper);
fViewer.setLabelProvider(wrapper);
- }
- else
- {
+ } else {
// Retarget current content/label providers in atomic fashion. See comments
// on ContentLabelProviderWrapper.
@SuppressWarnings("unchecked")
- ContentLabelProviderWrapper<OSData> wrapper = (ContentLabelProviderWrapper<OSData>)fViewer.getContentProvider();
+ ContentLabelProviderWrapper<OSData> wrapper = (ContentLabelProviderWrapper<OSData>) fViewer
+ .getContentProvider();
wrapper.setData(data);
}
fViewer.setInput(getViewSite());
fViewer.getControl().setVisible(true);
- for (int i = 0; i < fViewer.getTable().getColumnCount(); ++i)
- {
+ for (int i = 0; i < fViewer.getTable().getColumnCount(); ++i) {
TableColumn col = fViewer.getTable().getColumns()[i];
String cn = col.getText();
@@ -609,16 +576,13 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
table.setSortColumn(col);
}
- if (fColumnLayout.getVisible(cn))
- {
+ if (fColumnLayout.getVisible(cn)) {
int w = fColumnLayout.getWidth(cn);
if (w > 0)
col.setWidth(w);
else
col.pack();
- }
- else
- {
+ } else {
col.setWidth(0);
col.setResizable(false);
}
@@ -628,10 +592,10 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
private void populateViewMenu(final OSData data) {
assert data.getColumnCount() == fViewer.getTable().getColumnCount();
-
+
if (data == fMenuShownData)
return;
-
+
IActionBars bars = getViewSite().getActionBars();
bars.getMenuManager().setVisible(true);
bars.getMenuManager().removeAll();
@@ -666,26 +630,23 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
bars.getMenuManager().add(a);
}
bars.updateActionBars();
-
+
fMenuShownData = data;
}
- class Comparator extends ViewerComparator
- {
+ class Comparator extends ViewerComparator {
private int fColumn = 0;
private OSData fData;
private boolean fInteger = false;
private int fDirection = 1;
- public void configure(int column, OSData data)
- {
+ public void configure(int column, OSData data) {
fColumn = column;
fData = data;
fInteger = data.getColumnIsInteger(column);
}
- public void setDirection(int direction)
- {
+ public void setDirection(int direction) {
assert direction == 1 || direction == -1;
fDirection = direction;
}
@@ -694,13 +655,13 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
public int compare(Viewer viewer, Object xe1, Object xe2) {
String v1 = fData.getColumnText(xe1, fColumn);
- String v2 = fData.getColumnText(xe2, fColumn);
+ String v2 = fData.getColumnText(xe2, fColumn);
if (fInteger) {
Integer i1 = Integer.parseInt(v1);
Integer i2 = Integer.parseInt(v2);
- return fDirection*(i1 - i2);
+ return fDirection * (i1 - i2);
} else {
- return fDirection*(v1.compareTo(v2));
+ return fDirection * (v1.compareTo(v2));
}
}
};
@@ -723,7 +684,7 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
private void setResourceClass(String resourceClass) {
fResourceClass = resourceClass;
}
-
+
/**
* @return currently debug context for which resources are displayed
*/
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/ResourceClassContributionItem.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/ResourceClassContributionItem.java
index f32663093c8..4a3760e67d9 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/ResourceClassContributionItem.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/ResourceClassContributionItem.java
@@ -36,8 +36,7 @@ public class ResourceClassContributionItem extends ContributionItem {
// the combobox itself is adding. This constant is our guess.
private static final int COMBO_TRIM_WIDTH = 64;
- interface Listener
- {
+ interface Listener {
void resourceClassChanged(String newClass);
}
@@ -52,8 +51,8 @@ public class ResourceClassContributionItem extends ContributionItem {
private boolean enabled = true;
private static IDialogSettings settings;
- private static IDialogSettings getDialogSettings()
- {
+
+ private static IDialogSettings getDialogSettings() {
if (settings != null)
return settings;
@@ -80,24 +79,24 @@ public class ResourceClassContributionItem extends ContributionItem {
}
public String updateClasses(IResourceClass[] resourceClasses) {
-
+
boolean different = false;
if (this.resourceClasses.length != resourceClasses.length)
different = true;
- else for (int i = 0; i < this.resourceClasses.length; ++i) {
- if (!this.resourceClasses[i].getId().equals(resourceClasses[i].getId())
- || !this.resourceClasses[i].getHumanDescription().equals(resourceClasses[i].getHumanDescription()))
- {
- different = true;
- break;
+ else
+ for (int i = 0; i < this.resourceClasses.length; ++i) {
+ if (!this.resourceClasses[i].getId().equals(resourceClasses[i].getId()) || !this.resourceClasses[i]
+ .getHumanDescription().equals(resourceClasses[i].getHumanDescription())) {
+ different = true;
+ break;
+ }
}
- }
if (!different)
return fResourceClassId;
this.resourceClasses = resourceClasses;
-
+
fResourceClassCombo.removeAll();
final int width = populateCombo();
// Now change the width. Call to setWidth causes relayout automatically.
@@ -106,14 +105,14 @@ public class ResourceClassContributionItem extends ContributionItem {
// is not shown. The bug manifests by 100% CPU consumption inside event loop, and
// it further blocks asyncExec runnables from ever executing. I suppose it might
// be specific to relayout of invisible toolbar.
-
+
// If we're invisible, we don't arrange for relayout to happen when the view becomes
// available, because it is not exactly trivial (we need to events on the right control)
- // and it only matters when we start a new session and it has a different set of
+ // and it only matters when we start a new session and it has a different set of
// resource classes and that requires longer combobox.
if (toolItem.getParent().isVisible())
toolItem.setWidth(width);
-
+
return fResourceClassId;
}
@@ -122,7 +121,7 @@ public class ResourceClassContributionItem extends ContributionItem {
* returns some reasonable default width.
*/
private int populateCombo() {
-
+
int width = 0;
String lastResourceClassId = getDialogSettings().get("resourceClass"); //$NON-NLS-1$
int index = -1;
@@ -135,8 +134,6 @@ public class ResourceClassContributionItem extends ContributionItem {
if (resourceClasses[i].getId().equals(lastResourceClassId))
index = i;
}
-
-
if (index != -1) {
fResourceClassId = lastResourceClassId;
@@ -144,22 +141,21 @@ public class ResourceClassContributionItem extends ContributionItem {
fResourceClassCombo.select(index);
blockListener = false;
}
-
+
if (width == 0) {
// We have some hints what the longest element in combo will be. Even if it's different
// in new GDB version, no problem -- the combo will be resized when it's populated.
- width = gc.textExtent("Shared memory regions").x; //$NON-NLS-1$
+ width = gc.textExtent("Shared memory regions").x; //$NON-NLS-1$
}
// Because there's no way whatsoever to set the width
// of the combobox list, only complete length, we just add
// random padding.
width = width + COMBO_TRIM_WIDTH;
-
+
return width;
}
-
public String getResourceClassId() {
return fResourceClassId;
}
@@ -185,8 +181,7 @@ public class ResourceClassContributionItem extends ContributionItem {
// id is never null here, unless we messed up our data structures.
assert id != null;
- if (id != null && !id.equals(fResourceClassId))
- {
+ if (id != null && !id.equals(fResourceClassId)) {
fResourceClassId = id;
getDialogSettings().put("resourceClass", id); //$NON-NLS-1$
if (fListener != null && !blockListener)
@@ -199,7 +194,6 @@ public class ResourceClassContributionItem extends ContributionItem {
}
});
-
toolItem = new ToolItem(parent, SWT.SEPARATOR);
toolItem.setControl(fResourceClassCombo);
toolItem.setWidth(width);
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/SessionOSData.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/SessionOSData.java
index 3cdd4e9eaba..fcb235617c0 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/SessionOSData.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/SessionOSData.java
@@ -66,10 +66,8 @@ public class SessionOSData {
private boolean fAcceptingCommands = false;
private boolean fFetchingClasses = false;
private boolean fFetchingContent = false;
-
- public SessionOSData(DsfSession session, final ICommandControlDMContext executionContext)
- {
+ public SessionOSData(DsfSession session, final ICommandControlDMContext executionContext) {
fSession = session;
BundleContext c = GdbUIPlugin.getDefault().getBundle().getBundleContext();
fTracker = new DsfServicesTracker(c, fSession.getId());
@@ -80,7 +78,7 @@ public class SessionOSData {
@Override
public void run() {
-
+
IMIRunControl runControl = fTracker.getService(IMIRunControl.class);
fAcceptingCommands = runControl.isTargetAcceptingCommands();
@@ -93,41 +91,38 @@ public class SessionOSData {
notifyUI();
return;
}
-
+
if (fHardwareOs.isAvailable()) {
- fetchClasses();
+ fetchClasses();
}
}
});
}
-
+
@ConfinedToDsfExecutor("")
- private void fetchClasses()
- {
+ private void fetchClasses() {
fWaitingForSession = false;
fFetchingClasses = true;
- fHardwareOs.getResourceClasses(fContext, new DataRequestMonitor<IResourceClass[]>(fSession.getExecutor(), null) {
- @Override
- @ConfinedToDsfExecutor("fExecutor")
- protected void handleCompleted() {
-
- if (isSuccess())
- {
- fResourceClasses = getData();
- if (fResourceClasses.length == 0)
- fSupported = false;
- }
- else
- {
- fSupported = false;
- }
- fFetchingClasses = false;
- notifyUI();
- }
- });
+ fHardwareOs.getResourceClasses(fContext,
+ new DataRequestMonitor<IResourceClass[]>(fSession.getExecutor(), null) {
+ @Override
+ @ConfinedToDsfExecutor("fExecutor")
+ protected void handleCompleted() {
+
+ if (isSuccess()) {
+ fResourceClasses = getData();
+ if (fResourceClasses.length == 0)
+ fSupported = false;
+ } else {
+ fSupported = false;
+ }
+ fFetchingClasses = false;
+ notifyUI();
+ }
+ });
}
-
- @DsfServiceEventHandler
+
+ @DsfServiceEventHandler
public void eventDispatched(DataModelInitializedEvent e) {
// If we see this event, it necessary means that by the time we've set event listener,
// isAvailable() was returning false, so we need to fetch classes now.
@@ -135,32 +130,27 @@ public class SessionOSData {
fetchClasses();
}
- public boolean waitingForSessionInitialization()
- {
+ public boolean waitingForSessionInitialization() {
return fWaitingForSession;
}
- public boolean osResourcesSupported()
- {
+ public boolean osResourcesSupported() {
return fSupported;
}
- public void dispose()
- {
+ public void dispose() {
fSession.removeServiceEventListener(SessionOSData.this);
fTracker.dispose();
}
- public IResourceClass[] getResourceClasses()
- {
+ public IResourceClass[] getResourceClasses() {
return fResourceClasses;
}
/** Returns OS awareness data for given resource class that
* was previously fetched, or null if none was ever fetched.
*/
- public OSData existingData(String resourceClass)
- {
+ public OSData existingData(String resourceClass) {
return fExistingData.get(resourceClass);
}
@@ -168,8 +158,7 @@ public class SessionOSData {
* been obtained.
* @pre existingData(resourceClass) != null
*/
- public Date timestamp(String resourceClass)
- {
+ public Date timestamp(String resourceClass) {
return fTimestamp.get(resourceClass);
}
@@ -178,28 +167,24 @@ public class SessionOSData {
* and if GDB is accepting commands right now.
*
*/
- public boolean canFetchData()
- {
+ public boolean canFetchData() {
return fAcceptingCommands && !fFetchingContent;
}
- public boolean fetchingClasses()
- {
+ public boolean fetchingClasses() {
return fFetchingClasses;
}
/** Returns true if we're presently fetching data. This can
* be used to provide some feedback to the user.
*/
- public boolean fetchingContent()
- {
+ public boolean fetchingContent() {
return fFetchingContent;
}
/** Fetches up-to-date data for resourceClass. Listeners will be
* informed when the new data is available. */
- public void fetchData(final String resourceClass)
- {
+ public void fetchData(final String resourceClass) {
fFetchingContent = true;
notifyUI();
@@ -208,35 +193,31 @@ public class SessionOSData {
@Override
public void run() {
- fHardwareOs.getResourcesInformation(fContext, resourceClass, new DataRequestMonitor<IResourcesInformation>(executor, null) {
-
- @Override
- @ConfinedToDsfExecutor("fExecutor")
- protected void handleCompleted() {
-
- fFetchingContent = false;
-
- if (isSuccess())
- {
- OSData data = new OSData(resourceClass, getData());
- fExistingData.put(resourceClass, data);
- fTimestamp.put(resourceClass, new Date());
- }
- else
- {
- StatusManager.getManager().handle(getStatus(), StatusManager.SHOW);
- }
- notifyUI();
- }
- });
+ fHardwareOs.getResourcesInformation(fContext, resourceClass,
+ new DataRequestMonitor<IResourcesInformation>(executor, null) {
+
+ @Override
+ @ConfinedToDsfExecutor("fExecutor")
+ protected void handleCompleted() {
+
+ fFetchingContent = false;
+
+ if (isSuccess()) {
+ OSData data = new OSData(resourceClass, getData());
+ fExistingData.put(resourceClass, data);
+ fTimestamp.put(resourceClass, new Date());
+ } else {
+ StatusManager.getManager().handle(getStatus(), StatusManager.SHOW);
+ }
+ notifyUI();
+ }
+ });
}
});
-
}
- public interface Listener
- {
+ public interface Listener {
void update();
}
@@ -246,55 +227,53 @@ public class SessionOSData {
* the listener. The listener will not be called if the control
* is disposed.
*/
- public void setUIListener(Listener listener, Control control)
- {
+ public void setUIListener(Listener listener, Control control) {
fUIListener = listener;
fUIControl = control;
}
- private void notifyUI()
- {
-
+ private void notifyUI() {
+
final Control c = fUIControl;
if (c != null && !c.isDisposed())
// There be dragons: if you try to use c.getDisplay() below, then this Runnable will not
// run until resource view is actually visible. And it will also block other interesting
// async/job runnables, like perspective switch runnable using during debug launch,
// causing launch to be stuck at random point.
- //
+ //
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
-
+
if (!c.isDisposed())
fUIListener.update();
}
});
-
+
+ }
+
+ @DsfServiceEventHandler
+ public void eventDispatched(IResumedDMEvent e) {
+ if (e instanceof IContainerResumedDMEvent) {
+ // This event is raised only in all-stop. It does not
+ // seem to be possible to issue -info-os in all-stop,
+ // regardless of whether target-async is in effect, and
+ // according to DSF folks, all-stop+target-async will
+ // not work anyway. So, we assume that no commands
+ // can be issued right now.
+ fAcceptingCommands = false;
+ notifyUI();
+ }
}
- @DsfServiceEventHandler
- public void eventDispatched(IResumedDMEvent e) {
- if (e instanceof IContainerResumedDMEvent) {
- // This event is raised only in all-stop. It does not
- // seem to be possible to issue -info-os in all-stop,
- // regardless of whether target-async is in effect, and
- // according to DSF folks, all-stop+target-async will
- // not work anyway. So, we assume that no commands
- // can be issued right now.
- fAcceptingCommands = false;
- notifyUI();
- }
- }
-
- @DsfServiceEventHandler
- public void eventDispatched(ISuspendedDMEvent e) {
- if (e instanceof IContainerSuspendedDMEvent) {
- fAcceptingCommands = true;
- notifyUI();
- }
- }
+ @DsfServiceEventHandler
+ public void eventDispatched(ISuspendedDMEvent e) {
+ if (e instanceof IContainerSuspendedDMEvent) {
+ fAcceptingCommands = true;
+ notifyUI();
+ }
+ }
/**
* @return the fContext
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbConsolePreferencePage.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbConsolePreferencePage.java
index fe5a4bbdcee..188a15f8028 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbConsolePreferencePage.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbConsolePreferencePage.java
@@ -23,13 +23,13 @@ import org.eclipse.ui.IWorkbenchPreferencePage;
/**
* GDB CLI Console Preference Page.
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noinstantiate This class is not intended to be instantiated by clients.
* @noreference This class is not intended to be referenced by clients.
*/
public class GdbConsolePreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
- private static final int MIN_BUFFER_LINES = 16; /* minimum of ~1000 chars */
+ private static final int MIN_BUFFER_LINES = 16; /* minimum of ~1000 chars */
// Instead of using a maximum of Integer.MAX_VALUE (which is some obscure number),
// let's use a well defined limit e.g. 2 billion lines, which is readable.
private static final int MAX_BUFFER_LINES = 2000000000;
@@ -58,9 +58,11 @@ public class GdbConsolePreferencePage extends FieldEditorPreferencePage implemen
}
private void setupEditors() {
- BooleanFieldEditor invertColors = new BooleanFieldEditor(IGdbDebugPreferenceConstants.PREF_CONSOLE_INVERTED_COLORS,
+ BooleanFieldEditor invertColors = new BooleanFieldEditor(
+ IGdbDebugPreferenceConstants.PREF_CONSOLE_INVERTED_COLORS,
MessagesForPreferences.GdbConsolePreferencePage_InvertColors, getFieldEditorParent());
- IntegerFieldEditor editorBufferSize = new IntegerFieldEditor(IGdbDebugPreferenceConstants.PREF_CONSOLE_BUFFERLINES,
+ IntegerFieldEditor editorBufferSize = new IntegerFieldEditor(
+ IGdbDebugPreferenceConstants.PREF_CONSOLE_BUFFERLINES,
MessagesForPreferences.GdbConsolePreferencePage_BufferLines, getFieldEditorParent());
editorBufferSize.setValidRange(MIN_BUFFER_LINES, MAX_BUFFER_LINES);
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbDebugPreferencePage.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbDebugPreferencePage.java
index a031d2e91cc..6298aac88fd 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbDebugPreferencePage.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbDebugPreferencePage.java
@@ -84,7 +84,7 @@ import org.eclipse.ui.PlatformUI;
* A preference page for settings that are currently only supported in GDB.
*/
public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
-
+
private static final int DEFAULT_GDB_COMMAND_LABEL_WIDTH_HINT = 300;
/**
@@ -93,8 +93,7 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements
*/
private class ListenableBooleanFieldEditor extends BooleanFieldEditor {
- public ListenableBooleanFieldEditor(String name, String labelText, int style,
- Composite parent) {
+ public ListenableBooleanFieldEditor(String name, String labelText, int style, Composite parent) {
super(name, labelText, style, parent);
}
@@ -107,88 +106,87 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements
class AdvancedTimeoutSettingsDialog extends TitleAreaDialog {
class CommandTimeoutEntry {
-
+
String fCommand;
Integer fTimeout;
-
- CommandTimeoutEntry( String command, Integer timeout ) {
+
+ CommandTimeoutEntry(String command, Integer timeout) {
fCommand = command;
fTimeout = timeout;
}
}
class CellEditorListener implements ICellEditorListener {
-
+
CellEditor fEditor;
-
- public CellEditorListener( CellEditor editor ) {
+
+ public CellEditorListener(CellEditor editor) {
super();
fEditor = editor;
}
@Override
- public void editorValueChanged( boolean oldValidState, boolean newValidState ) {
- if ( newValidState ) {
- setErrorMessage( null );
- }
- else {
- setErrorMessage( fEditor.getErrorMessage() );
+ public void editorValueChanged(boolean oldValidState, boolean newValidState) {
+ if (newValidState) {
+ setErrorMessage(null);
+ } else {
+ setErrorMessage(fEditor.getErrorMessage());
}
updateDialogButtons();
}
-
+
@Override
public void cancelEditor() {
}
-
+
@Override
public void applyEditorValue() {
validate();
updateDialogButtons();
}
};
-
+
abstract class AbstractEditingSupport extends EditingSupport {
- public AbstractEditingSupport( ColumnViewer viewer ) {
- super( viewer );
+ public AbstractEditingSupport(ColumnViewer viewer) {
+ super(viewer);
}
@Override
- protected void setValue( Object element, Object value ) {
- if ( element instanceof CommandTimeoutEntry && value instanceof String ) {
- if ( processValue( (CommandTimeoutEntry)element, (String)value ) ) {
- fViewer.refresh( element );
+ protected void setValue(Object element, Object value) {
+ if (element instanceof CommandTimeoutEntry && value instanceof String) {
+ if (processValue((CommandTimeoutEntry) element, (String) value)) {
+ fViewer.refresh(element);
validate();
updateDialogButtons();
}
}
}
-
+
@Override
- protected Object getValue( Object element ) {
- if ( element instanceof CommandTimeoutEntry ) {
- return doGetValue( (CommandTimeoutEntry)element );
+ protected Object getValue(Object element) {
+ if (element instanceof CommandTimeoutEntry) {
+ return doGetValue((CommandTimeoutEntry) element);
}
return null;
}
-
+
@Override
- protected CellEditor getCellEditor( Object element ) {
- final CellEditor editor = new TextCellEditor( (Composite)getViewer().getControl() );
- editor.setValidator( getValidator() );
- editor.addListener( new CellEditorListener( editor ) );
+ protected CellEditor getCellEditor(Object element) {
+ final CellEditor editor = new TextCellEditor((Composite) getViewer().getControl());
+ editor.setValidator(getValidator());
+ editor.addListener(new CellEditorListener(editor));
return editor;
}
-
+
@Override
- protected boolean canEdit( Object element ) {
- return ( element instanceof CommandTimeoutEntry );
+ protected boolean canEdit(Object element) {
+ return (element instanceof CommandTimeoutEntry);
}
-
- abstract boolean processValue( CommandTimeoutEntry entry, String value );
- abstract Object doGetValue( CommandTimeoutEntry entry );
+ abstract boolean processValue(CommandTimeoutEntry entry, String value);
+
+ abstract Object doGetValue(CommandTimeoutEntry entry);
abstract ICellEditorValidator getValidator();
};
@@ -196,14 +194,14 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements
private TableViewer fViewer;
private Button fAddButton;
private Button fDeleteButton;
-
+
private List<CommandTimeoutEntry> fEntries;
-
+
final private ICellEditorValidator fCommandValidator = new ICellEditorValidator() {
-
+
@Override
- public String isValid( Object value ) {
- if ( value instanceof String && ((String)value).trim().length() == 0 ) {
+ public String isValid(Object value) {
+ if (value instanceof String && ((String) value).trim().length() == 0) {
return MessagesForPreferences.GdbDebugPreferencePage_Command_field_can_not_be_empty;
}
return null;
@@ -211,16 +209,15 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements
};
final private ICellEditorValidator fTimeoutValidator = new ICellEditorValidator() {
-
+
@Override
- public String isValid( Object value ) {
- if ( value instanceof String ) {
+ public String isValid(Object value) {
+ if (value instanceof String) {
try {
- int intValue = Integer.decode( (String)value ).intValue();
- if ( intValue < 0 )
+ int intValue = Integer.decode((String) value).intValue();
+ if (intValue < 0)
return MessagesForPreferences.GdbDebugPreferencePage_Timeout_value_can_not_be_negative;
- }
- catch( NumberFormatException e ) {
+ } catch (NumberFormatException e) {
return MessagesForPreferences.GdbDebugPreferencePage_Invalid_timeout_value;
}
}
@@ -228,116 +225,115 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements
}
};
- AdvancedTimeoutSettingsDialog( Shell parentShell, Set<Map.Entry<String, Integer>> entries ) {
- super( parentShell );
+ AdvancedTimeoutSettingsDialog(Shell parentShell, Set<Map.Entry<String, Integer>> entries) {
+ super(parentShell);
setShellStyle(getShellStyle() | SWT.RESIZE);
fEntries = new LinkedList<CommandTimeoutEntry>();
- for ( Map.Entry<String, Integer> entry : entries ) {
- fEntries.add( new CommandTimeoutEntry( entry.getKey(), entry.getValue() ) );
+ for (Map.Entry<String, Integer> entry : entries) {
+ fEntries.add(new CommandTimeoutEntry(entry.getKey(), entry.getValue()));
}
}
@Override
- protected Control createDialogArea( Composite parent ) {
- getShell().setText( MessagesForPreferences.GdbDebugPreferencePage_Advanced_Timeout_Settings );
- setTitle( MessagesForPreferences.GdbDebugPreferencePage_Advanced_timeout_dialog_title );
- setTitleImage( GdbUIPlugin.getImage( IGdbUIConstants.IMG_WIZBAN_ADVANCED_TIMEOUT_SETTINGS ) );
- setMessage( MessagesForPreferences.GdbDebugPreferencePage_Advanced_timeout_dialog_message );
-
- Composite control = (Composite)super.createDialogArea( parent );
- Composite comp = new Composite( control, SWT.NONE );
- GridData gd = new GridData( SWT.FILL, SWT.FILL, true, true );
- GridLayout layout = new GridLayout( 2, false );
+ protected Control createDialogArea(Composite parent) {
+ getShell().setText(MessagesForPreferences.GdbDebugPreferencePage_Advanced_Timeout_Settings);
+ setTitle(MessagesForPreferences.GdbDebugPreferencePage_Advanced_timeout_dialog_title);
+ setTitleImage(GdbUIPlugin.getImage(IGdbUIConstants.IMG_WIZBAN_ADVANCED_TIMEOUT_SETTINGS));
+ setMessage(MessagesForPreferences.GdbDebugPreferencePage_Advanced_timeout_dialog_message);
+
+ Composite control = (Composite) super.createDialogArea(parent);
+ Composite comp = new Composite(control, SWT.NONE);
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ GridLayout layout = new GridLayout(2, false);
layout.marginLeft = FieldDecorationRegistry.getDefault().getMaximumDecorationWidth();
- comp.setLayout( layout );
- comp.setLayoutData( gd );
-
- fViewer = new TableViewer( comp, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER );
+ comp.setLayout(layout);
+ comp.setLayoutData(gd);
+
+ fViewer = new TableViewer(comp, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
final Table table = fViewer.getTable();
- gd = new GridData( SWT.FILL, SWT.FILL, true, true );
+ gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.horizontalIndent = FieldDecorationRegistry.getDefault().getMaximumDecorationWidth();
- table.setLayoutData( gd );
-
- ControlDecoration decoration = new ControlDecoration( table, SWT.TOP | SWT.LEFT, control );
- decoration.setImage(
- FieldDecorationRegistry.getDefault().getFieldDecoration(
- FieldDecorationRegistry.DEC_INFORMATION ).getImage() );
- decoration.setDescriptionText(
- MessagesForPreferences.GdbDebugPreferencePage_Advanced_timeout_settings_dialog_tooltip );
- fViewer.addDoubleClickListener( new IDoubleClickListener() {
+ table.setLayoutData(gd);
+
+ ControlDecoration decoration = new ControlDecoration(table, SWT.TOP | SWT.LEFT, control);
+ decoration.setImage(FieldDecorationRegistry.getDefault()
+ .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage());
+ decoration.setDescriptionText(
+ MessagesForPreferences.GdbDebugPreferencePage_Advanced_timeout_settings_dialog_tooltip);
+ fViewer.addDoubleClickListener(new IDoubleClickListener() {
@Override
- public void doubleClick( DoubleClickEvent event ) {
+ public void doubleClick(DoubleClickEvent event) {
okPressed();
}
- } );
+ });
+
+ fViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- fViewer.addSelectionChangedListener( new ISelectionChangedListener() {
-
@Override
- public void selectionChanged( SelectionChangedEvent event ) {
+ public void selectionChanged(SelectionChangedEvent event) {
updateDialogButtons();
}
- } );
-
- Composite btnComp = new Composite( comp, SWT.NONE );
- btnComp.setLayout( new GridLayout() );
- btnComp.setLayoutData( new GridData( SWT.RIGHT, SWT.TOP, false, false ) );
-
- fAddButton = new Button( btnComp, SWT.PUSH );
- fAddButton.setText( MessagesForPreferences.GdbDebugPreferencePage_Add_button );
- fAddButton.setFont( JFaceResources.getDialogFont() );
- setButtonLayoutData( fAddButton );
- fAddButton.addSelectionListener( new SelectionAdapter() {
+ });
+
+ Composite btnComp = new Composite(comp, SWT.NONE);
+ btnComp.setLayout(new GridLayout());
+ btnComp.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false));
+
+ fAddButton = new Button(btnComp, SWT.PUSH);
+ fAddButton.setText(MessagesForPreferences.GdbDebugPreferencePage_Add_button);
+ fAddButton.setFont(JFaceResources.getDialogFont());
+ setButtonLayoutData(fAddButton);
+ fAddButton.addSelectionListener(new SelectionAdapter() {
@Override
- public void widgetSelected( SelectionEvent e ) {
+ public void widgetSelected(SelectionEvent e) {
addNewEntry();
}
- } );
-
- fDeleteButton = new Button( btnComp, SWT.PUSH );
- fDeleteButton.setText( MessagesForPreferences.GdbDebugPreferencePage_Delete_button );
- fDeleteButton.setFont( JFaceResources.getDialogFont() );
- setButtonLayoutData( fDeleteButton );
- fDeleteButton.addSelectionListener( new SelectionAdapter() {
+ });
+
+ fDeleteButton = new Button(btnComp, SWT.PUSH);
+ fDeleteButton.setText(MessagesForPreferences.GdbDebugPreferencePage_Delete_button);
+ fDeleteButton.setFont(JFaceResources.getDialogFont());
+ setButtonLayoutData(fDeleteButton);
+ fDeleteButton.addSelectionListener(new SelectionAdapter() {
@Override
- public void widgetSelected( SelectionEvent e ) {
+ public void widgetSelected(SelectionEvent e) {
deleteEntries();
}
- } );
-
- table.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
- table.setHeaderVisible( true );
- table.setLinesVisible( true );
-
- TableViewerColumn commandColumn = new TableViewerColumn( fViewer, SWT.LEFT );
- commandColumn.getColumn().setText( MessagesForPreferences.GdbDebugPreferencePage_Command_column_name );
- commandColumn.setLabelProvider( createCommandLabelProvider() );
- commandColumn.setEditingSupport( createCommandEditingSupport( fViewer ) );
-
- TableViewerColumn timeoutColumn = new TableViewerColumn( fViewer, SWT.LEFT );
- timeoutColumn.getColumn().setText( MessagesForPreferences.GdbDebugPreferencePage_Timeout_column_name );
- timeoutColumn.setLabelProvider( createTimeoutLabelProvider() );
- timeoutColumn.setEditingSupport( createTimeoutEditingSupport( fViewer ) );
-
- fViewer.setContentProvider( createCustomTimeoutsContentProvider() );
-
- table.addControlListener( new ControlAdapter() {
-
+ });
+
+ table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+
+ TableViewerColumn commandColumn = new TableViewerColumn(fViewer, SWT.LEFT);
+ commandColumn.getColumn().setText(MessagesForPreferences.GdbDebugPreferencePage_Command_column_name);
+ commandColumn.setLabelProvider(createCommandLabelProvider());
+ commandColumn.setEditingSupport(createCommandEditingSupport(fViewer));
+
+ TableViewerColumn timeoutColumn = new TableViewerColumn(fViewer, SWT.LEFT);
+ timeoutColumn.getColumn().setText(MessagesForPreferences.GdbDebugPreferencePage_Timeout_column_name);
+ timeoutColumn.setLabelProvider(createTimeoutLabelProvider());
+ timeoutColumn.setEditingSupport(createTimeoutEditingSupport(fViewer));
+
+ fViewer.setContentProvider(createCustomTimeoutsContentProvider());
+
+ table.addControlListener(new ControlAdapter() {
+
@Override
- public void controlResized( ControlEvent e ) {
+ public void controlResized(ControlEvent e) {
Rectangle area = table.getClientArea();
- if ( area.width > 0 ) {
+ if (area.width > 0) {
TableColumn[] cols = table.getColumns();
- cols[0].setWidth( area.width * 50 / 100 );
- cols[1].setWidth( area.width * 50 / 100 );
- table.removeControlListener( this );
+ cols[0].setWidth(area.width * 50 / 100);
+ cols[1].setWidth(area.width * 50 / 100);
+ table.removeControlListener(this);
}
}
- } );
+ });
- fViewer.setInput( fEntries );
+ fViewer.setInput(fEntries);
updateDialogButtons();
@@ -345,28 +341,28 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements
}
void updateDialogButtons() {
- if ( fViewer != null && fDeleteButton != null ) {
- fDeleteButton.setEnabled( !fViewer.getSelection().isEmpty() );
+ if (fViewer != null && fDeleteButton != null) {
+ fDeleteButton.setEnabled(!fViewer.getSelection().isEmpty());
}
- Button okButton = getButton( IDialogConstants.OK_ID );
- if ( okButton != null )
- okButton.setEnabled( getErrorMessage() == null );
+ Button okButton = getButton(IDialogConstants.OK_ID);
+ if (okButton != null)
+ okButton.setEnabled(getErrorMessage() == null);
}
void addNewEntry() {
- CommandTimeoutEntry newEntry = new CommandTimeoutEntry( "", Integer.valueOf( 0 ) ); //$NON-NLS-1$
- fEntries.add( newEntry );
+ CommandTimeoutEntry newEntry = new CommandTimeoutEntry("", Integer.valueOf(0)); //$NON-NLS-1$
+ fEntries.add(newEntry);
fViewer.refresh();
- fViewer.setSelection( new StructuredSelection( newEntry ) );
- validateEntry( newEntry );
+ fViewer.setSelection(new StructuredSelection(newEntry));
+ validateEntry(newEntry);
updateDialogButtons();
- fViewer.editElement( newEntry, 0 );
+ fViewer.editElement(newEntry, 0);
}
void deleteEntries() {
- IStructuredSelection sel = (IStructuredSelection)fViewer.getSelection();
- if ( !sel.isEmpty() )
- fEntries.removeAll( sel.toList() );
+ IStructuredSelection sel = (IStructuredSelection) fViewer.getSelection();
+ if (!sel.isEmpty())
+ fEntries.removeAll(sel.toList());
fViewer.refresh();
validate();
updateDialogButtons();
@@ -374,41 +370,41 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements
CustomTimeoutsMap getResult() {
CustomTimeoutsMap map = new CustomTimeoutsMap();
- for ( CommandTimeoutEntry entry : fEntries ) {
- map.put( entry.fCommand, entry.fTimeout );
+ for (CommandTimeoutEntry entry : fEntries) {
+ map.put(entry.fCommand, entry.fTimeout);
}
return map;
}
void validate() {
- for ( CommandTimeoutEntry entry : fEntries ) {
- validateEntry( entry );
+ for (CommandTimeoutEntry entry : fEntries) {
+ validateEntry(entry);
}
}
- void validateEntry( CommandTimeoutEntry entry ) {
- String errorMessage = fCommandValidator.isValid( entry.fCommand );
- setErrorMessage( ( errorMessage != null ) ?
- errorMessage : fTimeoutValidator.isValid( entry.fTimeout.toString() ) );
+ void validateEntry(CommandTimeoutEntry entry) {
+ String errorMessage = fCommandValidator.isValid(entry.fCommand);
+ setErrorMessage(
+ (errorMessage != null) ? errorMessage : fTimeoutValidator.isValid(entry.fTimeout.toString()));
}
IStructuredContentProvider createCustomTimeoutsContentProvider() {
return new IStructuredContentProvider() {
-
+
@Override
- public void inputChanged( Viewer viewer, Object oldInput, Object newInput ) {
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
-
+
@Override
public void dispose() {
}
-
+
@Override
- public Object[] getElements( Object inputElement ) {
- if ( inputElement instanceof List<?> ) {
- @SuppressWarnings( "unchecked" )
- List<CommandTimeoutEntry> list = (List<CommandTimeoutEntry>)inputElement;
- return list.toArray( new Object[list.size()] );
+ public Object[] getElements(Object inputElement) {
+ if (inputElement instanceof List<?>) {
+ @SuppressWarnings("unchecked")
+ List<CommandTimeoutEntry> list = (List<CommandTimeoutEntry>) inputElement;
+ return list.toArray(new Object[list.size()]);
}
return null;
}
@@ -422,11 +418,11 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements
* @see org.eclipse.jface.viewers.ColumnLabelProvider#getText(java.lang.Object)
*/
@Override
- public String getText( Object element ) {
- if ( element instanceof CommandTimeoutEntry ) {
- return ((CommandTimeoutEntry)element).fCommand;
+ public String getText(Object element) {
+ if (element instanceof CommandTimeoutEntry) {
+ return ((CommandTimeoutEntry) element).fCommand;
}
- return super.getText( element );
+ return super.getText(element);
}
};
}
@@ -438,26 +434,26 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements
* @see org.eclipse.jface.viewers.ColumnLabelProvider#getText(java.lang.Object)
*/
@Override
- public String getText( Object element ) {
- if ( element instanceof CommandTimeoutEntry ) {
- return ((CommandTimeoutEntry)element).fTimeout.toString();
+ public String getText(Object element) {
+ if (element instanceof CommandTimeoutEntry) {
+ return ((CommandTimeoutEntry) element).fTimeout.toString();
}
- return super.getText( element );
+ return super.getText(element);
}
};
}
- EditingSupport createCommandEditingSupport( ColumnViewer viewer ) {
- return new AbstractEditingSupport( viewer ) {
-
+ EditingSupport createCommandEditingSupport(ColumnViewer viewer) {
+ return new AbstractEditingSupport(viewer) {
+
@Override
- boolean processValue( CommandTimeoutEntry entry, String value ) {
+ boolean processValue(CommandTimeoutEntry entry, String value) {
entry.fCommand = value;
return true;
}
@Override
- Object doGetValue( CommandTimeoutEntry entry ) {
+ Object doGetValue(CommandTimeoutEntry entry) {
return entry.fCommand;
}
@@ -468,23 +464,22 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements
};
}
- EditingSupport createTimeoutEditingSupport( ColumnViewer viewer ) {
- return new AbstractEditingSupport( viewer ) {
+ EditingSupport createTimeoutEditingSupport(ColumnViewer viewer) {
+ return new AbstractEditingSupport(viewer) {
@Override
- boolean processValue( CommandTimeoutEntry entry, String value ) {
+ boolean processValue(CommandTimeoutEntry entry, String value) {
try {
- entry.fTimeout = Integer.decode( value );
+ entry.fTimeout = Integer.decode(value);
return true;
- }
- catch( NumberFormatException e ) {
+ } catch (NumberFormatException e) {
// Shouldn't happen, validator takes care of this case.
}
return false;
}
@Override
- Object doGetValue( CommandTimeoutEntry entry ) {
+ Object doGetValue(CommandTimeoutEntry entry) {
return entry.fTimeout.toString();
}
@@ -500,16 +495,16 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements
private Button fTimeoutAdvancedButton;
private CustomTimeoutsMap fCustomTimeouts;
-
+
public GdbDebugPreferencePage() {
super(FLAT);
- IPreferenceStore store= GdbUIPlugin.getDefault().getPreferenceStore();
+ IPreferenceStore store = GdbUIPlugin.getDefault().getPreferenceStore();
setPreferenceStore(store);
setDescription(MessagesForPreferences.GdbDebugPreferencePage_description);
fCustomTimeouts = new CustomTimeoutsMap();
}
- @Override
+ @Override
public void init(IWorkbench workbench) {
}
@@ -529,9 +524,9 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements
@Override
protected void createFieldEditors() {
- final Composite parent= getFieldEditorParent();
- final GridLayout layout= new GridLayout();
- layout.marginWidth= 0;
+ final Composite parent = getFieldEditorParent();
+ final GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
parent.setLayout(layout);
final Group group1 = new Group(parent, SWT.NONE);
@@ -542,8 +537,7 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements
final StringFieldEditor stringFieldEditorCommand = new StringFieldEditor(
IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND,
- MessagesForPreferences.GdbDebugPreferencePage_GDB_debugger,
- group1);
+ MessagesForPreferences.GdbDebugPreferencePage_GDB_debugger, group1);
stringFieldEditorCommand.fillIntoGrid(group1, 2);
GridData stringFieldLayoutData = (GridData) stringFieldEditorCommand.getTextControl(group1).getLayoutData();
@@ -559,12 +553,11 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements
stringFieldEditorCommand);
}
});
- setButtonLayoutData( browsebutton );
+ setButtonLayoutData(browsebutton);
final StringFieldEditor stringFieldEditorGdbInit = new StringFieldEditor(
IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_INIT,
- MessagesForPreferences.GdbDebugPreferencePage_GDB_command_file,
- group1);
+ MessagesForPreferences.GdbDebugPreferencePage_GDB_command_file, group1);
stringFieldEditorGdbInit.fillIntoGrid(group1, 2);
addField(stringFieldEditorGdbInit);
@@ -577,116 +570,100 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements
stringFieldEditorGdbInit);
}
});
- setButtonLayoutData( browsebutton );
+ setButtonLayoutData(browsebutton);
final StringWithBooleanFieldEditor enableStopAtMain = new StringWithBooleanFieldEditor(
IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN,
IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN_SYMBOL,
- MessagesForPreferences.GdbDebugPreferencePage_Stop_on_startup_at,
- group1);
+ MessagesForPreferences.GdbDebugPreferencePage_Stop_on_startup_at, group1);
enableStopAtMain.fillIntoGrid(group1, 3);
addField(enableStopAtMain);
-
- fCommandTimeoutField = new IntegerWithBooleanFieldEditor(
- IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT,
- IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT_VALUE,
- MessagesForPreferences.GdbDebugPreferencePage_Command_timeout,
- group1);
+
+ fCommandTimeoutField = new IntegerWithBooleanFieldEditor(IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT,
+ IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT_VALUE,
+ MessagesForPreferences.GdbDebugPreferencePage_Command_timeout, group1);
fCommandTimeoutField.setValidRange(0, Integer.MAX_VALUE);
fCommandTimeoutField.fillIntoGrid(group1, 2);
addField(fCommandTimeoutField);
-
+
fTimeoutAdvancedButton = new Button(group1, SWT.PUSH);
fTimeoutAdvancedButton.setText(MessagesForPreferences.GdbDebugPreferencePage_Advanced_button);
fTimeoutAdvancedButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- handleAdvancedButtonSelected(
- MessagesForPreferences.GdbDebugPreferencePage_GDB_debugger_dialog_title);
+ handleAdvancedButtonSelected(MessagesForPreferences.GdbDebugPreferencePage_GDB_debugger_dialog_title);
}
});
- setButtonLayoutData( fTimeoutAdvancedButton );
+ setButtonLayoutData(fTimeoutAdvancedButton);
- final ListenableBooleanFieldEditor enableNonStop= new ListenableBooleanFieldEditor(
+ final ListenableBooleanFieldEditor enableNonStop = new ListenableBooleanFieldEditor(
IGdbDebugPreferenceConstants.PREF_DEFAULT_NON_STOP,
- MessagesForPreferences.GdbDebugPreferencePage_Non_stop_mode,
- SWT.NONE, group1);
+ MessagesForPreferences.GdbDebugPreferencePage_Non_stop_mode, SWT.NONE, group1);
enableNonStop.fillIntoGrid(group1, 3);
addField(enableNonStop);
- if (Platform.getOS().startsWith("win")) { //$NON-NLS-1$
+ if (Platform.getOS().startsWith("win")) { //$NON-NLS-1$
BooleanFieldEditor externalConsoleField = new BooleanFieldEditor(
IGdbDebugPreferenceConstants.PREF_EXTERNAL_CONSOLE,
- MessagesForPreferences.GdbDebugPreferencePage_external_console,
- group1);
-
+ MessagesForPreferences.GdbDebugPreferencePage_external_console, group1);
+
externalConsoleField.fillIntoGrid(group1, 3);
addField(externalConsoleField);
- }
+ }
final StringWithBooleanFieldEditor remoteTimeout = new StringWithBooleanFieldEditor(
IGdbDebugPreferenceConstants.PREF_DEFAULT_REMOTE_TIMEOUT_ENABLED,
IGdbDebugPreferenceConstants.PREF_DEFAULT_REMOTE_TIMEOUT_VALUE,
- MessagesForPreferences.GdbDebugPreferencePage_remoteTimeout_label,
- group1);
- remoteTimeout.getCheckboxControl(group1).setToolTipText(MessagesForPreferences.GdbDebugPreferencePage_remoteTimeout_tooltip);
- remoteTimeout.getTextControl(group1).setToolTipText(MessagesForPreferences.GdbDebugPreferencePage_remoteTimeout_tooltip);
+ MessagesForPreferences.GdbDebugPreferencePage_remoteTimeout_label, group1);
+ remoteTimeout.getCheckboxControl(group1)
+ .setToolTipText(MessagesForPreferences.GdbDebugPreferencePage_remoteTimeout_tooltip);
+ remoteTimeout.getTextControl(group1)
+ .setToolTipText(MessagesForPreferences.GdbDebugPreferencePage_remoteTimeout_tooltip);
remoteTimeout.fillIntoGrid(group1, 3);
addField(remoteTimeout);
-
group1.setLayout(groupLayout);
- final Group group2= new Group(parent, SWT.NONE);
+ final Group group2 = new Group(parent, SWT.NONE);
group2.setText(MessagesForPreferences.GdbDebugPreferencePage_general_behavior_label);
- groupLayout= new GridLayout(3, false);
+ groupLayout = new GridLayout(3, false);
group2.setLayout(groupLayout);
group2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- BooleanFieldEditor boolField= new BooleanFieldEditor(
- IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB,
- MessagesForPreferences.GdbDebugPreferencePage_autoTerminateGdb_label,
- group2);
+ BooleanFieldEditor boolField = new BooleanFieldEditor(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB,
+ MessagesForPreferences.GdbDebugPreferencePage_autoTerminateGdb_label, group2);
boolField.fillIntoGrid(group2, 3);
addField(boolField);
// Need to set layout again.
group2.setLayout(groupLayout);
- boolField= new BooleanFieldEditor(
- IGdbDebugPreferenceConstants.PREF_USE_INSPECTOR_HOVER,
- MessagesForPreferences.GdbDebugPreferencePage_useInspectorHover_label,
- group2);
+ boolField = new BooleanFieldEditor(IGdbDebugPreferenceConstants.PREF_USE_INSPECTOR_HOVER,
+ MessagesForPreferences.GdbDebugPreferencePage_useInspectorHover_label, group2);
boolField.fillIntoGrid(group2, 3);
addField(boolField);
// need to set layout again
group2.setLayout(groupLayout);
- boolField= new BooleanFieldEditor(
- IGdbDebugPreferenceConstants.PREF_HIDE_RUNNING_THREADS,
- MessagesForPreferences.GdbDebugPreferencePage_hideRunningThreads,
- group2);
+ boolField = new BooleanFieldEditor(IGdbDebugPreferenceConstants.PREF_HIDE_RUNNING_THREADS,
+ MessagesForPreferences.GdbDebugPreferencePage_hideRunningThreads, group2);
boolField.fillIntoGrid(group2, 3);
addField(boolField);
// Need to set layout again.
group2.setLayout(groupLayout);
- boolField= new BooleanFieldEditor(
- IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER,
- MessagesForPreferences.GdbDebugPreferencePage_useAggressiveBpFilter,
- group2);
+ boolField = new BooleanFieldEditor(IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER,
+ MessagesForPreferences.GdbDebugPreferencePage_useAggressiveBpFilter, group2);
boolField.fillIntoGrid(group2, 3);
addField(boolField);
// Need to set layout again.
group2.setLayout(groupLayout);
-
- boolField= new BooleanFieldEditor(
- IGdbDebugPreferenceConstants.PREF_TRACES_ENABLE,
- MessagesForPreferences.GdbDebugPreferencePage_enableTraces_label,
- group2);
+
+ boolField = new BooleanFieldEditor(IGdbDebugPreferenceConstants.PREF_TRACES_ENABLE,
+ MessagesForPreferences.GdbDebugPreferencePage_enableTraces_label, group2);
boolField.fillIntoGrid(group2, 1);
addField(boolField);
@@ -698,12 +675,11 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements
// couple the two fields using IntegerWithBooleanFieldEditor because
// we want the gdb traces limit to stay enabled even when the gdb traces
// are not actually shown (when the above preference is not selected).
- // The reason is that since the gdb traces record even when they are not
+ // The reason is that since the gdb traces record even when they are not
// shown, we want the user to be able to set the limit on those consoles,
// even if they are not currently shown.
final IntegerFieldEditor gdbTracesLimit = new IntegerFieldEditor(
- IGdbDebugPreferenceConstants.PREF_MAX_GDB_TRACES,
- "", // Empty title as we reuse the string of the previous field //$NON-NLS-1$
+ IGdbDebugPreferenceConstants.PREF_MAX_GDB_TRACES, "", // Empty title as we reuse the string of the previous field //$NON-NLS-1$
group2);
// Instead of using Integer.MAX_VALUE which is some obscure number,
@@ -714,10 +690,9 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements
// Need to set layout again.
group2.setLayout(groupLayout);
- boolField= new BooleanFieldEditor(
- IGdbDebugPreferenceConstants.PREF_USE_RTTI,
+ boolField = new BooleanFieldEditor(IGdbDebugPreferenceConstants.PREF_USE_RTTI,
MessagesForPreferences.GdbDebugPreferencePage_use_rtti_label1 + " \n" //$NON-NLS-1$
- + MessagesForPreferences.GdbDebugPreferencePage_use_rtti_label2,
+ + MessagesForPreferences.GdbDebugPreferencePage_use_rtti_label2,
group2);
boolField.fillIntoGrid(group2, 3);
@@ -734,7 +709,7 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements
final ListenableBooleanFieldEditor enablePrettyPrintingField = new ListenableBooleanFieldEditor(
IGdbDebugPreferenceConstants.PREF_ENABLE_PRETTY_PRINTING,
MessagesForPreferences.GdbDebugPreferencePage_enablePrettyPrinting_label1 + " \n" //$NON-NLS-1$
- + MessagesForPreferences.GdbDebugPreferencePage_enablePrettyPrinting_label2,
+ + MessagesForPreferences.GdbDebugPreferencePage_enablePrettyPrinting_label2,
SWT.NONE, group);
enablePrettyPrintingField.fillIntoGrid(group, 3);
@@ -749,14 +724,13 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements
final IntegerFieldEditor childCountLimitField = new IntegerFieldEditor(
IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS,
- MessagesForPreferences.GdbDebugPreferencePage_initialChildCountLimitForCollections_label,
- indentHelper);
+ MessagesForPreferences.GdbDebugPreferencePage_initialChildCountLimitForCollections_label, indentHelper);
childCountLimitField.setValidRange(1, 10000);
childCountLimitField.fillIntoGrid(indentHelper, 3);
- boolean prettyPrintingEnabled =
- getPreferenceStore().getBoolean(IGdbDebugPreferenceConstants.PREF_ENABLE_PRETTY_PRINTING);
+ boolean prettyPrintingEnabled = getPreferenceStore()
+ .getBoolean(IGdbDebugPreferenceConstants.PREF_ENABLE_PRETTY_PRINTING);
childCountLimitField.setEnabled(prettyPrintingEnabled, indentHelper);
addField(childCountLimitField);
@@ -790,9 +764,9 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements
}
private void handleAdvancedButtonSelected(String dialogTitle) {
- AdvancedTimeoutSettingsDialog dialog =
- new AdvancedTimeoutSettingsDialog( getShell(), fCustomTimeouts.entrySet() );
- if ( dialog.open() == Window.OK ) {
+ AdvancedTimeoutSettingsDialog dialog = new AdvancedTimeoutSettingsDialog(getShell(),
+ fCustomTimeouts.entrySet());
+ if (dialog.open() == Window.OK) {
fCustomTimeouts = dialog.getResult();
}
}
@@ -803,19 +777,19 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements
}
@Override
- public void propertyChange( PropertyChangeEvent event ) {
- if ( event.getSource().equals( fCommandTimeoutField ) && event.getNewValue() instanceof Boolean ) {
- fTimeoutAdvancedButton.setEnabled( ((Boolean)event.getNewValue()).booleanValue() );
+ public void propertyChange(PropertyChangeEvent event) {
+ if (event.getSource().equals(fCommandTimeoutField) && event.getNewValue() instanceof Boolean) {
+ fTimeoutAdvancedButton.setEnabled(((Boolean) event.getNewValue()).booleanValue());
}
- super.propertyChange( event );
+ super.propertyChange(event);
}
@Override
protected void performDefaults() {
IPreferenceStore store = getPreferenceStore();
- if ( store != null ) {
- String memento = store.getDefaultString( IGdbDebugPreferenceConstants.PREF_COMMAND_CUSTOM_TIMEOUTS );
- fCustomTimeouts.initializeFromMemento( memento );
+ if (store != null) {
+ String memento = store.getDefaultString(IGdbDebugPreferenceConstants.PREF_COMMAND_CUSTOM_TIMEOUTS);
+ fCustomTimeouts.initializeFromMemento(memento);
}
super.performDefaults();
updateTimeoutButtons();
@@ -823,19 +797,20 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements
@Override
public boolean performOk() {
- getPreferenceStore().setValue( IGdbDebugPreferenceConstants.PREF_COMMAND_CUSTOM_TIMEOUTS, fCustomTimeouts.getMemento() );
+ getPreferenceStore().setValue(IGdbDebugPreferenceConstants.PREF_COMMAND_CUSTOM_TIMEOUTS,
+ fCustomTimeouts.getMemento());
return super.performOk();
}
private void updateTimeoutButtons() {
- fTimeoutAdvancedButton.setEnabled( fCommandTimeoutField.getBooleanValue() );
+ fTimeoutAdvancedButton.setEnabled(fCommandTimeoutField.getBooleanValue());
}
private void initializeCustomTimeouts() {
IPreferenceStore store = getPreferenceStore();
- if ( store != null ) {
- String memento = store.getString( IGdbDebugPreferenceConstants.PREF_COMMAND_CUSTOM_TIMEOUTS );
- fCustomTimeouts.initializeFromMemento( memento );
+ if (store != null) {
+ String memento = store.getString(IGdbDebugPreferenceConstants.PREF_COMMAND_CUSTOM_TIMEOUTS);
+ fCustomTimeouts.initializeFromMemento(memento);
}
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.java
index 6a148e96ba1..1cfb06ae6e4 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.java
@@ -81,7 +81,7 @@ class MessagesForPreferences extends NLS {
public static String GdbConsolePreferencePage_BufferLines;
public static String GdbDebugPreferencePage_remoteTimeout_label;
public static String GdbDebugPreferencePage_remoteTimeout_tooltip;
-
+
static {
// initialize resource bundle
NLS.initializeMessages(MessagesForPreferences.class.getName(), MessagesForPreferences.class);
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/ReverseDebugPreferencePage.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/ReverseDebugPreferencePage.java
index 77cce5bc7bf..e37b76780c1 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/ReverseDebugPreferencePage.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/ReverseDebugPreferencePage.java
@@ -25,30 +25,30 @@ import org.eclipse.ui.IWorkbenchPreferencePage;
public class ReverseDebugPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
public ReverseDebugPreferencePage() {
- super( GRID );
+ super(GRID);
IPreferenceStore store = GdbUIPlugin.getDefault().getPreferenceStore();
- setPreferenceStore( store );
+ setPreferenceStore(store);
}
@Override
protected void createFieldEditors() {
- FieldEditor edit = new RadioGroupFieldEditor(
- IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_HARDWARE,
- MessagesForPreferences.ReverseDebugPreferencePage_SelectHardwareTracingMethod,
- 1,
+ FieldEditor edit = new RadioGroupFieldEditor(IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_HARDWARE,
+ MessagesForPreferences.ReverseDebugPreferencePage_SelectHardwareTracingMethod, 1,
new String[][] {
- {MessagesForPreferences.ReverseDebugPreferencePage_GDBPreference, IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_GDB_TRACE},
- {MessagesForPreferences.ReverseDebugPreferencePage_BranchTrace, IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_BRANCH_TRACE},
- {MessagesForPreferences.ReverseDebugPreferencePage_ProcessorTrace, 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 );
+ { MessagesForPreferences.ReverseDebugPreferencePage_GDBPreference,
+ IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_GDB_TRACE },
+ { MessagesForPreferences.ReverseDebugPreferencePage_BranchTrace,
+ IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_BRANCH_TRACE },
+ { MessagesForPreferences.ReverseDebugPreferencePage_ProcessorTrace,
+ 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 ) {
+ public void init(IWorkbench workbench) {
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/sync/GdbDebugContextSyncManager.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/sync/GdbDebugContextSyncManager.java
index 5adb8456672..58beed0fc57 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/sync/GdbDebugContextSyncManager.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/sync/GdbDebugContextSyncManager.java
@@ -50,9 +50,8 @@ public class GdbDebugContextSyncManager implements IDebugContextListener {
if (context != null) {
final IDMContext dmc = context.getAdapter(IDMContext.class);
- if (dmc instanceof IMIContainerDMContext ||
- dmc instanceof IMIExecutionDMContext ||
- dmc instanceof IFrameDMContext) {
+ if (dmc instanceof IMIContainerDMContext || dmc instanceof IMIExecutionDMContext
+ || dmc instanceof IFrameDMContext) {
// A process, thread or stack frame was selected. In each case, have GDB switch to the new
// corresponding thread, if required.
@@ -72,9 +71,9 @@ public class GdbDebugContextSyncManager implements IDebugContextListener {
eventSessionId);
IGDBFocusSynchronizer gdbSync = tracker.getService(IGDBFocusSynchronizer.class);
tracker.dispose();
-
+
if (gdbSync != null) {
- gdbSync.setFocus(new IDMContext[] {dmc}, new ImmediateRequestMonitor() {
+ gdbSync.setFocus(new IDMContext[] { dmc }, new ImmediateRequestMonitor() {
@Override
protected void handleFailure() {
// do not set error - it's normal in some cases to fail to switch thread
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/CollectActionPage.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/CollectActionPage.java
index f26c50ae600..c98e563ef1a 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/CollectActionPage.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/CollectActionPage.java
@@ -42,11 +42,12 @@ public class CollectActionPage extends PlatformObject implements IBreakpointActi
*/
private class IllegalCollectStringLimitException extends Exception {
private static final long serialVersionUID = -2087722354642237691L;
+
public IllegalCollectStringLimitException(String message) {
super(message);
}
}
-
+
private Text fCollectString;
private Button fTreatCharPtrAsStrings;
private Text fTreatCharPtrAsStringsLimit;
@@ -69,7 +70,7 @@ public class CollectActionPage extends PlatformObject implements IBreakpointActi
fCollectString = new Text(composite, SWT.BORDER);
fCollectString.setText(fCollectAction.getCollectString());
fCollectString.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
-
+
// An option to collect character pointers as strings
fTreatCharPtrAsStrings = new Button(composite, SWT.CHECK);
GridData gd = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
@@ -85,14 +86,15 @@ public class CollectActionPage extends PlatformObject implements IBreakpointActi
// Disable/enable the limit field
fTreatCharPtrAsStringsLimit.setEnabled(fTreatCharPtrAsStrings.getSelection());
}
+
@Override
public void widgetDefaultSelected(SelectionEvent e) {
// Disable/enable the limit field
fTreatCharPtrAsStringsLimit.setEnabled(fTreatCharPtrAsStrings.getSelection());
}
});
-
- // A label asking for an optional limit of bytes of collected strings
+
+ // A label asking for an optional limit of bytes of collected strings
final Label limitLabel = new Label(composite, SWT.NONE);
gd = new GridData(SWT.CENTER, SWT.CENTER, false, false);
gd.horizontalIndent = buttonWidth;
@@ -103,12 +105,13 @@ public class CollectActionPage extends PlatformObject implements IBreakpointActi
fTreatCharPtrAsStringsLimit = new Text(composite, SWT.BORDER);
fTreatCharPtrAsStringsLimit.setText(getCharPtrAsStringLimit(fCollectAction.getCharPtrAsStringsLimit()));
- gd = new GridData(SWT.FILL, SWT.CENTER, false, false);
- gd.horizontalIndent = FieldDecorationRegistry.getDefault().getMaximumDecorationWidth();
+ gd = new GridData(SWT.FILL, SWT.CENTER, false, false);
+ gd.horizontalIndent = FieldDecorationRegistry.getDefault().getMaximumDecorationWidth();
fTreatCharPtrAsStringsLimit.setLayoutData(gd);
fTreatCharPtrAsStringsLimit.setEnabled(fTreatCharPtrAsStrings.getSelection());
- final ControlDecoration decoration = new ControlDecoration(fTreatCharPtrAsStringsLimit, SWT.TOP | SWT.LEFT, composite );
+ final ControlDecoration decoration = new ControlDecoration(fTreatCharPtrAsStringsLimit, SWT.TOP | SWT.LEFT,
+ composite);
decoration.hide();
fTreatCharPtrAsStringsLimit.addModifyListener(new ModifyListener() {
@Override
@@ -117,16 +120,14 @@ public class CollectActionPage extends PlatformObject implements IBreakpointActi
getCharPtrAsStringLimit(fTreatCharPtrAsStringsLimit.getText());
decoration.hide();
} catch (IllegalCollectStringLimitException exception) {
- decoration.setImage(
- FieldDecorationRegistry.getDefault().getFieldDecoration(
- FieldDecorationRegistry.DEC_ERROR).getImage());
+ decoration.setImage(FieldDecorationRegistry.getDefault()
+ .getFieldDecoration(FieldDecorationRegistry.DEC_ERROR).getImage());
decoration.setDescriptionText(exception.getMessage());
decoration.show();
- }
+ }
}
});
-
return composite;
}
@@ -134,15 +135,15 @@ public class CollectActionPage extends PlatformObject implements IBreakpointActi
return fCollectAction;
}
- @Override
+ @Override
public void actionDialogCanceled() {
}
- @Override
+ @Override
public void actionDialogOK() {
fCollectAction.setCollectString(fCollectString.getText());
fCollectAction.setCharPtrAsStrings(fTreatCharPtrAsStrings.getSelection());
-
+
try {
Integer limit = getCharPtrAsStringLimit(fTreatCharPtrAsStringsLimit.getText());
fCollectAction.setCharPtrAsStringsLimit(limit);
@@ -151,43 +152,46 @@ public class CollectActionPage extends PlatformObject implements IBreakpointActi
}
}
- @Override
+ @Override
public Composite createComposite(IBreakpointAction action, Composite composite, int style) {
fCollectAction = (CollectAction) action;
return createCollectActionComposite(composite, style);
}
- /**
- * Convert the user-specified string into an integer.
- * If the string is not valid, disable the limit by using null.
- * @param limitStr The string provided by the user
- * @return An non-negative integer limit, or null for no limit.
- */
- private Integer getCharPtrAsStringLimit(String limitStr) throws IllegalCollectStringLimitException {
- limitStr = limitStr.trim();
- Integer limit = null;
+ /**
+ * Convert the user-specified string into an integer.
+ * If the string is not valid, disable the limit by using null.
+ * @param limitStr The string provided by the user
+ * @return An non-negative integer limit, or null for no limit.
+ */
+ private Integer getCharPtrAsStringLimit(String limitStr) throws IllegalCollectStringLimitException {
+ limitStr = limitStr.trim();
+ Integer limit = null;
try {
limit = Integer.parseInt(limitStr);
if (limit < 0) {
- throw new IllegalCollectStringLimitException(MessagesForTracepointActions.TracepointActions_Collect_Strings_Limit_Error);
+ throw new IllegalCollectStringLimitException(
+ MessagesForTracepointActions.TracepointActions_Collect_Strings_Limit_Error);
}
} catch (NumberFormatException e) {
if (!limitStr.isEmpty()) {
// We only accept an empty string, which means no limit
- throw new IllegalCollectStringLimitException(MessagesForTracepointActions.TracepointActions_Collect_Strings_Limit_Error);
+ throw new IllegalCollectStringLimitException(
+ MessagesForTracepointActions.TracepointActions_Collect_Strings_Limit_Error);
}
}
return limit;
- }
-
- /**
- * Convert the integer limit into a string.
- * If the string is not valid, disable the limit by using null.
- * @param limit The integer limit to convert. Can be null for no limit.
- * @return The limit as a string, where no limit or a negative limit is the empty string.
- */
- private String getCharPtrAsStringLimit(Integer limit) {
- if (limit == null || limit < 0) return ""; //$NON-NLS-1$
+ }
+
+ /**
+ * Convert the integer limit into a string.
+ * If the string is not valid, disable the limit by using null.
+ * @param limit The integer limit to convert. Can be null for no limit.
+ * @return The limit as a string, where no limit or a negative limit is the empty string.
+ */
+ private String getCharPtrAsStringLimit(Integer limit) {
+ if (limit == null || limit < 0)
+ return ""; //$NON-NLS-1$
return Integer.toString(limit);
- }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/EvaluateActionPage.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/EvaluateActionPage.java
index 5defe9f1a7e..330c9d6c687 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/EvaluateActionPage.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/EvaluateActionPage.java
@@ -46,25 +46,24 @@ public class EvaluateActionPage extends PlatformObject implements IBreakpointAct
fEvalString = new Text(composite, SWT.BORDER);
fEvalString.setText(fEvalAction.getEvalString());
fEvalString.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-
+
return composite;
}
-
public EvaluateAction getEvalAction() {
return fEvalAction;
}
- @Override
+ @Override
public void actionDialogCanceled() {
}
- @Override
+ @Override
public void actionDialogOK() {
fEvalAction.setEvalString(fEvalString.getText());
}
- @Override
+ @Override
public Composite createComposite(IBreakpointAction action, Composite composite, int style) {
fEvalAction = (EvaluateAction) action;
return createEvaluateActionComposite(composite, style);
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/MessagesForTracepointActions.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/MessagesForTracepointActions.java
index 13a0910fea5..510f0aef1e6 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/MessagesForTracepointActions.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/MessagesForTracepointActions.java
@@ -21,7 +21,7 @@ import org.eclipse.osgi.util.NLS;
* @since 2.1
*/
class MessagesForTracepointActions extends NLS {
- private static final String BUNDLE_NAME= "org.eclipse.cdt.dsf.gdb.internal.ui.tracepointactions.messages"; //$NON-NLS-1$
+ private static final String BUNDLE_NAME = "org.eclipse.cdt.dsf.gdb.internal.ui.tracepointactions.messages"; //$NON-NLS-1$
public static String TracepointActions_Actions_for_this_tracepoint;
public static String TracepointActions_Available_actions;
@@ -46,7 +46,7 @@ class MessagesForTracepointActions extends NLS {
public static String TracepointActions_Collect_Strings_Label;
public static String TracepointActions_Collect_Strings_Limit_Label;
public static String TracepointActions_Collect_Strings_Limit_Error;
-
+
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, MessagesForTracepointActions.class);
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/TracepointActionDialog.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/TracepointActionDialog.java
index 71dd27a68f0..09ec33f5b62 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/TracepointActionDialog.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/TracepointActionDialog.java
@@ -63,8 +63,8 @@ public class TracepointActionDialog extends Dialog {
private static final String TRACEPOINT_ACTION_DIALOG_LAST_SELECTED = "TracepointActionDialog.lastSelectedAction"; //$NON-NLS-1$
private static final int TRACEPOINT_ACTIONS_COUNT = 3;
-
- private Composite actionArea;
+
+ private Composite actionArea;
private Composite[] actionComposites;
private ITracepointAction tracepointAction;
private IBreakpointActionPage actionPage;
@@ -77,20 +77,20 @@ public class TracepointActionDialog extends Dialog {
private int lastSelectedActionTypeIndex;
private IBreakpointAction originalAction;
private boolean isSubAction;
-
+
// If this dialog is for a "while-stepping" action, we keep track
// of the parent global list, so that it can be updated.
private TracepointGlobalActionsList parentGlobalList;
private IExtension[] breakpointActionPageExtensions;
-
+
private static final Point MINIMUM_SIZE = new Point(440, 540);
/**
* Create the dialog
*/
- public TracepointActionDialog(Shell parentShell, ITracepointAction action,
- TracepointGlobalActionsList parentList, boolean isSub) {
+ public TracepointActionDialog(Shell parentShell, ITracepointAction action, TracepointGlobalActionsList parentList,
+ boolean isSub) {
super(parentShell);
setShellStyle(getShellStyle() | SWT.MAX | SWT.RESIZE);
originalAction = action;
@@ -161,14 +161,16 @@ public class TracepointActionDialog extends Dialog {
tracepointActions.add(new CollectAction());
tracepointActions.add(new EvaluateAction());
// Sub actions of whileStepping cannot be whileStepping
- if (!isSubAction) tracepointActions.add(new WhileSteppingAction());
-
+ if (!isSubAction)
+ tracepointActions.add(new WhileSteppingAction());
+
actionPages = new IBreakpointActionPage[TRACEPOINT_ACTIONS_COUNT];
actionComposites = new Composite[TRACEPOINT_ACTIONS_COUNT];
if (!tracepointActions.isEmpty()) {
- String lastTypeName = GdbUIPlugin.getDefault().getPreferenceStore().getString(TRACEPOINT_ACTION_DIALOG_LAST_SELECTED);
+ String lastTypeName = GdbUIPlugin.getDefault().getPreferenceStore()
+ .getString(TRACEPOINT_ACTION_DIALOG_LAST_SELECTED);
if (tracepointAction != null) {
lastTypeName = tracepointAction.getTypeName();
@@ -177,17 +179,17 @@ public class TracepointActionDialog extends Dialog {
for (int i = 0; i < tracepointActions.size(); i++) {
tracepointActions.get(i).setName(tracepointActions.get(i).getDefaultName());
- String actionTypeName = tracepointActions.get(i).getTypeName();
+ String actionTypeName = tracepointActions.get(i).getTypeName();
combo.add(actionTypeName);
if (actionTypeName.equals(lastTypeName)) {
lastSelectedActionTypeIndex = i;
if (tracepointAction != null) {
tracepointActions.add(i, tracepointAction);
- tracepointActions.remove(i+1);
+ tracepointActions.remove(i + 1);
}
}
}
-
+
combo.select(lastSelectedActionTypeIndex);
if (originalAction != null)
combo.setEnabled(false);
@@ -224,7 +226,8 @@ public class TracepointActionDialog extends Dialog {
@Override
protected void okPressed() {
if (originalAction == null)
- GdbUIPlugin.getDefault().getPreferenceStore().setValue(TRACEPOINT_ACTION_DIALOG_LAST_SELECTED, tracepointAction.getTypeName());
+ GdbUIPlugin.getDefault().getPreferenceStore().setValue(TRACEPOINT_ACTION_DIALOG_LAST_SELECTED,
+ tracepointAction.getTypeName());
String newName = actionNameTextWidget.getText();
if (originalAction == null || !originalAction.getName().equals(newName)) {
actionName = TracepointActionManager.getInstance().makeUniqueActionName(newName);
@@ -245,11 +248,12 @@ public class TracepointActionDialog extends Dialog {
actionPages[selectedTypeIndex] = getActionPage(tracepointActions.get(selectedTypeIndex));
actionPage = actionPages[selectedTypeIndex];
if (actionPage instanceof WhileSteppingActionPage) {
- ((WhileSteppingActionPage)actionPage).setParentGlobalList(parentGlobalList);
+ ((WhileSteppingActionPage) actionPage).setParentGlobalList(parentGlobalList);
}
}
if (actionComposites[selectedTypeIndex] == null) {
- Composite actionComposite = actionPages[selectedTypeIndex].createComposite(tracepointAction, actionArea, SWT.NONE);
+ Composite actionComposite = actionPages[selectedTypeIndex].createComposite(tracepointAction, actionArea,
+ SWT.NONE);
actionComposites[selectedTypeIndex] = actionComposite;
}
actionName = tracepointAction.getName();
@@ -262,7 +266,8 @@ public class TracepointActionDialog extends Dialog {
public IExtension[] getBreakpointActionPageExtensions() {
if (breakpointActionPageExtensions == null) {
- IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(CDebugUIPlugin.PLUGIN_ID, BREAKPOINT_ACTION_PAGE_EXTENSION_POINT_ID);
+ IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(CDebugUIPlugin.PLUGIN_ID,
+ BREAKPOINT_ACTION_PAGE_EXTENSION_POINT_ID);
if (point == null)
breakpointActionPageExtensions = new IExtension[0];
else {
@@ -296,22 +301,20 @@ public class TracepointActionDialog extends Dialog {
return actionPageResult;
}
-
private void addDecorator(Composite parent, final Text control) {
- GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
- gd.horizontalIndent = FieldDecorationRegistry.getDefault().getMaximumDecorationWidth();
+ GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ gd.horizontalIndent = FieldDecorationRegistry.getDefault().getMaximumDecorationWidth();
control.setLayoutData(gd);
- final ControlDecoration decoration = new ControlDecoration(control, SWT.TOP | SWT.LEFT, parent );
+ final ControlDecoration decoration = new ControlDecoration(control, SWT.TOP | SWT.LEFT, parent);
decoration.hide();
control.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
String name = control.getText();
if (name.trim().isEmpty()) {
- decoration.setImage(
- FieldDecorationRegistry.getDefault().getFieldDecoration(
- FieldDecorationRegistry.DEC_ERROR).getImage());
+ decoration.setImage(FieldDecorationRegistry.getDefault()
+ .getFieldDecoration(FieldDecorationRegistry.DEC_ERROR).getImage());
decoration.setDescriptionText(Messages.getString("ActionDialog.ErrEmptyName")); //$NON-NLS-1$
decoration.show();
} else {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/TracepointActionsList.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/TracepointActionsList.java
index ad29c8a3adc..87b09b6fa2e 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/TracepointActionsList.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/TracepointActionsList.java
@@ -204,9 +204,9 @@ public class TracepointActionsList extends Composite {
int[] selectedItems = table.getSelectionIndices();
removeButton.setEnabled(selectedItems.length > 0);
downButton.setEnabled(selectedItems.length == 1 && selectedItems[0] < (table.getItemCount() - 1));
- upButton.setEnabled(selectedItems.length == 1 && selectedItems[0] > 0);
+ upButton.setEnabled(selectedItems.length == 1 && selectedItems[0] > 0);
}
-
+
/**
* Update the appearance of given action.
* @param action
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/TracepointActionsPreferencePage.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/TracepointActionsPreferencePage.java
index 5c271ba3669..85a36699346 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/TracepointActionsPreferencePage.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/TracepointActionsPreferencePage.java
@@ -47,8 +47,10 @@ public class TracepointActionsPreferencePage extends PreferencePage implements I
container.setLayout(gridLayout);
final Label breakpointActionsAvailableLabel = new Label(container, SWT.NONE);
- breakpointActionsAvailableLabel.setText(MessagesForTracepointActions.TracepointActions_Preferences_Actions_Available);
- final TracepointGlobalActionsList actionsList = new TracepointGlobalActionsList(container, SWT.NONE, false, null, false);
+ breakpointActionsAvailableLabel
+ .setText(MessagesForTracepointActions.TracepointActions_Preferences_Actions_Available);
+ final TracepointGlobalActionsList actionsList = new TracepointGlobalActionsList(container, SWT.NONE, false,
+ null, false);
actionsList.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
actionsList.getDeleteButton().addSelectionListener(new SelectionAdapter() {
@@ -57,14 +59,13 @@ public class TracepointActionsPreferencePage extends PreferencePage implements I
actionsList.HandleDeleteButton();
}
});
- String helpContextID = GdbUIPlugin.PLUGIN_ID + "." + contextHelpID; //$NON-NLS-1$
+ String helpContextID = GdbUIPlugin.PLUGIN_ID + "." + contextHelpID; //$NON-NLS-1$
PlatformUI.getWorkbench().getHelpSystem().setHelp(super.getControl(), helpContextID);
return container;
}
-
- @Override
+ @Override
public void init(IWorkbench workbench) {
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/TracepointActionsPropertyPage.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/TracepointActionsPropertyPage.java
index 0f9a898b9f8..6db87e98122 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/TracepointActionsPropertyPage.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/TracepointActionsPropertyPage.java
@@ -31,7 +31,7 @@ import org.eclipse.ui.dialogs.PropertyPage;
/**
* Property page for Tracepoint actions
- *
+ *
* @since 2.1
*/
public class TracepointActionsPropertyPage extends PropertyPage {
@@ -89,7 +89,7 @@ public class TracepointActionsPropertyPage extends PropertyPage {
// connect attached actions list to global list
globalActionsList.setClientList(actionsList);
-
+
globalActionsList.getAttachButton().addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
@@ -117,7 +117,7 @@ public class TracepointActionsPropertyPage extends PropertyPage {
/**
* Clean up attached actions that were just deleted from the GlobalActionList
- *
+ *
* @since 7.0
*/
protected void HandleDeleteButton() {
@@ -150,7 +150,8 @@ public class TracepointActionsPropertyPage extends PropertyPage {
public boolean performOk() {
try {
TracepointActionManager.getInstance().saveActionData();
- tracepointMarker.setAttribute(BreakpointActionManager.BREAKPOINT_ACTION_ATTRIBUTE, actionsList.getActionNames());
+ tracepointMarker.setAttribute(BreakpointActionManager.BREAKPOINT_ACTION_ATTRIBUTE,
+ actionsList.getActionNames());
} catch (CoreException e) {
}
return super.performOk();
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/TracepointGlobalActionsList.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/TracepointGlobalActionsList.java
index 4edd3f2b060..e0fbf34091f 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/TracepointGlobalActionsList.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/TracepointGlobalActionsList.java
@@ -43,17 +43,18 @@ public class TracepointGlobalActionsList extends Composite {
private Table table;
private TracepointActionsList clientList;
private boolean isSubAction;
-
+
// When dealing with a "while-stepping" action, we deal with a "child" global
// list, and must keep track of the parent global list, to properly update it.
// This field will be null when the this class represents the parent class itself.
private TracepointGlobalActionsList parentGlobalList;
- public TracepointGlobalActionsList(Composite parent, int style, boolean useAttachButton, TracepointGlobalActionsList parentList, boolean isSub) {
+ public TracepointGlobalActionsList(Composite parent, int style, boolean useAttachButton,
+ TracepointGlobalActionsList parentList, boolean isSub) {
super(parent, style);
isSubAction = isSub;
parentGlobalList = parentList;
-
+
final GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 5;
setLayout(gridLayout);
@@ -64,6 +65,7 @@ public class TracepointGlobalActionsList extends Composite {
public void widgetSelected(SelectionEvent e) {
updateButtons();
}
+
@Override
public void widgetDefaultSelected(SelectionEvent e) {
HandleEditButton();
@@ -91,7 +93,8 @@ public class TracepointGlobalActionsList extends Composite {
ArrayList<ITracepointAction> actions = TracepointActionManager.getInstance().getActions();
for (ITracepointAction element : actions) {
- if (isSubAction && element instanceof WhileSteppingAction) continue;
+ if (isSubAction && element instanceof WhileSteppingAction)
+ continue;
final TableItem tableItem = new TableItem(table, SWT.NONE);
tableItem.setText(0, element.getName());
tableItem.setText(1, element.getTypeName());
@@ -133,7 +136,7 @@ public class TracepointGlobalActionsList extends Composite {
deleteButton = new Button(this, SWT.NONE);
deleteButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
deleteButton.setText(MessagesForTracepointActions.TracepointActions_Delete);
-
+
updateButtons();
}
@@ -176,7 +179,7 @@ public class TracepointGlobalActionsList extends Composite {
}
updateButtons();
}
-
+
void removeAction(ITracepointAction action) {
TableItem[] currentItems = table.getItems();
for (int i = 0; i < currentItems.length; i++) {
@@ -188,7 +191,7 @@ public class TracepointGlobalActionsList extends Composite {
break;
}
}
- updateButtons();
+ updateButtons();
}
protected void HandleEditButton() {
@@ -219,11 +222,11 @@ public class TracepointGlobalActionsList extends Composite {
TracepointActionDialog dialog = new TracepointActionDialog(this.getShell(), null, this, isSubAction);
int result = dialog.open();
if (result == Window.OK) {
- ITracepointAction action = (ITracepointAction)dialog.getTracepointAction();
+ ITracepointAction action = (ITracepointAction) dialog.getTracepointAction();
action.setName(dialog.getActionName());
TracepointActionManager.getInstance().addAction(action);
addAction(action);
-
+
if (parentGlobalList != null) {
assert isSubAction;
// Update the parent list also
@@ -239,7 +242,7 @@ public class TracepointGlobalActionsList extends Composite {
tableItem.setText(2, action.getSummary());
tableItem.setData(action);
}
-
+
public void updateButtons() {
TableItem[] selectedItems = table.getSelection();
if (attachButton != null)
@@ -247,7 +250,7 @@ public class TracepointGlobalActionsList extends Composite {
deleteButton.setEnabled(selectedItems.length > 0);
editButton.setEnabled(selectedItems.length == 1);
}
-
+
/**
* Register client list to be notified of changes to actions.
* @param actionsList
@@ -255,7 +258,7 @@ public class TracepointGlobalActionsList extends Composite {
void setClientList(TracepointActionsList actionsList) {
clientList = actionsList;
}
-
+
/**
* Update the appearance of given action.
* @param action
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/WhileSteppingActionPage.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/WhileSteppingActionPage.java
index 4837e3d18f0..887bc452787 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/WhileSteppingActionPage.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/WhileSteppingActionPage.java
@@ -44,7 +44,7 @@ public class WhileSteppingActionPage extends PlatformObject implements IBreakpoi
* Create the composite
*/
private Composite createWhileSteppingActionComposite(Composite parent, int style) {
-
+
Composite composite = new Composite(parent, SWT.NULL);
composite.setLayout(new GridLayout(2, false));
@@ -58,7 +58,7 @@ public class WhileSteppingActionPage extends PlatformObject implements IBreakpoi
final Label actionsTriggeredWhenLabel = new Label(composite, SWT.NONE);
actionsTriggeredWhenLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
- actionsTriggeredWhenLabel.setText(MessagesForTracepointActions.TracepointActions_WhileStepping_Sub_Actions);
+ actionsTriggeredWhenLabel.setText(MessagesForTracepointActions.TracepointActions_WhileStepping_Sub_Actions);
actionsList = new TracepointActionsList(composite, SWT.NONE);
GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
@@ -117,24 +117,24 @@ public class WhileSteppingActionPage extends PlatformObject implements IBreakpoi
/**
* Clean up attached actions that were just deleted from the GlobalActionList
- *
+ *
* @since 7.0
*/
protected void HandleDeleteButton() {
// attached actions are now handled by the GlobalActionsList
-
+
globalActionsList.HandleDeleteButton();
}
-
+
public WhileSteppingAction getWhileSteppingAction() {
return fWhileSteppingAction;
}
- @Override
+ @Override
public void actionDialogCanceled() {
}
- @Override
+ @Override
public void actionDialogOK() {
// Make sure we are dealing with an int
int count = 1;
@@ -148,13 +148,13 @@ public class WhileSteppingActionPage extends PlatformObject implements IBreakpoi
fWhileSteppingAction.setSubActionsContent(actionsList.getActionNames());
}
- @Override
+ @Override
public Composite createComposite(IBreakpointAction action, Composite composite, int style) {
- fWhileSteppingAction = (WhileSteppingAction)action;
+ fWhileSteppingAction = (WhileSteppingAction) action;
return createWhileSteppingActionComposite(composite, style);
}
-
- void setParentGlobalList(TracepointGlobalActionsList list) {
- parentGlobalActionsList = list;
- }
+
+ void setParentGlobalList(TracepointGlobalActionsList list) {
+ parentGlobalActionsList = list;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/AbstractImageRegistry.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/AbstractImageRegistry.java
index c107482a4c9..2b506899f72 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/AbstractImageRegistry.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/AbstractImageRegistry.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -31,7 +31,7 @@ import org.osgi.framework.Bundle;
/**
* Abstract image registry that allows for defining fallback paths for images.
* This is copy of <code>org.eclipse.cdt.dsf.debug.internal.ui.disassembly.AbstractImageRegistry</code>
- *
+ *
* @since 2.1
*/
public abstract class AbstractImageRegistry extends ImageRegistry {
@@ -42,7 +42,7 @@ public abstract class AbstractImageRegistry extends ImageRegistry {
protected AbstractImageRegistry(Plugin plugin) {
fBaseUrl = plugin.getBundle().getEntry("/"); //$NON-NLS-1$
}
-
+
/**
* Defines the key for a local image, that must be found below the icons directory
* in the plugin.
@@ -52,10 +52,10 @@ public abstract class AbstractImageRegistry extends ImageRegistry {
* key.
*/
protected void localImage(String key, String dir, String name) {
- if (dir== null || dir.isEmpty())
- fLocations.put(key, new String[] {"icons/" + name}); //$NON-NLS-1$
+ if (dir == null || dir.isEmpty())
+ fLocations.put(key, new String[] { "icons/" + name }); //$NON-NLS-1$
else
- fLocations.put(key, new String[] {"icons/" + dir + "/" + name}); //$NON-NLS-1$ //$NON-NLS-2$
+ fLocations.put(key, new String[] { "icons/" + dir + "/" + name }); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
@@ -69,62 +69,62 @@ public abstract class AbstractImageRegistry extends ImageRegistry {
* key.
*/
protected void externalImage(String key, String plugin, String[] dirs, String name) {
- if (plugin != null) {
- fPlugins.put(key, plugin);
- }
- String[] locations = new String[dirs.length];
- for (int i = 0; i < dirs.length; i++) {
+ if (plugin != null) {
+ fPlugins.put(key, plugin);
+ }
+ String[] locations = new String[dirs.length];
+ for (int i = 0; i < dirs.length; i++) {
String dir = dirs[i];
- if (dir== null || dir.isEmpty())
+ if (dir == null || dir.isEmpty())
locations[i] = "icons/" + name; //$NON-NLS-1$
else
locations[i] = "icons/" + dir + "/" + name; //$NON-NLS-1$ //$NON-NLS-2$
- }
- fLocations.put(key, locations);
+ }
+ fLocations.put(key, locations);
}
-
+
// overrider
@Override
final public Image get(String key) {
- Image i = super.get(key);
- if (i != null) {
- return i;
- }
-
- ImageDescriptor d = createFileImageDescriptor(key);
- if (d != null) {
- put(key, d);
- return super.get(key);
- }
- return null;
+ Image i = super.get(key);
+ if (i != null) {
+ return i;
+ }
+
+ ImageDescriptor d = createFileImageDescriptor(key);
+ if (d != null) {
+ put(key, d);
+ return super.get(key);
+ }
+ return null;
}
// overrider
@Override
final public ImageDescriptor getDescriptor(String key) {
- ImageDescriptor d = super.getDescriptor(key);
- if (d != null) {
- return d;
- }
-
- d = createFileImageDescriptor(key);
- if (d != null) {
- put(key, d);
- return d;
- }
- return null;
+ ImageDescriptor d = super.getDescriptor(key);
+ if (d != null) {
+ return d;
+ }
+
+ d = createFileImageDescriptor(key);
+ if (d != null) {
+ put(key, d);
+ return d;
+ }
+ return null;
}
private ImageDescriptor createFileImageDescriptor(String key) {
URL url = fBaseUrl;
String pluginId = fPlugins.get(key);
if (pluginId != null) {
- Bundle bundle= Platform.getBundle(pluginId);
+ Bundle bundle = Platform.getBundle(pluginId);
if (bundle != null) {
url = bundle.getEntry("/"); //$NON-NLS-1$
}
}
- String[] locations= fLocations.get(key);
+ String[] locations = fLocations.get(key);
if (locations != null) {
for (int i = 0; i < locations.length; i++) {
String loc = locations[i];
@@ -136,13 +136,14 @@ public abstract class AbstractImageRegistry extends ImageRegistry {
return candidate;
}
} catch (MalformedURLException e) {
- GdbUIPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, "Malformed Icon URL", e)); //$NON-NLS-1$
+ GdbUIPlugin.getDefault().getLog()
+ .log(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, "Malformed Icon URL", e)); //$NON-NLS-1$
} catch (SWTException e) {
// try the next one.
}
}
}
- return null;
+ return null;
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/CircularProgress.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/CircularProgress.java
index e060151c367..e8bcba1a041 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/CircularProgress.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/CircularProgress.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Dmitry Kozlov (Mentor Graphics) - initial API and implementation
*******************************************************************************/
@@ -23,16 +23,15 @@ import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
public class CircularProgress extends Canvas {
-
- private static final String PERCENT_SIGN = "%"; //$NON-NLS-1$
- private static final String PERCENT_TEXT = "100%"; //$NON-NLS-1$
+
+ private static final String PERCENT_SIGN = "%"; //$NON-NLS-1$
+ private static final String PERCENT_TEXT = "100%"; //$NON-NLS-1$
private static final int PROGRESS_WIDTH = 8;
private static final int PROGRESS_MARGIN = 2;
private static final int PROGRESS_ARC = 15;
- final protected int[] fBufferProgressMeasure = {0};
+ final protected int[] fBufferProgressMeasure = { 0 };
- public CircularProgress(Composite parent, int flags)
- {
+ public CircularProgress(Composite parent, int flags) {
super(parent, flags);
addPaintListener(new PaintListener() {
@@ -44,27 +43,27 @@ public class CircularProgress extends Canvas {
GC gc = new GC(this);
Point e = gc.textExtent(PERCENT_TEXT);
- int size = e.x + 8 * PROGRESS_MARGIN + 2 * PROGRESS_WIDTH;
+ int size = e.x + 8 * PROGRESS_MARGIN + 2 * PROGRESS_WIDTH;
setBounds(0, 0, size, size);
}
-
+
/**
* Set progress as number of percent (0-100)
*/
public void setProgress(int progress) {
fBufferProgressMeasure[0] = progress;
}
-
+
@Override
public Point computeSize(int wHint, int hHint, boolean changed) {
return computeSize(wHint, hHint);
}
-
+
@Override
public Point computeSize(int wHint, int hHint) {
return new Point(getBounds().width, getBounds().height);
}
-
+
private void onPaint(PaintEvent e) {
Rectangle clientArea = getClientArea();
int margin = PROGRESS_MARGIN;
@@ -72,10 +71,11 @@ public class CircularProgress extends Canvas {
e.gc.setBackground(getParent().getBackground());
e.gc.fillRectangle(0, 0, clientArea.width, clientArea.height);
e.gc.setBackground(getParent().getDisplay().getSystemColor(SWT.COLOR_GRAY));
- e.gc.fillOval(margin, margin, clientArea.width-2*margin, clientArea.height-2*margin);
+ e.gc.fillOval(margin, margin, clientArea.width - 2 * margin, clientArea.height - 2 * margin);
e.gc.setBackground(getParent().getBackground());
- e.gc.fillOval(margin+width, margin+width, clientArea.width-2*(margin+width), clientArea.height-2*(margin+width));
-
+ e.gc.fillOval(margin + width, margin + width, clientArea.width - 2 * (margin + width),
+ clientArea.height - 2 * (margin + width));
+
String progress;
e.gc.setBackground(getParent().getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION));
@@ -83,24 +83,26 @@ public class CircularProgress extends Canvas {
// Draw usual progress bar and text value in %
progress = fBufferProgressMeasure[0] + PERCENT_SIGN;
int n = (int) (fBufferProgressMeasure[0] * 3.6);
- e.gc.fillArc(margin, margin, clientArea.width-2*margin, clientArea.height-2*margin, 90 , -n );
+ e.gc.fillArc(margin, margin, clientArea.width - 2 * margin, clientArea.height - 2 * margin, 90, -n);
} else {
// Draw constantly moving progress without exact value and text value 100%
progress = PERCENT_TEXT;
int n = (int) ((fBufferProgressMeasure[0] % 100) * 3.6);
// Fill in the full buffer first
- e.gc.fillOval(margin, margin, clientArea.width-2*margin, clientArea.height-2*margin);
+ e.gc.fillOval(margin, margin, clientArea.width - 2 * margin, clientArea.height - 2 * margin);
// Move progress bar within the buffer
e.gc.setBackground(getParent().getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
- e.gc.fillArc(margin, margin, clientArea.width-2*margin, clientArea.height-2*margin, 90 - n - PROGRESS_ARC, - PROGRESS_ARC );
+ e.gc.fillArc(margin, margin, clientArea.width - 2 * margin, clientArea.height - 2 * margin,
+ 90 - n - PROGRESS_ARC, -PROGRESS_ARC);
}
e.gc.setBackground(getParent().getBackground());
- e.gc.fillOval(margin+width, margin+width, clientArea.width-2*(margin+width), clientArea.width-2*(margin+width));
+ e.gc.fillOval(margin + width, margin + width, clientArea.width - 2 * (margin + width),
+ clientArea.width - 2 * (margin + width));
// Progress % in the text form
e.gc.setForeground(getParent().getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND));
e.gc.setFont(getParent().getDisplay().getSystemFont());
Point p = e.gc.textExtent(progress);
- e.gc.drawText(progress,(clientArea.width - p.x)/2 + 1,(clientArea.height-p.y)/2);
+ e.gc.drawText(progress, (clientArea.width - p.x) / 2 + 1, (clientArea.height - p.y) / 2);
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/FlatButton.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/FlatButton.java
index a41a58f9e69..d1d0f2a1673 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/FlatButton.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/FlatButton.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Vladimir Prus (Mentor Graphics) - initial API and implementation
* Dmitry Kozlov (Mentor Graphics) - extend to be inheritance-friendly
@@ -31,14 +31,14 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.TypedListener;
public class FlatButton extends Canvas {
-
+
protected String fText;
protected int fMargin = 4;
protected Cursor fHandCursor;
-
+
public FlatButton(Composite parent, int flags) {
super(parent, flags);
-
+
fHandCursor = getDisplay().getSystemCursor(SWT.CURSOR_HAND);
setCursor(fHandCursor);
@@ -54,48 +54,48 @@ public class FlatButton extends Canvas {
public void mouseDown(MouseEvent e) {
onSelection(e);
}
- });
+ });
}
-
- public void addSelectionListener (SelectionListener listener) {
- checkWidget ();
- if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
+
+ public void addSelectionListener(SelectionListener listener) {
+ checkWidget();
+ if (listener == null)
+ SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener(listener);
+ addListener(SWT.Selection, typedListener);
+ addListener(SWT.DefaultSelection, typedListener);
}
-
+
public void setText(String text) {
fText = text;
}
-
- public String getText() {
+
+ public String getText() {
return fText;
}
-
+
public void setMargin(int margin) {
fMargin = margin;
}
-
+
@Override
public Point computeSize(int wHint, int hHint, boolean changed) {
return computeSize(wHint, hHint);
}
-
+
@Override
public Point computeSize(int wHint, int hHint) {
-
+
GC gc = new GC(this);
if (fText == null || fText.isEmpty()) {
Point e = gc.textExtent("A"); //$NON-NLS-1$
- return new Point(0, e.y + fMargin*2);
+ return new Point(0, e.y + fMargin * 2);
}
-
-
+
Point e = gc.textExtent(fText);
- return new Point(e.x + fMargin*2, e.y + fMargin*2);
+ return new Point(e.x + fMargin * 2, e.y + fMargin * 2);
}
-
+
protected void onPaint(PaintEvent event) {
GC gc = event.gc;
Rectangle ca = getClientArea();
@@ -106,29 +106,28 @@ public class FlatButton extends Canvas {
float h = mainHSB[0];
float s = mainHSB[1];
float b = mainHSB[2];
-
-
- Color borderColor = new Color(gc.getDevice(), new RGB(h, s, (float)(b*0.7)));
- Color shadowColor = new Color(gc.getDevice(), new RGB(h, s, (float)(b*0.5)));
-
+
+ Color borderColor = new Color(gc.getDevice(), new RGB(h, s, (float) (b * 0.7)));
+ Color shadowColor = new Color(gc.getDevice(), new RGB(h, s, (float) (b * 0.5)));
+
gc.setForeground(borderColor);
- gc.drawRectangle(0, 0, ca.width-1, ca.height-1);
-
+ gc.drawRectangle(0, 0, ca.width - 1, ca.height - 1);
+
gc.setForeground(shadowColor);
- gc.drawLine(0, ca.height-1, ca.width-1, ca.height-1);
-
- gc.fillRectangle(1, 1, ca.width-2, ca.height-2);
-
+ gc.drawLine(0, ca.height - 1, ca.width - 1, ca.height - 1);
+
+ gc.fillRectangle(1, 1, ca.width - 2, ca.height - 2);
+
gc.setForeground(gc.getDevice().getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT));
gc.drawText(fText, fMargin, fMargin, true);
-
+
borderColor.dispose();
shadowColor.dispose();
}
-
+
protected void onSelection(MouseEvent e) {
if (isEnabled()) {
notifyListeners(SWT.Selection, null);
- }
+ }
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/FlatRadioButton.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/FlatRadioButton.java
index 28109f9c49d..2dab6b20179 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/FlatRadioButton.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/FlatRadioButton.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Dmitry Kozlov (Mentor Graphics) - initial API and implementation
*******************************************************************************/
@@ -24,7 +24,7 @@ import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Composite;
public class FlatRadioButton extends FlatButton {
-
+
protected static final String STATE_OFF_LABEL = "OFF"; //$NON-NLS-1$
protected static final String STATE_ON_LABEL = "ON"; //$NON-NLS-1$
@@ -33,21 +33,21 @@ public class FlatRadioButton extends FlatButton {
public FlatRadioButton(Composite parent, int flags) {
super(parent, flags);
}
-
+
@Override
public Point computeSize(int wHint, int hHint) {
GC gc = new GC(this);
if (fText == null || fText.isEmpty()) {
Point e = gc.textExtent("A"); //$NON-NLS-1$
- return new Point(0, e.y + fMargin*2);
+ return new Point(0, e.y + fMargin * 2);
}
Point e = gc.textExtent(fText);
Point pOn = gc.textExtent(STATE_ON_LABEL);
Point pOff = gc.textExtent(STATE_OFF_LABEL);
int h = Math.max(pOn.y, pOff.y);
- return new Point(e.x + fMargin*4 + Math.max(pOn.x, pOff.x), Math.max(e.y, h) + fMargin*2 );
+ return new Point(e.x + fMargin * 4 + Math.max(pOn.x, pOff.x), Math.max(e.y, h) + fMargin * 2);
}
@Override
@@ -63,16 +63,16 @@ public class FlatRadioButton extends FlatButton {
float b = mainHSB[2];
Point e = gc.textExtent(fText);
- Color borderColor = new Color(gc.getDevice(), new RGB(h, s, (float)(b*0.7)));
- Color shadowColor = new Color(gc.getDevice(), new RGB(h, s, (float)(b*0.5)));
+ Color borderColor = new Color(gc.getDevice(), new RGB(h, s, (float) (b * 0.7)));
+ Color shadowColor = new Color(gc.getDevice(), new RGB(h, s, (float) (b * 0.5)));
gc.setForeground(borderColor);
- gc.drawRectangle(0, 0, ca.width-1, ca.height-1);
+ gc.drawRectangle(0, 0, ca.width - 1, ca.height - 1);
gc.setForeground(shadowColor);
- gc.drawLine(0, ca.height-1, ca.width-1, ca.height-1);
+ gc.drawLine(0, ca.height - 1, ca.width - 1, ca.height - 1);
- gc.fillRectangle(e.x + fMargin*2 , 1, ca.width - 1 - e.x - fMargin*2 , ca.height-2);
+ gc.fillRectangle(e.x + fMargin * 2, 1, ca.width - 1 - e.x - fMargin * 2, ca.height - 2);
gc.setForeground(gc.getDevice().getSystemColor(SWT.COLOR_LIST_FOREGROUND));
gc.drawText(fText, fMargin, fMargin, true);
@@ -81,11 +81,11 @@ public class FlatRadioButton extends FlatButton {
Point pOn = gc.textExtent(STATE_ON_LABEL);
Point pOff = gc.textExtent(STATE_OFF_LABEL);
if (selection) {
- int offset = pOn.x < pOff.x ? (pOff.x - pOn.x)/2 : 0;
- gc.drawText(STATE_ON_LABEL , e.x + fMargin*3 + offset, fMargin);
+ int offset = pOn.x < pOff.x ? (pOff.x - pOn.x) / 2 : 0;
+ gc.drawText(STATE_ON_LABEL, e.x + fMargin * 3 + offset, fMargin);
} else {
- int offset = pOn.x < pOff.x ? 0 : (pOn.x - pOff.x)/2 ;
- gc.drawText(STATE_OFF_LABEL , e.x + fMargin*3 + offset, fMargin);
+ int offset = pOn.x < pOff.x ? 0 : (pOn.x - pOff.x) / 2;
+ gc.drawText(STATE_OFF_LABEL, e.x + fMargin * 3 + offset, fMargin);
}
borderColor.dispose();
@@ -95,10 +95,10 @@ public class FlatRadioButton extends FlatButton {
@Override
protected void onSelection(MouseEvent e) {
if (isEnabled()) {
- selection = ! selection;
+ selection = !selection;
notifyListeners(SWT.Selection, null);
redraw();
- }
+ }
}
public void setSelection(boolean selection) {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/TraceControlModel.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/TraceControlModel.java
index 7690824d623..fc55c146643 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/TraceControlModel.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/TraceControlModel.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Dmitry Kozlov (Mentor Graphics) - Trace control view enhancements (Bug 390827)
*******************************************************************************/
@@ -65,13 +65,13 @@ import org.eclipse.ui.IWorkbenchWindow;
* all DSF debug sessions at the same time.
*/
public class TraceControlModel {
-
+
private String fDebugSessionId;
private DsfServicesTracker fServicesTracker;
private volatile IGDBTraceControl fGDBTraceControl;
private volatile ITraceTargetDMContext fTargetContext;
private TraceControlView fTraceControlView;
-
+
private IDebugContextListener fDebugContextListener = new IDebugContextListener() {
@Override
public void debugContextChanged(DebugContextEvent event) {
@@ -83,7 +83,7 @@ public class TraceControlModel {
TraceControlModel(TraceControlView view) {
fTraceControlView = view;
-
+
IWorkbenchWindow window = fTraceControlView.getSite().getWorkbenchWindow();
DebugUITools.getDebugContextManager().getContextService(window).addDebugContextListener(fDebugContextListener);
updateDebugContext();
@@ -94,35 +94,34 @@ public class TraceControlModel {
notifyUI(TracepointsMessages.TraceControlView_trace_status_no_debug_session);
return;
}
-
+
if (fTargetContext == null || fGDBTraceControl == null) {
notifyUI(TracepointsMessages.TraceControlView_trace_status_not_supported);
return;
}
- getSession().getExecutor().execute(
- new DsfRunnable() {
- @Override
- public void run() {
- if (fTargetContext != null && fGDBTraceControl != null) {
- fGDBTraceControl.getTraceStatus(
- fTargetContext, new DataRequestMonitor<ITraceStatusDMData>(getSession().getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (isSuccess() && getData() != null) {
- notifyUI((ITraceStatusDMData2)getData());
- } else {
- notifyUI((ITraceStatusDMData2)null);
+ getSession().getExecutor().execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ if (fTargetContext != null && fGDBTraceControl != null) {
+ fGDBTraceControl.getTraceStatus(fTargetContext,
+ new DataRequestMonitor<ITraceStatusDMData>(getSession().getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (isSuccess() && getData() != null) {
+ notifyUI((ITraceStatusDMData2) getData());
+ } else {
+ notifyUI((ITraceStatusDMData2) null);
+ }
}
- }
- });
- } else {
- notifyUI((ITraceStatusDMData2)null);
- }
+ });
+ } else {
+ notifyUI((ITraceStatusDMData2) null);
}
+ }
});
}
-
+
public void init() {
if (fDebugSessionId != null) {
debugSessionChanged();
@@ -133,19 +132,20 @@ public class TraceControlModel {
public void dispose() {
IWorkbenchWindow window = fTraceControlView.getSite().getWorkbenchWindow();
- DebugUITools.getDebugContextManager().getContextService(window).removeDebugContextListener(fDebugContextListener);
+ DebugUITools.getDebugContextManager().getContextService(window)
+ .removeDebugContextListener(fDebugContextListener);
setDebugContext(null);
}
-
+
protected void updateDebugContext() {
IAdaptable debugContext = DebugUITools.getDebugContext();
if (debugContext instanceof IDMVMContext) {
- setDebugContext((IDMVMContext)debugContext);
+ setDebugContext((IDMVMContext) debugContext);
} else {
setDebugContext(null);
}
}
-
+
protected void setDebugContext(IDMVMContext vmContext) {
if (vmContext != null) {
IDMContext dmContext = vmContext.getDMContext();
@@ -183,20 +183,20 @@ public class TraceControlModel {
session.removeServiceEventListener(TraceControlModel.this);
}
});
- } catch (RejectedExecutionException e) {
- // Session is shut down.
- }
+ } catch (RejectedExecutionException e) {
+ // Session is shut down.
+ }
}
fDebugSessionId = null;
fTargetContext = null;
if (fServicesTracker != null) {
- fServicesTracker.dispose();
+ fServicesTracker.dispose();
fServicesTracker = null;
}
debugSessionChanged();
}
}
-
+
private void debugSessionChanged() {
if (getSession() != null) {
try {
@@ -207,10 +207,10 @@ public class TraceControlModel {
session.addServiceEventListener(TraceControlModel.this, null);
}
});
- } catch (RejectedExecutionException e) {
- // Session is shut down.
- }
- }
+ } catch (RejectedExecutionException e) {
+ // Session is shut down.
+ }
+ }
updateContent();
}
@@ -219,27 +219,28 @@ public class TraceControlModel {
if (getSession() == null) {
return;
}
-
- getSession().getExecutor().execute(
- new DsfRunnable() {
- @Override
- public void run() {
- if (fTargetContext != null && fGDBTraceControl != null) {
- if (fGDBTraceControl instanceof IGDBTraceControl2) {
- ((IGDBTraceControl2)fGDBTraceControl).stopTraceVisualization(fTargetContext, new ImmediateRequestMonitor());
- } else {
- // Legacy way of stopping visualization of trace data
- ITraceRecordDMContext emptyDmc = fGDBTraceControl.createTraceRecordContext(fTargetContext, "-1"); //$NON-NLS-1$
- fGDBTraceControl.selectTraceRecord(emptyDmc, new ImmediateRequestMonitor());
- }
+
+ getSession().getExecutor().execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ if (fTargetContext != null && fGDBTraceControl != null) {
+ if (fGDBTraceControl instanceof IGDBTraceControl2) {
+ ((IGDBTraceControl2) fGDBTraceControl).stopTraceVisualization(fTargetContext,
+ new ImmediateRequestMonitor());
+ } else {
+ // Legacy way of stopping visualization of trace data
+ ITraceRecordDMContext emptyDmc = fGDBTraceControl.createTraceRecordContext(fTargetContext,
+ "-1"); //$NON-NLS-1$
+ fGDBTraceControl.selectTraceRecord(emptyDmc, new ImmediateRequestMonitor());
}
}
- });
+ }
+ });
}
/**
* Get the list of trace variables from the backend.
- *
+ *
* @return null when the list cannot be obtained.
*/
public ITraceVariableDMData[] getTraceVarList() {
@@ -250,21 +251,21 @@ public class TraceControlModel {
Query<ITraceVariableDMData[]> query = new Query<ITraceVariableDMData[]>() {
@Override
protected void execute(final DataRequestMonitor<ITraceVariableDMData[]> rm) {
-
+
if (fTargetContext != null && fGDBTraceControl != null) {
fGDBTraceControl.getTraceVariables(fTargetContext,
new DataRequestMonitor<ITraceVariableDMData[]>(getSession().getExecutor(), rm) {
- @Override
- protected void handleCompleted() {
- if (isSuccess()) {
- rm.setData(getData());
- } else {
- rm.setData(null);
- }
- rm.done();
- };
-
- });
+ @Override
+ protected void handleCompleted() {
+ if (isSuccess()) {
+ rm.setData(getData());
+ } else {
+ rm.setData(null);
+ }
+ rm.done();
+ };
+
+ });
} else {
rm.setData(null);
rm.done();
@@ -290,33 +291,36 @@ public class TraceControlModel {
*/
public void createVariable(final String name, final String value) throws FailedTraceVariableCreationException {
if (getSession() == null) {
- throw new TraceControlView.FailedTraceVariableCreationException(TracepointsMessages.TraceControlView_create_variable_error);
+ throw new TraceControlView.FailedTraceVariableCreationException(
+ TracepointsMessages.TraceControlView_create_variable_error);
}
Query<String> query = new Query<String>() {
@Override
protected void execute(final DataRequestMonitor<String> rm) {
-
+
if (fTargetContext != null && fGDBTraceControl != null) {
- fGDBTraceControl.createTraceVariable(fTargetContext, name, value,
+ fGDBTraceControl.createTraceVariable(fTargetContext, name, value,
new RequestMonitor(getSession().getExecutor(), rm) {
- @Override
- protected void handleFailure() {
- String message = TracepointsMessages.TraceControlView_create_variable_error;
- Throwable t = getStatus().getException();
- if (t != null) {
- message = t.getMessage();
- }
- FailedTraceVariableCreationException e =
- new FailedTraceVariableCreationException(message);
- rm.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE, "Backend error", e)); //$NON-NLS-1$
- rm.done();
- };
- });
+ @Override
+ protected void handleFailure() {
+ String message = TracepointsMessages.TraceControlView_create_variable_error;
+ Throwable t = getStatus().getException();
+ if (t != null) {
+ message = t.getMessage();
+ }
+ FailedTraceVariableCreationException e = new FailedTraceVariableCreationException(
+ message);
+ rm.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID,
+ IDsfStatusConstants.INVALID_STATE, "Backend error", e)); //$NON-NLS-1$
+ rm.done();
+ };
+ });
} else {
- FailedTraceVariableCreationException e =
- new FailedTraceVariableCreationException(TracepointsMessages.TraceControlView_trace_variable_tracing_unavailable);
- rm.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE, "Tracing unavailable", e)); //$NON-NLS-1$
+ FailedTraceVariableCreationException e = new FailedTraceVariableCreationException(
+ TracepointsMessages.TraceControlView_trace_variable_tracing_unavailable);
+ rm.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE,
+ "Tracing unavailable", e)); //$NON-NLS-1$
rm.done();
}
}
@@ -329,9 +333,9 @@ public class TraceControlModel {
} catch (ExecutionException e) {
Throwable t = e.getCause();
if (t instanceof CoreException) {
- t = ((CoreException)t).getStatus().getException();
+ t = ((CoreException) t).getStatus().getException();
if (t instanceof FailedTraceVariableCreationException) {
- throw (FailedTraceVariableCreationException)t;
+ throw (FailedTraceVariableCreationException) t;
}
}
throw new FailedTraceVariableCreationException(TracepointsMessages.TraceControlView_create_variable_error);
@@ -343,56 +347,56 @@ public class TraceControlModel {
return;
}
- getSession().getExecutor().execute(
- new DsfRunnable() {
- @Override
- public void run() {
- if (fTargetContext != null && fGDBTraceControl != null) {
- fGDBTraceControl.getCurrentTraceRecordContext(
- fTargetContext,
- new ImmediateDataRequestMonitor<ITraceRecordDMContext>() {
- @Override
- protected void handleSuccess() {
- final ITraceRecordDMContext previousDmc = getData();
- ITraceRecordDMContext nextRecord = fGDBTraceControl.createTraceRecordContext(fTargetContext, traceRecordId);
-
- // Must send the event right away to tell the services we are starting visualization
- // If we don't, the services won't behave accordingly soon enough
- // Bug 347514
- getSession().dispatchEvent(new TraceRecordSelectedChangedEvent(nextRecord), new Hashtable<String, String>());
-
- fGDBTraceControl.selectTraceRecord(nextRecord, new ImmediateRequestMonitor() {
- @Override
- protected void handleError() {
- // If we weren't able to select the next record, we must notify that we are still on the previous one
- // since we have already sent a TraceRecordSelectedChangedEvent early, but it didn't happen.
- getSession().dispatchEvent(new TraceRecordSelectedChangedEvent(previousDmc), new Hashtable<String, String>());
- }
- });
- };
- });
-
-
+ getSession().getExecutor().execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ if (fTargetContext != null && fGDBTraceControl != null) {
+ fGDBTraceControl.getCurrentTraceRecordContext(fTargetContext,
+ new ImmediateDataRequestMonitor<ITraceRecordDMContext>() {
+ @Override
+ protected void handleSuccess() {
+ final ITraceRecordDMContext previousDmc = getData();
+ ITraceRecordDMContext nextRecord = fGDBTraceControl
+ .createTraceRecordContext(fTargetContext, traceRecordId);
+
+ // Must send the event right away to tell the services we are starting visualization
+ // If we don't, the services won't behave accordingly soon enough
+ // Bug 347514
+ getSession().dispatchEvent(new TraceRecordSelectedChangedEvent(nextRecord),
+ new Hashtable<String, String>());
+
+ fGDBTraceControl.selectTraceRecord(nextRecord, new ImmediateRequestMonitor() {
+ @Override
+ protected void handleError() {
+ // If we weren't able to select the next record, we must notify that we are still on the previous one
+ // since we have already sent a TraceRecordSelectedChangedEvent early, but it didn't happen.
+ getSession().dispatchEvent(new TraceRecordSelectedChangedEvent(previousDmc),
+ new Hashtable<String, String>());
+ }
+ });
+ };
+ });
- }
}
- });
+ }
+ });
}
public void setCircularBuffer(final boolean useCircularBuffer) {
if (getSession() == null) {
return;
}
-
- getSession().getExecutor().execute(
- new DsfRunnable() {
- @Override
- public void run() {
- if (fTargetContext != null && fGDBTraceControl != null && fGDBTraceControl instanceof IGDBTraceControl2) {
- ((IGDBTraceControl2)fGDBTraceControl).setCircularTraceBuffer(fTargetContext, useCircularBuffer, new ImmediateRequestMonitor());
- }
+
+ getSession().getExecutor().execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ if (fTargetContext != null && fGDBTraceControl != null
+ && fGDBTraceControl instanceof IGDBTraceControl2) {
+ ((IGDBTraceControl2) fGDBTraceControl).setCircularTraceBuffer(fTargetContext, useCircularBuffer,
+ new ImmediateRequestMonitor());
}
- });
+ }
+ });
}
public void setDisconnectedTracing(final boolean disconnected) {
@@ -400,15 +404,16 @@ public class TraceControlModel {
return;
}
- getSession().getExecutor().execute(
- new DsfRunnable() {
- @Override
- public void run() {
- if (fTargetContext != null && fGDBTraceControl != null && fGDBTraceControl instanceof IGDBTraceControl2) {
- ((IGDBTraceControl2)fGDBTraceControl).setDisconnectedTracing(fTargetContext, disconnected, new ImmediateRequestMonitor());
- }
+ getSession().getExecutor().execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ if (fTargetContext != null && fGDBTraceControl != null
+ && fGDBTraceControl instanceof IGDBTraceControl2) {
+ ((IGDBTraceControl2) fGDBTraceControl).setDisconnectedTracing(fTargetContext, disconnected,
+ new ImmediateRequestMonitor());
}
- });
+ }
+ });
}
public void setTraceNotes(final String notes) {
@@ -416,36 +421,36 @@ public class TraceControlModel {
return;
}
- getSession().getExecutor().execute(
- new DsfRunnable() {
- @Override
- public void run() {
- if (fTargetContext != null && fGDBTraceControl != null && fGDBTraceControl instanceof IGDBTraceControl2) {
- ((IGDBTraceControl2)fGDBTraceControl).setTraceNotes(fTargetContext, notes, new ImmediateRequestMonitor());
- }
+ getSession().getExecutor().execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ if (fTargetContext != null && fGDBTraceControl != null
+ && fGDBTraceControl instanceof IGDBTraceControl2) {
+ ((IGDBTraceControl2) fGDBTraceControl).setTraceNotes(fTargetContext, notes,
+ new ImmediateRequestMonitor());
}
- });
+ }
+ });
}
-
+
private void getGDBTraceControl() {
if (getSession() == null) {
fGDBTraceControl = null;
return;
}
- getSession().getExecutor().execute(
- new DsfRunnable() {
- @Override
- public void run() {
- fGDBTraceControl = getService(IGDBTraceControl.class);
- }
- });
+ getSession().getExecutor().execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ fGDBTraceControl = getService(IGDBTraceControl.class);
+ }
+ });
}
private DsfSession getSession() {
return DsfSession.getSession(fDebugSessionId);
}
-
+
private <V> V getService(Class<V> serviceClass) {
if (fServicesTracker != null) {
return fServicesTracker.getService(serviceClass);
@@ -502,6 +507,7 @@ public class TraceControlModel {
public void handleEvent(ITraceRecordSelectedChangedDMEvent event) {
updateContent();
}
+
/*
* Since something suspended, might as well refresh our status
* to show the latest.
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/TraceControlView.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/TraceControlView.java
index 01551309df6..e3b6d3370ac 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/TraceControlView.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/TraceControlView.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - Initial API and implementation
* Dmitry Kozlov (Mentor Graphics) - Trace control view enhancements (Bug 390827)
@@ -59,9 +59,9 @@ import org.eclipse.ui.progress.UIJob;
/**
* TraceControlView Part
- *
+ *
* This view is used to control Tracing.
- *
+ *
* @since 2.1
*/
public class TraceControlView extends ViewPart implements IViewPart {
@@ -71,10 +71,11 @@ public class TraceControlView extends ViewPart implements IViewPart {
protected static final int UI_REFRESH_DELAY = 1000; // milliseconds
public static class FailedTraceVariableCreationException extends Exception {
- private static final long serialVersionUID = -3042693455630687285L;
+ private static final long serialVersionUID = -3042693455630687285L;
+
+ FailedTraceVariableCreationException() {
+ }
- FailedTraceVariableCreationException() {}
-
FailedTraceVariableCreationException(String errorMessage) {
super(errorMessage);
}
@@ -86,9 +87,12 @@ public class TraceControlView extends ViewPart implements IViewPart {
private final class RefreshViewAction extends Action {
public RefreshViewAction() {
setText(TracepointsMessages.TraceControlView_action_Refresh_label);
- setImageDescriptor(TracepointImageRegistry.getImageDescriptor(TracepointImageRegistry.ICON_Refresh_enabled));
- setDisabledImageDescriptor(TracepointImageRegistry.getImageDescriptor(TracepointImageRegistry.ICON_Refresh_disabled));
+ setImageDescriptor(
+ TracepointImageRegistry.getImageDescriptor(TracepointImageRegistry.ICON_Refresh_enabled));
+ setDisabledImageDescriptor(
+ TracepointImageRegistry.getImageDescriptor(TracepointImageRegistry.ICON_Refresh_disabled));
}
+
@Override
public void run() {
fLastRefreshTime = System.currentTimeMillis();
@@ -104,6 +108,7 @@ public class TraceControlView extends ViewPart implements IViewPart {
super(TracepointsMessages.TraceControlView_auto_refresh_action_label, AS_CHECK_BOX);
setImageDescriptor(TracepointImageRegistry.getImageDescriptor(TracepointImageRegistry.ICON_Refresh_Auto));
}
+
@Override
public void run() {
if (isChecked()) {
@@ -125,8 +130,10 @@ public class TraceControlView extends ViewPart implements IViewPart {
protected final class DisconnectedTracingAction extends Action {
public DisconnectedTracingAction() {
super(TracepointsMessages.TraceControlView_action_Disconnected_tracing_label, AS_CHECK_BOX);
- setImageDescriptor(TracepointImageRegistry.getImageDescriptor(TracepointImageRegistry.ICON_Disconnected_Tracing));
+ setImageDescriptor(
+ TracepointImageRegistry.getImageDescriptor(TracepointImageRegistry.ICON_Disconnected_Tracing));
}
+
@Override
public void run() {
fTraceControlModel.setDisconnectedTracing(isChecked());
@@ -136,8 +143,10 @@ public class TraceControlView extends ViewPart implements IViewPart {
protected final class OpenTraceVarDetailsAction extends Action {
public OpenTraceVarDetailsAction() {
setText(TracepointsMessages.TraceControlView_action_trace_variable_details);
- setImageDescriptor(TracepointImageRegistry.getImageDescriptor(TracepointImageRegistry.ICON_Trace_Variables));
+ setImageDescriptor(
+ TracepointImageRegistry.getImageDescriptor(TracepointImageRegistry.ICON_Trace_Variables));
}
+
@Override
public void run() {
Shell shell = Display.getDefault().getActiveShell();
@@ -149,8 +158,10 @@ public class TraceControlView extends ViewPart implements IViewPart {
protected final class ExitVisualizationModeDetailsAction extends Action {
public ExitVisualizationModeDetailsAction() {
setText(TracepointsMessages.TraceControlView_action_exit_visualization_mode);
- setImageDescriptor(TracepointImageRegistry.getImageDescriptor(TracepointImageRegistry.ICON_Exit_Visualization));
+ setImageDescriptor(
+ TracepointImageRegistry.getImageDescriptor(TracepointImageRegistry.ICON_Exit_Visualization));
}
+
@Override
public void run() {
fTraceControlModel.exitVisualizationMode();
@@ -158,7 +169,7 @@ public class TraceControlView extends ViewPart implements IViewPart {
// triggered by this asynchronous operation.
}
}
-
+
protected TraceControlModel fTraceControlModel;
protected RefreshViewAction fRefreshViewAction;
@@ -175,8 +186,8 @@ public class TraceControlView extends ViewPart implements IViewPart {
protected Composite fTopComposite;
protected Composite fStatusComposite;
- protected Label fStatusLabel;
- protected Label fSecondaryStatusLabel;
+ protected Label fStatusLabel;
+ protected Label fSecondaryStatusLabel;
protected Composite fSecondaryStatusComposite;
protected FlatButton fActionButton;
@@ -189,13 +200,12 @@ public class TraceControlView extends ViewPart implements IViewPart {
protected Label fFrameLabel;
protected Label fFrameNumberLabel;
protected Slider fFrameSlider;
-
+
protected Composite fNotesComposite;
protected Label fNotesContentLabel;
protected Text fNotesContentText;
protected Button fSetNotesButton;
-
public TraceControlView() {
}
@@ -204,7 +214,7 @@ public class TraceControlView extends ViewPart implements IViewPart {
super.init(site);
fTraceControlModel = new TraceControlModel(this);
}
-
+
@Override
public void init(IViewSite site, IMemento memento) throws PartInitException {
init(site);
@@ -214,7 +224,7 @@ public class TraceControlView extends ViewPart implements IViewPart {
public void createPartControl(Composite parent) {
createActions();
-
+
fTopComposite = new Composite(parent, SWT.NONE);
GridLayout topLayout = new GridLayout(1, false);
topLayout.marginWidth = 0;
@@ -225,13 +235,13 @@ public class TraceControlView extends ViewPart implements IViewPart {
// Tracing status line
createStatusLine(fTopComposite);
- // Secondary status: start time, stop time and reason
+ // Secondary status: start time, stop time and reason
setSecondaryStatusLineVisible(false, null);
// Buffer line
createBufferLine(fTopComposite);
setBufferLineVisible(false, null, false);
-
+
// Frame line
createFrameLine(fTopComposite);
setFrameLineVisible(false, null);
@@ -239,7 +249,7 @@ public class TraceControlView extends ViewPart implements IViewPart {
// Trace notes
//createNotesLine(fTopComposite);
//setNotesLineVisible(false, null, false);
-
+
fTraceControlModel.init();
}
@@ -249,7 +259,7 @@ public class TraceControlView extends ViewPart implements IViewPart {
gd.horizontalSpan = 2;
gd.minimumHeight = 22;
fStatusComposite.setLayoutData(gd);
- GridLayout l = new GridLayout(2,false);
+ GridLayout l = new GridLayout(2, false);
l.marginBottom = 0;
fStatusComposite.setLayout(l);
fStatusComposite.setBackgroundMode(SWT.INHERIT_FORCE);
@@ -258,39 +268,40 @@ public class TraceControlView extends ViewPart implements IViewPart {
if (cachedBold == null) {
FontData fontData = fStatusLabel.getFont().getFontData()[0];
fontData.setStyle(SWT.BOLD);
- cachedBold = new Font(fStatusLabel.getDisplay(),fontData);
+ cachedBold = new Font(fStatusLabel.getDisplay(), fontData);
}
fStatusLabel.setFont(cachedBold);
GridData d = new GridData(SWT.LEFT, SWT.CENTER, false, false);
fStatusLabel.setLayoutData(d);
fStatusLabel.setText(TracepointsMessages.TraceControlView_trace_status_no_debug_session);
fStatusLabel.setBackground(parent.getBackground());
-
+
fActionButton = new FlatButton(fStatusComposite, SWT.NONE);
fActionButton.setText(EMPTY_STRING);
GridData acGd = new GridData(SWT.LEFT, SWT.CENTER, false, false);
acGd.horizontalIndent = ACTION_BUTTON_INDENTATION;
fActionButton.setLayoutData(acGd);
fActionButton.addSelectionListener(new SelectionAdapter() {
-
+
@Override
public void widgetSelected(SelectionEvent e) {
// Run action
IHandlerService handlerService = getSite().getService(IHandlerService.class);
if (handlerService == null) {
- GdbUIPlugin.log(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, "Missing command handler service")); //$NON-NLS-1$
- return;
+ GdbUIPlugin
+ .log(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, "Missing command handler service")); //$NON-NLS-1$
+ return;
}
try {
- String text = ((FlatButton)e.getSource()).getText();
- if (TracepointsMessages.TraceControlView_action_start.equals(text) ||
- TracepointsMessages.TraceControlView_action_restart.equals(text)) {
+ String text = ((FlatButton) e.getSource()).getText();
+ if (TracepointsMessages.TraceControlView_action_start.equals(text)
+ || TracepointsMessages.TraceControlView_action_restart.equals(text)) {
handlerService.executeCommand("org.eclipse.cdt.debug.ui.command.startTracing", null); //$NON-NLS-1$
} else if (TracepointsMessages.TraceControlView_action_stop.equals(text)) {
handlerService.executeCommand("org.eclipse.cdt.debug.ui.command.stopTracing", null); //$NON-NLS-1$
} else if (TracepointsMessages.TraceControlView_action_finish_visualization.equals(text)) {
- fTraceControlModel.exitVisualizationMode();
+ fTraceControlModel.exitVisualizationMode();
}
// Note that the content of the view will be updated due to the event
// triggered by the above operations. There is no point in updating the
@@ -302,28 +313,28 @@ public class TraceControlView extends ViewPart implements IViewPart {
}
});
-
+
fSecondaryStatusLabel = new Label(fStatusComposite, SWT.NONE | SWT.WRAP);
GridData sslGd = new GridData(SWT.FILL, SWT.TOP, true, false);
sslGd.horizontalSpan = 2;
fSecondaryStatusLabel.setLayoutData(sslGd);
fSecondaryStatusLabel.setBackground(parent.getBackground());
-
+
Label separator = new Label(fStatusComposite, SWT.SEPARATOR | SWT.HORIZONTAL);
GridData sGd = new GridData(SWT.FILL, SWT.BOTTOM, true, false);
//sGd.heightHint = 3;
sGd.horizontalSpan = 2;
separator.setLayoutData(sGd);
}
-
+
protected void setActionLinkVisible(boolean visible, String text) {
fActionButton.setVisible(visible);
- fActionButton.setText(visible ? text: EMPTY_STRING);
+ fActionButton.setText(visible ? text : EMPTY_STRING);
}
-
+
private void setSecondaryStatusLineVisible(boolean visible, ITraceStatusDMData2 tData) {
fSecondaryStatusLabel.setVisible(visible);
- ((GridData)fSecondaryStatusLabel.getLayoutData()).exclude = !visible;
+ ((GridData) fSecondaryStatusLabel.getLayoutData()).exclude = !visible;
if (visible && tData != null) {
STOP_REASON_ENUM stopReason = tData.getStopReason();
@@ -339,15 +350,12 @@ public class TraceControlView extends ViewPart implements IViewPart {
formatTimeInterval(fLastRefreshTime, System.currentTimeMillis(), true));
}
if (tData.getUserName() != null && tData.getUserName().length() > 0) {
- user = TracepointsMessages.bind(TracepointsMessages.TraceControlView_trace_status_secondary_user, tData.getUserName());
+ user = TracepointsMessages.bind(TracepointsMessages.TraceControlView_trace_status_secondary_user,
+ tData.getUserName());
}
- fSecondaryStatusLabel.setText(TracepointsMessages.bind(
- TracepointsMessages.TraceControlView_trace_status_secondary_running,
- new Object[] {
- formatTime(tData.getStartTime()),
- user,
- lastRefreshed}
- ));
+ fSecondaryStatusLabel.setText(
+ TracepointsMessages.bind(TracepointsMessages.TraceControlView_trace_status_secondary_running,
+ new Object[] { formatTime(tData.getStartTime()), user, lastRefreshed }));
} else {
// Should not happen if usage is correct
fSecondaryStatusLabel.setText(EMPTY_STRING);
@@ -356,10 +364,10 @@ public class TraceControlView extends ViewPart implements IViewPart {
fSecondaryStatusLabel.setText(EMPTY_STRING);
}
}
-
+
protected void createNotesLine(final Composite parent) {
// Trace notes: notes text and edit notes button
- fNotesComposite = new Composite(parent, SWT.NONE);
+ fNotesComposite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(3, false);
layout.marginWidth = 0;
layout.marginHeight = 0;
@@ -374,17 +382,17 @@ public class TraceControlView extends ViewPart implements IViewPart {
slGd.verticalSpan = 4;
separator.setLayoutData(slGd);
separator.setBackground(fNotesComposite.getBackground());
-
+
Label fNotesLabel = new Label(fNotesComposite, SWT.NONE);
fNotesLabel.setBackground(parent.getBackground());
fNotesLabel.setText(TracepointsMessages.TraceControlView_trace_notes_label);
if (cachedBold != null) {
fNotesLabel.setFont(cachedBold);
}
-
+
fSetNotesButton = new Button(fNotesComposite, SWT.TOGGLE);
- fSetNotesButton.setImage(TracepointImageRegistry.getImageDescriptor(
- TracepointImageRegistry.ICON_Edit_enabled).createImage());
+ fSetNotesButton.setImage(
+ TracepointImageRegistry.getImageDescriptor(TracepointImageRegistry.ICON_Edit_enabled).createImage());
fSetNotesButton.setSelection(false);
fSetNotesButton.setToolTipText(TracepointsMessages.TraceControlView_trace_notes_edit_tooltip);
fSetNotesButton.setLayoutData(new GridData(SWT.END, SWT.TOP, false, false));
@@ -394,14 +402,14 @@ public class TraceControlView extends ViewPart implements IViewPart {
handleEditNotesButtonPressed();
}
});
-
+
fNotesContentLabel = new Label(fNotesComposite, SWT.WRAP);
fNotesContentLabel.setBackground(parent.getBackground());
fNotesContentLabel.setText(TracepointsMessages.TraceControlView_trace_notes_not_set);
GridData nclGd = new GridData(SWT.FILL, SWT.TOP, true, false);
nclGd.horizontalSpan = 2;
fNotesContentLabel.setLayoutData(nclGd);
-
+
fNotesContentText = new Text(fNotesComposite, SWT.BORDER);
fNotesContentText.setVisible(false);
GridData gd = new GridData(SWT.FILL, SWT.TOP, true, false);
@@ -414,9 +422,9 @@ public class TraceControlView extends ViewPart implements IViewPart {
fSetNotesButton.setSelection(false);
handleEditNotesButtonPressed();
}
- });
+ });
fNotesContentText.addKeyListener(new KeyAdapter() {
-
+
@Override
public void keyPressed(KeyEvent e) {
if (e.keyCode == 0x1b) {
@@ -426,21 +434,21 @@ public class TraceControlView extends ViewPart implements IViewPart {
}
}
});
-
+
}
protected void handleEditNotesButtonPressed() {
handleEditNotesButtonPressed(false);
}
-
+
protected void handleEditNotesButtonPressed(boolean cancelEditing) {
boolean isEditMode = fSetNotesButton.getSelection();
fNotesContentLabel.setVisible(!isEditMode);
- ((GridData)fNotesContentLabel.getLayoutData()).exclude = isEditMode;
-
+ ((GridData) fNotesContentLabel.getLayoutData()).exclude = isEditMode;
+
fNotesContentText.setVisible(isEditMode);
- ((GridData)fNotesContentText.getLayoutData()).exclude = !isEditMode;
-
+ ((GridData) fNotesContentText.getLayoutData()).exclude = !isEditMode;
+
fNotesContentText.setFocus();
if (isEditMode) {
@@ -461,10 +469,9 @@ public class TraceControlView extends ViewPart implements IViewPart {
fTraceControlModel.updateContent();
}
-
protected void setNotesLineVisible(boolean visible, ITraceStatusDMData2 tData, boolean readonly) {
fNotesComposite.setVisible(visible);
- ((GridData)fNotesComposite.getLayoutData()).exclude = !visible;
+ ((GridData) fNotesComposite.getLayoutData()).exclude = !visible;
if (visible) {
if (tData.getNotes() != null && tData.getNotes().length() > 0) {
@@ -473,11 +480,11 @@ public class TraceControlView extends ViewPart implements IViewPart {
fNotesContentLabel.setText(TracepointsMessages.TraceControlView_trace_notes_not_set);
}
if (tData != null && tData.getStartTime() != null)
- fSetNotesButton.setEnabled(!readonly);
+ fSetNotesButton.setEnabled(!readonly);
}
}
- protected void createFrameLine(Composite parent) {
+ protected void createFrameLine(Composite parent) {
fFrameComposite = new Composite(parent, SWT.NONE);
GridData fcGd = new GridData(SWT.FILL, SWT.TOP, true, false);
fcGd.horizontalSpan = 2;
@@ -485,7 +492,7 @@ public class TraceControlView extends ViewPart implements IViewPart {
GridLayout layout = new GridLayout(2, false);
layout.marginHeight = 0;
fFrameComposite.setLayout(layout);
-
+
Label separator = new Label(fFrameComposite, SWT.SEPARATOR | SWT.HORIZONTAL);
GridData sepGd = new GridData(SWT.FILL, SWT.CENTER, true, false);
sepGd.horizontalSpan = 2;
@@ -498,33 +505,33 @@ public class TraceControlView extends ViewPart implements IViewPart {
fFrameSlider.setLayoutData(gd2);
fFrameSlider.setValues(0, 0, 100, 1, 1, 10);
fFrameSlider.addSelectionListener(new SelectionAdapter() {
-
+
@Override
public void widgetSelected(SelectionEvent e) {
- IHandlerService handlerService = getSite().getService(IHandlerService.class);
- if (e.detail == SWT.ARROW_DOWN) {
- try {
- handlerService.executeCommand("org.eclipse.cdt.dsf.gdb.ui.command.selectNextTraceRecord", null); //$NON-NLS-1$
- } catch (Exception ex) {
- }
- } else if (e.detail == SWT.ARROW_UP) {
- try {
- handlerService.executeCommand("org.eclipse.cdt.dsf.gdb.ui.command.selectPreviousTraceRecord", null); //$NON-NLS-1$
- } catch (Exception ex) {
- }
- } else if (e.detail == SWT.DRAG) {
- // We don't want to query gdb while user drags thumb, just update the label instead
- // but postpone actual gdb query to the time thumb is released (e.detail == SWT.NONE)
- fFrameNumberLabel.setText(TracepointsMessages.bind(
- TracepointsMessages.TraceControlView_frame_dragging,
- fFrameSlider.getSelection()));
- } else {
- fTraceControlModel.setCurrentTraceRecord(Integer.toString(fFrameSlider.getSelection()));
- }
+ IHandlerService handlerService = getSite().getService(IHandlerService.class);
+ if (e.detail == SWT.ARROW_DOWN) {
+ try {
+ handlerService.executeCommand("org.eclipse.cdt.dsf.gdb.ui.command.selectNextTraceRecord", null); //$NON-NLS-1$
+ } catch (Exception ex) {
+ }
+ } else if (e.detail == SWT.ARROW_UP) {
+ try {
+ handlerService.executeCommand("org.eclipse.cdt.dsf.gdb.ui.command.selectPreviousTraceRecord", //$NON-NLS-1$
+ null);
+ } catch (Exception ex) {
+ }
+ } else if (e.detail == SWT.DRAG) {
+ // We don't want to query gdb while user drags thumb, just update the label instead
+ // but postpone actual gdb query to the time thumb is released (e.detail == SWT.NONE)
+ fFrameNumberLabel.setText(TracepointsMessages
+ .bind(TracepointsMessages.TraceControlView_frame_dragging, fFrameSlider.getSelection()));
+ } else {
+ fTraceControlModel.setCurrentTraceRecord(Integer.toString(fFrameSlider.getSelection()));
+ }
}
-
+
});
-
+
fFrameLabel = new Label(fFrameComposite, SWT.NONE);
fFrameLabel.setText(TracepointsMessages.TraceControlView_frame_label);
fFrameLabel.setLayoutData(new GridData());
@@ -537,8 +544,8 @@ public class TraceControlView extends ViewPart implements IViewPart {
protected void setFrameLineVisible(boolean visible, ITraceStatusDMData2 traceData) {
fFrameComposite.setVisible(visible);
- ((GridData)fFrameComposite.getLayoutData()).exclude = !visible;
-
+ ((GridData) fFrameComposite.getLayoutData()).exclude = !visible;
+
if (visible) {
fFrameSlider.setMinimum(0);
if (traceData.getNumberOfCollectedFrame() == 0) {
@@ -548,12 +555,12 @@ public class TraceControlView extends ViewPart implements IViewPart {
}
int inc = traceData.getNumberOfCollectedFrame() / 20;
fFrameSlider.setPageIncrement(inc <= 1 ? 2 : inc);
-
+
String fl = EMPTY_STRING;
if (traceData.getCurrentTraceFrameId() != null) {
fl += TracepointsMessages.bind(TracepointsMessages.TraceControlView_frame_looking,
- new Object[] { traceData.getCurrentTraceFrameId(),
- Integer.valueOf(traceData.getTracepointNumberForCurrentTraceFrame())} );
+ new Object[] { traceData.getCurrentTraceFrameId(),
+ Integer.valueOf(traceData.getTracepointNumberForCurrentTraceFrame()) });
int recId = 0;
try {
recId = Integer.parseInt(traceData.getCurrentTraceFrameId());
@@ -561,7 +568,8 @@ public class TraceControlView extends ViewPart implements IViewPart {
}
fFrameSlider.setSelection(recId);
} else {
- fl += TracepointsMessages.bind(TracepointsMessages.TraceControlView_frame_not_looking, traceData.getNumberOfCollectedFrame());
+ fl += TracepointsMessages.bind(TracepointsMessages.TraceControlView_frame_not_looking,
+ traceData.getNumberOfCollectedFrame());
fFrameSlider.setSelection(0);
}
fFrameNumberLabel.setText(fl);
@@ -570,9 +578,9 @@ public class TraceControlView extends ViewPart implements IViewPart {
fFrameSlider.setEnabled(traceData.getNumberOfCollectedFrame() != 0);
}
}
-
+
protected void createBufferLine(final Composite parent) {
-
+
fBufferComposite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(3, false);
layout.marginHeight = 0;
@@ -580,7 +588,7 @@ public class TraceControlView extends ViewPart implements IViewPart {
GridData gd = new GridData(SWT.FILL, SWT.TOP, true, false);
fBufferComposite.setLayoutData(gd);
fBufferComposite.setBackgroundMode(SWT.INHERIT_FORCE);
-
+
Label fBufferLabel = new Label(fBufferComposite, SWT.NONE);
fBufferLabel.setText(TracepointsMessages.TraceControlView_buffer_label);
if (cachedBold != null) {
@@ -610,7 +618,7 @@ public class TraceControlView extends ViewPart implements IViewPart {
fTraceControlModel.updateContent();
}
});
-
+
fBufferCollectedFramesLabel = new Label(fBufferComposite, SWT.WRAP);
fBufferCollectedFramesLabel.setText(TracepointsMessages.TraceControlView_buffer_label);
GridData gd3 = new GridData(SWT.FILL, SWT.BOTTOM, true, false);
@@ -619,49 +627,51 @@ public class TraceControlView extends ViewPart implements IViewPart {
protected void setBufferLineVisible(boolean visible, ITraceStatusDMData2 tData, boolean readonly) {
fBufferComposite.setVisible(visible);
- ((GridData)fBufferComposite.getLayoutData()).exclude = !visible;
+ ((GridData) fBufferComposite.getLayoutData()).exclude = !visible;
- if (visible && tData != null){
- if (tData.getStopReason() != null && tData.getStopReason() == STOP_REASON_ENUM.OVERFLOW){
+ if (visible && tData != null) {
+ if (tData.getStopReason() != null && tData.getStopReason() == STOP_REASON_ENUM.OVERFLOW) {
// Buffer overflowed, it should be 100% full instead of 99%
fBufferProgress.setProgress(100);
- } else if (tData.getStopReason() != null && tData.isCircularBuffer() && tData.getNumberOfCreatedFrames() > tData.getNumberOfCollectedFrame()) {
+ } else if (tData.getStopReason() != null && tData.isCircularBuffer()
+ && tData.getNumberOfCreatedFrames() > tData.getNumberOfCollectedFrame()) {
// Buffer is circular and overflowed once, it should be 100% full instead of 99%
fBufferProgress.setProgress(100);
- } else if (tData.isCircularBuffer() && tData.isTracingActive() &&
- tData.getNumberOfCreatedFrames() > tData.getNumberOfCollectedFrame()) {
+ } else if (tData.isCircularBuffer() && tData.isTracingActive()
+ && tData.getNumberOfCreatedFrames() > tData.getNumberOfCollectedFrame()) {
// If we run with Circular buffer and all buffer was filled in once, we continue displaying progress 100%
// and showing moving bar that makes a circle every tData.getNumberOfCollectedFrame() because it is buffer size in frames
- // and actual number of collected frames from the start is tData.getNumberOfCreatedFrames(), but only last
+ // and actual number of collected frames from the start is tData.getNumberOfCreatedFrames(), but only last
// tData.getNumberOfCollectedFrame() are stored in the buffer
- int p = (tData.getNumberOfCreatedFrames() % tData.getNumberOfCollectedFrame()) * 100 / tData.getNumberOfCollectedFrame();
+ int p = (tData.getNumberOfCreatedFrames() % tData.getNumberOfCollectedFrame()) * 100
+ / tData.getNumberOfCollectedFrame();
// 100 is an indicator that buffer is already full and should be showed in different manner
fBufferProgress.setProgress(100 + p);
} else {
- fBufferProgress.setProgress((tData.getTotalBufferSize() - tData.getFreeBufferSize()) * 100 / tData.getTotalBufferSize());
+ fBufferProgress.setProgress(
+ (tData.getTotalBufferSize() - tData.getFreeBufferSize()) * 100 / tData.getTotalBufferSize());
}
-
+
fSetCircularBufferButton.setSelection(tData.isCircularBuffer());
fSetCircularBufferButton.setEnabled(!readonly);
- fSetCircularBufferButton.setToolTipText(fSetCircularBufferButton.getSelection() ?
- TracepointsMessages.TraceControlView_buffer_circular_on_tooltip :
- TracepointsMessages.TraceControlView_buffer_circular_off_tooltip);
+ fSetCircularBufferButton.setToolTipText(fSetCircularBufferButton.getSelection()
+ ? TracepointsMessages.TraceControlView_buffer_circular_on_tooltip
+ : TracepointsMessages.TraceControlView_buffer_circular_off_tooltip);
fSetCircularBufferButton.redraw();
fSetCircularBufferButton.update();
-
+
fBufferCollectedFramesLabel.setText(TracepointsMessages.bind(
- TracepointsMessages.TraceControlView_buffer_frames_collected,
- tData.getNumberOfCollectedFrame(),
- (tData.getTotalBufferSize() - tData.getFreeBufferSize())/1000));
+ TracepointsMessages.TraceControlView_buffer_frames_collected, tData.getNumberOfCollectedFrame(),
+ (tData.getTotalBufferSize() - tData.getFreeBufferSize()) / 1000));
fBufferProgress.redraw();
fBufferProgress.update();
}
}
-
+
protected void createActions() {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
window.getActivePage().showActionSet("org.eclipse.cdt.debug.ui.tracepointActionSet"); //$NON-NLS-1$
-
+
IActionBars bars = getViewSite().getActionBars();
IToolBarManager manager = bars.getToolBarManager();
@@ -681,11 +691,11 @@ public class TraceControlView extends ViewPart implements IViewPart {
fDisconnectedTracingAction = new DisconnectedTracingAction();
manager.add(fDisconnectedTracingAction);
fDisconnectedTracingAction.setEnabled(false);
-
+
// Create the action to open the trace variable details
fOpenTraceVarDetails = new OpenTraceVarDetailsAction();
manager.add(fOpenTraceVarDetails);
-
+
// Create the action to exit visualization mode
fExitVisualizationAction = new ExitVisualizationModeDetailsAction();
manager.add(fExitVisualizationAction);
@@ -693,24 +703,24 @@ public class TraceControlView extends ViewPart implements IViewPart {
bars.updateActionBars();
updateActionEnablement(null);
}
-
+
@Override
public void dispose() {
fTraceControlModel.dispose();
- fStatusLabel = null; // Indicate that we have been disposed
+ fStatusLabel = null; // Indicate that we have been disposed
if (refreshUIJob != null) {
refreshUIJob.cancel();
}
-
- if (cachedBold != null) {
+
+ if (cachedBold != null) {
cachedBold.dispose();
cachedBold = null;
}
-
+
super.dispose();
}
-
+
protected void updateUI(final String statusMessage) {
try {
fLastTraceData = null;
@@ -729,7 +739,7 @@ public class TraceControlView extends ViewPart implements IViewPart {
protected void updateUI(final ITraceStatusDMData2 traceData) {
fLastTraceData = traceData;
- if (traceData == null ) {
+ if (traceData == null) {
// should not happen, but still process it correctly
updateUI(TracepointsMessages.TraceControlView_trace_status_inactive);
} else if (!traceData.isTracingSupported()) {
@@ -741,33 +751,34 @@ public class TraceControlView extends ViewPart implements IViewPart {
fStatusLabel.setText(s);
setActionLinkVisible(false, EMPTY_STRING);
- // If start and stop time are not available in trace data file, do not show secondary status line
- if (getTimeMilliseconds(traceData.getStartTime()) != 0 && getTimeMilliseconds(traceData.getStopTime()) != 0) {
+ // If start and stop time are not available in trace data file, do not show secondary status line
+ if (getTimeMilliseconds(traceData.getStartTime()) != 0
+ && getTimeMilliseconds(traceData.getStopTime()) != 0) {
setSecondaryStatusLineVisible(true, traceData);
} else {
setSecondaryStatusLineVisible(false, traceData);
}
- //setNotesLineVisible(true, traceData, true);
+ //setNotesLineVisible(true, traceData, true);
setBufferLineVisible(true, traceData, true);
- setFrameLineVisible(true, traceData);
-
+ setFrameLineVisible(true, traceData);
+
updateActionEnablement(traceData);
updateLayout();
-
- } else if (!traceData.isTracingActive() && traceData.getStopReason() == null){
+
+ } else if (!traceData.isTracingActive() && traceData.getStopReason() == null) {
// Tracing is not started yet
fDisconnectedTracingAction.setEnabled(true);
fStatusLabel.setText(TracepointsMessages.TraceControlView_trace_status_not_started);
- setActionLinkVisible(true,TracepointsMessages.TraceControlView_action_start);
+ setActionLinkVisible(true, TracepointsMessages.TraceControlView_action_start);
setSecondaryStatusLineVisible(false, null);
- //setNotesLineVisible(true, traceData, false);
+ //setNotesLineVisible(true, traceData, false);
setBufferLineVisible(true, traceData, false);
setFrameLineVisible(false, null);
updateActionEnablement(traceData);
- updateLayout();
-
+ updateLayout();
+
} else {
// Live execution tracing started and running or started and stopped
fDisconnectedTracingAction.setEnabled(true);
@@ -788,7 +799,7 @@ public class TraceControlView extends ViewPart implements IViewPart {
if (traceData.getNumberOfCollectedFrame() == 0) {
fStatusLabel.setText(TracepointsMessages.TraceControlView_trace_status_not_started);
} else {
- fStatusLabel.setText(TracepointsMessages.TraceControlView_trace_status_stopped);
+ fStatusLabel.setText(TracepointsMessages.TraceControlView_trace_status_stopped);
}
setActionLinkVisible(true, TracepointsMessages.TraceControlView_action_restart);
}
@@ -808,7 +819,7 @@ public class TraceControlView extends ViewPart implements IViewPart {
updateLayout();
}
}
-
+
protected void startRefreshUIJob() {
if (refreshUIJob == null) {
refreshUIJob = new UIJob("Refresh Trace Control view UI") { //$NON-NLS-1$
@@ -821,14 +832,14 @@ public class TraceControlView extends ViewPart implements IViewPart {
// Update the UI to simply say how long ago was the last refresh
updateUI(fLastTraceData);
}
-
+
return Status.OK_STATUS;
}
};
}
refreshUIJob.schedule(UI_REFRESH_DELAY);
}
-
+
protected String getStopMessage(ITraceStatusDMData2 tData) {
String stopMessage;
STOP_REASON_ENUM fStopReason = tData.getStopReason();
@@ -836,7 +847,9 @@ public class TraceControlView extends ViewPart implements IViewPart {
stopMessage = TracepointsMessages.TraceControlView_tracing_stopped_user_request;
} else if (fStopReason == STOP_REASON_ENUM.PASSCOUNT) {
if (tData.getStoppingTracepoint() != null) {
- stopMessage = TracepointsMessages.bind(TracepointsMessages.TraceControlView_tracing_stopped_tracepoint_number, tData.getStoppingTracepoint());
+ stopMessage = TracepointsMessages.bind(
+ TracepointsMessages.TraceControlView_tracing_stopped_tracepoint_number,
+ tData.getStoppingTracepoint());
} else {
stopMessage = TracepointsMessages.TraceControlView_tracing_stopped_passcount;
}
@@ -852,53 +865,46 @@ public class TraceControlView extends ViewPart implements IViewPart {
String user = EMPTY_STRING;
if (tData.getUserName() != null && tData.getUserName().length() > 0) {
- user = TracepointsMessages.bind(TracepointsMessages.TraceControlView_trace_status_secondary_user, tData.getUserName());
+ user = TracepointsMessages.bind(TracepointsMessages.TraceControlView_trace_status_secondary_user,
+ tData.getUserName());
}
if (tData.isTracingFromFile()) {
- stopMessage = TracepointsMessages.bind(
- TracepointsMessages.TraceControlView_trace_status_secondary_offline,
- new Object[] {formatTime(tData.getStartTime()),
- user,
- formatTime(tData.getStopTime()),
- stopMessage
- });
+ stopMessage = TracepointsMessages.bind(TracepointsMessages.TraceControlView_trace_status_secondary_offline,
+ new Object[] { formatTime(tData.getStartTime()), user, formatTime(tData.getStopTime()),
+ stopMessage });
} else {
- stopMessage = TracepointsMessages.bind(
- TracepointsMessages.TraceControlView_trace_status_secondary_stopped,
- new Object[] {formatTimeInterval(tData.getStartTime(),tData.getStopTime()),
- user,
- formatTime(tData.getStopTime()),
- stopMessage
- });
- }
-
+ stopMessage = TracepointsMessages.bind(TracepointsMessages.TraceControlView_trace_status_secondary_stopped,
+ new Object[] { formatTimeInterval(tData.getStartTime(), tData.getStopTime()), user,
+ formatTime(tData.getStopTime()), stopMessage });
+ }
+
return stopMessage;
}
protected void updateActionEnablement(ITraceStatusDMData2 traceData) {
fOpenTraceVarDetails.setEnabled(traceData != null && traceData.isTracingSupported());
- fExitVisualizationAction.setEnabled(traceData != null && traceData.getCurrentTraceFrameId() != null &&
- !traceData.isTracingFromFile());
+ fExitVisualizationAction.setEnabled(
+ traceData != null && traceData.getCurrentTraceFrameId() != null && !traceData.isTracingFromFile());
fDisconnectedTracingAction.setChecked(traceData != null && traceData.isDisconnectedTracingEnabled());
}
-
+
@Override
public void setFocus() {
if (fStatusLabel != null) {
fStatusLabel.setFocus();
}
}
-
+
public void updateLayout() {
fStatusComposite.layout(true);
fTopComposite.layout(true);
}
-
+
protected long getTimeMilliseconds(String time) {
long microseconds = 0;
- try {
+ try {
if (time.length() != 0) {
- String[] times = time.split("\\."); //$NON-NLS-1$
+ String[] times = time.split("\\."); //$NON-NLS-1$
microseconds += Long.parseLong(times[0]) * 1000000;
microseconds += Long.parseLong(times[1]);
}
@@ -908,17 +914,17 @@ public class TraceControlView extends ViewPart implements IViewPart {
return microseconds / 1000;
}
- /**
+ /**
* Format time from gdb presentation into user-understandable form
* @param time in gd presentation
- * @return
+ * @return
*/
protected String formatTime(String time) {
long milliseconds = getTimeMilliseconds(time);
return formatTime(milliseconds);
}
- /**
+ /**
* Format time from standard milliseconds since Epoch into user-understandable form
*/
protected String formatTime(long milliseconds) {
@@ -927,77 +933,89 @@ public class TraceControlView extends ViewPart implements IViewPart {
long days = TimeUnit.MILLISECONDS.toDays(currentTime - milliseconds);
if (days == 0) {
// today
- return TracepointsMessages.bind(TracepointsMessages.TraceControlView_today, DateFormat.getTimeInstance(DateFormat.SHORT).format(date));
+ return TracepointsMessages.bind(TracepointsMessages.TraceControlView_today,
+ DateFormat.getTimeInstance(DateFormat.SHORT).format(date));
} else if (days == 1) {
// yesterday
- return TracepointsMessages.bind(TracepointsMessages.TraceControlView_yesterday, DateFormat.getTimeInstance(DateFormat.SHORT).format(date));
+ return TracepointsMessages.bind(TracepointsMessages.TraceControlView_yesterday,
+ DateFormat.getTimeInstance(DateFormat.SHORT).format(date));
}
-
+
return DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(date);
}
/**
- * Format time interval returned by trace status command into human-readable
+ * Format time interval returned by trace status command into human-readable
*/
protected String formatTimeInterval(String startTime, String stopTime) {
long startMicroseconds = 0;
long stopMicroseconds = 0;
- try {
+ try {
if (startTime.length() != 0) {
- String[] times = startTime.split("\\."); //$NON-NLS-1$
+ String[] times = startTime.split("\\."); //$NON-NLS-1$
startMicroseconds += Long.parseLong(times[0]) * 1000000;
startMicroseconds += Long.parseLong(times[1]);
}
if (stopTime.length() != 0) {
- String[] times = stopTime.split("\\."); //$NON-NLS-1$
+ String[] times = stopTime.split("\\."); //$NON-NLS-1$
stopMicroseconds += Long.parseLong(times[0]) * 1000000;
stopMicroseconds += Long.parseLong(times[1]);
}
- return formatTimeInterval(startMicroseconds/1000, stopMicroseconds/1000, true);
+ return formatTimeInterval(startMicroseconds / 1000, stopMicroseconds / 1000, true);
} catch (NumberFormatException ex) {
GdbPlugin.log(ex);
}
return EMPTY_STRING;
}
-
+
/**
- * Format time interval returned by trace status command into human-readable
+ * Format time interval returned by trace status command into human-readable
*/
protected String formatTimeInterval(long startMilliseconds, long stopMilliseconds, boolean shortForm) {
long millis = stopMilliseconds - startMilliseconds;
long days = TimeUnit.MILLISECONDS.toDays(millis);
- millis -= TimeUnit.DAYS.toMillis(days);
- long hours = TimeUnit.MILLISECONDS.toHours(millis);
- millis -= TimeUnit.HOURS.toMillis(hours);
- long minutes = TimeUnit.MILLISECONDS.toMinutes(millis);
- millis -= TimeUnit.MINUTES.toMillis(minutes);
- long seconds = TimeUnit.MILLISECONDS.toSeconds(millis);
-
- StringBuilder sb = new StringBuilder(64);
- if (!shortForm) {
- if (days != 0) sb.append(days).append(TracepointsMessages.TraceControlView_date_days);
- if (hours != 0) sb.append(hours).append(TracepointsMessages.TraceControlView_date_hours);
- if (minutes != 0) sb.append(minutes).append(TracepointsMessages.TraceControlView_date_minutes);
- if (seconds != 0) sb.append(seconds).append(TracepointsMessages.TraceControlView_date_seconds);
- if (sb.length() == 0) sb.append(TracepointsMessages.TraceControlView_date_zero);
- } else {
- if (days != 0) sb.append(days).append(TracepointsMessages.TraceControlView_date_short_days);
- if (hours != 0) sb.append(hours).append(TracepointsMessages.TraceControlView_date_short_hours);
- if (minutes != 0) sb.append(minutes).append(TracepointsMessages.TraceControlView_date_short_minutes);
- if (seconds != 0) sb.append(seconds).append(TracepointsMessages.TraceControlView_date_short_seconds);
- if (sb.length() == 0) sb.append(TracepointsMessages.TraceControlView_date_short_zero);
-
- }
- return(sb.toString());
- }
-
- /**
+ millis -= TimeUnit.DAYS.toMillis(days);
+ long hours = TimeUnit.MILLISECONDS.toHours(millis);
+ millis -= TimeUnit.HOURS.toMillis(hours);
+ long minutes = TimeUnit.MILLISECONDS.toMinutes(millis);
+ millis -= TimeUnit.MINUTES.toMillis(minutes);
+ long seconds = TimeUnit.MILLISECONDS.toSeconds(millis);
+
+ StringBuilder sb = new StringBuilder(64);
+ if (!shortForm) {
+ if (days != 0)
+ sb.append(days).append(TracepointsMessages.TraceControlView_date_days);
+ if (hours != 0)
+ sb.append(hours).append(TracepointsMessages.TraceControlView_date_hours);
+ if (minutes != 0)
+ sb.append(minutes).append(TracepointsMessages.TraceControlView_date_minutes);
+ if (seconds != 0)
+ sb.append(seconds).append(TracepointsMessages.TraceControlView_date_seconds);
+ if (sb.length() == 0)
+ sb.append(TracepointsMessages.TraceControlView_date_zero);
+ } else {
+ if (days != 0)
+ sb.append(days).append(TracepointsMessages.TraceControlView_date_short_days);
+ if (hours != 0)
+ sb.append(hours).append(TracepointsMessages.TraceControlView_date_short_hours);
+ if (minutes != 0)
+ sb.append(minutes).append(TracepointsMessages.TraceControlView_date_short_minutes);
+ if (seconds != 0)
+ sb.append(seconds).append(TracepointsMessages.TraceControlView_date_short_seconds);
+ if (sb.length() == 0)
+ sb.append(TracepointsMessages.TraceControlView_date_short_zero);
+
+ }
+ return (sb.toString());
+ }
+
+ /**
* GDB's set trace-user and set trace-notes commands require quotes if argument contains spaces,
- * but these quotes are returned by trace status, to workaround this we remove quotes on UI side
+ * but these quotes are returned by trace status, to workaround this we remove quotes on UI side
*/
protected String removeQuotes(String s) {
- if (s.startsWith("\"") && s.endsWith("\"")) { //$NON-NLS-1$//$NON-NLS-2$
- return s.substring(1, s.length()-1);
+ if (s.startsWith("\"") && s.endsWith("\"")) { //$NON-NLS-1$//$NON-NLS-2$
+ return s.substring(1, s.length() - 1);
} else {
return s;
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/TraceVarDetailsDialog.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/TraceVarDetailsDialog.java
index aee11ab019a..0fe82058e94 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/TraceVarDetailsDialog.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/TraceVarDetailsDialog.java
@@ -46,7 +46,7 @@ import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.plugin.AbstractUIPlugin;
public final class TraceVarDetailsDialog extends Dialog {
-
+
private Button createButton = null;
private Button refreshButton = null;
private Table table = null;
@@ -62,7 +62,7 @@ public final class TraceVarDetailsDialog extends Dialog {
setShellStyle(getShellStyle() | SWT.RESIZE | SWT.MAX);
fView = view;
}
-
+
@Override
protected Control createDialogArea(Composite parent) {
getShell().setText(TracepointsMessages.TraceControlView_trace_variable_details_dialog_title);
@@ -90,7 +90,7 @@ public final class TraceVarDetailsDialog extends Dialog {
nameTableColumn.setWidth(150);
nameTableColumn.setText(TracepointsMessages.TraceControlView_trace_variable_details_column_name);
nameTableColumn.setAlignment(SWT.LEFT);
-
+
final TableColumn initValTableColumn = new TableColumn(table, SWT.NONE);
initValTableColumn.setWidth(120);
initValTableColumn.setText(TracepointsMessages.TraceControlView_trace_variable_details_column_init_value);
@@ -111,10 +111,10 @@ public final class TraceVarDetailsDialog extends Dialog {
});
refreshButton.setText(TracepointsMessages.TraceControlView_trace_variable_details_refresh_button);
refreshButton.setEnabled(true);
-
+
Label separator = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
separator.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-
+
// Create the section to create a new variable
Composite createComposite = new Composite(composite, SWT.NONE);
gridLayout = new GridLayout(1, false);
@@ -134,7 +134,7 @@ public final class TraceVarDetailsDialog extends Dialog {
nameLabel.setText(TracepointsMessages.TraceControlView_trace_variable_details_name_label);
nameInput = new Text(inputComposite, SWT.BORDER);
nameInput.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-
+
Label valueLabel = new Label(inputComposite, SWT.NONE);
valueLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
valueLabel.setText(TracepointsMessages.TraceControlView_trace_variable_details_value_label);
@@ -163,40 +163,40 @@ public final class TraceVarDetailsDialog extends Dialog {
warningIconLabel = new Label(createButtonComposite, SWT.NONE);
warningIconLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
- warningImage = AbstractUIPlugin
- .imageDescriptorFromPlugin(
- GdbUIPlugin.PLUGIN_ID, "icons/full/obj16/warning.gif").createImage(); //$NON-NLS-1$
+ warningImage = AbstractUIPlugin.imageDescriptorFromPlugin(GdbUIPlugin.PLUGIN_ID, "icons/full/obj16/warning.gif") //$NON-NLS-1$
+ .createImage();
warningIconLabel.setImage(warningImage);
warningIconLabel.setVisible(false);
-
+
warningTextLabel = new Label(createButtonComposite, SWT.NONE);
warningTextLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
parent.addDisposeListener(new DisposeListener() {
- @Override
+ @Override
public void widgetDisposed(DisposeEvent e) {
if (warningImage != null)
warningImage.dispose();
}
});
-
+
// When the user goes into either input field, then pressing return
// should try to create the command
FocusListener clearWarningFocusListener = new FocusListener() {
- @Override
+ @Override
public void focusGained(FocusEvent e) {
getShell().setDefaultButton(createButton);
}
- @Override
+
+ @Override
public void focusLost(FocusEvent e) {
}
};
-
+
nameInput.addFocusListener(clearWarningFocusListener);
valueInput.addFocusListener(clearWarningFocusListener);
// When the user modifies any entry in the input, we should clear any warning
ModifyListener clearWarningListener = new ModifyListener() {
- @Override
+ @Override
public void modifyText(ModifyEvent e) {
setWarningVisible(false);
}
@@ -210,11 +210,11 @@ public final class TraceVarDetailsDialog extends Dialog {
return composite;
}
-
+
/**
* Set the visibility of the warning. Should be set to true when there
* is a problem creating the specific variable; false otherwise
- *
+ *
* @param visible
* True for visible, false for hidden.
*/
@@ -222,14 +222,14 @@ public final class TraceVarDetailsDialog extends Dialog {
if (warningIconLabel == null)
return;
warningIconLabel.setVisible(visible);
-
+
if (visible == false) {
if (warningTextLabel != null) {
warningTextLabel.setText(""); //$NON-NLS-1$
}
}
}
-
+
/**
* Set the visibility of the warning icon to true and set its
* text to the parameter message.
@@ -245,10 +245,9 @@ public final class TraceVarDetailsDialog extends Dialog {
@Override
protected void createButtonsForButtonBar(Composite parent) {
// create Close button only
- createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL,
- true);
+ createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, true);
}
-
+
@Override
protected void buttonPressed(int buttonId) {
if (IDialogConstants.CLOSE_ID == buttonId) {
@@ -263,7 +262,7 @@ public final class TraceVarDetailsDialog extends Dialog {
createButton.setEnabled(false);
return;
}
-
+
// Remove the warning and re-enable the create button, since we now
// have a list of trace variables.
setWarningVisible(false);
@@ -291,7 +290,7 @@ public final class TraceVarDetailsDialog extends Dialog {
break;
}
}
-
+
if (index == -1) {
index = items.length;
}
@@ -306,7 +305,7 @@ public final class TraceVarDetailsDialog extends Dialog {
nameInput.setText(""); //$NON-NLS-1$
valueInput.setText("0"); //$NON-NLS-1$
}
-
+
protected void handleCreate() {
String name = nameInput.getText();
if (name != null && !name.isEmpty()) {
@@ -314,7 +313,7 @@ public final class TraceVarDetailsDialog extends Dialog {
if (value != null && value.length() == 0) {
value = null; // No value specified
}
-
+
try {
fView.fTraceControlModel.createVariable(name, value);
resetInputFields();
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/TracepointImageRegistry.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/TracepointImageRegistry.java
index e42a23ddfcc..e90abca9111 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/TracepointImageRegistry.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/TracepointImageRegistry.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* Dmitry Kozlov (Mentor Graphics) - Trace control view enhancements (Bug 390827)
@@ -29,47 +29,55 @@ public class TracepointImageRegistry extends AbstractImageRegistry {
private static List<Object[]> fStore = new ArrayList<Object[]>();
private static String add(String plugin, String[] dirs, String name) {
- String key = plugin+'/'+dirs[0]+'/'+name;
- fStore.add(new Object[] {key, plugin, dirs, name});
- return key;
+ String key = plugin + '/' + dirs[0] + '/' + name;
+ fStore.add(new Object[] { key, plugin, dirs, name });
+ return key;
}
-
- private static final String ORG_ECLIPSE_UI_PLUGIN_ID = "org.eclipse.ui"; //$NON-NLS-1$
- private static final String ORG_ECLIPSE_CDT_DSF_GDB_UI_PLUGIN_ID = "org.eclipse.cdt.dsf.gdb.ui"; //$NON-NLS-1$
-
- public static final String ICON_Refresh_enabled = add(ORG_ECLIPSE_UI_PLUGIN_ID, new String[] {"full/elcl16"}, "refresh_nav.png"); //$NON-NLS-1$ //$NON-NLS-2$
- public static final String ICON_Refresh_disabled = add(ORG_ECLIPSE_UI_PLUGIN_ID, new String[] {"full/dlcl16"}, "refresh_nav.png"); //$NON-NLS-1$ //$NON-NLS-2$
- public static final String ICON_Refresh_Auto = add(ORG_ECLIPSE_CDT_DSF_GDB_UI_PLUGIN_ID, new String[] {"full/obj16"}, "refresh_auto.gif"); //$NON-NLS-1$ //$NON-NLS-2$
- public static final String ICON_Disconnected_Tracing = add(ORG_ECLIPSE_CDT_DSF_GDB_UI_PLUGIN_ID, new String[] {"full/obj16"}, "disconnected_tracing.png"); //$NON-NLS-1$ //$NON-NLS-2$
- public static final String ICON_Circular_Buffer = add(ORG_ECLIPSE_CDT_DSF_GDB_UI_PLUGIN_ID, new String[] {"full/obj16"}, "circular_buffer.png"); //$NON-NLS-1$ //$NON-NLS-2$
- public static final String ICON_Trace_Variables = add(ORG_ECLIPSE_CDT_DSF_GDB_UI_PLUGIN_ID, new String[] {"full/obj16"}, "tracevariables.gif"); //$NON-NLS-1$ //$NON-NLS-2$
- public static final String ICON_Exit_Visualization = add(ORG_ECLIPSE_CDT_DSF_GDB_UI_PLUGIN_ID, new String[] {"full/obj16"}, "stop_visual_trace.gif"); //$NON-NLS-1$ //$NON-NLS-2$
- public static final String ICON_Edit_enabled = add(ORG_ECLIPSE_CDT_DSF_GDB_UI_PLUGIN_ID, new String[] {"full/obj16"}, "write_obj.gif"); //$NON-NLS-1$ //$NON-NLS-2$
-
- private static TracepointImageRegistry INSTANCE = new TracepointImageRegistry(GdbUIPlugin.getDefault());
-
- TracepointImageRegistry(Plugin plugin) {
+
+ private static final String ORG_ECLIPSE_UI_PLUGIN_ID = "org.eclipse.ui"; //$NON-NLS-1$
+ private static final String ORG_ECLIPSE_CDT_DSF_GDB_UI_PLUGIN_ID = "org.eclipse.cdt.dsf.gdb.ui"; //$NON-NLS-1$
+
+ public static final String ICON_Refresh_enabled = add(ORG_ECLIPSE_UI_PLUGIN_ID, new String[] { "full/elcl16" }, //$NON-NLS-1$
+ "refresh_nav.png"); //$NON-NLS-1$
+ public static final String ICON_Refresh_disabled = add(ORG_ECLIPSE_UI_PLUGIN_ID, new String[] { "full/dlcl16" }, //$NON-NLS-1$
+ "refresh_nav.png"); //$NON-NLS-1$
+ public static final String ICON_Refresh_Auto = add(ORG_ECLIPSE_CDT_DSF_GDB_UI_PLUGIN_ID,
+ new String[] { "full/obj16" }, "refresh_auto.gif"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final String ICON_Disconnected_Tracing = add(ORG_ECLIPSE_CDT_DSF_GDB_UI_PLUGIN_ID,
+ new String[] { "full/obj16" }, "disconnected_tracing.png"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final String ICON_Circular_Buffer = add(ORG_ECLIPSE_CDT_DSF_GDB_UI_PLUGIN_ID,
+ new String[] { "full/obj16" }, "circular_buffer.png"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final String ICON_Trace_Variables = add(ORG_ECLIPSE_CDT_DSF_GDB_UI_PLUGIN_ID,
+ new String[] { "full/obj16" }, "tracevariables.gif"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final String ICON_Exit_Visualization = add(ORG_ECLIPSE_CDT_DSF_GDB_UI_PLUGIN_ID,
+ new String[] { "full/obj16" }, "stop_visual_trace.gif"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final String ICON_Edit_enabled = add(ORG_ECLIPSE_CDT_DSF_GDB_UI_PLUGIN_ID,
+ new String[] { "full/obj16" }, "write_obj.gif"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ private static TracepointImageRegistry INSTANCE = new TracepointImageRegistry(GdbUIPlugin.getDefault());
+
+ TracepointImageRegistry(Plugin plugin) {
super(plugin);
initialize();
}
- void initialize() {
- for (Iterator<Object[]> iter = fStore.iterator(); iter.hasNext();) {
- Object[] element = iter.next();
- if (element.length == 2) {
- String dir= (String) element[0];
- String name= (String) element[1];
- localImage(name, dir, name);
- } else {
- String key = (String) element[0];
- String plugin= (String) element[1];
- String[] dirs= (String[]) element[2];
- String name= (String) element[3];
- externalImage(key, plugin, dirs, name);
- }
- }
+ void initialize() {
+ for (Iterator<Object[]> iter = fStore.iterator(); iter.hasNext();) {
+ Object[] element = iter.next();
+ if (element.length == 2) {
+ String dir = (String) element[0];
+ String name = (String) element[1];
+ localImage(name, dir, name);
+ } else {
+ String key = (String) element[0];
+ String plugin = (String) element[1];
+ String[] dirs = (String[]) element[2];
+ String name = (String) element[3];
+ externalImage(key, plugin, dirs, name);
+ }
+ }
}
-
+
public static ImageDescriptor getImageDescriptor(String key) {
return INSTANCE.getDescriptor(key);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/TracepointsMessages.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/TracepointsMessages.java
index f934e0c00d2..7f7d2ea63c3 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/TracepointsMessages.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/TracepointsMessages.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* Dmitry Kozlov (Mentor Graphics) - trace control view enhancements (Bug 390827)
@@ -24,6 +24,7 @@ public final class TracepointsMessages extends NLS {
private TracepointsMessages() {
// Do not instantiate
}
+
public static String TraceControlView_buffer_label;
public static String TraceControlView_buffer_circular_button_label;
public static String TraceControlView_buffer_circular_on_tooltip;
@@ -81,18 +82,18 @@ public final class TracepointsMessages extends NLS {
public static String TraceControlView_today;
public static String TraceControlView_yesterday;
public static String TraceControlView_date_days;
- public static String TraceControlView_date_hours;
- public static String TraceControlView_date_minutes;
+ public static String TraceControlView_date_hours;
+ public static String TraceControlView_date_minutes;
public static String TraceControlView_date_seconds;
public static String TraceControlView_date_zero;
public static String TraceControlView_date_short_days;
- public static String TraceControlView_date_short_hours;
- public static String TraceControlView_date_short_minutes;
+ public static String TraceControlView_date_short_hours;
+ public static String TraceControlView_date_short_minutes;
public static String TraceControlView_date_short_seconds;
public static String TraceControlView_date_short_zero;
// Not used
public static String TraceControlView_tracing_stopped_at;
-
+
static {
NLS.initializeMessages(TracepointsMessages.class.getName(), TracepointsMessages.class);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/FetchMoreChildrenEvent.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/FetchMoreChildrenEvent.java
index 3630931782f..200a845de32 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/FetchMoreChildrenEvent.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/FetchMoreChildrenEvent.java
@@ -19,19 +19,19 @@ import org.eclipse.jface.viewers.TreePath;
/**
* Event to fetch additional children for and expression context.
- *
+ *
* @since 3.0
*/
public class FetchMoreChildrenEvent extends AbstractDMEvent<IExpressionDMContext> {
-
+
private TreePath path;
-
- public FetchMoreChildrenEvent(IExpressionDMContext exprCtx, TreePath path) {
- super(exprCtx);
- this.path = path;
- }
-
- public TreePath getPath() {
- return path;
- }
+
+ public FetchMoreChildrenEvent(IExpressionDMContext exprCtx, TreePath path) {
+ super(exprCtx);
+ this.path = path;
+ }
+
+ public TreePath getPath() {
+ return path;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/GdbExpressionVMProvider.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/GdbExpressionVMProvider.java
index 8ebbb640ce8..f9c6adc4eeb 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/GdbExpressionVMProvider.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/GdbExpressionVMProvider.java
@@ -60,179 +60,181 @@ public class GdbExpressionVMProvider extends ExpressionVMProvider {
/**
* Constructor (passthru)
*/
- public GdbExpressionVMProvider(AbstractVMAdapter adapter,
- IPresentationContext context, DsfSession session) {
+ public GdbExpressionVMProvider(AbstractVMAdapter adapter, IPresentationContext context, DsfSession session) {
super(adapter, context, session);
- final IPreferenceStore store = GdbUIPlugin.getDefault().getPreferenceStore();
-
- Integer childCountLimit = store.getInt(IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS);
- if (childCountLimit != 0) {
- getPresentationContext().setProperty(IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS,
- childCountLimit);
- }
-
- fPreferencesListener = new IPropertyChangeListener() {
- @Override
+ final IPreferenceStore store = GdbUIPlugin.getDefault().getPreferenceStore();
+
+ Integer childCountLimit = store
+ .getInt(IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS);
+ if (childCountLimit != 0) {
+ getPresentationContext().setProperty(
+ IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS, childCountLimit);
+ }
+
+ fPreferencesListener = new IPropertyChangeListener() {
+ @Override
public void propertyChange(final PropertyChangeEvent event) {
handlePropertyChanged(store, event);
- }};
- store.addPropertyChangeListener(fPreferencesListener);
+ }
+ };
+ store.addPropertyChangeListener(fPreferencesListener);
}
- @Override
+ @Override
public void dispose() {
super.dispose();
-
- final IPreferenceStore store = GdbUIPlugin.getDefault().getPreferenceStore();
+
+ final IPreferenceStore store = GdbUIPlugin.getDefault().getPreferenceStore();
store.removePropertyChangeListener(fPreferencesListener);
}
/**
* The only difference between this and our super implementation is that we
- * create a GdbVariableVMNode instead of a VariableVMNode.
- *
+ * create a GdbVariableVMNode instead of a VariableVMNode.
+ *
* @see org.eclipse.cdt.dsf.debug.ui.viewmodel.expression.ExpressionVMProvider#configureLayout()
*/
- @Override
+ @Override
protected void configureLayout() {
-
- /*
- * Allocate the synchronous data providers.
- */
- SyncRegisterDataAccess syncRegDataAccess = new SyncRegisterDataAccess(getSession());
- SyncVariableDataAccess syncvarDataAccess = new SyncVariableDataAccess(getSession()) ;
-
- /*
- * Create the top level node which provides the anchor starting point.
- */
- IRootVMNode rootNode = new RootDMVMNode(this);
-
- /*
- * Now the Over-arching management node.
- */
- if (IDsfDebugUIConstants.ID_EXPRESSION_HOVER.equals(getPresentationContext().getId())) {
- SingleExpressionVMNode expressionManagerNode = new SingleExpressionVMNode(this);
- addChildNodes(rootNode, new IVMNode[] { expressionManagerNode });
- } else {
- ExpressionManagerVMNode expressionManagerNode = new ExpressionManagerVMNode(this);
- addChildNodes(rootNode, new IVMNode[] {expressionManagerNode});
- }
-
- // Disabled expression node intercepts disabled expressions and prevents them from being
- // evaluated by other nodes.
- IExpressionVMNode disabledExpressionNode = new DisabledExpressionVMNode(this);
-
- /*
- * The expression view wants to support fully all of the components of the register view.
- */
- IExpressionVMNode registerGroupNode = new RegisterGroupVMNode(this, getSession(), syncRegDataAccess);
-
- IExpressionVMNode registerNode = new RegisterVMNode(this, getSession(), syncRegDataAccess);
- addChildNodes(registerGroupNode, new IExpressionVMNode[] {registerNode});
-
- /*
- * Create the next level which is the bit-field level.
- */
- IVMNode bitFieldNode = new RegisterBitFieldVMNode(this, getSession(), syncRegDataAccess);
- addChildNodes(registerNode, new IVMNode[] { bitFieldNode });
-
- /*
- * Create the support for the SubExpressions. Anything which is brought into the expressions
- * view comes in as a fully qualified expression so we go directly to the SubExpression layout
- * node.
- */
- IExpressionVMNode variableNode = new GdbVariableVMNode(this, getSession(), syncvarDataAccess);
- addChildNodes(variableNode, new IExpressionVMNode[] {variableNode});
-
- /* Wire up the casting support. IExpressions2 service is always available
+
+ /*
+ * Allocate the synchronous data providers.
+ */
+ SyncRegisterDataAccess syncRegDataAccess = new SyncRegisterDataAccess(getSession());
+ SyncVariableDataAccess syncvarDataAccess = new SyncVariableDataAccess(getSession());
+
+ /*
+ * Create the top level node which provides the anchor starting point.
+ */
+ IRootVMNode rootNode = new RootDMVMNode(this);
+
+ /*
+ * Now the Over-arching management node.
+ */
+ if (IDsfDebugUIConstants.ID_EXPRESSION_HOVER.equals(getPresentationContext().getId())) {
+ SingleExpressionVMNode expressionManagerNode = new SingleExpressionVMNode(this);
+ addChildNodes(rootNode, new IVMNode[] { expressionManagerNode });
+ } else {
+ ExpressionManagerVMNode expressionManagerNode = new ExpressionManagerVMNode(this);
+ addChildNodes(rootNode, new IVMNode[] { expressionManagerNode });
+ }
+
+ // Disabled expression node intercepts disabled expressions and prevents them from being
+ // evaluated by other nodes.
+ IExpressionVMNode disabledExpressionNode = new DisabledExpressionVMNode(this);
+
+ /*
+ * The expression view wants to support fully all of the components of the register view.
+ */
+ IExpressionVMNode registerGroupNode = new RegisterGroupVMNode(this, getSession(), syncRegDataAccess);
+
+ IExpressionVMNode registerNode = new RegisterVMNode(this, getSession(), syncRegDataAccess);
+ addChildNodes(registerGroupNode, new IExpressionVMNode[] { registerNode });
+
+ /*
+ * Create the next level which is the bit-field level.
+ */
+ IVMNode bitFieldNode = new RegisterBitFieldVMNode(this, getSession(), syncRegDataAccess);
+ addChildNodes(registerNode, new IVMNode[] { bitFieldNode });
+
+ /*
+ * Create the support for the SubExpressions. Anything which is brought into the expressions
+ * view comes in as a fully qualified expression so we go directly to the SubExpression layout
+ * node.
+ */
+ IExpressionVMNode variableNode = new GdbVariableVMNode(this, getSession(), syncvarDataAccess);
+ addChildNodes(variableNode, new IExpressionVMNode[] { variableNode });
+
+ /* Wire up the casting support. IExpressions2 service is always available
* for gdb. No need to call hookUpCastingSupport */
((VariableVMNode) variableNode).setCastToTypeSupport(
new DsfCastToTypeSupport(getSession(), GdbExpressionVMProvider.this, syncvarDataAccess));
-
- /*
- * Tell the expression node which sub-nodes it will directly support. It is very important
- * that the variables node be the last in this chain. The model assumes that there is some
- * form of metalanguage expression syntax which each of the nodes evaluates and decides if
- * they are dealing with it or not. The variables node assumes that the expression is fully
- * qualified and there is no analysis or subdivision of the expression it will parse. So it
- * it currently the case that the location of the nodes within the array being passed in is
- * the order of search/evaluation. Thus variables wants to be last. Otherwise it would just
- * assume what it was passed was for it and the real node which wants to handle it would be
- * left out in the cold.
- */
- setExpressionNodes(new IExpressionVMNode[] {disabledExpressionNode, registerGroupNode, variableNode});
-
- /*
- * Let the work know which is the top level node.
- */
- setRootNode(rootNode);
- }
-
+
+ /*
+ * Tell the expression node which sub-nodes it will directly support. It is very important
+ * that the variables node be the last in this chain. The model assumes that there is some
+ * form of metalanguage expression syntax which each of the nodes evaluates and decides if
+ * they are dealing with it or not. The variables node assumes that the expression is fully
+ * qualified and there is no analysis or subdivision of the expression it will parse. So it
+ * it currently the case that the location of the nodes within the array being passed in is
+ * the order of search/evaluation. Thus variables wants to be last. Otherwise it would just
+ * assume what it was passed was for it and the real node which wants to handle it would be
+ * left out in the cold.
+ */
+ setExpressionNodes(new IExpressionVMNode[] { disabledExpressionNode, registerGroupNode, variableNode });
+
+ /*
+ * Let the work know which is the top level node.
+ */
+ setRootNode(rootNode);
+ }
+
@Override
public void handleEvent(Object event, final RequestMonitor rm) {
- if (event instanceof DoubleClickEvent && !isDisposed()) {
-
- final ISelection selection= ((DoubleClickEvent) event).getSelection();
- if (selection instanceof IStructuredSelection) {
-
- Object element= ((IStructuredSelection) selection).getFirstElement();
- if (element instanceof IncompleteChildrenVMC) {
-
- IncompleteChildrenVMC incompleteChildrenVmc = ((IncompleteChildrenVMC) element);
- IVMNode node = incompleteChildrenVmc.getVMNode();
- if (node instanceof GdbVariableVMNode && node.getVMProvider() == this) {
-
- if (selection instanceof ITreeSelection) {
- ITreeSelection treeSelection = (ITreeSelection) selection;
- TreePath path = treeSelection.getPaths()[0];
-
- IExpressionDMContext exprCtx = incompleteChildrenVmc.getParentDMContext();
- ((GdbVariableVMNode) node).incrementChildCountLimit(exprCtx);
-
- // replace double click event with the fetch more children event.
- final FetchMoreChildrenEvent fetchMoreChildrenEvent = new FetchMoreChildrenEvent(
- exprCtx, path);
- getExecutor().execute(new DsfRunnable() {
- @Override
- public void run() {
- handleEvent(fetchMoreChildrenEvent, rm);
- }
- });
-
- return;
- }
- }
- }
- }
- }
-
+ if (event instanceof DoubleClickEvent && !isDisposed()) {
+
+ final ISelection selection = ((DoubleClickEvent) event).getSelection();
+ if (selection instanceof IStructuredSelection) {
+
+ Object element = ((IStructuredSelection) selection).getFirstElement();
+ if (element instanceof IncompleteChildrenVMC) {
+
+ IncompleteChildrenVMC incompleteChildrenVmc = ((IncompleteChildrenVMC) element);
+ IVMNode node = incompleteChildrenVmc.getVMNode();
+ if (node instanceof GdbVariableVMNode && node.getVMProvider() == this) {
+
+ if (selection instanceof ITreeSelection) {
+ ITreeSelection treeSelection = (ITreeSelection) selection;
+ TreePath path = treeSelection.getPaths()[0];
+
+ IExpressionDMContext exprCtx = incompleteChildrenVmc.getParentDMContext();
+ ((GdbVariableVMNode) node).incrementChildCountLimit(exprCtx);
+
+ // replace double click event with the fetch more children event.
+ final FetchMoreChildrenEvent fetchMoreChildrenEvent = new FetchMoreChildrenEvent(exprCtx,
+ path);
+ getExecutor().execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ handleEvent(fetchMoreChildrenEvent, rm);
+ }
+ });
+
+ return;
+ }
+ }
+ }
+ }
+ }
+
super.handleEvent(event, rm);
}
- /**
- * @param store
- * @param event
- *
- * @since 3.0
- */
+ /**
+ * @param store
+ * @param event
+ *
+ * @since 3.0
+ */
protected void handlePropertyChanged(final IPreferenceStore store, final PropertyChangeEvent event) {
String property = event.getProperty();
if (IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS.equals(property)) {
- Integer childCountLimit = store.getInt(IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS);
-
- if (childCountLimit != 0) {
- getPresentationContext().setProperty(IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS,
- childCountLimit);
- } else {
- getPresentationContext().setProperty(IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS,
- null);
- }
-
+ Integer childCountLimit = store
+ .getInt(IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS);
+
+ if (childCountLimit != 0) {
+ getPresentationContext().setProperty(
+ IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS, childCountLimit);
+ } else {
+ getPresentationContext()
+ .setProperty(IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS, null);
+ }
+
getExecutor().execute(new DsfRunnable() {
- @Override
- public void run() {
- handleEvent(event);
- }
+ @Override
+ public void run() {
+ handleEvent(event);
+ }
});
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/GdbVariableVMNode.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/GdbVariableVMNode.java
index a59c757b46c..1fe6d290a0f 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/GdbVariableVMNode.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/GdbVariableVMNode.java
@@ -97,53 +97,53 @@ public class GdbVariableVMNode extends VariableVMNode {
// fillUpdateWithVMCs. fillUpdateWithVMCs checks whether there are
// limit + 1 children, and if so, will create an IncompleteChildrenVMC
// for the last child, discarding the original expression context.
-
+
/**
* Specialization of VariableVMNode.VariableExpressionVMC that participates
* in the "Add Watchpoint" object contribution action.
*/
public class GdbVariableExpressionVMC extends VariableVMNode.VariableExpressionVMC implements ICWatchpointTarget {
-
+
/**
* Constructor (passthru)
*/
public GdbVariableExpressionVMC(IDMContext dmc) {
- super(dmc);
- }
-
+ super(dmc);
+ }
+
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.core.IWatchpointTarget#getSize()
*/
- @Override
+ @Override
public void getSize(final ICWatchpointTarget.GetSizeRequest request) {
- final IExpressionDMContext exprDmc = DMContexts.getAncestorOfType(getDMContext(), IExpressionDMContext.class);
+ final IExpressionDMContext exprDmc = DMContexts.getAncestorOfType(getDMContext(),
+ IExpressionDMContext.class);
if (exprDmc != null) {
- getSession().getExecutor().execute(new Runnable() {
- @Override
- public void run() {
- final IExpressions expressionService = getServicesTracker().getService(IExpressions.class);
- if (expressionService != null) {
- final DataRequestMonitor<IExpressionDMAddress> drm = new DataRequestMonitor<IExpressionDMAddress>(getSession().getExecutor(), null) {
- @Override
+ getSession().getExecutor().execute(new Runnable() {
+ @Override
+ public void run() {
+ final IExpressions expressionService = getServicesTracker().getService(IExpressions.class);
+ if (expressionService != null) {
+ final DataRequestMonitor<IExpressionDMAddress> drm = new DataRequestMonitor<IExpressionDMAddress>(
+ getSession().getExecutor(), null) {
+ @Override
public void handleCompleted() {
- if (isSuccess()) {
- request.setSize(getData().getSize());
- }
- request.setStatus(getStatus());
- request.done();
- }
- };
-
- expressionService.getExpressionAddressData(exprDmc, drm);
- }
- else {
- request.setStatus(internalError());
- request.done();
- }
- }
- });
- }
- else {
+ if (isSuccess()) {
+ request.setSize(getData().getSize());
+ }
+ request.setStatus(getStatus());
+ request.done();
+ }
+ };
+
+ expressionService.getExpressionAddressData(exprDmc, drm);
+ } else {
+ request.setStatus(internalError());
+ request.done();
+ }
+ }
+ });
+ } else {
request.setStatus(internalError());
request.done();
}
@@ -152,40 +152,40 @@ public class GdbVariableVMNode extends VariableVMNode {
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.core.IWatchpointTarget#canCreateWatchpoint(org.eclipse.cdt.debug.internal.core.IWatchpointTarget.CanCreateWatchpointRequest)
*/
- @Override
+ @Override
public void canSetWatchpoint(final ICWatchpointTarget.CanCreateWatchpointRequest request) {
// If the expression is an l-value, then we say it supports a
// watchpoint. The logic here is basically the same as what's in
// getSize(), as the same DSF service method tells us (a) if it's an
// lvalue, and (b) its size.
- final IExpressionDMContext exprDmc = DMContexts.getAncestorOfType(getDMContext(), IExpressionDMContext.class);
+ final IExpressionDMContext exprDmc = DMContexts.getAncestorOfType(getDMContext(),
+ IExpressionDMContext.class);
if (exprDmc != null) {
- getSession().getExecutor().execute(new Runnable() {
- @Override
- public void run() {
- final IExpressions expressionService = getServicesTracker().getService(IExpressions.class);
- if (expressionService != null) {
- final DataRequestMonitor<IExpressionDMAddress> drm = new DataRequestMonitor<IExpressionDMAddress>(getSession().getExecutor(), null) {
- @Override
+ getSession().getExecutor().execute(new Runnable() {
+ @Override
+ public void run() {
+ final IExpressions expressionService = getServicesTracker().getService(IExpressions.class);
+ if (expressionService != null) {
+ final DataRequestMonitor<IExpressionDMAddress> drm = new DataRequestMonitor<IExpressionDMAddress>(
+ getSession().getExecutor(), null) {
+ @Override
public void handleCompleted() {
- if (isSuccess()) {
- request.setCanCreate(getData().getSize() > 0);
- }
- request.setStatus(getStatus());
- request.done();
- }
- };
-
- expressionService.getExpressionAddressData(exprDmc, drm);
- }
- else {
- request.setStatus(internalError());
- request.done();
- }
- }
- });
- }
- else {
+ if (isSuccess()) {
+ request.setCanCreate(getData().getSize() > 0);
+ }
+ request.setStatus(getStatus());
+ request.done();
+ }
+ };
+
+ expressionService.getExpressionAddressData(exprDmc, drm);
+ } else {
+ request.setStatus(internalError());
+ request.done();
+ }
+ }
+ });
+ } else {
request.setStatus(internalError());
request.done();
}
@@ -199,19 +199,19 @@ public class GdbVariableVMNode extends VariableVMNode {
}
return super.canViewInMemory();
}
-
- @SuppressWarnings({ "unchecked", "rawtypes" })
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
@Override
- public Object getAdapter(Class adapter) {
- if (adapter.isAssignableFrom(IWatchExpressionFactoryAdapter2.class)) {
- return fGdbVariableExpressionFactory;
- }
- return super.getAdapter(adapter);
- }
+ public Object getAdapter(Class adapter) {
+ if (adapter.isAssignableFrom(IWatchExpressionFactoryAdapter2.class)) {
+ return fGdbVariableExpressionFactory;
+ }
+ return super.getAdapter(adapter);
+ }
};
-
+
private static boolean isConvenienceVariable(String expr) {
- // GDB convenience variables are variables that start with a $ followed
+ // GDB convenience variables are variables that start with a $ followed
// by at least one digit.
// Note that registers also start with a $, so we need to make sure
// there is a digit immediately following the $.
@@ -222,12 +222,12 @@ public class GdbVariableVMNode extends VariableVMNode {
// Convenience variables are used for return values of methods calls.
// see bug 341731
if (expr.matches(".*" + "\\$\\d" + ".*")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- return true;
+ return true;
}
return false;
}
-
+
private static boolean isRegisterExpression(String expr) {
// Registers expressions start with a $ followed by a non-digit.
// We must check for the non-digit because we need to make sure
@@ -237,7 +237,7 @@ public class GdbVariableVMNode extends VariableVMNode {
// such as (int)($eax)
// So, we look for a $ followed by a non-digit, anywhere in the expression.
if (expr.matches(".*" + "\\$\\D" + ".*")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- return true;
+ return true;
}
return false;
@@ -246,31 +246,31 @@ public class GdbVariableVMNode extends VariableVMNode {
/**
* A factory to control the "Watch" action for GDB variables.
*/
- protected class GdbVariableExpressionFactory extends VariableExpressionFactory {
- @Override
- public boolean canCreateWatchExpression(Object element) {
- if (element instanceof VariableExpressionVMC) {
- String expression = ((VariableExpressionVMC)element).getExpression();
- if (isConvenienceVariable(expression)) {
- return false;
- }
- }
-
- return super.canCreateWatchExpression(element);
- }
- }
-
- final protected VariableExpressionFactory fGdbVariableExpressionFactory = new GdbVariableExpressionFactory();
+ protected class GdbVariableExpressionFactory extends VariableExpressionFactory {
+ @Override
+ public boolean canCreateWatchExpression(Object element) {
+ if (element instanceof VariableExpressionVMC) {
+ String expression = ((VariableExpressionVMC) element).getExpression();
+ if (isConvenienceVariable(expression)) {
+ return false;
+ }
+ }
+
+ return super.canCreateWatchExpression(element);
+ }
+ }
+
+ final protected VariableExpressionFactory fGdbVariableExpressionFactory = new GdbVariableExpressionFactory();
/**
* The special context representing more children to be available.
- *
+ *
* @since 3.0
*/
public class IncompleteChildrenVMC extends AbstractVMContext {
private IExpressionDMContext parentDmc;
-
+
public IncompleteChildrenVMC(IExpressionDMContext exprDmc, int childCountLimit) {
super(GdbVariableVMNode.this);
this.parentDmc = exprDmc;
@@ -278,8 +278,7 @@ public class GdbVariableVMNode extends VariableVMNode {
@Override
public boolean equals(Object obj) {
- return obj instanceof IncompleteChildrenVMC &&
- ((IncompleteChildrenVMC)obj).parentDmc.equals(parentDmc);
+ return obj instanceof IncompleteChildrenVMC && ((IncompleteChildrenVMC) obj).parentDmc.equals(parentDmc);
}
@Override
@@ -289,20 +288,21 @@ public class GdbVariableVMNode extends VariableVMNode {
public IExpressionDMContext getParentDMContext() {
return parentDmc;
- }
+ }
}
-
+
/**
* Maps expressions to their current limit on the maximum number of children.
*/
private Map<IExpressionDMContext, Integer> childCountLimits = new HashMap<IExpressionDMContext, Integer>();
/**
- * Utility method to create an IStatus object for an internal error
+ * Utility method to create an IStatus object for an internal error
*/
private static Status internalError() {
return new Status(Status.ERROR, GdbUIPlugin.getUniqueIdentifier(), Messages.Internal_Error);
}
+
/**
* Constructor (passthru)
*/
@@ -317,14 +317,14 @@ public class GdbVariableVMNode extends VariableVMNode {
* "Add Watchpoint" context menu appears for variables and expressions in
* GDB-DSF sessions but not necessarily other DSF-based sessions [bugzilla
* 248606]
- *
+ *
* @see org.eclipse.cdt.dsf.debug.ui.viewmodel.variable.VariableVMNode#createVMContext(org.eclipse.cdt.dsf.datamodel.IDMContext)
*/
- @Override
- protected IDMVMContext createVMContext(IDMContext dmc) {
- return new GdbVariableExpressionVMC(dmc);
- }
-
+ @Override
+ protected IDMVMContext createVMContext(IDMContext dmc) {
+ return new GdbVariableExpressionVMC(dmc);
+ }
+
@Override
protected void updateHasElementsInSessionThread(final IHasChildrenUpdate update) {
if (update.getElement() instanceof IncompleteChildrenVMC) {
@@ -332,88 +332,88 @@ public class GdbVariableVMNode extends VariableVMNode {
update.done();
return;
}
-
+
super.updateHasElementsInSessionThread(update);
}
-
+
@Override
protected void updateElementCountInSessionThread(final IChildrenCountUpdate update) {
- // Get the data model context object for the current node in the hierarchy.
-
- final IExpressionDMContext expressionDMC = findDmcInPath(update.getViewerInput(), update.getElementPath(), IExpressionDMContext.class);
-
- if ( expressionDMC != null ) {
- final IExpressions expressionService = getServicesTracker().getService(IExpressions.class);
-
- if (expressionService == null) {
- handleFailedUpdate(update);
- return;
- }
-
- if (expressionService instanceof IMIExpressions) {
- final IMIExpressions miExpressions = (IMIExpressions) expressionService;
+ // Get the data model context object for the current node in the hierarchy.
+
+ final IExpressionDMContext expressionDMC = findDmcInPath(update.getViewerInput(), update.getElementPath(),
+ IExpressionDMContext.class);
+
+ if (expressionDMC != null) {
+ final IExpressions expressionService = getServicesTracker().getService(IExpressions.class);
+
+ if (expressionService == null) {
+ handleFailedUpdate(update);
+ return;
+ }
+
+ if (expressionService instanceof IMIExpressions) {
+ final IMIExpressions miExpressions = (IMIExpressions) expressionService;
miExpressions.safeToAskForAllSubExpressions(expressionDMC,
new ViewerDataRequestMonitor<Boolean>(getSession().getExecutor(), update) {
- @Override
- protected void handleCompleted() {
- if (! isSuccess()) {
- handleFailedUpdate(update);
- return;
- }
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ handleFailedUpdate(update);
+ return;
+ }
+
+ boolean limitRequired = !getData().booleanValue();
+ if (limitRequired) {
+
+ final int childCountLimit = getOrInitChildCountLimit(expressionDMC);
+
+ miExpressions.getSubExpressionCount(expressionDMC, childCountLimit + 1,
+ new ViewerDataRequestMonitor<Integer>(getExecutor(), update) {
+ @Override
+ public void handleCompleted() {
+ if (!isSuccess()) {
+ handleFailedUpdate(update);
+ return;
+ }
+
+ int childCount = getData();
+ if (childCountLimit < childCount) {
+ childCount = childCountLimit + 1;
+ }
+
+ update.setChildCount(childCount);
+ update.done();
+ }
+ });
+ } else {
+ GdbVariableVMNode.super.updateElementCountInSessionThread(update);
+ }
+ }
+ });
+
+ return;
+ }
+ }
- boolean limitRequired = ! getData().booleanValue();
- if (limitRequired) {
-
- final int childCountLimit = getOrInitChildCountLimit(expressionDMC);
-
- miExpressions.getSubExpressionCount(
- expressionDMC, childCountLimit + 1,
- new ViewerDataRequestMonitor<Integer>(getExecutor(), update) {
- @Override
- public void handleCompleted() {
- if (!isSuccess()) {
- handleFailedUpdate(update);
- return;
- }
-
- int childCount = getData();
- if (childCountLimit < childCount) {
- childCount = childCountLimit + 1;
- }
-
- update.setChildCount(childCount);
- update.done();
- }
- });
- } else {
- GdbVariableVMNode.super.updateElementCountInSessionThread(update);
- }
- }
- });
-
- return;
- }
- }
-
- super.updateElementCountInSessionThread(update);
+ super.updateElementCountInSessionThread(update);
}
@Override
- protected void fillUpdateWithVMCs(IChildrenUpdate update,
- IDMContext[] dmcs, int firstIndex) {
+ protected void fillUpdateWithVMCs(IChildrenUpdate update, IDMContext[] dmcs, int firstIndex) {
super.fillUpdateWithVMCs(update, dmcs, firstIndex);
-
- IExpressionDMContext expressionDMC = findDmcInPath(update.getViewerInput(), update.getElementPath(), IExpressionDMContext.class);
-
- if (expressionDMC != null) {
- int childCountLimit = getChildCountLimit(expressionDMC);
- int childCount = firstIndex + update.getLength();
- if (childCountLimit < childCount) {
- update.setChild(new IncompleteChildrenVMC(expressionDMC, childCountLimit), childCountLimit);
- }
- }
+
+ IExpressionDMContext expressionDMC = findDmcInPath(update.getViewerInput(), update.getElementPath(),
+ IExpressionDMContext.class);
+
+ if (expressionDMC != null) {
+ int childCountLimit = getChildCountLimit(expressionDMC);
+ int childCount = firstIndex + update.getLength();
+ if (childCountLimit < childCount) {
+ update.setChild(new IncompleteChildrenVMC(expressionDMC, childCountLimit), childCountLimit);
+ }
+ }
}
@Override
@@ -422,14 +422,11 @@ public class GdbVariableVMNode extends VariableVMNode {
for (IPropertiesUpdate update : updates) {
if (update.getElement() instanceof IncompleteChildrenVMC) {
- if (update.getProperties().contains(
- AbstractExpressionVMNode.PROP_ELEMENT_EXPRESSION)) {
- update.setProperty(
- AbstractExpressionVMNode.PROP_ELEMENT_EXPRESSION,
- Messages.More_Children);
+ if (update.getProperties().contains(AbstractExpressionVMNode.PROP_ELEMENT_EXPRESSION)) {
+ update.setProperty(AbstractExpressionVMNode.PROP_ELEMENT_EXPRESSION, Messages.More_Children);
}
-
+
if (update.getProperties().contains(PROP_NAME)) {
update.setProperty(PROP_NAME, Messages.More_Children);
}
@@ -438,26 +435,25 @@ public class GdbVariableVMNode extends VariableVMNode {
realExpressions.add(update);
}
}
-
+
super.update(realExpressions.toArray(new IPropertiesUpdate[realExpressions.size()]));
}
private int getInitialChildCountLimit() {
- Object initialLimitProperty = getVMProvider().getPresentationContext().getProperty(
- IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS);
-
- return (initialLimitProperty instanceof Integer) ? (Integer) initialLimitProperty
- : 100;
+ Object initialLimitProperty = getVMProvider().getPresentationContext()
+ .getProperty(IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS);
+
+ return (initialLimitProperty instanceof Integer) ? (Integer) initialLimitProperty : 100;
}
-
+
/**
* The given expression context requires a child count limit. If a limit
* is already available from preceding calls, obtain this limit. Otherwise
* calculate the initial value, store it, and return it.
- *
+ *
* @param expressionDMC
* @return The child count limit to apply for the given expression.
- *
+ *
* @since 3.0
*/
protected int getOrInitChildCountLimit(IExpressionDMContext expressionDMC) {
@@ -467,77 +463,75 @@ public class GdbVariableVMNode extends VariableVMNode {
int initialLimit = getInitialChildCountLimit();
childCountLimits.put(expressionDMC, initialLimit);
-
+
return initialLimit;
}
-
+
/**
* @param expressionDMC
* @return The currently stored child count limit for the given expression,
* or {@link Integer#MAX_VALUE} if no child count limit is currently
* stored.
- *
+ *
* @since 3.0
*/
protected int getChildCountLimit(IExpressionDMContext expressionDMC) {
if (childCountLimits.containsKey(expressionDMC)) {
return childCountLimits.get(expressionDMC);
}
- return Integer.MAX_VALUE;
+ return Integer.MAX_VALUE;
}
-
- private void resetChildCountLimits(IExecutionDMContext execCtx) {
- int initialLimit = getInitialChildCountLimit();
- for (IExpressionDMContext limitCtx : childCountLimits.keySet()) {
- if (DMContexts.isAncestorOf(limitCtx, execCtx)) {
- childCountLimits.put(limitCtx, initialLimit);
- }
+
+ private void resetChildCountLimits(IExecutionDMContext execCtx) {
+ int initialLimit = getInitialChildCountLimit();
+ for (IExpressionDMContext limitCtx : childCountLimits.keySet()) {
+ if (DMContexts.isAncestorOf(limitCtx, execCtx)) {
+ childCountLimits.put(limitCtx, initialLimit);
+ }
}
- }
-
- private void resetAllChildCountLimits() {
- int initialLimit = getInitialChildCountLimit();
- for (IExpressionDMContext limitCtx : childCountLimits.keySet()) {
- childCountLimits.put(limitCtx, initialLimit);
+ }
+
+ private void resetAllChildCountLimits() {
+ int initialLimit = getInitialChildCountLimit();
+ for (IExpressionDMContext limitCtx : childCountLimits.keySet()) {
+ childCountLimits.put(limitCtx, initialLimit);
}
- }
-
+ }
+
/**
* Increment the child count limit by the default increment.
* This implementation doubles the current limit.
- *
+ *
* @since 3.0
*/
public void incrementChildCountLimit(IExpressionDMContext expressionDMC) {
- assert(childCountLimits.containsKey(expressionDMC));
-
+ assert (childCountLimits.containsKey(expressionDMC));
+
int childCountLimit = getChildCountLimit(expressionDMC);
if (childCountLimit < Integer.MAX_VALUE / 2) {
childCountLimits.put(expressionDMC, childCountLimit * 2);
}
}
-
+
@Override
public int getDeltaFlags(Object e) {
int flags = super.getDeltaFlags(e);
-
+
if (e instanceof FetchMoreChildrenEvent) {
flags |= IModelDelta.CONTENT;
} else if (e instanceof ISuspendedDMEvent) {
// The child count limit must be reset.
flags |= IModelDelta.CONTENT;
- } else if (e instanceof PropertyChangeEvent) {
- String property = ((PropertyChangeEvent)e).getProperty();
- if (IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS.equals(property))
- {
- flags |= IModelDelta.CONTENT;
- }
+ } else if (e instanceof PropertyChangeEvent) {
+ String property = ((PropertyChangeEvent) e).getProperty();
+ if (IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS.equals(property)) {
+ flags |= IModelDelta.CONTENT;
+ }
}
-
+
return flags;
}
-
-
+
@Override
public int getDeltaFlagsForExpression(IExpression expression, Object event) {
int flags = super.getDeltaFlagsForExpression(expression, event);
@@ -546,109 +540,99 @@ public class GdbVariableVMNode extends VariableVMNode {
flags |= IModelDelta.CONTENT;
} else if (event instanceof PropertyChangeEvent) {
String property = ((PropertyChangeEvent) event).getProperty();
- if (IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS
- .equals(property)) {
+ if (IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS.equals(property)) {
flags |= IModelDelta.CONTENT;
}
}
return flags;
}
-
+
@Override
- public void buildDelta(Object e, VMDelta parentDelta, int nodeOffset,
- RequestMonitor rm) {
-
- if (e instanceof FetchMoreChildrenEvent) {
- buildDeltaForFetchMoreChildrenEvent((FetchMoreChildrenEvent) e, parentDelta, rm);
- return;
+ public void buildDelta(Object e, VMDelta parentDelta, int nodeOffset, RequestMonitor rm) {
+
+ if (e instanceof FetchMoreChildrenEvent) {
+ buildDeltaForFetchMoreChildrenEvent((FetchMoreChildrenEvent) e, parentDelta, rm);
+ return;
} else if (e instanceof ISuspendedDMEvent) {
resetChildCountLimits(((ISuspendedDMEvent) e).getDMContext());
- } else if (e instanceof PropertyChangeEvent) {
- String property = ((PropertyChangeEvent)e).getProperty();
- if (IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS.equals(property))
- {
- resetAllChildCountLimits();
- buildDeltaForChildCountLimitPreferenceChangedEvent(parentDelta, rm);
- return;
- }
- }
-
- super.buildDelta(e, parentDelta, nodeOffset, rm);
+ } else if (e instanceof PropertyChangeEvent) {
+ String property = ((PropertyChangeEvent) e).getProperty();
+ if (IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS.equals(property)) {
+ resetAllChildCountLimits();
+ buildDeltaForChildCountLimitPreferenceChangedEvent(parentDelta, rm);
+ return;
+ }
+ }
+
+ super.buildDelta(e, parentDelta, nodeOffset, rm);
}
-
+
@Override
- public void buildDeltaForExpressionElement(Object element, int elementIdx,
- Object event, VMDelta parentDelta, RequestMonitor rm) {
-
- if (event instanceof FetchMoreChildrenEvent) {
- FetchMoreChildrenEvent fetchMoreEvent = (FetchMoreChildrenEvent) event;
- GdbVariableExpressionVMC topLevelExpressionVMC = (GdbVariableExpressionVMC) element;
- if (topLevelExpressionVMC.equals(fetchMoreEvent.getPath().getFirstSegment())) {
- buildDeltaForFetchMoreChildrenEvent(fetchMoreEvent, parentDelta, rm);
- return;
- }
+ public void buildDeltaForExpressionElement(Object element, int elementIdx, Object event, VMDelta parentDelta,
+ RequestMonitor rm) {
+
+ if (event instanceof FetchMoreChildrenEvent) {
+ FetchMoreChildrenEvent fetchMoreEvent = (FetchMoreChildrenEvent) event;
+ GdbVariableExpressionVMC topLevelExpressionVMC = (GdbVariableExpressionVMC) element;
+ if (topLevelExpressionVMC.equals(fetchMoreEvent.getPath().getFirstSegment())) {
+ buildDeltaForFetchMoreChildrenEvent(fetchMoreEvent, parentDelta, rm);
+ return;
+ }
} else if (event instanceof ISuspendedDMEvent) {
resetChildCountLimits(((ISuspendedDMEvent) event).getDMContext());
} else if (event instanceof IContainerSuspendedDMEvent) {
resetChildCountLimits(((IContainerSuspendedDMEvent) event).getDMContext());
- } else if (event instanceof PropertyChangeEvent) {
- String property = ((PropertyChangeEvent)event).getProperty();
- if (IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS.equals(property))
- {
- resetAllChildCountLimits();
- buildDeltaForChildCountLimitPreferenceChangedEvent(parentDelta, rm);
- return;
- }
- }
-
- super.buildDeltaForExpressionElement(element, elementIdx, event, parentDelta,
- rm);
+ } else if (event instanceof PropertyChangeEvent) {
+ String property = ((PropertyChangeEvent) event).getProperty();
+ if (IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS.equals(property)) {
+ resetAllChildCountLimits();
+ buildDeltaForChildCountLimitPreferenceChangedEvent(parentDelta, rm);
+ return;
+ }
+ }
+
+ super.buildDeltaForExpressionElement(element, elementIdx, event, parentDelta, rm);
}
-
- private void buildDeltaForFetchMoreChildrenEvent(
- FetchMoreChildrenEvent fetchMoreChidrenEvent,
- VMDelta parentDelta, final RequestMonitor rm) {
+
+ private void buildDeltaForFetchMoreChildrenEvent(FetchMoreChildrenEvent fetchMoreChidrenEvent, VMDelta parentDelta,
+ final RequestMonitor rm) {
TreePath path = fetchMoreChidrenEvent.getPath();
-
+
// Add all the parents of the expression. Those didn't change, however.
for (int i = 0; i < path.getSegmentCount() - 2; ++i) {
parentDelta = parentDelta.addNode(path.getSegment(i), IModelDelta.NO_CHANGE);
}
-
- // Add the node for the expression. This one changed, of course.
- final VMDelta expressionDelta =
- parentDelta.addNode(path.getSegment(path.getSegmentCount() - 2), IModelDelta.CONTENT);
+
+ // Add the node for the expression. This one changed, of course.
+ final VMDelta expressionDelta = parentDelta.addNode(path.getSegment(path.getSegmentCount() - 2),
+ IModelDelta.CONTENT);
// Make sure the element formerly know as <...more_children...> is selected
// afterwards.
-
- final int offset = getChildCountLimit(fetchMoreChidrenEvent.getDMContext()) / 2;
- // The one trailing element is to see whether there are more children.
- final int maxLength = offset + 1;
- getVMProvider().updateNode(
- this,
- new VMChildrenUpdate(
- expressionDelta, getVMProvider().getPresentationContext(), offset, maxLength,
- new DataRequestMonitor<List<Object>>(getExecutor(), rm) {
- @Override
- public void handleCompleted() {
-
- // FIXME if the new child has children they do not appear because of this code.
-// final List<Object> data= getData();
-// if (data != null && data.size() != 0) {
-// expressionDelta.addNode(data.get(0), offset, IModelDelta.SELECT);
-// }
- rm.done();
- }
- })
- );
- }
-
- private void buildDeltaForChildCountLimitPreferenceChangedEvent(
- final VMDelta parentDelta, final RequestMonitor rm) {
- parentDelta.setFlags(parentDelta.getFlags() | IModelDelta.CONTENT);
- rm.done();
- }
+
+ final int offset = getChildCountLimit(fetchMoreChidrenEvent.getDMContext()) / 2;
+ // The one trailing element is to see whether there are more children.
+ final int maxLength = offset + 1;
+ getVMProvider().updateNode(this, new VMChildrenUpdate(expressionDelta, getVMProvider().getPresentationContext(),
+ offset, maxLength, new DataRequestMonitor<List<Object>>(getExecutor(), rm) {
+ @Override
+ public void handleCompleted() {
+
+ // FIXME if the new child has children they do not appear because of this code.
+ // final List<Object> data= getData();
+ // if (data != null && data.size() != 0) {
+ // expressionDelta.addNode(data.get(0), offset, IModelDelta.SELECT);
+ // }
+ rm.done();
+ }
+ }));
+ }
+
+ private void buildDeltaForChildCountLimitPreferenceChangedEvent(final VMDelta parentDelta,
+ final RequestMonitor rm) {
+ parentDelta.setFlags(parentDelta.getFlags() | IModelDelta.CONTENT);
+ rm.done();
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/GdbVariableVMProvider.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/GdbVariableVMProvider.java
index b40f7e3fad2..81bf75e1793 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/GdbVariableVMProvider.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/GdbVariableVMProvider.java
@@ -10,7 +10,7 @@
*
* Contributors:
* Freescale Semiconductor - initial API and implementation
- * Axel Mueller - Bug 306555 - Add support for cast to type / view as array (IExpressions2)
+ * Axel Mueller - Bug 306555 - Add support for cast to type / view as array (IExpressions2)
* Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121)
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel;
@@ -51,125 +51,127 @@ public class GdbVariableVMProvider extends VariableVMProvider {
/**
* Constructor (passthru)
*/
- public GdbVariableVMProvider(AbstractVMAdapter adapter,
- IPresentationContext context, DsfSession session) {
+ public GdbVariableVMProvider(AbstractVMAdapter adapter, IPresentationContext context, DsfSession session) {
super(adapter, context, session);
-
- final IPreferenceStore store = GdbUIPlugin.getDefault().getPreferenceStore();
-
- Integer childCountLimit = store.getInt(IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS);
- if (childCountLimit != 0) {
- getPresentationContext().setProperty(IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS,
- childCountLimit);
- }
-
- fPreferencesListener = new IPropertyChangeListener() {
- @Override
+
+ final IPreferenceStore store = GdbUIPlugin.getDefault().getPreferenceStore();
+
+ Integer childCountLimit = store
+ .getInt(IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS);
+ if (childCountLimit != 0) {
+ getPresentationContext().setProperty(
+ IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS, childCountLimit);
+ }
+
+ fPreferencesListener = new IPropertyChangeListener() {
+ @Override
public void propertyChange(final PropertyChangeEvent event) {
handlePropertyChanged(store, event);
- }};
- store.addPropertyChangeListener(fPreferencesListener);
+ }
+ };
+ store.addPropertyChangeListener(fPreferencesListener);
}
- @Override
+ @Override
public void dispose() {
super.dispose();
-
- final IPreferenceStore store = GdbUIPlugin.getDefault().getPreferenceStore();
+
+ final IPreferenceStore store = GdbUIPlugin.getDefault().getPreferenceStore();
store.removePropertyChangeListener(fPreferencesListener);
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.dsf.debug.ui.viewmodel.variable.VariableVMProvider#configureLayout(org.eclipse.cdt.dsf.debug.ui.viewmodel.variable.SyncVariableDataAccess)
- */
- @Override
+ * @see org.eclipse.cdt.dsf.debug.ui.viewmodel.variable.VariableVMProvider#configureLayout(org.eclipse.cdt.dsf.debug.ui.viewmodel.variable.SyncVariableDataAccess)
+ */
+ @Override
protected void configureLayout() {
- // Create the variable data access routines.
- SyncVariableDataAccess varAccess = new SyncVariableDataAccess(getSession()) ;
-
- // Create the top level node to deal with the root selection.
- IRootVMNode rootNode = new RootDMVMNode(this);
- setRootNode(rootNode);
-
- // Create the next level which represents members of structs/unions/enums and elements of arrays.
- IVMNode subExpressioNode = new GdbVariableVMNode(this, getSession(), varAccess);
- addChildNodes(rootNode, new IVMNode[] { subExpressioNode });
+ // Create the variable data access routines.
+ SyncVariableDataAccess varAccess = new SyncVariableDataAccess(getSession());
+
+ // Create the top level node to deal with the root selection.
+ IRootVMNode rootNode = new RootDMVMNode(this);
+ setRootNode(rootNode);
+
+ // Create the next level which represents members of structs/unions/enums and elements of arrays.
+ IVMNode subExpressioNode = new GdbVariableVMNode(this, getSession(), varAccess);
+ addChildNodes(rootNode, new IVMNode[] { subExpressioNode });
/* Wire up the casting support. IExpressions2 service is always available
* for gdb. No need to call hookUpCastingSupport */
- ((VariableVMNode) subExpressioNode).setCastToTypeSupport(
- new DsfCastToTypeSupport(getSession(), GdbVariableVMProvider.this, varAccess));
-
- // Configure the sub-expression node to be a child of itself. This way the content
- // provider will recursively drill-down the variable hierarchy.
- addChildNodes(subExpressioNode, new IVMNode[] { subExpressioNode });
- }
+ ((VariableVMNode) subExpressioNode)
+ .setCastToTypeSupport(new DsfCastToTypeSupport(getSession(), GdbVariableVMProvider.this, varAccess));
+
+ // Configure the sub-expression node to be a child of itself. This way the content
+ // provider will recursively drill-down the variable hierarchy.
+ addChildNodes(subExpressioNode, new IVMNode[] { subExpressioNode });
+ }
@Override
public void handleEvent(Object event, final RequestMonitor rm) {
- if (event instanceof DoubleClickEvent && !isDisposed()) {
-
- final ISelection selection= ((DoubleClickEvent) event).getSelection();
- if (selection instanceof IStructuredSelection) {
-
- Object element= ((IStructuredSelection) selection).getFirstElement();
- if (element instanceof IncompleteChildrenVMC) {
-
- IncompleteChildrenVMC incompleteChildrenVmc = ((IncompleteChildrenVMC) element);
- IVMNode node = incompleteChildrenVmc.getVMNode();
- if (node instanceof GdbVariableVMNode && node.getVMProvider() == this) {
-
- if (selection instanceof ITreeSelection) {
-
- ITreeSelection treeSelection = (ITreeSelection) selection;
- TreePath path = treeSelection.getPaths()[0];
- IExpressionDMContext exprCtx = incompleteChildrenVmc.getParentDMContext();
- ((GdbVariableVMNode) node).incrementChildCountLimit(exprCtx);
-
- // replace double click event with the fetch more children event.
- final FetchMoreChildrenEvent fetchMoreChildrenEvent = new FetchMoreChildrenEvent(
- exprCtx, path);
- getExecutor().execute(new DsfRunnable() {
- @Override
- public void run() {
- handleEvent(fetchMoreChildrenEvent, rm);
- }
- });
-
- return;
- }
- }
- }
- }
- }
-
+ if (event instanceof DoubleClickEvent && !isDisposed()) {
+
+ final ISelection selection = ((DoubleClickEvent) event).getSelection();
+ if (selection instanceof IStructuredSelection) {
+
+ Object element = ((IStructuredSelection) selection).getFirstElement();
+ if (element instanceof IncompleteChildrenVMC) {
+
+ IncompleteChildrenVMC incompleteChildrenVmc = ((IncompleteChildrenVMC) element);
+ IVMNode node = incompleteChildrenVmc.getVMNode();
+ if (node instanceof GdbVariableVMNode && node.getVMProvider() == this) {
+
+ if (selection instanceof ITreeSelection) {
+
+ ITreeSelection treeSelection = (ITreeSelection) selection;
+ TreePath path = treeSelection.getPaths()[0];
+ IExpressionDMContext exprCtx = incompleteChildrenVmc.getParentDMContext();
+ ((GdbVariableVMNode) node).incrementChildCountLimit(exprCtx);
+
+ // replace double click event with the fetch more children event.
+ final FetchMoreChildrenEvent fetchMoreChildrenEvent = new FetchMoreChildrenEvent(exprCtx,
+ path);
+ getExecutor().execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ handleEvent(fetchMoreChildrenEvent, rm);
+ }
+ });
+
+ return;
+ }
+ }
+ }
+ }
+ }
+
super.handleEvent(event, rm);
}
-
+
/**
* @param store
* @param event
- *
+ *
* @since 3.0
*/
protected void handlePropertyChanged(final IPreferenceStore store, final PropertyChangeEvent event) {
String property = event.getProperty();
if (IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS.equals(property)) {
- Integer childCountLimit = store.getInt(IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS);
-
- if (childCountLimit != 0) {
- getPresentationContext().setProperty(IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS,
- childCountLimit);
- } else {
- getPresentationContext().setProperty(IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS,
- null);
- }
-
+ Integer childCountLimit = store
+ .getInt(IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS);
+
+ if (childCountLimit != 0) {
+ getPresentationContext().setProperty(
+ IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS, childCountLimit);
+ } else {
+ getPresentationContext()
+ .setProperty(IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS, null);
+ }
+
getExecutor().execute(new DsfRunnable() {
- @Override
- public void run() {
- handleEvent(event);
- }
+ @Override
+ public void run() {
+ handleEvent(event);
+ }
});
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/GdbViewModelAdapter.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/GdbViewModelAdapter.java
index 65d68007792..4230c22a680 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/GdbViewModelAdapter.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/GdbViewModelAdapter.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -27,40 +27,39 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentati
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
import org.eclipse.debug.ui.IDebugUIConstants;
-/*
- *
+/*
+ *
*/
@ThreadSafe
-public class GdbViewModelAdapter extends AbstractDebugVMAdapter
-{
- public GdbViewModelAdapter(DsfSession session, SteppingController controller) {
- super(session, controller);
- getSession().registerModelAdapter(IColumnPresentationFactory.class, this);
- }
+public class GdbViewModelAdapter extends AbstractDebugVMAdapter {
+ public GdbViewModelAdapter(DsfSession session, SteppingController controller) {
+ super(session, controller);
+ getSession().registerModelAdapter(IColumnPresentationFactory.class, this);
+ }
+
+ @Override
+ public void dispose() {
+ getSession().unregisterModelAdapter(IColumnPresentationFactory.class);
+ super.dispose();
+ }
- @Override
- public void dispose() {
- getSession().unregisterModelAdapter(IColumnPresentationFactory.class);
- super.dispose();
- }
-
- @Override
- protected IVMProvider createViewModelProvider(IPresentationContext context) {
- if ( IDebugUIConstants.ID_DEBUG_VIEW.equals(context.getId()) ) {
- return new LaunchVMProvider(this, context, getSession());
- } else if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(context.getId()) ) {
- return new GdbVariableVMProvider(this, context, getSession());
- } else if (IDebugUIConstants.ID_REGISTER_VIEW.equals(context.getId()) ) {
- return new RegisterVMProvider(this, context, getSession());
- } else if (IDebugUIConstants.ID_EXPRESSION_VIEW.equals(context.getId()) ) {
- return new GdbExpressionVMProvider(this, context, getSession());
- } else if (IDsfDebugUIConstants.ID_EXPRESSION_HOVER.equals(context.getId()) ) {
- return new GdbExpressionVMProvider(this, context, getSession());
- } else if (IDebugUIConstants.ID_MODULE_VIEW.equals(context.getId()) ) {
- return new ModulesVMProvider(this, context, getSession());
- } else if (IDebugUIConstants.ID_BREAKPOINT_VIEW.equals(context.getId()) ) {
- return new GdbBreakpointVMProvider(this, context, getSession());
- }
- return null;
- }
+ @Override
+ protected IVMProvider createViewModelProvider(IPresentationContext context) {
+ if (IDebugUIConstants.ID_DEBUG_VIEW.equals(context.getId())) {
+ return new LaunchVMProvider(this, context, getSession());
+ } else if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(context.getId())) {
+ return new GdbVariableVMProvider(this, context, getSession());
+ } else if (IDebugUIConstants.ID_REGISTER_VIEW.equals(context.getId())) {
+ return new RegisterVMProvider(this, context, getSession());
+ } else if (IDebugUIConstants.ID_EXPRESSION_VIEW.equals(context.getId())) {
+ return new GdbExpressionVMProvider(this, context, getSession());
+ } else if (IDsfDebugUIConstants.ID_EXPRESSION_HOVER.equals(context.getId())) {
+ return new GdbExpressionVMProvider(this, context, getSession());
+ } else if (IDebugUIConstants.ID_MODULE_VIEW.equals(context.getId())) {
+ return new ModulesVMProvider(this, context, getSession());
+ } else if (IDebugUIConstants.ID_BREAKPOINT_VIEW.equals(context.getId())) {
+ return new GdbBreakpointVMProvider(this, context, getSession());
+ }
+ return null;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/Messages.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/Messages.java
index aa0b5d9d21b..bcfd5f38ec2 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/Messages.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/Messages.java
@@ -16,16 +16,17 @@ package org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel;
import org.eclipse.osgi.util.NLS;
-
public class Messages extends NLS {
-
- static {
- // initialize resource bundle
- NLS.initializeMessages(/*Messages.class.getName()*/"org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.Message", Messages.class); //$NON-NLS-1$
- }
- private Messages() {}
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(/*Messages.class.getName()*/"org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.Message", //$NON-NLS-1$
+ Messages.class);
+ }
+
+ private Messages() {
+ }
- public static String Internal_Error;
- public static String More_Children;
+ public static String Internal_Error;
+ public static String More_Children;
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/breakpoints/GdbBreakpointVMNode.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/breakpoints/GdbBreakpointVMNode.java
index 93c3d95758c..999ce014809 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/breakpoints/GdbBreakpointVMNode.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/breakpoints/GdbBreakpointVMNode.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Marc Khouzam (Ericsson) - initial API and implementation
*******************************************************************************/
@@ -27,33 +27,33 @@ import org.eclipse.jface.util.PropertyChangeEvent;
*/
public class GdbBreakpointVMNode extends RawBreakpointVMNode {
- public GdbBreakpointVMNode(BreakpointVMProvider provider) {
- super(provider);
- }
-
- @Override
- public int getDeltaFlags(Object event) {
- if (event instanceof PropertyChangeEvent) {
- String property = ((PropertyChangeEvent)event).getProperty();
- if (IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER.equals(property)) {
- return IModelDelta.CONTENT;
- }
- }
-
- return super.getDeltaFlags(event);
- }
-
- @Override
- public void buildDelta(Object event, VMDelta parent, int nodeOffset, RequestMonitor rm) {
- if (event instanceof PropertyChangeEvent) {
- String property = ((PropertyChangeEvent)event).getProperty();
- if (IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER.equals(property)) {
- parent.setFlags(parent.getFlags() | IModelDelta.CONTENT);
- rm.done();
- return;
- }
- }
-
- super.buildDelta(event, parent, nodeOffset, rm);
- }
+ public GdbBreakpointVMNode(BreakpointVMProvider provider) {
+ super(provider);
+ }
+
+ @Override
+ public int getDeltaFlags(Object event) {
+ if (event instanceof PropertyChangeEvent) {
+ String property = ((PropertyChangeEvent) event).getProperty();
+ if (IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER.equals(property)) {
+ return IModelDelta.CONTENT;
+ }
+ }
+
+ return super.getDeltaFlags(event);
+ }
+
+ @Override
+ public void buildDelta(Object event, VMDelta parent, int nodeOffset, RequestMonitor rm) {
+ if (event instanceof PropertyChangeEvent) {
+ String property = ((PropertyChangeEvent) event).getProperty();
+ if (IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER.equals(property)) {
+ parent.setFlags(parent.getFlags() | IModelDelta.CONTENT);
+ rm.done();
+ return;
+ }
+ }
+
+ super.buildDelta(event, parent, nodeOffset, rm);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/breakpoints/GdbBreakpointVMProvider.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/breakpoints/GdbBreakpointVMProvider.java
index 9dd12a1a9ba..0994819ade3 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/breakpoints/GdbBreakpointVMProvider.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/breakpoints/GdbBreakpointVMProvider.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* Mikhail Khodjaiants (Mentor), Marc Khouzam (Ericsson)
@@ -74,10 +74,10 @@ import org.eclipse.ui.PlatformUI;
*/
public class GdbBreakpointVMProvider extends BreakpointVMProvider {
- final private DsfSession fSession;
-
- final private DsfServicesTracker fServicesTracker;
-
+ final private DsfSession fSession;
+
+ final private DsfServicesTracker fServicesTracker;
+
/** Indicator that we should use aggressive breakpoint filtering */
private boolean fUseAggressiveBpFilter = false;
@@ -86,309 +86,316 @@ public class GdbBreakpointVMProvider extends BreakpointVMProvider {
@Override
public void propertyChange(final PropertyChangeEvent event) {
if (IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER.equals(event.getProperty())) {
- fUseAggressiveBpFilter = (Boolean)event.getNewValue();
+ fUseAggressiveBpFilter = (Boolean) event.getNewValue();
// Set the property in the presentation context so it can be seen by the vmnode which
// will refresh the view
- getPresentationContext().setProperty(IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER, fUseAggressiveBpFilter);
+ getPresentationContext().setProperty(IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER,
+ fUseAggressiveBpFilter);
}
}
};
- public GdbBreakpointVMProvider(AbstractVMAdapter adapter, IPresentationContext presentationContext, DsfSession session) {
- super(adapter, presentationContext);
- fSession = session;
- fServicesTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), fSession.getId());
-
- IPreferenceStore store = GdbUIPlugin.getDefault().getPreferenceStore();
- store.addPropertyChangeListener(fPropertyChangeListener);
- fUseAggressiveBpFilter = store.getBoolean(IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER);
+ public GdbBreakpointVMProvider(AbstractVMAdapter adapter, IPresentationContext presentationContext,
+ DsfSession session) {
+ super(adapter, presentationContext);
+ fSession = session;
+ fServicesTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), fSession.getId());
+
+ IPreferenceStore store = GdbUIPlugin.getDefault().getPreferenceStore();
+ store.addPropertyChangeListener(fPropertyChangeListener);
+ fUseAggressiveBpFilter = store.getBoolean(IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER);
+ }
+
+ @Override
+ public void dispose() {
+ GdbUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(fPropertyChangeListener);
+ fServicesTracker.dispose();
+ super.dispose();
+ }
+
+ @Override
+ protected void calcFileteredBreakpoints(final DataRequestMonitor<IBreakpoint[]> rm) {
+ if (Boolean.TRUE.equals(
+ getPresentationContext().getProperty(IBreakpointUIConstants.PROP_BREAKPOINTS_FILTER_SELECTION))) {
+ if (fUseAggressiveBpFilter) {
+ // Aggressive filtering of breakpoints. Only return bps that are installed on the target.
+ ISelection debugContext = getDebugContext();
+ if (debugContext instanceof IStructuredSelection) {
+ // Use a set to avoid duplicates
+ final Set<IBreakpoint> bps = new HashSet<IBreakpoint>();
+
+ int count = 0;
+ final ImmediateCountingRequestMonitor crm = new ImmediateCountingRequestMonitor(rm) {
+ @Override
+ protected void handleSuccess() {
+ rm.done(bps.toArray(new IBreakpoint[bps.size()]));
+ }
+ };
+
+ for (Object element : ((IStructuredSelection) debugContext).toList()) {
+
+ IBreakpointsTargetDMContext bpContext = null;
+ IExecutionDMContext execContext = null;
+ if (element instanceof IDMVMContext) {
+ bpContext = DMContexts.getAncestorOfType(((IDMVMContext) element).getDMContext(),
+ IBreakpointsTargetDMContext.class);
+ execContext = DMContexts.getAncestorOfType(((IDMVMContext) element).getDMContext(),
+ IExecutionDMContext.class);
+
+ if (bpContext != null && fSession.getId().equals(bpContext.getSessionId())) {
+ count++;
+ getInstalledBreakpoints(bpContext, execContext,
+ new DataRequestMonitor<Collection<IBreakpoint>>(getExecutor(), crm) {
+ @Override
+ protected void handleCompleted() {
+ if (isSuccess()) {
+ bps.addAll(getData());
+ }
+ crm.done();
+ }
+ });
+ }
+ }
+ }
+
+ crm.setDoneCount(count);
+ } else {
+ rm.done(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_HANDLE,
+ "Invalid debug selection", //$NON-NLS-1$
+ null));
+ }
+ } else {
+ // Original behavior of bp filtering. Return all bp of type ICBreakpoint
+ IBreakpoint[] allBreakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints();
+ List<IBreakpoint> filteredBPs = new ArrayList<IBreakpoint>(allBreakpoints.length);
+ for (IBreakpoint bp : allBreakpoints) {
+ if (bp instanceof ICBreakpoint && bp.getModelIdentifier().equals(CDebugCorePlugin.PLUGIN_ID)) {
+ filteredBPs.add(bp);
+ }
+ }
+ rm.done(filteredBPs.toArray(new IBreakpoint[filteredBPs.size()]));
+ }
+ } else {
+ super.calcFileteredBreakpoints(rm);
+ }
}
-
- @Override
- public void dispose() {
- GdbUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(fPropertyChangeListener);
- fServicesTracker.dispose();
- super.dispose();
- }
-
- @Override
- protected void calcFileteredBreakpoints( final DataRequestMonitor<IBreakpoint[]> rm ) {
- if ( Boolean.TRUE.equals( getPresentationContext().getProperty( IBreakpointUIConstants.PROP_BREAKPOINTS_FILTER_SELECTION ) ) ) {
- if ( fUseAggressiveBpFilter ) {
- // Aggressive filtering of breakpoints. Only return bps that are installed on the target.
- ISelection debugContext = getDebugContext();
- if ( debugContext instanceof IStructuredSelection ) {
- // Use a set to avoid duplicates
- final Set<IBreakpoint> bps = new HashSet<IBreakpoint>();
-
- int count = 0;
- final ImmediateCountingRequestMonitor crm = new ImmediateCountingRequestMonitor( rm ) {
- @Override
- protected void handleSuccess() {
- rm.done( bps.toArray( new IBreakpoint[bps.size()] ) );
- }
- };
-
- for ( Object element : ( (IStructuredSelection)debugContext ).toList() ) {
-
- IBreakpointsTargetDMContext bpContext = null;
- IExecutionDMContext execContext = null;
- if ( element instanceof IDMVMContext ) {
- bpContext = DMContexts.getAncestorOfType( ((IDMVMContext)element).getDMContext(), IBreakpointsTargetDMContext.class );
- execContext = DMContexts.getAncestorOfType( ((IDMVMContext)element).getDMContext(), IExecutionDMContext.class );
-
- if ( bpContext != null && fSession.getId().equals( bpContext.getSessionId() ) ) {
- count++;
- getInstalledBreakpoints( bpContext, execContext, new DataRequestMonitor<Collection<IBreakpoint>>( getExecutor(), crm ) {
- @Override
- protected void handleCompleted() {
- if ( isSuccess() ) {
- bps.addAll( getData() );
- }
- crm.done();
- }
- } );
- }
- }
- }
-
- crm.setDoneCount(count);
- } else {
- rm.done( new Status(
- IStatus.ERROR,
- GdbUIPlugin.PLUGIN_ID,
- IDsfStatusConstants.INVALID_HANDLE,
- "Invalid debug selection", //$NON-NLS-1$
- null ) );
- }
- } else {
- // Original behavior of bp filtering. Return all bp of type ICBreakpoint
- IBreakpoint[] allBreakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints();
- List<IBreakpoint> filteredBPs = new ArrayList<IBreakpoint>( allBreakpoints.length );
- for (IBreakpoint bp : allBreakpoints) {
- if ( bp instanceof ICBreakpoint && bp.getModelIdentifier().equals( CDebugCorePlugin.PLUGIN_ID ) ) {
- filteredBPs.add( bp );
- }
- }
- rm.done( filteredBPs.toArray( new IBreakpoint[filteredBPs.size()]) );
- }
+
+ @Override
+ protected IVMNode createBreakpointVMNode() {
+ return new GdbBreakpointVMNode(this);
+ }
+
+ @Override
+ public void getBreakpointsForDebugContext(ISelection debugContext, final DataRequestMonitor<IBreakpoint[]> rm) {
+ IExecutionDMContext _execCtx = null;
+ if (debugContext instanceof IStructuredSelection) {
+ Object element = ((IStructuredSelection) debugContext).getFirstElement();
+ if (element instanceof IDMVMContext) {
+ _execCtx = DMContexts.getAncestorOfType(((IDMVMContext) element).getDMContext(),
+ IExecutionDMContext.class);
+ }
+ }
+
+ if (_execCtx == null || !fSession.getId().equals(_execCtx.getSessionId())) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_HANDLE,
+ "Debug context doesn't contain a thread", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ final IExecutionDMContext execCtx = _execCtx;
+
+ try {
+ fSession.getExecutor().execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ IBreakpointsExtension bpService = fServicesTracker.getService(IBreakpointsExtension.class);
+ if (bpService == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE,
+ "Breakpoints service not available", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+ bpService.getExecutionContextBreakpoints(execCtx,
+ new DataRequestMonitor<IBreakpoints.IBreakpointDMContext[]>(fSession.getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ MIBreakpointsManager bpManager = fServicesTracker
+ .getService(MIBreakpointsManager.class);
+ if (bpManager == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID,
+ IDsfStatusConstants.INVALID_STATE, "Breakpoints service not available", //$NON-NLS-1$
+ null));
+ rm.done();
+ return;
+ }
+
+ IBreakpoint bp = null;
+
+ if (getData().length > 0) {
+ bp = bpManager.findPlatformBreakpoint(getData()[0]);
+ }
+
+ if (bp != null) {
+ rm.setData(new IBreakpoint[] { bp });
+ } else {
+ rm.setData(new IBreakpoint[0]);
+ }
+ rm.done();
+ }
+ });
+ }
+ });
+ } catch (RejectedExecutionException e) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE,
+ "Request for monitor: '" + toString() + "' resulted in a rejected execution exception.", e)); //$NON-NLS-1$ //$NON-NLS-2$);
+ rm.done();
}
- else {
- super.calcFileteredBreakpoints( rm );
+ }
+
+ private ISelection getDebugContext() {
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ if (window != null) {
+ return DebugUITools.getDebugContextManager().getContextService(window).getActiveContext();
}
- }
-
- @Override
- protected IVMNode createBreakpointVMNode() {
- return new GdbBreakpointVMNode(this);
- }
-
- @Override
- public void getBreakpointsForDebugContext(ISelection debugContext, final DataRequestMonitor<IBreakpoint[]> rm) {
- IExecutionDMContext _execCtx = null;
- if (debugContext instanceof IStructuredSelection) {
- Object element = ((IStructuredSelection)debugContext).getFirstElement();
- if (element instanceof IDMVMContext) {
- _execCtx = DMContexts.getAncestorOfType( ((IDMVMContext)element).getDMContext(), IExecutionDMContext.class);
- }
- }
-
- if (_execCtx == null || !fSession.getId().equals(_execCtx.getSessionId())) {
- rm.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_HANDLE, "Debug context doesn't contain a thread", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- final IExecutionDMContext execCtx = _execCtx;
-
- try {
- fSession.getExecutor().execute(new DsfRunnable() {
- @Override
- public void run() {
- IBreakpointsExtension bpService = fServicesTracker.getService(IBreakpointsExtension.class);
- if (bpService == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE, "Breakpoints service not available", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
- bpService.getExecutionContextBreakpoints(
- execCtx,
- new DataRequestMonitor<IBreakpoints.IBreakpointDMContext[]>(fSession.getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- MIBreakpointsManager bpManager = fServicesTracker.getService(MIBreakpointsManager.class);
- if (bpManager == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE, "Breakpoints service not available", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- IBreakpoint bp = null;
-
-
- if (getData().length > 0) {
- bp = bpManager.findPlatformBreakpoint(getData()[0]);
- }
-
- if (bp != null) {
- rm.setData(new IBreakpoint[] { bp });
- } else {
- rm.setData(new IBreakpoint[0]);
- }
- rm.done();
- }
- });
- }
- });
- } catch (RejectedExecutionException e) {
- rm.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE, "Request for monitor: '" + toString() + "' resulted in a rejected execution exception.", e)); //$NON-NLS-1$ //$NON-NLS-2$);
- rm.done();
- }
- }
-
- private ISelection getDebugContext() {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if ( window != null ) {
- return DebugUITools.getDebugContextManager().getContextService( window ).getActiveContext();
- }
- return StructuredSelection.EMPTY;
- }
-
- private void getInstalledBreakpoints( final IBreakpointsTargetDMContext targetContext,
- final IExecutionDMContext execContext,
- final DataRequestMonitor<Collection<IBreakpoint>> rm ) {
-
+ return StructuredSelection.EMPTY;
+ }
+
+ private void getInstalledBreakpoints(final IBreakpointsTargetDMContext targetContext,
+ final IExecutionDMContext execContext, final DataRequestMonitor<Collection<IBreakpoint>> rm) {
+
try {
- fSession.getExecutor().execute( new DsfRunnable() {
+ fSession.getExecutor().execute(new DsfRunnable() {
@Override
public void run() {
- final IBreakpointsExtension bpService = fServicesTracker.getService( IBreakpointsExtension.class );
- if ( bpService == null ) {
- rm.setStatus( new Status(
- IStatus.ERROR,
- GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE,
+ final IBreakpointsExtension bpService = fServicesTracker.getService(IBreakpointsExtension.class);
+ if (bpService == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE,
"Breakpoints service not available", //$NON-NLS-1$
- null ) );
+ null));
rm.done();
return;
}
- bpService.getBreakpoints( targetContext, new DataRequestMonitor<IBreakpointDMContext[]>( fSession.getExecutor(), rm ) {
-
- @Override
- protected void handleSuccess() {
- final MIBreakpointsManager bpManager = fServicesTracker.getService( MIBreakpointsManager.class );
- if ( bpManager == null ) {
- rm.setStatus( new Status(
- IStatus.ERROR,
- GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE,
- "Breakpoint manager service not available", //$NON-NLS-1$
- null ) );
- rm.done();
- return;
- }
-
- if ( getData().length > 0 ) {
- final Set<IBreakpoint> bps = new HashSet<IBreakpoint>( getData().length );
- final CountingRequestMonitor crm = new CountingRequestMonitor( ImmediateExecutor.getInstance(), rm ) {
-
- @Override
- protected void handleSuccess() {
- rm.setData( bps );
+ bpService.getBreakpoints(targetContext,
+ new DataRequestMonitor<IBreakpointDMContext[]>(fSession.getExecutor(), rm) {
+
+ @Override
+ protected void handleSuccess() {
+ final MIBreakpointsManager bpManager = fServicesTracker
+ .getService(MIBreakpointsManager.class);
+ if (bpManager == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID,
+ IDsfStatusConstants.INVALID_STATE,
+ "Breakpoint manager service not available", //$NON-NLS-1$
+ null));
rm.done();
+ return;
}
- };
- crm.setDoneCount( getData().length );
-
- for ( final IBreakpointDMContext bpCtx : getData() ) {
- bpService.getBreakpointDMData(
- bpCtx,
- new DataRequestMonitor<IBreakpointDMData>( ImmediateExecutor.getInstance(), crm ) {
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.dsf.concurrent.RequestMonitor#handleSuccess()
- */
+
+ if (getData().length > 0) {
+ final Set<IBreakpoint> bps = new HashSet<IBreakpoint>(getData().length);
+ final CountingRequestMonitor crm = new CountingRequestMonitor(
+ ImmediateExecutor.getInstance(), rm) {
+
@Override
protected void handleSuccess() {
- if ( getData() instanceof MIBreakpointDMData ) {
- MIBreakpointDMData data = (MIBreakpointDMData)getData();
- if ( !data.isPending() ) {
- bpBelongsToContext( execContext, data, new ImmediateDataRequestMonitor<Boolean>(crm) {
- @Override
- protected void handleSuccess() {
- if (getData()) {
- IBreakpoint bp = bpManager.findPlatformBreakpoint( bpCtx );
- if ( bp != null )
- bps.add( bp );
+ rm.setData(bps);
+ rm.done();
+ }
+ };
+ crm.setDoneCount(getData().length);
+
+ for (final IBreakpointDMContext bpCtx : getData()) {
+ bpService.getBreakpointDMData(bpCtx,
+ new DataRequestMonitor<IBreakpointDMData>(
+ ImmediateExecutor.getInstance(), crm) {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.dsf.concurrent.RequestMonitor#handleSuccess()
+ */
+ @Override
+ protected void handleSuccess() {
+ if (getData() instanceof MIBreakpointDMData) {
+ MIBreakpointDMData data = (MIBreakpointDMData) getData();
+ if (!data.isPending()) {
+ bpBelongsToContext(execContext, data,
+ new ImmediateDataRequestMonitor<Boolean>(
+ crm) {
+ @Override
+ protected void handleSuccess() {
+ if (getData()) {
+ IBreakpoint bp = bpManager
+ .findPlatformBreakpoint(
+ bpCtx);
+ if (bp != null)
+ bps.add(bp);
+ }
+ crm.done();
+ }
+ });
+ return;
}
- crm.done();
}
- });
- return;
- }
- }
- crm.done();
- }
- } );
+ crm.done();
+ }
+ });
+ }
+ } else {
+ rm.setData(new HashSet<IBreakpoint>());
+ rm.done();
+ }
}
- }
- else {
- rm.setData( new HashSet<IBreakpoint>() );
- rm.done();
- }
- }
- } );
+ });
}
- } );
- }
- catch( RejectedExecutionException e ) {
- rm.setStatus( new Status(
- IStatus.ERROR,
- GdbUIPlugin.PLUGIN_ID,
- IDsfStatusConstants.INVALID_STATE,
- "Request for monitor: '" + toString() + "' resulted in a rejected execution exception.", e ) ); //$NON-NLS-1$ //$NON-NLS-2$);
+ });
+ } catch (RejectedExecutionException e) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE,
+ "Request for monitor: '" + toString() + "' resulted in a rejected execution exception.", e)); //$NON-NLS-1$ //$NON-NLS-2$);
rm.done();
}
- }
-
- private void bpBelongsToContext( IExecutionDMContext execContext, final MIBreakpointDMData data, final DataRequestMonitor<Boolean> rm ) {
- if ( execContext == null ) {
- // No execution context so accept all breakpoints
- rm.done( true );
- return;
- }
-
- // First check if a thread is selected as the context. In that case, we only want to show breakpoints that
- // are applicable to that thread.
- IMIExecutionDMContext threadContext = DMContexts.getAncestorOfType( execContext, IMIExecutionDMContext.class );
- if ( threadContext != null ) {
+ }
+
+ private void bpBelongsToContext(IExecutionDMContext execContext, final MIBreakpointDMData data,
+ final DataRequestMonitor<Boolean> rm) {
+ if (execContext == null) {
+ // No execution context so accept all breakpoints
+ rm.done(true);
+ return;
+ }
+
+ // First check if a thread is selected as the context. In that case, we only want to show breakpoints that
+ // are applicable to that thread.
+ IMIExecutionDMContext threadContext = DMContexts.getAncestorOfType(execContext, IMIExecutionDMContext.class);
+ if (threadContext != null) {
// A thread is selected. Now make sure this breakpoint is assigned to this thread.
- if (data.getThreadId() != null && data.getThreadId().length() > 0) {
- String bpThreadId = data.getThreadId().trim();
- // A threadId of 0 means all threads of this process. We therefore will have to check
- // if this breakpoint applies to the process that is selected. But if the threadId is not 0
- // we simply make sure we have the right thread selected.
- if (!bpThreadId.equals("0")) { //$NON-NLS-1$
- String ctxThreadId = threadContext.getThreadId();
- rm.done(ctxThreadId.equals(bpThreadId));
- return;
- }
- }
- }
+ if (data.getThreadId() != null && data.getThreadId().length() > 0) {
+ String bpThreadId = data.getThreadId().trim();
+ // A threadId of 0 means all threads of this process. We therefore will have to check
+ // if this breakpoint applies to the process that is selected. But if the threadId is not 0
+ // we simply make sure we have the right thread selected.
+ if (!bpThreadId.equals("0")) { //$NON-NLS-1$
+ String ctxThreadId = threadContext.getThreadId();
+ rm.done(ctxThreadId.equals(bpThreadId));
+ return;
+ }
+ }
+ }
// If we get here it is that the breakpoint is not assigned to a single thread.
// We therefore make sure the breakpoint is applicable to the selected process.
- final IMIContainerDMContext containerContext = DMContexts.getAncestorOfType( execContext, IMIContainerDMContext.class );
- if ( containerContext != null ) {
- if ( data.getGroupIds() != null ) {
- List<String> groupIds = Arrays.asList( data.getGroupIds() );
- rm.done( groupIds.contains( containerContext.getGroupId() ) );
+ final IMIContainerDMContext containerContext = DMContexts.getAncestorOfType(execContext,
+ IMIContainerDMContext.class);
+ if (containerContext != null) {
+ if (data.getGroupIds() != null) {
+ List<String> groupIds = Arrays.asList(data.getGroupIds());
+ rm.done(groupIds.contains(containerContext.getGroupId()));
} else {
// This happens if we are debugging a single process, so all breakpoints apply.
- rm.done( true );
+ rm.done(true);
}
} else {
// Accept breakpoint
- rm.done( true );
+ rm.done(true);
}
- }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/commands/RetargetDebugContextCommand.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/commands/RetargetDebugContextCommand.java
index dce24b70dc7..3e2d2249633 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/commands/RetargetDebugContextCommand.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/commands/RetargetDebugContextCommand.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial implementation
*******************************************************************************/
@@ -38,123 +38,129 @@ import org.eclipse.ui.handlers.HandlerUtil;
/**
* Base class for actions which delegate functionality to an adapter retrieved
* from the current debug context.
- *
+ *
* @since 2.0
*/
-abstract public class RetargetDebugContextCommand extends AbstractHandler implements IDebugContextListener {
-
- private ISelection fDebugContext;
- private Object fTargetAdapter = null;
- private IDebugContextService fContextService = null;
- private String fCommandId = null;
-
- protected Object getTargetAdapter() { return fTargetAdapter; }
- protected ISelection getDebugContext() { return fDebugContext; }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
- */
- public RetargetDebugContextCommand() {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- fContextService = DebugUITools.getDebugContextManager().getContextService(window);
- fContextService.addPostDebugContextListener(this);
- fDebugContext = fContextService.getActiveContext();
- update();
- }
-
- @Override
+abstract public class RetargetDebugContextCommand extends AbstractHandler implements IDebugContextListener {
+
+ private ISelection fDebugContext;
+ private Object fTargetAdapter = null;
+ private IDebugContextService fContextService = null;
+ private String fCommandId = null;
+
+ protected Object getTargetAdapter() {
+ return fTargetAdapter;
+ }
+
+ protected ISelection getDebugContext() {
+ return fDebugContext;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
+ */
+ public RetargetDebugContextCommand() {
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ fContextService = DebugUITools.getDebugContextManager().getContextService(window);
+ fContextService.addPostDebugContextListener(this);
+ fDebugContext = fContextService.getActiveContext();
+ update();
+ }
+
+ @Override
public Object execute(ExecutionEvent event) throws ExecutionException {
fCommandId = event.getCommand().getId();
-
- if (fTargetAdapter != null) {
- try {
- performCommand(fTargetAdapter, fDebugContext);
- } catch (ExecutionException e) {
- Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
- ErrorDialog.openError(shell, MessagesForVMActions.RetargetDebugContextAction_ErrorDialog_title, MessagesForVMActions.RetargetDebugContextAction_ErrorDialog_message, null);
- }
- }
-
- update();
-
+
+ if (fTargetAdapter != null) {
+ try {
+ performCommand(fTargetAdapter, fDebugContext);
+ } catch (ExecutionException e) {
+ Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
+ ErrorDialog.openError(shell, MessagesForVMActions.RetargetDebugContextAction_ErrorDialog_title,
+ MessagesForVMActions.RetargetDebugContextAction_ErrorDialog_message, null);
+ }
+ }
+
+ update();
+
return null;
}
-
- /**
- * Returns whether the specific operation is supported.
- *
- * @param target the target adapter
- * @param debugContext the selection to verify the operation on
- * @return whether the operation can be performed
- */
- protected abstract boolean canPerformCommand(Object target, ISelection debugContext);
-
- /**
- * Performs the specific operation.
- *
- * @param target the target adapter
- * @param debugContext the selection to verify the operation on
- * @throws CoreException if an exception occurs
- */
- protected abstract void performCommand(Object target, ISelection debugContext) throws ExecutionException;
-
- /**
- * Returns the type of adapter (target) this command works on.
- *
- * @return the type of adapter this command works on
- */
- protected abstract Class<?> getAdapterClass();
-
- public void update() {
- boolean enabled = false;
-
- fTargetAdapter = null;
- if (fDebugContext instanceof IStructuredSelection) {
- IStructuredSelection ss = (IStructuredSelection) fDebugContext;
- if (!ss.isEmpty()) {
- Object object = ss.getFirstElement();
- if (object instanceof IAdaptable) {
- fTargetAdapter = getAdapter((IAdaptable) object);
- if (fTargetAdapter != null) {
- enabled = canPerformCommand(fTargetAdapter, fDebugContext);
- }
- }
- }
- }
-
- setBaseEnabled(enabled);
-
- if (fCommandId != null) {
- ICommandService commandService = PlatformUI.getWorkbench().getService(ICommandService.class);
- if (commandService != null) {
- commandService.refreshElements(fCommandId, null);
- }
- }
- }
-
- @Override
+
+ /**
+ * Returns whether the specific operation is supported.
+ *
+ * @param target the target adapter
+ * @param debugContext the selection to verify the operation on
+ * @return whether the operation can be performed
+ */
+ protected abstract boolean canPerformCommand(Object target, ISelection debugContext);
+
+ /**
+ * Performs the specific operation.
+ *
+ * @param target the target adapter
+ * @param debugContext the selection to verify the operation on
+ * @throws CoreException if an exception occurs
+ */
+ protected abstract void performCommand(Object target, ISelection debugContext) throws ExecutionException;
+
+ /**
+ * Returns the type of adapter (target) this command works on.
+ *
+ * @return the type of adapter this command works on
+ */
+ protected abstract Class<?> getAdapterClass();
+
+ public void update() {
+ boolean enabled = false;
+
+ fTargetAdapter = null;
+ if (fDebugContext instanceof IStructuredSelection) {
+ IStructuredSelection ss = (IStructuredSelection) fDebugContext;
+ if (!ss.isEmpty()) {
+ Object object = ss.getFirstElement();
+ if (object instanceof IAdaptable) {
+ fTargetAdapter = getAdapter((IAdaptable) object);
+ if (fTargetAdapter != null) {
+ enabled = canPerformCommand(fTargetAdapter, fDebugContext);
+ }
+ }
+ }
+ }
+
+ setBaseEnabled(enabled);
+
+ if (fCommandId != null) {
+ ICommandService commandService = PlatformUI.getWorkbench().getService(ICommandService.class);
+ if (commandService != null) {
+ commandService.refreshElements(fCommandId, null);
+ }
+ }
+ }
+
+ @Override
public void dispose() {
- // Must use the stored service. If we try to fetch the service
- // again with the workbenchWindow, it may fail if the window is
- // already closed.
- fContextService.removePostDebugContextListener(this);
- fTargetAdapter = null;
- }
-
- @Override
- public void debugContextChanged(DebugContextEvent event) {
- fDebugContext = event.getContext();
- update();
- }
-
- protected Object getAdapter(IAdaptable adaptable) {
- Object adapter = adaptable.getAdapter(getAdapterClass());
- if (adapter == null) {
- IAdapterManager adapterManager = Platform.getAdapterManager();
- if (adapterManager.hasAdapter(adaptable, getAdapterClass().getName())) {
- adapter = adapterManager.loadAdapter(adaptable, getAdapterClass().getName());
- }
- }
- return adapter;
- }
+ // Must use the stored service. If we try to fetch the service
+ // again with the workbenchWindow, it may fail if the window is
+ // already closed.
+ fContextService.removePostDebugContextListener(this);
+ fTargetAdapter = null;
+ }
+
+ @Override
+ public void debugContextChanged(DebugContextEvent event) {
+ fDebugContext = event.getContext();
+ update();
+ }
+
+ protected Object getAdapter(IAdaptable adaptable) {
+ Object adapter = adaptable.getAdapter(getAdapterClass());
+ if (adapter == null) {
+ IAdapterManager adapterManager = Platform.getAdapterManager();
+ if (adapterManager.hasAdapter(adaptable, getAdapterClass().getName())) {
+ adapter = adapterManager.loadAdapter(adaptable, getAdapterClass().getName());
+ }
+ }
+ return adapter;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/ContainerVMNode.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/ContainerVMNode.java
index ed238d8974c..f1f0849d98d 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/ContainerVMNode.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/ContainerVMNode.java
@@ -7,18 +7,17 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - Initial API and implementation
* Wind River Systems - Factored out AbstractContainerVMNode
- * Patrick Chuong (Texas Instruments) - Add support for icon overlay in the debug view (Bug 334566)
+ * Patrick Chuong (Texas Instruments) - Add support for icon overlay in the debug view (Bug 334566)
* Marc Khouzam (Ericsson) - Respect the "Show Full Path" option for the process name (Bug 378418)
* Marc Khouzam (Ericsson) - Support for exited processes in the debug view (bug 407340)
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.launch;
-
import java.util.Map;
import java.util.concurrent.RejectedExecutionException;
@@ -78,194 +77,204 @@ import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.ui.IMemento;
-
-public class ContainerVMNode extends AbstractContainerVMNode
- implements IElementLabelProvider, IElementMementoProvider
-{
+public class ContainerVMNode extends AbstractContainerVMNode implements IElementLabelProvider, IElementMementoProvider {
/** Indicator that we should not display running threads */
private boolean fHideRunningThreadsProperty = false;
-
+
/** PropertyChangeListener to keep track of the PREF_HIDE_RUNNING_THREADS preference */
private IPropertyChangeListener fPropertyChangeListener = new IPropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent event) {
if (event.getProperty().equals(IGdbDebugPreferenceConstants.PREF_HIDE_RUNNING_THREADS)) {
- fHideRunningThreadsProperty = (Boolean)event.getNewValue();
+ fHideRunningThreadsProperty = (Boolean) event.getNewValue();
}
}
};
-
+
public ContainerVMNode(AbstractDMVMProvider provider, DsfSession session) {
- super(provider, session);
+ super(provider, session);
- IPreferenceStore store = GdbUIPlugin.getDefault().getPreferenceStore();
- store.addPropertyChangeListener(fPropertyChangeListener);
- fHideRunningThreadsProperty = store.getBoolean(IGdbDebugPreferenceConstants.PREF_HIDE_RUNNING_THREADS);
+ IPreferenceStore store = GdbUIPlugin.getDefault().getPreferenceStore();
+ store.addPropertyChangeListener(fPropertyChangeListener);
+ fHideRunningThreadsProperty = store.getBoolean(IGdbDebugPreferenceConstants.PREF_HIDE_RUNNING_THREADS);
}
-
- @Override
- public void dispose() {
+
+ @Override
+ public void dispose() {
GdbUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(fPropertyChangeListener);
- super.dispose();
- }
-
+ super.dispose();
+ }
+
@Override
public String toString() {
- return "ContainerVMNode(" + getSession().getId() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ return "ContainerVMNode(" + getSession().getId() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
}
@Override
- protected IElementLabelProvider createLabelProvider() {
- PropertiesBasedLabelProvider provider = new PropertiesBasedLabelProvider();
-
- provider.setColumnInfo(
- PropertiesBasedLabelProvider.ID_COLUMN_NO_COLUMNS,
- new LabelColumnInfo(new LabelAttribute[] {
-
- /* EXITED CONTAINER LABEL */
- new GdbExecutionContextLabelText(
- MessagesForGdbLaunchVM.ContainerVMNode_No_columns__exited_format,
- new String[] {
- ExecutionContextLabelText.PROP_NAME_KNOWN,
- PROP_NAME,
- ExecutionContextLabelText.PROP_ID_KNOWN,
- ILaunchVMConstants.PROP_ID,
- IGdbLaunchVMConstants.PROP_EXIT_CODE_KNOWN,
- IGdbLaunchVMConstants.PROP_EXIT_CODE }) {
- @Override
- public boolean isEnabled(IStatus status, Map<String, Object> properties) {
- Boolean exited = (Boolean) properties.get(IGdbLaunchVMConstants.PROP_THREAD_EXITED);
- return Boolean.TRUE.equals(exited);
- }
- },
- /* EXITED CONTAINER IMAGE */
- new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_OS_PROCESS_TERMINATED)) {
- { setPropertyNames(new String[] {
- IGdbLaunchVMConstants.PROP_THREAD_EXITED }); }
- },
-
- /* ACTIVE CONTAINER LABEL */
- new GdbExecutionContextLabelText(
- MessagesForGdbLaunchVM.ContainerVMNode_No_columns__text_format,
- new String[] {
- ExecutionContextLabelText.PROP_NAME_KNOWN,
- PROP_NAME,
- ExecutionContextLabelText.PROP_ID_KNOWN,
- ILaunchVMConstants.PROP_ID,
- IGdbLaunchVMConstants.PROP_CORES_ID_KNOWN,
- IGdbLaunchVMConstants.PROP_CORES_ID,
- IGdbLaunchVMConstants.PROP_THREAD_SUMMARY_KNOWN,
- IGdbLaunchVMConstants.PROP_THREAD_SUMMARY }),
-
- new LabelText(MessagesForGdbLaunchVM.ContainerVMNode_No_columns__Error__label, new String[0]),
-
- /* RUNNING CONTAINER - RED PIN */
- new LabelImage(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_CONTAINER_RUNNING_R_PINNED)) {
- { setPropertyNames(new String[] {
- ILaunchVMConstants.PROP_IS_SUSPENDED,
- IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
- IGdbLaunchVMConstants.PROP_PIN_COLOR }); }
+ protected IElementLabelProvider createLabelProvider() {
+ PropertiesBasedLabelProvider provider = new PropertiesBasedLabelProvider();
+
+ provider.setColumnInfo(PropertiesBasedLabelProvider.ID_COLUMN_NO_COLUMNS,
+ new LabelColumnInfo(new LabelAttribute[] {
+
+ /* EXITED CONTAINER LABEL */
+ new GdbExecutionContextLabelText(
+ MessagesForGdbLaunchVM.ContainerVMNode_No_columns__exited_format,
+ new String[] { ExecutionContextLabelText.PROP_NAME_KNOWN, PROP_NAME,
+ ExecutionContextLabelText.PROP_ID_KNOWN, ILaunchVMConstants.PROP_ID,
+ IGdbLaunchVMConstants.PROP_EXIT_CODE_KNOWN,
+ IGdbLaunchVMConstants.PROP_EXIT_CODE }) {
+ @Override
+ public boolean isEnabled(IStatus status, Map<String, Object> properties) {
+ Boolean exited = (Boolean) properties.get(IGdbLaunchVMConstants.PROP_THREAD_EXITED);
+ return Boolean.TRUE.equals(exited);
+ }
+ },
+ /* EXITED CONTAINER IMAGE */
+ new LabelImage(
+ DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_OS_PROCESS_TERMINATED)) {
+ {
+ setPropertyNames(new String[] { IGdbLaunchVMConstants.PROP_THREAD_EXITED });
+ }
+ },
+
+ /* ACTIVE CONTAINER LABEL */
+ new GdbExecutionContextLabelText(MessagesForGdbLaunchVM.ContainerVMNode_No_columns__text_format,
+ new String[] { ExecutionContextLabelText.PROP_NAME_KNOWN, PROP_NAME,
+ ExecutionContextLabelText.PROP_ID_KNOWN, ILaunchVMConstants.PROP_ID,
+ IGdbLaunchVMConstants.PROP_CORES_ID_KNOWN, IGdbLaunchVMConstants.PROP_CORES_ID,
+ IGdbLaunchVMConstants.PROP_THREAD_SUMMARY_KNOWN,
+ IGdbLaunchVMConstants.PROP_THREAD_SUMMARY }),
+
+ new LabelText(MessagesForGdbLaunchVM.ContainerVMNode_No_columns__Error__label, new String[0]),
+
+ /* RUNNING CONTAINER - RED PIN */
+ new LabelImage(
+ CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_CONTAINER_RUNNING_R_PINNED)) {
+ {
+ setPropertyNames(new String[] { ILaunchVMConstants.PROP_IS_SUSPENDED,
+ IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
+ IGdbLaunchVMConstants.PROP_PIN_COLOR });
+ }
- @Override
- public boolean isEnabled(IStatus status, Map<String, Object> properties) {
- Boolean prop = (Boolean) properties.get(ILaunchVMConstants.PROP_IS_SUSPENDED);
- Boolean pin_prop = (Boolean) properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
- Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
- return (prop != null && pin_prop != null && pin_color_prop != null) ?
- !prop.booleanValue() && pin_prop.booleanValue() && pin_color_prop.equals(IPinElementColorDescriptor.RED) : false;
- };
- },
- /* RUNNING CONTAINER - GREEN PIN */
- new LabelImage(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_CONTAINER_RUNNING_G_PINNED)) {
- { setPropertyNames(new String[] {
- ILaunchVMConstants.PROP_IS_SUSPENDED,
- IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
- IGdbLaunchVMConstants.PROP_PIN_COLOR }); }
+ @Override
+ public boolean isEnabled(IStatus status, Map<String, Object> properties) {
+ Boolean prop = (Boolean) properties.get(ILaunchVMConstants.PROP_IS_SUSPENDED);
+ Boolean pin_prop = (Boolean) properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
+ Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
+ return (prop != null && pin_prop != null && pin_color_prop != null)
+ ? !prop.booleanValue() && pin_prop.booleanValue()
+ && pin_color_prop.equals(IPinElementColorDescriptor.RED)
+ : false;
+ };
+ },
+ /* RUNNING CONTAINER - GREEN PIN */
+ new LabelImage(
+ CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_CONTAINER_RUNNING_G_PINNED)) {
+ {
+ setPropertyNames(new String[] { ILaunchVMConstants.PROP_IS_SUSPENDED,
+ IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
+ IGdbLaunchVMConstants.PROP_PIN_COLOR });
+ }
- @Override
- public boolean isEnabled(IStatus status, Map<String, Object> properties) {
- Boolean prop = (Boolean) properties.get(ILaunchVMConstants.PROP_IS_SUSPENDED);
- Boolean pin_prop = (Boolean) properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
- Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
- return (prop != null && pin_prop != null && pin_color_prop != null) ?
- !prop.booleanValue() && pin_prop.booleanValue() && pin_color_prop.equals(IPinElementColorDescriptor.GREEN) : false;
- };
- },
- /* RUNNING CONTAINER - BLUE PIN */
- new LabelImage(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_CONTAINER_RUNNING_B_PINNED)) {
- { setPropertyNames(new String[] {
- ILaunchVMConstants.PROP_IS_SUSPENDED,
- IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
- IGdbLaunchVMConstants.PROP_PIN_COLOR }); }
+ @Override
+ public boolean isEnabled(IStatus status, Map<String, Object> properties) {
+ Boolean prop = (Boolean) properties.get(ILaunchVMConstants.PROP_IS_SUSPENDED);
+ Boolean pin_prop = (Boolean) properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
+ Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
+ return (prop != null && pin_prop != null && pin_color_prop != null)
+ ? !prop.booleanValue() && pin_prop.booleanValue()
+ && pin_color_prop.equals(IPinElementColorDescriptor.GREEN)
+ : false;
+ };
+ },
+ /* RUNNING CONTAINER - BLUE PIN */
+ new LabelImage(
+ CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_CONTAINER_RUNNING_B_PINNED)) {
+ {
+ setPropertyNames(new String[] { ILaunchVMConstants.PROP_IS_SUSPENDED,
+ IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
+ IGdbLaunchVMConstants.PROP_PIN_COLOR });
+ }
+
+ @Override
+ public boolean isEnabled(IStatus status, Map<String, Object> properties) {
+ Boolean prop = (Boolean) properties.get(ILaunchVMConstants.PROP_IS_SUSPENDED);
+ Boolean pin_prop = (Boolean) properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
+ Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
+ return (prop != null && pin_prop != null && pin_color_prop != null)
+ ? !prop.booleanValue() && pin_prop.booleanValue()
+ && pin_color_prop.equals(IPinElementColorDescriptor.BLUE)
+ : false;
+ };
+ },
+ /* RUNNING CONTAINER - NO PIN */
+ new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_DEBUG_TARGET)) {
+ {
+ setPropertyNames(new String[] { ILaunchVMConstants.PROP_IS_SUSPENDED });
+ }
+
+ @Override
+ public boolean isEnabled(IStatus status, java.util.Map<String, Object> properties) {
+ return Boolean.FALSE.equals(properties.get(ILaunchVMConstants.PROP_IS_SUSPENDED));
+ };
+ },
+
+ /* SUSPENDED CONTAINER - RED PIN */
+ new LabelImage(
+ CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_CONTAINER_SUSPENDED_R_PINNED)) {
+ {
+ setPropertyNames(new String[] { IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
+ IGdbLaunchVMConstants.PROP_PIN_COLOR });
+ }
+
+ @Override
+ public boolean isEnabled(IStatus status, Map<String, Object> properties) {
+ Boolean pin_prop = (Boolean) properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
+ Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
+ return (pin_prop != null && pin_color_prop != null) ? pin_prop.booleanValue()
+ && pin_color_prop.equals(IPinElementColorDescriptor.RED) : false;
+ };
+ },
+ /* SUSPENDED CONTAINER - GREEN PIN */
+ new LabelImage(
+ CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_CONTAINER_SUSPENDED_G_PINNED)) {
+ {
+ setPropertyNames(new String[] { IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
+ IGdbLaunchVMConstants.PROP_PIN_COLOR });
+ }
+
+ @Override
+ public boolean isEnabled(IStatus status, Map<String, Object> properties) {
+ Boolean pin_prop = (Boolean) properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
+ Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
+ return (pin_prop != null && pin_color_prop != null) ? pin_prop.booleanValue()
+ && pin_color_prop.equals(IPinElementColorDescriptor.GREEN) : false;
+ };
+ },
+ /* SUSPENDED CONTAINER - BLUE PIN */
+ new LabelImage(
+ CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_CONTAINER_SUSPENDED_B_PINNED)) {
+ {
+ setPropertyNames(new String[] { IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
+ IGdbLaunchVMConstants.PROP_PIN_COLOR });
+ }
+
+ @Override
+ public boolean isEnabled(IStatus status, Map<String, Object> properties) {
+ Boolean pin_prop = (Boolean) properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
+ Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
+ return (pin_prop != null && pin_color_prop != null) ? pin_prop.booleanValue()
+ && pin_color_prop.equals(IPinElementColorDescriptor.BLUE) : false;
+ };
+ },
+ /* SUSPENDED CONTAINER - NO PIN */
+ new LabelImage(DebugUITools
+ .getImageDescriptor(IDebugUIConstants.IMG_OBJS_DEBUG_TARGET_SUSPENDED)), }));
+
+ return provider;
+ }
- @Override
- public boolean isEnabled(IStatus status, Map<String, Object> properties) {
- Boolean prop = (Boolean) properties.get(ILaunchVMConstants.PROP_IS_SUSPENDED);
- Boolean pin_prop = (Boolean) properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
- Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
- return (prop != null && pin_prop != null && pin_color_prop != null) ?
- !prop.booleanValue() && pin_prop.booleanValue() && pin_color_prop.equals(IPinElementColorDescriptor.BLUE) : false;
- };
- },
- /* RUNNING CONTAINER - NO PIN */
- new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_DEBUG_TARGET)) {
- { setPropertyNames(new String[] { ILaunchVMConstants.PROP_IS_SUSPENDED }); }
-
- @Override
- public boolean isEnabled(IStatus status, java.util.Map<String,Object> properties) {
- return Boolean.FALSE.equals(properties.get(ILaunchVMConstants.PROP_IS_SUSPENDED));
- };
- },
-
- /* SUSPENDED CONTAINER - RED PIN */
- new LabelImage(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_CONTAINER_SUSPENDED_R_PINNED)) {
- { setPropertyNames(new String[] {
- IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
- IGdbLaunchVMConstants.PROP_PIN_COLOR }); }
-
- @Override
- public boolean isEnabled(IStatus status, Map<String, Object> properties) {
- Boolean pin_prop = (Boolean)properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
- Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
- return (pin_prop != null && pin_color_prop != null) ?
- pin_prop.booleanValue() && pin_color_prop.equals(IPinElementColorDescriptor.RED) : false;
- };
- },
- /* SUSPENDED CONTAINER - GREEN PIN */
- new LabelImage(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_CONTAINER_SUSPENDED_G_PINNED)) {
- { setPropertyNames(new String[] {
- IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
- IGdbLaunchVMConstants.PROP_PIN_COLOR }); }
-
- @Override
- public boolean isEnabled(IStatus status, Map<String, Object> properties) {
- Boolean pin_prop = (Boolean)properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
- Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
- return (pin_prop != null && pin_color_prop != null) ?
- pin_prop.booleanValue() && pin_color_prop.equals(IPinElementColorDescriptor.GREEN) : false;
- };
- },
- /* SUSPENDED CONTAINER - BLUE PIN */
- new LabelImage(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_CONTAINER_SUSPENDED_B_PINNED)) {
- { setPropertyNames(new String[] {
- IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
- IGdbLaunchVMConstants.PROP_PIN_COLOR }); }
-
- @Override
- public boolean isEnabled(IStatus status, Map<String, Object> properties) {
- Boolean pin_prop = (Boolean)properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
- Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
- return (pin_prop != null && pin_color_prop != null) ?
- pin_prop.booleanValue() && pin_color_prop.equals(IPinElementColorDescriptor.BLUE) : false;
- };
- },
- /* SUSPENDED CONTAINER - NO PIN */
- new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_DEBUG_TARGET_SUSPENDED)),
- }));
-
- return provider;
- }
-
@Override
protected void updateElementsInSessionThread(final IChildrenUpdate update) {
IProcesses processService = getServicesTracker().getService(IProcesses.class);
@@ -275,8 +284,7 @@ public class ContainerVMNode extends AbstractContainerVMNode
return;
}
- processService.getProcessesBeingDebugged(
- controlService.getContext(),
+ processService.getProcessesBeingDebugged(controlService.getContext(),
new ViewerDataRequestMonitor<IDMContext[]>(getExecutor(), update) {
@Override
public void handleCompleted() {
@@ -284,301 +292,307 @@ public class ContainerVMNode extends AbstractContainerVMNode
handleFailedUpdate(update);
return;
}
- if (getData() != null) fillUpdateWithVMCs(update, getData());
+ if (getData() != null)
+ fillUpdateWithVMCs(update, getData());
update.done();
}
});
}
- @Override
- protected void updatePropertiesInSessionThread(IPropertiesUpdate[] updates) {
- IPropertiesUpdate[] parentUpdates = new IPropertiesUpdate[updates.length];
-
- for (int i = 0; i < updates.length; i++) {
- final IPropertiesUpdate update = updates[i];
-
- final ViewerCountingRequestMonitor countringRm =
- new ViewerCountingRequestMonitor(ImmediateExecutor.getInstance(), updates[i]);
- int count = 0;
-
- // Create a delegating update which will let the super-class fill in the
- // standard container properties.
- parentUpdates[i] = new VMDelegatingPropertiesUpdate(updates[i], countringRm);
- count++;
-
- // set pin properties
- IDMContext dmc = findDmcInPath(update.getViewerInput(), update.getElementPath(), IDMContext.class);
- IPinElementColorDescriptor colorDesc = PinCloneUtils.getPinElementColorDescriptor(GdbPinProvider.getPinnedHandles(), dmc);
- updates[i].setProperty(IGdbLaunchVMConstants.PROP_PIN_COLOR,
- colorDesc != null ? colorDesc.getOverlayColor() : null);
- updates[i].setProperty(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
- PinCloneUtils.isPinnedTo(GdbPinProvider.getPinnedHandles(), dmc));
-
- if (update.getProperties().contains(PROP_NAME) ||
- update.getProperties().contains(ILaunchVMConstants.PROP_ID) ||
- update.getProperties().contains(IGdbLaunchVMConstants.PROP_CORES_ID) ||
- update.getProperties().contains(IGdbLaunchVMConstants.PROP_THREAD_EXITED) ||
- update.getProperties().contains((IGdbLaunchVMConstants.PROP_EXIT_CODE)))
- {
- IProcesses processService = getServicesTracker().getService(IProcesses.class);
- final IProcessDMContext procDmc = findDmcInPath(update.getViewerInput(), update.getElementPath(), IProcessDMContext.class);
-
- if (processService == null || procDmc == null) {
- update.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_HANDLE, "Service or handle invalid", null)); //$NON-NLS-1$
- } else {
- processService.getExecutionData(
- procDmc,
- new ViewerDataRequestMonitor<IThreadDMData>(getExecutor(), update) {
- @Override
- public void handleCompleted() {
- if (isSuccess()) {
- fillThreadDataProperties(update, getData());
- } else {
- update.setStatus(getStatus());
- }
- countringRm.done();
- }
- });
- count++;
- }
- }
-
- if (update.getProperties().contains(IGdbLaunchVMConstants.PROP_THREAD_SUMMARY)) {
- fillThreadSummary(update, countringRm);
- count++;
- }
-
- countringRm.setDoneCount(count);
- }
-
- super.updatePropertiesInSessionThread(parentUpdates);
- }
-
- protected void fillThreadDataProperties(IPropertiesUpdate update, IThreadDMData data) {
- String fileName = data.getName();
- if (fileName != null) {
- Object showFullPathPreference = getVMProvider().getPresentationContext().getProperty(IDsfDebugUIConstants.DEBUG_VIEW_SHOW_FULL_PATH_PROPERTY);
- if (showFullPathPreference instanceof Boolean && (Boolean)showFullPathPreference == false) {
- fileName = new Path(fileName).lastSegment();
- }
- }
- update.setProperty(PROP_NAME, fileName);
- update.setProperty(ILaunchVMConstants.PROP_ID, data.getId());
-
+ @Override
+ protected void updatePropertiesInSessionThread(IPropertiesUpdate[] updates) {
+ IPropertiesUpdate[] parentUpdates = new IPropertiesUpdate[updates.length];
+
+ for (int i = 0; i < updates.length; i++) {
+ final IPropertiesUpdate update = updates[i];
+
+ final ViewerCountingRequestMonitor countringRm = new ViewerCountingRequestMonitor(
+ ImmediateExecutor.getInstance(), updates[i]);
+ int count = 0;
+
+ // Create a delegating update which will let the super-class fill in the
+ // standard container properties.
+ parentUpdates[i] = new VMDelegatingPropertiesUpdate(updates[i], countringRm);
+ count++;
+
+ // set pin properties
+ IDMContext dmc = findDmcInPath(update.getViewerInput(), update.getElementPath(), IDMContext.class);
+ IPinElementColorDescriptor colorDesc = PinCloneUtils
+ .getPinElementColorDescriptor(GdbPinProvider.getPinnedHandles(), dmc);
+ updates[i].setProperty(IGdbLaunchVMConstants.PROP_PIN_COLOR,
+ colorDesc != null ? colorDesc.getOverlayColor() : null);
+ updates[i].setProperty(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
+ PinCloneUtils.isPinnedTo(GdbPinProvider.getPinnedHandles(), dmc));
+
+ if (update.getProperties().contains(PROP_NAME)
+ || update.getProperties().contains(ILaunchVMConstants.PROP_ID)
+ || update.getProperties().contains(IGdbLaunchVMConstants.PROP_CORES_ID)
+ || update.getProperties().contains(IGdbLaunchVMConstants.PROP_THREAD_EXITED)
+ || update.getProperties().contains((IGdbLaunchVMConstants.PROP_EXIT_CODE))) {
+ IProcesses processService = getServicesTracker().getService(IProcesses.class);
+ final IProcessDMContext procDmc = findDmcInPath(update.getViewerInput(), update.getElementPath(),
+ IProcessDMContext.class);
+
+ if (processService == null || procDmc == null) {
+ update.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID,
+ IDsfStatusConstants.INVALID_HANDLE, "Service or handle invalid", null)); //$NON-NLS-1$
+ } else {
+ processService.getExecutionData(procDmc,
+ new ViewerDataRequestMonitor<IThreadDMData>(getExecutor(), update) {
+ @Override
+ public void handleCompleted() {
+ if (isSuccess()) {
+ fillThreadDataProperties(update, getData());
+ } else {
+ update.setStatus(getStatus());
+ }
+ countringRm.done();
+ }
+ });
+ count++;
+ }
+ }
+
+ if (update.getProperties().contains(IGdbLaunchVMConstants.PROP_THREAD_SUMMARY)) {
+ fillThreadSummary(update, countringRm);
+ count++;
+ }
+
+ countringRm.setDoneCount(count);
+ }
+
+ super.updatePropertiesInSessionThread(parentUpdates);
+ }
+
+ protected void fillThreadDataProperties(IPropertiesUpdate update, IThreadDMData data) {
+ String fileName = data.getName();
+ if (fileName != null) {
+ Object showFullPathPreference = getVMProvider().getPresentationContext()
+ .getProperty(IDsfDebugUIConstants.DEBUG_VIEW_SHOW_FULL_PATH_PROPERTY);
+ if (showFullPathPreference instanceof Boolean && (Boolean) showFullPathPreference == false) {
+ fileName = new Path(fileName).lastSegment();
+ }
+ }
+ update.setProperty(PROP_NAME, fileName);
+ update.setProperty(ILaunchVMConstants.PROP_ID, data.getId());
+
String coresStr = null;
- if (data instanceof IGdbThreadDMData) {
- String[] cores = ((IGdbThreadDMData)data).getCores();
- if (cores != null) {
- StringBuilder str = new StringBuilder();
- for (String core : cores) {
- str.append(core).append(',');
- }
- if (str.length() > 0) {
- coresStr = str.substring(0, str.length() - 1);
- }
- }
- }
- update.setProperty(IGdbLaunchVMConstants.PROP_CORES_ID, coresStr);
-
- if (data instanceof IGdbThreadExitedDMData) {
- update.setProperty(IGdbLaunchVMConstants.PROP_THREAD_EXITED, true);
-
- Integer exitCode = ((IGdbThreadExitedDMData)data).getExitCode();
- if (exitCode != null) {
- update.setProperty(IGdbLaunchVMConstants.PROP_EXIT_CODE, exitCode);
- }
- }
- }
-
- protected void fillThreadSummary(final IPropertiesUpdate update, final RequestMonitor rm) {
- if (!fHideRunningThreadsProperty) {
- // Disable the thread summary when we are not hiding threads
- update.setProperty(IGdbLaunchVMConstants.PROP_THREAD_SUMMARY, null);
- rm.done();
- return;
- }
-
- IProcesses processService = getServicesTracker().getService(IProcesses.class);
- final IContainerDMContext procDmc = findDmcInPath(update.getViewerInput(), update.getElementPath(), IContainerDMContext.class);
-
- if (processService == null || procDmc == null) {
- update.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_HANDLE, "Service or handle invalid", null)); //$NON-NLS-1$
- } else {
- // Fetch all the threads
- processService.getProcessesBeingDebugged(
- procDmc,
- new ViewerDataRequestMonitor<IDMContext[]>(getSession().getExecutor(), update) {
- @Override
- public void handleCompleted() {
- IRunControl runControl = getServicesTracker().getService(IRunControl.class);
- if (!isSuccess() ||
- !(getData() instanceof IExecutionDMContext[]) ||
- runControl == null) {
- update.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_HANDLE, "Unable to get threads summary", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- // For each thread, count how many are running and therefore hidden
- // Remove running threads from the list
- int runningCount = 0;
- for (IExecutionDMContext execDmc : (IExecutionDMContext[])getData()) {
- // Keep suspended or stepping threads
- if (!runControl.isSuspended(execDmc) && !runControl.isStepping(execDmc)) {
- runningCount++;
+ if (data instanceof IGdbThreadDMData) {
+ String[] cores = ((IGdbThreadDMData) data).getCores();
+ if (cores != null) {
+ StringBuilder str = new StringBuilder();
+ for (String core : cores) {
+ str.append(core).append(',');
+ }
+ if (str.length() > 0) {
+ coresStr = str.substring(0, str.length() - 1);
+ }
+ }
+ }
+ update.setProperty(IGdbLaunchVMConstants.PROP_CORES_ID, coresStr);
+
+ if (data instanceof IGdbThreadExitedDMData) {
+ update.setProperty(IGdbLaunchVMConstants.PROP_THREAD_EXITED, true);
+
+ Integer exitCode = ((IGdbThreadExitedDMData) data).getExitCode();
+ if (exitCode != null) {
+ update.setProperty(IGdbLaunchVMConstants.PROP_EXIT_CODE, exitCode);
+ }
+ }
+ }
+
+ protected void fillThreadSummary(final IPropertiesUpdate update, final RequestMonitor rm) {
+ if (!fHideRunningThreadsProperty) {
+ // Disable the thread summary when we are not hiding threads
+ update.setProperty(IGdbLaunchVMConstants.PROP_THREAD_SUMMARY, null);
+ rm.done();
+ return;
+ }
+
+ IProcesses processService = getServicesTracker().getService(IProcesses.class);
+ final IContainerDMContext procDmc = findDmcInPath(update.getViewerInput(), update.getElementPath(),
+ IContainerDMContext.class);
+
+ if (processService == null || procDmc == null) {
+ update.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_HANDLE,
+ "Service or handle invalid", null)); //$NON-NLS-1$
+ } else {
+ // Fetch all the threads
+ processService.getProcessesBeingDebugged(procDmc,
+ new ViewerDataRequestMonitor<IDMContext[]>(getSession().getExecutor(), update) {
+ @Override
+ public void handleCompleted() {
+ IRunControl runControl = getServicesTracker().getService(IRunControl.class);
+ if (!isSuccess() || !(getData() instanceof IExecutionDMContext[]) || runControl == null) {
+ update.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID,
+ IDsfStatusConstants.INVALID_HANDLE, "Unable to get threads summary", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ // For each thread, count how many are running and therefore hidden
+ // Remove running threads from the list
+ int runningCount = 0;
+ for (IExecutionDMContext execDmc : (IExecutionDMContext[]) getData()) {
+ // Keep suspended or stepping threads
+ if (!runControl.isSuspended(execDmc) && !runControl.isStepping(execDmc)) {
+ runningCount++;
+ }
}
+ update.setProperty(IGdbLaunchVMConstants.PROP_THREAD_SUMMARY, String.format("(%d %s)", //$NON-NLS-1$
+ runningCount, MessagesForGdbLaunchVM.ContainerVMNode_filtered_running_threads));
+ rm.done();
}
- update.setProperty(IGdbLaunchVMConstants.PROP_THREAD_SUMMARY,
- String.format("(%d %s)", runningCount, MessagesForGdbLaunchVM.ContainerVMNode_filtered_running_threads)); //$NON-NLS-1$
- rm.done();
- }
- });
- }
- }
-
+ });
+ }
+ }
+
@Override
public int getDeltaFlags(Object e) {
if (e instanceof ICommandControlShutdownDMEvent) {
return IModelDelta.CONTENT;
}
if (e instanceof IThreadRemovedDMEvent) {
- IDMContext dmc = e instanceof IDMEvent<?> ? ((IDMEvent<?>)e).getDMContext() : null;
- if (dmc instanceof IProcessDMContext) {
- return IModelDelta.CONTENT;
- }
- return IModelDelta.NO_CHANGE;
- }
- return super.getDeltaFlags(e);
+ IDMContext dmc = e instanceof IDMEvent<?> ? ((IDMEvent<?>) e).getDMContext() : null;
+ if (dmc instanceof IProcessDMContext) {
+ return IModelDelta.CONTENT;
+ }
+ return IModelDelta.NO_CHANGE;
+ }
+ return super.getDeltaFlags(e);
}
@Override
- public void buildDelta(Object e, final VMDelta parentDelta, final int nodeOffset, final RequestMonitor requestMonitor) {
+ public void buildDelta(Object e, final VMDelta parentDelta, final int nodeOffset,
+ final RequestMonitor requestMonitor) {
if (e instanceof ICommandControlShutdownDMEvent) {
- parentDelta.setFlags(parentDelta.getFlags() | IModelDelta.CONTENT);
- } else if (e instanceof IThreadRemovedDMEvent) {
- IDMContext dmc = e instanceof IDMEvent<?> ? ((IDMEvent<?>)e).getDMContext() : null;
- if (dmc instanceof IProcessDMContext) {
- // A process was removed, refresh the parent
- parentDelta.setFlags(parentDelta.getFlags() | IModelDelta.CONTENT);
- }
- } else {
- super.buildDelta(e, parentDelta, nodeOffset, requestMonitor);
- return;
- }
+ parentDelta.setFlags(parentDelta.getFlags() | IModelDelta.CONTENT);
+ } else if (e instanceof IThreadRemovedDMEvent) {
+ IDMContext dmc = e instanceof IDMEvent<?> ? ((IDMEvent<?>) e).getDMContext() : null;
+ if (dmc instanceof IProcessDMContext) {
+ // A process was removed, refresh the parent
+ parentDelta.setFlags(parentDelta.getFlags() | IModelDelta.CONTENT);
+ }
+ } else {
+ super.buildDelta(e, parentDelta, nodeOffset, requestMonitor);
+ return;
+ }
requestMonitor.done();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider#compareElements(org.eclipse.debug.internal.ui.viewers.model.provisional.IElementCompareRequest[])
- */
- private final String MEMENTO_NAME = "CONTAINER_MEMENTO_NAME"; //$NON-NLS-1$
-
- @Override
- public void compareElements(IElementCompareRequest[] requests) {
- for (final IElementCompareRequest request : requests) {
-
- Object element = request.getElement();
- final IMemento memento = request.getMemento();
- final String mementoName = memento.getString(MEMENTO_NAME);
-
- if (mementoName != null) {
- if (element instanceof IDMVMContext) {
-
- IDMContext dmc = ((IDMVMContext)element).getDMContext();
-
- if (dmc instanceof IContainerDMContext)
- {
- final IProcessDMContext procDmc = findDmcInPath(request.getViewerInput(), request.getElementPath(), IProcessDMContext.class);
-
- if (procDmc != null) {
- try {
- getSession().getExecutor().execute(new DsfRunnable() {
- @Override
- public void run() {
- final IProcesses processService = getServicesTracker().getService(IProcesses.class);
- if (processService != null) {
- processService.getExecutionData(
- procDmc,
- new ViewerDataRequestMonitor<IThreadDMData>(processService.getExecutor(), request) {
- @Override
- protected void handleCompleted() {
- if ( getStatus().isOK() ) {
- memento.putString(MEMENTO_NAME, "Container." + getData().getName() + getData().getId()); //$NON-NLS-1$
- }
- request.done();
- }
- });
- }
- else {
- request.done();
- }
- }
- });
- } catch (RejectedExecutionException e) {
- request.done();
- }
-
- continue;
- }
- }
- }
- }
- request.done();
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider#encodeElements(org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoRequest[])
- */
- @Override
- public void encodeElements(IElementMementoRequest[] requests) {
- for (final IElementMementoRequest request : requests) {
-
- Object element = request.getElement();
- final IMemento memento = request.getMemento();
-
- if (element instanceof IDMVMContext) {
-
- IDMContext dmc = ((IDMVMContext)element).getDMContext();
-
- if (dmc instanceof IContainerDMContext)
- {
- final IProcessDMContext procDmc = findDmcInPath(request.getViewerInput(), request.getElementPath(), IProcessDMContext.class);
-
- if (procDmc != null) {
- try {
- getSession().getExecutor().execute(new DsfRunnable() {
- @Override
- public void run() {
- final IProcesses processService = getServicesTracker().getService(IProcesses.class);
- if (processService != null) {
- processService.getExecutionData(
- procDmc,
- new ViewerDataRequestMonitor<IThreadDMData>(processService.getExecutor(), request) {
- @Override
- protected void handleCompleted() {
- if ( getStatus().isOK() ) {
- memento.putString(MEMENTO_NAME, "Container." + getData().getName() + getData().getId()); //$NON-NLS-1$
- }
- request.done();
- }
- });
- } else {
- request.done();
- }
- }
- });
- } catch (RejectedExecutionException e) {
- request.done();
- }
-
- continue;
- }
- }
- }
- request.done();
- }
- }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider#compareElements(org.eclipse.debug.internal.ui.viewers.model.provisional.IElementCompareRequest[])
+ */
+ private final String MEMENTO_NAME = "CONTAINER_MEMENTO_NAME"; //$NON-NLS-1$
+
+ @Override
+ public void compareElements(IElementCompareRequest[] requests) {
+ for (final IElementCompareRequest request : requests) {
+
+ Object element = request.getElement();
+ final IMemento memento = request.getMemento();
+ final String mementoName = memento.getString(MEMENTO_NAME);
+
+ if (mementoName != null) {
+ if (element instanceof IDMVMContext) {
+
+ IDMContext dmc = ((IDMVMContext) element).getDMContext();
+
+ if (dmc instanceof IContainerDMContext) {
+ final IProcessDMContext procDmc = findDmcInPath(request.getViewerInput(),
+ request.getElementPath(), IProcessDMContext.class);
+
+ if (procDmc != null) {
+ try {
+ getSession().getExecutor().execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ final IProcesses processService = getServicesTracker()
+ .getService(IProcesses.class);
+ if (processService != null) {
+ processService.getExecutionData(procDmc,
+ new ViewerDataRequestMonitor<IThreadDMData>(
+ processService.getExecutor(), request) {
+ @Override
+ protected void handleCompleted() {
+ if (getStatus().isOK()) {
+ memento.putString(MEMENTO_NAME, "Container." //$NON-NLS-1$
+ + getData().getName() + getData().getId());
+ }
+ request.done();
+ }
+ });
+ } else {
+ request.done();
+ }
+ }
+ });
+ } catch (RejectedExecutionException e) {
+ request.done();
+ }
+
+ continue;
+ }
+ }
+ }
+ }
+ request.done();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider#encodeElements(org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoRequest[])
+ */
+ @Override
+ public void encodeElements(IElementMementoRequest[] requests) {
+ for (final IElementMementoRequest request : requests) {
+
+ Object element = request.getElement();
+ final IMemento memento = request.getMemento();
+
+ if (element instanceof IDMVMContext) {
+
+ IDMContext dmc = ((IDMVMContext) element).getDMContext();
+
+ if (dmc instanceof IContainerDMContext) {
+ final IProcessDMContext procDmc = findDmcInPath(request.getViewerInput(), request.getElementPath(),
+ IProcessDMContext.class);
+
+ if (procDmc != null) {
+ try {
+ getSession().getExecutor().execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ final IProcesses processService = getServicesTracker().getService(IProcesses.class);
+ if (processService != null) {
+ processService.getExecutionData(procDmc,
+ new ViewerDataRequestMonitor<IThreadDMData>(
+ processService.getExecutor(), request) {
+ @Override
+ protected void handleCompleted() {
+ if (getStatus().isOK()) {
+ memento.putString(MEMENTO_NAME, "Container." //$NON-NLS-1$
+ + getData().getName() + getData().getId());
+ }
+ request.done();
+ }
+ });
+ } else {
+ request.done();
+ }
+ }
+ });
+ } catch (RejectedExecutionException e) {
+ request.done();
+ }
+
+ continue;
+ }
+ }
+ }
+ request.done();
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/GdbExecutionContextLabelText.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/GdbExecutionContextLabelText.java
index f6ffc43ac00..b98ff11ce97 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/GdbExecutionContextLabelText.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/GdbExecutionContextLabelText.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* Marc Khouzam (Ericsson) - Support for exited processes in the debug view (bug 407340)
@@ -24,40 +24,39 @@ import org.eclipse.core.runtime.IStatus;
*/
public class GdbExecutionContextLabelText extends ExecutionContextLabelText {
- public GdbExecutionContextLabelText(String formatPattern, String[] propertyNames) {
- super(formatPattern, propertyNames);
- }
+ public GdbExecutionContextLabelText(String formatPattern, String[] propertyNames) {
+ super(formatPattern, propertyNames);
+ }
- @Override
- protected Object getPropertyValue(String propertyName, IStatus status, Map<String, Object> properties) {
- if (IGdbLaunchVMConstants.PROP_OS_ID_KNOWN.equals(propertyName)) {
- return properties.get(IGdbLaunchVMConstants.PROP_OS_ID) != null ? 1 : 0;
- }
- if (IGdbLaunchVMConstants.PROP_CORES_ID_KNOWN.equals(propertyName)) {
- return properties.get(IGdbLaunchVMConstants.PROP_CORES_ID) != null ? 1 : 0;
- }
- if (IGdbLaunchVMConstants.PROP_THREAD_SUMMARY_KNOWN.equals(propertyName)) {
- return properties.get(IGdbLaunchVMConstants.PROP_THREAD_SUMMARY) != null ? 1 : 0;
- }
- if (IGdbLaunchVMConstants.PROP_EXIT_CODE_KNOWN.equals(propertyName)) {
- return properties.get(IGdbLaunchVMConstants.PROP_EXIT_CODE) != null ? 1 : 0;
- }
- return super.getPropertyValue(propertyName, status, properties);
- }
+ @Override
+ protected Object getPropertyValue(String propertyName, IStatus status, Map<String, Object> properties) {
+ if (IGdbLaunchVMConstants.PROP_OS_ID_KNOWN.equals(propertyName)) {
+ return properties.get(IGdbLaunchVMConstants.PROP_OS_ID) != null ? 1 : 0;
+ }
+ if (IGdbLaunchVMConstants.PROP_CORES_ID_KNOWN.equals(propertyName)) {
+ return properties.get(IGdbLaunchVMConstants.PROP_CORES_ID) != null ? 1 : 0;
+ }
+ if (IGdbLaunchVMConstants.PROP_THREAD_SUMMARY_KNOWN.equals(propertyName)) {
+ return properties.get(IGdbLaunchVMConstants.PROP_THREAD_SUMMARY) != null ? 1 : 0;
+ }
+ if (IGdbLaunchVMConstants.PROP_EXIT_CODE_KNOWN.equals(propertyName)) {
+ return properties.get(IGdbLaunchVMConstants.PROP_EXIT_CODE) != null ? 1 : 0;
+ }
+ return super.getPropertyValue(propertyName, status, properties);
+ }
- @Override
- protected boolean checkProperty(String propertyName, IStatus status, Map<String, Object> properties) {
- if (IGdbLaunchVMConstants.PROP_OS_ID_KNOWN.equals(propertyName) ||
- IGdbLaunchVMConstants.PROP_OS_ID.equals(propertyName) ||
- IGdbLaunchVMConstants.PROP_CORES_ID_KNOWN.equals(propertyName) ||
- IGdbLaunchVMConstants.PROP_CORES_ID.equals(propertyName) ||
- IGdbLaunchVMConstants.PROP_THREAD_SUMMARY_KNOWN.equals(propertyName) ||
- IGdbLaunchVMConstants.PROP_THREAD_SUMMARY.equals(propertyName) ||
- IGdbLaunchVMConstants.PROP_EXIT_CODE_KNOWN.equals(propertyName) ||
- IGdbLaunchVMConstants.PROP_EXIT_CODE.equals(propertyName))
- {
- return true;
- }
- return super.checkProperty(propertyName, status, properties);
- }
+ @Override
+ protected boolean checkProperty(String propertyName, IStatus status, Map<String, Object> properties) {
+ if (IGdbLaunchVMConstants.PROP_OS_ID_KNOWN.equals(propertyName)
+ || IGdbLaunchVMConstants.PROP_OS_ID.equals(propertyName)
+ || IGdbLaunchVMConstants.PROP_CORES_ID_KNOWN.equals(propertyName)
+ || IGdbLaunchVMConstants.PROP_CORES_ID.equals(propertyName)
+ || IGdbLaunchVMConstants.PROP_THREAD_SUMMARY_KNOWN.equals(propertyName)
+ || IGdbLaunchVMConstants.PROP_THREAD_SUMMARY.equals(propertyName)
+ || IGdbLaunchVMConstants.PROP_EXIT_CODE_KNOWN.equals(propertyName)
+ || IGdbLaunchVMConstants.PROP_EXIT_CODE.equals(propertyName)) {
+ return true;
+ }
+ return super.checkProperty(propertyName, status, properties);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/GdbStackFramesVMNode.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/GdbStackFramesVMNode.java
index 4a693700c29..fa3b549f96a 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/GdbStackFramesVMNode.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/GdbStackFramesVMNode.java
@@ -37,50 +37,47 @@ public class GdbStackFramesVMNode extends StackFramesVMNode {
@Override
public int getDeltaFlags(Object e) {
if (e instanceof IGDBFocusChangedEvent) {
- return IModelDelta.SELECT;
+ return IModelDelta.SELECT;
}
-
+
return super.getDeltaFlags(e);
}
-
+
@Override
public void buildDelta(final Object e, final VMDelta parentDelta, final int nodeOffset, final RequestMonitor rm) {
if (e instanceof IGDBFocusChangedEvent) {
- buildDeltaForFocusChangedEvent((IGDBFocusChangedEvent)e, parentDelta, rm);
- }
- else {
+ buildDeltaForFocusChangedEvent((IGDBFocusChangedEvent) e, parentDelta, rm);
+ } else {
super.buildDelta(e, parentDelta, nodeOffset, rm);
}
}
-
+
private void buildDeltaForFocusChangedEvent(IGDBFocusChangedEvent event, VMDelta parentDelta, RequestMonitor rm) {
getSession().getExecutor().execute(new Runnable() {
@Override
public void run() {
IDMContext ctx = event.getDMContext();
-
- // Is IGDBFocusChangedEvent pertinent for this VMNode?
+
+ // Is IGDBFocusChangedEvent pertinent for this VMNode?
if (ctx instanceof IFrameDMContext) {
- IFrameDMContext newFrameFocus = (IFrameDMContext)ctx;
- IMIExecutionDMContext execDmc = DMContexts.getAncestorOfType(newFrameFocus, IMIExecutionDMContext.class);
+ IFrameDMContext newFrameFocus = (IFrameDMContext) ctx;
+ IMIExecutionDMContext execDmc = DMContexts.getAncestorOfType(newFrameFocus,
+ IMIExecutionDMContext.class);
if (execDmc == null) {
rm.done();
return;
}
- IRunControl runControl = getServicesTracker().getService(IRunControl.class);
- if (runControl == null) {
- // Required services have not initialized yet. Ignore the event.
- rm.done();
- return;
- }
+ IRunControl runControl = getServicesTracker().getService(IRunControl.class);
+ if (runControl == null) {
+ // Required services have not initialized yet. Ignore the event.
+ rm.done();
+ return;
+ }
if (runControl.isSuspended(execDmc) || runControl.isStepping(execDmc)) {
// find the VMC index for the frame that switched, so we can select it correctly.
- getVMCIndexForDmc(
- GdbStackFramesVMNode.this,
- newFrameFocus,
- parentDelta,
+ getVMCIndexForDmc(GdbStackFramesVMNode.this, newFrameFocus, parentDelta,
new DataRequestMonitor<Integer>(getExecutor(), rm) {
@Override
protected void handleSuccess() {
@@ -90,24 +87,21 @@ public class GdbStackFramesVMNode extends StackFramesVMNode {
// Retrieve the list of stack frames
getVMProvider().updateNode(GdbStackFramesVMNode.this,
new VMChildrenUpdate(parentDelta,
- getVMProvider().getPresentationContext(), -1,
- -1, new DataRequestMonitor<List<Object>>(
- getExecutor(), rm) {
- @Override
- public void handleSuccess() {
- final List<Object> data = getData();
- if (data != null && data.size() != 0) {
- // create the delta to select the
- // current stack frame
- parentDelta.addNode(
- data.get(frameOffset),
- frameOffset,
- IModelDelta.SELECT | IModelDelta.FORCE
- );
- }
- rm.done();
- }
- }));
+ getVMProvider().getPresentationContext(), -1, -1,
+ new DataRequestMonitor<List<Object>>(getExecutor(), rm) {
+ @Override
+ public void handleSuccess() {
+ final List<Object> data = getData();
+ if (data != null && data.size() != 0) {
+ // create the delta to select the
+ // current stack frame
+ parentDelta.addNode(data.get(frameOffset),
+ frameOffset,
+ IModelDelta.SELECT | IModelDelta.FORCE);
+ }
+ rm.done();
+ }
+ }));
}
});
} else {
@@ -119,6 +113,6 @@ public class GdbStackFramesVMNode extends StackFramesVMNode {
rm.done();
}
}
- });
+ });
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/GdbStandardProcessVMNode.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/GdbStandardProcessVMNode.java
index eff58106fb8..1bed684e787 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/GdbStandardProcessVMNode.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/GdbStandardProcessVMNode.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
@@ -28,143 +28,141 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
import org.eclipse.jface.viewers.TreePath;
/**
- * Layout node for the standard platform debug model IProcess object. This
- * node requires that an ILaunch object be found as an ancestor of this node.
- * It does not implement the label provider functionality, so the default
+ * Layout node for the standard platform debug model IProcess object. This
+ * node requires that an ILaunch object be found as an ancestor of this node.
+ * It does not implement the label provider functionality, so the default
* adapters should be used to retrieve the label.
- *
+ *
* This version is specific to DSF-GDB to no longer show the inferiors.
*/
public class GdbStandardProcessVMNode extends StandardProcessVMNode {
-
- public GdbStandardProcessVMNode(AbstractVMProvider provider) {
- super(provider);
- }
- @Override
- public String toString() {
- return "GdbStandardProcessVMNode"; //$NON-NLS-1$
- }
+ public GdbStandardProcessVMNode(AbstractVMProvider provider) {
+ super(provider);
+ }
+
+ @Override
+ public String toString() {
+ return "GdbStandardProcessVMNode"; //$NON-NLS-1$
+ }
+
+ @Override
+ public void update(IChildrenUpdate[] updates) {
+ for (IChildrenUpdate update : updates) {
+ ILaunch launch = findLaunch(update.getElementPath());
+ if (launch == null) {
+ // There is no launch in the parent of this node. This means that the
+ // layout is misconfigured.
+ assert false;
+ update.done();
+ continue;
+ }
+
+ /*
+ * Assume that the process objects are stored within the launch, and
+ * retrieve them on dispatch thread.
+ */
+ int count = 0;
+ for (IProcess process : launch.getProcesses()) {
+ if (!(process instanceof InferiorRuntimeProcess)) {
+ update.setChild(process, count++);
+ }
+ }
+ update.done();
+ }
+ }
+
+ @Override
+ public void update(final IChildrenCountUpdate[] updates) {
+ for (IChildrenCountUpdate update : updates) {
+ if (!checkUpdate(update))
+ continue;
+ ILaunch launch = findLaunch(update.getElementPath());
+ if (launch == null) {
+ assert false;
+ update.setChildCount(0);
+ update.done();
+ return;
+ }
+
+ int count = 0;
+ for (IProcess process : launch.getProcesses()) {
+ if (!(process instanceof InferiorRuntimeProcess)) {
+ count++;
+ }
+ }
+ update.setChildCount(count);
+ update.done();
+ }
+ }
+
+ // @see org.eclipse.cdt.dsf.ui.viewmodel.IViewModelLayoutNode#hasElements(org.eclipse.cdt.dsf.ui.viewmodel.IVMContext, org.eclipse.cdt.dsf.concurrent.DataRequestMonitor)
+ @Override
+ public void update(IHasChildrenUpdate[] updates) {
+ for (IHasChildrenUpdate update : updates) {
+ ILaunch launch = findLaunch(update.getElementPath());
+ if (launch == null) {
+ assert false;
+ update.setHasChilren(false);
+ update.done();
+ return;
+ }
+
+ boolean hasChildren = false;
+ for (IProcess process : launch.getProcesses()) {
+ if (!(process instanceof InferiorRuntimeProcess)) {
+ hasChildren = true;
+ break;
+ }
+ }
+
+ update.setHasChilren(hasChildren);
+ update.done();
+ }
+ }
- @Override
- public void update(IChildrenUpdate[] updates) {
- for (IChildrenUpdate update : updates) {
- ILaunch launch = findLaunch(update.getElementPath());
- if (launch == null) {
- // There is no launch in the parent of this node. This means that the
- // layout is misconfigured.
- assert false;
- update.done();
- continue;
- }
-
- /*
- * Assume that the process objects are stored within the launch, and
- * retrieve them on dispatch thread.
- */
- int count = 0;
- for (IProcess process : launch.getProcesses()) {
- if (!(process instanceof InferiorRuntimeProcess)) {
- update.setChild(process, count++);
- }
- }
- update.done();
- }
- }
-
- @Override
- public void update(final IChildrenCountUpdate[] updates) {
- for (IChildrenCountUpdate update : updates) {
- if (!checkUpdate(update)) continue;
- ILaunch launch = findLaunch(update.getElementPath());
- if (launch == null) {
- assert false;
- update.setChildCount(0);
- update.done();
- return;
- }
-
- int count = 0;
- for (IProcess process : launch.getProcesses()) {
- if (!(process instanceof InferiorRuntimeProcess)) {
- count++;
- }
- }
- update.setChildCount(count);
- update.done();
- }
- }
+ /**
+ * Recursively searches the VMC for Launch VMC, and returns its ILaunch.
+ * Returns null if an ILaunch is not found.
+ */
+ private ILaunch findLaunch(TreePath path) {
+ for (int i = path.getSegmentCount() - 1; i >= 0; i--) {
+ if (path.getSegment(i) instanceof ILaunch) {
+ return (ILaunch) path.getSegment(i);
+ }
+ }
+ return null;
+ }
- // @see org.eclipse.cdt.dsf.ui.viewmodel.IViewModelLayoutNode#hasElements(org.eclipse.cdt.dsf.ui.viewmodel.IVMContext, org.eclipse.cdt.dsf.concurrent.DataRequestMonitor)
- @Override
- public void update(IHasChildrenUpdate[] updates) {
- for (IHasChildrenUpdate update : updates) {
- ILaunch launch = findLaunch(update.getElementPath());
- if (launch == null) {
- assert false;
- update.setHasChilren(false);
- update.done();
- return;
- }
-
- boolean hasChildren = false;
- for (IProcess process : launch.getProcesses()) {
- if (!(process instanceof InferiorRuntimeProcess)) {
- hasChildren = true;
- break;
- }
- }
-
- update.setHasChilren(hasChildren);
- update.done();
- }
- }
+ @Override
+ public int getDeltaFlags(Object e) {
+ int myFlags = 0;
+ if (e instanceof DebugEvent) {
+ DebugEvent de = (DebugEvent) e;
+ if (!(de.getSource() instanceof InferiorRuntimeProcess) && (de.getKind() == DebugEvent.CHANGE
+ || de.getKind() == DebugEvent.CREATE || de.getKind() == DebugEvent.TERMINATE)) {
+ myFlags = IModelDelta.STATE;
+ }
+ }
+ return myFlags;
+ }
- /**
- * Recursively searches the VMC for Launch VMC, and returns its ILaunch.
- * Returns null if an ILaunch is not found.
- */
- private ILaunch findLaunch(TreePath path) {
- for (int i = path.getSegmentCount() - 1; i >= 0; i--) {
- if (path.getSegment(i) instanceof ILaunch) {
- return (ILaunch)path.getSegment(i);
- }
- }
- return null;
- }
-
- @Override
- public int getDeltaFlags(Object e) {
- int myFlags = 0;
- if (e instanceof DebugEvent) {
- DebugEvent de = (DebugEvent)e;
- if (!(de.getSource() instanceof InferiorRuntimeProcess) &&
- (de.getKind() == DebugEvent.CHANGE ||
- de.getKind() == DebugEvent.CREATE ||
- de.getKind() == DebugEvent.TERMINATE) )
- {
- myFlags = IModelDelta.STATE;
- }
- }
- return myFlags;
- }
-
- @Override
- public void buildDelta(Object e, VMDelta parent, int nodeOffset, RequestMonitor requestMonitor) {
- if (e instanceof DebugEvent && !(((DebugEvent)e).getSource() instanceof InferiorRuntimeProcess)) {
- DebugEvent de = (DebugEvent)e;
- if (de.getKind() == DebugEvent.CHANGE) {
- handleChange(de, parent);
- } else if (de.getKind() == DebugEvent.CREATE) {
- handleCreate(de, parent);
- } else if (de.getKind() == DebugEvent.TERMINATE) {
- handleTerminate(de, parent);
- }
- /*
- * No other node should need to process events related to process.
- * Therefore, just invoke the request monitor without calling super.buildDelta().
- */
- }
- requestMonitor.done();
- }
+ @Override
+ public void buildDelta(Object e, VMDelta parent, int nodeOffset, RequestMonitor requestMonitor) {
+ if (e instanceof DebugEvent && !(((DebugEvent) e).getSource() instanceof InferiorRuntimeProcess)) {
+ DebugEvent de = (DebugEvent) e;
+ if (de.getKind() == DebugEvent.CHANGE) {
+ handleChange(de, parent);
+ } else if (de.getKind() == DebugEvent.CREATE) {
+ handleCreate(de, parent);
+ } else if (de.getKind() == DebugEvent.TERMINATE) {
+ handleTerminate(de, parent);
+ }
+ /*
+ * No other node should need to process events related to process.
+ * Therefore, just invoke the request monitor without calling super.buildDelta().
+ */
+ }
+ requestMonitor.done();
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/IGdbLaunchVMConstants.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/IGdbLaunchVMConstants.java
index 20c24899464..aed4253d780 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/IGdbLaunchVMConstants.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/IGdbLaunchVMConstants.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* Patrick Chuong (Texas Instruments) - Add support for icon overlay in the debug view (Bug 334566)
@@ -20,44 +20,44 @@ package org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.launch;
*/
public interface IGdbLaunchVMConstants {
- public static final String PROP_OS_ID = "os_id"; //$NON-NLS-1$
-
- /**
- * Value <code>0</code> means it's not known. Value <code>1</code>, means it's known.
- */
- public static final String PROP_OS_ID_KNOWN = "os_id_known"; //$NON-NLS-1$
-
- public static final String PROP_CORES_ID = "cores_id"; //$NON-NLS-1$
-
- /**
- * Value <code>0</code> means it's not known. Value <code>1</code>, means it's known.
- */
- public static final String PROP_CORES_ID_KNOWN = "cores_id_known"; //$NON-NLS-1$
-
- /**
- * The context is pinned. Value <code>true</code> or <code>false</code>.
- */
- public static final String PROP_PINNED_CONTEXT = "pinned_context"; //$NON-NLS-1$
-
- /**
- * The pin color. One of the <code>IPinElementColorDescriptor</code> color value.
- */
- public static final String PROP_PIN_COLOR = "pin_color"; //$NON-NLS-1$
-
- public static final String PROP_THREAD_SUMMARY_KNOWN = "thread_summary_known"; //$NON-NLS-1$
- public static final String PROP_THREAD_SUMMARY = "thread_summary"; //$NON-NLS-1$
-
- /**
- * If this property is set, it indicates the process or thread should be shown as exited.
- */
- public static final String PROP_THREAD_EXITED = "thread_exited"; //$NON-NLS-1$
-
- /**
- * Value <code>0</code> means it's not known. Value <code>1</code>, means it's known.
- */
- public static final String PROP_EXIT_CODE_KNOWN = "exit_code_known"; //$NON-NLS-1$
- /**
- * If set, the value of the property indicates the exit code returned.
- */
- public static final String PROP_EXIT_CODE = "exit_code"; //$NON-NLS-1$
+ public static final String PROP_OS_ID = "os_id"; //$NON-NLS-1$
+
+ /**
+ * Value <code>0</code> means it's not known. Value <code>1</code>, means it's known.
+ */
+ public static final String PROP_OS_ID_KNOWN = "os_id_known"; //$NON-NLS-1$
+
+ public static final String PROP_CORES_ID = "cores_id"; //$NON-NLS-1$
+
+ /**
+ * Value <code>0</code> means it's not known. Value <code>1</code>, means it's known.
+ */
+ public static final String PROP_CORES_ID_KNOWN = "cores_id_known"; //$NON-NLS-1$
+
+ /**
+ * The context is pinned. Value <code>true</code> or <code>false</code>.
+ */
+ public static final String PROP_PINNED_CONTEXT = "pinned_context"; //$NON-NLS-1$
+
+ /**
+ * The pin color. One of the <code>IPinElementColorDescriptor</code> color value.
+ */
+ public static final String PROP_PIN_COLOR = "pin_color"; //$NON-NLS-1$
+
+ public static final String PROP_THREAD_SUMMARY_KNOWN = "thread_summary_known"; //$NON-NLS-1$
+ public static final String PROP_THREAD_SUMMARY = "thread_summary"; //$NON-NLS-1$
+
+ /**
+ * If this property is set, it indicates the process or thread should be shown as exited.
+ */
+ public static final String PROP_THREAD_EXITED = "thread_exited"; //$NON-NLS-1$
+
+ /**
+ * Value <code>0</code> means it's not known. Value <code>1</code>, means it's known.
+ */
+ public static final String PROP_EXIT_CODE_KNOWN = "exit_code_known"; //$NON-NLS-1$
+ /**
+ * If set, the value of the property indicates the exit code returned.
+ */
+ public static final String PROP_EXIT_CODE = "exit_code"; //$NON-NLS-1$
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/LaunchVMModelProxyStrategy.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/LaunchVMModelProxyStrategy.java
index 04e27364868..45a1bbb4bf5 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/LaunchVMModelProxyStrategy.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/LaunchVMModelProxyStrategy.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -19,24 +19,24 @@ import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.jface.viewers.TreePath;
/**
- *
+ *
*/
public class LaunchVMModelProxyStrategy extends DefaultVMModelProxyStrategy {
- final private TreePath fRootPath;
-
- public LaunchVMModelProxyStrategy(AbstractVMProvider provider, Object rootElement) {
- super(provider, rootElement);
- fRootPath = new TreePath( new Object[] { rootElement });
- }
-
- @Override
- public Object getViewerInput() {
- return DebugPlugin.getDefault().getLaunchManager();
- }
-
- @Override
- public TreePath getRootPath() {
- return fRootPath;
- }
+ final private TreePath fRootPath;
+
+ public LaunchVMModelProxyStrategy(AbstractVMProvider provider, Object rootElement) {
+ super(provider, rootElement);
+ fRootPath = new TreePath(new Object[] { rootElement });
+ }
+
+ @Override
+ public Object getViewerInput() {
+ return DebugPlugin.getDefault().getLaunchManager();
+ }
+
+ @Override
+ public TreePath getRootPath() {
+ return fRootPath;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/LaunchVMProvider.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/LaunchVMProvider.java
index b49887e1078..18440f8f97d 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/LaunchVMProvider.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/LaunchVMProvider.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* Ericsson - Modified for new functionality
@@ -42,135 +42,123 @@ import org.eclipse.debug.core.IDebugEventSetListener;
import org.eclipse.debug.core.ILaunchesListener2;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
-
/**
- *
+ *
*/
-public class LaunchVMProvider extends AbstractLaunchVMProvider
- implements IDebugEventSetListener, ILaunchesListener2
-{
-
+public class LaunchVMProvider extends AbstractLaunchVMProvider implements IDebugEventSetListener, ILaunchesListener2 {
+
/**
* Indicates that we are currently visualizing trace data.
*/
private boolean fTracepointVisualizationModeEnabled;
-
+
@ThreadSafe
- public LaunchVMProvider(AbstractVMAdapter adapter, IPresentationContext presentationContext, DsfSession session)
- {
- super(adapter, presentationContext, session);
-
- createNodes();
- }
+ public LaunchVMProvider(AbstractVMAdapter adapter, IPresentationContext presentationContext, DsfSession session) {
+ super(adapter, presentationContext, session);
+
+ createNodes();
+ }
protected void createNodes() {
- IRootVMNode launchNode = new LaunchRootVMNode(this);
- setRootNode(launchNode);
-
- // Container node to contain all processes and threads
- IVMNode containerNode = new ContainerVMNode(this, getSession());
- IVMNode processesNode = new GdbStandardProcessVMNode(this);
- addChildNodes(launchNode, new IVMNode[] { containerNode, processesNode});
-
- IVMNode threadsNode = new ThreadVMNode(this, getSession());
- addChildNodes(containerNode, new IVMNode[] { threadsNode });
-
- IVMNode stackFramesNode = new GdbStackFramesVMNode(this, getSession());
- addChildNodes(threadsNode, new IVMNode[] { stackFramesNode });
- }
-
- @Override
- protected boolean canSkipHandlingEvent(Object newEvent, Object eventToSkip) {
- // Never skip the process lifecycle events.
- if (eventToSkip instanceof ICommandControlInitializedDMEvent ||
- eventToSkip instanceof ICommandControlShutdownDMEvent)
- {
- return false;
- }
-
- if (eventToSkip instanceof ITracingStartedDMEvent ||
- eventToSkip instanceof ITracingStoppedDMEvent)
- {
- if (newEvent instanceof ITracingStartedDMEvent ||
- newEvent instanceof ITracingStoppedDMEvent)
- {
- return true;
- }
- }
-
- if (eventToSkip instanceof ITracingSupportedChangeDMEvent)
- {
- if (newEvent instanceof ITracingSupportedChangeDMEvent)
- {
- return true;
- }
- }
-
- if (eventToSkip instanceof ITraceRecordSelectedChangedDMEvent) {
- ITraceRecordSelectedChangedDMEvent recordChanged = (ITraceRecordSelectedChangedDMEvent)eventToSkip;
- if (recordChanged.isVisualizationModeEnabled() == fTracepointVisualizationModeEnabled) {
- // We only care about this event if it indicates a change of visualization state
- return true;
- }
- }
-
- return super.canSkipHandlingEvent(newEvent, eventToSkip);
- }
-
- @Override
- public void handleEvent(Object event, RequestMonitor rm) {
- if (event instanceof ITracingStartedDMEvent ||
- event instanceof ITracingStoppedDMEvent ||
- event instanceof ITracingSupportedChangeDMEvent)
- {
- // Refresh the view to trigger a context change, which
- // will cause command enablement to be refreshed
- refresh();
- rm.done();
- return;
- }
-
- if (event instanceof ITraceRecordSelectedChangedDMEvent) {
- ITraceRecordSelectedChangedDMEvent recordChanged = (ITraceRecordSelectedChangedDMEvent)event;
- // If trace visualization has changed we have to refresh the debug view
- if (recordChanged.isVisualizationModeEnabled() != fTracepointVisualizationModeEnabled) {
- fTracepointVisualizationModeEnabled = recordChanged.isVisualizationModeEnabled();
-
- // Refresh the view because the set of threads has totally changed.
- refresh();
- rm.done();
- return;
- }
- }
-
- super.handleEvent(event, rm);
- }
-
- @Override
- public void refresh() {
- super.refresh();
- try {
- getSession().getExecutor().execute(new DsfRunnable() {
- @Override
- public void run() {
- DsfServicesTracker tracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), getSession().getId());
- IProcesses processesService = tracker.getService(IProcesses.class);
- if (processesService instanceof ICachingService) {
- ((ICachingService)processesService).flushCache(null);
- }
- IStack stackService = tracker.getService(IStack.class);
- if (stackService instanceof ICachingService) {
- ((ICachingService)stackService).flushCache(null);
- }
- IRunControl runControlService = tracker.getService(IRunControl.class);
- if (runControlService instanceof ICachingService) {
- ((ICachingService)runControlService).flushCache(null);
- }
- tracker.dispose();
- }
- });
- } catch (RejectedExecutionException e) {
- // Session disposed, ignore.
- }
- }
+ IRootVMNode launchNode = new LaunchRootVMNode(this);
+ setRootNode(launchNode);
+
+ // Container node to contain all processes and threads
+ IVMNode containerNode = new ContainerVMNode(this, getSession());
+ IVMNode processesNode = new GdbStandardProcessVMNode(this);
+ addChildNodes(launchNode, new IVMNode[] { containerNode, processesNode });
+
+ IVMNode threadsNode = new ThreadVMNode(this, getSession());
+ addChildNodes(containerNode, new IVMNode[] { threadsNode });
+
+ IVMNode stackFramesNode = new GdbStackFramesVMNode(this, getSession());
+ addChildNodes(threadsNode, new IVMNode[] { stackFramesNode });
+ }
+
+ @Override
+ protected boolean canSkipHandlingEvent(Object newEvent, Object eventToSkip) {
+ // Never skip the process lifecycle events.
+ if (eventToSkip instanceof ICommandControlInitializedDMEvent
+ || eventToSkip instanceof ICommandControlShutdownDMEvent) {
+ return false;
+ }
+
+ if (eventToSkip instanceof ITracingStartedDMEvent || eventToSkip instanceof ITracingStoppedDMEvent) {
+ if (newEvent instanceof ITracingStartedDMEvent || newEvent instanceof ITracingStoppedDMEvent) {
+ return true;
+ }
+ }
+
+ if (eventToSkip instanceof ITracingSupportedChangeDMEvent) {
+ if (newEvent instanceof ITracingSupportedChangeDMEvent) {
+ return true;
+ }
+ }
+
+ if (eventToSkip instanceof ITraceRecordSelectedChangedDMEvent) {
+ ITraceRecordSelectedChangedDMEvent recordChanged = (ITraceRecordSelectedChangedDMEvent) eventToSkip;
+ if (recordChanged.isVisualizationModeEnabled() == fTracepointVisualizationModeEnabled) {
+ // We only care about this event if it indicates a change of visualization state
+ return true;
+ }
+ }
+
+ return super.canSkipHandlingEvent(newEvent, eventToSkip);
+ }
+
+ @Override
+ public void handleEvent(Object event, RequestMonitor rm) {
+ if (event instanceof ITracingStartedDMEvent || event instanceof ITracingStoppedDMEvent
+ || event instanceof ITracingSupportedChangeDMEvent) {
+ // Refresh the view to trigger a context change, which
+ // will cause command enablement to be refreshed
+ refresh();
+ rm.done();
+ return;
+ }
+
+ if (event instanceof ITraceRecordSelectedChangedDMEvent) {
+ ITraceRecordSelectedChangedDMEvent recordChanged = (ITraceRecordSelectedChangedDMEvent) event;
+ // If trace visualization has changed we have to refresh the debug view
+ if (recordChanged.isVisualizationModeEnabled() != fTracepointVisualizationModeEnabled) {
+ fTracepointVisualizationModeEnabled = recordChanged.isVisualizationModeEnabled();
+
+ // Refresh the view because the set of threads has totally changed.
+ refresh();
+ rm.done();
+ return;
+ }
+ }
+
+ super.handleEvent(event, rm);
+ }
+
+ @Override
+ public void refresh() {
+ super.refresh();
+ try {
+ getSession().getExecutor().execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ DsfServicesTracker tracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(),
+ getSession().getId());
+ IProcesses processesService = tracker.getService(IProcesses.class);
+ if (processesService instanceof ICachingService) {
+ ((ICachingService) processesService).flushCache(null);
+ }
+ IStack stackService = tracker.getService(IStack.class);
+ if (stackService instanceof ICachingService) {
+ ((ICachingService) stackService).flushCache(null);
+ }
+ IRunControl runControlService = tracker.getService(IRunControl.class);
+ if (runControlService instanceof ICachingService) {
+ ((ICachingService) runControlService).flushCache(null);
+ }
+ tracker.dispose();
+ }
+ });
+ } catch (RejectedExecutionException e) {
+ // Session disposed, ignore.
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/MessagesForGdbLaunchVM.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/MessagesForGdbLaunchVM.java
index 2354e322d0d..7177ad6b367 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/MessagesForGdbLaunchVM.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/MessagesForGdbLaunchVM.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* Marc Khouzam (Ericsson) - Support for exited processes in the debug view (bug 407340)
@@ -21,19 +21,19 @@ import org.eclipse.osgi.util.NLS;
* @noinstantiate This class is not intended to be instantiated by clients.
*/
public class MessagesForGdbLaunchVM extends NLS {
- public static String ThreadVMNode_No_columns__text_format;
- public static String ThreadVMNode_No_columns__Error__label;
- public static String ContainerVMNode_No_columns__text_format;
- public static String ContainerVMNode_No_columns__exited_format;
- public static String ContainerVMNode_No_columns__Error__label;
- /** since 2.3 */
- public static String ContainerVMNode_filtered_running_threads;
-
- static {
- // initialize resource bundle
- NLS.initializeMessages(MessagesForGdbLaunchVM.class.getName(), MessagesForGdbLaunchVM.class);
- }
+ public static String ThreadVMNode_No_columns__text_format;
+ public static String ThreadVMNode_No_columns__Error__label;
+ public static String ContainerVMNode_No_columns__text_format;
+ public static String ContainerVMNode_No_columns__exited_format;
+ public static String ContainerVMNode_No_columns__Error__label;
+ /** since 2.3 */
+ public static String ContainerVMNode_filtered_running_threads;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(MessagesForGdbLaunchVM.class.getName(), MessagesForGdbLaunchVM.class);
+ }
- private MessagesForGdbLaunchVM() {
- }
+ private MessagesForGdbLaunchVM() {
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/ThreadVMNode.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/ThreadVMNode.java
index 1acf6ac7333..5d904de1fb3 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/ThreadVMNode.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/ThreadVMNode.java
@@ -7,10 +7,10 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
- * Ericsson - Modified for multi threaded functionality
+ * Ericsson - Modified for multi threaded functionality
* Patrick Chuong (Texas Instruments) - Add support for icon overlay in the debug view (Bug 334566)
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.launch;
@@ -72,202 +72,213 @@ import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.ui.IMemento;
-
-public class ThreadVMNode extends AbstractThreadVMNode
- implements IElementLabelProvider, IElementMementoProvider
-{
+public class ThreadVMNode extends AbstractThreadVMNode implements IElementLabelProvider, IElementMementoProvider {
/** Indicator that we should not display running threads */
private boolean fHideRunningThreadsProperty = false;
-
+
/** PropertyChangeListener to keep track of the PREF_HIDE_RUNNING_THREADS preference */
private IPropertyChangeListener fPropertyChangeListener = new IPropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent event) {
if (event.getProperty().equals(IGdbDebugPreferenceConstants.PREF_HIDE_RUNNING_THREADS)) {
- fHideRunningThreadsProperty = (Boolean)event.getNewValue();
+ fHideRunningThreadsProperty = (Boolean) event.getNewValue();
// Refresh the debug view to take in consideration this change
getDMVMProvider().refresh();
}
}
};
-
- public ThreadVMNode(AbstractDMVMProvider provider, DsfSession session) {
- super(provider, session);
-
+
+ public ThreadVMNode(AbstractDMVMProvider provider, DsfSession session) {
+ super(provider, session);
+
IPreferenceStore store = GdbUIPlugin.getDefault().getPreferenceStore();
store.addPropertyChangeListener(fPropertyChangeListener);
fHideRunningThreadsProperty = store.getBoolean(IGdbDebugPreferenceConstants.PREF_HIDE_RUNNING_THREADS);
- }
+ }
- @Override
- public void dispose() {
+ @Override
+ public void dispose() {
GdbUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(fPropertyChangeListener);
- super.dispose();
- }
- @Override
- public String toString() {
- return "ThreadVMNode(" + getSession().getId() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- @Override
- protected IElementLabelProvider createLabelProvider() {
- PropertiesBasedLabelProvider provider = new PropertiesBasedLabelProvider();
-
- provider.setColumnInfo(
- PropertiesBasedLabelProvider.ID_COLUMN_NO_COLUMNS,
- new LabelColumnInfo(new LabelAttribute[] {
- // Text is made of the thread name followed by its state and state change reason.
- new GdbExecutionContextLabelText(
- MessagesForGdbLaunchVM.ThreadVMNode_No_columns__text_format,
- new String[] {
- ExecutionContextLabelText.PROP_NAME_KNOWN,
- PROP_NAME,
- ExecutionContextLabelText.PROP_ID_KNOWN,
- ILaunchVMConstants.PROP_ID,
- IGdbLaunchVMConstants.PROP_OS_ID_KNOWN,
- IGdbLaunchVMConstants.PROP_OS_ID,
- IGdbLaunchVMConstants.PROP_CORES_ID_KNOWN,
- IGdbLaunchVMConstants.PROP_CORES_ID,
- ILaunchVMConstants.PROP_IS_SUSPENDED,
- ExecutionContextLabelText.PROP_STATE_CHANGE_REASON_KNOWN,
- ILaunchVMConstants.PROP_STATE_CHANGE_REASON,
- ExecutionContextLabelText.PROP_STATE_CHANGE_DETAILS_KNOWN,
- ILaunchVMConstants.PROP_STATE_CHANGE_DETAILS}),
- new LabelText(MessagesForGdbLaunchVM.ThreadVMNode_No_columns__Error__label, new String[0]),
- /* RUNNING THREAD - RED PIN */
- new LabelImage(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_THREAD_RUNNING_R_PINNED)) {
- { setPropertyNames(new String[] {
- ILaunchVMConstants.PROP_IS_SUSPENDED,
- IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
- IGdbLaunchVMConstants.PROP_PIN_COLOR }); }
+ super.dispose();
+ }
- @Override
- public boolean isEnabled(IStatus status, Map<String, Object> properties) {
- Boolean prop = (Boolean) properties.get(ILaunchVMConstants.PROP_IS_SUSPENDED);
- Boolean pin_prop = (Boolean) properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
- Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
- return (prop != null && pin_prop != null && pin_color_prop != null) ?
- !prop.booleanValue() && pin_prop.booleanValue() && pin_color_prop.equals(IPinElementColorDescriptor.RED) : false;
- };
- },
- /* RUNNING THREAD - GREEN PIN */
- new LabelImage(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_THREAD_RUNNING_G_PINNED)) {
- { setPropertyNames(new String[] {
- ILaunchVMConstants.PROP_IS_SUSPENDED,
- IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
- IGdbLaunchVMConstants.PROP_PIN_COLOR }); }
+ @Override
+ public String toString() {
+ return "ThreadVMNode(" + getSession().getId() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
- @Override
- public boolean isEnabled(IStatus status, Map<String, Object> properties) {
- Boolean prop = (Boolean) properties.get(ILaunchVMConstants.PROP_IS_SUSPENDED);
- Boolean pin_prop = (Boolean) properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
- Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
- return (prop != null && pin_prop != null && pin_color_prop != null) ?
- !prop.booleanValue() && pin_prop.booleanValue() && pin_color_prop.equals(IPinElementColorDescriptor.GREEN) : false;
- };
- },
- /* RUNNING THREAD - BLUE PIN */
- new LabelImage(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_THREAD_RUNNING_B_PINNED)) {
- { setPropertyNames(new String[] {
- ILaunchVMConstants.PROP_IS_SUSPENDED,
- IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
- IGdbLaunchVMConstants.PROP_PIN_COLOR }); }
+ @Override
+ protected IElementLabelProvider createLabelProvider() {
+ PropertiesBasedLabelProvider provider = new PropertiesBasedLabelProvider();
- @Override
- public boolean isEnabled(IStatus status, Map<String, Object> properties) {
- Boolean prop = (Boolean) properties.get(ILaunchVMConstants.PROP_IS_SUSPENDED);
- Boolean pin_prop = (Boolean) properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
- Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
- return (prop != null && pin_prop != null && pin_color_prop != null) ?
- !prop.booleanValue() && pin_prop.booleanValue() && pin_color_prop.equals(IPinElementColorDescriptor.BLUE) : false;
- };
- },
- /* RUNNING THREAD - NO PIN */
- new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_THREAD_RUNNING)) {
- { setPropertyNames(new String[] { ILaunchVMConstants.PROP_IS_SUSPENDED }); }
-
- @Override
- public boolean isEnabled(IStatus status, java.util.Map<String,Object> properties) {
- // prop has been seen to be null during session shutdown [313823]
- Boolean prop = (Boolean)properties.get(ILaunchVMConstants.PROP_IS_SUSPENDED);
- return (prop != null) ? !prop.booleanValue() : false;
- };
- },
- /* SUSPENDED THREAD - RED PIN */
- new LabelImage(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_THREAD_SUSPENDED_R_PINNED)) {
- { setPropertyNames(new String[] {
- IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
- IGdbLaunchVMConstants.PROP_PIN_COLOR }); }
-
- @Override
- public boolean isEnabled(IStatus status, Map<String, Object> properties) {
- Boolean pin_prop = (Boolean)properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
- Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
- return (pin_prop != null && pin_color_prop != null) ?
- pin_prop.booleanValue() && pin_color_prop.equals(IPinElementColorDescriptor.RED) : false;
- };
- },
- /* SUSPENDED THREAD - GREEN PIN */
- new LabelImage(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_THREAD_SUSPENDED_G_PINNED)) {
- { setPropertyNames(new String[] {
- IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
- IGdbLaunchVMConstants.PROP_PIN_COLOR }); }
-
- @Override
- public boolean isEnabled(IStatus status, Map<String, Object> properties) {
- Boolean pin_prop = (Boolean)properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
- Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
- return (pin_prop != null && pin_color_prop != null) ?
- pin_prop.booleanValue() && pin_color_prop.equals(IPinElementColorDescriptor.GREEN) : false;
- };
- },
- /* SUSPENDED THREAD - BLUE PIN */
- new LabelImage(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_THREAD_SUSPENDED_B_PINNED)) {
- { setPropertyNames(new String[] {
- IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
- IGdbLaunchVMConstants.PROP_PIN_COLOR }); }
-
- @Override
- public boolean isEnabled(IStatus status, Map<String, Object> properties) {
- Boolean pin_prop = (Boolean)properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
- Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
- return (pin_prop != null && pin_color_prop != null) ?
- pin_prop.booleanValue() && pin_color_prop.equals(IPinElementColorDescriptor.BLUE) : false;
- };
- },
- /* SUSPENDED THREAD - NO PIN */
- new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_THREAD_SUSPENDED)),
- }));
- return provider;
- }
+ provider.setColumnInfo(PropertiesBasedLabelProvider.ID_COLUMN_NO_COLUMNS,
+ new LabelColumnInfo(new LabelAttribute[] {
+ // Text is made of the thread name followed by its state and state change reason.
+ new GdbExecutionContextLabelText(MessagesForGdbLaunchVM.ThreadVMNode_No_columns__text_format,
+ new String[] { ExecutionContextLabelText.PROP_NAME_KNOWN, PROP_NAME,
+ ExecutionContextLabelText.PROP_ID_KNOWN, ILaunchVMConstants.PROP_ID,
+ IGdbLaunchVMConstants.PROP_OS_ID_KNOWN, IGdbLaunchVMConstants.PROP_OS_ID,
+ IGdbLaunchVMConstants.PROP_CORES_ID_KNOWN, IGdbLaunchVMConstants.PROP_CORES_ID,
+ ILaunchVMConstants.PROP_IS_SUSPENDED,
+ ExecutionContextLabelText.PROP_STATE_CHANGE_REASON_KNOWN,
+ ILaunchVMConstants.PROP_STATE_CHANGE_REASON,
+ ExecutionContextLabelText.PROP_STATE_CHANGE_DETAILS_KNOWN,
+ ILaunchVMConstants.PROP_STATE_CHANGE_DETAILS }),
+ new LabelText(MessagesForGdbLaunchVM.ThreadVMNode_No_columns__Error__label, new String[0]),
+ /* RUNNING THREAD - RED PIN */
+ new LabelImage(
+ CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_THREAD_RUNNING_R_PINNED)) {
+ {
+ setPropertyNames(new String[] { ILaunchVMConstants.PROP_IS_SUSPENDED,
+ IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
+ IGdbLaunchVMConstants.PROP_PIN_COLOR });
+ }
+
+ @Override
+ public boolean isEnabled(IStatus status, Map<String, Object> properties) {
+ Boolean prop = (Boolean) properties.get(ILaunchVMConstants.PROP_IS_SUSPENDED);
+ Boolean pin_prop = (Boolean) properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
+ Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
+ return (prop != null && pin_prop != null && pin_color_prop != null)
+ ? !prop.booleanValue() && pin_prop.booleanValue()
+ && pin_color_prop.equals(IPinElementColorDescriptor.RED)
+ : false;
+ };
+ },
+ /* RUNNING THREAD - GREEN PIN */
+ new LabelImage(
+ CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_THREAD_RUNNING_G_PINNED)) {
+ {
+ setPropertyNames(new String[] { ILaunchVMConstants.PROP_IS_SUSPENDED,
+ IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
+ IGdbLaunchVMConstants.PROP_PIN_COLOR });
+ }
+
+ @Override
+ public boolean isEnabled(IStatus status, Map<String, Object> properties) {
+ Boolean prop = (Boolean) properties.get(ILaunchVMConstants.PROP_IS_SUSPENDED);
+ Boolean pin_prop = (Boolean) properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
+ Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
+ return (prop != null && pin_prop != null && pin_color_prop != null)
+ ? !prop.booleanValue() && pin_prop.booleanValue()
+ && pin_color_prop.equals(IPinElementColorDescriptor.GREEN)
+ : false;
+ };
+ },
+ /* RUNNING THREAD - BLUE PIN */
+ new LabelImage(
+ CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_THREAD_RUNNING_B_PINNED)) {
+ {
+ setPropertyNames(new String[] { ILaunchVMConstants.PROP_IS_SUSPENDED,
+ IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
+ IGdbLaunchVMConstants.PROP_PIN_COLOR });
+ }
+
+ @Override
+ public boolean isEnabled(IStatus status, Map<String, Object> properties) {
+ Boolean prop = (Boolean) properties.get(ILaunchVMConstants.PROP_IS_SUSPENDED);
+ Boolean pin_prop = (Boolean) properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
+ Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
+ return (prop != null && pin_prop != null && pin_color_prop != null)
+ ? !prop.booleanValue() && pin_prop.booleanValue()
+ && pin_color_prop.equals(IPinElementColorDescriptor.BLUE)
+ : false;
+ };
+ },
+ /* RUNNING THREAD - NO PIN */
+ new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_THREAD_RUNNING)) {
+ {
+ setPropertyNames(new String[] { ILaunchVMConstants.PROP_IS_SUSPENDED });
+ }
+
+ @Override
+ public boolean isEnabled(IStatus status, java.util.Map<String, Object> properties) {
+ // prop has been seen to be null during session shutdown [313823]
+ Boolean prop = (Boolean) properties.get(ILaunchVMConstants.PROP_IS_SUSPENDED);
+ return (prop != null) ? !prop.booleanValue() : false;
+ };
+ },
+ /* SUSPENDED THREAD - RED PIN */
+ new LabelImage(
+ CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_THREAD_SUSPENDED_R_PINNED)) {
+ {
+ setPropertyNames(new String[] { IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
+ IGdbLaunchVMConstants.PROP_PIN_COLOR });
+ }
+
+ @Override
+ public boolean isEnabled(IStatus status, Map<String, Object> properties) {
+ Boolean pin_prop = (Boolean) properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
+ Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
+ return (pin_prop != null && pin_color_prop != null) ? pin_prop.booleanValue()
+ && pin_color_prop.equals(IPinElementColorDescriptor.RED) : false;
+ };
+ },
+ /* SUSPENDED THREAD - GREEN PIN */
+ new LabelImage(
+ CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_THREAD_SUSPENDED_G_PINNED)) {
+ {
+ setPropertyNames(new String[] { IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
+ IGdbLaunchVMConstants.PROP_PIN_COLOR });
+ }
+
+ @Override
+ public boolean isEnabled(IStatus status, Map<String, Object> properties) {
+ Boolean pin_prop = (Boolean) properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
+ Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
+ return (pin_prop != null && pin_color_prop != null) ? pin_prop.booleanValue()
+ && pin_color_prop.equals(IPinElementColorDescriptor.GREEN) : false;
+ };
+ },
+ /* SUSPENDED THREAD - BLUE PIN */
+ new LabelImage(
+ CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_THREAD_SUSPENDED_B_PINNED)) {
+ {
+ setPropertyNames(new String[] { IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
+ IGdbLaunchVMConstants.PROP_PIN_COLOR });
+ }
+
+ @Override
+ public boolean isEnabled(IStatus status, Map<String, Object> properties) {
+ Boolean pin_prop = (Boolean) properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
+ Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
+ return (pin_prop != null && pin_color_prop != null) ? pin_prop.booleanValue()
+ && pin_color_prop.equals(IPinElementColorDescriptor.BLUE) : false;
+ };
+ },
+ /* SUSPENDED THREAD - NO PIN */
+ new LabelImage(
+ DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_THREAD_SUSPENDED)), }));
+ return provider;
+ }
@Override
- protected void updateElementsInSessionThread(final IChildrenUpdate update) {
- IProcesses procService = getServicesTracker().getService(IProcesses.class);
- final IContainerDMContext contDmc = findDmcInPath(update.getViewerInput(), update.getElementPath(), IContainerDMContext.class);
- if (procService == null || contDmc == null) {
- handleFailedUpdate(update);
- return;
- }
-
- procService.getProcessesBeingDebugged(
- contDmc,
- new ViewerDataRequestMonitor<IDMContext[]>(getSession().getExecutor(), update){
+ protected void updateElementsInSessionThread(final IChildrenUpdate update) {
+ IProcesses procService = getServicesTracker().getService(IProcesses.class);
+ final IContainerDMContext contDmc = findDmcInPath(update.getViewerInput(), update.getElementPath(),
+ IContainerDMContext.class);
+ if (procService == null || contDmc == null) {
+ handleFailedUpdate(update);
+ return;
+ }
+
+ procService.getProcessesBeingDebugged(contDmc,
+ new ViewerDataRequestMonitor<IDMContext[]>(getSession().getExecutor(), update) {
@Override
public void handleCompleted() {
if (!isSuccess() || !(getData() instanceof IExecutionDMContext[])) {
handleFailedUpdate(update);
return;
}
-
- IExecutionDMContext[] execDmcs = (IExecutionDMContext[])getData();
+
+ IExecutionDMContext[] execDmcs = (IExecutionDMContext[]) getData();
if (fHideRunningThreadsProperty) {
// Remove running threads from the list
- IRunControl runControl = getServicesTracker().getService(IRunControl.class);
- if (runControl == null) {
- handleFailedUpdate(update);
- return;
- }
+ IRunControl runControl = getServicesTracker().getService(IRunControl.class);
+ if (runControl == null) {
+ handleFailedUpdate(update);
+ return;
+ }
List<IExecutionDMContext> execDmcsNotRunning = new ArrayList<IExecutionDMContext>();
for (IExecutionDMContext execDmc : execDmcs) {
@@ -278,156 +289,154 @@ public class ThreadVMNode extends AbstractThreadVMNode
}
execDmcs = execDmcsNotRunning.toArray(new IExecutionDMContext[execDmcsNotRunning.size()]);
}
-
+
fillUpdateWithVMCs(update, execDmcs);
update.done();
}
});
- }
-
- @Override
- protected void updatePropertiesInSessionThread(IPropertiesUpdate[] updates) {
- IPropertiesUpdate[] parentUpdates = new IPropertiesUpdate[updates.length];
-
- for (int i = 0; i < updates.length; i++) {
- final IPropertiesUpdate update = updates[i];
-
- final ViewerCountingRequestMonitor countringRm =
- new ViewerCountingRequestMonitor(ImmediateExecutor.getInstance(), updates[i]);
- int count = 0;
-
- // Create a delegating update which will let the super-class fill in the
- // standard container properties.
- parentUpdates[i] = new VMDelegatingPropertiesUpdate(updates[i], countringRm);
- count++;
-
- IMIExecutionDMContext execDmc = findDmcInPath(
- update.getViewerInput(), update.getElementPath(), IMIExecutionDMContext.class);
- if (execDmc != null) {
- update.setProperty(ILaunchVMConstants.PROP_ID, execDmc.getThreadId());
-
- // set pin properties
- IPinElementColorDescriptor colorDesc = PinCloneUtils.getPinElementColorDescriptor(GdbPinProvider.getPinnedHandles(), execDmc);
- updates[i].setProperty(IGdbLaunchVMConstants.PROP_PIN_COLOR,
- colorDesc != null ? colorDesc.getOverlayColor() : null);
- updates[i].setProperty(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
- PinCloneUtils.isPinnedTo(GdbPinProvider.getPinnedHandles(), execDmc));
- }
-
- if (update.getProperties().contains(PROP_NAME) ||
- update.getProperties().contains(IGdbLaunchVMConstants.PROP_OS_ID) ||
- update.getProperties().contains(IGdbLaunchVMConstants.PROP_CORES_ID))
- {
- IProcesses processService = getServicesTracker().getService(IProcesses.class);
- final IThreadDMContext threadDmc = findDmcInPath(update.getViewerInput(), update.getElementPath(), IThreadDMContext.class);
-
- if (processService == null || threadDmc == null) {
- update.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, "Service or handle invalid", null)); //$NON-NLS-1$
- } else {
- processService.getExecutionData(
- threadDmc,
- new ViewerDataRequestMonitor<IThreadDMData>(getExecutor(), update) {
- @Override
- public void handleCompleted() {
- if (isSuccess()) {
- fillThreadDataProperties(update, getData());
- }
- update.setStatus(getStatus());
- countringRm.done();
- }
- });
- count++;
- }
- }
-
- countringRm.setDoneCount(count);
- }
- super.updatePropertiesInSessionThread(parentUpdates);
- }
-
- protected void fillThreadDataProperties(IPropertiesUpdate update, IThreadDMData data) {
- if (data.getName() != null && data.getName().length() > 0) {
- update.setProperty(PROP_NAME, data.getName());
- }
- update.setProperty(IGdbLaunchVMConstants.PROP_OS_ID, data.getId());
-
- if (data instanceof IGdbThreadDMData) {
- String[] cores = ((IGdbThreadDMData)data).getCores();
- if (cores != null) {
- StringBuilder str = new StringBuilder();
- for (String core : cores) {
- str.append(core).append(',');
- }
- if (str.length() > 0) {
- String coresStr = str.substring(0, str.length() - 1);
- update.setProperty(IGdbLaunchVMConstants.PROP_CORES_ID, coresStr);
- }
- }
- }
- }
+ }
+
+ @Override
+ protected void updatePropertiesInSessionThread(IPropertiesUpdate[] updates) {
+ IPropertiesUpdate[] parentUpdates = new IPropertiesUpdate[updates.length];
+
+ for (int i = 0; i < updates.length; i++) {
+ final IPropertiesUpdate update = updates[i];
+
+ final ViewerCountingRequestMonitor countringRm = new ViewerCountingRequestMonitor(
+ ImmediateExecutor.getInstance(), updates[i]);
+ int count = 0;
+
+ // Create a delegating update which will let the super-class fill in the
+ // standard container properties.
+ parentUpdates[i] = new VMDelegatingPropertiesUpdate(updates[i], countringRm);
+ count++;
+
+ IMIExecutionDMContext execDmc = findDmcInPath(update.getViewerInput(), update.getElementPath(),
+ IMIExecutionDMContext.class);
+ if (execDmc != null) {
+ update.setProperty(ILaunchVMConstants.PROP_ID, execDmc.getThreadId());
+
+ // set pin properties
+ IPinElementColorDescriptor colorDesc = PinCloneUtils
+ .getPinElementColorDescriptor(GdbPinProvider.getPinnedHandles(), execDmc);
+ updates[i].setProperty(IGdbLaunchVMConstants.PROP_PIN_COLOR,
+ colorDesc != null ? colorDesc.getOverlayColor() : null);
+ updates[i].setProperty(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
+ PinCloneUtils.isPinnedTo(GdbPinProvider.getPinnedHandles(), execDmc));
+ }
+
+ if (update.getProperties().contains(PROP_NAME)
+ || update.getProperties().contains(IGdbLaunchVMConstants.PROP_OS_ID)
+ || update.getProperties().contains(IGdbLaunchVMConstants.PROP_CORES_ID)) {
+ IProcesses processService = getServicesTracker().getService(IProcesses.class);
+ final IThreadDMContext threadDmc = findDmcInPath(update.getViewerInput(), update.getElementPath(),
+ IThreadDMContext.class);
+
+ if (processService == null || threadDmc == null) {
+ update.setStatus(
+ new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, "Service or handle invalid", null)); //$NON-NLS-1$
+ } else {
+ processService.getExecutionData(threadDmc,
+ new ViewerDataRequestMonitor<IThreadDMData>(getExecutor(), update) {
+ @Override
+ public void handleCompleted() {
+ if (isSuccess()) {
+ fillThreadDataProperties(update, getData());
+ }
+ update.setStatus(getStatus());
+ countringRm.done();
+ }
+ });
+ count++;
+ }
+ }
+
+ countringRm.setDoneCount(count);
+ }
+ super.updatePropertiesInSessionThread(parentUpdates);
+ }
+
+ protected void fillThreadDataProperties(IPropertiesUpdate update, IThreadDMData data) {
+ if (data.getName() != null && data.getName().length() > 0) {
+ update.setProperty(PROP_NAME, data.getName());
+ }
+ update.setProperty(IGdbLaunchVMConstants.PROP_OS_ID, data.getId());
+
+ if (data instanceof IGdbThreadDMData) {
+ String[] cores = ((IGdbThreadDMData) data).getCores();
+ if (cores != null) {
+ StringBuilder str = new StringBuilder();
+ for (String core : cores) {
+ str.append(core).append(',');
+ }
+ if (str.length() > 0) {
+ String coresStr = str.substring(0, str.length() - 1);
+ update.setProperty(IGdbLaunchVMConstants.PROP_CORES_ID, coresStr);
+ }
+ }
+ }
+ }
private String produceThreadElementName(String viewName, IMIExecutionDMContext execCtx) {
return "Thread." + execCtx.getThreadId(); //$NON-NLS-1$
- }
+ }
- @Override
+ @Override
public int getDeltaFlags(Object e) {
- if (fHideRunningThreadsProperty && e instanceof IResumedDMEvent) {
- // Special handling in the case of hiding the running threads to
- // cause a proper refresh when a thread is resumed.
- // We don't need to worry about the ISuspendedDMEvent in this case
- // because a proper refresh will be triggered anyway by the stack frame
- // being displayed.
- return IModelDelta.CONTENT;
- }
- else if (e instanceof IGDBFocusChangedEvent) {
- return IModelDelta.SELECT;
- }
- return super.getDeltaFlags(e);
- }
-
- @Override
+ if (fHideRunningThreadsProperty && e instanceof IResumedDMEvent) {
+ // Special handling in the case of hiding the running threads to
+ // cause a proper refresh when a thread is resumed.
+ // We don't need to worry about the ISuspendedDMEvent in this case
+ // because a proper refresh will be triggered anyway by the stack frame
+ // being displayed.
+ return IModelDelta.CONTENT;
+ } else if (e instanceof IGDBFocusChangedEvent) {
+ return IModelDelta.SELECT;
+ }
+ return super.getDeltaFlags(e);
+ }
+
+ @Override
public void buildDelta(Object e, final VMDelta parentDelta, final int nodeOffset, final RequestMonitor rm) {
- if (fHideRunningThreadsProperty && e instanceof IResumedDMEvent) {
- // Special handling in the case of hiding the running threads to
- // cause a proper refresh when a thread is resumed.
- // We don't need to worry about the ISuspendedDMEvent in this case
- // because a proper refresh will be triggered anyway by the stack frame
- // being displayed.
- //
- // - If not stepping, update the content of the parent, to allow for
- // this thread to become hidden.
- // - If stepping, do nothing to avoid too many updates. If a
- // time-out is reached before the step completes, the
- // ISteppingTimedOutEvent will trigger a refresh.
- if (((IResumedDMEvent)e).getReason() != IRunControl.StateChangeReason.STEP) {
- VMDelta ancestorDelta = parentDelta.getParentDelta();
- ancestorDelta.setFlags(ancestorDelta.getFlags() | IModelDelta.CONTENT);
- }
- rm.done();
- } else if (e instanceof IGDBFocusChangedEvent) {
- buildDeltaForFocusChangedEvent((IGDBFocusChangedEvent)e, parentDelta, nodeOffset, rm);
- } else {
- super.buildDelta(e, parentDelta, nodeOffset, rm);
- }
- }
-
- private void buildDeltaForFocusChangedEvent(IGDBFocusChangedEvent event, VMDelta parentDelta, int nodeOffset, RequestMonitor rm) {
- getSession().getExecutor().execute(new DsfRunnable() {
+ if (fHideRunningThreadsProperty && e instanceof IResumedDMEvent) {
+ // Special handling in the case of hiding the running threads to
+ // cause a proper refresh when a thread is resumed.
+ // We don't need to worry about the ISuspendedDMEvent in this case
+ // because a proper refresh will be triggered anyway by the stack frame
+ // being displayed.
+ //
+ // - If not stepping, update the content of the parent, to allow for
+ // this thread to become hidden.
+ // - If stepping, do nothing to avoid too many updates. If a
+ // time-out is reached before the step completes, the
+ // ISteppingTimedOutEvent will trigger a refresh.
+ if (((IResumedDMEvent) e).getReason() != IRunControl.StateChangeReason.STEP) {
+ VMDelta ancestorDelta = parentDelta.getParentDelta();
+ ancestorDelta.setFlags(ancestorDelta.getFlags() | IModelDelta.CONTENT);
+ }
+ rm.done();
+ } else if (e instanceof IGDBFocusChangedEvent) {
+ buildDeltaForFocusChangedEvent((IGDBFocusChangedEvent) e, parentDelta, nodeOffset, rm);
+ } else {
+ super.buildDelta(e, parentDelta, nodeOffset, rm);
+ }
+ }
+
+ private void buildDeltaForFocusChangedEvent(IGDBFocusChangedEvent event, VMDelta parentDelta, int nodeOffset,
+ RequestMonitor rm) {
+ getSession().getExecutor().execute(new DsfRunnable() {
@Override
public void run() {
- // can we find a thread context in the hierarchy of the IGDBFocusChangedEvent's context?
+ // can we find a thread context in the hierarchy of the IGDBFocusChangedEvent's context?
IDMContext thread = DMContexts.getAncestorOfType(event.getDMContext(), IMIExecutionDMContext.class);
final IDMContext newThreadFocus = thread;
if (newThreadFocus != null) {
// we need to find the VMC index for the thread that switched, so we can
- // select it correctly.
- getVMCIndexForDmc(
- ThreadVMNode.this,
- newThreadFocus,
- parentDelta,
- new DataRequestMonitor<Integer>(getExecutor(), rm) {
- @Override
+ // select it correctly.
+ getVMCIndexForDmc(ThreadVMNode.this, newThreadFocus, parentDelta,
+ new DataRequestMonitor<Integer>(getExecutor(), rm) {
+ @Override
protected void handleSuccess() {
final int threadOffset = getData();
// Create a delta for the thread node - Select it whether it's running or not
@@ -438,69 +447,70 @@ public class ThreadVMNode extends AbstractThreadVMNode
IModelDelta.SELECT | IModelDelta.FORCE);
rm.done();
}
- });
+ });
} else {
// context not a thread - nothing to do here
rm.done();
}
}
- });
- }
-
-
- private static final String MEMENTO_NAME = "THREAD_MEMENTO_NAME"; //$NON-NLS-1$
-
- /*
- * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider#compareElements(org.eclipse.debug.internal.ui.viewers.model.provisional.IElementCompareRequest[])
- */
- @Override
- public void compareElements(IElementCompareRequest[] requests) {
-
- for ( IElementCompareRequest request : requests ) {
-
- Object element = request.getElement();
- IMemento memento = request.getMemento();
- String mementoName = memento.getString(MEMENTO_NAME);
-
- if (mementoName != null) {
- if (element instanceof IDMVMContext) {
-
- IDMContext dmc = ((IDMVMContext)element).getDMContext();
-
- if ( dmc instanceof IMIExecutionDMContext) {
-
- String elementName = produceThreadElementName( request.getPresentationContext().getId(), (IMIExecutionDMContext) dmc );
- request.setEqual( elementName.equals( mementoName ) );
- }
- }
- }
- request.done();
- }
- }
-
- /*
- * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider#encodeElements(org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoRequest[])
- */
- @Override
- public void encodeElements(IElementMementoRequest[] requests) {
-
- for ( IElementMementoRequest request : requests ) {
-
- Object element = request.getElement();
- IMemento memento = request.getMemento();
-
- if (element instanceof IDMVMContext) {
-
- IDMContext dmc = ((IDMVMContext)element).getDMContext();
-
- if ( dmc instanceof IMIExecutionDMContext) {
-
- String elementName = produceThreadElementName( request.getPresentationContext().getId(), (IMIExecutionDMContext) dmc );
- memento.putString(MEMENTO_NAME, elementName);
- }
- }
- request.done();
- }
- }
+ });
+ }
+
+ private static final String MEMENTO_NAME = "THREAD_MEMENTO_NAME"; //$NON-NLS-1$
+
+ /*
+ * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider#compareElements(org.eclipse.debug.internal.ui.viewers.model.provisional.IElementCompareRequest[])
+ */
+ @Override
+ public void compareElements(IElementCompareRequest[] requests) {
+
+ for (IElementCompareRequest request : requests) {
+
+ Object element = request.getElement();
+ IMemento memento = request.getMemento();
+ String mementoName = memento.getString(MEMENTO_NAME);
+
+ if (mementoName != null) {
+ if (element instanceof IDMVMContext) {
+
+ IDMContext dmc = ((IDMVMContext) element).getDMContext();
+
+ if (dmc instanceof IMIExecutionDMContext) {
+
+ String elementName = produceThreadElementName(request.getPresentationContext().getId(),
+ (IMIExecutionDMContext) dmc);
+ request.setEqual(elementName.equals(mementoName));
+ }
+ }
+ }
+ request.done();
+ }
+ }
+
+ /*
+ * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider#encodeElements(org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoRequest[])
+ */
+ @Override
+ public void encodeElements(IElementMementoRequest[] requests) {
+
+ for (IElementMementoRequest request : requests) {
+
+ Object element = request.getElement();
+ IMemento memento = request.getMemento();
+
+ if (element instanceof IDMVMContext) {
+
+ IDMContext dmc = ((IDMVMContext) element).getDMContext();
+
+ if (dmc instanceof IMIExecutionDMContext) {
+
+ String elementName = produceThreadElementName(request.getPresentationContext().getId(),
+ (IMIExecutionDMContext) dmc);
+ memento.putString(MEMENTO_NAME, elementName);
+ }
+ }
+ request.done();
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/GDBTypeParser.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/GDBTypeParser.java
index c966dca00c6..6b027d89120 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/GDBTypeParser.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/GDBTypeParser.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial implementation
* Anders Dahlberg (Ericsson) - Need additional API to extend support for memory spaces (Bug 431627)
@@ -22,7 +22,7 @@ import java.util.regex.Pattern;
* GDB Type Parser (duplicate of org.eclipse.cdt.debug.mi.core.GDBTypeParser)
* The code was lifted from: The C Programming Language
* B. W. Kernighan and D. Ritchie
- *
+ *
* @since 3.0
*/
public class GDBTypeParser {
@@ -35,7 +35,7 @@ public class GDBTypeParser {
// direct-dcl '(' ')'
// direct-dcl '[' integer ']'
// name: ([a-zA-z][0-9])+
- // integer ([0-9)+
+ // integer ([0-9)+
private static final int EOF = -1;
private static final int NAME = 0;
@@ -66,8 +66,8 @@ public class GDBTypeParser {
// Sanity.
String s = (gdbTypeString == null) ? "" : gdbTypeString; //$NON-NLS-1$
- s = Pattern.compile("\\bconst\\b").matcher(s).replaceAll(""); //$NON-NLS-1$//$NON-NLS-2$
- s = Pattern.compile("\\bvolatile\\b").matcher(s).replaceAll(""); //$NON-NLS-1$//$NON-NLS-2$
+ s = Pattern.compile("\\bconst\\b").matcher(s).replaceAll(""); //$NON-NLS-1$//$NON-NLS-2$
+ s = Pattern.compile("\\bvolatile\\b").matcher(s).replaceAll(""); //$NON-NLS-1$//$NON-NLS-2$
s = s.trim();
// Initialize.
@@ -90,14 +90,14 @@ public class GDBTypeParser {
// We are only interested in "class A"
// Carefull for class A::data or class ns::A<ns::data>
int column = dataType.indexOf(':');
- while (column > 0) {
- if ((column + 2) < dataType.length() && dataType.charAt(column + 1) == ':') {
- column = dataType.indexOf(':', column+2);
- continue;
- }
- dataType = dataType.substring(0, column);
- break;
- }
+ while (column > 0) {
+ if ((column + 2) < dataType.length() && dataType.charAt(column + 1) == ':') {
+ column = dataType.indexOf(':', column + 2);
+ continue;
+ }
+ dataType = dataType.substring(0, column);
+ break;
+ }
genericType = new GDBType(dataType);
// Start the recursive parser.
@@ -105,13 +105,13 @@ public class GDBTypeParser {
return getGDBType();
}
- public static String unParse (GDBType gdbParentType) {
+ public static String unParse(GDBType gdbParentType) {
StringBuilder sb = new StringBuilder();
GDBType gdbType = gdbParentType;
// Fetch the datatype.
while (gdbType != null) {
if (gdbType instanceof GDBDerivedType) {
- GDBDerivedType derived = (GDBDerivedType)gdbType;
+ GDBDerivedType derived = (GDBDerivedType) gdbType;
int type = derived.getType();
gdbType = derived.getChild();
switch (type) {
@@ -150,13 +150,13 @@ public class GDBTypeParser {
switch (getChildType(gdbType)) {
case GDBType.POINTER:
case GDBType.REFERENCE:
- sb.append(prefix);
+ sb.append(prefix);
break;
case GDBType.GENERIC:
sb.insert(0, prefix);
break;
default:
- sb.insert(0, "("+prefix).append(')'); //$NON-NLS-1$
+ sb.insert(0, "(" + prefix).append(')'); //$NON-NLS-1$
break;
}
}
@@ -240,18 +240,18 @@ public class GDBTypeParser {
public String verbose() {
StringBuilder sb = new StringBuilder();
switch (getType()) {
- case FUNCTION :
- sb.append(" function returning ").append(hasChild() ? child.verbose() : ""); //$NON-NLS-1$//$NON-NLS-2$
- break;
- case ARRAY :
- sb.append(" array[").append(dimension).append("] of ").append(hasChild() ? child.verbose() : ""); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
- break;
- case REFERENCE :
- sb.append(" reference to ").append(hasChild() ? child.verbose() : ""); //$NON-NLS-1$//$NON-NLS-2$
- break;
- case POINTER :
- sb.append(" pointer to ").append(hasChild() ? child.verbose() : ""); //$NON-NLS-1$//$NON-NLS-2$
- break;
+ case FUNCTION:
+ sb.append(" function returning ").append(hasChild() ? child.verbose() : ""); //$NON-NLS-1$//$NON-NLS-2$
+ break;
+ case ARRAY:
+ sb.append(" array[").append(dimension).append("] of ").append(hasChild() ? child.verbose() : ""); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+ break;
+ case REFERENCE:
+ sb.append(" reference to ").append(hasChild() ? child.verbose() : ""); //$NON-NLS-1$//$NON-NLS-2$
+ break;
+ case POINTER:
+ sb.append(" pointer to ").append(hasChild() ? child.verbose() : ""); //$NON-NLS-1$//$NON-NLS-2$
+ break;
}
return sb.toString();
}
@@ -310,9 +310,9 @@ public class GDBTypeParser {
GDBDerivedType dType = gdbDerivedType;
GDBType gdbType = gdbDerivedType.getChild();
while (gdbType instanceof GDBDerivedType) {
- dType = (GDBDerivedType)gdbType;
+ dType = (GDBDerivedType) gdbType;
gdbType = dType.getChild();
- }
+ }
gdbType = createGDBDerivedType(gdbType, kind, d);
dType.setChild(gdbType);
}
@@ -338,14 +338,14 @@ public class GDBTypeParser {
tokenType = PARENS;
} else if (isCIdentifierStart(c)) {
int i = 0;
- token += (char)c;
+ token += (char) c;
while (i == 0 && c != ')') {
if (c == EOF) {
// Unbalanced parantheses.
break;
}
c = getch();
- token += (char)c;
+ token += (char) c;
if (c == '(') {
++i;
} else if (c == ')') {
@@ -357,8 +357,6 @@ public class GDBTypeParser {
ungetch();
tokenType = '(';
}
-
-
} else if (c == '[') {
while ((c = getch()) != ']' && c != EOF) {
@@ -366,31 +364,31 @@ public class GDBTypeParser {
}
tokenType = BRACKETS;
} else if (isCIdentifierStart(c)) {
- StringBuilder sb = new StringBuilder();
- sb.append((char) c);
+ StringBuilder sb = new StringBuilder();
+ sb.append((char) c);
while (isCIdentifierPart((c = getch())) && c != EOF) {
- sb.append((char) c);
+ sb.append((char) c);
}
- if (c == '<') {
- // Swallow template args in types like "class foobar<A,B> : public C {..} *"
- // FIXME: if the bracket is not terminate do we throw exception?
- sb.append((char) c);
- int count = 1;
- do {
- c = getch();
- if (c == '<') {
- count++;
- } else if (c == '>') {
- count--;
- }
- if (c != ' ') {
- sb.append((char)c);
- }
- } while (count > 0 && c != EOF);
- } else if (c != EOF) {
+ if (c == '<') {
+ // Swallow template args in types like "class foobar<A,B> : public C {..} *"
+ // FIXME: if the bracket is not terminate do we throw exception?
+ sb.append((char) c);
+ int count = 1;
+ do {
+ c = getch();
+ if (c == '<') {
+ count++;
+ } else if (c == '>') {
+ count--;
+ }
+ if (c != ' ') {
+ sb.append((char) c);
+ }
+ } while (count > 0 && c != EOF);
+ } else if (c != EOF) {
ungetch();
}
- token = sb.toString();
+ token = sb.toString();
tokenType = NAME;
} else if (c == '{') {
// Swallow gdb sends things like "struct foobar {..} *"
@@ -452,7 +450,7 @@ public class GDBTypeParser {
name = " " + token; //$NON-NLS-1$
} else if (tokenType == PARENS) {
insertingChild(GDBType.FUNCTION);
- } else if (tokenType == BRACKETS) {
+ } else if (tokenType == BRACKETS) {
int len = 0;
if (!token.isEmpty()) {
try {
@@ -483,7 +481,7 @@ public class GDBTypeParser {
}
}
}
-
+
/**
* @since 4.4
*/
@@ -519,13 +517,13 @@ public class GDBTypeParser {
System.out.println(parser.getGDBType().verbose());
System.out.println();
- System.out.println("class ns::link<8, ns::A> : public ns::B { int i; int j; struct link * next;} *"); //$NON-NLS-1$
- parser.parse("class ns::link<8, ns::A> : public ns::B { int i; int j; struct link * next;} *"); //$NON-NLS-1$
- System.out.println(GDBTypeParser.unParse(parser.getGDBType()));
- System.out.println(parser.getGDBType().verbose());
- System.out.println();
+ System.out.println("class ns::link<8, ns::A> : public ns::B { int i; int j; struct link * next;} *"); //$NON-NLS-1$
+ parser.parse("class ns::link<8, ns::A> : public ns::B { int i; int j; struct link * next;} *"); //$NON-NLS-1$
+ System.out.println(GDBTypeParser.unParse(parser.getGDBType()));
+ System.out.println(parser.getGDBType().verbose());
+ System.out.println();
- System.out.println("char **argv"); //$NON-NLS-1$
+ System.out.println("char **argv"); //$NON-NLS-1$
parser.parse("char **argv"); //$NON-NLS-1$
System.out.println(GDBTypeParser.unParse(parser.getGDBType()));
System.out.println(parser.getGDBType().verbose());
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGDBLaunchConfigurationConstants.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGDBLaunchConfigurationConstants.java
index 9efa3beff2a..6d4d25711c2 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGDBLaunchConfigurationConstants.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGDBLaunchConfigurationConstants.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
* Marc Khouzam (Ericsson) - Support for fast tracepoints (Bug 346320)
@@ -19,7 +19,6 @@ package org.eclipse.cdt.dsf.gdb;
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
import org.eclipse.cdt.dsf.gdb.launching.LaunchUtils;
-
public class IGDBLaunchConfigurationConstants {
//
@@ -32,7 +31,7 @@ public class IGDBLaunchConfigurationConstants {
public static final String ATTR_DEV_SPEED = GdbPlugin.PLUGIN_ID + ".DEV_SPEED"; //$NON-NLS-1$
//
//
-
+
//
// New to DSF GDB/MI
public static final String DEBUGGER_MODE_REMOTE = "remote"; //$NON-NLS-1$
@@ -71,7 +70,8 @@ public class IGDBLaunchConfigurationConstants {
* Launch configuration attribute key. Boolean value to set the 'use shared library symbols for application' flag of the debugger.
* @since 1.1
*/
- public static final String ATTR_DEBUGGER_USE_SOLIB_SYMBOLS_FOR_APP = GdbPlugin.PLUGIN_ID + ".USE_SOLIB_SYMBOLS_FOR_APP"; //$NON-NLS-1$
+ public static final String ATTR_DEBUGGER_USE_SOLIB_SYMBOLS_FOR_APP = GdbPlugin.PLUGIN_ID
+ + ".USE_SOLIB_SYMBOLS_FOR_APP"; //$NON-NLS-1$
/**
* Launch configuration attribute key. The value is a List (array of String) of directories for the search path of shared libraries.
@@ -88,7 +88,7 @@ public class IGDBLaunchConfigurationConstants {
* @since 2.0
*/
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
@@ -98,21 +98,22 @@ public class IGDBLaunchConfigurationConstants {
/**
* Launch configuration attribute key. Boolean value. See
* IGDBBackend.getUpdateThreadListOnSuspend()
- *
+ *
* @since 3.0
*/
- public static final String ATTR_DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND = GdbPlugin.PLUGIN_ID + ".UPDATE_THREADLIST_ON_SUSPEND"; //$NON-NLS-1$
+ public static final String ATTR_DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND = GdbPlugin.PLUGIN_ID
+ + ".UPDATE_THREADLIST_ON_SUSPEND"; //$NON-NLS-1$
- /**
+ /**
* Launch configuration attribute key. The value is a String specifying the type of post mortem launch.
* @since 3.0
- */
+ */
public static final String ATTR_DEBUGGER_POST_MORTEM_TYPE = GdbPlugin.PLUGIN_ID + ".POST_MORTEM_TYPE"; //$NON-NLS-1$
-
+
/**
* Launch configuration attribute key. Boolean value to set the 'detach-on-fork' GDB option.
* When detach-on-fork is off, we will automatically attach to forked processes. This will yield
- * a multi-process session, which is supported with GDB >= 7.2
+ * a multi-process session, which is supported with GDB >= 7.2
* Note that detach-on-fork == !ATTR_DEBUGGER_DEBUG_ON_FORK
* @since 4.0
*/
@@ -130,9 +131,9 @@ public class IGDBLaunchConfigurationConstants {
* @since 4.1
*/
public static final String ATTR_DEBUGGER_TRACEPOINT_MODE = GdbPlugin.PLUGIN_ID + ".TRACEPOINT_MODE"; //$NON-NLS-1$
-
+
/**
- * Launch configuration attribute key. The value is a String specifying the path of the executable
+ * Launch configuration attribute key. The value is a String specifying the path of the executable
* on the target.
* @since 4.2
*/
@@ -141,7 +142,7 @@ public class IGDBLaunchConfigurationConstants {
/**
* Enablement setting to set Remote Timeout in GDB to (set remotetimeout num).
* The value to use is in {@link #ATTR_DEBUGGER_REMOTE_TIMEOUT_VALUE}
- *
+ *
* @since 5.5
*/
public static final String ATTR_DEBUGGER_REMOTE_TIMEOUT_ENABLED = GdbPlugin.PLUGIN_ID + ".REMOTE_TIMEOUT_ENABLED"; //$NON-NLS-1$
@@ -150,7 +151,7 @@ public class IGDBLaunchConfigurationConstants {
* Setting to set Remote Timeout in GDB to (set remotetimeout num) if enabled
* with {@link #ATTR_DEBUGGER_REMOTE_TIMEOUT_ENABLED} The value is a string and
* does not have to be a number (but it normally is).
- *
+ *
* @since 5.5
*/
public static final String ATTR_DEBUGGER_REMOTE_TIMEOUT_VALUE = GdbPlugin.PLUGIN_ID + ".REMOTE_TIMEOUT_VALUE"; //$NON-NLS-1$
@@ -178,7 +179,7 @@ public class IGDBLaunchConfigurationConstants {
/**
* Launch configuration attribute value. The key is ATTR_DEBUGGER_USE_SOLIB_SYMBOLS_FOR_APP.
- * @since 1.1
+ * @since 1.1
*/
public static final boolean DEBUGGER_USE_SOLIB_SYMBOLS_FOR_APP_DEFAULT = false;
@@ -209,34 +210,34 @@ public class IGDBLaunchConfigurationConstants {
/**
* Launch configuration attribute value. The key is
* ATTR_DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND
- *
+ *
* @since 3.0
*/
public static final boolean DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND_DEFAULT = false;
-
- /**
+
+ /**
* Possible attribute value for the key is ATTR_DEBUGGER_POST_MORTEM_TYPE.
* Indicates a core file.
- *
- * @since 3.0
- */
+ *
+ * @since 3.0
+ */
public static final String DEBUGGER_POST_MORTEM_CORE_FILE = "CORE_FILE"; //$NON-NLS-1$
/**
* Possible attribute value for the key is ATTR_DEBUGGER_POST_MORTEM_TYPE.
* Indicates a trace data file.
- *
- * @since 3.0
- */
+ *
+ * @since 3.0
+ */
public static final String DEBUGGER_POST_MORTEM_TRACE_FILE = "TRACE_FILE"; //$NON-NLS-1$
- /**
+ /**
* Launch configuration attribute value. The key is ATTR_DEBUGGER_POST_MORTEM_TYPE.
* @since 3.0
*/
public static final String DEBUGGER_POST_MORTEM_TYPE_DEFAULT = DEBUGGER_POST_MORTEM_CORE_FILE;
-
- /**
+
+ /**
* Launch configuration attribute value. The key is ATTR_DEBUGGER_DEBUG_ON_FORK.
* @since 4.0
*/
@@ -248,39 +249,39 @@ public class IGDBLaunchConfigurationConstants {
*/
public static final boolean DEBUGGER_EXTERNAL_CONSOLE_DEFAULT = false;
- /**
+ /**
* Possible attribute value for the key is ATTR_DEBUGGER_TRACEPOINT_MODE.
* Indicates that only normal tracepoints should be used.
* @since 4.1
- */
+ */
public static final String DEBUGGER_TRACEPOINT_NORMAL_ONLY = "TP_NORMAL_ONLY"; //$NON-NLS-1$
- /**
+ /**
* Possible attribute value for the key is ATTR_DEBUGGER_TRACEPOINT_MODE.
* Indicates that only fast tracepoints should be used.
* @since 4.1
- */
+ */
public static final String DEBUGGER_TRACEPOINT_FAST_ONLY = "TP_FAST_ONLY"; //$NON-NLS-1$
- /**
+ /**
* Possible attribute value for the key is ATTR_DEBUGGER_TRACEPOINT_MODE.
* Indicates that normal tracepoints should be used whenever a fast tracepoint
* cannot be inserted.
* @since 4.1
- */
+ */
public static final String DEBUGGER_TRACEPOINT_FAST_THEN_NORMAL = "TP_FAST_THEN_NORMAL"; //$NON-NLS-1$
- /**
+ /**
* Default attribute value for the key is ATTR_DEBUGGER_TRACEPOINT_MODE.
* @since 4.1
*/
public static final String DEBUGGER_TRACEPOINT_MODE_DEFAULT = DEBUGGER_TRACEPOINT_NORMAL_ONLY;
- /**
+ /**
* The default value of DebugPlugin.ATTR_PROCESS_FACTORY_ID.
* @since 4.1
*/
- // Bug 210366
+ // Bug 210366
public static final String DEBUGGER_ATTR_PROCESS_FACTORY_ID_DEFAULT = "org.eclipse.cdt.dsf.gdb.GdbProcessFactory"; //$NON-NLS-1$
/**
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGdbDebugConstants.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGdbDebugConstants.java
index 9db53891baa..c391eda03a0 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGdbDebugConstants.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGdbDebugConstants.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial implementation
* Anton Gorenkov - Need to use a process factory (Bug 210366)
@@ -18,14 +18,13 @@ package org.eclipse.cdt.dsf.gdb;
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext;
-
/**
* @noimplement This interface is not intended to be implemented by clients.
* @since 4.0
*/
public interface IGdbDebugConstants {
-
- public static final String PREFIX = GdbPlugin.PLUGIN_ID + "."; //$NON-NLS-1$
+
+ public static final String PREFIX = GdbPlugin.PLUGIN_ID + "."; //$NON-NLS-1$
/**
* Status code for which a UI handler is registered.
@@ -33,41 +32,40 @@ public interface IGdbDebugConstants {
*/
public static final int STATUS_HANDLER_CODE = 20001;
- /**
- * Attribute key to be added to the IProcess associated with an IMIContainerDMContext.
- * The value should be the groupId as returned by {@link IMIContainerDMContext#getGroupId()}
- */
- public static final String INFERIOR_GROUPID_ATTR = PREFIX + "inferiorGroupId"; //$NON-NLS-1$
+ /**
+ * Attribute key to be added to the IProcess associated with an IMIContainerDMContext.
+ * The value should be the groupId as returned by {@link IMIContainerDMContext#getGroupId()}
+ */
+ public static final String INFERIOR_GROUPID_ATTR = PREFIX + "inferiorGroupId"; //$NON-NLS-1$
- /**
- * Attribute key to be passed to DebugPlugin.newProcess to specify the type of process
- * that should be created by our IProcessFactory.
- * @since 4.1
- */
- public static final String PROCESS_TYPE_CREATION_ATTR = PREFIX + "createProcessType"; //$NON-NLS-1$
+ /**
+ * Attribute key to be passed to DebugPlugin.newProcess to specify the type of process
+ * that should be created by our IProcessFactory.
+ * @since 4.1
+ */
+ public static final String PROCESS_TYPE_CREATION_ATTR = PREFIX + "createProcessType"; //$NON-NLS-1$
- /**
- * Attribute value of PROCESS_TYPE_CREATION_ATTR to be passed to DebugPlugin.newProcess to
- * require the creation of an InferiorRuntimeProcess instead of a RuntimeProcess
- * (which is used by default).
- * @since 4.1
- */
- public static final String INFERIOR_PROCESS_CREATION_VALUE = PREFIX + "inferiorProcess"; //$NON-NLS-1$
-
- /**
- * Attribute value of PROCESS_TYPE_CREATION_ATTR to be passed to DebugPlugin.newProcess to
- * require the creation of an GdbProcess instead of a RuntimeProcess
- * (which is used by default).
- * @since 4.1
- */
- public static final String GDB_PROCESS_CREATION_VALUE = PREFIX + "gdbProcess"; //$NON-NLS-1$
+ /**
+ * Attribute value of PROCESS_TYPE_CREATION_ATTR to be passed to DebugPlugin.newProcess to
+ * require the creation of an InferiorRuntimeProcess instead of a RuntimeProcess
+ * (which is used by default).
+ * @since 4.1
+ */
+ public static final String INFERIOR_PROCESS_CREATION_VALUE = PREFIX + "inferiorProcess"; //$NON-NLS-1$
+
+ /**
+ * Attribute value of PROCESS_TYPE_CREATION_ATTR to be passed to DebugPlugin.newProcess to
+ * require the creation of an GdbProcess instead of a RuntimeProcess
+ * (which is used by default).
+ * @since 4.1
+ */
+ public static final String GDB_PROCESS_CREATION_VALUE = PREFIX + "gdbProcess"; //$NON-NLS-1$
- /**
- * Attribute key that when set, indicates that the inferior process has properly exited,
- * and its exit value can be used.
+ /**
+ * Attribute key that when set, indicates that the inferior process has properly exited,
+ * and its exit value can be used.
* @since 4.2
*/
- public static final String INFERIOR_EXITED_ATTR = PREFIX + "inferiorExited"; //$NON-NLS-1$
+ public static final String INFERIOR_EXITED_ATTR = PREFIX + "inferiorExited"; //$NON-NLS-1$
}
-
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGdbDebugPreferenceConstants.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGdbDebugPreferenceConstants.java
index f7baec79793..373d27eb398 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGdbDebugPreferenceConstants.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGdbDebugPreferenceConstants.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial implementation
* Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121)
@@ -27,12 +27,12 @@ import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
public interface IGdbDebugPreferenceConstants {
/**
- * Help prefixes.
- */
- public static final String PREFIX = GdbPlugin.PLUGIN_ID + "."; //$NON-NLS-1$
-
+ * Help prefixes.
+ */
+ public static final String PREFIX = GdbPlugin.PLUGIN_ID + "."; //$NON-NLS-1$
+
/**
- * Boolean preference whether to enable GDB traces. Default is <code>true</code>.
+ * Boolean preference whether to enable GDB traces. Default is <code>true</code>.
*/
public static final String PREF_TRACES_ENABLE = "tracesEnable"; //$NON-NLS-1$
@@ -43,12 +43,12 @@ public interface IGdbDebugPreferenceConstants {
public static final String PREF_MAX_GDB_TRACES = "maxGdbTraces"; //$NON-NLS-1$
/**
- * Boolean preference whether to automatically terminate GDB when the inferior exists. Default is <code>true</code>.
+ * Boolean preference whether to automatically terminate GDB when the inferior exists. Default is <code>true</code>.
*/
public static final String PREF_AUTO_TERMINATE_GDB = "autoTerminateGdb"; //$NON-NLS-1$
/**
- * Boolean preference whether to use the advanced Inspect debug text hover. Default is <code>true</code>.
+ * Boolean preference whether to use the advanced Inspect debug text hover. Default is <code>true</code>.
* @since 3.0
*/
public static final String PREF_USE_INSPECTOR_HOVER = "useInspectorHover"; //$NON-NLS-1$
@@ -66,13 +66,13 @@ public interface IGdbDebugPreferenceConstants {
* @since 4.0
*/
public static final String PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS = "initialChildCountLimitForCollections"; //$NON-NLS-1$
-
+
/**
* The default command for gdb
* @since 4.0
*/
public static final String PREF_DEFAULT_GDB_COMMAND = "defaultGdbCommand"; //$NON-NLS-1$
-
+
/**
* The default command file for gdb
* @since 4.0
@@ -124,7 +124,7 @@ public interface IGdbDebugPreferenceConstants {
/**
* Boolean preference whether to use RTTI for MI variables type
* determination. Default is <code>true</code>.
- *
+ *
* @since 4.1
*/
public static final String PREF_USE_RTTI = PREFIX + "useRtti"; //$NON-NLS-1$
@@ -132,7 +132,7 @@ public interface IGdbDebugPreferenceConstants {
/**
* Boolean preference whether to use new-console. Default is
* {@link IGDBLaunchConfigurationConstants#DEBUGGER_EXTERNAL_CONSOLE_DEFAULT}
- *
+ *
* @since 5.4
*/
public static final String PREF_EXTERNAL_CONSOLE = PREFIX + "externalConsole"; //$NON-NLS-1$
@@ -140,21 +140,21 @@ public interface IGdbDebugPreferenceConstants {
/**
* Boolean preference whether to hide or not, the running threads in the debug view.
* Default is <code>false</code>.
- *
+ *
* @since 4.1
*/
public static final String PREF_HIDE_RUNNING_THREADS = PREFIX + "hideRunningThreads"; //$NON-NLS-1$
-
+
/**
- * Boolean preference whether to use the new behavior of the command
+ * Boolean preference whether to use the new behavior of the command
* "Show Breakpoints Supported by Selected Target" from the Breakpoints view.
- * The original behavior is to only show breakpoints that apply to the current debug
+ * The original behavior is to only show breakpoints that apply to the current debug
* session; so all C/C++ breakpoints but not Java ones.
* The new behavior is to only show breakpoints that are actually installed in the current
* debug session.
- *
+ *
* Default is <code>true</code>.
- *
+ *
* @since 4.2
*/
public static final String PREF_AGGRESSIVE_BP_FILTER = PREFIX + "aggressiveBpFilter"; //$NON-NLS-1$
@@ -171,16 +171,16 @@ public interface IGdbDebugPreferenceConstants {
*/
public static final String PREF_REVERSE_TRACE_METHOD_GDB_TRACE = "UseGdbTrace"; //$NON-NLS-1$
- /**
- * String preference controlling trace method used for hardware tracing.
- * @since 5.0
- */
+ /**
+ * String preference controlling trace method used for hardware tracing.
+ * @since 5.0
+ */
public static final String PREF_REVERSE_TRACE_METHOD_BRANCH_TRACE = "UseBranchTrace"; //$NON-NLS-1$
- /**
- * String preference controlling trace method used for hardware tracing.
- * @since 5.0
- */
+ /**
+ * String preference controlling trace method used for hardware tracing.
+ * @since 5.0
+ */
public static final String PREF_REVERSE_TRACE_METHOD_PROCESSOR_TRACE = "UseProcessorTrace"; //$NON-NLS-1$
/**
@@ -210,7 +210,7 @@ public interface IGdbDebugPreferenceConstants {
/**
* The value is a boolean specifying the default for whether to issue "set
* remotetimout" with the value being {@link #PREF_DEFAULT_REMOTE_TIMEOUT_VALUE}
- *
+ *
* @since 5.5
*/
public static final String PREF_DEFAULT_REMOTE_TIMEOUT_ENABLED = "defaultRemoteTimeoutEnabled"; //$NON-NLS-1$
@@ -218,7 +218,7 @@ public interface IGdbDebugPreferenceConstants {
/**
* The value, if enabled with {@link #PREF_DEFAULT_REMOTE_TIMEOUT_ENABLED}, the
* value for GDB "set remotetimout"
- *
+ *
* @since 5.5
*/
public static final String PREF_DEFAULT_REMOTE_TIMEOUT_VALUE = "defaultRemoteTimeoutValue"; //$NON-NLS-1$
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/actions/IConnect.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/actions/IConnect.java
index c1e7ba8aa56..b03aa995845 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/actions/IConnect.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/actions/IConnect.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
@@ -20,7 +20,7 @@ import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
*/
public interface IConnect {
/**
- * Returns whether this element can currently attempt to
+ * Returns whether this element can currently attempt to
* connect to a new process.
*/
public boolean canConnect();
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/breakpoints/CBreakpointGdbThreadsFilterExtension.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/breakpoints/CBreakpointGdbThreadsFilterExtension.java
index a074e9ab2e2..fe1c79de813 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/breakpoints/CBreakpointGdbThreadsFilterExtension.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/breakpoints/CBreakpointGdbThreadsFilterExtension.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* Ericsson - Make the class thread-safe as it can be accessed by multiple
@@ -30,82 +30,82 @@ import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
import org.eclipse.core.runtime.CoreException;
/**
- *
+ *
*/
public class CBreakpointGdbThreadsFilterExtension implements IDsfBreakpointExtension {
- private final Map<IContainerDMContext,Set<IExecutionDMContext>> fFilteredThreadsByTarget =
- Collections.synchronizedMap(new HashMap<IContainerDMContext,Set<IExecutionDMContext>>(1));
+ private final Map<IContainerDMContext, Set<IExecutionDMContext>> fFilteredThreadsByTarget = Collections
+ .synchronizedMap(new HashMap<IContainerDMContext, Set<IExecutionDMContext>>(1));
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.core.model.ICBreakpointExtension#initialize(org.eclipse.cdt.debug.core.model.ICBreakpoint)
- */
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.core.model.ICBreakpointExtension#initialize(org.eclipse.cdt.debug.core.model.ICBreakpoint)
+ */
@Override
public void initialize(ICBreakpoint breakpoint) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#getTargetFilters()
- */
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#getTargetFilters()
+ */
@Override
- public IContainerDMContext[] getTargetFilters() throws CoreException {
+ public IContainerDMContext[] getTargetFilters() throws CoreException {
Set<IContainerDMContext> set = fFilteredThreadsByTarget.keySet();
synchronized (fFilteredThreadsByTarget) {
return set.toArray(new IContainerDMContext[set.size()]);
}
- }
+ }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#getThreadFilters(org.eclipse.cdt.debug.core.model.ICDebugTarget)
- */
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#getThreadFilters(org.eclipse.cdt.debug.core.model.ICDebugTarget)
+ */
@Override
- public IExecutionDMContext[] getThreadFilters( IContainerDMContext target ) throws CoreException {
- Set<IExecutionDMContext> set = fFilteredThreadsByTarget.get( target );
- return ( set != null ) ? set.toArray( new IExecutionDMContext[set.size()] ) : null;
- }
+ public IExecutionDMContext[] getThreadFilters(IContainerDMContext target) throws CoreException {
+ Set<IExecutionDMContext> set = fFilteredThreadsByTarget.get(target);
+ return (set != null) ? set.toArray(new IExecutionDMContext[set.size()]) : null;
+ }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#removeTargetFilter(org.eclipse.cdt.debug.core.model.ICDebugTarget)
- */
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#removeTargetFilter(org.eclipse.cdt.debug.core.model.ICDebugTarget)
+ */
@Override
- public void removeTargetFilter( IContainerDMContext target ) throws CoreException {
+ public void removeTargetFilter(IContainerDMContext target) throws CoreException {
fFilteredThreadsByTarget.remove(target);
- }
+ }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#removeThreadFilters(org.eclipse.cdt.debug.core.model.ICThread[])
- */
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#removeThreadFilters(org.eclipse.cdt.debug.core.model.ICThread[])
+ */
@Override
- public void removeThreadFilters( IExecutionDMContext[] threads ) throws CoreException {
- if ( threads != null && threads.length > 0 ) {
- IContainerDMContext target = DMContexts.getAncestorOfType(threads[0], IContainerDMContext.class);
- Set<IExecutionDMContext> set = fFilteredThreadsByTarget.get( target );
- if ( set != null ) {
- set.removeAll( Arrays.asList( threads ) );
- if ( set.isEmpty() ) {
- fFilteredThreadsByTarget.remove( target );
- }
- }
- }
- }
+ public void removeThreadFilters(IExecutionDMContext[] threads) throws CoreException {
+ if (threads != null && threads.length > 0) {
+ IContainerDMContext target = DMContexts.getAncestorOfType(threads[0], IContainerDMContext.class);
+ Set<IExecutionDMContext> set = fFilteredThreadsByTarget.get(target);
+ if (set != null) {
+ set.removeAll(Arrays.asList(threads));
+ if (set.isEmpty()) {
+ fFilteredThreadsByTarget.remove(target);
+ }
+ }
+ }
+ }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#setTargetFilter(org.eclipse.cdt.debug.core.model.ICDebugTarget)
- */
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#setTargetFilter(org.eclipse.cdt.debug.core.model.ICDebugTarget)
+ */
@Override
- public void setTargetFilter( IContainerDMContext target ) throws CoreException {
- fFilteredThreadsByTarget.put( target, null );
- }
+ public void setTargetFilter(IContainerDMContext target) throws CoreException {
+ fFilteredThreadsByTarget.put(target, null);
+ }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#setThreadFilters(org.eclipse.cdt.debug.core.model.ICThread[])
- */
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#setThreadFilters(org.eclipse.cdt.debug.core.model.ICThread[])
+ */
@Override
- public void setThreadFilters( IExecutionDMContext[] threads ) throws CoreException {
- if ( threads != null && threads.length > 0 ) {
- IContainerDMContext target = DMContexts.getAncestorOfType(threads[0], IContainerDMContext.class);
- fFilteredThreadsByTarget.put( target, new HashSet<IExecutionDMContext>( Arrays.asList( threads ) ) );
- }
- }
+ public void setThreadFilters(IExecutionDMContext[] threads) throws CoreException {
+ if (threads != null && threads.length > 0) {
+ IContainerDMContext target = DMContexts.getAncestorOfType(threads[0], IContainerDMContext.class);
+ fFilteredThreadsByTarget.put(target, new HashSet<IExecutionDMContext>(Arrays.asList(threads)));
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/breakpoints/GDBDynamicPrintfUtils.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/breakpoints/GDBDynamicPrintfUtils.java
index 452fa3dd27a..74842f0383c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/breakpoints/GDBDynamicPrintfUtils.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/breakpoints/GDBDynamicPrintfUtils.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Marc Khouzam (Ericsson) - Support Dynamic Printf (Bug 400628)
*******************************************************************************/
@@ -17,10 +17,9 @@ package org.eclipse.cdt.dsf.gdb.breakpoints;
import org.eclipse.cdt.dsf.concurrent.Immutable;
import org.eclipse.osgi.util.NLS;
-
/**
* Utility methods to help deal with Dynamic Printf logic.
- *
+ *
* @since 4.4
*/
public class GDBDynamicPrintfUtils {
@@ -31,21 +30,21 @@ public class GDBDynamicPrintfUtils {
private String fStringSection;
private String[] fArgs;
private String fErrorMessage;
-
+
public GDBDynamicPrintfString(String str) {
if (str == null) {
fErrorMessage = Messages.DynamicPrintf_Invalid_string;
return;
}
-
+
str = str.trim();
-
+
// No point in having an empty string, just disable the dprintf instead
if (str.isEmpty()) {
fErrorMessage = Messages.DynamicPrintf_Invalid_string;
return;
}
-
+
// First character must be a double-quote
if (str.charAt(0) != '"') {
fErrorMessage = Messages.DynamicPrintf_Printf_must_start_with_quote;
@@ -63,7 +62,7 @@ public class GDBDynamicPrintfUtils {
char[] chars = str.toCharArray();
int closingQuoteIndex = 0;
int numArgExpected = 0;
- for (int i=1; i<chars.length; i++) {
+ for (int i = 1; i < chars.length; i++) {
switch (chars[i]) {
case '\\':
// Next char can be ignored
@@ -73,7 +72,7 @@ public class GDBDynamicPrintfUtils {
closingQuoteIndex = i;
break;
case '%':
- if (chars.length > i+1 && chars[i+1] != '%') {
+ if (chars.length > i + 1 && chars[i + 1] != '%') {
// Not a %% so we have found an expected argument.
numArgExpected++;
}
@@ -87,11 +86,12 @@ public class GDBDynamicPrintfUtils {
i++;
break;
}
-
+
// If we found the closing double-quote, there is no need to keep counting
- if (closingQuoteIndex > 0) break;
+ if (closingQuoteIndex > 0)
+ break;
}
-
+
if (closingQuoteIndex < 1) {
// Didn't find a closing double-quote!
fErrorMessage = Messages.DynamicPrintf_Printf_missing_closing_quote;
@@ -99,20 +99,20 @@ public class GDBDynamicPrintfUtils {
}
// We extract the string part of the printf string leaving the arguments
- fStringSection = str.substring(0, closingQuoteIndex+1);
-
+ fStringSection = str.substring(0, closingQuoteIndex + 1);
+
int numArgPresent = 0;
if (closingQuoteIndex + 1 >= str.length()) {
// No more characters after the string part
fArgs = new String[0];
numArgPresent = 0;
} else {
- String argString = str.substring(closingQuoteIndex+1).trim();
+ String argString = str.substring(closingQuoteIndex + 1).trim();
if (argString.charAt(0) != ',') {
fErrorMessage = Messages.DynamicPrintf_Missing_comma;
return;
}
-
+
// Remove the first , to avoid an empty element after the split.
// Then split the string but keep any empty results
String[] args = argString.substring(1).split(",", -1); //$NON-NLS-1$
@@ -136,27 +136,29 @@ public class GDBDynamicPrintfUtils {
}
return;
}
-
+
// Everything is ok!
fValid = true;
}
-
+
public boolean isValid() {
return fValid;
}
-
+
public String getString() {
- if (!isValid()) return ""; //$NON-NLS-1$
+ if (!isValid())
+ return ""; //$NON-NLS-1$
return fStringSection;
}
-
+
public String[] getArguments() {
- if (!isValid()) return new String[0];
+ if (!isValid())
+ return new String[0];
return fArgs;
}
-
+
public String getErrorMessage() {
return fErrorMessage;
}
- }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/CoreInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/CoreInfo.java
index f8de871916e..798dba2a08c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/CoreInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/CoreInfo.java
@@ -18,7 +18,7 @@ import org.eclipse.cdt.internal.core.ICoreInfo;
public class CoreInfo implements ICoreInfo {
private String fId;
private String fPhysicalId;
-
+
public CoreInfo(String id, String pId) {
fId = id;
fPhysicalId = pId;
@@ -32,5 +32,5 @@ public class CoreInfo implements ICoreInfo {
@Override
public String getPhysicalId() {
return fPhysicalId;
- }
+ }
} \ No newline at end of file
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/CoreList.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/CoreList.java
index d6a82cd4fa4..35bd9a7dbaf 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/CoreList.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/CoreList.java
@@ -32,124 +32,121 @@ public class CoreList {
private ICoreInfo[] fCoreList;
private String fCoreFileName;
private IResourcesInformation fResourcesInfo;
-
+
private static final String PROCESSOR_ID_STR = "processor"; //$NON-NLS-1$
private static final String PHYSICAL_ID_STR = "physical id"; //$NON-NLS-1$
-
+
/** Default constructor - assumes the info comes from file /proc/cpuinfo */
public CoreList() {
fCoreFileName = "/proc/cpuinfo"; //$NON-NLS-1$
}
-
+
/** Alternate constructor - info comes from a file passed as parameter */
public CoreList(String fileName) {
fCoreFileName = fileName;
}
-
- /**
+
+ /**
* Alternate constructor - info comes from IResourcesInformation object,
- * that was obtained from GDB
+ * that was obtained from GDB
*/
public CoreList(IResourcesInformation info) {
fResourcesInfo = info;
}
-
/** Returns the list of cores. The core information will only
- * be parsed once and the result cached. To force a re-parse,
+ * be parsed once and the result cached. To force a re-parse,
* one must create a new CoreList object. */
- public ICoreInfo[] getCoreList() {
-
- // already parsed info?
+ public ICoreInfo[] getCoreList() {
+
+ // already parsed info?
if (fCoreList != null) {
return fCoreList;
}
if (fCoreFileName != null) {
getCoreListFromFile();
- }
- else if (fResourcesInfo != null) {
+ } else if (fResourcesInfo != null) {
getCoreListFromResourceInfo();
}
return fCoreList;
}
-
+
/**
* This method will only parse /proc/cpuinfo once and cache
* the result. To force a re-parse, one must create a new
- * CoreList object.
+ * CoreList object.
*/
- private void getCoreListFromFile() {
+ private void getCoreListFromFile() {
File cpuInfo = new File(fCoreFileName);
Vector<ICoreInfo> coreInfo = new Vector<ICoreInfo>();
- BufferedReader reader = null;
- try {
- String processorId = null;
- String physicalId = null;
-
- Reader r = new InputStreamReader(new FileInputStream(cpuInfo));
- reader = new BufferedReader(r);
- String line;
- while ((line = reader.readLine()) != null) {
- line = line.trim();
- if (line.startsWith(PROCESSOR_ID_STR)) {
- if (processorId != null) {
- // We are already at the next 'processor' entry, without
- // having found the 'physical id' entry. This means
- // there is a single physical CPU.
- physicalId = "0"; //$NON-NLS-1$
-
- coreInfo.add(new CoreInfo(processorId, physicalId));
- processorId = null;
- }
- // Found the processor id of this core, so store it temporarily
- processorId = line.split(":")[1].trim(); //$NON-NLS-1$
- } else if (line.startsWith(PHYSICAL_ID_STR)) {
- // Found the physical id of this core, so store it temporarily
-
- assert physicalId == null;
- physicalId = line.split(":")[1].trim(); //$NON-NLS-1$
-
- coreInfo.add(new CoreInfo(processorId, physicalId));
-
- // Get ready to look for the next core.
- processorId = null;
- physicalId = null;
- }
- }
- if (processorId != null) {
- // This will happen when there is no 'physical id' field
- coreInfo.add(new CoreInfo(processorId, "0")); //$NON-NLS-1$
- }
+ BufferedReader reader = null;
+ try {
+ String processorId = null;
+ String physicalId = null;
+
+ Reader r = new InputStreamReader(new FileInputStream(cpuInfo));
+ reader = new BufferedReader(r);
+ String line;
+ while ((line = reader.readLine()) != null) {
+ line = line.trim();
+ if (line.startsWith(PROCESSOR_ID_STR)) {
+ if (processorId != null) {
+ // We are already at the next 'processor' entry, without
+ // having found the 'physical id' entry. This means
+ // there is a single physical CPU.
+ physicalId = "0"; //$NON-NLS-1$
+
+ coreInfo.add(new CoreInfo(processorId, physicalId));
+ processorId = null;
+ }
+ // Found the processor id of this core, so store it temporarily
+ processorId = line.split(":")[1].trim(); //$NON-NLS-1$
+ } else if (line.startsWith(PHYSICAL_ID_STR)) {
+ // Found the physical id of this core, so store it temporarily
+
+ assert physicalId == null;
+ physicalId = line.split(":")[1].trim(); //$NON-NLS-1$
+
+ coreInfo.add(new CoreInfo(processorId, physicalId));
+
+ // Get ready to look for the next core.
+ processorId = null;
+ physicalId = null;
+ }
+ }
+ if (processorId != null) {
+ // This will happen when there is no 'physical id' field
+ coreInfo.add(new CoreInfo(processorId, "0")); //$NON-NLS-1$
+ }
} catch (IOException e) {
} finally {
try {
if (reader != null) {
reader.close();
}
- } catch (IOException e) {/* Don't care */}
+ } catch (IOException e) {
+ /* Don't care */}
reader = null;
}
-
+
fCoreList = coreInfo.toArray(new ICoreInfo[coreInfo.size()]);
}
-
-
- private void getCoreListFromResourceInfo() {
+
+ private void getCoreListFromResourceInfo() {
Vector<ICoreInfo> coreInfo = new Vector<ICoreInfo>();
- int processorIdIndex = -1;
+ int processorIdIndex = -1;
int physicalIdIndex = -1;
String processorId = null;
- String physicalId = null;
-
+ String physicalId = null;
+
int column = 0;
// find the indexes of the columns that we need
for (String col : fResourcesInfo.getColumnNames()) {
if (col.equalsIgnoreCase(PROCESSOR_ID_STR)) {
processorIdIndex = column;
- }
- else if (col.equalsIgnoreCase(PHYSICAL_ID_STR)) {
+ } else if (col.equalsIgnoreCase(PHYSICAL_ID_STR)) {
physicalIdIndex = column;
}
column++;
@@ -175,7 +172,7 @@ public class CoreList {
physicalId = null;
}
}
-
+
fCoreList = coreInfo.toArray(new ICoreInfo[coreInfo.size()]);
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbDebugOptions.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbDebugOptions.java
index f2f102269be..05ec17c3be8 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbDebugOptions.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbDebugOptions.java
@@ -25,12 +25,12 @@ import org.osgi.framework.BundleContext;
* Hooks our debug options to the Platform trace functionality.
* In essence, we can open Window -> Preferences -> Tracing
* and turn on debug options for this package. The debug output
- * will come out on the console and can be saved directly to
- * a file. Classes that need to be debugged can call into
+ * will come out on the console and can be saved directly to
+ * a file. Classes that need to be debugged can call into
* GdbDebugOptions to get debug flags. If new flags need to be
* created, they will need to have a unique identifier and added to
* the .options file in this plugin
- *
+ *
* @since 4.1
*
*/
@@ -56,7 +56,6 @@ public class GdbDebugOptions implements DebugOptionsListener {
context.registerService(DebugOptionsListener.class.getName(), this, props);
}
-
@Override
public void optionsChanged(DebugOptions options) {
fgDebugTrace = options.newDebugTrace(GdbPlugin.getUniqueIdentifier());
@@ -73,7 +72,7 @@ public class GdbDebugOptions implements DebugOptionsListener {
public static void trace(String option, String message, Throwable throwable) {
trace(option, message, 100, throwable);
}
-
+
/**
* Prints the given message to System.out and to the OSGi tracing (if started)
* @param option the option or <code>null</code>
@@ -88,17 +87,17 @@ public class GdbDebugOptions implements DebugOptionsListener {
} else if (lineMax < 100) {
lineMax = 100;
}
-
+
//divide the string into substrings of 'lineMax' chars or less for printing to console
String systemPrintableMessage = message;
while (systemPrintableMessage.length() > lineMax) {
- String partial = systemPrintableMessage.substring(0, lineMax);
+ String partial = systemPrintableMessage.substring(0, lineMax);
systemPrintableMessage = systemPrintableMessage.substring(lineMax);
System.out.println(partial + "\\"); //$NON-NLS-1$
}
System.out.print(systemPrintableMessage);
//then pass the original message to be traced into a file
- if(fgDebugTrace != null) {
+ if (fgDebugTrace != null) {
fgDebugTrace.trace(option, message, throwable);
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPlugin.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPlugin.java
index 58a85eb0400..9956a40fa98 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPlugin.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPlugin.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* Abeer Bagul (Tensilica) - Updated error message (Bug 339048)
@@ -46,11 +46,11 @@ public class GdbPlugin extends Plugin {
// The shared instance
private static GdbPlugin plugin;
-
- private static BundleContext fgBundleContext;
-
- private IAdapterFactory fMemoryRetrievalFactory = null;
-
+
+ private static BundleContext fgBundleContext;
+
+ private IAdapterFactory fMemoryRetrievalFactory = null;
+
/**
* The constructor
*/
@@ -62,15 +62,15 @@ public class GdbPlugin extends Plugin {
* @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
*/
@Override
- public void start(BundleContext context) throws Exception {
- fgBundleContext = context;
+ public void start(BundleContext context) throws Exception {
+ fgBundleContext = context;
super.start(context);
plugin = this;
-
- new GdbDebugOptions(context);
-
- fMemoryRetrievalFactory = new MemoryBlockRetrievalFactory();
- Platform.getAdapterManager().registerAdapters(fMemoryRetrievalFactory, IDMContext.class);
+
+ new GdbDebugOptions(context);
+
+ fMemoryRetrievalFactory = new MemoryBlockRetrievalFactory();
+ Platform.getAdapterManager().registerAdapters(fMemoryRetrievalFactory, IDMContext.class);
}
/*
@@ -78,16 +78,16 @@ public class GdbPlugin extends Plugin {
* @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
*/
@Override
- public void stop(BundleContext context) throws Exception {
- shutdownActiveLaunches();
+ public void stop(BundleContext context) throws Exception {
+ shutdownActiveLaunches();
plugin = null;
-
+
if (fMemoryRetrievalFactory != null) {
Platform.getAdapterManager().unregisterAdapters(fMemoryRetrievalFactory, IDMContext.class);
}
-
+
super.stop(context);
- fgBundleContext = null;
+ fgBundleContext = null;
}
/**
@@ -99,74 +99,81 @@ public class GdbPlugin extends Plugin {
return plugin;
}
- public static BundleContext getBundleContext() {
- return fgBundleContext;
- }
-
- /**
- * Shuts down any active launches. We must shutdown any active sessions
- * and services associated with this plugin before this plugin is stopped.
- * Any attempts to use the plugins {@link BundleContext} after the plugin
- * is shut down will result in exceptions.
- */
- private void shutdownActiveLaunches() {
-
- DebugPlugin debugPlugin = DebugPlugin.getDefault();
- if (debugPlugin == null) {
+ public static BundleContext getBundleContext() {
+ return fgBundleContext;
+ }
+
+ /**
+ * Shuts down any active launches. We must shutdown any active sessions
+ * and services associated with this plugin before this plugin is stopped.
+ * Any attempts to use the plugins {@link BundleContext} after the plugin
+ * is shut down will result in exceptions.
+ */
+ private void shutdownActiveLaunches() {
+
+ DebugPlugin debugPlugin = DebugPlugin.getDefault();
+ if (debugPlugin == null) {
// Simple junit tests don't cause the platform debug plugins to load
- return;
- }
-
- for (ILaunch launch : debugPlugin.getLaunchManager().getLaunches()) {
- if (launch instanceof GdbLaunch && ((GdbLaunch)launch).getSession().isActive()) {
- final GdbLaunch gdbLaunch = (GdbLaunch)launch;
-
- Query<Object> launchShutdownQuery = new Query<Object>() {
- @Override
- protected void execute(DataRequestMonitor<Object> rm) {
- gdbLaunch.shutdownSession(rm);
- }
- };
-
- try {
- gdbLaunch.getSession().getExecutor().execute(launchShutdownQuery);
- } catch (RejectedExecutionException e) {
- // We can get this exception if the session is shutdown concurrently
- // to this method running.
- break;
- }
-
- // The Query.get() method is a synchronous call which blocks until the
- // query completes.
- try {
- launchShutdownQuery.get(1, TimeUnit.MINUTES);
- } catch (InterruptedException e) {
- getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, "InterruptedException while shutting down launch " + gdbLaunch, e.getCause())); //$NON-NLS-1$
- } catch (ExecutionException e) {
- getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, "Exception while shutting down launch " + gdbLaunch, e.getCause())); //$NON-NLS-1$
- } catch (TimeoutException e) {
- getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, "TimeoutException while shutting down launch " + gdbLaunch, e.getCause())); //$NON-NLS-1$
- }
- }
- }
- }
-
- public static String getDebugTime() {
- StringBuilder traceBuilder = new StringBuilder();
-
- // Record the time
- long time = System.currentTimeMillis();
- long seconds = (time / 1000) % 1000;
- if (seconds < 100) traceBuilder.append('0');
- if (seconds < 10) traceBuilder.append('0');
- traceBuilder.append(seconds);
- traceBuilder.append(',');
- long millis = time % 1000;
- if (millis < 100) traceBuilder.append('0');
- if (millis < 10) traceBuilder.append('0');
- traceBuilder.append(millis);
- return traceBuilder.toString();
- }
+ return;
+ }
+
+ for (ILaunch launch : debugPlugin.getLaunchManager().getLaunches()) {
+ if (launch instanceof GdbLaunch && ((GdbLaunch) launch).getSession().isActive()) {
+ final GdbLaunch gdbLaunch = (GdbLaunch) launch;
+
+ Query<Object> launchShutdownQuery = new Query<Object>() {
+ @Override
+ protected void execute(DataRequestMonitor<Object> rm) {
+ gdbLaunch.shutdownSession(rm);
+ }
+ };
+
+ try {
+ gdbLaunch.getSession().getExecutor().execute(launchShutdownQuery);
+ } catch (RejectedExecutionException e) {
+ // We can get this exception if the session is shutdown concurrently
+ // to this method running.
+ break;
+ }
+
+ // The Query.get() method is a synchronous call which blocks until the
+ // query completes.
+ try {
+ launchShutdownQuery.get(1, TimeUnit.MINUTES);
+ } catch (InterruptedException e) {
+ getLog().log(new Status(IStatus.ERROR, PLUGIN_ID,
+ "InterruptedException while shutting down launch " + gdbLaunch, e.getCause())); //$NON-NLS-1$
+ } catch (ExecutionException e) {
+ getLog().log(new Status(IStatus.ERROR, PLUGIN_ID,
+ "Exception while shutting down launch " + gdbLaunch, e.getCause())); //$NON-NLS-1$
+ } catch (TimeoutException e) {
+ getLog().log(new Status(IStatus.ERROR, PLUGIN_ID,
+ "TimeoutException while shutting down launch " + gdbLaunch, e.getCause())); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+
+ public static String getDebugTime() {
+ StringBuilder traceBuilder = new StringBuilder();
+
+ // Record the time
+ long time = System.currentTimeMillis();
+ long seconds = (time / 1000) % 1000;
+ if (seconds < 100)
+ traceBuilder.append('0');
+ if (seconds < 10)
+ traceBuilder.append('0');
+ traceBuilder.append(seconds);
+ traceBuilder.append(',');
+ long millis = time % 1000;
+ if (millis < 100)
+ traceBuilder.append('0');
+ if (millis < 10)
+ traceBuilder.append('0');
+ traceBuilder.append(millis);
+ return traceBuilder.toString();
+ }
/**
* Convenience method which returns the unique identifier of this plugin.
@@ -183,16 +190,17 @@ public class GdbPlugin extends Plugin {
/**
* Logs the specified status with this plug-in's log.
- *
+ *
* @param status
* status to log
*/
public static void log(IStatus status) {
getDefault().getLog().log(status);
}
+
/**
* Logs an internal error with the specified message.
- *
+ *
* @param message
* the error message to log
*/
@@ -202,7 +210,7 @@ public class GdbPlugin extends Plugin {
/**
* Logs an internal error with the specified throwable
- *
+ *
* @param e
* the exception to be logged
*/
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPreferenceInitializer.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPreferenceInitializer.java
index 32c7d68e312..b0173d6dfe8 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPreferenceInitializer.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPreferenceInitializer.java
@@ -39,21 +39,33 @@ public class GdbPreferenceInitializer extends AbstractPreferenceInitializer {
node.putBoolean(IGdbDebugPreferenceConstants.PREF_USE_INSPECTOR_HOVER, true);
node.putBoolean(IGdbDebugPreferenceConstants.PREF_ENABLE_PRETTY_PRINTING, true);
node.putBoolean(IGdbDebugPreferenceConstants.PREF_USE_RTTI, true);
- node.putBoolean(IGdbDebugPreferenceConstants.PREF_EXTERNAL_CONSOLE, IGDBLaunchConfigurationConstants.DEBUGGER_EXTERNAL_CONSOLE_DEFAULT);
+ node.putBoolean(IGdbDebugPreferenceConstants.PREF_EXTERNAL_CONSOLE,
+ IGDBLaunchConfigurationConstants.DEBUGGER_EXTERNAL_CONSOLE_DEFAULT);
node.putInt(IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS, 100);
- node.put(IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND, IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT);
- node.put(IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_INIT, IGDBLaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT);
- node.putBoolean(IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_DEFAULT);
- node.put(IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN_SYMBOL, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT);
- node.putBoolean(IGdbDebugPreferenceConstants.PREF_DEFAULT_NON_STOP, IGDBLaunchConfigurationConstants.DEBUGGER_NON_STOP_DEFAULT);
+ node.put(IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND,
+ IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT);
+ node.put(IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_INIT,
+ IGDBLaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT);
+ node.putBoolean(IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN,
+ ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_DEFAULT);
+ node.put(IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN_SYMBOL,
+ ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT);
+ node.putBoolean(IGdbDebugPreferenceConstants.PREF_DEFAULT_NON_STOP,
+ IGDBLaunchConfigurationConstants.DEBUGGER_NON_STOP_DEFAULT);
node.putBoolean(IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT, false);
- node.putInt(IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT_VALUE, IGdbDebugPreferenceConstants.COMMAND_TIMEOUT_VALUE_DEFAULT);
+ 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);
- node.putBoolean(IGdbDebugPreferenceConstants.PREF_CONSOLE_INVERTED_COLORS, IGdbDebugPreferenceConstants.CONSOLE_INVERTED_COLORS_DEFAULT);
- node.putInt(IGdbDebugPreferenceConstants.PREF_CONSOLE_BUFFERLINES, IGdbDebugPreferenceConstants.CONSOLE_BUFFERLINES_DEFAULT);
- node.putBoolean(IGdbDebugPreferenceConstants.PREF_DEFAULT_REMOTE_TIMEOUT_ENABLED, IGDBLaunchConfigurationConstants.DEBUGGER_REMOTE_TIMEOUT_ENABLED_DEFAULT);
- node.put(IGdbDebugPreferenceConstants.PREF_DEFAULT_REMOTE_TIMEOUT_VALUE, IGDBLaunchConfigurationConstants.DEBUGGER_REMOTE_TIMEOUT_VALUE_DEFAULT);
+ node.put(IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_HARDWARE,
+ IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_GDB_TRACE);
+ node.putBoolean(IGdbDebugPreferenceConstants.PREF_CONSOLE_INVERTED_COLORS,
+ IGdbDebugPreferenceConstants.CONSOLE_INVERTED_COLORS_DEFAULT);
+ node.putInt(IGdbDebugPreferenceConstants.PREF_CONSOLE_BUFFERLINES,
+ IGdbDebugPreferenceConstants.CONSOLE_BUFFERLINES_DEFAULT);
+ node.putBoolean(IGdbDebugPreferenceConstants.PREF_DEFAULT_REMOTE_TIMEOUT_ENABLED,
+ IGDBLaunchConfigurationConstants.DEBUGGER_REMOTE_TIMEOUT_ENABLED_DEFAULT);
+ node.put(IGdbDebugPreferenceConstants.PREF_DEFAULT_REMOTE_TIMEOUT_VALUE,
+ IGDBLaunchConfigurationConstants.DEBUGGER_REMOTE_TIMEOUT_VALUE_DEFAULT);
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/Messages.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/Messages.java
index 5cba4094025..cd9aa45d025 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/Messages.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/Messages.java
@@ -30,14 +30,14 @@ public class Messages extends NLS {
public static String CustomTimeoutsMap_Invalid_custom_timeout_value;
public static String GDBControl_Session_is_terminated;
-
+
public static String StepIntoSelection;
-
+
public static String StepIntoSelection_Execution_did_not_enter_function;
-
+
static {
// initialize resource bundle
- NLS.initializeMessages( Messages.class.getName(), Messages.class );
+ NLS.initializeMessages(Messages.class.getName(), Messages.class);
}
private Messages() {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/ProcStatCoreLoads.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/ProcStatCoreLoads.java
index 97e2022de3f..9315a3ffe78 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/ProcStatCoreLoads.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/ProcStatCoreLoads.java
@@ -18,28 +18,27 @@ import java.util.Map;
/**
* This class provides a container to store the computed
- * loads for the various CPU cores.
+ * loads for the various CPU cores.
*
*/
public class ProcStatCoreLoads {
private Map<String, Float> m_coreLoads;
-
+
public ProcStatCoreLoads() {
- m_coreLoads = new HashMap<String,Float>();
+ m_coreLoads = new HashMap<String, Float>();
}
-
+
public void put(String coreId, Float load) {
- m_coreLoads.put(coreId,load);
+ m_coreLoads.put(coreId, load);
}
-
+
/**
* @param cpuId: the cpu/core id, as listed in /proc/cpuinfo.
- * For example, for the core labelled "cpu0" in /proc/stat,
+ * For example, for the core labelled "cpu0" in /proc/stat,
* use id "0".
* @return The measured load for that core
*/
public Float getLoad(String cpuId) {
- return m_coreLoads.get("cpu"+cpuId); //$NON-NLS-1$
+ return m_coreLoads.get("cpu" + cpuId); //$NON-NLS-1$
}
}
-
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/ProcStatCounters.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/ProcStatCounters.java
index 34192d21b55..c6266e8f674 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/ProcStatCounters.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/ProcStatCounters.java
@@ -18,11 +18,11 @@ import java.util.HashMap;
import java.util.Map;
/**
- * A class that holds one set of /proc/stat counters.
+ * A class that holds one set of /proc/stat counters.
* TODO: extend to more than the tick counters.
*/
public class ProcStatCounters {
- private Map<String,OneCoreTickCounters> fTickCounters = new HashMap<String,OneCoreTickCounters>();
+ private Map<String, OneCoreTickCounters> fTickCounters = new HashMap<String, OneCoreTickCounters>();
/**
* An object of this class holds one set of core/CPU tick counter values, for a single CPU core
@@ -39,7 +39,8 @@ public class ProcStatCounters {
public OneCoreTickCounters(Integer[] c) {
// sanity checks
assert (c != null && c.length >= 7);
- if (c == null || c.length < 7) return;
+ if (c == null || c.length < 7)
+ return;
fUser = c[0];
fNice = c[1];
@@ -56,12 +57,12 @@ public class ProcStatCounters {
private int getActiveTicks() {
return fUser + fNice + fSystem + fIowait + fIrq + fSoftirq;
}
-
+
/**
* @return The "idle" tick counter
*/
private int getIdleTicks() {
- return fIdle;
+ return fIdle;
}
}
@@ -69,7 +70,7 @@ public class ProcStatCounters {
*
*/
public ProcStatCounters() {
- fTickCounters = new HashMap<String,OneCoreTickCounters>();
+ fTickCounters = new HashMap<String, OneCoreTickCounters>();
}
/**
@@ -80,44 +81,44 @@ public class ProcStatCounters {
public void addTickCounters(String core, Integer[] ticks) {
fTickCounters.put(core, new OneCoreTickCounters(ticks));
}
-
+
/**
* Note: It was discovered during testing that sometimes, the counters in
- * /proc/stat are not updated for a given core, between two measurements.
+ * /proc/stat are not updated for a given core, between two measurements.
* The cause seems to be that with CPUs such as the i5 and i7, some power-
* saving modes can put a core to sleep for a short time. When all counters
* for a core are the same for 2 measurements, it can cause a division by
- * zero below, in the load computing code. Given that this can legitimately
- * happen, we handle the case and assign a load of zero, when it does.
- *
- * @param old: another ProcStatCounters object. If null, will compute the
+ * zero below, in the load computing code. Given that this can legitimately
+ * happen, we handle the case and assign a load of zero, when it does.
+ *
+ * @param old: another ProcStatCounters object. If null, will compute the
* average load from boot time (i.e. historical load).
* @return the load, for each CPU core, computed from the two
* sets of counters.
*/
public final ProcStatCoreLoads computeLoads(final ProcStatCounters old) {
ProcStatCoreLoads loads = new ProcStatCoreLoads();
-
+
// for each core
- for(String coreId: fTickCounters.keySet()) {
+ for (String coreId : fTickCounters.keySet()) {
OneCoreTickCounters coreCountersNew = fTickCounters.get(coreId);
// Do we have 2 sets of counters to compute the load from?
if (old != null) {
OneCoreTickCounters coreCountersOld = old.fTickCounters.get(coreId);
int diffIdle = coreCountersNew.getIdleTicks() - coreCountersOld.getIdleTicks();
int diffActive = coreCountersNew.getActiveTicks() - coreCountersOld.getActiveTicks();
-
+
// Sanity check - we do not expect that the counter should decrease
- assert(diffIdle >= 0);
- assert(diffActive >= 0);
-
+ assert (diffIdle >= 0);
+ assert (diffActive >= 0);
+
if (diffIdle < 0 || diffActive < 0) {
return null;
}
-
+
float load;
if (diffIdle + diffActive != 0) {
- load = diffActive / (float)(diffActive + diffIdle);
+ load = diffActive / (float) (diffActive + diffIdle);
}
// Here we catch the cases where a core has been asleep for the whole
// measurement period. See note above this method.
@@ -132,11 +133,11 @@ public class ProcStatCounters {
int diffIdle = coreCountersNew.getIdleTicks();
int diffActive = coreCountersNew.getActiveTicks();
assert (diffActive + diffIdle != 0);
- float load = diffActive / (float)(diffActive + diffIdle);
+ float load = diffActive / (float) (diffActive + diffIdle);
loads.put(coreId, load * 100.0f);
}
}
-
+
return loads;
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/ProcStatParser.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/ProcStatParser.java
index 09245ab6826..beedd9c562f 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/ProcStatParser.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/ProcStatParser.java
@@ -29,75 +29,76 @@ import java.util.regex.Pattern;
* TODO: extend to more than the tick counters.
* @see also http://www.linuxhowtos.org/System/procstat.htm
*/
-public class ProcStatParser {
-
- private ProcStatCounters cpuCoreCounters;
- private ProcStatCounters cpuCoreCountersOld;
-
- public ProcStatParser() {
-
- }
-
- /**
- * Read and parse the /proc/stat file given as param
- * @param fileName
- */
- public void parseStatFile(String fileName) throws FileNotFoundException, NumberFormatException {
- cpuCoreCountersOld = cpuCoreCounters;
-
- File statFile = new File(fileName);
- if (!statFile.exists()) {
- throw new FileNotFoundException();
- }
-
- cpuCoreCounters = new ProcStatCounters();
- BufferedReader reader = null;
- try {
- String coreId;
- Reader r = new InputStreamReader(new FileInputStream(statFile));
- reader = new BufferedReader(r);
- String line;
- // ex: "cpu0 2048635 3195 385292 66149962 895977 22 36130 0 0 0"
- // note: we intentionally do not catch the "cpu" (without a core number) line.
- Pattern patternCpu = Pattern.compile("^(cpu[0-9]+)(.*)$"); //$NON-NLS-1$
-
- while ((line = reader.readLine()) != null) {
- line = line.trim();
-
- // catch "cpu" lines from /proc/stat
- Matcher matcherCpu = patternCpu.matcher(line);
- if (matcherCpu.find()) {
- Vector<Integer> ticks = new Vector<Integer>();
- coreId = matcherCpu.group(1);
- // extract the counters for current cpu line
- for (String tick : matcherCpu.group(2).trim().split("\\s+")) { //$NON-NLS-1$
- ticks.add(Integer.parseInt(tick));
- }
-
- cpuCoreCounters.addTickCounters(coreId, ticks.toArray(new Integer[ticks.size()]));
- }
- }
+public class ProcStatParser {
- } catch (IOException e) {
- } finally {
- try {
- if (reader != null) {
- reader.close();
- }
- } catch (IOException e) {/* Don't care */}
- reader = null;
- }
+ private ProcStatCounters cpuCoreCounters;
+ private ProcStatCounters cpuCoreCountersOld;
- }
+ public ProcStatParser() {
- /**
- * @return a Map of the computed CPU/core loads. The load of individual
- * CPUs/cores can be found with keys "cpuN", where N is the CPU/core
- * number, starting with 0, as found in /proc/stat .
- *
- */
+ }
+
+ /**
+ * Read and parse the /proc/stat file given as param
+ * @param fileName
+ */
+ public void parseStatFile(String fileName) throws FileNotFoundException, NumberFormatException {
+ cpuCoreCountersOld = cpuCoreCounters;
+
+ File statFile = new File(fileName);
+ if (!statFile.exists()) {
+ throw new FileNotFoundException();
+ }
+
+ cpuCoreCounters = new ProcStatCounters();
+ BufferedReader reader = null;
+ try {
+ String coreId;
+ Reader r = new InputStreamReader(new FileInputStream(statFile));
+ reader = new BufferedReader(r);
+ String line;
+ // ex: "cpu0 2048635 3195 385292 66149962 895977 22 36130 0 0 0"
+ // note: we intentionally do not catch the "cpu" (without a core number) line.
+ Pattern patternCpu = Pattern.compile("^(cpu[0-9]+)(.*)$"); //$NON-NLS-1$
+
+ while ((line = reader.readLine()) != null) {
+ line = line.trim();
+
+ // catch "cpu" lines from /proc/stat
+ Matcher matcherCpu = patternCpu.matcher(line);
+ if (matcherCpu.find()) {
+ Vector<Integer> ticks = new Vector<Integer>();
+ coreId = matcherCpu.group(1);
+ // extract the counters for current cpu line
+ for (String tick : matcherCpu.group(2).trim().split("\\s+")) { //$NON-NLS-1$
+ ticks.add(Integer.parseInt(tick));
+ }
+
+ cpuCoreCounters.addTickCounters(coreId, ticks.toArray(new Integer[ticks.size()]));
+ }
+ }
+
+ } catch (IOException e) {
+ } finally {
+ try {
+ if (reader != null) {
+ reader.close();
+ }
+ } catch (IOException e) {
+ /* Don't care */}
+ reader = null;
+ }
+
+ }
+
+ /**
+ * @return a Map of the computed CPU/core loads. The load of individual
+ * CPUs/cores can be found with keys "cpuN", where N is the CPU/core
+ * number, starting with 0, as found in /proc/stat .
+ *
+ */
public ProcStatCoreLoads getCpuLoad() {
- return cpuCoreCounters.computeLoads(cpuCoreCountersOld);
- }
-
+ return cpuCoreCounters.computeLoads(cpuCoreCountersOld);
+ }
+
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/commands/ISelectNextTraceRecordHandler.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/commands/ISelectNextTraceRecordHandler.java
index 4c80c3ea169..c54cefb5241 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/commands/ISelectNextTraceRecordHandler.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/commands/ISelectNextTraceRecordHandler.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
@@ -17,7 +17,7 @@ import org.eclipse.debug.core.commands.IDebugCommandHandler;
/**
* Handler interface to select the next trace record.
- *
+ *
* @since 3.0
*/
public interface ISelectNextTraceRecordHandler extends IDebugCommandHandler {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/commands/ISelectPrevTraceRecordHandler.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/commands/ISelectPrevTraceRecordHandler.java
index aaaf373afff..bf7ff3721b7 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/commands/ISelectPrevTraceRecordHandler.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/commands/ISelectPrevTraceRecordHandler.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/launching/CoreBuildLocalDebugLaunchDelegate.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/launching/CoreBuildLocalDebugLaunchDelegate.java
index dfb1289be02..8af06ee4fac 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/launching/CoreBuildLocalDebugLaunchDelegate.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/launching/CoreBuildLocalDebugLaunchDelegate.java
@@ -92,7 +92,8 @@ public class CoreBuildLocalDebugLaunchDelegate extends CoreBuildLaunchConfigDele
try {
servicesLaunchSequence.get();
} catch (InterruptedException | ExecutionException e) {
- throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, Messages.CoreBuildLocalDebugLaunchDelegate_FailureLaunching, e));
+ throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
+ Messages.CoreBuildLocalDebugLaunchDelegate_FailureLaunching, e));
}
gdbLaunch.initializeControl();
@@ -108,16 +109,16 @@ public class CoreBuildLocalDebugLaunchDelegate extends CoreBuildLaunchConfigDele
tracker.dispose();
control.completeInitialization(
new RequestMonitorWithProgress(ImmediateExecutor.getInstance(), monitor) {
- @Override
- protected void handleCompleted() {
- if (isCanceled()) {
- rm.cancel();
- } else {
- rm.setStatus(getStatus());
- }
- rm.done();
- }
- });
+ @Override
+ protected void handleCompleted() {
+ if (isCanceled()) {
+ rm.cancel();
+ } else {
+ rm.setStatus(getStatus());
+ }
+ rm.done();
+ }
+ });
}
};
@@ -126,7 +127,8 @@ public class CoreBuildLocalDebugLaunchDelegate extends CoreBuildLaunchConfigDele
try {
ready.get();
} catch (ExecutionException | InterruptedException e) {
- throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, Messages.CoreBuildLocalDebugLaunchDelegate_FailureStart, e));
+ throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
+ Messages.CoreBuildLocalDebugLaunchDelegate_FailureStart, e));
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/memory/GdbMemoryAddressInfoRegistersRetrieval.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/memory/GdbMemoryAddressInfoRegistersRetrieval.java
index 933e01defb1..6baf5cbaf47 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/memory/GdbMemoryAddressInfoRegistersRetrieval.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/memory/GdbMemoryAddressInfoRegistersRetrieval.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
@@ -47,7 +47,8 @@ public class GdbMemoryAddressInfoRegistersRetrieval implements IGdbMemoryAddress
}
@Override
- public void itemsRequest(final IDMContext context, final IMemoryBlock memBlock, final DataRequestMonitor<IMemoryBlockAddressInfoItem[]> rm) {
+ public void itemsRequest(final IDMContext context, final IMemoryBlock memBlock,
+ final DataRequestMonitor<IMemoryBlockAddressInfoItem[]> rm) {
if (fSession == null || fSession.getExecutor() == null) {
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Initialization problem, invalid session")); //$NON-NLS-1$
return;
@@ -67,34 +68,35 @@ public class GdbMemoryAddressInfoRegistersRetrieval implements IGdbMemoryAddress
// Resolve register data
getRegistersData(service, registers,
new DataRequestMonitor<IRegisterDMData[]>(fSession.getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- final IRegisterDMData[] regBaseData = getData();
- // Resolve register values
- getRegisterValues(service, registers,
- new DataRequestMonitor<FormattedValueDMData[]>(fSession.getExecutor(),
- rm) {
@Override
protected void handleSuccess() {
- // Extract the register information needed to build the requested data items
- FormattedValueDMData[] regFormattedData = getData();
- String[] regNames = extractRegNames(regBaseData);
- String[] regValues = extractValues(regFormattedData);
-
- // Consolidate the Register information in a container class
- IMemoryBlockAddressInfoItem[] regDataContainers = createRegisterDataContainers(
- registers, regNames, regValues);
-
- // Filter or arrange data as needed
- regDataContainers = normalizeRegisterData(regDataContainers, memBlock);
-
- rm.setData(regDataContainers);
- rm.done();
- }
+ final IRegisterDMData[] regBaseData = getData();
+ // Resolve register values
+ getRegisterValues(service, registers,
+ new DataRequestMonitor<FormattedValueDMData[]>(fSession.getExecutor(),
+ rm) {
+ @Override
+ protected void handleSuccess() {
+ // Extract the register information needed to build the requested data items
+ FormattedValueDMData[] regFormattedData = getData();
+ String[] regNames = extractRegNames(regBaseData);
+ String[] regValues = extractValues(regFormattedData);
+
+ // Consolidate the Register information in a container class
+ IMemoryBlockAddressInfoItem[] regDataContainers = createRegisterDataContainers(
+ registers, regNames, regValues);
+
+ // Filter or arrange data as needed
+ regDataContainers = normalizeRegisterData(regDataContainers,
+ memBlock);
+
+ rm.setData(regDataContainers);
+ rm.done();
+ }
+ });
+
+ };
});
-
- };
- });
} else {
// no valid registers
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
@@ -108,13 +110,14 @@ public class GdbMemoryAddressInfoRegistersRetrieval implements IGdbMemoryAddress
}
}
- protected IMemoryBlockAddressInfoItem[] normalizeRegisterData(IMemoryBlockAddressInfoItem[] regDataContainers, IMemoryBlock memBlock) {
-// // The information provided may be applicable per memory space
-// String memSpaceId = ""; //$NON-NLS-1$
-// if (memBlock instanceof IMemorySpaceAwareMemoryBlock) {
-// memSpaceId = ((IMemorySpaceAwareMemoryBlock) memBlock).getMemorySpaceID();
-// }
-
+ protected IMemoryBlockAddressInfoItem[] normalizeRegisterData(IMemoryBlockAddressInfoItem[] regDataContainers,
+ IMemoryBlock memBlock) {
+ // // The information provided may be applicable per memory space
+ // String memSpaceId = ""; //$NON-NLS-1$
+ // if (memBlock instanceof IMemorySpaceAwareMemoryBlock) {
+ // memSpaceId = ((IMemorySpaceAwareMemoryBlock) memBlock).getMemorySpaceID();
+ // }
+
List<IMemoryBlockAddressInfoItem> items = new ArrayList<IMemoryBlockAddressInfoItem>();
// Remove all items with value zero
for (IMemoryBlockAddressInfoItem item : regDataContainers) {
@@ -127,7 +130,7 @@ public class GdbMemoryAddressInfoRegistersRetrieval implements IGdbMemoryAddress
return items.toArray(new IMemoryBlockAddressInfoItem[items.size()]);
}
-
+
@Override
public String getInfoType() {
return REGISTERS_INFO_TYPE;
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/memory/GdbMemoryAddressInfoVariablesRetrieval.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/memory/GdbMemoryAddressInfoVariablesRetrieval.java
index f25755a2f92..9b5274e8e0c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/memory/GdbMemoryAddressInfoVariablesRetrieval.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/memory/GdbMemoryAddressInfoVariablesRetrieval.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
@@ -171,12 +171,12 @@ public class GdbMemoryAddressInfoVariablesRetrieval implements IGdbMemoryAddress
for (IVariableDMContext localDMC : localsDMCs) {
stackFrameService.getVariableData(localDMC,
new DataRequestMonitor<IVariableDMData>(dsfExecutor, crm) {
- @Override
- public void handleSuccess() {
- localsDMData.add(getData());
- crm.done();
- }
- });
+ @Override
+ public void handleSuccess() {
+ localsDMData.add(getData());
+ crm.done();
+ }
+ });
countRM++;
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/memory/GdbMemoryBlock.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/memory/GdbMemoryBlock.java
index b6fcd8b35be..031751a793c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/memory/GdbMemoryBlock.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/memory/GdbMemoryBlock.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Texas Instruments, Freescale Semiconductor - initial API and implementation
* Alvaro Sanchez-Leon (Ericsson AB) - [Memory] Support 16 bit addressable size (Bug 426730)
@@ -40,28 +40,27 @@ import org.eclipse.debug.core.DebugPlugin;
/**
* A specialization of the DSF memory block implementation supporting memory
* spaces. The memory space support is provisional, thus this class is internal.
- *
+ *
* @author Alain Lee and John Cortell
*/
public class GdbMemoryBlock extends DsfMemoryBlock implements IMemorySpaceAwareMemoryBlock {
private final String fMemorySpaceID;
-
+
/**
* Constructor
*/
- public GdbMemoryBlock(DsfMemoryBlockRetrieval retrieval, IMemoryDMContext context,
- String modelId, String expression, BigInteger address,
- int word_size, long length, String memorySpaceID) {
+ public GdbMemoryBlock(DsfMemoryBlockRetrieval retrieval, IMemoryDMContext context, String modelId,
+ String expression, BigInteger address, int word_size, long length, String memorySpaceID) {
super(retrieval, context, modelId, expression, address, word_size, length);
fMemorySpaceID = (memorySpaceID != null && !memorySpaceID.isEmpty()) ? memorySpaceID : null;
- assert memorySpaceID == null || !memorySpaceID.isEmpty(); // callers shouldn't be passing in an empty string
-
- //TODO: remove the memorySpaceID parameter from this method
+ assert memorySpaceID == null || !memorySpaceID.isEmpty(); // callers shouldn't be passing in an empty string
+
+ //TODO: remove the memorySpaceID parameter from this method
//after making sure it's not used in earlier implementations
//in the mean time check for consistency
- if(memorySpaceID != null) {
- assert(context instanceof IMemorySpaceDMContext);
+ if (memorySpaceID != null) {
+ assert (context instanceof IMemorySpaceDMContext);
assert memorySpaceID.equals(((IMemorySpaceDMContext) context).getMemorySpaceId());
} else {
if (context instanceof IMemorySpaceDMContext) {
@@ -79,13 +78,13 @@ public class GdbMemoryBlock extends DsfMemoryBlock implements IMemorySpaceAwareM
private final String fMemorySpaceId;
public MemorySpaceDMContext(String sessionId, String memorySpaceId, IDMContext parent) {
- super(sessionId, new IDMContext[] {parent});
+ super(sessionId, new IDMContext[] { parent });
// A memorySpaceDMContext should not be created if the memorySpaceId is not valid.
// However we need the id to calculate the hash, therefore we can not leave it as null
- assert(memorySpaceId != null);
- fMemorySpaceId = memorySpaceId == null ? "": memorySpaceId; //$NON-NLS-1$
+ assert (memorySpaceId != null);
+ fMemorySpaceId = memorySpaceId == null ? "" : memorySpaceId; //$NON-NLS-1$
}
-
+
/* (non-Javadoc)
* @see org.eclipse.cdt.dsf.debug.service.IMemorySpaces.IMemorySpaceDMContext#getMemorySpaceId()
*/
@@ -99,29 +98,29 @@ public class GdbMemoryBlock extends DsfMemoryBlock implements IMemorySpaceAwareM
*/
@Override
public boolean equals(Object other) {
- if (other instanceof MemorySpaceDMContext) {
- MemorySpaceDMContext dmc = (MemorySpaceDMContext) other;
- return (super.baseEquals(other)) && (dmc.fMemorySpaceId.equals(fMemorySpaceId));
- } else {
- return false;
- }
+ if (other instanceof MemorySpaceDMContext) {
+ MemorySpaceDMContext dmc = (MemorySpaceDMContext) other;
+ return (super.baseEquals(other)) && (dmc.fMemorySpaceId.equals(fMemorySpaceId));
+ } else {
+ return false;
+ }
}
/* (non-Javadoc)
* @see org.eclipse.cdt.dsf.datamodel.AbstractDMContext#hashCode()
*/
@Override
- public int hashCode() {
- return super.baseHashCode() + fMemorySpaceId.hashCode();
+ public int hashCode() {
+ return super.baseHashCode() + fMemorySpaceId.hashCode();
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return baseToString() + ".memoryspace[" + fMemorySpaceId + ']'; //$NON-NLS-1$
}
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return baseToString() + ".memoryspace[" + fMemorySpaceId + ']'; //$NON-NLS-1$
- }
}
/* (non-Javadoc)
@@ -135,14 +134,14 @@ public class GdbMemoryBlock extends DsfMemoryBlock implements IMemorySpaceAwareM
/**
* Override this method to qualify the expression with the memory space, if
* applicable.
- *
+ *
* @see org.eclipse.cdt.dsf.debug.model.DsfMemoryBlock#getExpression()
*/
@Override
public String getExpression() {
if (fMemorySpaceID != null) {
assert !fMemorySpaceID.isEmpty();
- GdbMemoryBlockRetrieval retrieval = (GdbMemoryBlockRetrieval)getMemoryBlockRetrieval();
+ GdbMemoryBlockRetrieval retrieval = (GdbMemoryBlockRetrieval) getMemoryBlockRetrieval();
return retrieval.encodeAddress(super.getExpression(), fMemorySpaceID);
}
return super.getExpression();
@@ -150,26 +149,26 @@ public class GdbMemoryBlock extends DsfMemoryBlock implements IMemorySpaceAwareM
@Override
public int getAddressSize() throws DebugException {
- GdbMemoryBlockRetrieval retrieval = (GdbMemoryBlockRetrieval)getMemoryBlockRetrieval();
+ GdbMemoryBlockRetrieval retrieval = (GdbMemoryBlockRetrieval) getMemoryBlockRetrieval();
- IGDBMemory memoryService = (IGDBMemory)retrieval.getServiceTracker().getService();
+ IGDBMemory memoryService = (IGDBMemory) retrieval.getServiceTracker().getService();
if (memoryService != null) {
return memoryService.getAddressSize(getContext());
}
-
- throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.REQUEST_FAILED, Messages.Err_MemoryServiceNotAvailable, null));
+
+ throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.REQUEST_FAILED,
+ Messages.Err_MemoryServiceNotAvailable, null));
}
-
+
@Override
@DsfServiceEventHandler
public void eventDispatched(ISuspendedDMEvent e) {
super.eventDispatched(e);
- if (e.getReason() == StateChangeReason.BREAKPOINT ||
- e.getReason() == StateChangeReason.EVENT_BREAKPOINT ||
- e.getReason() == StateChangeReason.WATCHPOINT) {
- // If the session is suspended because of a breakpoint we need to
+ if (e.getReason() == StateChangeReason.BREAKPOINT || e.getReason() == StateChangeReason.EVENT_BREAKPOINT
+ || e.getReason() == StateChangeReason.WATCHPOINT) {
+ // If the session is suspended because of a breakpoint we need to
// fire DebugEvent.SUSPEND to force update for the "On Breakpoint" update mode.
- // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=406999.
+ // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=406999.
DebugEvent debugEvent = new DebugEvent(this, DebugEvent.SUSPEND, DebugEvent.BREAKPOINT);
DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] { debugEvent });
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/memory/GdbMemoryBlockRetrieval.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/memory/GdbMemoryBlockRetrieval.java
index f099215a084..087efd478c0 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/memory/GdbMemoryBlockRetrieval.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/memory/GdbMemoryBlockRetrieval.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Texas Instruments, Freescale Semiconductor - initial API and implementation
* Alvaro Sanchez-Leon (Ericsson AB) - Each memory context needs a different MemoryRetrieval (Bug 250323)
@@ -65,47 +65,43 @@ import com.ibm.icu.text.MessageFormat;
* A specialization of the DSF memory block retrieval implementation supporting
* memory spaces. The memory space support is provisional, thus this class is
* internal.
- *
+ *
* @author Alain Lee and John Cortell
*/
-public class GdbMemoryBlockRetrieval extends DsfMemoryBlockRetrieval implements
- IMemorySpaceAwareMemoryBlockRetrieval {
+public class GdbMemoryBlockRetrieval extends DsfMemoryBlockRetrieval implements IMemorySpaceAwareMemoryBlockRetrieval {
- private final ServiceTracker<IMemorySpaces, IMemorySpaces> fMemorySpaceServiceTracker;
+ private final ServiceTracker<IMemorySpaces, IMemorySpaces> fMemorySpaceServiceTracker;
// No need to use the constants in our base class. Serializing and
// recreating the blocks is done entirely by us
- private static final String MEMORY_BLOCK_EXPRESSION_LIST = "memoryBlockExpressionList"; //$NON-NLS-1$
- private static final String ATTR_EXPRESSION_LIST_CONTEXT = "context"; //$NON-NLS-1$
- private static final String MEMORY_BLOCK_EXPRESSION = "gdbmemoryBlockExpression"; //$NON-NLS-1$
- private static final String ATTR_MEMORY_BLOCK_EXPR_LABEL = "label"; //$NON-NLS-1$
- private static final String ATTR_MEMORY_BLOCK_EXPR_ADDRESS = "address"; //$NON-NLS-1$
- private static final String ATTR_MEMORY_BLOCK_MEMORY_SPACE_ID = "memorySpaceID"; //$NON-NLS-1$
-
- /** see comment in base class */
- private static final String CONTEXT_RESERVED = "reserved-for-future-use"; //$NON-NLS-1$
+ private static final String MEMORY_BLOCK_EXPRESSION_LIST = "memoryBlockExpressionList"; //$NON-NLS-1$
+ private static final String ATTR_EXPRESSION_LIST_CONTEXT = "context"; //$NON-NLS-1$
+ private static final String MEMORY_BLOCK_EXPRESSION = "gdbmemoryBlockExpression"; //$NON-NLS-1$
+ private static final String ATTR_MEMORY_BLOCK_EXPR_LABEL = "label"; //$NON-NLS-1$
+ private static final String ATTR_MEMORY_BLOCK_EXPR_ADDRESS = "address"; //$NON-NLS-1$
+ private static final String ATTR_MEMORY_BLOCK_MEMORY_SPACE_ID = "memorySpaceID"; //$NON-NLS-1$
+
+ /** see comment in base class */
+ private static final String CONTEXT_RESERVED = "reserved-for-future-use"; //$NON-NLS-1$
/**
* Constructor
*/
- public GdbMemoryBlockRetrieval(String modelId, ILaunchConfiguration config,
- DsfSession session) throws DebugException {
+ public GdbMemoryBlockRetrieval(String modelId, ILaunchConfiguration config, DsfSession session)
+ throws DebugException {
super(modelId, config, session);
-
- BundleContext bundle = GdbPlugin.getBundleContext();
-
+ BundleContext bundle = GdbPlugin.getBundleContext();
+
// Create a tracker for the memory spaces service
- String filter = DsfServices.createServiceFilter(IMemorySpaces.class, session.getId());
- try {
- fMemorySpaceServiceTracker = new ServiceTracker<>(
- bundle, bundle.createFilter(filter), null);
+ String filter = DsfServices.createServiceFilter(IMemorySpaces.class, session.getId());
+ try {
+ fMemorySpaceServiceTracker = new ServiceTracker<>(bundle, bundle.createFilter(filter), null);
} catch (InvalidSyntaxException e) {
- throw new DebugException(new Status(IStatus.ERROR,
- GdbPlugin.PLUGIN_ID, DebugException.INTERNAL_ERROR,
+ throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.INTERNAL_ERROR,
"Error creating service filter.", e)); //$NON-NLS-1$
}
-
+
fMemorySpaceServiceTracker.open();
}
@@ -114,58 +110,59 @@ public class GdbMemoryBlockRetrieval extends DsfMemoryBlockRetrieval implements
*/
@Override
public IMemoryBlockExtension getExtendedMemoryBlock(String expression, Object context) throws DebugException {
-
+
String memorySpaceID = null;
-
+
// Determine if the expression has memory space information
IDMContext dmc = null;
if (context instanceof IDMContext) {
dmc = (IDMContext) context;
} else {
- if (context instanceof IAdaptable) {
- dmc = ((IAdaptable)context).getAdapter(IDMContext.class);
- }
+ if (context instanceof IAdaptable) {
+ dmc = ((IAdaptable) context).getAdapter(IDMContext.class);
+ }
}
-
+
if (dmc != null) {
DecodeResult result = decodeMemorySpaceExpression(dmc, expression);
expression = result.getExpression();
memorySpaceID = result.getMemorySpaceId();
}
-
+
return getMemoryBlock(expression, context, memorySpaceID);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.core.model.provisional.IMemorySpaceAwareMemoryBlockRetrieval#getExtendedMemoryBlock(java.lang.String, java.lang.Object, java.lang.String)
*/
@Override
- public IMemorySpaceAwareMemoryBlock getMemoryBlock(String expression, Object context, String memorySpaceID) throws DebugException {
- // Drill for the actual DMC
- IMemoryDMContext memoryDmc = null;
- IDMContext dmc = null;
- if (context instanceof IAdaptable) {
- dmc = ((IAdaptable)context).getAdapter(IDMContext.class);
- if (dmc != null) {
- memoryDmc = DMContexts.getAncestorOfType(dmc, IMemoryDMContext.class);
- }
- }
-
- if (memoryDmc == null) {
- return null;
- }
-
- //Adjust the memory context to use memory spaces when available
- if (memoryDmc instanceof IMemorySpaceDMContext) {
- // The memory space ids should match
- assert(memorySpaceID != null);
- assert(memorySpaceID.equals(((IMemorySpaceDMContext)memoryDmc).getMemorySpaceId()));
- } else {
- if (memorySpaceID != null && memorySpaceID.length() > 0) {
- memoryDmc = new MemorySpaceDMContext(getSession().getId(), memorySpaceID, memoryDmc);
- }
- }
-
+ public IMemorySpaceAwareMemoryBlock getMemoryBlock(String expression, Object context, String memorySpaceID)
+ throws DebugException {
+ // Drill for the actual DMC
+ IMemoryDMContext memoryDmc = null;
+ IDMContext dmc = null;
+ if (context instanceof IAdaptable) {
+ dmc = ((IAdaptable) context).getAdapter(IDMContext.class);
+ if (dmc != null) {
+ memoryDmc = DMContexts.getAncestorOfType(dmc, IMemoryDMContext.class);
+ }
+ }
+
+ if (memoryDmc == null) {
+ return null;
+ }
+
+ //Adjust the memory context to use memory spaces when available
+ if (memoryDmc instanceof IMemorySpaceDMContext) {
+ // The memory space ids should match
+ assert (memorySpaceID != null);
+ assert (memorySpaceID.equals(((IMemorySpaceDMContext) memoryDmc).getMemorySpaceId()));
+ } else {
+ if (memorySpaceID != null && memorySpaceID.length() > 0) {
+ memoryDmc = new MemorySpaceDMContext(getSession().getId(), memorySpaceID, memoryDmc);
+ }
+ }
+
// The block start address (supports 64-bit processors)
BigInteger blockAddress;
@@ -195,7 +192,7 @@ public class GdbMemoryBlockRetrieval extends DsfMemoryBlockRetrieval implements
offset = 1;
}
// Now, try to parse the expression. If a NumberFormatException is
- // thrown, then it wasn't a simple numerical expression and we go
+ // thrown, then it wasn't a simple numerical expression and we go
// to plan B (attempt an expression evaluation)
blockAddress = new BigInteger(expression.substring(offset), base);
@@ -213,25 +210,26 @@ public class GdbMemoryBlockRetrieval extends DsfMemoryBlockRetrieval implements
// check for block address exceeding maximum allowed address value
int addressSize = getAddressSize(memoryDmc);
- BigInteger endAddress = BigInteger.ONE.shiftLeft(addressSize*8).subtract(BigInteger.ONE);
+ BigInteger endAddress = BigInteger.ONE.shiftLeft(addressSize * 8).subtract(BigInteger.ONE);
if (endAddress.compareTo(blockAddress) < 0) {
- throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1,
+ throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1,
MessageFormat.format(Messages.Err_ExceedsMaxAddress, expression, endAddress.toString(16)), null));
}
-
+
/*
* At this point, we only resolved the requested memory block
* start address and we have no idea of the block's length.
- *
+ *
* The renderer will provide this information when it calls
* getBytesFromAddress() i.e. after the memory block holder has
* been instantiated.
- *
+ *
* The down side is that every time we switch renderer, for the
* same memory block, a trip to the target could result. However,
* the memory request cache should save the day.
*/
- return new GdbMemoryBlock(this, memoryDmc, getModelId(), expression, blockAddress, getAddressableSize(memoryDmc), 0, memorySpaceID);
+ return new GdbMemoryBlock(this, memoryDmc, getModelId(), expression, blockAddress,
+ getAddressableSize(memoryDmc), 0, memorySpaceID);
}
/*
@@ -240,63 +238,62 @@ public class GdbMemoryBlockRetrieval extends DsfMemoryBlockRetrieval implements
*/
@Override
public void getMemorySpaces(final Object context, final GetMemorySpacesRequest request) {
- try {
- getExecutor().execute(new DsfRunnable() {
- @Override
- public void run() {
- IDMContext dmc = null;
- if (context instanceof IAdaptable) {
- dmc = ((IAdaptable)context).getAdapter(IDMContext.class);
- if (dmc != null) {
- IMemorySpaces service = fMemorySpaceServiceTracker.getService();
- if (service != null) {
- service.getMemorySpaces(
- dmc,
- new DataRequestMonitor<String[]>(getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- // Store the result
- if (isSuccess()) {
- request.setMemorySpaces(getData());
- }
- else {
- request.setStatus(getStatus());
- }
- request.done();
- }
- });
- return;
- }
- }
- }
-
- // If we get here, something didn't work as expected
- request.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.INTERNAL_ERROR, "Unable to get memory spaces", null)); //$NON-NLS-1$
- request.done();
- }
- });
- } catch (RejectedExecutionException e) {
- request.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.INTERNAL_ERROR, "Unable to get memory spaces", null)); //$NON-NLS-1$
- request.done();
- }
+ try {
+ getExecutor().execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ IDMContext dmc = null;
+ if (context instanceof IAdaptable) {
+ dmc = ((IAdaptable) context).getAdapter(IDMContext.class);
+ if (dmc != null) {
+ IMemorySpaces service = fMemorySpaceServiceTracker.getService();
+ if (service != null) {
+ service.getMemorySpaces(dmc, new DataRequestMonitor<String[]>(getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ // Store the result
+ if (isSuccess()) {
+ request.setMemorySpaces(getData());
+ } else {
+ request.setStatus(getStatus());
+ }
+ request.done();
+ }
+ });
+ return;
+ }
+ }
+ }
+
+ // If we get here, something didn't work as expected
+ request.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.INTERNAL_ERROR,
+ "Unable to get memory spaces", null)); //$NON-NLS-1$
+ request.done();
+ }
+ });
+ } catch (RejectedExecutionException e) {
+ request.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.INTERNAL_ERROR,
+ "Unable to get memory spaces", null)); //$NON-NLS-1$
+ request.done();
+ }
}
-
+
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.core.model.provisional.IMemorySpaceAwareMemoryBlockRetrieval#encodeAddress(java.lang.String, java.lang.String)
*/
@Override
public String encodeAddress(String expression, String memorySpaceID) {
String result = null;
- IMemorySpaces service = fMemorySpaceServiceTracker.getService();
- if (service != null) {
- // the service can tell us to use our default encoding by returning null
+ IMemorySpaces service = fMemorySpaceServiceTracker.getService();
+ if (service != null) {
+ // the service can tell us to use our default encoding by returning null
result = service.encodeAddress(expression, memorySpaceID);
- }
- if (result == null) {
- // default encoding
- result = memorySpaceID + ':' + expression;
- }
- return result;
+ }
+ if (result == null) {
+ // default encoding
+ result = memorySpaceID + ':' + expression;
+ }
+ return result;
}
/* (non-Javadoc)
@@ -304,22 +301,27 @@ public class GdbMemoryBlockRetrieval extends DsfMemoryBlockRetrieval implements
*/
@Override
public DecodeResult decodeAddress(String str) throws CoreException {
- IMemorySpaces service = fMemorySpaceServiceTracker.getService();
- if (service != null) {
- final IMemorySpaces.DecodeResult result = service.decodeAddress(str);
- if (result != null) { // service can return null to tell use to use default decoding
- return new DecodeResult() {
- @Override
- public String getMemorySpaceId() { return result.getMemorySpaceId(); }
- @Override
- public String getExpression() { return result.getExpression(); }
+ IMemorySpaces service = fMemorySpaceServiceTracker.getService();
+ if (service != null) {
+ final IMemorySpaces.DecodeResult result = service.decodeAddress(str);
+ if (result != null) { // service can return null to tell use to use default decoding
+ return new DecodeResult() {
+ @Override
+ public String getMemorySpaceId() {
+ return result.getMemorySpaceId();
+ }
+
+ @Override
+ public String getExpression() {
+ return result.getExpression();
+ }
};
- }
- }
-
- // default decoding
- final String memorySpaceID;
- final String expression;
+ }
+ }
+
+ // default decoding
+ final String memorySpaceID;
+ final String expression;
int index = str.indexOf(':');
if (index == -1) {
//Unknown parsing, may not use memory spaces
@@ -327,48 +329,54 @@ public class GdbMemoryBlockRetrieval extends DsfMemoryBlockRetrieval implements
expression = str;
} else {
memorySpaceID = str.substring(0, index);
- expression = (index < str.length()-1) ? str.substring(index+1) : ""; //$NON-NLS-1$
+ expression = (index < str.length() - 1) ? str.substring(index + 1) : ""; //$NON-NLS-1$
}
return new DecodeResult() {
@Override
- public String getMemorySpaceId() { return memorySpaceID; }
+ public String getMemorySpaceId() {
+ return memorySpaceID;
+ }
+
@Override
- public String getExpression() { return expression; }
+ public String getExpression() {
+ return expression;
+ }
};
-
+
}
-
+
/**
* Decode the received expression by
* First, decoding the string directly
* Second, if the memory space is not found in the expression string, use the Memory service to use some help from gdb
*/
- private DecodeResult decodeMemorySpaceExpression(final IDMContext dmc, final String expression) throws DebugException {
+ private DecodeResult decodeMemorySpaceExpression(final IDMContext dmc, final String expression)
+ throws DebugException {
DecodeResult decodeResult;
try {
decodeResult = decodeAddress(expression);
} catch (CoreException e1) {
throw new DebugException(e1.getStatus());
}
-
+
if (decodeResult.getMemorySpaceId() != null) {
//memory space found in expression
return decodeResult;
}
-
+
//
- final IMemorySpaces service = fMemorySpaceServiceTracker.getService();
+ final IMemorySpaces service = fMemorySpaceServiceTracker.getService();
if (service instanceof IMemorySpaces2) {
final IMemorySpaces2 memSpaceService = (IMemorySpaces2) service;
-
+
Query<IMemorySpaces.DecodeResult> query = new Query<IMemorySpaces.DecodeResult>() {
@Override
protected void execute(final DataRequestMonitor<IMemorySpaces.DecodeResult> drm) {
memSpaceService.decodeExpression(dmc, expression, drm);
}
};
-
+
getExecutor().execute(query);
try {
final IMemorySpaces.DecodeResult result = query.get();
@@ -377,33 +385,30 @@ public class GdbMemoryBlockRetrieval extends DsfMemoryBlockRetrieval implements
public String getMemorySpaceId() {
return result.getMemorySpaceId();
}
-
+
@Override
public String getExpression() {
return result.getExpression();
}
};
} catch (InterruptedException e) {
- throw new DebugException(new Status(IStatus.ERROR,
- GdbPlugin.PLUGIN_ID, DebugException.INTERNAL_ERROR,
+ throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.INTERNAL_ERROR,
"Error evaluating memory space expression (InterruptedException).", e)); //$NON-NLS-1$
} catch (ExecutionException e) {
- throw new DebugException(new Status(IStatus.ERROR,
- GdbPlugin.PLUGIN_ID, DebugException.INTERNAL_ERROR,
+ throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.INTERNAL_ERROR,
"Error evaluating memory space expression (ExecutionException).", e)); //$NON-NLS-1$
}
-
- }
-
+
+ }
+
return decodeResult;
}
-
-
+
ServiceTracker<IMemorySpaces, IMemorySpaces> getMemorySpaceServiceTracker() {
return fMemorySpaceServiceTracker;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.cdt.dsf.debug.model.DsfMemoryBlockRetrieval#getMemento()
*/
@@ -412,29 +417,28 @@ public class GdbMemoryBlockRetrieval extends DsfMemoryBlockRetrieval implements
IMemoryBlock[] blocks = DebugPlugin.getDefault().getMemoryBlockManager().getMemoryBlocks(this);
Document document = DebugPlugin.newDocument();
Element expressionList = document.createElement(MEMORY_BLOCK_EXPRESSION_LIST);
- expressionList.setAttribute(ATTR_EXPRESSION_LIST_CONTEXT, CONTEXT_RESERVED);
+ expressionList.setAttribute(ATTR_EXPRESSION_LIST_CONTEXT, CONTEXT_RESERVED);
for (IMemoryBlock block : blocks) {
if (block instanceof IMemoryBlockExtension) {
IMemoryBlockExtension memoryBlock = (IMemoryBlockExtension) block;
Element expression = document.createElement(MEMORY_BLOCK_EXPRESSION);
expression.setAttribute(ATTR_MEMORY_BLOCK_EXPR_ADDRESS, memoryBlock.getBigBaseAddress().toString());
if (block instanceof IMemorySpaceAwareMemoryBlock) {
- String memorySpaceID = ((IMemorySpaceAwareMemoryBlock)memoryBlock).getMemorySpaceID();
+ String memorySpaceID = ((IMemorySpaceAwareMemoryBlock) memoryBlock).getMemorySpaceID();
if (memorySpaceID != null) {
expression.setAttribute(ATTR_MEMORY_BLOCK_MEMORY_SPACE_ID, memorySpaceID);
-
+
// What we return from GdbMemoryBlock#getExpression()
// is the encoded representation. We need to decode it
// to get the original expression used to create the block
- DecodeResult result = ((IMemorySpaceAwareMemoryBlockRetrieval)memoryBlock.getMemoryBlockRetrieval()).decodeAddress(memoryBlock.getExpression());
+ DecodeResult result = ((IMemorySpaceAwareMemoryBlockRetrieval) memoryBlock
+ .getMemoryBlockRetrieval()).decodeAddress(memoryBlock.getExpression());
expression.setAttribute(ATTR_MEMORY_BLOCK_EXPR_LABEL, result.getExpression());
- }
- else {
+ } else {
expression.setAttribute(ATTR_MEMORY_BLOCK_EXPR_LABEL, memoryBlock.getExpression());
}
- }
- else {
- assert false; // should never happen (see getExtendedMemoryBlock()), but we can handle it.
+ } else {
+ assert false; // should never happen (see getExtendedMemoryBlock()), but we can handle it.
expression.setAttribute(ATTR_MEMORY_BLOCK_EXPR_LABEL, memoryBlock.getExpression());
}
expressionList.appendChild(expression);
@@ -443,61 +447,66 @@ public class GdbMemoryBlockRetrieval extends DsfMemoryBlockRetrieval implements
document.appendChild(expressionList);
return DebugPlugin.serializeDocument(document);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.cdt.dsf.debug.model.DsfMemoryBlockRetrieval#createBlocksFromConfiguration(org.eclipse.cdt.dsf.debug.service.IMemory.IMemoryDMContext, java.lang.String)
*/
@Override
- protected void createBlocksFromConfiguration(final IMemoryDMContext memoryCtx, String memento) throws CoreException {
+ protected void createBlocksFromConfiguration(final IMemoryDMContext memoryCtx, String memento)
+ throws CoreException {
- // Parse the memento and validate its type
- Element root = DebugPlugin.parseDocument(memento);
+ // Parse the memento and validate its type
+ Element root = DebugPlugin.parseDocument(memento);
if (!root.getNodeName().equalsIgnoreCase(MEMORY_BLOCK_EXPRESSION_LIST)) {
- IStatus status = new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugPlugin.INTERNAL_ERROR,
- "Memory monitor initialization: invalid memento", null);//$NON-NLS-1$
- throw new CoreException(status);
+ IStatus status = new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugPlugin.INTERNAL_ERROR,
+ "Memory monitor initialization: invalid memento", null);//$NON-NLS-1$
+ throw new CoreException(status);
+ }
+
+ // Process the block list specific to this memory context
+ // FIXME: (Bug228573) We only process the first entry...
+ if (root.getAttribute(ATTR_EXPRESSION_LIST_CONTEXT).equals(CONTEXT_RESERVED)) {
+ List<IMemoryBlock> blocks = new ArrayList<IMemoryBlock>();
+ NodeList expressionList = root.getChildNodes();
+ int length = expressionList.getLength();
+ for (int i = 0; i < length; ++i) {
+ IMemoryDMContext memoryContext = memoryCtx;
+ Node node = expressionList.item(i);
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element entry = (Element) node;
+ if (entry.getNodeName().equalsIgnoreCase(MEMORY_BLOCK_EXPRESSION)) {
+ String label = entry.getAttribute(ATTR_MEMORY_BLOCK_EXPR_LABEL);
+ String address = entry.getAttribute(ATTR_MEMORY_BLOCK_EXPR_ADDRESS);
+
+ String memorySpaceID = null;
+ if (entry.hasAttribute(ATTR_MEMORY_BLOCK_MEMORY_SPACE_ID)) {
+ memorySpaceID = entry.getAttribute(ATTR_MEMORY_BLOCK_MEMORY_SPACE_ID);
+ if (memorySpaceID.length() == 0) {
+ memorySpaceID = null;
+ assert false : "should have either no memory space or a valid (non-empty) ID"; //$NON-NLS-1$
+ } else {
+ if (memoryContext instanceof IMemorySpaceDMContext) {
+ //The context is already a memory space context, make sure the ids are consistent
+ assert (((IMemorySpaceDMContext) memoryContext).getMemorySpaceId()
+ .equals(memorySpaceID));
+ } else {
+ //Use a memory space context if the memory space id is valid
+ memoryContext = new MemorySpaceDMContext(getSession().getId(), memorySpaceID,
+ memoryContext);
+ }
+ }
+ }
+
+ BigInteger blockAddress = new BigInteger(address);
+ DsfMemoryBlock block = new GdbMemoryBlock(this, memoryContext, getModelId(), label,
+ blockAddress, getAddressableSize(memoryContext), 0, memorySpaceID);
+ blocks.add(block);
+ }
+ }
+ }
+ DebugPlugin.getDefault().getMemoryBlockManager()
+ .addMemoryBlocks(blocks.toArray(new IMemoryBlock[blocks.size()]));
}
-
- // Process the block list specific to this memory context
- // FIXME: (Bug228573) We only process the first entry...
- if (root.getAttribute(ATTR_EXPRESSION_LIST_CONTEXT).equals(CONTEXT_RESERVED)) {
- List<IMemoryBlock> blocks = new ArrayList<IMemoryBlock>();
- NodeList expressionList = root.getChildNodes();
- int length = expressionList.getLength();
- for (int i = 0; i < length; ++i) {
- IMemoryDMContext memoryContext = memoryCtx;
- Node node = expressionList.item(i);
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element entry = (Element) node;
- if (entry.getNodeName().equalsIgnoreCase(MEMORY_BLOCK_EXPRESSION)) {
- String label = entry.getAttribute(ATTR_MEMORY_BLOCK_EXPR_LABEL);
- String address = entry.getAttribute(ATTR_MEMORY_BLOCK_EXPR_ADDRESS);
-
- String memorySpaceID = null;
- if (entry.hasAttribute(ATTR_MEMORY_BLOCK_MEMORY_SPACE_ID)) {
- memorySpaceID = entry.getAttribute(ATTR_MEMORY_BLOCK_MEMORY_SPACE_ID);
- if (memorySpaceID.length() == 0) {
- memorySpaceID = null;
- assert false : "should have either no memory space or a valid (non-empty) ID"; //$NON-NLS-1$
- } else {
- if (memoryContext instanceof IMemorySpaceDMContext) {
- //The context is already a memory space context, make sure the ids are consistent
- assert(((IMemorySpaceDMContext) memoryContext).getMemorySpaceId().equals(memorySpaceID));
- } else {
- //Use a memory space context if the memory space id is valid
- memoryContext = new MemorySpaceDMContext(getSession().getId(), memorySpaceID, memoryContext);
- }
- }
- }
-
- BigInteger blockAddress = new BigInteger(address);
- DsfMemoryBlock block = new GdbMemoryBlock(this, memoryContext, getModelId(), label, blockAddress, getAddressableSize(memoryContext), 0, memorySpaceID);
- blocks.add(block);
- }
- }
- }
- DebugPlugin.getDefault().getMemoryBlockManager().addMemoryBlocks( blocks.toArray(new IMemoryBlock[blocks.size()]));
- }
}
/* (non-Javadoc)
@@ -506,25 +515,24 @@ public class GdbMemoryBlockRetrieval extends DsfMemoryBlockRetrieval implements
@Override
public boolean creatingBlockRequiresMemorySpaceID() {
IMemorySpaces service = fMemorySpaceServiceTracker.getService();
- if (service != null) {
- return service.creatingBlockRequiresMemorySpaceID();
- }
+ if (service != null) {
+ return service.creatingBlockRequiresMemorySpaceID();
+ }
return false;
}
-
+
private int getAddressableSize(IMemoryDMContext context) {
- IGDBMemory2 memoryService = (IGDBMemory2) getServiceTracker()
- .getService();
-
+ IGDBMemory2 memoryService = (IGDBMemory2) getServiceTracker().getService();
+
if (memoryService != null && context != null) {
return memoryService.getAddressableSize(context);
}
-
+
return super.getAddressableSize();
}
-
+
private int getAddressSize(IMemoryDMContext context) {
- IGDBMemory memoryService = (IGDBMemory)getServiceTracker().getService();
+ IGDBMemory memoryService = (IGDBMemory) getServiceTracker().getService();
if (memoryService != null && context != null) {
return memoryService.getAddressSize(context);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/memory/GdbMemoryBlockRetrievalManager.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/memory/GdbMemoryBlockRetrievalManager.java
index a4c3494e60d..e36ebe719ca 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/memory/GdbMemoryBlockRetrievalManager.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/memory/GdbMemoryBlockRetrievalManager.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Alvaro Sanchez-Leon (Ericsson AB) - Each memory context needs a different MemoryRetrieval (Bug 250323)
*******************************************************************************/
@@ -31,16 +31,17 @@ public class GdbMemoryBlockRetrievalManager extends MemoryBlockRetrievalManager
* @see org.eclipse.cdt.dsf.debug.internal.provisional.model.MemoryBlockRetrievalManager#createMemoryBlockRetrieval(java.lang.String, org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.cdt.dsf.service.DsfSession)
*/
@Override
- protected IMemoryBlockRetrieval createMemoryBlockRetrieval(String model, ILaunchConfiguration config, DsfSession session) {
+ protected IMemoryBlockRetrieval createMemoryBlockRetrieval(String model, ILaunchConfiguration config,
+ DsfSession session) {
DsfMemoryBlockRetrieval memRetrieval = null;
-
+
try {
memRetrieval = new GdbMemoryBlockRetrieval(model, config, session);
} catch (DebugException e) {
GdbPlugin.getDefault().getLog().log(e.getStatus());
}
-
+
return memRetrieval;
}
-
+
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/memory/MemoryBlockAddressInfoItem.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/memory/MemoryBlockAddressInfoItem.java
index dc2e691f09c..0a065884792 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/memory/MemoryBlockAddressInfoItem.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/memory/MemoryBlockAddressInfoItem.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/memory/Messages.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/memory/Messages.java
index 28a925fd9fe..6d5057d5959 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/memory/Messages.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/memory/Messages.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Freescale Semiconductor - initial API and implementation
*******************************************************************************/
@@ -20,13 +20,13 @@ import org.eclipse.osgi.util.NLS;
* @noinstantiate This class is not intended to be instantiated by clients.
*/
public class Messages extends NLS {
- static {
- NLS.initializeMessages("org.eclipse.cdt.dsf.gdb.internal.memory.messages", Messages.class); //$NON-NLS-1$
- }
+ static {
+ NLS.initializeMessages("org.eclipse.cdt.dsf.gdb.internal.memory.messages", Messages.class); //$NON-NLS-1$
+ }
- public static String Err_ExceedsMaxAddress;
+ public static String Err_ExceedsMaxAddress;
public static String Err_MemoryServiceNotAvailable;
- public static String Err_MemoryReadFailed;
- public static String Err_MemoryWriteFailed;
- public static String Err_InvalidEncodedAddress;
+ public static String Err_MemoryReadFailed;
+ public static String Err_MemoryWriteFailed;
+ public static String Err_InvalidEncodedAddress;
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/GDBFocusSynchronizer.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/GDBFocusSynchronizer.java
index 7c9bf3a9011..189c8e31eab 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/GDBFocusSynchronizer.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/GDBFocusSynchronizer.java
@@ -51,47 +51,44 @@ import org.eclipse.core.runtime.Status;
import org.osgi.framework.BundleContext;
/**
- * This service keeps synchronized the CDT Debug View selection and GDB's
- * internal focus.
+ * This service keeps synchronized the CDT Debug View selection and GDB's
+ * internal focus.
+ *
+ * To keep the Debug View selection synchronized to CDT's selection, the service keeps
+ * track of what is the current GDB focus, by listening to the GDB MI notification
+ * "=thread-selected". When this notification is received, the service orders a change
+ * to CDT's Debug View selection to match, by sending an IGDBFocusChangedEvent.
+ *
+ * To keep GDB's focus synchronized to the Debug View selections, the UI listens to
+ * platform 'Debug Selection changed' events, and then uses this service, to order GDB
+ * to change focus to match the selection.
*
- * To keep the Debug View selection synchronized to CDT's selection, the service keeps
- * track of what is the current GDB focus, by listening to the GDB MI notification
- * "=thread-selected". When this notification is received, the service orders a change
- * to CDT's Debug View selection to match, by sending an IGDBFocusChangedEvent.
- *
- * To keep GDB's focus synchronized to the Debug View selections, the UI listens to
- * platform 'Debug Selection changed' events, and then uses this service, to order GDB
- * to change focus to match the selection.
- *
* Note: the mapping between the DV selection and GDB focus is not 1 to 1; there can
* be multiple debug sessions at one time, all shown in the DV. There is however a single
* effective DV selection. On the other end, each debug session has a dedicated instance
- * of GDB, having its own unique focus, at any given time. Also not all DV selections map
- * to a valid GDB focus.
- *
+ * of GDB, having its own unique focus, at any given time. Also not all DV selections map
+ * to a valid GDB focus.
+ *
* @since 5.2
*/
-public class GDBFocusSynchronizer extends AbstractDsfService implements IGDBFocusSynchronizer, IEventListener
-{
- /** This service's opinion of what is the current GDB focus - it can be
+public class GDBFocusSynchronizer extends AbstractDsfService implements IGDBFocusSynchronizer, IEventListener {
+ /** This service's opinion of what is the current GDB focus - it can be
* a process, thread or stack frame context */
private IDMContext fCurrentGDBFocus;
-
+
private IStack fStackService;
private IGDBProcesses fProcesses;
private IGDBControl fGdbcontrol;
private CommandFactory fCommandFactory;
-
+
// default initial values
private static final String THREAD_ID_DEFAULT = "1"; //$NON-NLS-1$
-
+
public GDBFocusSynchronizer(DsfSession session) {
super(session);
}
-
- private class GDBFocusChangedEvent extends AbstractDMEvent<IDMContext>
- implements IGDBFocusChangedEvent
- {
+
+ private class GDBFocusChangedEvent extends AbstractDMEvent<IDMContext> implements IGDBFocusChangedEvent {
public GDBFocusChangedEvent(IDMContext ctx) {
super(ctx);
}
@@ -113,20 +110,19 @@ public class GDBFocusSynchronizer extends AbstractDsfService implements IGDBFocu
}
private void doInitialize(RequestMonitor requestMonitor) {
- // obtain reference to a few needed services
+ // obtain reference to a few needed services
fProcesses = getServicesTracker().getService(IGDBProcesses.class);
fStackService = getServicesTracker().getService(IStack.class);
fGdbcontrol = getServicesTracker().getService(IGDBControl.class);
fCommandFactory = fGdbcontrol.getCommandFactory();
- register(new String[] { IGDBFocusSynchronizer.class.getName()},
- new Hashtable<String, String>());
+ register(new String[] { IGDBFocusSynchronizer.class.getName() }, new Hashtable<String, String>());
fGdbcontrol.addEventListener(this);
getSession().addServiceEventListener(this, null);
-
- // set a sane initial value for current GDB focus.
- // This value will be updated when the session has finished launching.
+
+ // set a sane initial value for current GDB focus.
+ // This value will be updated when the session has finished launching.
// See updateContexts() below.
fCurrentGDBFocus = createThreadContextFromThreadId(THREAD_ID_DEFAULT);
requestMonitor.done();
@@ -136,12 +132,11 @@ public class GDBFocusSynchronizer extends AbstractDsfService implements IGDBFocu
public void shutdown(RequestMonitor requestMonitor) {
fGdbcontrol.removeEventListener(this);
getSession().removeServiceEventListener(this);
-
+
unregister();
super.shutdown(requestMonitor);
}
-
-
+
@Override
public void setFocus(final IDMContext[] focus, RequestMonitor rm) {
assert focus != null;
@@ -150,8 +145,8 @@ public class GDBFocusSynchronizer extends AbstractDsfService implements IGDBFocu
// new selection is a frame?
if (elem instanceof IFrameDMContext) {
- final IFrameDMContext finalFrameCtx = (IFrameDMContext)elem;
-
+ final IFrameDMContext finalFrameCtx = (IFrameDMContext) elem;
+
setFrameFocus(finalFrameCtx, new ImmediateRequestMonitor(rm) {
@Override
public void handleSuccess() {
@@ -163,8 +158,8 @@ public class GDBFocusSynchronizer extends AbstractDsfService implements IGDBFocu
}
// new selection is a thread?
else if (elem instanceof IMIExecutionDMContext) {
- final IMIExecutionDMContext finalThreadCtx = (IMIExecutionDMContext)elem;
-
+ final IMIExecutionDMContext finalThreadCtx = (IMIExecutionDMContext) elem;
+
setThreadFocus(finalThreadCtx, new ImmediateRequestMonitor(rm) {
@Override
protected void handleSuccess() {
@@ -176,20 +171,19 @@ public class GDBFocusSynchronizer extends AbstractDsfService implements IGDBFocu
}
// new selection is a process?
else if (elem instanceof IMIContainerDMContext) {
- setProcessFocus((IMIContainerDMContext)elem, rm);
- }
- else {
+ setProcessFocus((IMIContainerDMContext) elem, rm);
+ } else {
assert false;
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
- INVALID_HANDLE, "Invalid context to set focus to", null)); //$NON-NLS-1$);
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid context to set focus to", //$NON-NLS-1$
+ null)); //);
return;
}
}
protected void setProcessFocus(IMIContainerDMContext newProc, RequestMonitor rm) {
if (newProc == null) {
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
- INVALID_HANDLE, "GdbFocusSynchronizer unable to resolve process context for the selected element", null)); //$NON-NLS-1$
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE,
+ "GdbFocusSynchronizer unable to resolve process context for the selected element", null)); //$NON-NLS-1$
return;
}
// There is no MI command to set the inferior. We could use the CLI 'inferior' command, but it would then
@@ -205,7 +199,7 @@ public class GDBFocusSynchronizer extends AbstractDsfService implements IGDBFocu
if (getData().length > 0) {
IDMContext finalThread = getData()[0];
if (finalThread instanceof IMIExecutionDMContext) {
- setThreadFocus((IMIExecutionDMContext)(finalThread), new ImmediateRequestMonitor(rm) {
+ setThreadFocus((IMIExecutionDMContext) (finalThread), new ImmediateRequestMonitor(rm) {
@Override
protected void handleSuccess() {
// update the current focus, to match new GDB focus
@@ -224,14 +218,15 @@ public class GDBFocusSynchronizer extends AbstractDsfService implements IGDBFocu
String miInferiorId = newProc.getGroupId();
// Remove the 'i' prefix
String cliInferiorId = miInferiorId.substring(1, miInferiorId.length());
- ICommand<MIInfo> command = fCommandFactory.createCLIInferior(fGdbcontrol.getContext(), cliInferiorId);
- fGdbcontrol.queueCommand(command, new ImmediateDataRequestMonitor<MIInfo> (rm) {
+ ICommand<MIInfo> command = fCommandFactory.createCLIInferior(fGdbcontrol.getContext(),
+ cliInferiorId);
+ fGdbcontrol.queueCommand(command, new ImmediateDataRequestMonitor<MIInfo>(rm) {
@Override
protected void handleSuccess() {
// update the current focus, to match new GDB focus
fCurrentGDBFocus = newProc;
rm.done();
- }
+ }
});
}
}
@@ -240,156 +235,149 @@ public class GDBFocusSynchronizer extends AbstractDsfService implements IGDBFocu
protected void setThreadFocus(IMIExecutionDMContext newThread, RequestMonitor rm) {
if (newThread == null) {
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
- INVALID_HANDLE, "GdbFocusSynchronizer unable to resolve thread context for the selected element", null)); //$NON-NLS-1$
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE,
+ "GdbFocusSynchronizer unable to resolve thread context for the selected element", null)); //$NON-NLS-1$
return;
}
-
+
// Create a mi-thread-select and send the command
- ICommand<MIInfo> command = fCommandFactory.createMIThreadSelect(fGdbcontrol.getContext(), newThread.getThreadId());
- fGdbcontrol.queueCommand(command, new ImmediateDataRequestMonitor<MIInfo> (rm));
+ ICommand<MIInfo> command = fCommandFactory.createMIThreadSelect(fGdbcontrol.getContext(),
+ newThread.getThreadId());
+ fGdbcontrol.queueCommand(command, new ImmediateDataRequestMonitor<MIInfo>(rm));
}
protected void setFrameFocus(IFrameDMContext newFrame, RequestMonitor rm) {
if (newFrame == null) {
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
- INVALID_HANDLE, "GdbFocusSynchronizer unable to resolve frame context for the selected element", null)); //$NON-NLS-1$
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE,
+ "GdbFocusSynchronizer unable to resolve frame context for the selected element", null)); //$NON-NLS-1$
return;
}
-
+
// We must specify the thread for which we want to set the frame in the -stack-select-frame command
IMIExecutionDMContext threadDmc = DMContexts.getAncestorOfType(newFrame, IMIExecutionDMContext.class);
if (isThreadSuspended(threadDmc)) {
// Create a mi-stack-select-frame and send the command
ICommand<MIInfo> command = fCommandFactory.createMIStackSelectFrame(threadDmc, newFrame.getLevel());
fGdbcontrol.queueCommand(command, new ImmediateDataRequestMonitor<MIInfo>(rm));
- }
- else {
+ } else {
rm.done();
}
}
-
+
private boolean isThreadSuspended(IExecutionDMContext ctx) {
assert ctx != null;
IRunControl runControl = getServicesTracker().getService(IRunControl.class);
if (runControl != null) {
return runControl.isSuspended(ctx);
- }
- else {
+ } else {
return false;
}
}
- /**
+ /**
* Parses gdb output for the =thread-selected notification.
* When this is detected, generate a DSF event to notify listeners
- *
+ *
* example :
- * =thread-selected,id="7",frame={level="0",addr="0x000000000041eab0",func="main",args=[]}
+ * =thread-selected,id="7",frame={level="0",addr="0x000000000041eab0",func="main",args=[]}
*/
@Override
public void eventReceived(Object output) {
- for (MIOOBRecord oobr : ((MIOutput)output).getMIOOBRecords()) {
- if (oobr instanceof MINotifyAsyncOutput) {
- MINotifyAsyncOutput out = (MINotifyAsyncOutput) oobr;
- String miEvent = out.getAsyncClass();
- if ("thread-selected".equals(miEvent)) { //$NON-NLS-1$
- // extract tid
- MIResult[] results = out.getMIResults();
- String tid = null;
- String frameLevel = null;
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- MIValue val = results[i].getMIValue();
-
- if (var.equals("frame") && val instanceof MITuple) { //$NON-NLS-1$
- // dig deeper to get the frame level
- MIResult[] res = ((MITuple)val).getMIResults();
-
- for (int j = 0; j < res.length; j++) {
- var = res[j].getVariable();
- val = res[j].getMIValue();
-
- if (var.equals("level")) { //$NON-NLS-1$
- if (val instanceof MIConst) {
- frameLevel = ((MIConst) val).getString();
- }
- }
- }
- }
- else {
- if (var.equals("id")) { //$NON-NLS-1$
- if (val instanceof MIConst) {
- tid = ((MIConst) val).getString();
- }
- }
- }
- }
-
- // tid should never be null
- assert (tid != null);
- if (tid == null) {
- return;
- }
-
- // update current focus
- if (frameLevel == null) {
- // thread running - current focus is a thread
- fCurrentGDBFocus = createThreadContextFromThreadId(tid);
+ for (MIOOBRecord oobr : ((MIOutput) output).getMIOOBRecords()) {
+ if (oobr instanceof MINotifyAsyncOutput) {
+ MINotifyAsyncOutput out = (MINotifyAsyncOutput) oobr;
+ String miEvent = out.getAsyncClass();
+ if ("thread-selected".equals(miEvent)) { //$NON-NLS-1$
+ // extract tid
+ MIResult[] results = out.getMIResults();
+ String tid = null;
+ String frameLevel = null;
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ MIValue val = results[i].getMIValue();
+
+ if (var.equals("frame") && val instanceof MITuple) { //$NON-NLS-1$
+ // dig deeper to get the frame level
+ MIResult[] res = ((MITuple) val).getMIResults();
+
+ for (int j = 0; j < res.length; j++) {
+ var = res[j].getVariable();
+ val = res[j].getMIValue();
+
+ if (var.equals("level")) { //$NON-NLS-1$
+ if (val instanceof MIConst) {
+ frameLevel = ((MIConst) val).getString();
+ }
+ }
+ }
+ } else {
+ if (var.equals("id")) { //$NON-NLS-1$
+ if (val instanceof MIConst) {
+ tid = ((MIConst) val).getString();
+ }
+ }
+ }
+ }
+
+ // tid should never be null
+ assert (tid != null);
+ if (tid == null) {
+ return;
+ }
+
+ // update current focus
+ if (frameLevel == null) {
+ // thread running - current focus is a thread
+ fCurrentGDBFocus = createThreadContextFromThreadId(tid);
createAndDispatchGDBFocusChangedEvent();
- }
- else {
- // thread suspended - current focus is a stack frame
- int intFrameNum = 0;
- try {
- intFrameNum = Integer.parseInt(frameLevel);
- }
- catch (NumberFormatException e){
- GdbPlugin.log(e);
- }
- String finalTid = tid;
- fStackService.getFrames(
- createThreadContextFromThreadId(finalTid),
- intFrameNum, intFrameNum,
- new ImmediateDataRequestMonitor<IFrameDMContext[]>() {
- @Override
- protected void handleCompleted() {
- if (isSuccess() && getData().length > 0) {
- fCurrentGDBFocus = getData()[0];
- } else {
- fCurrentGDBFocus = createThreadContextFromThreadId(finalTid);
- }
- createAndDispatchGDBFocusChangedEvent();
- }
- });
- }
- }
- }
- }
+ } else {
+ // thread suspended - current focus is a stack frame
+ int intFrameNum = 0;
+ try {
+ intFrameNum = Integer.parseInt(frameLevel);
+ } catch (NumberFormatException e) {
+ GdbPlugin.log(e);
+ }
+ String finalTid = tid;
+ fStackService.getFrames(createThreadContextFromThreadId(finalTid), intFrameNum, intFrameNum,
+ new ImmediateDataRequestMonitor<IFrameDMContext[]>() {
+ @Override
+ protected void handleCompleted() {
+ if (isSuccess() && getData().length > 0) {
+ fCurrentGDBFocus = getData()[0];
+ } else {
+ fCurrentGDBFocus = createThreadContextFromThreadId(finalTid);
+ }
+ createAndDispatchGDBFocusChangedEvent();
+ }
+ });
+ }
+ }
+ }
+ }
}
private void createAndDispatchGDBFocusChangedEvent() {
assert fCurrentGDBFocus != null;
- fGdbcontrol.getSession().dispatchEvent(new GDBFocusChangedEvent(fCurrentGDBFocus),
- fGdbcontrol.getProperties());
+ fGdbcontrol.getSession().dispatchEvent(new GDBFocusChangedEvent(fCurrentGDBFocus), fGdbcontrol.getProperties());
}
- /**
+ /**
* Creates an execution context from a thread id
- *
+ *
* @param tid The thread id on which the execution context is based
*/
private IMIExecutionDMContext createThreadContextFromThreadId(String tid) {
assert tid != null;
-
- IContainerDMContext parentContainer =
- fProcesses.createContainerContextFromThreadId(fGdbcontrol.getContext(), tid);
- IProcessDMContext processDmc = DMContexts.getAncestorOfType(parentContainer, IProcessDMContext.class);
+
+ IContainerDMContext parentContainer = fProcesses.createContainerContextFromThreadId(fGdbcontrol.getContext(),
+ tid);
+ IProcessDMContext processDmc = DMContexts.getAncestorOfType(parentContainer, IProcessDMContext.class);
IThreadDMContext threadDmc = fProcesses.createThreadContext(processDmc, tid);
return fProcesses.createExecutionContext(parentContainer, threadDmc, tid);
}
-
+
@Override
public void sessionSelected() {
// get debug view to select this session's current thread/frame
@@ -400,28 +388,27 @@ public class GDBFocusSynchronizer extends AbstractDsfService implements IGDBFocu
public IDMContext[] getFocus() {
return new IDMContext[] { fCurrentGDBFocus };
}
-
+
@DsfServiceEventHandler
public void updateContexts(DataModelInitializedEvent event) {
// the debug session has finished launching - update the current focus
// to something sane. i.e. thread1 or thread1->frame0
IMIExecutionDMContext threadCtx = createThreadContextFromThreadId(THREAD_ID_DEFAULT);
-
- if (!isThreadSuspended(threadCtx)) {
- fCurrentGDBFocus = threadCtx;
- }
- else {
- fStackService.getTopFrame(threadCtx, new ImmediateDataRequestMonitor<IFrameDMContext>() {
- @Override
- protected void handleCompleted() {
- if (isSuccess()) {
- fCurrentGDBFocus = getData();
- } else {
- fCurrentGDBFocus = threadCtx;
- }
- }
- });
- }
+
+ if (!isThreadSuspended(threadCtx)) {
+ fCurrentGDBFocus = threadCtx;
+ } else {
+ fStackService.getTopFrame(threadCtx, new ImmediateDataRequestMonitor<IFrameDMContext>() {
+ @Override
+ protected void handleCompleted() {
+ if (isSuccess()) {
+ fCurrentGDBFocus = getData();
+ } else {
+ fCurrentGDBFocus = threadCtx;
+ }
+ }
+ });
+ }
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/IGDBFocusSynchronizer.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/IGDBFocusSynchronizer.java
index 07534a8a015..0904edf6ece 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/IGDBFocusSynchronizer.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/IGDBFocusSynchronizer.java
@@ -16,9 +16,9 @@ import org.eclipse.cdt.dsf.datamodel.IDMEvent;
import org.eclipse.cdt.dsf.service.IDsfService;
/**
- * This service keeps synchronized the CDT debug view selection and GDB's
+ * This service keeps synchronized the CDT debug view selection and GDB's
* internal focus - GDB's current thread, stack frame, and (implicitly) inferior.
- *
+ *
* @since 5.2
*/
public interface IGDBFocusSynchronizer extends IDsfService {
@@ -26,31 +26,32 @@ public interface IGDBFocusSynchronizer extends IDsfService {
* Returns an array of contexts, representing the current synchronized focus
*/
IDMContext[] getFocus();
-
- /**
- * Sets the service's current focus and propagate it to the GDB corresponding to this
+
+ /**
+ * Sets the service's current focus and propagate it to the GDB corresponding to this
* service's instance, when appropriate.
- *
+ *
* @param focus An array of IDMContext, each context representing a focus'ed element
* from the Debug View
* @param rm the request monitor
*/
void setFocus(IDMContext[] focus, RequestMonitor rm);
-
- /**
- * The service sends this event to indicate that GDB has changed its focus, as a
- * result of an event not triggered by CDT. For example a console command typed by
- * the user.
+
+ /**
+ * The service sends this event to indicate that GDB has changed its focus, as a
+ * result of an event not triggered by CDT. For example a console command typed by
+ * the user.
* Note: the full focus might not be reflected in the included context. The service
* can be queried to get the complete picture.
- */
- interface IGDBFocusChangedEvent extends IDMEvent<IDMContext> {}
-
- /**
- * This tells the synchronizer that the session, corresponding to this service's
- * instance, has been selected. This can be called, for example, when a specific
- * debugger console has become active, so that the synchronizer will reflect this
- * in the Debug View selection.
- */
- void sessionSelected();
+ */
+ interface IGDBFocusChangedEvent extends IDMEvent<IDMContext> {
+ }
+
+ /**
+ * This tells the synchronizer that the session, corresponding to this service's
+ * instance, has been selected. This can be called, for example, when a specific
+ * debugger console has become active, so that the synchronizer will reflect this
+ * in the Debug View selection.
+ */
+ void sessionSelected();
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/command/commands/MIMetaGetCPUInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/command/commands/MIMetaGetCPUInfo.java
index 239737fea25..504f58bfb1e 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/command/commands/MIMetaGetCPUInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/command/commands/MIMetaGetCPUInfo.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Marc Khouzam (Ericsson) - initial API and implementation
*******************************************************************************/
@@ -32,23 +32,25 @@ public class MIMetaGetCPUInfo implements ICommand<MIMetaGetCPUInfoInfo> {
}
@Override
- public ICommand<? extends ICommandResult> coalesceWith( ICommand<? extends ICommandResult> command ) {
- return null ;
- }
+ public ICommand<? extends ICommandResult> coalesceWith(ICommand<? extends ICommandResult> command) {
+ return null;
+ }
@Override
- public IDMContext getContext(){
+ public IDMContext getContext() {
return fCtx;
}
@Override
public boolean equals(Object other) {
- if (other == null) return false;
- if (!(other.getClass().equals(getClass()))) return false;
+ if (other == null)
+ return false;
+ if (!(other.getClass().equals(getClass())))
+ return false;
// Since other is the same class is this, we are sure it is of type MIMetaGetCPUInfo also
- MIMetaGetCPUInfo otherCmd = (MIMetaGetCPUInfo)other;
- return fCtx == null ? otherCmd.fCtx == null : fCtx.equals(otherCmd.fCtx);
+ MIMetaGetCPUInfo otherCmd = (MIMetaGetCPUInfo) other;
+ return fCtx == null ? otherCmd.fCtx == null : fCtx.equals(otherCmd.fCtx);
}
@Override
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/command/events/EventMessages.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/command/events/EventMessages.java
index fe26415d6f1..fe0170a48ba 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/command/events/EventMessages.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/command/events/EventMessages.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
@@ -20,14 +20,14 @@ import org.eclipse.osgi.util.NLS;
* @noinstantiate This class is not intended to be instantiated by clients.
*/
public class EventMessages extends NLS {
- public static String Tracepoint;
- public static String Record;
+ public static String Tracepoint;
+ public static String Record;
- static {
- // initialize resource bundle
- NLS.initializeMessages(EventMessages.class.getName(), EventMessages.class);
- }
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(EventMessages.class.getName(), EventMessages.class);
+ }
- private EventMessages() {
- }
+ private EventMessages() {
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/command/events/MITracepointSelectedEvent.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/command/events/MITracepointSelectedEvent.java
index 6eab2c77859..afd9cdbda0b 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/command/events/MITracepointSelectedEvent.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/command/events/MITracepointSelectedEvent.java
@@ -29,7 +29,7 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIValue;
* is a response to an MI command, we trigger an MI event internally
* because it should cause the same behaviour as if we stopped at a
* breakpoint. The output record looks like this:
- *
+ *
* <code>
* ^done,found="1",tracepoint="1",traceframe="0",frame={level="0",addr="0x08048900",func="foo",args=[{name="i",value="2"}],file="file.cpp",fullname="/home/marc/file.cpp",line="505"}
@@ -40,48 +40,50 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIValue;
public class MITracepointSelectedEvent extends MIBreakpointHitEvent {
private int fRecNo;
-
- protected MITracepointSelectedEvent(IExecutionDMContext ctx, int token, MIResult[] results, MIFrame frame, String trptno, int recordno) {
- super(ctx, token, results, frame, trptno);
- fRecNo = recordno;
- }
+
+ protected MITracepointSelectedEvent(IExecutionDMContext ctx, int token, MIResult[] results, MIFrame frame,
+ String trptno, int recordno) {
+ super(ctx, token, results, frame, trptno);
+ fRecNo = recordno;
+ }
/**
* Returns a text to display for the reason why we show the debug view as stopped.
*/
public String getReason() {
return EventMessages.Tracepoint + " " + getNumber() + //$NON-NLS-1$
- ", " + EventMessages.Record + " " + fRecNo; //$NON-NLS-1$ //$NON-NLS-2$
+ ", " + EventMessages.Record + " " + fRecNo; //$NON-NLS-1$ //$NON-NLS-2$
}
-
- @ConfinedToDsfExecutor("")
- public static MITracepointSelectedEvent parse(IExecutionDMContext dmc, int token, MIResult[] results) {
- String trptno = ""; //$NON-NLS-1$
- int recordno = -1;
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- MIValue value = results[i].getMIValue();
- String str = ""; //$NON-NLS-1$
- if (value != null && value instanceof MIConst) {
- str = ((MIConst)value).getString();
- }
+ @ConfinedToDsfExecutor("")
+ public static MITracepointSelectedEvent parse(IExecutionDMContext dmc, int token, MIResult[] results) {
+ String trptno = ""; //$NON-NLS-1$
+ int recordno = -1;
- if (var.equals("tracepoint")) { //$NON-NLS-1$
- try {
- trptno = str.trim();
- } catch (NumberFormatException e) {
- }
- } else if (var.equals("traceframe")) { //$NON-NLS-1$
- try {
- recordno = Integer.parseInt(str.trim());
- } catch (NumberFormatException e) {
- }
- }
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ MIValue value = results[i].getMIValue();
+ String str = ""; //$NON-NLS-1$
+ if (value != null && value instanceof MIConst) {
+ str = ((MIConst) value).getString();
+ }
- }
+ if (var.equals("tracepoint")) { //$NON-NLS-1$
+ try {
+ trptno = str.trim();
+ } catch (NumberFormatException e) {
+ }
+ } else if (var.equals("traceframe")) { //$NON-NLS-1$
+ try {
+ recordno = Integer.parseInt(str.trim());
+ } catch (NumberFormatException e) {
+ }
+ }
- MIStoppedEvent stoppedEvent = MIStoppedEvent.parse(dmc, token, results);
- return new MITracepointSelectedEvent(stoppedEvent.getDMContext(), token, results, stoppedEvent.getFrame(), trptno, recordno);
- }
+ }
+
+ MIStoppedEvent stoppedEvent = MIStoppedEvent.parse(dmc, token, results);
+ return new MITracepointSelectedEvent(stoppedEvent.getDMContext(), token, results, stoppedEvent.getFrame(),
+ trptno, recordno);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/command/output/MIMetaGetCPUInfoInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/command/output/MIMetaGetCPUInfoInfo.java
index c4e2f0aee08..87d25fcb464 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/command/output/MIMetaGetCPUInfoInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/command/output/MIMetaGetCPUInfoInfo.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Marc Khouzam (Ericsson) - initial API and implementation
*******************************************************************************/
@@ -31,7 +31,9 @@ public class MIMetaGetCPUInfoInfo implements ICommandResult {
fCoresInfo = info;
}
- public ICoreInfo[] getInfo() { return fCoresInfo; }
+ public ICoreInfo[] getInfo() {
+ return fCoresInfo;
+ }
@Override
public <V extends ICommandResult> V getSubsetResult(ICommand<V> command) {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/control/StepIntoSelectionActiveOperation.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/control/StepIntoSelectionActiveOperation.java
index 77649ace9d6..099ef5d321c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/control/StepIntoSelectionActiveOperation.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/control/StepIntoSelectionActiveOperation.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Alvaro Sanchez-Leon (Ericsson AB) - Support for Step into selection (bug 244865)
*******************************************************************************/
@@ -25,12 +25,12 @@ public class StepIntoSelectionActiveOperation {
private final IMIExecutionDMContext fThreadContext;
private String fBaseFileLocation = null;
private int fBaseLine = 0;
- private int fOriginalStackDepth=0;
+ private int fOriginalStackDepth = 0;
private String fFunctionSignature = null;
private MIFrame fRunToLineFrame = null;
- public StepIntoSelectionActiveOperation(IMIExecutionDMContext threadContext, int line, IFunctionDeclaration targetFunction,
- int stackDepth, MIFrame runToLineFrame) {
+ public StepIntoSelectionActiveOperation(IMIExecutionDMContext threadContext, int line,
+ IFunctionDeclaration targetFunction, int stackDepth, MIFrame runToLineFrame) {
fThreadContext = threadContext;
fBaseLine = line;
fTargetFunction = targetFunction;
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/control/StepIntoSelectionUtils.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/control/StepIntoSelectionUtils.java
index 71f5215ced5..ec1303f5f06 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/control/StepIntoSelectionUtils.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/control/StepIntoSelectionUtils.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Alvaro Sanchez-Leon (Ericsson AB) - Support for Step into selection (bug 244865)
*******************************************************************************/
@@ -29,7 +29,7 @@ import org.eclipse.osgi.util.NLS;
public class StepIntoSelectionUtils {
public static final String cppSep = "::"; //$NON-NLS-1$
-
+
public static boolean sameSignature(MIFrame currentFrame, StepIntoSelectionActiveOperation stepOperation) {
String currentFunctionName = currentFrame.getFunction();
String targetFunctionName = stepOperation.getTargetFunctionSignature();
@@ -59,7 +59,7 @@ public class StepIntoSelectionUtils {
// Simple enough for initial implementation.
return true;
}
-
+
// TODO: A more detailed check can be implemented in order to cover for parameter types return types, etc..
// This with the intention to avoid early stops, however this implementation need to be tested extensively in
// order to avoid missing the target due to unexpected formatting mismatch between declaration and GDB representation.
@@ -77,12 +77,16 @@ public class StepIntoSelectionUtils {
}
}
- return ((currentFrame.getArgs().length - argSizeAdjustment) == stepOperation.getTargetFunctionDeclaration().getNumberOfParameters());
+ return ((currentFrame.getArgs().length - argSizeAdjustment) == stepOperation.getTargetFunctionDeclaration()
+ .getNumberOfParameters());
}
-
+
public static void missedSelectedTarget(StepIntoSelectionActiveOperation stepOperation) {
final String functionName = stepOperation.getTargetFunctionDeclaration().getElementName();
- IStatus status = new Status(IStatus.INFO, GdbPlugin.PLUGIN_ID, IGdbDebugConstants.STATUS_HANDLER_CODE, Messages.StepIntoSelection + "\n" + NLS.bind(Messages.StepIntoSelection_Execution_did_not_enter_function, functionName), null); //$NON-NLS-1$
+ IStatus status = new Status(IStatus.INFO, GdbPlugin.PLUGIN_ID, IGdbDebugConstants.STATUS_HANDLER_CODE,
+ Messages.StepIntoSelection + "\n" //$NON-NLS-1$
+ + NLS.bind(Messages.StepIntoSelection_Execution_did_not_enter_function, functionName),
+ null);
IStatusHandler statusHandler = DebugPlugin.getDefault().getStatusHandler(status);
if (statusHandler != null) {
try {
@@ -92,5 +96,5 @@ public class StepIntoSelectionUtils {
}
}
}
-
+
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/tracepointactions/CollectAction.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/tracepointactions/CollectAction.java
index aaa71d416ff..9e41cac83d0 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/tracepointactions/CollectAction.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/tracepointactions/CollectAction.java
@@ -34,13 +34,13 @@ import org.xml.sax.helpers.DefaultHandler;
/**
* Action used to tell GDB to collect different values from a tracepoint.
* It corresponds to GDB's 'collect' action.
- *
+ *
* As for GDB 7.4:
* collect[/s] EXPRESSIONS
- * The tracepoint collect command now takes an optional modifier "/s"
+ * The tracepoint collect command now takes an optional modifier "/s"
* that directs it to dereference pointer-to-character types and
* collect the bytes of memory up to a zero byte. The behavior is
- * similar to what you see when you use the regular print command on a
+ * similar to what you see when you use the regular print command on a
* string. An optional integer following the "/s" sets a bound on the
* number of bytes that will be collected.
*
@@ -53,7 +53,7 @@ public class CollectAction extends AbstractTracepointAction {
private static final String COLLECT_STRING_ATTR = "collectString"; //$NON-NLS-1$
private static final String COLLECT_AS_STRING_ATTR = "collectAsString"; //$NON-NLS-1$
private static final String COLLECT_AS_STRING_LIMIT_ATTR = "collectAsStringLimit"; //$NON-NLS-1$
-
+
private String fCollectString = ""; //$NON-NLS-1$
/** Indicates if we should ask GDB to collect character pointers as strings */
private boolean fCharPtrAsStrings;
@@ -62,7 +62,7 @@ public class CollectAction extends AbstractTracepointAction {
* Null will indicate that no limit is to be used.
* This value should be non-negative. */
private Integer fCharPtrAsStringsLimit;
-
+
@Override
public String getDefaultName() {
return MessagesForTracepointActions.TracepointActions_Untitled_Collect;
@@ -71,12 +71,12 @@ public class CollectAction extends AbstractTracepointAction {
public String getCollectString() {
return fCollectString;
}
-
+
public void setCollectString(String str) {
fCollectString = str;
}
- /**
+ /**
* Indicates if this collect action will treat character pointers as strings.
* @since 4.1
*/
@@ -94,21 +94,21 @@ public class CollectAction extends AbstractTracepointAction {
/**
* Indicates the maximum number of bytes that should be collected
- * when treating character pointers as strings
+ * when treating character pointers as strings
* @return null if no limit is to be used
* @return a non-negative integer indicating the limit
- *
+ *
* @since 4.1
*/
public Integer getCharPtrAsStringsLimit() {
return fCharPtrAsStringsLimit;
}
- /**
+ /**
* Specify the maximum number of bytes that should be collected when
* when treating character pointers as strings.
* @param limit A non-negative integer, or null of no limit should be used.
- *
+ *
* @since 4.1
*/
public void setCharPtrAsStringsLimit(Integer limit) {
@@ -135,7 +135,8 @@ public class CollectAction extends AbstractTracepointAction {
// Store the different attributes of this collect action
rootElement.setAttribute(COLLECT_STRING_ATTR, fCollectString);
rootElement.setAttribute(COLLECT_AS_STRING_ATTR, Boolean.toString(fCharPtrAsStrings));
- rootElement.setAttribute(COLLECT_AS_STRING_LIMIT_ATTR, fCharPtrAsStringsLimit == null ? "" : fCharPtrAsStringsLimit.toString()); //$NON-NLS-1$
+ rootElement.setAttribute(COLLECT_AS_STRING_LIMIT_ATTR,
+ fCharPtrAsStringsLimit == null ? "" : fCharPtrAsStringsLimit.toString()); //$NON-NLS-1$
doc.appendChild(rootElement);
@@ -161,8 +162,8 @@ public class CollectAction extends AbstractTracepointAction {
@Override
public String getSummary() {
// Return the exact format that will be sent to GDB.
-
- StringBuilder collectCmd = new StringBuilder("collect "); //$NON-NLS-1$
+
+ StringBuilder collectCmd = new StringBuilder("collect "); //$NON-NLS-1$
if (fCharPtrAsStrings) {
collectCmd.append("/s"); //$NON-NLS-1$
if (fCharPtrAsStringsLimit != null) {
@@ -174,7 +175,7 @@ public class CollectAction extends AbstractTracepointAction {
}
// Finally, actually add what to collect
collectCmd.append(fCollectString);
-
+
return collectCmd.toString();
}
@@ -191,17 +192,18 @@ public class CollectAction extends AbstractTracepointAction {
parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
parser.setErrorHandler(new DefaultHandler());
root = parser.parse(new InputSource(new StringReader(data))).getDocumentElement();
-
+
fCollectString = root.getAttribute(COLLECT_STRING_ATTR);
- if (fCollectString == null) fCollectString = ""; //$NON-NLS-1$
-
+ if (fCollectString == null)
+ fCollectString = ""; //$NON-NLS-1$
+
String asStrings = root.getAttribute(COLLECT_AS_STRING_ATTR);
if (asStrings != null) {
fCharPtrAsStrings = Boolean.valueOf(asStrings);
} else {
fCharPtrAsStrings = false;
}
-
+
fCharPtrAsStringsLimit = null;
String asStringsLimit = root.getAttribute(COLLECT_AS_STRING_LIMIT_ATTR);
if (asStringsLimit != null) {
@@ -210,12 +212,12 @@ public class CollectAction extends AbstractTracepointAction {
} catch (NumberFormatException e) {
// leave as null to disable
}
- }
+ }
} catch (Exception e) {
GdbPlugin.log(e);
}
}
-
+
@Override
public String toString() {
return getSummary();
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/tracepointactions/EvaluateAction.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/tracepointactions/EvaluateAction.java
index 7bbf0e3a460..0ac7c8dff84 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/tracepointactions/EvaluateAction.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/tracepointactions/EvaluateAction.java
@@ -39,7 +39,7 @@ public class EvaluateAction extends AbstractTracepointAction {
private static final String EVALUATE_ACTION_ID = "org.eclipse.cdt.dsf.gdb.tracepointactions.EvaluateAction"; //$NON-NLS-1$
private String fEvalString = ""; //$NON-NLS-1$
-
+
@Override
public String getDefaultName() {
return MessagesForTracepointActions.TracepointActions_Untitled_Evaluate;
@@ -48,7 +48,7 @@ public class EvaluateAction extends AbstractTracepointAction {
public String getEvalString() {
return fEvalString;
}
-
+
public void setEvalString(String str) {
fEvalString = str;
}
@@ -118,7 +118,7 @@ public class EvaluateAction extends AbstractTracepointAction {
GdbPlugin.log(e);
}
}
-
+
@Override
public String toString() {
return getSummary();
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/tracepointactions/ITracepointAction.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/tracepointactions/ITracepointAction.java
index c1746dddedc..38f89fc36dd 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/tracepointactions/ITracepointAction.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/tracepointactions/ITracepointAction.java
@@ -15,7 +15,6 @@ package org.eclipse.cdt.dsf.gdb.internal.tracepointactions;
import org.eclipse.cdt.debug.core.breakpointactions.IBreakpointAction;
-
/**
* Marker interface to differentiate between different breakpoint actions
* @since 3.0
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/tracepointactions/MessagesForTracepointActions.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/tracepointactions/MessagesForTracepointActions.java
index 3275cb1bf42..049e0d519ba 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/tracepointactions/MessagesForTracepointActions.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/tracepointactions/MessagesForTracepointActions.java
@@ -21,7 +21,7 @@ import org.eclipse.osgi.util.NLS;
* @since 3.0
*/
class MessagesForTracepointActions extends NLS {
- private static final String BUNDLE_NAME= "org.eclipse.cdt.dsf.gdb.internal.tracepointactions.messages"; //$NON-NLS-1$
+ private static final String BUNDLE_NAME = "org.eclipse.cdt.dsf.gdb.internal.tracepointactions.messages"; //$NON-NLS-1$
public static String TracepointActions_Untitled_Collect;
public static String TracepointActions_Untitled_Evaluate;
@@ -29,7 +29,7 @@ class MessagesForTracepointActions extends NLS {
public static String TracepointActions_Collect_Name;
public static String TracepointActions_Evaluate_Name;
public static String TracepointActions_WhileStepping_Name;
-
+
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, MessagesForTracepointActions.class);
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/tracepointactions/TracepointActionManager.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/tracepointactions/TracepointActionManager.java
index fc59418b02e..0fa2c688af3 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/tracepointactions/TracepointActionManager.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/tracepointactions/TracepointActionManager.java
@@ -40,17 +40,17 @@ import org.xml.sax.helpers.DefaultHandler;
public class TracepointActionManager {
private static final String TRACEPOINT_ACTION_DATA = "TracepointActionManager.actionData"; //$NON-NLS-1$
- private static final TracepointActionManager fTracepointActionManager = new TracepointActionManager();
-
- // We need a delimiter that the user won't type directly.
- // Bug 346215
- public static final String TRACEPOINT_ACTION_DELIMITER = "%_#"; //$NON-NLS-1$
-
+ private static final TracepointActionManager fTracepointActionManager = new TracepointActionManager();
+
+ // We need a delimiter that the user won't type directly.
+ // Bug 346215
+ public static final String TRACEPOINT_ACTION_DELIMITER = "%_#"; //$NON-NLS-1$
+
private ArrayList<ITracepointAction> tracepointActions = null;
private TracepointActionManager() {
}
-
+
public static TracepointActionManager getInstance() {
return fTracepointActionManager;
}
@@ -114,7 +114,7 @@ public class TracepointActionManager {
if (className == null)
throw new Exception();
- ITracepointAction action = (ITracepointAction)Class.forName(className).newInstance();
+ ITracepointAction action = (ITracepointAction) Class.forName(className).newInstance();
action.setName(name);
action.initializeFromMemento(value);
addAction(action);
@@ -159,8 +159,8 @@ public class TracepointActionManager {
ITracepointAction action = iter.next();
Element element = doc.createElement("actionEntry"); //$NON-NLS-1$
- element.setAttribute("name", action.getName()); //$NON-NLS-1$
- element.setAttribute("class", action.getClass().getName()); //$NON-NLS-1$
+ element.setAttribute("name", action.getName()); //$NON-NLS-1$
+ element.setAttribute("class", action.getClass().getName()); //$NON-NLS-1$
element.setAttribute("value", action.getMemento()); //$NON-NLS-1$
rootElement.appendChild(element);
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/tracepointactions/WhileSteppingAction.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/tracepointactions/WhileSteppingAction.java
index 2d640450e44..76b796c414f 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/tracepointactions/WhileSteppingAction.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/tracepointactions/WhileSteppingAction.java
@@ -45,7 +45,7 @@ public class WhileSteppingAction extends AbstractTracepointAction {
private String fSubActionContent = ""; //$NON-NLS-1$
// The number of steps this while-stepping command will occur
private int fStepCount = 1;
-
+
@Override
public String getDefaultName() {
return MessagesForTracepointActions.TracepointActions_Untitled_WhileStepping;
@@ -54,7 +54,7 @@ public class WhileSteppingAction extends AbstractTracepointAction {
public String getSubActionsNames() {
return fSubActionNames;
}
-
+
public void setSubActionsNames(String str) {
fSubActionNames = str;
}
@@ -62,13 +62,13 @@ public class WhileSteppingAction extends AbstractTracepointAction {
public String getSubActionsContent() {
return fSubActionContent;
}
-
+
// Take all the sub action names, and find their corresponding action,
// then build the content string
public void setSubActionsContent(String subActionNames) {
String[] names = subActionNames.split(","); //$NON-NLS-1$
fSubActionContent = ""; //$NON-NLS-1$
-
+
for (String name : names) {
ITracepointAction action = TracepointActionManager.getInstance().findAction(name.trim());
if (action != null) {
@@ -76,8 +76,8 @@ public class WhileSteppingAction extends AbstractTracepointAction {
}
}
// Remove last comma
- if (fSubActionContent.length() >0) {
- fSubActionContent = fSubActionContent.substring(0, fSubActionContent.length()-1);
+ if (fSubActionContent.length() > 0) {
+ fSubActionContent = fSubActionContent.substring(0, fSubActionContent.length() - 1);
}
}
@@ -157,7 +157,7 @@ public class WhileSteppingAction extends AbstractTracepointAction {
GdbPlugin.log(e);
}
}
-
+
@Override
public String toString() {
return getSummary();
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java
index b03eb742da3..474c8f34977 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java
@@ -7,11 +7,11 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
- * Ericsson - initial API and implementation
- * Nokia - create and use backend service.
- * IBM Corporation
+ * Ericsson - initial API and implementation
+ * Nokia - create and use backend service.
+ * IBM Corporation
* Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121)
* Sergey Prigogin (Google)
* Marc Khouzam (Ericsson) - No longer call method to check non-stop for GDB < 7.0 (Bug 365471)
@@ -68,7 +68,7 @@ public class FinalLaunchSequence extends ReflectionSequence {
private Map<String, Object> fAttributes;
private IGDBControl fCommandControl;
- private IGDBBackend fGDBBackend;
+ private IGDBBackend fGDBBackend;
private IMIProcesses fProcService;
private CommandFactory fCommandFactory;
@@ -79,7 +79,8 @@ public class FinalLaunchSequence extends ReflectionSequence {
* @since 4.0
*/
public FinalLaunchSequence(DsfSession session, Map<String, Object> attributes, RequestMonitorWithProgress rm) {
- super(session.getExecutor(), rm, LaunchMessages.getString("FinalLaunchSequence.0"), LaunchMessages.getString("FinalLaunchSequence.1")); //$NON-NLS-1$ //$NON-NLS-2$
+ super(session.getExecutor(), rm, LaunchMessages.getString("FinalLaunchSequence.0"), //$NON-NLS-1$
+ LaunchMessages.getString("FinalLaunchSequence.1")); //$NON-NLS-1$
fSession = session;
fAttributes = attributes;
}
@@ -105,21 +106,20 @@ public class FinalLaunchSequence extends ReflectionSequence {
@Override
protected String[] getExecutionOrder(String group) {
if (GROUP_TOP_LEVEL.equals(group)) {
- return new String[] {
- "stepInitializeFinalLaunchSequence", //$NON-NLS-1$
+ return new String[] { "stepInitializeFinalLaunchSequence", //$NON-NLS-1$
// Global GDB settings
- "stepGDBVersion", //$NON-NLS-1$
- "stepSetEnvironmentDirectory", //$NON-NLS-1$
- "stepSetBreakpointPending", //$NON-NLS-1$
- "stepEnablePrettyPrinting", //$NON-NLS-1$
- "stepSetPrintObject", //$NON-NLS-1$
- "stepSetCharset", //$NON-NLS-1$
- "stepSourceGDBInitFile", //$NON-NLS-1$
- "stepSetAutoLoadSharedLibrarySymbols", //$NON-NLS-1$
- "stepSetSharedLibraryPaths", //$NON-NLS-1$
- "stepSetSourceSubstitutePath", //$NON-NLS-1$
- "stepSetRemoteTimeout", //$NON-NLS-1$
-
+ "stepGDBVersion", //$NON-NLS-1$
+ "stepSetEnvironmentDirectory", //$NON-NLS-1$
+ "stepSetBreakpointPending", //$NON-NLS-1$
+ "stepEnablePrettyPrinting", //$NON-NLS-1$
+ "stepSetPrintObject", //$NON-NLS-1$
+ "stepSetCharset", //$NON-NLS-1$
+ "stepSourceGDBInitFile", //$NON-NLS-1$
+ "stepSetAutoLoadSharedLibrarySymbols", //$NON-NLS-1$
+ "stepSetSharedLibraryPaths", //$NON-NLS-1$
+ "stepSetSourceSubstitutePath", //$NON-NLS-1$
+ "stepSetRemoteTimeout", //$NON-NLS-1$
+
// -environment-directory with a lot of paths could
// make setting breakpoint incredibly slow, which makes
// the debug session un-workable. We simply stop
@@ -127,39 +127,41 @@ public class FinalLaunchSequence extends ReflectionSequence {
// Bug 225805
//
// "stepSetSourceLookupPath", //$NON-NLS-1$
-
+
// For remote-attach launch only
- "stepRemoteConnection", //$NON-NLS-1$
+ "stepRemoteConnection", //$NON-NLS-1$
// For all launches except attach ones
"stepNewProcess", //$NON-NLS-1$
// For local attach launch only
- "stepAttachToProcess", //$NON-NLS-1$
+ "stepAttachToProcess", //$NON-NLS-1$
// Global
- "stepDataModelInitializationComplete", //$NON-NLS-1$
- "stepCleanup", //$NON-NLS-1$
+ "stepDataModelInitializationComplete", //$NON-NLS-1$
+ "stepCleanup", //$NON-NLS-1$
};
}
return null;
}
- /**
+ /**
* Initialize the members of the FinalLaunchSequence class.
* This step is mandatory for the rest of the sequence to complete.
- * @since 4.0
+ * @since 4.0
*/
@Execute
public void stepInitializeFinalLaunchSequence(RequestMonitor requestMonitor) {
fTracker = new DsfServicesTracker(GdbPlugin.getBundleContext(), fSession.getId());
fGDBBackend = fTracker.getService(IGDBBackend.class);
if (fGDBBackend == null) {
- requestMonitor.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, "Cannot obtain GDBBackend service", null)); //$NON-NLS-1$
+ requestMonitor.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, "Cannot obtain GDBBackend service", null)); //$NON-NLS-1$
requestMonitor.done();
return;
}
fCommandControl = fTracker.getService(IGDBControl.class);
if (fCommandControl == null) {
- requestMonitor.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, "Cannot obtain control service", null)); //$NON-NLS-1$
+ requestMonitor.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, "Cannot obtain control service", null)); //$NON-NLS-1$
requestMonitor.done();
return;
}
@@ -168,7 +170,8 @@ public class FinalLaunchSequence extends ReflectionSequence {
fProcService = fTracker.getService(IMIProcesses.class);
if (fProcService == null) {
- requestMonitor.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, "Cannot obtain process service", null)); //$NON-NLS-1$
+ requestMonitor.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, "Cannot obtain process service", null)); //$NON-NLS-1$
requestMonitor.done();
return;
}
@@ -176,9 +179,9 @@ public class FinalLaunchSequence extends ReflectionSequence {
requestMonitor.done();
}
- /**
+ /**
* Rollback method for {@link #stepInitializeFinalLaunchSequence()}
- * @since 4.0
+ * @since 4.0
*/
@RollBack("stepInitializeFinalLaunchSequence")
public void rollBackInitializeFinalLaunchSequence(RequestMonitor requestMonitor) {
@@ -190,13 +193,12 @@ public class FinalLaunchSequence extends ReflectionSequence {
}
/**
- * Print the version of GDB.
- * @since 4.6
+ * Print the version of GDB.
+ * @since 4.6
*/
@Execute
public void stepGDBVersion(final RequestMonitor requestMonitor) {
- fCommandControl.queueCommand(
- fCommandFactory.createMIGDBVersion(fCommandControl.getContext()),
+ fCommandControl.queueCommand(fCommandFactory.createMIGDBVersion(fCommandControl.getContext()),
new DataRequestMonitor<MIGDBVersionInfo>(getExecutor(), requestMonitor) {
@Override
protected void handleCompleted() {
@@ -207,8 +209,8 @@ public class FinalLaunchSequence extends ReflectionSequence {
}
/**
- * Specify GDB's working directory.
- * @since 4.0
+ * Specify GDB's working directory.
+ * @since 4.0
*/
@Execute
public void stepSetEnvironmentDirectory(final RequestMonitor requestMonitor) {
@@ -216,25 +218,26 @@ public class FinalLaunchSequence extends ReflectionSequence {
try {
dir = fGDBBackend.getGDBWorkingDirectory();
} catch (CoreException e) {
- requestMonitor.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, "Cannot get working directory", e)); //$NON-NLS-1$
+ requestMonitor
+ .setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, "Cannot get working directory", e)); //$NON-NLS-1$
requestMonitor.done();
return;
}
if (dir != null) {
fCommandControl.queueCommand(
- fCommandFactory.createMIEnvironmentCD(fCommandControl.getContext(), dir.toString()),
+ fCommandFactory.createMIEnvironmentCD(fCommandControl.getContext(), dir.toString()),
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor));
} else {
requestMonitor.done();
}
}
-
- /**
- * Allow breakpoints/tracepoints to be set as pending when using the gdb console
- * or a CLI command to create them.
- * @since 4.0
- */
+
+ /**
+ * Allow breakpoints/tracepoints to be set as pending when using the gdb console
+ * or a CLI command to create them.
+ * @since 4.0
+ */
@Execute
public void stepSetBreakpointPending(final RequestMonitor requestMonitor) {
if (fGDBBackend.getSessionType() != SessionType.CORE) {
@@ -254,23 +257,21 @@ public class FinalLaunchSequence extends ReflectionSequence {
@Execute
public void stepEnablePrettyPrinting(final RequestMonitor requestMonitor) {
if (Platform.getPreferencesService().getBoolean(GdbPlugin.PLUGIN_ID,
- IGdbDebugPreferenceConstants.PREF_ENABLE_PRETTY_PRINTING,
- false, null)) {
+ IGdbDebugPreferenceConstants.PREF_ENABLE_PRETTY_PRINTING, false, null)) {
- fCommandControl.enablePrettyPrintingForMIVariableObjects(
- new RequestMonitor(getExecutor(), requestMonitor) {
+ fCommandControl.enablePrettyPrintingForMIVariableObjects(new RequestMonitor(getExecutor(), requestMonitor) {
+ @Override
+ protected void handleCompleted() {
+ fCommandControl.setPrintPythonErrors(false, new ImmediateRequestMonitor() {
@Override
protected void handleCompleted() {
- fCommandControl.setPrintPythonErrors(false, new ImmediateRequestMonitor() {
- @Override
- protected void handleCompleted() {
- // Ignore this error
- // Bug 402988
- requestMonitor.done();
- }
- });
+ // Ignore this error
+ // Bug 402988
+ requestMonitor.done();
}
});
+ }
+ });
} else {
fCommandControl.setPrintPythonErrors(false, new ImmediateRequestMonitor() {
@Override
@@ -282,7 +283,7 @@ public class FinalLaunchSequence extends ReflectionSequence {
});
}
}
-
+
/**
* Turn on RTTI usage, if enabled in preferences.
* @since 4.1
@@ -291,8 +292,7 @@ public class FinalLaunchSequence extends ReflectionSequence {
public void stepSetPrintObject(final RequestMonitor requestMonitor) {
// Enable or disable variables type determination based on RTTI.
// See bug 377536 for details.
- boolean useRtti = Platform.getPreferencesService().getBoolean(
- GdbPlugin.PLUGIN_ID,
+ boolean useRtti = Platform.getPreferencesService().getBoolean(GdbPlugin.PLUGIN_ID,
IGdbDebugPreferenceConstants.PREF_USE_RTTI, false, null);
fCommandControl.queueCommand(
fCommandControl.getCommandFactory().createMIGDBSetPrintObject(fCommandControl.getContext(), useRtti),
@@ -301,11 +301,10 @@ public class FinalLaunchSequence extends ReflectionSequence {
protected void handleCompleted() {
// Not an essential command, so accept errors
requestMonitor.done();
- }
- }
- );
+ }
+ });
}
-
+
/**
* Set the charsets.
* @since 4.1
@@ -315,31 +314,31 @@ public class FinalLaunchSequence extends ReflectionSequence {
// Enable printing of sevenbit-strings. This is required to avoid charset issues.
// See bug 307311 for details.
fCommandControl.queueCommand(
- fCommandFactory.createMIGDBSetPrintSevenbitStrings(fCommandControl.getContext(), true),
- new ImmediateDataRequestMonitor<MIInfo>(requestMonitor) {
- @Override
- protected void handleCompleted() {
- // Set the charset to ISO-8859-1. We have to do this here because GDB earlier than
- // 7.0 has no proper Unicode support. Note that we can still handle UTF-8 though, as
- // we can determine and decode UTF-8 encoded strings on our own. This makes ISO-8859-1
- // the most suitable option here. See the MIStringHandler class and bug 307311 for
- // details.
- fCommandControl.queueCommand(
- fCommandFactory.createMIGDBSetCharset(fCommandControl.getContext(), "ISO-8859-1"), //$NON-NLS-1$
- new ImmediateDataRequestMonitor<MIInfo>(requestMonitor) {
- @Override
- protected void handleCompleted() {
- // Not an essential command, so accept errors
- requestMonitor.done();
- }
- });
- }
- });
+ fCommandFactory.createMIGDBSetPrintSevenbitStrings(fCommandControl.getContext(), true),
+ new ImmediateDataRequestMonitor<MIInfo>(requestMonitor) {
+ @Override
+ protected void handleCompleted() {
+ // Set the charset to ISO-8859-1. We have to do this here because GDB earlier than
+ // 7.0 has no proper Unicode support. Note that we can still handle UTF-8 though, as
+ // we can determine and decode UTF-8 encoded strings on our own. This makes ISO-8859-1
+ // the most suitable option here. See the MIStringHandler class and bug 307311 for
+ // details.
+ fCommandControl.queueCommand(
+ fCommandFactory.createMIGDBSetCharset(fCommandControl.getContext(), "ISO-8859-1"), //$NON-NLS-1$
+ new ImmediateDataRequestMonitor<MIInfo>(requestMonitor) {
+ @Override
+ protected void handleCompleted() {
+ // Not an essential command, so accept errors
+ requestMonitor.done();
+ }
+ });
+ }
+ });
}
/**
* Source the gdbinit file specified in the launch.
- * @since 4.0
+ * @since 4.0
*/
@Execute
public void stepSourceGDBInitFile(final RequestMonitor requestMonitor) {
@@ -348,10 +347,11 @@ public class FinalLaunchSequence extends ReflectionSequence {
if (gdbinitFile != null && !gdbinitFile.isEmpty()) {
String projectName = (String) fAttributes.get(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME);
- final String expandedGDBInitFile = new DebugStringVariableSubstitutor(projectName).performStringSubstitution(gdbinitFile);
+ final String expandedGDBInitFile = new DebugStringVariableSubstitutor(projectName)
+ .performStringSubstitution(gdbinitFile);
fCommandControl.queueCommand(
- fCommandFactory.createCLISource(fCommandControl.getContext(), expandedGDBInitFile),
+ fCommandFactory.createCLISource(fCommandControl.getContext(), expandedGDBInitFile),
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor) {
@Override
protected void handleCompleted() {
@@ -359,7 +359,8 @@ public class FinalLaunchSequence extends ReflectionSequence {
// should not consider this an error.
// If it is not the default, then the user must have specified it and
// we want to warn the user if we can't find it.
- if (!expandedGDBInitFile.equals(IGDBLaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT)) {
+ if (!expandedGDBInitFile
+ .equals(IGDBLaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT)) {
requestMonitor.setStatus(getStatus());
}
requestMonitor.done();
@@ -369,41 +370,40 @@ public class FinalLaunchSequence extends ReflectionSequence {
requestMonitor.done();
}
} catch (CoreException e) {
- requestMonitor.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, "Cannot get gdbinit option", e)); //$NON-NLS-1$
+ requestMonitor
+ .setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, "Cannot get gdbinit option", e)); //$NON-NLS-1$
requestMonitor.done();
}
}
/**
* Enable non-stop mode if requested.
- * @since 4.0
+ * @since 4.0
*/
// Keep this method in this class for backwards-compatibility, although
// it is called only by sub-classes.
// It could be moved to FinalLaunchSequence_7_0, otherwise.
@Execute
public void stepSetNonStop(final RequestMonitor requestMonitor) {
- boolean isNonStop = CDebugUtils.getAttribute(
- fAttributes,
- IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP,
- LaunchUtils.getIsNonStopModeDefault());
+ boolean isNonStop = CDebugUtils.getAttribute(fAttributes,
+ IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP, LaunchUtils.getIsNonStopModeDefault());
// GDBs that don't support non-stop don't allow you to set it to false.
// We really should set it to false when GDB supports it though.
// Something to fix later.
if (isNonStop) {
- fCommandControl.queueCommand(
- fCommandFactory.createMIGDBSetTargetAsync(fCommandControl.getContext(), true),
+ fCommandControl.queueCommand(fCommandFactory.createMIGDBSetTargetAsync(fCommandControl.getContext(), true),
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor) {
@Override
protected void handleSuccess() {
fCommandControl.queueCommand(
- fCommandFactory.createMIGDBSetPagination(fCommandControl.getContext(), false),
+ fCommandFactory.createMIGDBSetPagination(fCommandControl.getContext(), false),
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor) {
@Override
protected void handleSuccess() {
fCommandControl.queueCommand(
- fCommandFactory.createMIGDBSetNonStop(fCommandControl.getContext(), true),
+ fCommandFactory.createMIGDBSetNonStop(fCommandControl.getContext(),
+ true),
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor));
}
});
@@ -411,8 +411,7 @@ public class FinalLaunchSequence extends ReflectionSequence {
});
} else {
// Explicitly set target-async to off for all-stop mode.
- fCommandControl.queueCommand(
- fCommandFactory.createMIGDBSetTargetAsync(fCommandControl.getContext(), false),
+ fCommandControl.queueCommand(fCommandFactory.createMIGDBSetTargetAsync(fCommandControl.getContext(), false),
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor) {
@Override
protected void handleError() {
@@ -426,23 +425,21 @@ public class FinalLaunchSequence extends ReflectionSequence {
/**
* Tell GDB to automatically load or not the shared library symbols
- * @since 4.0
+ * @since 4.0
*/
@Execute
public void stepSetAutoLoadSharedLibrarySymbols(RequestMonitor requestMonitor) {
- boolean autolib = CDebugUtils.getAttribute(
- fAttributes,
+ boolean autolib = CDebugUtils.getAttribute(fAttributes,
IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB,
IGDBLaunchConfigurationConstants.DEBUGGER_AUTO_SOLIB_DEFAULT);
- fCommandControl.queueCommand(
- fCommandFactory.createMIGDBSetAutoSolib(fCommandControl.getContext(), autolib),
+ fCommandControl.queueCommand(fCommandFactory.createMIGDBSetAutoSolib(fCommandControl.getContext(), autolib),
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor));
}
/**
* Set the shared library paths.
- * @since 4.0
+ * @since 4.0
*/
@Execute
public void stepSetSharedLibraryPaths(final RequestMonitor requestMonitor) {
@@ -452,7 +449,7 @@ public class FinalLaunchSequence extends ReflectionSequence {
if (!p.isEmpty()) {
String[] paths = p.toArray(new String[p.size()]);
fCommandControl.queueCommand(
- fCommandFactory.createMIGDBSetSolibSearchPath(fCommandControl.getContext(), paths),
+ fCommandFactory.createMIGDBSetSolibSearchPath(fCommandControl.getContext(), paths),
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor) {
@Override
protected void handleSuccess() {
@@ -464,7 +461,7 @@ public class FinalLaunchSequence extends ReflectionSequence {
// // in the GDB documentation. This is to avoid the sysroot
// // variable finding libraries that were not meant to be found.
// fCommandControl.queueCommand(
- // new MIGDBSetSysroot(fCommandControl.getContext()),
+ // new MIGDBSetSysroot(fCommandControl.getContext()),
// new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor));
};
});
@@ -472,21 +469,22 @@ public class FinalLaunchSequence extends ReflectionSequence {
requestMonitor.done();
}
} catch (CoreException e) {
- requestMonitor.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, "Cannot set share library paths", e)); //$NON-NLS-1$
+ requestMonitor
+ .setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, "Cannot set share library paths", e)); //$NON-NLS-1$
requestMonitor.done();
}
}
/**
* Setup the source paths.
- * @since 4.0
+ * @since 4.0
*/
@Execute
public void stepSetSourceLookupPath(RequestMonitor requestMonitor) {
CSourceLookup sourceLookup = fTracker.getService(CSourceLookup.class);
- ILaunch launch = (ILaunch)fSession.getModelAdapter(ILaunch.class);
- CSourceLookupDirector locator = (CSourceLookupDirector)launch.getSourceLocator();
- ISourceLookupDMContext sourceLookupDmc = (ISourceLookupDMContext)fCommandControl.getContext();
+ ILaunch launch = (ILaunch) fSession.getModelAdapter(ILaunch.class);
+ CSourceLookupDirector locator = (CSourceLookupDirector) launch.getSourceLocator();
+ ISourceLookupDMContext sourceLookupDmc = (ISourceLookupDMContext) fCommandControl.getContext();
sourceLookup.setSourceLookupPath(sourceLookupDmc, locator.getSourceContainers(), requestMonitor);
}
@@ -514,7 +512,7 @@ public class FinalLaunchSequence extends ReflectionSequence {
/**
* Before starting a remote connection, set the gdb remotetimeout to the user
* specified value.
- *
+ *
* @since 5.5
*/
@Execute
@@ -544,40 +542,33 @@ public class FinalLaunchSequence extends ReflectionSequence {
rm.done();
}
- private static final String INVALID = "invalid"; //$NON-NLS-1$
- /**
+ private static final String INVALID = "invalid"; //$NON-NLS-1$
+
+ /**
* If we are dealing with a remote-attach debugging session, connect to the target.
* @since 4.0
*/
@Execute
public void stepRemoteConnection(final RequestMonitor rm) {
if (fGDBBackend.getSessionType() == SessionType.REMOTE && fGDBBackend.getIsAttachSession()) {
- boolean isTcpConnection = CDebugUtils.getAttribute(
- fAttributes,
- IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP,
- false);
+ boolean isTcpConnection = CDebugUtils.getAttribute(fAttributes,
+ IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP, false);
if (isTcpConnection) {
- String remoteTcpHost = CDebugUtils.getAttribute(
- fAttributes,
- IGDBLaunchConfigurationConstants.ATTR_HOST, INVALID);
- String remoteTcpPort = CDebugUtils.getAttribute(
- fAttributes,
- IGDBLaunchConfigurationConstants.ATTR_PORT, INVALID);
+ String remoteTcpHost = CDebugUtils.getAttribute(fAttributes, IGDBLaunchConfigurationConstants.ATTR_HOST,
+ INVALID);
+ String remoteTcpPort = CDebugUtils.getAttribute(fAttributes, IGDBLaunchConfigurationConstants.ATTR_PORT,
+ INVALID);
- fCommandControl.queueCommand(
- fCommandFactory.createMITargetSelect(fCommandControl.getContext(),
- remoteTcpHost, remoteTcpPort, true),
- new ImmediateDataRequestMonitor<MIInfo>(rm));
+ fCommandControl.queueCommand(fCommandFactory.createMITargetSelect(fCommandControl.getContext(),
+ remoteTcpHost, remoteTcpPort, true), new ImmediateDataRequestMonitor<MIInfo>(rm));
} else {
- String serialDevice = CDebugUtils.getAttribute(
- fAttributes,
- IGDBLaunchConfigurationConstants.ATTR_DEV, INVALID);
+ String serialDevice = CDebugUtils.getAttribute(fAttributes, IGDBLaunchConfigurationConstants.ATTR_DEV,
+ INVALID);
fCommandControl.queueCommand(
- fCommandFactory.createMITargetSelect(fCommandControl.getContext(),
- serialDevice, true),
- new ImmediateDataRequestMonitor<MIInfo>(rm));
+ fCommandFactory.createMITargetSelect(fCommandControl.getContext(), serialDevice, true),
+ new ImmediateDataRequestMonitor<MIInfo>(rm));
}
} else {
rm.done();
@@ -592,8 +583,7 @@ public class FinalLaunchSequence extends ReflectionSequence {
@Execute
public void stepNewProcess(final RequestMonitor rm) {
if (!fGDBBackend.getIsAttachSession()) {
- boolean noBinarySpecified = CDebugUtils.getAttribute(
- fAttributes,
+ boolean noBinarySpecified = CDebugUtils.getAttribute(fAttributes,
IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_USE_SOLIB_SYMBOLS_FOR_APP,
IGDBLaunchConfigurationConstants.DEBUGGER_USE_SOLIB_SYMBOLS_FOR_APP_DEFAULT);
@@ -605,18 +595,18 @@ public class FinalLaunchSequence extends ReflectionSequence {
// Even if binary is null, we must call this to do all the other steps
// necessary to create a process. It is possible that the binary is not needed
- fProcService.debugNewProcess(fCommandControl.getContext(), binary, fAttributes,
+ fProcService.debugNewProcess(fCommandControl.getContext(), binary, fAttributes,
new DataRequestMonitor<IDMContext>(getExecutor(), rm) {
- @Override
- protected void handleCancel() {
- // If this step is cancelled, cancel the current sequence.
- // This is to allow the user to press the cancel button
- // when prompted for a post-mortem file.
- // Bug 362105
- rm.cancel();
- rm.done();
- }
- });
+ @Override
+ protected void handleCancel() {
+ // If this step is cancelled, cancel the current sequence.
+ // This is to allow the user to press the cancel button
+ // when prompted for a post-mortem file.
+ // Bug 362105
+ rm.cancel();
+ rm.done();
+ }
+ });
} else {
rm.done();
}
@@ -624,26 +614,25 @@ public class FinalLaunchSequence extends ReflectionSequence {
/**
* If we are dealing with an local attach session, perform the attach.
- * For a remote attach session, we don't attach during the launch; instead
- * we wait for the user to manually do the attach.
- * @since 4.0
+ * For a remote attach session, we don't attach during the launch; instead
+ * we wait for the user to manually do the attach.
+ * @since 4.0
*/
@Execute
public void stepAttachToProcess(final RequestMonitor requestMonitor) {
if (fGDBBackend.getIsAttachSession() && fGDBBackend.getSessionType() != SessionType.REMOTE) {
// Is the process id already stored in the launch?
- int pid = CDebugUtils.getAttribute(
- fAttributes,
- ICDTLaunchConfigurationConstants.ATTR_ATTACH_PROCESS_ID, -1);
+ int pid = CDebugUtils.getAttribute(fAttributes, ICDTLaunchConfigurationConstants.ATTR_ATTACH_PROCESS_ID,
+ -1);
if (pid != -1) {
fProcService.attachDebuggerToProcess(
fProcService.createProcessContext(fCommandControl.getContext(), Integer.toString(pid)),
new DataRequestMonitor<IDMContext>(getExecutor(), requestMonitor));
} else {
- IConnectHandler connectCommand = (IConnectHandler)fSession.getModelAdapter(IConnectHandler.class);
+ IConnectHandler connectCommand = (IConnectHandler) fSession.getModelAdapter(IConnectHandler.class);
if (connectCommand instanceof IConnect) {
- ((IConnect)connectCommand).connect(requestMonitor);
+ ((IConnect) connectCommand).connect(requestMonitor);
} else {
requestMonitor.done();
}
@@ -652,7 +641,7 @@ public class FinalLaunchSequence extends ReflectionSequence {
requestMonitor.done();
}
}
-
+
/**
* Indicate that the Data Model has been filled. This will trigger the Debug view to expand.
* @since 4.0
@@ -663,7 +652,7 @@ public class FinalLaunchSequence extends ReflectionSequence {
fCommandControl.getProperties());
requestMonitor.done();
}
-
+
/**
* Cleanup now that the sequence has been run.
* @since 4.0
@@ -675,4 +664,3 @@ public class FinalLaunchSequence extends ReflectionSequence {
requestMonitor.done();
}
}
-
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence_7_0.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence_7_0.java
index 1521cd72013..f4d2d140116 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence_7_0.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence_7_0.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Marc Khouzam (Ericsson) - initial API and implementation (Bug 365471)
* Marc Khouzam (Ericsson) - Support for different charsets (bug 370462)
@@ -40,7 +40,7 @@ import org.eclipse.core.runtime.Status;
* Subclass for GDB >= 7.0.
* This class currently sets non-stop mode, or makes
* sure target-async is off for all-stop.
- *
+ *
* @since 4.1
*/
public class FinalLaunchSequence_7_0 extends FinalLaunchSequence {
@@ -60,18 +60,19 @@ public class FinalLaunchSequence_7_0 extends FinalLaunchSequence {
List<String> orderList = new ArrayList<String>(Arrays.asList(super.getExecutionOrder(GROUP_TOP_LEVEL)));
// Now insert our steps right after the initialization of the base class.
- orderList.add(orderList.indexOf("stepInitializeFinalLaunchSequence") + 1, "stepInitializeFinalLaunchSequence_7_0"); //$NON-NLS-1$ //$NON-NLS-2$
-
+ orderList.add(orderList.indexOf("stepInitializeFinalLaunchSequence") + 1, //$NON-NLS-1$
+ "stepInitializeFinalLaunchSequence_7_0"); //$NON-NLS-1$
+
// Note that stepSetNonStop is defined in the base class for backwards-compatibility
orderList.add(orderList.indexOf("stepSourceGDBInitFile") + 1, "stepSetNonStop"); //$NON-NLS-1$ //$NON-NLS-2$
-
+
return orderList.toArray(new String[orderList.size()]);
}
return null;
}
-
- /**
+
+ /**
* Initialize the members of the FinalLaunchSequence_7_0 class.
* This step is mandatory for the rest of the sequence to complete.
*/
@@ -91,72 +92,72 @@ public class FinalLaunchSequence_7_0 extends FinalLaunchSequence {
rm.done();
}
-
- /**
+
+ /**
* Rollback method for {@link #stepInitializeFinalLaunchSequence_7_0()}
- * @since 4.0
+ * @since 4.0
*/
@RollBack("stepInitializeFinalLaunchSequence_7_0")
public void rollBackInitializeFinalLaunchSequence_7_0(RequestMonitor rm) {
rm.done();
}
-
+
@Override
@Execute
public void stepSetCharset(final RequestMonitor rm) {
// Enable printing of sevenbit-strings. This is required to avoid charset issues.
// See bug 307311 for details.
fCommandControl.queueCommand(
- fCommandFactory.createMIGDBSetPrintSevenbitStrings(fCommandControl.getContext(), true),
- new ImmediateDataRequestMonitor<MIInfo>(rm) {
- @Override
- protected void handleCompleted() {
- // Set the host charset to UTF-8. This ensures that we can correctly handle different
- // charsets used by the inferior program.
- fCommandControl.queueCommand(
- fCommandFactory.createMIGDBSetHostCharset(fCommandControl.getContext(), "UTF-8"), //$NON-NLS-1$
- new ImmediateDataRequestMonitor<MIInfo>(rm) {
- @Override
- protected void handleCompleted() {
- // Set the target charset. The target charset is the charset used by the char type of
- // the inferior program. Note that GDB only accepts upper case charset names.
- String charset =
- Platform.getPreferencesService().getString(CDebugCorePlugin.PLUGIN_ID,
- ICDebugConstants.PREF_DEBUG_CHARSET,
- Charset.defaultCharset().name(),
- null);
- fCommandControl.queueCommand(
- fCommandFactory.createMIGDBSetTargetCharset(fCommandControl.getContext(), charset.toUpperCase()),
- new ImmediateDataRequestMonitor<MIInfo>(rm) {
- @Override
- protected void handleCompleted() {
- // Set the target wide charset. The target wide charset is the charset used by the wchar_t
- // type of the inferior program. Note that GDB only accepts upper case charset names.
- String defaultWideCharset = "UTF-32"; //$NON-NLS-1$
- if (Platform.getOS().equals(Platform.OS_WIN32)) {
- defaultWideCharset = "UTF-16"; //$NON-NLS-1$
- }
-
- String wideCharset =
- Platform.getPreferencesService().getString(CDebugCorePlugin.PLUGIN_ID,
- ICDebugConstants.PREF_DEBUG_WIDE_CHARSET,
- defaultWideCharset,
- null);
-
- fCommandControl.queueCommand(
- fCommandFactory.createMIGDBSetTargetWideCharset(fCommandControl.getContext(), wideCharset.toUpperCase()),
+ fCommandFactory.createMIGDBSetPrintSevenbitStrings(fCommandControl.getContext(), true),
+ new ImmediateDataRequestMonitor<MIInfo>(rm) {
+ @Override
+ protected void handleCompleted() {
+ // Set the host charset to UTF-8. This ensures that we can correctly handle different
+ // charsets used by the inferior program.
+ fCommandControl.queueCommand(
+ fCommandFactory.createMIGDBSetHostCharset(fCommandControl.getContext(), "UTF-8"), //$NON-NLS-1$
+ new ImmediateDataRequestMonitor<MIInfo>(rm) {
+ @Override
+ protected void handleCompleted() {
+ // Set the target charset. The target charset is the charset used by the char type of
+ // the inferior program. Note that GDB only accepts upper case charset names.
+ String charset = Platform.getPreferencesService().getString(
+ CDebugCorePlugin.PLUGIN_ID, ICDebugConstants.PREF_DEBUG_CHARSET,
+ Charset.defaultCharset().name(), null);
+ fCommandControl.queueCommand(
+ fCommandFactory.createMIGDBSetTargetCharset(
+ fCommandControl.getContext(), charset.toUpperCase()),
new ImmediateDataRequestMonitor<MIInfo>(rm) {
@Override
protected void handleCompleted() {
- // Not an essential command, so accept errors
- rm.done();
+ // Set the target wide charset. The target wide charset is the charset used by the wchar_t
+ // type of the inferior program. Note that GDB only accepts upper case charset names.
+ String defaultWideCharset = "UTF-32"; //$NON-NLS-1$
+ if (Platform.getOS().equals(Platform.OS_WIN32)) {
+ defaultWideCharset = "UTF-16"; //$NON-NLS-1$
+ }
+
+ String wideCharset = Platform.getPreferencesService().getString(
+ CDebugCorePlugin.PLUGIN_ID,
+ ICDebugConstants.PREF_DEBUG_WIDE_CHARSET,
+ defaultWideCharset, null);
+
+ fCommandControl.queueCommand(
+ fCommandFactory.createMIGDBSetTargetWideCharset(
+ fCommandControl.getContext(),
+ wideCharset.toUpperCase()),
+ new ImmediateDataRequestMonitor<MIInfo>(rm) {
+ @Override
+ protected void handleCompleted() {
+ // Not an essential command, so accept errors
+ rm.done();
+ }
+ });
}
- });
- }
- });
- }
- });
- }
- });
+ });
+ }
+ });
+ }
+ });
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence_7_12.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence_7_12.java
index 190f7b9ce6e..a3932deb844 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence_7_12.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence_7_12.java
@@ -33,7 +33,7 @@ import org.eclipse.core.runtime.Status;
/**
* Subclass for GDB >= 7.12.
- *
+ *
* @since 5.2
*/
public class FinalLaunchSequence_7_12 extends FinalLaunchSequence_7_7 {
@@ -42,8 +42,7 @@ public class FinalLaunchSequence_7_12 extends FinalLaunchSequence_7_7 {
private Map<String, Object> fAttributes;
private IGDBBackend fGdbBackEnd;
- public FinalLaunchSequence_7_12(DsfSession session, Map<String, Object> attributes,
- RequestMonitorWithProgress rm) {
+ public FinalLaunchSequence_7_12(DsfSession session, Map<String, Object> attributes, RequestMonitorWithProgress rm) {
super(session, attributes, rm);
fAttributes = attributes;
}
@@ -53,8 +52,7 @@ public class FinalLaunchSequence_7_12 extends FinalLaunchSequence_7_7 {
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)));
+ List<String> orderList = new ArrayList<String>(Arrays.asList(super.getExecutionOrder(GROUP_TOP_LEVEL)));
// Now insert our steps right after the initialization of the base class.
orderList.add(orderList.indexOf("stepInitializeFinalLaunchSequence_7_7") + 1, //$NON-NLS-1$
@@ -62,7 +60,7 @@ public class FinalLaunchSequence_7_12 extends FinalLaunchSequence_7_7 {
orderList.add(orderList.indexOf("stepSourceGDBInitFile") + 1, //$NON-NLS-1$
"stepSetTargetAsync"); //$NON-NLS-1$
-
+
orderList.add(orderList.indexOf("stepSetTargetAsync") + 1, //$NON-NLS-1$
"stepSetRecordFullStopAtLimit"); //$NON-NLS-1$
@@ -78,8 +76,7 @@ public class FinalLaunchSequence_7_12 extends FinalLaunchSequence_7_7 {
*/
@Execute
public void stepInitializeFinalLaunchSequence_7_12(RequestMonitor rm) {
- DsfServicesTracker tracker = new DsfServicesTracker(GdbPlugin.getBundleContext(),
- getSession().getId());
+ DsfServicesTracker tracker = new DsfServicesTracker(GdbPlugin.getBundleContext(), getSession().getId());
fCommandControl = tracker.getService(IGDBControl.class);
fGdbBackEnd = tracker.getService(IGDBBackend.class);
@@ -99,8 +96,7 @@ public class FinalLaunchSequence_7_12 extends FinalLaunchSequence_7_7 {
private boolean isNonStop() {
boolean isNonStop = CDebugUtils.getAttribute(fAttributes,
- IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP,
- LaunchUtils.getIsNonStopModeDefault());
+ IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP, LaunchUtils.getIsNonStopModeDefault());
return isNonStop;
}
@@ -119,8 +115,7 @@ public class FinalLaunchSequence_7_12 extends FinalLaunchSequence_7_7 {
asyncOn = true;
}
- fCommandControl.queueCommand(
- fCommandFactory.createMIGDBSetTargetAsync(fCommandControl.getContext(), asyncOn),
+ fCommandControl.queueCommand(fCommandFactory.createMIGDBSetTargetAsync(fCommandControl.getContext(), asyncOn),
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor) {
@Override
protected void handleError() {
@@ -129,7 +124,7 @@ public class FinalLaunchSequence_7_12 extends FinalLaunchSequence_7_7 {
}
});
}
-
+
/**
* Set reverse debugging record full stop-at-limit to off, so GDB does not halt waiting for user input
* when the recording buffer gets full
@@ -138,14 +133,14 @@ public class FinalLaunchSequence_7_12 extends FinalLaunchSequence_7_7 {
@Execute
public void stepSetRecordFullStopAtLimit(RequestMonitor requestMonitor) {
fCommandControl.queueCommand(
- fCommandFactory.createMIGDBSetRecordFullStopAtLimit(fCommandControl.getContext(), false),
- new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor) {
- @Override
- protected void handleError() {
- // Accept errors since this is not essential
- requestMonitor.done();
- }
- });
+ fCommandFactory.createMIGDBSetRecordFullStopAtLimit(fCommandControl.getContext(), false),
+ new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor) {
+ @Override
+ protected void handleError() {
+ // Accept errors since this is not essential
+ requestMonitor.done();
+ }
+ });
}
@Override
@@ -155,11 +150,10 @@ public class FinalLaunchSequence_7_12 extends FinalLaunchSequence_7_7 {
// GDBs that don't support non-stop don't allow you to set it to false.
// We really should set it to false when GDB supports it though.
// Something to fix later.
- // Note: The base class is setting pagination to off, this is only necessary when
+ // Note: The base class is setting pagination to off, this is only necessary when
// using the Full GDB console (The basic console is started in MI mode and does not paginate).
// When the Full GDB console is used, pagination is set to off when GDB is started.
- fCommandControl.queueCommand(
- fCommandFactory.createMIGDBSetNonStop(fCommandControl.getContext(), true),
+ fCommandControl.queueCommand(fCommandFactory.createMIGDBSetNonStop(fCommandControl.getContext(), true),
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor));
} else {
requestMonitor.done();
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence_7_2.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence_7_2.java
index 0b6f5862826..41763985f82 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence_7_2.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence_7_2.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
* Marc Khouzam (Ericsson) - Use new FinalLaunchSequence_7_0 as base class (Bug 365471)
@@ -36,7 +36,7 @@ import org.eclipse.core.runtime.Status;
/**
* Subclass for GDB >= 7.2.
- *
+ *
* @since 4.0
*/
public class FinalLaunchSequence_7_2 extends FinalLaunchSequence_7_0 {
@@ -55,16 +55,17 @@ public class FinalLaunchSequence_7_2 extends FinalLaunchSequence_7_0 {
List<String> orderList = new ArrayList<String>(Arrays.asList(super.getExecutionOrder(GROUP_TOP_LEVEL)));
// Now insert our steps right after the initialization of the base class.
- orderList.add(orderList.indexOf("stepInitializeFinalLaunchSequence_7_0") + 1, "stepInitializeFinalLaunchSequence_7_2"); //$NON-NLS-1$ //$NON-NLS-2$
+ orderList.add(orderList.indexOf("stepInitializeFinalLaunchSequence_7_0") + 1, //$NON-NLS-1$
+ "stepInitializeFinalLaunchSequence_7_2"); //$NON-NLS-1$
orderList.add(orderList.indexOf("stepSetBreakpointPending") + 1, "stepDetachOnFork"); //$NON-NLS-1$ //$NON-NLS-2$
-
+
return orderList.toArray(new String[orderList.size()]);
}
return null;
}
-
- /**
+
+ /**
* Initialize the members of the FinalLaunchSequence_7_2 class.
* This step is mandatory for the rest of the sequence to complete.
*/
@@ -73,27 +74,28 @@ public class FinalLaunchSequence_7_2 extends FinalLaunchSequence_7_0 {
DsfServicesTracker tracker = new DsfServicesTracker(GdbPlugin.getBundleContext(), getSession().getId());
fGdbControl = tracker.getService(IGDBControl.class);
tracker.dispose();
-
- if (fGdbControl == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR, "Cannot obtain service", null)); //$NON-NLS-1$
+
+ if (fGdbControl == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR,
+ "Cannot obtain service", null)); //$NON-NLS-1$
rm.done();
return;
}
-
+
rm.done();
}
-
+
/**
* Tell GDB whether to automatically attach to a forked process or not.
*/
@Execute
public void stepDetachOnFork(final RequestMonitor rm) {
- boolean debugOnFork = CDebugUtils.getAttribute(getAttributes(),
- IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_DEBUG_ON_FORK,
- IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_ON_FORK_DEFAULT);
+ boolean debugOnFork = CDebugUtils.getAttribute(getAttributes(),
+ IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_DEBUG_ON_FORK,
+ IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_ON_FORK_DEFAULT);
fGdbControl.queueCommand(
- fGdbControl.getCommandFactory().createMIGDBSetDetachOnFork(fGdbControl.getContext(), !debugOnFork),
+ fGdbControl.getCommandFactory().createMIGDBSetDetachOnFork(fGdbControl.getContext(), !debugOnFork),
new ImmediateDataRequestMonitor<MIInfo>(rm));
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence_7_7.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence_7_7.java
index 68fc6b62351..98bc35f9a78 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence_7_7.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence_7_7.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Marc Khouzam (Ericsson) - initial API and implementation
*******************************************************************************/
@@ -33,13 +33,13 @@ import org.eclipse.core.runtime.Status;
/**
* Subclass for GDB >= 7.7.
- *
+ *
* @since 4.4
*/
public class FinalLaunchSequence_7_7 extends FinalLaunchSequence_7_2 {
private IGDBControl fControl;
-
+
public FinalLaunchSequence_7_7(DsfSession session, Map<String, Object> attributes, RequestMonitorWithProgress rm) {
super(session, attributes, rm);
}
@@ -52,16 +52,17 @@ public class FinalLaunchSequence_7_7 extends FinalLaunchSequence_7_2 {
List<String> orderList = new ArrayList<String>(Arrays.asList(super.getExecutionOrder(GROUP_TOP_LEVEL)));
// Now insert our steps right after the initialization of the base class.
- orderList.add(orderList.indexOf("stepInitializeFinalLaunchSequence_7_2") + 1, "stepInitializeFinalLaunchSequence_7_7"); //$NON-NLS-1$ //$NON-NLS-2$
+ orderList.add(orderList.indexOf("stepInitializeFinalLaunchSequence_7_2") + 1, //$NON-NLS-1$
+ "stepInitializeFinalLaunchSequence_7_7"); //$NON-NLS-1$
orderList.add(orderList.indexOf("stepSourceGDBInitFile"), "stepSetDPrinfStyle"); //$NON-NLS-1$ //$NON-NLS-2$
-
+
return orderList.toArray(new String[orderList.size()]);
}
return null;
}
-
- /**
+
+ /**
* Initialize the members of the FinalLaunchSequence_7_7 class.
* This step is mandatory for the rest of the sequence to complete.
*/
@@ -70,15 +71,16 @@ public class FinalLaunchSequence_7_7 extends FinalLaunchSequence_7_2 {
DsfServicesTracker tracker = new DsfServicesTracker(GdbPlugin.getBundleContext(), getSession().getId());
fControl = tracker.getService(IGDBControl.class);
tracker.dispose();
-
- if (fControl == null) {
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR, "Cannot obtain service", null)); //$NON-NLS-1$
+
+ if (fControl == null) {
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR,
+ "Cannot obtain service", null)); //$NON-NLS-1$
return;
}
-
+
rm.done();
}
-
+
/**
* Specify how dynamic printf should be handled by GDB.
*/
@@ -86,10 +88,8 @@ public class FinalLaunchSequence_7_7 extends FinalLaunchSequence_7_2 {
public void stepSetDPrinfStyle(final RequestMonitor rm) {
// We use the 'call' style which will
// have dprintf call the printf function in the program.
- fControl.queueCommand(
- fControl.getCommandFactory().createMIGDBSetDPrintfStyle(fControl.getContext(),
- MIGDBSetDPrintfStyle.CALL_STYLE),
- new ImmediateDataRequestMonitor<MIInfo>(rm) {
+ fControl.queueCommand(fControl.getCommandFactory().createMIGDBSetDPrintfStyle(fControl.getContext(),
+ MIGDBSetDPrintfStyle.CALL_STYLE), new ImmediateDataRequestMonitor<MIInfo>(rm) {
@Override
protected void handleCompleted() {
// We accept errors
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GDBDebugger.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GDBDebugger.java
index b2688650655..a741f05003a 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GDBDebugger.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GDBDebugger.java
@@ -12,10 +12,11 @@
* QNX Software Systems - Initial API and implementation
* Ericsson - Modified for DSF
*******************************************************************************/
-package org.eclipse.cdt.dsf.gdb.launching;
+package org.eclipse.cdt.dsf.gdb.launching;
/* This class simply exists because the extension needs it.
* However, since we only use the extension to re-use some CDT code,
* we don't actually need this class to do anything.
*/
-public class GDBDebugger {}
+public class GDBDebugger {
+}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GDBProcess.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GDBProcess.java
index 1461ce74ef9..b081ba7d2a5 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GDBProcess.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GDBProcess.java
@@ -23,16 +23,15 @@ import org.eclipse.debug.core.model.RuntimeProcess;
/**
* A process for the gdb backend to differentiate it from the inferior.
- *
+ *
* This process disables the base class handling of IO streams since
* all IO is handled by the different specialized {@link IDebuggerConsole}
- *
+ *
* @since 3.0
*/
public class GDBProcess extends RuntimeProcess {
- public GDBProcess(ILaunch launch, Process process, String name,
- Map<String, String> attributes) {
+ public GDBProcess(ILaunch launch, Process process, String name, Map<String, String> attributes) {
super(launch, process, name, attributes);
}
@@ -42,7 +41,7 @@ public class GDBProcess extends RuntimeProcess {
* Returning null insures that there will not be a
* text console automatically created for this process
* in the standard console view.
- *
+ *
* @see {@link ProcessConsoleManager#launchChanged}
*/
return null;
@@ -54,17 +53,17 @@ public class GDBProcess extends RuntimeProcess {
* The I/O handling does not go through this RuntimeProcess.
* Instead, the different consoles will connect directly to
* the process to obtain the input, output and error streams.
- *
+ *
* @see {@link GdbFullCliConsolePage} and {@link GdbBasicCliConsole}
*/
return new NoStreamsProxy();
}
- /**
+ /**
* Class that provides a streams proxy that actually
* ignores the I/O streams. We use this because the I/O
* is handled directly by the different {@link IDebuggerConsole}.
- *
+ *
* This is different than NullStreamsProxy which would
* still read but discard the IO, which is not what we want.
*/
@@ -80,7 +79,7 @@ public class GDBProcess extends RuntimeProcess {
}
@Override
- public void write(String input) throws IOException {
+ public void write(String input) throws IOException {
}
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GDBServerDebugger.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GDBServerDebugger.java
index b410abd6544..b93ea1e3b4e 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GDBServerDebugger.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GDBServerDebugger.java
@@ -12,10 +12,11 @@
* QNX Software Systems - Initial API and implementation
* Ericsson - Modified for Ericsson
*******************************************************************************/
-package org.eclipse.cdt.dsf.gdb.launching;
+package org.eclipse.cdt.dsf.gdb.launching;
/* This class simply exists because the extension needs it.
* However, since we only use the extension to re-use some CDT code,
* we don't actually need this class to do anything.
*/
-public class GDBServerDebugger {}
+public class GDBServerDebugger {
+}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbAttachLaunchDelegate.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbAttachLaunchDelegate.java
index e2645943376..28c36fabc73 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbAttachLaunchDelegate.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbAttachLaunchDelegate.java
@@ -11,18 +11,17 @@
* Contributors:
* Ericsson - Initial API and implementation
*******************************************************************************/
-package org.eclipse.cdt.dsf.gdb.launching;
+package org.eclipse.cdt.dsf.gdb.launching;
import org.eclipse.cdt.dsf.concurrent.ThreadSafe;
-
+
/**
* A special launch delegate for the attach debug session, which
* supports the launch when the project and/or binary is not specified.
* @since 4.0
*/
@ThreadSafe
-public class GdbAttachLaunchDelegate extends GdbLaunchDelegate
-{
+public class GdbAttachLaunchDelegate extends GdbLaunchDelegate {
public GdbAttachLaunchDelegate() {
// For an attach session, we don't require a project
// to be specified
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunch.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunch.java
index 71cf400228f..9b7af989956 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunch.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunch.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* Marc Khouzam (Ericsson) - Fix NPE for partial launches (Bug 368597)
@@ -119,7 +119,7 @@ public class GdbLaunch extends DsfLaunch implements ITerminate, IDisconnect, ITr
private IDsfDebugServicesFactory fServiceFactory;
private ILaunchTarget fLaunchTarget;
private Properties fInitialEnv;
-
+
private String fGdbVersion;
public GdbLaunch(ILaunchConfiguration launchConfiguration, String mode, ISourceLocator locator) {
@@ -289,7 +289,7 @@ public class GdbLaunch extends DsfLaunch implements ITerminate, IDisconnect, ITr
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.debug.core.Launch#terminate()
*/
@Override
@@ -347,7 +347,7 @@ public class GdbLaunch extends DsfLaunch implements ITerminate, IDisconnect, ITr
* monitor will never be invoked. Instead callers should use the
* {@link ImmediateExecutor}.
* </p>
- *
+ *
* @param rm
* The request monitor invoked when the shutdown is complete.
*/
@@ -461,7 +461,7 @@ public class GdbLaunch extends DsfLaunch implements ITerminate, IDisconnect, ITr
/**
* Get the default GDB path if not specified in the launch or launch config.
- *
+ *
* @since 5.0
*/
protected String getDefaultGDBPath() {
@@ -472,7 +472,7 @@ public class GdbLaunch extends DsfLaunch implements ITerminate, IDisconnect, ITr
/**
* Returns the path to gdb.
- *
+ *
* @since 5.0
*/
public IPath getGDBPath() {
@@ -497,7 +497,7 @@ public class GdbLaunch extends DsfLaunch implements ITerminate, IDisconnect, ITr
/**
* Set the path to gdb
- *
+ *
* @param path
* the path to gdb
* @since 5.0
@@ -509,16 +509,16 @@ public class GdbLaunch extends DsfLaunch implements ITerminate, IDisconnect, ITr
/**
* This method actually launches 'gdb --version' to determine the version of
* the GDB that is being used. The result is then cached for any future requests.
- *
+ *
* A timeout is scheduled which will kill the process if it takes too long.
- *
+ *
* @since 5.0
*/
public String getGDBVersion() throws CoreException {
if (fGdbVersion != null) {
return fGdbVersion;
}
-
+
String cmd = getGDBPath().toOSString() + " --version"; //$NON-NLS-1$
// Parse cmd to properly handle spaces and such things (bug 458499)
@@ -592,7 +592,7 @@ public class GdbLaunch extends DsfLaunch implements ITerminate, IDisconnect, ITr
/**
* Read from the specified stream and return what was read.
- *
+ *
* @param stream
* The input stream to be used to read the data. This method will
* close the stream.
@@ -627,7 +627,7 @@ public class GdbLaunch extends DsfLaunch implements ITerminate, IDisconnect, ITr
/**
* Gets the CDT environment from the CDT project's configuration referenced
* by the launch
- *
+ *
* @since 5.0
*/
public String[] getLaunchEnvironment() throws CoreException {
@@ -711,7 +711,7 @@ public class GdbLaunch extends DsfLaunch implements ITerminate, IDisconnect, ITr
/**
* Get the location of the gdbinit file.
- *
+ *
* @return gdbinit file location
* @throws CoreException
* @since 5.0
@@ -726,7 +726,7 @@ public class GdbLaunch extends DsfLaunch implements ITerminate, IDisconnect, ITr
/**
* Get the working directory.
- *
+ *
* @return the working directory
* @throws CoreException
* @since 5.0
@@ -791,7 +791,7 @@ public class GdbLaunch extends DsfLaunch implements ITerminate, IDisconnect, ITr
/**
* Get the program arguments
- *
+ *
* @return program arguments
* @throws CoreException
* @since 5.0
@@ -810,7 +810,7 @@ public class GdbLaunch extends DsfLaunch implements ITerminate, IDisconnect, ITr
/**
* Return the program path
- *
+ *
* @return the program path
* @since 5.0
*/
@@ -842,10 +842,10 @@ public class GdbLaunch extends DsfLaunch implements ITerminate, IDisconnect, ITr
}
if (!programPath.toFile().exists()) {
throwException(LaunchMessages.getString("AbstractCLaunchDelegate.Program_file_does_not_exist"), //$NON-NLS-1$
- new FileNotFoundException(
- LaunchMessages.getFormattedString("AbstractCLaunchDelegate.PROGRAM_PATH_not_found", //$NON-NLS-1$
- programPath.toOSString())),
- ICDTLaunchConfigurationConstants.ERR_PROGRAM_NOT_EXIST);
+ new FileNotFoundException(
+ LaunchMessages.getFormattedString("AbstractCLaunchDelegate.PROGRAM_PATH_not_found", //$NON-NLS-1$
+ programPath.toOSString())),
+ ICDTLaunchConfigurationConstants.ERR_PROGRAM_NOT_EXIST);
}
return programPath.toOSString();
@@ -854,7 +854,7 @@ public class GdbLaunch extends DsfLaunch implements ITerminate, IDisconnect, ITr
/**
* Throws a core exception with an error status object built from the given
* message, lower level exception, and error code.
- *
+ *
* @param message
* the status message
* @param exception
@@ -865,15 +865,15 @@ public class GdbLaunch extends DsfLaunch implements ITerminate, IDisconnect, ITr
*/
private static void throwException(String message, Throwable exception, int code) throws CoreException {
MultiStatus status = new MultiStatus(GdbPlugin.PLUGIN_ID, code, message, exception);
- status.add(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, code,
- exception == null ? "" : exception.getLocalizedMessage(), //$NON-NLS-1$
- exception));
+ status.add(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, code,
+ exception == null ? "" : exception.getLocalizedMessage(), //$NON-NLS-1$
+ exception));
throw new CoreException(status);
}
/**
* Sets the program path
- *
+ *
* @param programPath
* the program path
* @throws CoreException
@@ -885,7 +885,7 @@ public class GdbLaunch extends DsfLaunch implements ITerminate, IDisconnect, ITr
/**
* Return shared library paths
- *
+ *
* @return shared library paths
* @throws CoreException
* @since 5.0
@@ -897,7 +897,7 @@ public class GdbLaunch extends DsfLaunch implements ITerminate, IDisconnect, ITr
/**
* return the environment
- *
+ *
* @return the environment
* @throws CoreException
* @since 5.0
@@ -951,7 +951,7 @@ public class GdbLaunch extends DsfLaunch implements ITerminate, IDisconnect, ITr
/**
* Get whether to clear the environment before applying the variables
- *
+ *
* @return clear
* @throws CoreException
* @since 5.0
@@ -962,7 +962,7 @@ public class GdbLaunch extends DsfLaunch implements ITerminate, IDisconnect, ITr
/**
* Get whether to update thread list on suspend
- *
+ *
* @return whether
* @throws CoreException
* @since 5.0
@@ -975,7 +975,7 @@ public class GdbLaunch extends DsfLaunch implements ITerminate, IDisconnect, ITr
/**
* Set the launch target
- *
+ *
* @param launchTarget
* the launch target
* @since 5.0
@@ -986,7 +986,7 @@ public class GdbLaunch extends DsfLaunch implements ITerminate, IDisconnect, ITr
/**
* Return the launch target
- *
+ *
* @since 5.0
*/
@Override
@@ -997,7 +997,7 @@ public class GdbLaunch extends DsfLaunch implements ITerminate, IDisconnect, ITr
/**
* Set the initial environment variables. These can then be overriden
* by launch configuration attributes.
- *
+ *
* @since 5.2
*/
public void setInitialEnvironment(Properties initialEnv) {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunchDelegate.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunchDelegate.java
index d57bbe55a58..126baca1386 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunchDelegate.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunchDelegate.java
@@ -11,7 +11,7 @@
* Contributors:
* QNX Software Systems - Initial API and implementation
* Windriver and Ericsson - Updated for DSF
- * IBM Corporation
+ * IBM Corporation
* Ericsson - Added support for Mac OS
* Ericsson - Added support for post-mortem trace files
* Abeer Bagul (Tensilica) - Allow to better override GdbLaunch (bug 339550)
@@ -21,7 +21,7 @@
* Marc Khouzam (Ericsson - Show GDB version in debug view node label (Bug 455408)
* Samuel Hultgren (STMicroelectronics) - Bug 533769
*******************************************************************************/
-package org.eclipse.cdt.dsf.gdb.launching;
+package org.eclipse.cdt.dsf.gdb.launching;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
@@ -57,20 +57,19 @@ import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.core.model.ISourceLocator;
-
+
/**
* The shared launch configuration delegate for the DSF/GDB debugger.
* This delegate supports all configuration types (local, remote, attach, etc)
*/
@ThreadSafe
-public class GdbLaunchDelegate extends AbstractCLaunchDelegate2
-{
- public static final String GDB_DEBUG_MODEL_ID = "org.eclipse.cdt.dsf.gdb"; //$NON-NLS-1$
-
- private static final String NON_STOP_FIRST_VERSION = "6.8.50"; //$NON-NLS-1$
-
- private static final String TRACING_FIRST_VERSION = "7.1.50"; //$NON-NLS-1$
-
+public class GdbLaunchDelegate extends AbstractCLaunchDelegate2 {
+ public static final String GDB_DEBUG_MODEL_ID = "org.eclipse.cdt.dsf.gdb"; //$NON-NLS-1$
+
+ private static final String NON_STOP_FIRST_VERSION = "6.8.50"; //$NON-NLS-1$
+
+ private static final String TRACING_FIRST_VERSION = "7.1.50"; //$NON-NLS-1$
+
public GdbLaunchDelegate() {
// We now fully support project-less debugging
// See bug 343861
@@ -85,210 +84,225 @@ public class GdbLaunchDelegate extends AbstractCLaunchDelegate2
}
@Override
- public void launch( ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor ) throws CoreException {
+ public void launch(ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor)
+ throws CoreException {
org.eclipse.cdt.launch.LaunchUtils.enableActivity("org.eclipse.cdt.debug.dsfgdbActivity", true); //$NON-NLS-1$
- if ( monitor == null ) {
+ if (monitor == null) {
monitor = new NullProgressMonitor();
}
- if ( mode.equals( ILaunchManager.DEBUG_MODE ) ) {
- launchDebugger( config, launch, monitor );
+ if (mode.equals(ILaunchManager.DEBUG_MODE)) {
+ launchDebugger(config, launch, monitor);
}
}
- private void launchDebugger( ILaunchConfiguration config, ILaunch launch, IProgressMonitor monitor ) throws CoreException {
- monitor.beginTask(LaunchMessages.getString("GdbLaunchDelegate.0"), 10); //$NON-NLS-1$
- if ( monitor.isCanceled() ) {
+ private void launchDebugger(ILaunchConfiguration config, ILaunch launch, IProgressMonitor monitor)
+ throws CoreException {
+ monitor.beginTask(LaunchMessages.getString("GdbLaunchDelegate.0"), 10); //$NON-NLS-1$
+ if (monitor.isCanceled()) {
return;
}
try {
- launchDebugSession( config, launch, monitor );
- }
- finally {
+ launchDebugSession(config, launch, monitor);
+ } finally {
monitor.done();
- }
+ }
}
/** @since 4.1 */
- protected void launchDebugSession( final ILaunchConfiguration config, ILaunch l, IProgressMonitor monitor ) throws CoreException {
- if ( monitor.isCanceled() ) {
+ protected void launchDebugSession(final ILaunchConfiguration config, ILaunch l, IProgressMonitor monitor)
+ throws CoreException {
+ if (monitor.isCanceled()) {
return;
}
-
+
SessionType sessionType = LaunchUtils.getSessionType(config);
boolean attach = LaunchUtils.getIsAttach(config);
-
- final GdbLaunch launch = (GdbLaunch)l;
-
- if (sessionType == SessionType.REMOTE) {
- monitor.subTask( LaunchMessages.getString("GdbLaunchDelegate.1") ); //$NON-NLS-1$
- } else if (sessionType == SessionType.CORE) {
- monitor.subTask( LaunchMessages.getString("GdbLaunchDelegate.2") ); //$NON-NLS-1$
- } else {
- assert sessionType == SessionType.LOCAL : "Unexpected session type: " + sessionType.toString(); //$NON-NLS-1$
- monitor.subTask( LaunchMessages.getString("GdbLaunchDelegate.3") ); //$NON-NLS-1$
- }
-
- // An attach session does not need to necessarily have an
- // executable specified. This is because:
- // - In remote multi-process attach, there will be more than one executable
- // In this case executables need to be specified differently.
- // The current solution is to use the solib-search-path to specify
- // the path of any executable we can attach to.
- // - In local single process, GDB has the ability to find the executable
- // automatically.
- if (!attach) {
- checkBinaryDetails(config);
- }
-
- monitor.worked(1);
-
- String gdbVersion = launch.getGDBVersion();
-
- // First make sure non-stop is supported, if the user want to use this mode
- if (LaunchUtils.getIsNonStopMode(config) && !isNonStopSupportedInGdbVersion(gdbVersion)) {
- throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED,
- "Non-stop mode is not supported for GDB " + gdbVersion + ", GDB " + NON_STOP_FIRST_VERSION + " or higher is required.", null)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- if (LaunchUtils.getIsPostMortemTracing(config) && !isPostMortemTracingSupportedInGdbVersion(gdbVersion)) {
- throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED,
- "Post-mortem tracing is not supported for GDB " + gdbVersion + ", GDB " + NON_STOP_FIRST_VERSION + " or higher is required.", null)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- launch.setServiceFactory(newServiceFactory(config, gdbVersion));
-
- // Time to start the DSF stuff. First initialize the launch.
- // We do this here to avoid having to cleanup in case
- // the launch is cancelled above.
- // This initialize() call is the first thing that requires cleanup
- // followed by the steps further down which also need cleanup.
- launch.initialize();
-
- // Create and invoke the launch sequence to create the debug control and services
- IProgressMonitor subMon1 = new SubProgressMonitor(monitor, 4, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK);
- Sequence servicesLaunchSequence = getServicesSequence(launch.getSession(), launch, subMon1);
-
- launch.getSession().getExecutor().execute(servicesLaunchSequence);
- boolean succeed = false;
- try {
- servicesLaunchSequence.get();
- succeed = true;
- } catch (InterruptedException e1) {
- throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.INTERNAL_ERROR, "Interrupted Exception in dispatch thread", e1)); //$NON-NLS-1$
- } catch (ExecutionException e1) {
- throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Error in services launch sequence", e1.getCause())); //$NON-NLS-1$
- } catch (CancellationException e1) {
- // Launch aborted, so exit cleanly
- return;
- } finally {
- if (!succeed) {
- cleanupLaunch(launch);
- }
- }
-
- if (monitor.isCanceled()) {
+
+ final GdbLaunch launch = (GdbLaunch) l;
+
+ if (sessionType == SessionType.REMOTE) {
+ monitor.subTask(LaunchMessages.getString("GdbLaunchDelegate.1")); //$NON-NLS-1$
+ } else if (sessionType == SessionType.CORE) {
+ monitor.subTask(LaunchMessages.getString("GdbLaunchDelegate.2")); //$NON-NLS-1$
+ } else {
+ assert sessionType == SessionType.LOCAL : "Unexpected session type: " + sessionType.toString(); //$NON-NLS-1$
+ monitor.subTask(LaunchMessages.getString("GdbLaunchDelegate.3")); //$NON-NLS-1$
+ }
+
+ // An attach session does not need to necessarily have an
+ // executable specified. This is because:
+ // - In remote multi-process attach, there will be more than one executable
+ // In this case executables need to be specified differently.
+ // The current solution is to use the solib-search-path to specify
+ // the path of any executable we can attach to.
+ // - In local single process, GDB has the ability to find the executable
+ // automatically.
+ if (!attach) {
+ checkBinaryDetails(config);
+ }
+
+ monitor.worked(1);
+
+ String gdbVersion = launch.getGDBVersion();
+
+ // First make sure non-stop is supported, if the user want to use this mode
+ if (LaunchUtils.getIsNonStopMode(config) && !isNonStopSupportedInGdbVersion(gdbVersion)) {
+ throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED,
+ "Non-stop mode is not supported for GDB " + gdbVersion + ", GDB " + NON_STOP_FIRST_VERSION //$NON-NLS-1$//$NON-NLS-2$
+ + " or higher is required.", //$NON-NLS-1$
+ null));
+ }
+
+ if (LaunchUtils.getIsPostMortemTracing(config) && !isPostMortemTracingSupportedInGdbVersion(gdbVersion)) {
+ throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED,
+ "Post-mortem tracing is not supported for GDB " + gdbVersion + ", GDB " + NON_STOP_FIRST_VERSION //$NON-NLS-1$//$NON-NLS-2$
+ + " or higher is required.", //$NON-NLS-1$
+ null));
+ }
+
+ launch.setServiceFactory(newServiceFactory(config, gdbVersion));
+
+ // Time to start the DSF stuff. First initialize the launch.
+ // We do this here to avoid having to cleanup in case
+ // the launch is cancelled above.
+ // This initialize() call is the first thing that requires cleanup
+ // followed by the steps further down which also need cleanup.
+ launch.initialize();
+
+ // Create and invoke the launch sequence to create the debug control and services
+ IProgressMonitor subMon1 = new SubProgressMonitor(monitor, 4, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK);
+ Sequence servicesLaunchSequence = getServicesSequence(launch.getSession(), launch, subMon1);
+
+ launch.getSession().getExecutor().execute(servicesLaunchSequence);
+ boolean succeed = false;
+ try {
+ servicesLaunchSequence.get();
+ succeed = true;
+ } catch (InterruptedException e1) {
+ throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.INTERNAL_ERROR,
+ "Interrupted Exception in dispatch thread", e1)); //$NON-NLS-1$
+ } catch (ExecutionException e1) {
+ throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED,
+ "Error in services launch sequence", e1.getCause())); //$NON-NLS-1$
+ } catch (CancellationException e1) {
+ // Launch aborted, so exit cleanly
+ return;
+ } finally {
+ if (!succeed) {
+ cleanupLaunch(launch);
+ }
+ }
+
+ if (monitor.isCanceled()) {
cleanupLaunch(launch);
return;
- }
-
- // The initializeControl method should be called after the ICommandControlService
- // is initialized in the ServicesLaunchSequence above. This is because it is that
- // service that will trigger the launch cleanup (if we need it during this launch)
- // through an ICommandControlShutdownDMEvent
- launch.initializeControl();
-
- // Add the GDB process object to the launch.
- launch.addCLIProcess(getCLILabel(config, gdbVersion));
-
- monitor.worked(1);
-
- // Create and invoke the final launch sequence to setup GDB
- final IProgressMonitor subMon2 = new SubProgressMonitor(monitor, 4, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK);
-
- Query<Object> completeLaunchQuery = new Query<Object>() {
- @Override
- protected void execute(final DataRequestMonitor<Object> rm) {
- DsfServicesTracker tracker = new DsfServicesTracker(GdbPlugin.getBundleContext(), launch.getSession().getId());
- IGDBControl control = tracker.getService(IGDBControl.class);
- tracker.dispose();
- control.completeInitialization(new RequestMonitorWithProgress(ImmediateExecutor.getInstance(), subMon2) {
- @Override
- protected void handleCompleted() {
- if (isCanceled()) {
- rm.cancel();
- } else {
- rm.setStatus(getStatus());
- }
- rm.done();
- }
- });
- }
- };
-
- launch.getSession().getExecutor().execute(completeLaunchQuery);
- succeed = false;
- try {
- completeLaunchQuery.get();
- succeed = true;
- } catch (InterruptedException e1) {
- throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.INTERNAL_ERROR, "Interrupted Exception in dispatch thread", e1)); //$NON-NLS-1$
- } catch (ExecutionException e1) {
- final Throwable cause = e1.getCause();
- String message = ""; //$NON-NLS-1$
- if (cause != null) {
- message = ":\n\n" + cause.getMessage(); //$NON-NLS-1$
- }
- throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Error in final launch sequence" + message, cause)); //$NON-NLS-1$
- } catch (CancellationException e1) {
- // Launch aborted, so exit cleanly
- return;
- } finally {
- if (!succeed) {
- // finalLaunchSequence failed. Shutdown the session so that all started
- // services including any GDB process are shutdown. (bug 251486)
- cleanupLaunch(launch);
- }
- }
+ }
+
+ // The initializeControl method should be called after the ICommandControlService
+ // is initialized in the ServicesLaunchSequence above. This is because it is that
+ // service that will trigger the launch cleanup (if we need it during this launch)
+ // through an ICommandControlShutdownDMEvent
+ launch.initializeControl();
+
+ // Add the GDB process object to the launch.
+ launch.addCLIProcess(getCLILabel(config, gdbVersion));
+
+ monitor.worked(1);
+
+ // Create and invoke the final launch sequence to setup GDB
+ final IProgressMonitor subMon2 = new SubProgressMonitor(monitor, 4,
+ SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK);
+
+ Query<Object> completeLaunchQuery = new Query<Object>() {
+ @Override
+ protected void execute(final DataRequestMonitor<Object> rm) {
+ DsfServicesTracker tracker = new DsfServicesTracker(GdbPlugin.getBundleContext(),
+ launch.getSession().getId());
+ IGDBControl control = tracker.getService(IGDBControl.class);
+ tracker.dispose();
+ control.completeInitialization(
+ new RequestMonitorWithProgress(ImmediateExecutor.getInstance(), subMon2) {
+ @Override
+ protected void handleCompleted() {
+ if (isCanceled()) {
+ rm.cancel();
+ } else {
+ rm.setStatus(getStatus());
+ }
+ rm.done();
+ }
+ });
+ }
+ };
+
+ launch.getSession().getExecutor().execute(completeLaunchQuery);
+ succeed = false;
+ try {
+ completeLaunchQuery.get();
+ succeed = true;
+ } catch (InterruptedException e1) {
+ throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.INTERNAL_ERROR,
+ "Interrupted Exception in dispatch thread", e1)); //$NON-NLS-1$
+ } catch (ExecutionException e1) {
+ final Throwable cause = e1.getCause();
+ String message = ""; //$NON-NLS-1$
+ if (cause != null) {
+ message = ":\n\n" + cause.getMessage(); //$NON-NLS-1$
+ }
+ throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED,
+ "Error in final launch sequence" + message, cause)); //$NON-NLS-1$
+ } catch (CancellationException e1) {
+ // Launch aborted, so exit cleanly
+ return;
+ } finally {
+ if (!succeed) {
+ // finalLaunchSequence failed. Shutdown the session so that all started
+ // services including any GDB process are shutdown. (bug 251486)
+ cleanupLaunch(launch);
+ }
+ }
}
/**
- * Return the label to be used for the CLI node
+ * Return the label to be used for the CLI node
* @since 4.6
*/
protected String getCLILabel(ILaunchConfiguration config, String gdbVersion) throws CoreException {
- return LaunchUtils.getGDBPath(config).toString().trim() + " (" + gdbVersion +")"; //$NON-NLS-1$ //$NON-NLS-2$
+ return LaunchUtils.getGDBPath(config).toString().trim() + " (" + gdbVersion + ")"; //$NON-NLS-1$ //$NON-NLS-2$
}
-
- /**
+
+ /**
* This method takes care of cleaning up any resources allocated by the launch, as early as
* the call to getLaunch(), whenever the launch is cancelled or does not complete properly.
* @since 5.0 */
protected void cleanupLaunch(ILaunch launch) throws DebugException {
if (launch instanceof GdbLaunch) {
- final GdbLaunch gdbLaunch = (GdbLaunch)launch;
- Query<Object> launchShutdownQuery = new Query<Object>() {
- @Override
- protected void execute(DataRequestMonitor<Object> rm) {
- gdbLaunch.shutdownSession(rm);
- }
- };
-
- gdbLaunch.getSession().getExecutor().execute(launchShutdownQuery);
-
- // wait for the shutdown to finish.
- // The Query.get() method is a synchronous call which blocks until the
- // query completes.
- try {
- launchShutdownQuery.get();
- } catch (InterruptedException e) {
- throw new DebugException( new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.INTERNAL_ERROR, "InterruptedException while shutting down debugger launch " + launch, e)); //$NON-NLS-1$
- } catch (ExecutionException e) {
- throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Error in shutting down debugger launch " + launch, e)); //$NON-NLS-1$
- }
+ final GdbLaunch gdbLaunch = (GdbLaunch) launch;
+ Query<Object> launchShutdownQuery = new Query<Object>() {
+ @Override
+ protected void execute(DataRequestMonitor<Object> rm) {
+ gdbLaunch.shutdownSession(rm);
+ }
+ };
+
+ gdbLaunch.getSession().getExecutor().execute(launchShutdownQuery);
+
+ // wait for the shutdown to finish.
+ // The Query.get() method is a synchronous call which blocks until the
+ // query completes.
+ try {
+ launchShutdownQuery.get();
+ } catch (InterruptedException e) {
+ throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.INTERNAL_ERROR,
+ "InterruptedException while shutting down debugger launch " + launch, e)); //$NON-NLS-1$
+ } catch (ExecutionException e) {
+ throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED,
+ "Error in shutting down debugger launch " + launch, e)); //$NON-NLS-1$
+ }
}
}
-
+
/**
* Method used to check that the project and program are correct.
* Can be overridden to avoid checking certain things.
@@ -317,9 +331,10 @@ public class GdbLaunchDelegate extends AbstractCLaunchDelegate2
}
@Override
- public boolean preLaunchCheck(ILaunchConfiguration config, String mode, IProgressMonitor monitor) throws CoreException {
- // Setup default GDB Process Factory
- // Bug 210366
+ public boolean preLaunchCheck(ILaunchConfiguration config, String mode, IProgressMonitor monitor)
+ throws CoreException {
+ // Setup default GDB Process Factory
+ // Bug 210366
setDefaultProcessFactory(config);
// Forcibly turn off non-stop for post-mortem sessions.
@@ -331,116 +346,119 @@ public class GdbLaunchDelegate extends AbstractCLaunchDelegate2
if (LaunchUtils.getIsNonStopMode(config)) {
ILaunchConfigurationWorkingCopy wcConfig = config.getWorkingCopy();
wcConfig.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP, false);
- wcConfig.doSave();
+ wcConfig.doSave();
}
-
+
// no further prelaunch check for core files
return true;
}
-
+
return super.preLaunchCheck(config, mode, monitor);
// No need to cleanup in the case of errors: we haven't setup anything yet.
}
- /**
- * Modify the ILaunchConfiguration to set the DebugPlugin.ATTR_PROCESS_FACTORY_ID attribute,
- * so as to specify the process factory to use.
- *
- * This attribute should only be set if it is not part of the configuration already, to allow
- * other code to set it to something else.
+ /**
+ * Modify the ILaunchConfiguration to set the DebugPlugin.ATTR_PROCESS_FACTORY_ID attribute,
+ * so as to specify the process factory to use.
+ *
+ * This attribute should only be set if it is not part of the configuration already, to allow
+ * other code to set it to something else.
* @since 4.1
*/
- protected void setDefaultProcessFactory(ILaunchConfiguration config) throws CoreException {
- // Bug 210366
- if (!config.hasAttribute(DebugPlugin.ATTR_PROCESS_FACTORY_ID)) {
- ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
- wc.setAttribute(DebugPlugin.ATTR_PROCESS_FACTORY_ID,
- IGDBLaunchConfigurationConstants.DEBUGGER_ATTR_PROCESS_FACTORY_ID_DEFAULT);
- wc.doSave();
- }
- }
-
- // This is the first method to be called in the launch sequence, even before preLaunchCheck()
- // If we cancel the launch, we need to cleanup what is allocated in this method. The cleanup
- // can be performed by GdbLaunch.shutdownSession()
- @Override
- public ILaunch getLaunch(ILaunchConfiguration configuration, String mode) throws CoreException {
- GdbLaunch launch = createGdbLaunch(configuration, mode, null);
- // Don't initialize the GdbLaunch yet to avoid needing to cleanup.
- // We will initialize the launch once we know it will proceed and
- // that we need to start using it.
-
- // Need to configure the source locator before returning the launch
- // because once the launch is created and added to the launch manager,
- // the adapters will be created for the whole session, including
- // the source lookup adapter.
- launch.setSourceLocator(getSourceLocator(configuration, launch.getSession()));
- return launch;
- }
-
- /**
- * Creates an object of GdbLaunch.
- * Subclasses who wish to just replace the GdbLaunch object with a sub-classed GdbLaunch
- * should override this method.
- * Subclasses who wish to replace the GdbLaunch object as well as change the
- * initialization sequence of the launch, should override getLaunch() as well as this method.
- * Subclasses who wish to create a launch class which does not subclass GdbLaunch,
- * are advised to override getLaunch() directly.
- *
- * @param configuration The launch configuration
- * @param mode The launch mode - "run", "debug", "profile"
- * @param locator The source locator. Can be null.
- * @return The GdbLaunch object, or a sub-classed object
- * @throws CoreException
- * @since 4.1
- */
- protected GdbLaunch createGdbLaunch(ILaunchConfiguration configuration, String mode, ISourceLocator locator) throws CoreException {
- return new GdbLaunch(configuration, mode, locator);
- }
-
- /**
- * Returns a sequence that will create and initialize the different DSF services.
- * Subclasses that wish to add/remove services can override this method.
- *
- * @param session The current DSF session
- * @param launch The current launch
- * @param rm The progress monitor that is to be used to cancel the sequence if so desired.
- * @since 4.5
- */
- protected Sequence getServicesSequence(DsfSession session, ILaunch launch, IProgressMonitor rm) {
- return new ServicesLaunchSequence(session, (GdbLaunch)launch, rm);
- }
-
- /**
- * Creates and initializes the source locator for the given launch configuration and dsf session.
- * @since 4.1
- */
- protected ISourceLocator getSourceLocator(ILaunchConfiguration configuration, DsfSession session) throws CoreException {
- DsfSourceLookupDirector locator = createDsfSourceLocator(configuration, session);
- String memento = configuration.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, (String)null);
- if (memento == null) {
- locator.initializeDefaults(configuration);
- } else {
- locator.initializeFromMemento(memento, configuration);
- }
- return locator;
- }
-
- /**
- * Creates an object of DsfSourceLookupDirector with the given DsfSession.
- * Subclasses who wish to just replace the source locator object with a sub-classed source locator
- * should override this method.
- * Subclasses who wish to replace the source locator object as well as change the
- * initialization sequence of the source locator, should override getSourceLocator()
- * as well as this method.
- * Subclasses who wish to create a source locator which does not subclass DsfSourceLookupDirector,
- * are advised to override getSourceLocator() directly.
- * @since 4.1
- */
- protected DsfSourceLookupDirector createDsfSourceLocator(ILaunchConfiguration configuration, DsfSession session) throws CoreException {
- return new GdbSourceLookupDirector(session);
- }
-
+ protected void setDefaultProcessFactory(ILaunchConfiguration config) throws CoreException {
+ // Bug 210366
+ if (!config.hasAttribute(DebugPlugin.ATTR_PROCESS_FACTORY_ID)) {
+ ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
+ wc.setAttribute(DebugPlugin.ATTR_PROCESS_FACTORY_ID,
+ IGDBLaunchConfigurationConstants.DEBUGGER_ATTR_PROCESS_FACTORY_ID_DEFAULT);
+ wc.doSave();
+ }
+ }
+
+ // This is the first method to be called in the launch sequence, even before preLaunchCheck()
+ // If we cancel the launch, we need to cleanup what is allocated in this method. The cleanup
+ // can be performed by GdbLaunch.shutdownSession()
+ @Override
+ public ILaunch getLaunch(ILaunchConfiguration configuration, String mode) throws CoreException {
+ GdbLaunch launch = createGdbLaunch(configuration, mode, null);
+ // Don't initialize the GdbLaunch yet to avoid needing to cleanup.
+ // We will initialize the launch once we know it will proceed and
+ // that we need to start using it.
+
+ // Need to configure the source locator before returning the launch
+ // because once the launch is created and added to the launch manager,
+ // the adapters will be created for the whole session, including
+ // the source lookup adapter.
+ launch.setSourceLocator(getSourceLocator(configuration, launch.getSession()));
+ return launch;
+ }
+
+ /**
+ * Creates an object of GdbLaunch.
+ * Subclasses who wish to just replace the GdbLaunch object with a sub-classed GdbLaunch
+ * should override this method.
+ * Subclasses who wish to replace the GdbLaunch object as well as change the
+ * initialization sequence of the launch, should override getLaunch() as well as this method.
+ * Subclasses who wish to create a launch class which does not subclass GdbLaunch,
+ * are advised to override getLaunch() directly.
+ *
+ * @param configuration The launch configuration
+ * @param mode The launch mode - "run", "debug", "profile"
+ * @param locator The source locator. Can be null.
+ * @return The GdbLaunch object, or a sub-classed object
+ * @throws CoreException
+ * @since 4.1
+ */
+ protected GdbLaunch createGdbLaunch(ILaunchConfiguration configuration, String mode, ISourceLocator locator)
+ throws CoreException {
+ return new GdbLaunch(configuration, mode, locator);
+ }
+
+ /**
+ * Returns a sequence that will create and initialize the different DSF services.
+ * Subclasses that wish to add/remove services can override this method.
+ *
+ * @param session The current DSF session
+ * @param launch The current launch
+ * @param rm The progress monitor that is to be used to cancel the sequence if so desired.
+ * @since 4.5
+ */
+ protected Sequence getServicesSequence(DsfSession session, ILaunch launch, IProgressMonitor rm) {
+ return new ServicesLaunchSequence(session, (GdbLaunch) launch, rm);
+ }
+
+ /**
+ * Creates and initializes the source locator for the given launch configuration and dsf session.
+ * @since 4.1
+ */
+ protected ISourceLocator getSourceLocator(ILaunchConfiguration configuration, DsfSession session)
+ throws CoreException {
+ DsfSourceLookupDirector locator = createDsfSourceLocator(configuration, session);
+ String memento = configuration.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, (String) null);
+ if (memento == null) {
+ locator.initializeDefaults(configuration);
+ } else {
+ locator.initializeFromMemento(memento, configuration);
+ }
+ return locator;
+ }
+
+ /**
+ * Creates an object of DsfSourceLookupDirector with the given DsfSession.
+ * Subclasses who wish to just replace the source locator object with a sub-classed source locator
+ * should override this method.
+ * Subclasses who wish to replace the source locator object as well as change the
+ * initialization sequence of the source locator, should override getSourceLocator()
+ * as well as this method.
+ * Subclasses who wish to create a source locator which does not subclass DsfSourceLookupDirector,
+ * are advised to override getSourceLocator() directly.
+ * @since 4.1
+ */
+ protected DsfSourceLookupDirector createDsfSourceLocator(ILaunchConfiguration configuration, DsfSession session)
+ throws CoreException {
+ return new GdbSourceLookupDirector(session);
+ }
+
/**
* Returns true if the specified version of GDB supports
* non-stop mode.
@@ -460,9 +478,9 @@ public class GdbLaunchDelegate extends AbstractCLaunchDelegate2
*/
protected boolean isPostMortemTracingSupportedInGdbVersion(String version) {
if (TRACING_FIRST_VERSION.compareTo(version) <= 0
- // This feature will be available for GDB 7.2. But until that GDB is itself available
- // there is a pre-release that has a version of 6.8.50.20090414
- || "6.8.50.20090414".equals(version)) { //$NON-NLS-1$
+ // This feature will be available for GDB 7.2. But until that GDB is itself available
+ // there is a pre-release that has a version of 6.8.50.20090414
+ || "6.8.50.20090414".equals(version)) { //$NON-NLS-1$
return true;
}
return false;
@@ -473,7 +491,7 @@ public class GdbLaunchDelegate extends AbstractCLaunchDelegate2
* A subclass can override this method and provide its own ServiceFactory.
* @since 4.1
*/
- protected IDsfDebugServicesFactory newServiceFactory(ILaunchConfiguration config, String version) {
+ protected IDsfDebugServicesFactory newServiceFactory(ILaunchConfiguration config, String version) {
return new GdbDebugServicesFactory(version, config);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbProcessFactory.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbProcessFactory.java
index cdc0543ce6a..8d3ecec85c0 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbProcessFactory.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbProcessFactory.java
@@ -32,15 +32,17 @@ public class GdbProcessFactory implements IProcessFactory {
@Override
public IProcess newProcess(ILaunch launch, Process process, String label, Map<String, String> attributes) {
if (attributes != null) {
- if (IGdbDebugConstants.GDB_PROCESS_CREATION_VALUE.equals(attributes.get(IGdbDebugConstants.PROCESS_TYPE_CREATION_ATTR))) {
+ if (IGdbDebugConstants.GDB_PROCESS_CREATION_VALUE
+ .equals(attributes.get(IGdbDebugConstants.PROCESS_TYPE_CREATION_ATTR))) {
return new GDBProcess(launch, process, label, attributes);
}
- if (IGdbDebugConstants.INFERIOR_PROCESS_CREATION_VALUE.equals(attributes.get(IGdbDebugConstants.PROCESS_TYPE_CREATION_ATTR))) {
+ if (IGdbDebugConstants.INFERIOR_PROCESS_CREATION_VALUE
+ .equals(attributes.get(IGdbDebugConstants.PROCESS_TYPE_CREATION_ATTR))) {
return new InferiorRuntimeProcess(launch, process, label, attributes);
}
- }
-
+ }
+
return new RuntimeProcess(launch, process, label, attributes);
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbSourceLookupDirector.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbSourceLookupDirector.java
index 735a20d3cfc..f333db6176a 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbSourceLookupDirector.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbSourceLookupDirector.java
@@ -38,7 +38,7 @@ import org.eclipse.debug.core.sourcelookup.containers.DefaultSourceContainer;
* GDB backend handling path substitutions using gdb's "set substitute-path"
* mechanism. This director works in tandem with {@link IGDBSourceLookup}
* service to synchronise GDB's path substitutions.
- *
+ *
* @since 5.0
*/
public class GdbSourceLookupDirector extends DsfSourceLookupDirector {
@@ -63,7 +63,7 @@ public class GdbSourceLookupDirector extends DsfSourceLookupDirector {
/**
* Return a map of substitutions with the Key being the compilation path and
* the Value being the machine local path.
- *
+ *
* @return map of substitutions
*/
public Map<String, String> getSubstitutionsPaths() {
@@ -75,7 +75,7 @@ public class GdbSourceLookupDirector extends DsfSourceLookupDirector {
* Bug 500988: getting source containers from composite containers has a race
* condition around termination. This can lead to a NPE being thrown from within
* the above code.
- *
+ *
* The reason for the NPE is that termination of a launch can cause the launch
* configuration to be updated (e.g. with memory settings memento). This update
* causes the source lookups to be recalculated, however that recalculation is
@@ -84,7 +84,7 @@ public class GdbSourceLookupDirector extends DsfSourceLookupDirector {
* thread safe, we get NPEs. See CompositeSourceContainer.dispose() where the
* race condition is. Unfortunately synchronizing it leads to potential
* deadlocks.
- *
+ *
* Catching all NPEs and silently discarding them makes it very hard to track
* down bugs, so in case the NPE is caused for another reason we are logging it.
*/
@@ -135,7 +135,7 @@ public class GdbSourceLookupDirector extends DsfSourceLookupDirector {
* DefaultSourceContainer, but not in other types of
* composite containers (e.g. a DirectorySourceContainer
* cannot contain a MappingSourceContainer).
- *
+ *
* It is important we don't recurse across all composites
* containers for performance reasons. If a
* DirectorySourceContainer was recursed here, then it could
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbSourceLookupParticipant.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbSourceLookupParticipant.java
index 0e5a5f2d5e3..8940a4fd534 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbSourceLookupParticipant.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbSourceLookupParticipant.java
@@ -34,7 +34,7 @@ import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
* Source Lookup Participant that notifies the {@link IGDBSourceLookup} service
* of changes to the lookup path to allow the source lookup service to update
* GDB's substituted paths.
- *
+ *
* @since 5.0
*/
@ThreadSafe
@@ -106,7 +106,7 @@ public class GdbSourceLookupParticipant extends DsfSourceLookupParticipant {
* cache, but this method is only called when the source
* containers change which does not happen normally during a
* debug session.
- *
+ *
* XXX: Adding an event once we finished the update would allow
* other interested parties (such as the Debug View) from being
* notified that the frame data has changed. See Bug 489607.
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/IProcessExtendedInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/IProcessExtendedInfo.java
index 028f41dc266..ecb25599240 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/IProcessExtendedInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/IProcessExtendedInfo.java
@@ -7,14 +7,12 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.launching;
-
-
/**
* @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients.
@@ -26,24 +24,24 @@ public interface IProcessExtendedInfo {
* Returns the pid of the process, as assigned by the OS.
*/
public int getPid();
-
+
/**
* Returns the name of the process, as assigned by the OS.
- * Returns null if that information is not available.
+ * Returns null if that information is not available.
*/
public String getName();
-
+
/**
* Returns a list of cores on which the process is located.
- * This list is all cores on which at least one thread of the
+ * This list is all cores on which at least one thread of the
* process is located.
* Returns null if that information is not available.
*/
public String[] getCores();
-
+
/**
* Returns the owner of the process. Usually the userId
- * that started the process. Returns null if that
+ * that started the process. Returns null if that
* information is not available.
*/
public String getOwner();
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/ITracedLaunch.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/ITracedLaunch.java
index 0578ab3d94d..7bdaaaf018a 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/ITracedLaunch.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/ITracedLaunch.java
@@ -7,20 +7,19 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.launching;
-
/**
* This interface is used to indicate that a launch should have
* a TracingConsole.
- *
+ *
* @see org.eclipse.cdt.dsf.gdb.internal.ui.tracing.TracingConsoleManager
* @see org.eclipse.cdt.dsf.gdb.internal.ui.tracing.TracingConsole
- *
+ *
* @since 2.0
*/
public interface ITracedLaunch {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/InferiorRuntimeProcess.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/InferiorRuntimeProcess.java
index ee3be42c68a..2651b8df4cc 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/InferiorRuntimeProcess.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/InferiorRuntimeProcess.java
@@ -28,18 +28,17 @@ import com.ibm.icu.text.MessageFormat;
/**
* A process for the inferior to know it belongs to a DSF-GDB session.
* This class also adds the exit code of the inferior to the console.
- *
+ *
* Note that this class is also used in Run mode.
- *
+ *
* @since 4.0
*/
public class InferiorRuntimeProcess extends RuntimeProcess {
-
- public InferiorRuntimeProcess(ILaunch launch, Process process, String name,
- Map<String, String> attributes) {
+
+ public InferiorRuntimeProcess(ILaunch launch, Process process, String name, Map<String, String> attributes) {
super(launch, process, name, attributes);
}
-
+
@Override
protected void terminated() {
// We must set the console label before calling super.terminated()
@@ -47,18 +46,18 @@ public class InferiorRuntimeProcess extends RuntimeProcess {
// the console, and we find ourselves in a race condition
// where we may miss setting the label here (bug 463977)
setConsoleTerminatedLabel();
-
+
super.terminated();
}
-
+
private void setConsoleTerminatedLabel() {
if (getAttribute(IGdbDebugConstants.INFERIOR_EXITED_ATTR) != null) {
// Add the exit code to the title of the console if the inferior properly exited.
int exitValue = 0;
try {
// We have to explicitly get the exit code from the lower level process
- // instead of calling getExitValue() because we have not yet indicated
- // that this wrapper process has terminated by calling super.terminated()
+ // instead of calling getExitValue() because we have not yet indicated
+ // that this wrapper process has terminated by calling super.terminated()
// Bug 463977
exitValue = getSystemProcess().exitValue();
} catch (IllegalThreadStateException e) {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/LaunchMessages.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/LaunchMessages.java
index c092d1c0d3a..348fecdbf97 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/LaunchMessages.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/LaunchMessages.java
@@ -26,24 +26,26 @@ public class LaunchMessages {
private static ResourceBundle RESOURCE_BUNDLE = null;
static {
- try {
- RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
- } catch (MissingResourceException x) {
- }
+ try {
+ RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
+ } catch (MissingResourceException x) {
+ }
}
- private LaunchMessages() {}
+ private LaunchMessages() {
+ }
public static String getFormattedString(String key, String arg) {
return MessageFormat.format(getString(key), arg);
}
public static String getFormattedString(String key, String[] args) {
- return MessageFormat.format(getString(key), (Object[])args);
+ return MessageFormat.format(getString(key), (Object[]) args);
}
public static String getString(String key) {
- if (RESOURCE_BUNDLE == null) return '!' + key + '!';
+ if (RESOURCE_BUNDLE == null)
+ return '!' + key + '!';
return RESOURCE_BUNDLE.getString(key);
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/LaunchUtils.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/LaunchUtils.java
index c04ee68bdec..9b777cb2bd9 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/LaunchUtils.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/LaunchUtils.java
@@ -68,8 +68,8 @@ import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.ILaunchConfiguration;
public class LaunchUtils {
-
- /**
+
+ /**
* Verify the following things about the project:
* - is a valid project name given
* - does the project exist
@@ -87,8 +87,8 @@ public class LaunchUtils {
if (cproject == null && !name.isEmpty()) {
IProject proj = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
if (!proj.exists()) {
- abort(LaunchMessages.getFormattedString("AbstractCLaunchDelegate.Project_NAME_does_not_exist", name), null, //$NON-NLS-1$
- ICDTLaunchConfigurationConstants.ERR_NOT_A_C_PROJECT);
+ abort(LaunchMessages.getFormattedString("AbstractCLaunchDelegate.Project_NAME_does_not_exist", name), //$NON-NLS-1$
+ null, ICDTLaunchConfigurationConstants.ERR_NOT_A_C_PROJECT);
} else if (!proj.isOpen()) {
abort(LaunchMessages.getFormattedString("AbstractCLaunchDelegate.Project_NAME_is_closed", name), null, //$NON-NLS-1$
ICDTLaunchConfigurationConstants.ERR_NOT_A_C_PROJECT);
@@ -98,56 +98,58 @@ public class LaunchUtils {
}
return cproject;
}
-
+
/**
* Verify that program name of the configuration can be found as a file.
- *
+ *
* @return Absolute path of the program location
*/
public static IPath verifyProgramPath(ILaunchConfiguration configuration, ICProject cproject) throws CoreException {
- String programName = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, (String)null);
+ String programName = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME,
+ (String) null);
if (programName == null) {
abort(LaunchMessages.getString("AbstractCLaunchDelegate.Program_file_not_specified"), null, //$NON-NLS-1$
- ICDTLaunchConfigurationConstants.ERR_UNSPECIFIED_PROGRAM);
+ ICDTLaunchConfigurationConstants.ERR_UNSPECIFIED_PROGRAM);
}
- programName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(programName);
+ programName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(programName);
- IPath programPath = new Path(programName);
+ IPath programPath = new Path(programName);
if (programPath.isEmpty()) {
abort(LaunchMessages.getString("AbstractCLaunchDelegate.Program_file_does_not_exist"), null, //$NON-NLS-1$
- ICDTLaunchConfigurationConstants.ERR_PROGRAM_NOT_EXIST);
+ ICDTLaunchConfigurationConstants.ERR_PROGRAM_NOT_EXIST);
}
-
+
if (!programPath.isAbsolute() && cproject != null) {
// Find the specified program within the specified project
- IFile wsProgramPath = cproject.getProject().getFile(programPath);
- programPath = wsProgramPath.getLocation();
+ IFile wsProgramPath = cproject.getProject().getFile(programPath);
+ programPath = wsProgramPath.getLocation();
}
-
+
if (!programPath.toFile().exists()) {
abort(LaunchMessages.getString("AbstractCLaunchDelegate.Program_file_does_not_exist"), //$NON-NLS-1$
- new FileNotFoundException(
- LaunchMessages.getFormattedString("AbstractCLaunchDelegate.PROGRAM_PATH_not_found", //$NON-NLS-1$
- programPath.toOSString())),
- ICDTLaunchConfigurationConstants.ERR_PROGRAM_NOT_EXIST);
+ new FileNotFoundException(
+ LaunchMessages.getFormattedString("AbstractCLaunchDelegate.PROGRAM_PATH_not_found", //$NON-NLS-1$
+ programPath.toOSString())),
+ ICDTLaunchConfigurationConstants.ERR_PROGRAM_NOT_EXIST);
}
-
+
return programPath;
}
/**
* Verify that the executable path points to a valid binary file.
- *
- * @return An object representing the binary file.
+ *
+ * @return An object representing the binary file.
*/
public static IBinaryObject verifyBinary(ILaunchConfiguration configuration, IPath exePath) throws CoreException {
- ICProject cproject = getCProject(configuration);
+ ICProject cproject = getCProject(configuration);
if (cproject != null) {
- ICConfigExtensionReference[] parserRefs = CCorePlugin.getDefault().getDefaultBinaryParserExtensions(cproject.getProject());
+ ICConfigExtensionReference[] parserRefs = CCorePlugin.getDefault()
+ .getDefaultBinaryParserExtensions(cproject.getProject());
for (ICConfigExtensionReference parserRef : parserRefs) {
try {
IBinaryParser parser = CoreModelUtil.getBinaryParser(parserRef);
- IBinaryObject exe = (IBinaryObject)parser.getBinary(exePath);
+ IBinaryObject exe = (IBinaryObject) parser.getBinary(exePath);
if (exe != null) {
return exe;
}
@@ -159,24 +161,24 @@ public class LaunchUtils {
IBinaryParser parser = CCorePlugin.getDefault().getDefaultBinaryParser();
try {
- return (IBinaryObject)parser.getBinary(exePath);
+ return (IBinaryObject) parser.getBinary(exePath);
} catch (ClassCastException e) {
} catch (IOException e) {
}
-
+
abort(LaunchMessages.getString("AbstractCLaunchDelegate.Program_is_not_a_recognized_executable"), //$NON-NLS-1$
- new FileNotFoundException(
- LaunchMessages.getFormattedString("AbstractCLaunchDelegate.Program_is_not_a_recognized_executable", //$NON-NLS-1$
- exePath.toOSString())),
- ICDTLaunchConfigurationConstants.ERR_PROGRAM_NOT_BINARY);
-
+ new FileNotFoundException(LaunchMessages.getFormattedString(
+ "AbstractCLaunchDelegate.Program_is_not_a_recognized_executable", //$NON-NLS-1$
+ exePath.toOSString())),
+ ICDTLaunchConfigurationConstants.ERR_PROGRAM_NOT_BINARY);
+
return null;
}
/**
* Throws a core exception with an error status object built from the given
* message, lower level exception, and error code.
- *
+ *
* @param message
* the status message
* @param exception
@@ -187,9 +189,9 @@ public class LaunchUtils {
*/
private static void abort(String message, Throwable exception, int code) throws CoreException {
MultiStatus status = new MultiStatus(GdbPlugin.PLUGIN_ID, code, message, exception);
- status.add(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, code,
- exception == null ? "" : exception.getLocalizedMessage(), //$NON-NLS-1$
- exception));
+ status.add(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, code,
+ exception == null ? "" : exception.getLocalizedMessage(), //$NON-NLS-1$
+ exception));
throw new CoreException(status);
}
@@ -213,48 +215,49 @@ public class LaunchUtils {
}
private static String getProjectName(ILaunchConfiguration configuration) throws CoreException {
- return configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String)null);
+ return configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String) null);
}
-
- public static IPath getGDBPath(ILaunchConfiguration configuration) {
+
+ public static IPath getGDBPath(ILaunchConfiguration configuration) {
String defaultGdbCommand = Platform.getPreferencesService().getString(GdbPlugin.PLUGIN_ID,
- IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND,
- IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT, null);
-
- IPath retVal = new Path(defaultGdbCommand);
- try {
- String gdb = configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, defaultGdbCommand);
- gdb = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(gdb, false);
- retVal = new Path(gdb);
- } catch (CoreException e) {
- }
- return retVal;
- }
-
- /**
- * Find gdb version info from a string object which is supposed to
- * contain output text of "gdb --version" command.
- *
- * @param versionOutput
- * output text from "gdb --version" command .
- * @return
- * String representation of version of gdb such as "6.8" on success;
- * empty string otherwise.
- * @since 2.0
- */
+ IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND,
+ IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT, null);
+
+ IPath retVal = new Path(defaultGdbCommand);
+ try {
+ String gdb = configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME,
+ defaultGdbCommand);
+ gdb = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(gdb, false);
+ retVal = new Path(gdb);
+ } catch (CoreException e) {
+ }
+ return retVal;
+ }
+
+ /**
+ * Find gdb version info from a string object which is supposed to
+ * contain output text of "gdb --version" command.
+ *
+ * @param versionOutput
+ * output text from "gdb --version" command .
+ * @return
+ * String representation of version of gdb such as "6.8" on success;
+ * empty string otherwise.
+ * @since 2.0
+ */
public static String getGDBVersionFromText(String versionOutput) {
- String version = "";//$NON-NLS-1$
-
+ String version = "";//$NON-NLS-1$
+
// These are the GDB version patterns I have seen up to now
// The pattern works for all of them extracting the version of 6.8.50.20080730
// GNU gdb 6.8.50.20080730
// GNU gdb (GDB) 6.8.50.20080730-cvs
// GNU gdb (Ericsson GDB 1.0-10) 6.8.50.20080730-cvs
- // GNU gdb (GDB) Fedora (7.0-3.fc12)
- // GNU gdb Red Hat Linux (6.3.0.0-1.162.el4rh)
- // GNU gdb (GDB) STMicroelectronics/Linux Base 7.4-71 [build Mar 1 2013]
+ // GNU gdb (GDB) Fedora (7.0-3.fc12)
+ // GNU gdb Red Hat Linux (6.3.0.0-1.162.el4rh)
+ // GNU gdb (GDB) STMicroelectronics/Linux Base 7.4-71 [build Mar 1 2013]
- Pattern pattern = Pattern.compile(" gdb( \\(.*?\\))? (\\D* )*\\(?(\\d*(\\.\\d*)*)", Pattern.MULTILINE); //$NON-NLS-1$
+ Pattern pattern = Pattern.compile(" gdb( \\(.*?\\))? (\\D* )*\\(?(\\d*(\\.\\d*)*)", Pattern.MULTILINE); //$NON-NLS-1$
Matcher matcher = pattern.matcher(versionOutput);
if (matcher.find()) {
@@ -267,83 +270,86 @@ public class LaunchUtils {
}
}
- return version;
+ return version;
}
-
+
/**
* This method actually launches 'gdb --version' to determine the version
* of the GDB that is being used. This method should ideally be called
* only once per session and the resulting version string stored for future uses.
- *
+ *
* A timeout is scheduled which will kill the process if it takes too long.
- *
- * @deprecated Replaced with {@link GdbLaunch#getGDBVersion()}
+ *
+ * @deprecated Replaced with {@link GdbLaunch#getGDBVersion()}
*/
@Deprecated
- public static String getGDBVersion(final ILaunchConfiguration configuration) throws CoreException {
- String cmd = getGDBPath(configuration).toOSString() + " --version"; //$NON-NLS-1$
-
- // Parse cmd to properly handle spaces and such things (bug 458499)
+ public static String getGDBVersion(final ILaunchConfiguration configuration) throws CoreException {
+ String cmd = getGDBPath(configuration).toOSString() + " --version"; //$NON-NLS-1$
+
+ // Parse cmd to properly handle spaces and such things (bug 458499)
String[] args = CommandLineUtil.argumentsToArray(cmd);
-
- Process process = null;
- Job timeoutJob = null;
- try {
- process = ProcessFactory.getFactory().exec(args, getLaunchEnvironment(configuration));
-
- // Start a timeout job to make sure we don't get stuck waiting for
- // an answer from a gdb that is hanging
- // Bug 376203
- final Process finalProc = process;
- timeoutJob = new Job("GDB version timeout job") { //$NON-NLS-1$
- { setSystem(true); }
- @Override
- protected IStatus run(IProgressMonitor arg) {
- // Took too long. Kill the gdb process and
- // let things clean up.
- finalProc.destroy();
- return Status.OK_STATUS;
- }
- };
- timeoutJob.schedule(10000);
-
- String streamOutput = readStream(process.getInputStream());
-
- String gdbVersion = getGDBVersionFromText(streamOutput);
- if (gdbVersion == null || gdbVersion.isEmpty()) {
- Exception detailedException = null;
- if (!streamOutput.isEmpty()) {
- // We got some output but couldn't parse it. Make that output visible to the user in the error dialog.
- detailedException = new Exception("Unexpected output format: \n\n" + streamOutput); //$NON-NLS-1$
- } else {
- // We got no output. Check if we got something on the error stream.
- streamOutput = readStream(process.getErrorStream());
- if (!streamOutput.isEmpty()) {
- detailedException = new Exception(streamOutput);
- }
- }
-
- throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED,
- "Could not determine GDB version using command: " + StringUtil.join(args, " "), //$NON-NLS-1$ //$NON-NLS-2$
- detailedException));
- }
- return gdbVersion;
- } catch (IOException e) {
- throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED,
- "Error with command: " + StringUtil.join(args, " "), e));//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- // If we get here we are obviously not stuck reading the stream so we can cancel the timeout job.
- // Note that it may already have executed, but that is not a problem.
- if (timeoutJob != null) {
- timeoutJob.cancel();
- }
-
- if (process != null) {
- process.destroy();
- }
- }
+
+ Process process = null;
+ Job timeoutJob = null;
+ try {
+ process = ProcessFactory.getFactory().exec(args, getLaunchEnvironment(configuration));
+
+ // Start a timeout job to make sure we don't get stuck waiting for
+ // an answer from a gdb that is hanging
+ // Bug 376203
+ final Process finalProc = process;
+ timeoutJob = new Job("GDB version timeout job") { //$NON-NLS-1$
+ {
+ setSystem(true);
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor arg) {
+ // Took too long. Kill the gdb process and
+ // let things clean up.
+ finalProc.destroy();
+ return Status.OK_STATUS;
+ }
+ };
+ timeoutJob.schedule(10000);
+
+ String streamOutput = readStream(process.getInputStream());
+
+ String gdbVersion = getGDBVersionFromText(streamOutput);
+ if (gdbVersion == null || gdbVersion.isEmpty()) {
+ Exception detailedException = null;
+ if (!streamOutput.isEmpty()) {
+ // We got some output but couldn't parse it. Make that output visible to the user in the error dialog.
+ detailedException = new Exception("Unexpected output format: \n\n" + streamOutput); //$NON-NLS-1$
+ } else {
+ // We got no output. Check if we got something on the error stream.
+ streamOutput = readStream(process.getErrorStream());
+ if (!streamOutput.isEmpty()) {
+ detailedException = new Exception(streamOutput);
+ }
+ }
+
+ throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED,
+ "Could not determine GDB version using command: " + StringUtil.join(args, " "), //$NON-NLS-1$ //$NON-NLS-2$
+ detailedException));
+ }
+ return gdbVersion;
+ } catch (IOException e) {
+ throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED,
+ "Error with command: " + StringUtil.join(args, " "), e));//$NON-NLS-1$ //$NON-NLS-2$
+ } finally {
+ // If we get here we are obviously not stuck reading the stream so we can cancel the timeout job.
+ // Note that it may already have executed, but that is not a problem.
+ if (timeoutJob != null) {
+ timeoutJob.cancel();
+ }
+
+ if (process != null) {
+ process.destroy();
+ }
+ }
}
-
+
/**
* Compares two version numbers.
* Returns -1, 0, or 1 if v1 is less than, equal to, or greater than v2, respectively.
@@ -353,11 +359,12 @@ public class LaunchUtils {
* @since 4.8
*/
public static int compareVersions(String v1, String v2) {
- if (v1 == null || v2 == null) throw new NullPointerException();
-
+ if (v1 == null || v2 == null)
+ throw new NullPointerException();
+
String[] v1Parts = v1.split("\\."); //$NON-NLS-1$
String[] v2Parts = v2.split("\\."); //$NON-NLS-1$
- for (int i = 0; i < v1Parts.length && i < v2Parts.length; i++) {
+ for (int i = 0; i < v1Parts.length && i < v2Parts.length; i++) {
try {
int v1PartValue = Integer.parseInt(v1Parts[i]);
int v2PartValue = Integer.parseInt(v2Parts[i]);
@@ -372,10 +379,10 @@ public class LaunchUtils {
continue;
}
}
-
+
// If we get here is means the versions are still equal
// but there could be extra parts to examine
-
+
if (v1Parts.length < v2Parts.length) {
// v2 has extra parts, which implies v1 is a lower version (e.g., v1 = 7.9 v2 = 7.9.1)
// unless each extra part is 0, in which case the two versions are equal (e.g., v1 = 7.9 v2 = 7.9.0)
@@ -410,84 +417,87 @@ public class LaunchUtils {
/**
* Read from the specified stream and return what was read.
- *
+ *
* @param stream The input stream to be used to read the data. This method will close the stream.
* @return The data read from the stream
* @throws IOException If an IOException happens when reading the stream
*/
private static String readStream(InputStream stream) throws IOException {
- StringBuilder cmdOutput = new StringBuilder(200);
- try {
- Reader r = new InputStreamReader(stream);
- BufferedReader reader = new BufferedReader(r);
-
- String line;
- while ((line = reader.readLine()) != null) {
- cmdOutput.append(line);
- cmdOutput.append('\n');
- }
- return cmdOutput.toString();
- } finally {
- // Cleanup to avoid leaking pipes
- // Bug 345164
- if (stream != null) {
- try {
- stream.close();
- } catch (IOException e) {}
- }
- }
+ StringBuilder cmdOutput = new StringBuilder(200);
+ try {
+ Reader r = new InputStreamReader(stream);
+ BufferedReader reader = new BufferedReader(r);
+
+ String line;
+ while ((line = reader.readLine()) != null) {
+ cmdOutput.append(line);
+ cmdOutput.append('\n');
+ }
+ return cmdOutput.toString();
+ } finally {
+ // Cleanup to avoid leaking pipes
+ // Bug 345164
+ if (stream != null) {
+ try {
+ stream.close();
+ } catch (IOException e) {
+ }
+ }
+ }
}
-
+
public static boolean getIsAttach(ILaunchConfiguration config) {
- try {
- String debugMode = config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN );
- if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN)) {
- return false;
- } else if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH)) {
- return true;
- } else if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE)) {
- return false;
- } else if (debugMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE)) {
- return false;
- } else if (debugMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE_ATTACH)) {
- return true;
- }
- } catch (CoreException e) {
- }
- return false;
- }
-
+ try {
+ String debugMode = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
+ ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
+ if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN)) {
+ return false;
+ } else if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH)) {
+ return true;
+ } else if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE)) {
+ return false;
+ } else if (debugMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE)) {
+ return false;
+ } else if (debugMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE_ATTACH)) {
+ return true;
+ }
+ } catch (CoreException e) {
+ }
+ return false;
+ }
+
public static SessionType getSessionType(ILaunchConfiguration config) {
- try {
- String debugMode = config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN );
- if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN)) {
- return SessionType.LOCAL;
- } else if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH)) {
- return SessionType.LOCAL;
- } else if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE)) {
- return SessionType.CORE;
- } else if (debugMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE)) {
- return SessionType.REMOTE;
- } else if (debugMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE_ATTACH)) {
- return SessionType.REMOTE;
- } else {
- assert false : "Unexpected session-type attribute in launch config: " + debugMode; //$NON-NLS-1$
- }
- } catch (CoreException e) {
- }
- return SessionType.LOCAL;
- }
-
+ try {
+ String debugMode = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
+ ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
+ if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN)) {
+ return SessionType.LOCAL;
+ } else if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH)) {
+ return SessionType.LOCAL;
+ } else if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE)) {
+ return SessionType.CORE;
+ } else if (debugMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE)) {
+ return SessionType.REMOTE;
+ } else if (debugMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE_ATTACH)) {
+ return SessionType.REMOTE;
+ } else {
+ assert false : "Unexpected session-type attribute in launch config: " + debugMode; //$NON-NLS-1$
+ }
+ } catch (CoreException e) {
+ }
+ return SessionType.LOCAL;
+ }
+
/**
* Gets the CDT environment from the CDT project's configuration referenced by the
* launch
* @since 3.0
- * @deprecated Replaced with {@link GdbLaunch#getLaunchEnvironment()}
+ * @deprecated Replaced with {@link GdbLaunch#getLaunchEnvironment()}
*/
@Deprecated
public static String[] getLaunchEnvironment(ILaunchConfiguration config) throws CoreException {
// Get the project
- String projectName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String)null);
+ String projectName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String) null);
if (projectName == null) {
return null;
}
@@ -500,22 +510,22 @@ public class LaunchUtils {
return null;
}
- ICProjectDescription projDesc = CoreModel.getDefault().getProjectDescription(project, false);
+ ICProjectDescription projDesc = CoreModel.getDefault().getProjectDescription(project, false);
// Not a CDT project?
if (projDesc == null) {
- return null;
+ return null;
}
String buildConfigID = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_ID, ""); //$NON-NLS-1$
ICConfigurationDescription cfg = null;
if (buildConfigID.length() != 0) {
- cfg = projDesc.getConfigurationById(buildConfigID);
+ cfg = projDesc.getConfigurationById(buildConfigID);
}
// if configuration is null fall-back to active
if (cfg == null) {
- cfg = projDesc.getActiveConfiguration();
+ cfg = projDesc.getActiveConfiguration();
}
// Environment variables and inherited vars
@@ -541,68 +551,68 @@ public class LaunchUtils {
}
// Turn it into an envp format
- List<String> strings= new ArrayList<String>(envMap.size());
+ List<String> strings = new ArrayList<String>(envMap.size());
for (Entry<String, String> entry : envMap.entrySet()) {
- StringBuilder buffer= new StringBuilder(entry.getKey());
+ StringBuilder buffer = new StringBuilder(entry.getKey());
buffer.append('=').append(entry.getValue());
strings.add(buffer.toString());
}
return strings.toArray(new String[strings.size()]);
}
-
+
/**
* Returns <code>true</code> if the launch is meant to be in Non-Stop mode.
* Returns <code>false</code> otherwise.
- *
+ *
* @since 4.0
*/
public static boolean getIsNonStopMode(ILaunchConfiguration config) {
try {
return config.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP,
- getIsNonStopModeDefault());
- } catch (CoreException e) {
- }
- return false;
- }
-
+ getIsNonStopModeDefault());
+ } catch (CoreException e) {
+ }
+ return false;
+ }
+
/**
* Returns workspace-level default for the Non-Stop mode.
- *
+ *
* @since 4.0
*/
public static boolean getIsNonStopModeDefault() {
return Platform.getPreferencesService().getBoolean(GdbPlugin.PLUGIN_ID,
IGdbDebugPreferenceConstants.PREF_DEFAULT_NON_STOP,
IGDBLaunchConfigurationConstants.DEBUGGER_NON_STOP_DEFAULT, null);
- }
-
+ }
+
/**
* Returns workspace-level default for the stop at main option.
- *
+ *
* @since 4.0
*/
public static boolean getStopAtMainDefault() {
return Platform.getPreferencesService().getBoolean(GdbPlugin.PLUGIN_ID,
IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN,
ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_DEFAULT, null);
- }
-
+ }
+
/**
* Returns workspace-level default for the stop at main symbol.
- *
+ *
* @since 4.0
*/
public static String getStopAtMainSymbolDefault() {
return Platform.getPreferencesService().getString(GdbPlugin.PLUGIN_ID,
IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN_SYMBOL,
ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT, null);
- }
-
+ }
+
/**
* Returns <code>true</code> if the launch is meant to be for post-mortem
* tracing. Returns <code>false</code> otherwise.
- *
+ *
* @since 4.0
*/
public static boolean getIsPostMortemTracing(ILaunchConfiguration config) {
@@ -612,11 +622,11 @@ public class LaunchUtils {
String coreType = config.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_POST_MORTEM_TYPE,
IGDBLaunchConfigurationConstants.DEBUGGER_POST_MORTEM_TYPE_DEFAULT);
return coreType.equals(IGDBLaunchConfigurationConstants.DEBUGGER_POST_MORTEM_TRACE_FILE);
- } catch (CoreException e) {
+ } catch (CoreException e) {
}
}
- return false;
- }
+ return false;
+ }
/**
* Returns workspace-level default for the remote timeout enablement
@@ -626,7 +636,7 @@ public class LaunchUtils {
return Platform.getPreferencesService().getBoolean(GdbPlugin.PLUGIN_ID,
IGdbDebugPreferenceConstants.PREF_DEFAULT_REMOTE_TIMEOUT_ENABLED,
IGDBLaunchConfigurationConstants.DEBUGGER_REMOTE_TIMEOUT_ENABLED_DEFAULT, null);
- }
+ }
/**
* Returns workspace-level default for the remote timeout value
@@ -636,6 +646,5 @@ public class LaunchUtils {
return Platform.getPreferencesService().getString(GdbPlugin.PLUGIN_ID,
IGdbDebugPreferenceConstants.PREF_DEFAULT_REMOTE_TIMEOUT_VALUE,
IGDBLaunchConfigurationConstants.DEBUGGER_REMOTE_TIMEOUT_VALUE_DEFAULT, null);
- }
+ }
}
-
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/ServicesLaunchSequence.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/ServicesLaunchSequence.java
index ae6deba5821..79a9ed0ba1f 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/ServicesLaunchSequence.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/ServicesLaunchSequence.java
@@ -7,11 +7,11 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* Nokia - created GDBBackend service. Sep. 2008
- * IBM Corporation
+ * IBM Corporation
* Ericsson - Support for Tracing Control service
* Marc Khouzam (Ericsson) - Start IGDBHardware service for the multicore visualizer (Bug 335027)
*******************************************************************************/
@@ -44,114 +44,139 @@ import org.eclipse.core.runtime.IProgressMonitor;
public class ServicesLaunchSequence extends Sequence {
- private DsfSession fSession;
- private GdbLaunch fLaunch;
+ private DsfSession fSession;
+ private GdbLaunch fLaunch;
+
+ private ICommandControlService fCommandControl;
+ private CSourceLookup fSourceLookup;
+
+ private Step[] fSteps = new Step[] { new Step() {
+ @Override
+ public void execute(RequestMonitor requestMonitor) {
+ fLaunch.getServiceFactory().createService(IMIBackend.class, fSession, fLaunch.getLaunchConfiguration())
+ .initialize(requestMonitor);
+ }
+ }, new Step() {
+ @Override
+ public void execute(RequestMonitor requestMonitor) {
+ fCommandControl = fLaunch.getServiceFactory().createService(ICommandControlService.class, fSession,
+ fLaunch.getLaunchConfiguration());
+ fCommandControl.initialize(requestMonitor);
+ }
+ }, new Step() {
+ @Override
+ public void execute(RequestMonitor requestMonitor) {
+ fLaunch.getServiceFactory()
+ .createService(IGDBHardwareAndOS.class, fSession, fLaunch.getLaunchConfiguration())
+ .initialize(requestMonitor);
+ }
+ }, new Step() {
+ @Override
+ public void execute(RequestMonitor requestMonitor) {
+ fLaunch.getServiceFactory().createService(IProcesses.class, fSession).initialize(requestMonitor);
+ }
+ }, new Step() {
+ @Override
+ public void execute(RequestMonitor requestMonitor) {
+ fLaunch.getServiceFactory().createService(IRunControl.class, fSession).initialize(requestMonitor);
+ }
+ }, new Step() {
+ @Override
+ public void execute(RequestMonitor requestMonitor) {
+ fLaunch.getServiceFactory().createService(IMemory.class, fSession).initialize(requestMonitor);
+ }
+ }, new Step() {
+ @Override
+ public void execute(RequestMonitor requestMonitor) {
+ fLaunch.getServiceFactory().createService(IModules.class, fSession).initialize(requestMonitor);
+ }
+ }, new Step() {
+ @Override
+ public void execute(RequestMonitor requestMonitor) {
+ fLaunch.getServiceFactory().createService(IStack.class, fSession).initialize(requestMonitor);
+ }
+ }, new Step() {
+ @Override
+ public void execute(RequestMonitor requestMonitor) {
+ fLaunch.getServiceFactory().createService(IExpressions.class, fSession).initialize(requestMonitor);
+ }
+ }, new Step() {
+ @Override
+ public void execute(RequestMonitor requestMonitor) {
+ fSourceLookup = (CSourceLookup) fLaunch.getServiceFactory().createService(ISourceLookup.class, fSession);
+ fSourceLookup.initialize(requestMonitor);
+ }
+ }, new Step() {
+ @Override
+ public void execute(RequestMonitor requestMonitor) {
+ ISourceLookupDMContext sourceLookupDmc = (ISourceLookupDMContext) fCommandControl.getContext();
+ fSourceLookup.setSourceLookupDirector(sourceLookupDmc, (CSourceLookupDirector) fLaunch.getSourceLocator());
+ requestMonitor.done();
+ }
+ }, new Step() {
+ @Override
+ public void execute(final RequestMonitor requestMonitor) {
+ // Create the low-level breakpoint service
+ fLaunch.getServiceFactory().createService(IBreakpoints.class, fSession).initialize(requestMonitor);
+ }
+ }, new Step() {
+ @Override
+ public void execute(final RequestMonitor requestMonitor) {
+ // Create high-level breakpoint service and install breakpoints
+ // for the GDB debug context.
+ fLaunch.getServiceFactory().createService(MIBreakpointsManager.class, fSession).initialize(requestMonitor);
+ }
+ }, new Step() {
+ @Override
+ public void execute(RequestMonitor requestMonitor) {
+ fLaunch.getServiceFactory().createService(IRegisters.class, fSession).initialize(requestMonitor);
+ }
+ }, new Step() {
+ @Override
+ public void execute(RequestMonitor requestMonitor) {
+ fLaunch.getServiceFactory().createService(IDisassembly.class, fSession).initialize(requestMonitor);
+ }
+ }, new Step() {
+ @Override
+ public void execute(RequestMonitor requestMonitor) {
+ IGDBTraceControl traceService = fLaunch.getServiceFactory().createService(IGDBTraceControl.class, fSession,
+ fLaunch.getLaunchConfiguration());
+ // Note that for older versions of GDB, we don't support tracing, so there is no trace service.
+ if (traceService != null) {
+ traceService.initialize(requestMonitor);
+ } else {
+ requestMonitor.done();
+ }
+ }
+ }, new Step() {
+ @Override
+ public void execute(final RequestMonitor requestMonitor) {
+ fLaunch.getServiceFactory().createService(MIBreakpointsSynchronizer.class, fSession)
+ .initialize(requestMonitor);
+ }
+ }, new Step() {
+ @Override
+ public void execute(final RequestMonitor requestMonitor) {
+ IGDBFocusSynchronizer service = fLaunch.getServiceFactory().createService(IGDBFocusSynchronizer.class,
+ fSession);
+ // The focus synchronizer is a new service, don't require it to exist/be supported by a backend.
+ if (service != null) {
+ service.initialize(requestMonitor);
+ } else {
+ requestMonitor.done();
+ }
+ }
+ }, };
- private ICommandControlService fCommandControl;
- private CSourceLookup fSourceLookup;
-
- private Step[] fSteps = new Step[] {
- new Step() { @Override
- public void execute(RequestMonitor requestMonitor) {
- fLaunch.getServiceFactory().createService(IMIBackend.class, fSession, fLaunch.getLaunchConfiguration()).initialize(requestMonitor);
- }},
- new Step() { @Override
- public void execute(RequestMonitor requestMonitor) {
- fCommandControl = fLaunch.getServiceFactory().createService(ICommandControlService.class, fSession, fLaunch.getLaunchConfiguration());
- fCommandControl.initialize(requestMonitor);
- }},
- new Step() { @Override
- public void execute(RequestMonitor requestMonitor) {
- fLaunch.getServiceFactory().createService(IGDBHardwareAndOS.class, fSession, fLaunch.getLaunchConfiguration()).initialize(requestMonitor);
- }},
- new Step() { @Override
- public void execute(RequestMonitor requestMonitor) {
- fLaunch.getServiceFactory().createService(IProcesses.class, fSession).initialize(requestMonitor);
- }},
- new Step() { @Override
- public void execute(RequestMonitor requestMonitor) {
- fLaunch.getServiceFactory().createService(IRunControl.class, fSession).initialize(requestMonitor);
- }},
- new Step() { @Override
- public void execute(RequestMonitor requestMonitor) {
- fLaunch.getServiceFactory().createService(IMemory.class, fSession).initialize(requestMonitor);
- }},
- new Step() { @Override
- public void execute(RequestMonitor requestMonitor) {
- fLaunch.getServiceFactory().createService(IModules.class, fSession).initialize(requestMonitor);
- }},
- new Step() { @Override
- public void execute(RequestMonitor requestMonitor) {
- fLaunch.getServiceFactory().createService(IStack.class, fSession).initialize(requestMonitor);
- }},
- new Step() { @Override
- public void execute(RequestMonitor requestMonitor) {
- fLaunch.getServiceFactory().createService(IExpressions.class, fSession).initialize(requestMonitor);
- }},
- new Step() { @Override
- public void execute(RequestMonitor requestMonitor) {
- fSourceLookup = (CSourceLookup)fLaunch.getServiceFactory().createService(ISourceLookup.class, fSession);
- fSourceLookup.initialize(requestMonitor);
- }},
- new Step() { @Override
- public void execute(RequestMonitor requestMonitor) {
- ISourceLookupDMContext sourceLookupDmc = (ISourceLookupDMContext)fCommandControl.getContext();
- fSourceLookup.setSourceLookupDirector(sourceLookupDmc, (CSourceLookupDirector)fLaunch.getSourceLocator());
- requestMonitor.done();
- }},
- new Step() { @Override
- public void execute(final RequestMonitor requestMonitor) {
- // Create the low-level breakpoint service
- fLaunch.getServiceFactory().createService(IBreakpoints.class, fSession).initialize(requestMonitor);
- }},
- new Step() { @Override
- public void execute(final RequestMonitor requestMonitor) {
- // Create high-level breakpoint service and install breakpoints
- // for the GDB debug context.
- fLaunch.getServiceFactory().createService(MIBreakpointsManager.class, fSession).initialize(requestMonitor);
- }},
- new Step() { @Override
- public void execute(RequestMonitor requestMonitor) {
- fLaunch.getServiceFactory().createService(IRegisters.class, fSession).initialize(requestMonitor);
- }},
- new Step() { @Override
- public void execute(RequestMonitor requestMonitor) {
- fLaunch.getServiceFactory().createService(IDisassembly.class, fSession).initialize(requestMonitor);
- }},
- new Step() { @Override
- public void execute(RequestMonitor requestMonitor) {
- IGDBTraceControl traceService = fLaunch.getServiceFactory().createService(IGDBTraceControl.class, fSession, fLaunch.getLaunchConfiguration());
- // Note that for older versions of GDB, we don't support tracing, so there is no trace service.
- if (traceService != null) {
- traceService.initialize(requestMonitor);
- } else {
- requestMonitor.done();
- }
- }},
- new Step() { @Override
- public void execute(final RequestMonitor requestMonitor) {
- fLaunch.getServiceFactory().createService(MIBreakpointsSynchronizer.class, fSession).initialize(requestMonitor);
- }},
- new Step() { @Override
- public void execute(final RequestMonitor requestMonitor) {
- IGDBFocusSynchronizer service = fLaunch.getServiceFactory().createService(IGDBFocusSynchronizer.class, fSession);
- // The focus synchronizer is a new service, don't require it to exist/be supported by a backend.
- if (service != null) {
- service.initialize(requestMonitor);
- } else {
- requestMonitor.done();
- }
- }},
- };
-
- public ServicesLaunchSequence(DsfSession session, GdbLaunch launch, IProgressMonitor pm) {
- super(session.getExecutor(), pm, LaunchMessages.getString("ServicesLaunchSequence_0"), LaunchMessages.getString("ServicesLaunchSequence_1")); //$NON-NLS-1$ //$NON-NLS-2$
- fSession = session;
- fLaunch = launch;
- }
+ public ServicesLaunchSequence(DsfSession session, GdbLaunch launch, IProgressMonitor pm) {
+ super(session.getExecutor(), pm, LaunchMessages.getString("ServicesLaunchSequence_0"), //$NON-NLS-1$
+ LaunchMessages.getString("ServicesLaunchSequence_1")); //$NON-NLS-1$
+ fSession = session;
+ fLaunch = launch;
+ }
- @Override
- public Step[] getSteps() {
- return fSteps;
- }
+ @Override
+ public Step[] getSteps() {
+ return fSteps;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/ShutdownSequence.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/ShutdownSequence.java
index 86b9d8485bb..3833bdff77e 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/ShutdownSequence.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/ShutdownSequence.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -29,10 +29,10 @@ import org.osgi.framework.ServiceReference;
public class ShutdownSequence extends Sequence {
class ServiceShutdownStep extends Step {
-
+
private IDsfService fService;
- ServiceShutdownStep( IDsfService service ) {
+ ServiceShutdownStep(IDsfService service) {
super();
fService = service;
}
@@ -41,73 +41,72 @@ public class ShutdownSequence extends Sequence {
* @see org.eclipse.cdt.dsf.concurrent.Sequence.Step#execute(org.eclipse.cdt.dsf.concurrent.RequestMonitor)
*/
@Override
- public void execute( final RequestMonitor rm ) {
- fService.shutdown( new RequestMonitor( getExecutor(), rm ) {
+ public void execute(final RequestMonitor rm) {
+ fService.shutdown(new RequestMonitor(getExecutor(), rm) {
/* (non-Javadoc)
* @see org.eclipse.cdt.dsf.concurrent.RequestMonitor#handleCompleted()
*/
@Override
protected void handleCompleted() {
- if ( !isSuccess() ) {
- GdbPlugin.getDefault().getLog().log( getStatus() );
+ if (!isSuccess()) {
+ GdbPlugin.getDefault().getLog().log(getStatus());
}
rm.done();
}
- } );
+ });
}
}
- private String fSessionId;
-
- private Step[] fSteps;
+ private String fSessionId;
- public ShutdownSequence(DsfExecutor executor, String sessionId, RequestMonitor requestMonitor) {
- super(executor, requestMonitor);
- fSessionId = sessionId;
- fSteps = createSteps();
- }
+ private Step[] fSteps;
+
+ public ShutdownSequence(DsfExecutor executor, String sessionId, RequestMonitor requestMonitor) {
+ super(executor, requestMonitor);
+ fSessionId = sessionId;
+ fSteps = createSteps();
+ }
- @Override
- public Step[] getSteps() {
- return fSteps;
- }
+ @Override
+ public Step[] getSteps() {
+ return fSteps;
+ }
private Step[] createSteps() {
IDsfService[] services = getServices();
ServiceShutdownStep[] steps = new ServiceShutdownStep[services.length];
- for ( int i = 0; i < steps.length; ++i ) {
- steps[i] = new ServiceShutdownStep( services[i] );
+ for (int i = 0; i < steps.length; ++i) {
+ steps[i] = new ServiceShutdownStep(services[i]);
}
return steps;
}
-
+
private IDsfService[] getServices() {
IDsfService[] result = new IDsfService[0];
try {
- ServiceReference<?>[] serviceRefs = GdbPlugin.getBundleContext().getServiceReferences(
+ ServiceReference<?>[] serviceRefs = GdbPlugin.getBundleContext().getServiceReferences(
IDsfService.class.getName(),
- String.format( "(%s=%s)", IDsfService.PROP_SESSION_ID, fSessionId ).intern() ); //$NON-NLS-1$
-
+ String.format("(%s=%s)", IDsfService.PROP_SESSION_ID, fSessionId).intern()); //$NON-NLS-1$
+
if (serviceRefs != null) {
- List<IDsfService> services = new ArrayList<IDsfService>( serviceRefs.length );
- for ( ServiceReference<?> ref : serviceRefs ) {
- Object serviceObj = GdbPlugin.getBundleContext().getService( ref );
- if ( serviceObj instanceof IDsfService ) {
- services.add( (IDsfService)serviceObj );
+ List<IDsfService> services = new ArrayList<IDsfService>(serviceRefs.length);
+ for (ServiceReference<?> ref : serviceRefs) {
+ Object serviceObj = GdbPlugin.getBundleContext().getService(ref);
+ if (serviceObj instanceof IDsfService) {
+ services.add((IDsfService) serviceObj);
}
}
- Collections.sort( services, new Comparator<IDsfService>() {
+ Collections.sort(services, new Comparator<IDsfService>() {
@Override
- public int compare( IDsfService o1, IDsfService o2 ) {
+ public int compare(IDsfService o1, IDsfService o2) {
return o2.getStartupNumber() - o1.getStartupNumber();
}
- } );
- result = services.toArray( new IDsfService[services.size()] );
+ });
+ result = services.toArray(new IDsfService[services.size()]);
}
- }
- catch( InvalidSyntaxException e ) {
+ } catch (InvalidSyntaxException e) {
// Shouldn't happen
}
return result;
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/memory/IGdbMemoryAddressInfoTypeRetrieval.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/memory/IGdbMemoryAddressInfoTypeRetrieval.java
index 8bec1c6b869..eae29c1ab05 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/memory/IGdbMemoryAddressInfoTypeRetrieval.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/memory/IGdbMemoryAddressInfoTypeRetrieval.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
@@ -22,14 +22,14 @@ import org.eclipse.debug.core.model.IMemoryBlock;
* @since 5.0
*/
public interface IGdbMemoryAddressInfoTypeRetrieval {
- /**
- * @return the String representing the type of information items being provided
- */
- String getInfoType();
+ /**
+ * @return the String representing the type of information items being provided
+ */
+ String getInfoType();
- /**
- * The implementation provides the items of an associated type which could be pointing to a memory address
- */
- void itemsRequest(IDMContext selectionContext, IMemoryBlock memoryBlock,
- DataRequestMonitor<IMemoryBlockAddressInfoItem[]> rm);
+ /**
+ * The implementation provides the items of an associated type which could be pointing to a memory address
+ */
+ void itemsRequest(IDMContext selectionContext, IMemoryBlock memoryBlock,
+ DataRequestMonitor<IMemoryBlockAddressInfoItem[]> rm);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/DebugNewProcessSequence.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/DebugNewProcessSequence.java
index 510908660b7..4f0aa852c3a 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/DebugNewProcessSequence.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/DebugNewProcessSequence.java
@@ -7,12 +7,12 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
- * Marc Khouzam (Ericsson) - Support setting the path in which the core file
+ * Marc Khouzam (Ericsson) - Support setting the path in which the core file
* dialog should start (Bug 362039)
- * Sergey Prigogin (Google) - Bug 381804
+ * Sergey Prigogin (Google) - Bug 381804
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.service;
@@ -55,14 +55,14 @@ import org.eclipse.core.variables.VariablesPlugin;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.IStatusHandler;
-/**
+/**
* This sequence is used to start debugging a new process.
*
* @since 4.0
*/
public class DebugNewProcessSequence extends ReflectionSequence {
- private final static String INVALID = "invalid"; //$NON-NLS-1$
+ private final static String INVALID = "invalid"; //$NON-NLS-1$
private IGDBControl fCommandControl;
private CommandFactory fCommandFactory;
@@ -74,11 +74,10 @@ public class DebugNewProcessSequence extends ReflectionSequence {
private String fBinaryName;
private Map<String, Object> fAttributes;
private IMIContainerDMContext fContainerCtx;
-
+
// Store the dataRM so that we can fill it with the container context that we will be creating
private DataRequestMonitor<IDMContext> fDataRequestMonitor;
-
protected IMIContainerDMContext getContainerContext() {
return fContainerCtx;
}
@@ -86,8 +85,9 @@ public class DebugNewProcessSequence extends ReflectionSequence {
protected void setContainerContext(IMIContainerDMContext ctx) {
fContainerCtx = ctx;
}
-
- public DebugNewProcessSequence(DsfExecutor executor, boolean isInitial, IDMContext dmc, String file, Map<String, Object> attributes, DataRequestMonitor<IDMContext> rm) {
+
+ public DebugNewProcessSequence(DsfExecutor executor, boolean isInitial, IDMContext dmc, String file,
+ Map<String, Object> attributes, DataRequestMonitor<IDMContext> rm) {
super(executor, rm);
fContext = dmc;
fBinaryName = file;
@@ -98,27 +98,26 @@ public class DebugNewProcessSequence extends ReflectionSequence {
@Override
protected String[] getExecutionOrder(String group) {
if (GROUP_TOP_LEVEL.equals(group)) {
- return new String[] {
- "stepInitializeBaseSequence", //$NON-NLS-1$
- "stepSetEnvironmentVariables", //$NON-NLS-1$
- "stepSetExecutable", //$NON-NLS-1$
- "stepSetArguments", //$NON-NLS-1$
-
+ return new String[] { "stepInitializeBaseSequence", //$NON-NLS-1$
+ "stepSetEnvironmentVariables", //$NON-NLS-1$
+ "stepSetExecutable", //$NON-NLS-1$
+ "stepSetArguments", //$NON-NLS-1$
+
// For remote non-attach only
- "stepRemoteConnection", //$NON-NLS-1$
+ "stepRemoteConnection", //$NON-NLS-1$
// For post-mortem launch only
- "stepSpecifyCoreFile", //$NON-NLS-1$
-
+ "stepSpecifyCoreFile", //$NON-NLS-1$
+
"stepInitializeMemory", //$NON-NLS-1$
"stepStartTrackingBreakpoints", //$NON-NLS-1$
- "stepStartExecution", //$NON-NLS-1$
- "stepCleanupBaseSequence", //$NON-NLS-1$
+ "stepStartExecution", //$NON-NLS-1$
+ "stepCleanupBaseSequence", //$NON-NLS-1$
};
}
return null;
}
- /**
+ /**
* Initialize the members of the DebugNewProcessSequence class.
* This step is mandatory for the rest of the sequence to complete.
*/
@@ -127,33 +126,36 @@ public class DebugNewProcessSequence extends ReflectionSequence {
fTracker = new DsfServicesTracker(GdbPlugin.getBundleContext(), fContext.getSessionId());
fBackend = fTracker.getService(IGDBBackend.class);
fCommandControl = fTracker.getService(IGDBControl.class);
- fCommandFactory = fTracker.getService(IMICommandControl.class).getCommandFactory();
+ fCommandFactory = fTracker.getService(IMICommandControl.class).getCommandFactory();
fProcService = fTracker.getService(IGDBProcesses.class);
- if (fBackend == null || fCommandControl == null || fCommandFactory == null || fProcService == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR, "Cannot obtain service", null)); //$NON-NLS-1$
+ if (fBackend == null || fCommandControl == null || fCommandFactory == null || fProcService == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR,
+ "Cannot obtain service", null)); //$NON-NLS-1$
rm.done();
return;
}
- // When we are starting to debug a new process, the container is the default process used by GDB.
- // We don't have a pid yet, so we can simply create the container with the UNIQUE_GROUP_ID
- setContainerContext(fProcService.createContainerContextFromGroupId(fCommandControl.getContext(), MIProcesses.UNIQUE_GROUP_ID));
-
- rm.done();
+ // When we are starting to debug a new process, the container is the default process used by GDB.
+ // We don't have a pid yet, so we can simply create the container with the UNIQUE_GROUP_ID
+ setContainerContext(fProcService.createContainerContextFromGroupId(fCommandControl.getContext(),
+ MIProcesses.UNIQUE_GROUP_ID));
+
+ rm.done();
}
-
- /**
+
+ /**
* Rollback method for {@link #stepInitializeBaseSequence()}
- * @since 4.0
+ * @since 4.0
*/
@RollBack("stepInitializeBaseSequence")
public void rollBackInitializeBaseSequence(RequestMonitor rm) {
- if (fTracker != null) fTracker.dispose();
+ if (fTracker != null)
+ fTracker.dispose();
fTracker = null;
rm.done();
}
-
+
/**
* Specify environment variables if needed
*/
@@ -166,7 +168,8 @@ public class DebugNewProcessSequence extends ReflectionSequence {
clear = fBackend.getClearEnvironment();
properties = fBackend.getEnvironmentVariables();
} catch (CoreException e) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.REQUEST_FAILED, "Cannot get environment information", e)); //$NON-NLS-1$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.REQUEST_FAILED,
+ "Cannot get environment information", e)); //$NON-NLS-1$
rm.done();
return;
}
@@ -184,47 +187,43 @@ public class DebugNewProcessSequence extends ReflectionSequence {
*/
@Execute
public void stepSetExecutable(RequestMonitor rm) {
- boolean noFileCommand = CDebugUtils.getAttribute(
- fAttributes,
+ boolean noFileCommand = CDebugUtils.getAttribute(fAttributes,
IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_USE_SOLIB_SYMBOLS_FOR_APP,
IGDBLaunchConfigurationConstants.DEBUGGER_USE_SOLIB_SYMBOLS_FOR_APP_DEFAULT);
if (!noFileCommand && fBinaryName != null && !fBinaryName.isEmpty()) {
- fCommandControl.queueCommand(
- fCommandFactory.createMIFileExecAndSymbols(getContainerContext(), fBinaryName),
+ fCommandControl.queueCommand(fCommandFactory.createMIFileExecAndSymbols(getContainerContext(), fBinaryName),
new ImmediateDataRequestMonitor<MIInfo>(rm));
} else {
rm.done();
}
}
-
+
/**
* Specify the arguments to the program that will be run.
*/
@Execute
public void stepSetArguments(RequestMonitor rm) {
try {
- String args = CDebugUtils.getAttribute(
- fAttributes,
- ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
+ String args = CDebugUtils.getAttribute(fAttributes, ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
""); //$NON-NLS-1$
if (args.length() != 0) {
args = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(args);
String[] argArray = CommandLineUtil.argumentsToArray(args);
- fCommandControl.queueCommand(
- fCommandFactory.createMIGDBSetArgs(getContainerContext(), argArray),
+ fCommandControl.queueCommand(fCommandFactory.createMIGDBSetArgs(getContainerContext(), argArray),
new ImmediateDataRequestMonitor<MIInfo>(rm));
} else {
rm.done();
}
} catch (CoreException e) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.REQUEST_FAILED, "Cannot get inferior arguments", e)); //$NON-NLS-1$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.REQUEST_FAILED,
+ "Cannot get inferior arguments", e)); //$NON-NLS-1$
rm.done();
- }
+ }
}
- /**
+ /**
* If we are dealing with a remote debugging session, connect to the target.
* @since 4.0
*/
@@ -238,31 +237,23 @@ public class DebugNewProcessSequence extends ReflectionSequence {
// It is safe to do it here because a 'target remote' does not support
// multi-process so this step will not be executed more than once.
if (fBackend.getSessionType() == SessionType.REMOTE && !fBackend.getIsAttachSession()) {
- boolean isTcpConnection = CDebugUtils.getAttribute(
- fAttributes,
- IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP,
- false);
+ boolean isTcpConnection = CDebugUtils.getAttribute(fAttributes,
+ IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP, false);
if (isTcpConnection) {
- String remoteTcpHost = CDebugUtils.getAttribute(
- fAttributes,
- IGDBLaunchConfigurationConstants.ATTR_HOST, INVALID);
- String remoteTcpPort = CDebugUtils.getAttribute(
- fAttributes,
- IGDBLaunchConfigurationConstants.ATTR_PORT, INVALID);
+ String remoteTcpHost = CDebugUtils.getAttribute(fAttributes, IGDBLaunchConfigurationConstants.ATTR_HOST,
+ INVALID);
+ String remoteTcpPort = CDebugUtils.getAttribute(fAttributes, IGDBLaunchConfigurationConstants.ATTR_PORT,
+ INVALID);
- fCommandControl.queueCommand(
- fCommandFactory.createMITargetSelect(fCommandControl.getContext(),
- remoteTcpHost, remoteTcpPort, false),
- new ImmediateDataRequestMonitor<MIInfo>(rm));
+ fCommandControl.queueCommand(fCommandFactory.createMITargetSelect(fCommandControl.getContext(),
+ remoteTcpHost, remoteTcpPort, false), new ImmediateDataRequestMonitor<MIInfo>(rm));
} else {
- String serialDevice = CDebugUtils.getAttribute(
- fAttributes,
- IGDBLaunchConfigurationConstants.ATTR_DEV, INVALID);
+ String serialDevice = CDebugUtils.getAttribute(fAttributes, IGDBLaunchConfigurationConstants.ATTR_DEV,
+ INVALID);
fCommandControl.queueCommand(
- fCommandFactory.createMITargetSelect(fCommandControl.getContext(),
- serialDevice, false),
- new ImmediateDataRequestMonitor<MIInfo>(rm));
+ fCommandFactory.createMITargetSelect(fCommandControl.getContext(), serialDevice, false),
+ new ImmediateDataRequestMonitor<MIInfo>(rm));
}
} else {
rm.done();
@@ -273,7 +264,7 @@ public class DebugNewProcessSequence extends ReflectionSequence {
protected static class PromptForCoreJob extends Job {
/**
* The initial path that should be used in the prompt for the core file
- * @since 4.1
+ * @since 4.1
*/
protected String fInitialPath;
protected DataRequestMonitor<String> fRequestMonitor;
@@ -291,7 +282,8 @@ public class DebugNewProcessSequence extends ReflectionSequence {
@Override
protected IStatus run(IProgressMonitor monitor) {
- final IStatus promptStatus = new Status(IStatus.INFO, "org.eclipse.debug.ui", 200/*STATUS_HANDLER_PROMPT*/, "", null); //$NON-NLS-1$//$NON-NLS-2$
+ final IStatus promptStatus = new Status(IStatus.INFO, "org.eclipse.debug.ui", 200/*STATUS_HANDLER_PROMPT*/, //$NON-NLS-1$
+ "", null); //$NON-NLS-1$
final IStatus filePrompt = new Status(IStatus.INFO, "org.eclipse.cdt.dsf.gdb.ui", 1001, "", null); //$NON-NLS-1$//$NON-NLS-2$
// consult a status handler
final IStatusHandler prompter = DebugPlugin.getDefault().getStatusHandler(promptStatus);
@@ -304,14 +296,14 @@ public class DebugNewProcessSequence extends ReflectionSequence {
fRequestMonitor.setStatus(NO_CORE_STATUS);
fRequestMonitor.done();
return Status.OK_STATUS;
- }
+ }
try {
Object result = prompter.handleStatus(filePrompt, fInitialPath);
- if (result == null) {
- fRequestMonitor.cancel();
+ if (result == null) {
+ fRequestMonitor.cancel();
} else if (result instanceof String) {
- fRequestMonitor.setData((String)result);
+ fRequestMonitor.setData((String) result);
} else {
fRequestMonitor.setStatus(NO_CORE_STATUS);
}
@@ -323,8 +315,8 @@ public class DebugNewProcessSequence extends ReflectionSequence {
return Status.OK_STATUS;
}
};
-
- /**
+
+ /**
* If we are dealing with a postmortem session, connect to the core/trace file.
* @since 4.0
*/
@@ -337,25 +329,24 @@ public class DebugNewProcessSequence extends ReflectionSequence {
// multi-process so this step will not be executed more than once.
// Bug 338730
if (fBackend.getSessionType() == SessionType.CORE) {
- String coreFile = CDebugUtils.getAttribute(
- fAttributes,
- ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, ""); //$NON-NLS-1$
-
+ String coreFile = CDebugUtils.getAttribute(fAttributes, ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH,
+ ""); //$NON-NLS-1$
+
try {
// Support variable substitution for the core file path
// Bug 362039
- coreFile = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(coreFile, false);
+ coreFile = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(coreFile,
+ false);
} catch (CoreException e) {
// Ignore and use core file string as is.
// This should not happen because the dialog will
// prevent the user from making such mistakes
}
- final String coreType = CDebugUtils.getAttribute(
- fAttributes,
+ final String coreType = CDebugUtils.getAttribute(fAttributes,
IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_POST_MORTEM_TYPE,
IGDBLaunchConfigurationConstants.DEBUGGER_POST_MORTEM_TYPE_DEFAULT);
-
+
// We handle three cases:
// 1- Core file specified, in which case we use it
// 2- Nothing specified, in which case we prompt for a core file path
@@ -374,64 +365,65 @@ public class DebugNewProcessSequence extends ReflectionSequence {
}
// else not a directory but an actual core file: use it.
}
-
+
if (shouldPrompt) {
- new PromptForCoreJob(
- "Prompt for post mortem file", //$NON-NLS-1$
- coreType,
- coreFile,
- new DataRequestMonitor<String>(getExecutor(), rm) {
- @Override
- protected void handleCancel() {
- rm.cancel();
+ new PromptForCoreJob("Prompt for post mortem file", //$NON-NLS-1$
+ coreType, coreFile, new DataRequestMonitor<String>(getExecutor(), rm) {
+ @Override
+ protected void handleCancel() {
+ rm.cancel();
+ rm.done();
+ }
+
+ @Override
+ protected void handleSuccess() {
+ String newCoreFile = getData();
+ if (newCoreFile == null || newCoreFile.length() == 0) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1,
+ Messages.Cannot_get_post_mortem_file_path_error, null));
rm.done();
+ } else {
+ targetSelectFile(coreType, newCoreFile, rm);
}
- @Override
- protected void handleSuccess() {
- String newCoreFile = getData();
- if (newCoreFile == null || newCoreFile.length()== 0) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, Messages.Cannot_get_post_mortem_file_path_error, null));
- rm.done();
- } else {
- targetSelectFile(coreType, newCoreFile, rm);
- }
- }
- }).schedule();
- } else {
- // The user specified something that was not a directory,
- // it therefore should be the core file itself. Let's use it.
-
- // First convert to absolute path so that things work even if the user
- // specifies a relative path. The reason we do this is that GDB
- // may not be using the same root path as Eclipse.
- String absoluteCoreFile = new Path(coreFile).toFile().getAbsolutePath();
- targetSelectFile(coreType, absoluteCoreFile, rm);
- }
+ }
+ }).schedule();
+ } else {
+ // The user specified something that was not a directory,
+ // it therefore should be the core file itself. Let's use it.
+
+ // First convert to absolute path so that things work even if the user
+ // specifies a relative path. The reason we do this is that GDB
+ // may not be using the same root path as Eclipse.
+ String absoluteCoreFile = new Path(coreFile).toFile().getAbsolutePath();
+ targetSelectFile(coreType, absoluteCoreFile, rm);
+ }
} else {
rm.done();
}
}
-
+
private void targetSelectFile(String coreType, String file, RequestMonitor rm) {
if (coreType.equals(IGDBLaunchConfigurationConstants.DEBUGGER_POST_MORTEM_CORE_FILE)) {
- fCommandControl.queueCommand(
- fCommandFactory.createMITargetSelectCore(fCommandControl.getContext(), file),
+ fCommandControl.queueCommand(fCommandFactory.createMITargetSelectCore(fCommandControl.getContext(), file),
new DataRequestMonitor<MIInfo>(getExecutor(), rm));
} else if (coreType.equals(IGDBLaunchConfigurationConstants.DEBUGGER_POST_MORTEM_TRACE_FILE)) {
IGDBTraceControl traceControl = fTracker.getService(IGDBTraceControl.class);
if (traceControl != null) {
- ITraceTargetDMContext targetDmc = DMContexts.getAncestorOfType(fCommandControl.getContext(), ITraceTargetDMContext.class);
+ ITraceTargetDMContext targetDmc = DMContexts.getAncestorOfType(fCommandControl.getContext(),
+ ITraceTargetDMContext.class);
traceControl.loadTraceData(targetDmc, file, rm);
} else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, Messages.Tracing_not_supported_error, null));
+ rm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, Messages.Tracing_not_supported_error, null));
rm.done();
}
} else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, Messages.Invalid_post_mortem_type_error, null));
+ rm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, Messages.Invalid_post_mortem_type_error, null));
rm.done();
}
}
-
+
/**
* Start tracking the breakpoints. Note that for remote debugging
* we should first connect to the target.
@@ -471,27 +463,28 @@ public class DebugNewProcessSequence extends ReflectionSequence {
// This is important for multi-process
// Bug 342351
fAttributes.put(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, fBinaryName);
-
- fProcService.start(getContainerContext(), fAttributes, new ImmediateDataRequestMonitor<IContainerDMContext>(rm) {
- @Override
- protected void handleSuccess() {
- assert getData() instanceof IMIContainerDMContext;
-
- // Set the container that we created
- setContainerContext(DMContexts.getAncestorOfType(getData(), IMIContainerDMContext.class));
- fDataRequestMonitor.setData(getContainerContext());
-
- // Don't call fDataRequestMonitor.done(), the sequence will
- // automatically do that when it completes;
- rm.done();
- }
- });
+
+ fProcService.start(getContainerContext(), fAttributes,
+ new ImmediateDataRequestMonitor<IContainerDMContext>(rm) {
+ @Override
+ protected void handleSuccess() {
+ assert getData() instanceof IMIContainerDMContext;
+
+ // Set the container that we created
+ setContainerContext(DMContexts.getAncestorOfType(getData(), IMIContainerDMContext.class));
+ fDataRequestMonitor.setData(getContainerContext());
+
+ // Don't call fDataRequestMonitor.done(), the sequence will
+ // automatically do that when it completes;
+ rm.done();
+ }
+ });
} else {
fDataRequestMonitor.setData(getContainerContext());
rm.done();
}
}
-
+
/**
* Cleanup now that the sequence has been run.
* @since 4.0
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/DebugNewProcessSequence_7_2.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/DebugNewProcessSequence_7_2.java
index f7a664a25ac..c2918cbda48 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/DebugNewProcessSequence_7_2.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/DebugNewProcessSequence_7_2.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
@@ -40,7 +40,7 @@ import org.eclipse.core.runtime.Status;
* This allows to create multiple processes, unlike previous versions of GDB.
* Note that GDB 7.1 does support multi-process but didn't have the MI commands (e.g., -add-inferior)
* so we only support multi-process starting with 7.2
- *
+ *
* @since 4.0
*/
public class DebugNewProcessSequence_7_2 extends DebugNewProcessSequence {
@@ -53,13 +53,8 @@ public class DebugNewProcessSequence_7_2 extends DebugNewProcessSequence {
private final boolean fInitialProcess;
private final Map<String, Object> fAttributes;
- public DebugNewProcessSequence_7_2(
- DsfExecutor executor,
- boolean isInitial,
- IDMContext dmc,
- String file,
- Map<String, Object> attributes,
- DataRequestMonitor<IDMContext> rm) {
+ public DebugNewProcessSequence_7_2(DsfExecutor executor, boolean isInitial, IDMContext dmc, String file,
+ Map<String, Object> attributes, DataRequestMonitor<IDMContext> rm) {
super(executor, isInitial, dmc, file, attributes, rm);
fSessionId = dmc.getSessionId();
fInitialProcess = isInitial;
@@ -77,14 +72,14 @@ public class DebugNewProcessSequence_7_2 extends DebugNewProcessSequence {
orderList.add(orderList.indexOf("stepInitializeBaseSequence") + 1, "stepInitializeSequence_7_2"); //$NON-NLS-1$ //$NON-NLS-2$
orderList.add(orderList.indexOf("stepInitializeSequence_7_2") + 1, "stepAddInferior"); //$NON-NLS-1$ //$NON-NLS-2$
orderList.add(orderList.indexOf("stepSetExecutable") + 1, "stepSetRemoteExecutable"); //$NON-NLS-1$ //$NON-NLS-2$
-
+
return orderList.toArray(new String[orderList.size()]);
}
return null;
}
- /**
+ /**
* Initialize the members of the DebugNewProcessSequence_7_2 class.
* This step is mandatory for the rest of the sequence to complete.
*/
@@ -95,18 +90,19 @@ public class DebugNewProcessSequence_7_2 extends DebugNewProcessSequence {
fProcService = tracker.getService(IGDBProcesses.class);
fBackend = tracker.getService(IGDBBackend.class);
tracker.dispose();
-
- if (fGdbControl == null || fProcService == null || fBackend == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR, "Cannot obtain service", null)); //$NON-NLS-1$
+
+ if (fGdbControl == null || fProcService == null || fBackend == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR,
+ "Cannot obtain service", null)); //$NON-NLS-1$
rm.done();
return;
}
-
- fCommandFactory = fGdbControl.getCommandFactory();
-
+
+ fCommandFactory = fGdbControl.getCommandFactory();
+
rm.done();
}
-
+
/**
* Add a new inferior.
*/
@@ -118,24 +114,26 @@ public class DebugNewProcessSequence_7_2 extends DebugNewProcessSequence {
// 1- post-mortem and non-attach remote sessions don't support creating a new process
// 2- commands that were part of the .gdbinit file will affect the initial process, which is what the user expects,
// but would not affect a new process we created instead.
- setContainerContext(fProcService.createContainerContextFromGroupId(fGdbControl.getContext(), GDBProcesses_7_2.INITIAL_THREAD_GROUP_ID));
+ setContainerContext(fProcService.createContainerContextFromGroupId(fGdbControl.getContext(),
+ GDBProcesses_7_2.INITIAL_THREAD_GROUP_ID));
rm.done();
return;
}
-
- fGdbControl.queueCommand(
- fGdbControl.getCommandFactory().createMIAddInferior(fGdbControl.getContext()),
+
+ fGdbControl.queueCommand(fGdbControl.getCommandFactory().createMIAddInferior(fGdbControl.getContext()),
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, IDsfStatusConstants.REQUEST_FAILED, "Invalid gdb group id.", null)); //$NON-NLS-1$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
+ IDsfStatusConstants.REQUEST_FAILED, "Invalid gdb group id.", null)); //$NON-NLS-1$
rm.done();
return;
}
- setContainerContext(fProcService.createContainerContextFromGroupId(fGdbControl.getContext(), groupId));
+ setContainerContext(
+ fProcService.createContainerContextFromGroupId(fGdbControl.getContext(), groupId));
rm.done();
}
});
@@ -148,27 +146,18 @@ public class DebugNewProcessSequence_7_2 extends DebugNewProcessSequence {
@Execute
public void stepSetRemoteExecutable(final RequestMonitor rm) {
if (fBackend.getSessionType() == SessionType.REMOTE && fBackend.getIsAttachSession()) {
- String remoteBinary = CDebugUtils.getAttribute(
- fAttributes,
- IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_BINARY,
- ""); //$NON-NLS-1$
+ String remoteBinary = CDebugUtils.getAttribute(fAttributes,
+ IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_BINARY, ""); //$NON-NLS-1$
if (remoteBinary.length() == 0) {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Binary on host is not specified")); //$NON-NLS-1$
rm.done();
return;
}
- fGdbControl.queueCommand(
- fCommandFactory.createMIGDBSet(
- getContainerContext(),
- new String[] {
- "remote", //$NON-NLS-1$
- "exec-file", //$NON-NLS-1$
- remoteBinary,
- }),
- new ImmediateDataRequestMonitor<MIInfo>(rm));
- }
- else {
+ fGdbControl.queueCommand(fCommandFactory.createMIGDBSet(getContainerContext(), new String[] { "remote", //$NON-NLS-1$
+ "exec-file", //$NON-NLS-1$
+ remoteBinary, }), new ImmediateDataRequestMonitor<MIInfo>(rm));
+ } else {
rm.done();
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBackend.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBackend.java
index 7f90e7538c9..77a3d2ec311 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBackend.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBackend.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Nokia - initial API and implementation with some code moved from GDBControl.
* Wind River System
@@ -67,7 +67,7 @@ import org.osgi.framework.BundleContext;
* manages some GDB parameters from a given launch configuration.<br>
* <br>
* You can subclass for you special needs.
- *
+ *
* @since 1.1
*/
public class GDBBackend extends AbstractDsfService implements IGDBBackend, IMIBackend2 {
@@ -174,11 +174,11 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend, IMIBa
/**
* Options for GDB process. Returns the GDB command and its arguments as an
* array. Allow subclass to override.
- *
+ *
* @since 4.6
* @deprecated Replaced by getDebuggerCommandLine()
*/
- @Deprecated
+ @Deprecated
protected String[] getGDBCommandLineArray() {
// The goal here is to keep options to an absolute minimum.
// All configuration should be done in the final launch sequence
@@ -187,10 +187,10 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend, IMIBa
String cmd = getGDBPath().toOSString() + " --interpreter" + //$NON-NLS-1$
// We currently work with MI version 2. Don't use just 'mi' because it
// points to the latest MI version, while we want mi2 specifically.
- " mi2" + //$NON-NLS-1$
- // Don't read the gdbinit file here. It is read explicitly in
- // the LaunchSequence to make it easier to customize.
- " --nx"; //$NON-NLS-1$
+ " mi2" + //$NON-NLS-1$
+ // Don't read the gdbinit file here. It is read explicitly in
+ // the LaunchSequence to make it easier to customize.
+ " --nx"; //$NON-NLS-1$
// Parse to properly handle spaces and such things (bug 458499)
return CommandLineUtil.argumentsToArray(cmd);
@@ -201,29 +201,29 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend, IMIBa
* Allow subclass to override.
* @since 5.2
*/
- // This method replaces getGDBCommandLineArray() because we need
- // to override it for GDB 7.12 even if an extender has overridden
- // getGDBCommandLineArray().
- // Here is the scenario:
- // An extender has overridden getGDBCommandLineArray() to launch
- // GDB in MI mode but with extra parameters. Once GDBBackend_7_12
- // is released, the extender may likely point their extension to
- // GDBBackend_7_12 instead of GDBBackend (which will even happen
- // automatically if the extender extends GDBBackend_HEAD).
- // In such a case, they would override the changes in
- // GDBBackend_7_12.getGDBCommandLineArray() and the debug session
- // is likely to fail since with GDBBackend_7_12, we launch GDB
- // in CLI mode.
- //
- // Instead, we use getDebuggerCommandLine() and override that method in
- // GDBBackend_7_12. That way an extender will not override it
- // without noticing (since it didn't exist before). Then we can call
- // the overridden getGDBCommandLineArray() and work with that to
- // make it work with the new way to launch GDB of GDBBackend_7_12
- //
- // Note that we didn't name this method getGDBCommandLine() because
- // this name had been used in CDT 8.8 and could still be part of
- // extenders' code.
+ // This method replaces getGDBCommandLineArray() because we need
+ // to override it for GDB 7.12 even if an extender has overridden
+ // getGDBCommandLineArray().
+ // Here is the scenario:
+ // An extender has overridden getGDBCommandLineArray() to launch
+ // GDB in MI mode but with extra parameters. Once GDBBackend_7_12
+ // is released, the extender may likely point their extension to
+ // GDBBackend_7_12 instead of GDBBackend (which will even happen
+ // automatically if the extender extends GDBBackend_HEAD).
+ // In such a case, they would override the changes in
+ // GDBBackend_7_12.getGDBCommandLineArray() and the debug session
+ // is likely to fail since with GDBBackend_7_12, we launch GDB
+ // in CLI mode.
+ //
+ // Instead, we use getDebuggerCommandLine() and override that method in
+ // GDBBackend_7_12. That way an extender will not override it
+ // without noticing (since it didn't exist before). Then we can call
+ // the overridden getGDBCommandLineArray() and work with that to
+ // make it work with the new way to launch GDB of GDBBackend_7_12
+ //
+ // Note that we didn't name this method getGDBCommandLine() because
+ // this name had been used in CDT 8.8 and could still be part of
+ // extenders' code.
protected String[] getDebuggerCommandLine() {
// Call the old method in case it was overridden
return getGDBCommandLineArray();
@@ -278,7 +278,7 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend, IMIBa
/**
* Launch GDB process. Allow subclass to override.
- *
+ *
* @since 5.2
*/
// Again, we create a new method that we know has not been already
@@ -300,7 +300,7 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend, IMIBa
/**
* Launch GDB process with command and arguments. Allow subclass to
* override.
- *
+ *
* @since 4.6
* @deprecated Replace by launchGDBProcess()
*/
@@ -532,7 +532,7 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend, IMIBa
}
try {
- fProcess = launchGDBProcess();
+ fProcess = launchGDBProcess();
// Need to do this on the executor for thread-safety
getExecutor().submit(new DsfRunnable() {
@@ -624,9 +624,9 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend, IMIBa
if (jobThread != null) {
jobThread.interrupt();
}
-
+
destroy();
-
+
requestMonitor.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
DebugException.TARGET_REQUEST_FAILED, "Timed out trying to launch GDB.", null)); //$NON-NLS-1$
requestMonitor.done();
@@ -732,7 +732,7 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend, IMIBa
* GDBControlInitializedDMEvent that's used to indicate that GDB back
* end is ready for MI commands. But we still fire the event as it does
* no harm and may be needed sometime.... 09/29/2008
- *
+ *
* We send the event in the register step because that is when other
* services have access to it.
*/
@@ -810,12 +810,12 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend, IMIBa
* this job should be canceled. If this job is not canceled before the time
* is up, it will imply the interrupt did not successfully suspend the
* backend, and the current job will indicate this in the request monitor.
- *
+ *
* The specified timeout is used to indicate how many milliseconds this job
* should wait for. INTERRUPT_TIMEOUT_DEFAULT indicates to use the default
* of 5 seconds. The default is also use if the timeout value is 0 or
* negative.
- *
+ *
* @since 3.0
*/
protected class MonitorInterruptJob extends Job {
@@ -864,14 +864,14 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend, IMIBa
* when the target stops, in cases where we don't want to views to update.
* For example, if we want to interrupt the target to set a breakpoint, this
* interruption is done silently; we will receive the MI event though.
- *
+ *
* <p>
* Though we send a SIGINT, we may not specifically get an MISignalEvent.
* Typically we will, but not always, so wait for an MIStoppedEvent. See
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=305178#c21
- *
+ *
* @since 3.0
- *
+ *
*/
@DsfServiceEventHandler
public void eventDispatched(final MIStoppedEvent e) {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBackend_7_12.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBackend_7_12.java
index 939d41edbf1..3f783563bd9 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBackend_7_12.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBackend_7_12.java
@@ -34,10 +34,10 @@ import org.eclipse.osgi.util.NLS;
* full GDB console support. It achieves this by launching GDB in CLI mode
* in a special console widget and then connecting to GDB via MI by telling GDB to
* open a new MI console. The rest of the DSF-GDB support then stays the same.
- *
+ *
* If we are unable to create a PTY, we then revert to the previous behavior of
* the base class.
- *
+ *
* @since 5.2
*/
public class GDBBackend_7_12 extends GDBBackend {
@@ -46,10 +46,10 @@ public class GDBBackend_7_12 extends GDBBackend {
private PTY fMIPty;
/** The PTY that is used to create the GDB process in CLI mode */
private PTY fCLIPty;
-
+
/** Indicate that we failed to create a PTY. */
private boolean fPtyFailure;
-
+
private InputStream fDummyErrorStream;
public GDBBackend_7_12(DsfSession session, ILaunchConfiguration lc) {
@@ -62,12 +62,12 @@ public class GDBBackend_7_12 extends GDBBackend {
return !Platform.getOS().equals(Platform.OS_WIN32) && !Platform.getOS().equals(Platform.OS_MACOSX)
&& !fPtyFailure;
}
-
+
protected void createPty() {
if (!isFullGdbConsoleSupported()) {
return;
}
-
+
try {
fMIPty = new PTY();
fMIPty.validateSlaveName();
@@ -83,12 +83,11 @@ public class GDBBackend_7_12 extends GDBBackend {
} catch (IOException e) {
fMIPty = null;
fPtyFailure = true;
- GdbPlugin.log(new Status(
- IStatus.INFO, GdbPlugin.PLUGIN_ID,
- NLS.bind(Messages.PTY_Console_not_available, e.getMessage())));
+ GdbPlugin.log(new Status(IStatus.INFO, GdbPlugin.PLUGIN_ID,
+ NLS.bind(Messages.PTY_Console_not_available, e.getMessage())));
}
}
-
+
@Override
public OutputStream getMIOutputStream() {
if (fMIPty == null) {
@@ -121,15 +120,15 @@ public class GDBBackend_7_12 extends GDBBackend {
// Then trigger the MI console
@SuppressWarnings("deprecation")
String[] originalCommandLine = getGDBCommandLineArray();
-
- if (!isFullGdbConsoleSupported()) {
- return originalCommandLine;
- }
-
- // Below are the parameters we need to add to an existing commandLine,
- // to trigger a launch with the full CLI. This would also work
- // as the only parameters for a full CLI launch (although "--interpreter console"
- // could be removed in that case)
+
+ if (!isFullGdbConsoleSupported()) {
+ return originalCommandLine;
+ }
+
+ // Below are the parameters we need to add to an existing commandLine,
+ // to trigger a launch with the full CLI. This would also work
+ // as the only parameters for a full CLI launch (although "--interpreter console"
+ // could be removed in that case)
String[] extraArguments = new String[] {
// Start with -q option to avoid extra output which may trigger pagination
// This is important because if pagination is triggered on the version
@@ -137,51 +136,51 @@ public class GDBBackend_7_12 extends GDBBackend {
// Note that we cannot turn off pagination early enough to prevent the
// original version output from paginating
"-q", //$NON-NLS-1$
-
-// We don't put --nx at this time because our base class puts it already and if
-// if an extender has removed it, we shouldn't add it again.
-// Once we no longer extends the deprecated getGDBCommandLineArray() and simply
-// create the full commandLine here, we should put it
-// // Use the --nx option to avoid reading the gdbinit file here.
-// // The gdbinit file is read explicitly in the FinalLaunchSequence to make
-// // it easier to customize.
-// "--nx", //$NON-NLS-1$
-
+
+ // We don't put --nx at this time because our base class puts it already and if
+ // if an extender has removed it, we shouldn't add it again.
+ // Once we no longer extends the deprecated getGDBCommandLineArray() and simply
+ // create the full commandLine here, we should put it
+ // // Use the --nx option to avoid reading the gdbinit file here.
+ // // The gdbinit file is read explicitly in the FinalLaunchSequence to make
+ // // it easier to customize.
+ // "--nx", //$NON-NLS-1$
+
// Force a CLI console since the originalCommandLine
// probably specified "-i mi" or "--interpreter mi"
- // Once we no longer extend the deprecated
- // getGDBCommandLineArray() and simply create the full
+ // Once we no longer extend the deprecated
+ // getGDBCommandLineArray() and simply create the full
// commandLine here, we could remove this parameter
"--interpreter", "console", //$NON-NLS-1$ //$NON-NLS-2$
-
+
// Now trigger the new console towards our PTY.
"-ex", "new-ui mi " + fMIPty.getSlaveName(), //$NON-NLS-1$ //$NON-NLS-2$
-
+
// With GDB.7.12, pagination can lock up the whole debug session
// when using the full GDB console, so we turn it off.
// We must turn it off before calling 'show version' as even
// that command could cause pagination to trigger
- "-ex", "set pagination off", //$NON-NLS-1$//$NON-NLS-2$
+ "-ex", "set pagination off", //$NON-NLS-1$//$NON-NLS-2$
// Now print the version so the user gets that familiar output
- "-ex", "show version" //$NON-NLS-1$ //$NON-NLS-2$
+ "-ex", "show version" //$NON-NLS-1$ //$NON-NLS-2$
};
int oriLength = originalCommandLine.length;
int extraLength = extraArguments.length;
- String[] newCommandLine = new String[oriLength+extraLength];
+ String[] newCommandLine = new String[oriLength + extraLength];
System.arraycopy(originalCommandLine, 0, newCommandLine, 0, oriLength);
System.arraycopy(extraArguments, 0, newCommandLine, oriLength, extraLength);
return newCommandLine;
}
-
+
@Override
protected Process launchGDBProcess() throws CoreException {
if (!isFullGdbConsoleSupported()) {
return super.launchGDBProcess();
}
-
+
// If we are launching the full console, we need to use a PTY in TERMINAL mode
// for the GDB CLI to properly display in its view
Process proc = null;
@@ -189,9 +188,7 @@ public class GDBBackend_7_12 extends GDBBackend {
try {
fCLIPty = new PTY(Mode.TERMINAL);
IPath path = getGDBWorkingDirectory();
- proc = ProcessFactory.getFactory().exec(
- commandLine,
- getGDBLaunch().getLaunchEnvironment(),
+ proc = ProcessFactory.getFactory().exec(commandLine, getGDBLaunch().getLaunchEnvironment(),
new File(path != null ? path.toOSString() : ""), //$NON-NLS-1$
fCLIPty);
} catch (IOException e) {
@@ -201,7 +198,7 @@ public class GDBBackend_7_12 extends GDBBackend {
return proc;
}
-
+
@Override
public PTY getProcessPty() {
return fCLIPty;
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpointsManager_7_0.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpointsManager_7_0.java
index 90cf1ae3e0d..bf1cd6965ab 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpointsManager_7_0.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpointsManager_7_0.java
@@ -9,7 +9,7 @@
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
- * Marc Khouzam (Ericsson) - Initial API and implementation
+ * Marc Khouzam (Ericsson) - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.service;
@@ -33,11 +33,11 @@ import org.eclipse.debug.core.model.IBreakpoint;
/**
* Version of BreakpointsManager for GDB version starting with 7.0.
- *
+ *
* @since 4.7
*/
public class GDBBreakpointsManager_7_0 extends MIBreakpointsManager {
- private String fDebugModelId;
+ private String fDebugModelId;
public GDBBreakpointsManager_7_0(DsfSession session, String debugModelId) {
super(session, debugModelId);
@@ -55,14 +55,13 @@ public class GDBBreakpointsManager_7_0 extends MIBreakpointsManager {
}
private void doInitialize(final RequestMonitor rm) {
- register(new String[] { GDBBreakpointsManager_7_0.class.getName() },
- new Hashtable<String, String>());
+ register(new String[] { GDBBreakpointsManager_7_0.class.getName() }, new Hashtable<String, String>());
rm.done();
}
@DsfServiceEventHandler
- public void eventDispatched_7_0(IStartedDMEvent e) {
+ public void eventDispatched_7_0(IStartedDMEvent e) {
// With GDB 7.0 and 7.1, the pid of the process is used by GDB
// as the thread-group id. This is a problem because the pid does
// not exist when we create breakpoints.
@@ -73,29 +72,29 @@ public class GDBBreakpointsManager_7_0 extends MIBreakpointsManager {
// pid when we get the start event for the process.
// Note that we don't support multi-process for GDB 7.0 and 7.1, so it
// simplifies things.
- updateContextOnStartEvent(e);
- }
+ updateContextOnStartEvent(e);
+ }
protected void updateContextOnStartEvent(IStartedDMEvent e) {
if (e.getDMContext() instanceof IContainerDMContext) {
// Process created.
- IContainerDMContext containerWithPid = (IContainerDMContext)e.getDMContext();
-
- assert getTrackedBreakpointTargetContexts().size() == 1; // Only one process for GDB 7.0 and 7.1
+ IContainerDMContext containerWithPid = (IContainerDMContext) e.getDMContext();
+
+ assert getTrackedBreakpointTargetContexts().size() == 1; // Only one process for GDB 7.0 and 7.1
for (IBreakpointsTargetDMContext oldBpTarget : getTrackedBreakpointTargetContexts()) {
assert oldBpTarget instanceof IContainerDMContext;
- assert !containerWithPid.equals(oldBpTarget); // BpTarget does not have pid, while new container does
+ assert !containerWithPid.equals(oldBpTarget); // BpTarget does not have pid, while new container does
// Replace all BpTarget entries with the new container context containing the pid
- IBreakpointsTargetDMContext newBpTarget = (IBreakpointsTargetDMContext)containerWithPid;
+ IBreakpointsTargetDMContext newBpTarget = (IBreakpointsTargetDMContext) containerWithPid;
updateBpManagerMaps(newBpTarget, oldBpTarget);
-
+
// Replace all target filters of this session with the new container context containing the pid
updateTargetFilters(containerWithPid);
}
}
}
-
+
/**
* Updates all the maps of the MIBreakpointsManager to replace the old IBreakpointsTargetDMContext which
* does not have the pid, with the new one with does have the pid.
@@ -106,7 +105,7 @@ public class GDBBreakpointsManager_7_0 extends MIBreakpointsManager {
getBPToPlatformMaps().put(newBpTarget, getBPToPlatformMaps().get(oldBpTarget));
getPlatformToBPThreadsMaps().put(newBpTarget, getPlatformToBPThreadsMaps().get(oldBpTarget));
}
-
+
/**
* Updates all the target filter for this session to replace the old IBreakpointsTargetDMContext which
* does not have the pid, with the new one with does have the pid.
@@ -116,13 +115,15 @@ public class GDBBreakpointsManager_7_0 extends MIBreakpointsManager {
for (IBreakpoint breakpoint : breakpoints) {
if (breakpoint instanceof ICBreakpoint && supportsBreakpoint(breakpoint)) {
try {
- IDsfBreakpointExtension filterExt = getFilterExtension((ICBreakpoint)breakpoint);
+ IDsfBreakpointExtension filterExt = getFilterExtension((ICBreakpoint) breakpoint);
IContainerDMContext[] filterContainers = filterExt.getTargetFilters();
for (IContainerDMContext oldContainer : filterContainers) {
// For each target filter, replace it if it is from our session
- ICommandControlDMContext controldForOld = DMContexts.getAncestorOfType(oldContainer, ICommandControlDMContext.class);
- ICommandControlDMContext controlForNew = DMContexts.getAncestorOfType(newContainer, ICommandControlDMContext.class);
+ ICommandControlDMContext controldForOld = DMContexts.getAncestorOfType(oldContainer,
+ ICommandControlDMContext.class);
+ ICommandControlDMContext controlForNew = DMContexts.getAncestorOfType(newContainer,
+ ICommandControlDMContext.class);
if (controldForOld.equals(controlForNew)) {
filterExt.removeTargetFilter(oldContainer);
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpointsManager_7_2.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpointsManager_7_2.java
index 1b933995732..8c3e4594407 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpointsManager_7_2.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpointsManager_7_2.java
@@ -9,7 +9,7 @@
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
- * Marc Khouzam (Ericsson) - Initial API and implementation
+ * Marc Khouzam (Ericsson) - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.service;
@@ -40,16 +40,15 @@ public class GDBBreakpointsManager_7_2 extends GDBBreakpointsManager_7_0 {
}
private void doInitialize(final RequestMonitor rm) {
- register(new String[] { GDBBreakpointsManager_7_2.class.getName() },
- new Hashtable<String, String>());
+ register(new String[] { GDBBreakpointsManager_7_2.class.getName() }, new Hashtable<String, String>());
rm.done();
}
@Override
- protected void updateContextOnStartEvent(IStartedDMEvent e) {
+ protected void updateContextOnStartEvent(IStartedDMEvent e) {
// No longer need to update the context as the logic
- // of the base class was to work around an issue with
+ // of the base class was to work around an issue with
// GDB 7.0 and 7.1
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_0.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_0.java
index 9fdfbd24e20..2b52817c0fe 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_0.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_0.java
@@ -9,7 +9,7 @@
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
- * Ericsson - Initial API and implementation
+ * Ericsson - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.service;
@@ -51,8 +51,7 @@ import org.eclipse.core.runtime.Status;
* @since 3.0
*/
-public class GDBBreakpoints_7_0 extends MIBreakpoints
-{
+public class GDBBreakpoints_7_0 extends MIBreakpoints {
private ICommandControl fConnection;
private IMIRunControl fRunControl;
private CommandFactory fCommandFactory;
@@ -75,16 +74,15 @@ public class GDBBreakpoints_7_0 extends MIBreakpoints
}
private void doInitialize(final RequestMonitor rm) {
- // Get the services references
+ // Get the services references
fConnection = getServicesTracker().getService(ICommandControl.class);
fRunControl = getServicesTracker().getService(IMIRunControl.class);
- fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
+ fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
// Register this service
- register(new String[] { IBreakpoints.class.getName(),
- IBreakpointsExtension.class.getName(),
- MIBreakpoints.class.getName(),
- GDBBreakpoints_7_0.class.getName() },
+ register(
+ new String[] { IBreakpoints.class.getName(), IBreakpointsExtension.class.getName(),
+ MIBreakpoints.class.getName(), GDBBreakpoints_7_0.class.getName() },
new Hashtable<String, String>());
rm.done();
@@ -121,7 +119,7 @@ public class GDBBreakpoints_7_0 extends MIBreakpoints
@Override
public void shutdown(RequestMonitor requestMonitor) {
- unregister();
+ unregister();
super.shutdown(requestMonitor);
}
@@ -130,131 +128,139 @@ public class GDBBreakpoints_7_0 extends MIBreakpoints
* With GDB 7.0, we can create a breakpoint that is disabled. This avoids having to disable it as
* a separate command. It is also much better because in non-stop, we don't risk habing a thread
* hitting the breakpoint between creation and disablement.
- *
+ *
* @param context
* @param breakpoint
* @param finalRm
*/
@Override
- protected void addBreakpoint(final IBreakpointsTargetDMContext context, final Map<String, Object> attributes,
- final DataRequestMonitor<IBreakpointDMContext> finalRm)
- {
+ protected void addBreakpoint(final IBreakpointsTargetDMContext context, final Map<String, Object> attributes,
+ final DataRequestMonitor<IBreakpointDMContext> finalRm) {
// Select the context breakpoints map
final Map<String, MIBreakpointDMData> contextBreakpoints = getBreakpointMap(context);
if (contextBreakpoints == null) {
- finalRm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
- finalRm.done();
+ finalRm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
+ finalRm.done();
return;
}
// Extract the relevant parameters (providing default values to avoid potential NPEs)
final String location = formatLocation(attributes);
if (location.equals(NULL_STRING)) {
- finalRm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
- finalRm.done();
+ finalRm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
+ finalRm.done();
return;
}
- final Boolean enabled = (Boolean) getProperty(attributes, MIBreakpoints.IS_ENABLED, true);
- final Boolean isTemporary = (Boolean) getProperty(attributes, MIBreakpointDMData.IS_TEMPORARY, false);
- final Boolean isHardware = (Boolean) getProperty(attributes, MIBreakpointDMData.IS_HARDWARE, false);
- final String condition = (String) getProperty(attributes, MIBreakpoints.CONDITION, NULL_STRING);
- final Integer ignoreCount = (Integer) getProperty(attributes, MIBreakpoints.IGNORE_COUNT, 0);
- String threadId = (String) getProperty(attributes, MIBreakpointDMData.THREAD_ID, "0"); //$NON-NLS-1$
-
- final Step insertBreakpointStep = new Step() {
- @Override
- public void execute(final RequestMonitor rm) {
- // Execute the command
- fConnection.queueCommand(
- fCommandFactory.createMIBreakInsert(context, isTemporary, isHardware, condition, ignoreCount, location, threadId, !enabled, false),
- new DataRequestMonitor<MIBreakInsertInfo>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
-
- // With MI, an invalid location won't generate an error
- if (getData().getMIBreakpoints().length == 0) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, BREAKPOINT_INSERTION_FAILURE, null));
- rm.done();
- return;
- }
-
- // Create a breakpoint object and store it in the map
- final MIBreakpointDMData newBreakpoint = createMIBreakpointDMData(getData().getMIBreakpoints()[0]);
- String reference = newBreakpoint.getNumber();
- if (reference.isEmpty()) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, BREAKPOINT_INSERTION_FAILURE, null));
- rm.done();
- return;
- }
- contextBreakpoints.put(reference, newBreakpoint);
-
- // Format the return value
- MIBreakpointDMContext dmc = new MIBreakpointDMContext(GDBBreakpoints_7_0.this, new IDMContext[] { context }, reference);
- finalRm.setData(dmc);
-
- // Flag the event
- getSession().dispatchEvent(new BreakpointAddedEvent(dmc), getProperties());
-
- rm.done();
- }
-
- @Override
- protected void handleError() {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, BREAKPOINT_INSERTION_FAILURE, getStatus().getException()));
- rm.done();
- }
- });
- }
- };
-
- fRunControl.executeWithTargetAvailable(context, new Step[] { insertBreakpointStep }, finalRm);
+ final Boolean enabled = (Boolean) getProperty(attributes, MIBreakpoints.IS_ENABLED, true);
+ final Boolean isTemporary = (Boolean) getProperty(attributes, MIBreakpointDMData.IS_TEMPORARY, false);
+ final Boolean isHardware = (Boolean) getProperty(attributes, MIBreakpointDMData.IS_HARDWARE, false);
+ final String condition = (String) getProperty(attributes, MIBreakpoints.CONDITION, NULL_STRING);
+ final Integer ignoreCount = (Integer) getProperty(attributes, MIBreakpoints.IGNORE_COUNT, 0);
+ String threadId = (String) getProperty(attributes, MIBreakpointDMData.THREAD_ID, "0"); //$NON-NLS-1$
+
+ final Step insertBreakpointStep = new Step() {
+ @Override
+ public void execute(final RequestMonitor rm) {
+ // Execute the command
+ fConnection.queueCommand(
+ fCommandFactory.createMIBreakInsert(context, isTemporary, isHardware, condition, ignoreCount,
+ location, threadId, !enabled, false),
+ new DataRequestMonitor<MIBreakInsertInfo>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+
+ // With MI, an invalid location won't generate an error
+ if (getData().getMIBreakpoints().length == 0) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED,
+ BREAKPOINT_INSERTION_FAILURE, null));
+ rm.done();
+ return;
+ }
+
+ // Create a breakpoint object and store it in the map
+ final MIBreakpointDMData newBreakpoint = createMIBreakpointDMData(
+ getData().getMIBreakpoints()[0]);
+ String reference = newBreakpoint.getNumber();
+ if (reference.isEmpty()) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED,
+ BREAKPOINT_INSERTION_FAILURE, null));
+ rm.done();
+ return;
+ }
+ contextBreakpoints.put(reference, newBreakpoint);
+
+ // Format the return value
+ MIBreakpointDMContext dmc = new MIBreakpointDMContext(GDBBreakpoints_7_0.this,
+ new IDMContext[] { context }, reference);
+ finalRm.setData(dmc);
+
+ // Flag the event
+ getSession().dispatchEvent(new BreakpointAddedEvent(dmc), getProperties());
+
+ rm.done();
+ }
+
+ @Override
+ protected void handleError() {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED,
+ BREAKPOINT_INSERTION_FAILURE, getStatus().getException()));
+ rm.done();
+ }
+ });
+ }
+ };
+
+ fRunControl.executeWithTargetAvailable(context, new Step[] { insertBreakpointStep }, finalRm);
}
-
+
/**
* Add a tracepoint
- *
+ *
* @param context
* @param breakpoint
* @param drm
*/
@Override
- protected void addTracepoint(final IBreakpointsTargetDMContext context, final Map<String, Object> attributes, final DataRequestMonitor<IBreakpointDMContext> drm)
- {
+ protected void addTracepoint(final IBreakpointsTargetDMContext context, final Map<String, Object> attributes,
+ final DataRequestMonitor<IBreakpointDMContext> drm) {
// Select the context breakpoints map
final Map<String, MIBreakpointDMData> contextBreakpoints = getBreakpointMap(context);
if (contextBreakpoints == null) {
- drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
- drm.done();
+ drm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
+ drm.done();
return;
}
// Extract the relevant parameters (providing default values to avoid potential NPEs)
final String location = formatLocation(attributes);
if (location.equals(NULL_STRING)) {
- drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
- drm.done();
+ drm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
+ drm.done();
return;
}
- final String condition = (String) getProperty(attributes, MIBreakpoints.CONDITION, NULL_STRING);
+ final String condition = (String) getProperty(attributes, MIBreakpoints.CONDITION, NULL_STRING);
- fConnection.queueCommand(
- fCommandFactory.createCLITrace(context, location, condition),
+ fConnection.queueCommand(fCommandFactory.createCLITrace(context, location, condition),
new DataRequestMonitor<CLITraceInfo>(getExecutor(), drm) {
@Override
protected void handleSuccess() {
final String tpReference = getData().getTraceReference();
if (tpReference == null) {
- drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, BREAKPOINT_INSERTION_FAILURE, null));
+ drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED,
+ BREAKPOINT_INSERTION_FAILURE, null));
drm.done();
return;
}
-
+
// The simplest way to convert from the CLITraceInfo to a MIBreakInsertInfo
// is to list the breakpoints and take the proper output
- fConnection.queueCommand(
- fCommandFactory.createMIBreakList(context),
+ fConnection.queueCommand(fCommandFactory.createMIBreakList(context),
new DataRequestMonitor<MIBreakListInfo>(getExecutor(), drm) {
@Override
protected void handleSuccess() {
@@ -268,26 +274,33 @@ public class GDBBreakpoints_7_0 extends MIBreakpoints
contextBreakpoints.put(reference, newBreakpoint);
// Format the return value
- MIBreakpointDMContext dmc = new MIBreakpointDMContext(GDBBreakpoints_7_0.this, new IDMContext[] { context }, reference);
+ MIBreakpointDMContext dmc = new MIBreakpointDMContext(
+ GDBBreakpoints_7_0.this, new IDMContext[] { context },
+ reference);
drm.setData(dmc);
// Flag the event
- getSession().dispatchEvent(new BreakpointAddedEvent(dmc), getProperties());
+ getSession().dispatchEvent(new BreakpointAddedEvent(dmc),
+ getProperties());
// By default the tracepoint is enabled at creation
// If it wasn't supposed to be, then disable it right away
// Also, tracepoints are created with no passcount.
// We have to set the passcount manually now.
// Same for commands.
- Map<String,Object> delta = new HashMap<String,Object>();
- delta.put(MIBreakpoints.IS_ENABLED, getProperty(attributes, MIBreakpoints.IS_ENABLED, true));
- delta.put(MIBreakpoints.PASS_COUNT, getProperty(attributes, MIBreakpoints.PASS_COUNT, 0));
- delta.put(MIBreakpoints.COMMANDS, getProperty(attributes, MIBreakpoints.COMMANDS, "")); //$NON-NLS-1$
+ Map<String, Object> delta = new HashMap<String, Object>();
+ delta.put(MIBreakpoints.IS_ENABLED,
+ getProperty(attributes, MIBreakpoints.IS_ENABLED, true));
+ delta.put(MIBreakpoints.PASS_COUNT,
+ getProperty(attributes, MIBreakpoints.PASS_COUNT, 0));
+ delta.put(MIBreakpoints.COMMANDS,
+ getProperty(attributes, MIBreakpoints.COMMANDS, "")); //$NON-NLS-1$
modifyBreakpoint(dmc, delta, drm, false);
return;
}
}
- drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, BREAKPOINT_INSERTION_FAILURE, null));
+ drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED,
+ BREAKPOINT_INSERTION_FAILURE, null));
drm.done();
}
});
@@ -302,47 +315,50 @@ public class GDBBreakpoints_7_0 extends MIBreakpoints
* @param generateUpdateEvent
*/
@Override
- protected void modifyBreakpoint(final IBreakpointDMContext dmc, final Map<String, Object> attributes, final RequestMonitor rm, final boolean generateUpdateEvent)
- {
+ protected void modifyBreakpoint(final IBreakpointDMContext dmc, final Map<String, Object> attributes,
+ final RequestMonitor rm, final boolean generateUpdateEvent) {
// Retrieve the breakpoint parameters
// At this point, we know their are OK so there is no need to re-validate
MIBreakpointDMContext breakpointCtx = (MIBreakpointDMContext) dmc;
- IBreakpointsTargetDMContext context = DMContexts.getAncestorOfType(breakpointCtx, IBreakpointsTargetDMContext.class);
+ IBreakpointsTargetDMContext context = DMContexts.getAncestorOfType(breakpointCtx,
+ IBreakpointsTargetDMContext.class);
final Map<String, MIBreakpointDMData> contextBreakpoints = getBreakpointMap(context);
final String reference = breakpointCtx.getReference();
MIBreakpointDMData breakpoint = contextBreakpoints.get(reference);
// Track the number of change requests
int numberOfChanges = 0;
- final CountingRequestMonitor countingRm = new CountingRequestMonitor(getExecutor(), rm) {
- @Override
- protected void handleCompleted() {
- GDBBreakpoints_7_0.super.modifyBreakpoint(dmc, attributes, rm, generateUpdateEvent);
- }
- };
-
- // Determine if the tracepoint pass count changed
+ final CountingRequestMonitor countingRm = new CountingRequestMonitor(getExecutor(), rm) {
+ @Override
+ protected void handleCompleted() {
+ GDBBreakpoints_7_0.super.modifyBreakpoint(dmc, attributes, rm, generateUpdateEvent);
+ }
+ };
+
+ // Determine if the tracepoint pass count changed
String passCountAttribute = MIBreakpoints.PASS_COUNT;
if (attributes.containsKey(passCountAttribute)) {
- Integer oldValue = breakpoint.getPassCount();
+ Integer oldValue = breakpoint.getPassCount();
Integer newValue = (Integer) attributes.get(passCountAttribute);
- if (newValue == null) newValue = 0;
- if (!oldValue.equals(newValue)) {
- changePassCount(context, reference, newValue, countingRm);
- numberOfChanges++;
- }
- attributes.remove(passCountAttribute);
+ if (newValue == null)
+ newValue = 0;
+ if (!oldValue.equals(newValue)) {
+ changePassCount(context, reference, newValue, countingRm);
+ numberOfChanges++;
+ }
+ attributes.remove(passCountAttribute);
}
- // Determine if tracepoint commands changed
- // Note that breakpoint commands (actions) are not handled by the backend
+ // Determine if tracepoint commands changed
+ // Note that breakpoint commands (actions) are not handled by the backend
// which is why we don't check for changes here
String commandsAttribute = MIBreakpoints.COMMANDS;
- if (attributes.containsKey(commandsAttribute) &&
- breakpoint.getBreakpointType().equals(MIBreakpoints.TRACEPOINT)) {
+ if (attributes.containsKey(commandsAttribute)
+ && breakpoint.getBreakpointType().equals(MIBreakpoints.TRACEPOINT)) {
String oldValue = breakpoint.getCommands();
String newValue = (String) attributes.get(commandsAttribute);
- if (newValue == null) newValue = NULL_STRING;
+ if (newValue == null)
+ newValue = NULL_STRING;
if (!oldValue.equals(newValue)) {
ITracepointAction[] actions = generateGdbCommands(newValue);
numberOfChanges++;
@@ -352,9 +368,9 @@ public class GDBBreakpoints_7_0 extends MIBreakpoints
}
// Set the number of completions required
- countingRm.setDoneCount(numberOfChanges);
+ countingRm.setDoneCount(numberOfChanges);
}
-
+
private ITracepointAction[] generateGdbCommands(String actionStr) {
String[] actionNames = actionStr.split(TracepointActionManager.TRACEPOINT_ACTION_DELIMITER);
ITracepointAction[] actions = new ITracepointAction[actionNames.length];
@@ -366,17 +382,17 @@ public class GDBBreakpoints_7_0 extends MIBreakpoints
return actions;
}
- private void changeActions(final IBreakpointsTargetDMContext context,
- final String reference, final String actionNames, final ITracepointAction[] actions, final RequestMonitor rm)
- {
+ private void changeActions(final IBreakpointsTargetDMContext context, final String reference,
+ final String actionNames, final ITracepointAction[] actions, final RequestMonitor rm) {
// Pick the context breakpoints map
final Map<String, MIBreakpointDMData> contextBreakpoints = getBreakpointMap(context);
if (contextBreakpoints == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
+ rm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
rm.done();
return;
}
-
+
ArrayList<String> actionStrings = new ArrayList<String>();
for (ITracepointAction action : actions) {
if (action != null) {
@@ -391,7 +407,8 @@ public class GDBBreakpoints_7_0 extends MIBreakpoints
protected void handleSuccess() {
MIBreakpointDMData breakpoint = contextBreakpoints.get(reference);
if (breakpoint == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT, null));
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED,
+ UNKNOWN_BREAKPOINT, null));
rm.done();
return;
}
@@ -406,66 +423,65 @@ public class GDBBreakpoints_7_0 extends MIBreakpoints
* IgnoreCount is not supported by tracepoints
*/
@Override
- protected void changeIgnoreCount(IBreakpointsTargetDMContext context,
- final String reference, final int ignoreCount, final RequestMonitor rm)
- {
+ protected void changeIgnoreCount(IBreakpointsTargetDMContext context, final String reference, final int ignoreCount,
+ final RequestMonitor rm) {
// Pick the context breakpoints map
final Map<String, MIBreakpointDMData> contextBreakpoints = getBreakpointMap(context);
if (contextBreakpoints == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
- rm.done();
+ rm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
+ rm.done();
return;
}
-
+
final MIBreakpointDMData breakpoint = contextBreakpoints.get(reference);
if (breakpoint == null || breakpoint.getBreakpointType().equals(MIBreakpoints.TRACEPOINT)) {
// Ignorecount is not supported for tracepoints
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, INVALID_BREAKPOINT_TYPE, null));
- rm.done();
- return;
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, INVALID_BREAKPOINT_TYPE, null));
+ rm.done();
+ return;
}
super.changeIgnoreCount(context, reference, ignoreCount, rm);
}
-
+
/**
* Update the tracepoint passCount
- *
+ *
* @param context
* @param reference
* @param ignoreCount
* @param rm
- *
+ *
* @since 5.0
*/
- protected void changePassCount(IBreakpointsTargetDMContext context,
- final String reference, final int ignoreCount, final RequestMonitor rm)
- {
+ protected void changePassCount(IBreakpointsTargetDMContext context, final String reference, final int ignoreCount,
+ final RequestMonitor rm) {
// Pick the context breakpoints map
final Map<String, MIBreakpointDMData> contextBreakpoints = getBreakpointMap(context);
if (contextBreakpoints == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
- rm.done();
+ rm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
+ rm.done();
return;
}
-
+
final MIBreakpointDMData breakpoint = contextBreakpoints.get(reference);
if (breakpoint == null || breakpoint.getBreakpointType().equals(MIBreakpoints.TRACEPOINT) == false) {
// Passcount is just for tracepoints
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, INVALID_BREAKPOINT_TYPE, null));
- rm.done();
- return;
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, INVALID_BREAKPOINT_TYPE, null));
+ rm.done();
+ return;
}
// Queue the command
- fConnection.queueCommand(
- fCommandFactory.createCLIPasscount(context, reference, ignoreCount),
- new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- breakpoint.setPassCount(ignoreCount);
- rm.done();
- }
- });
+ fConnection.queueCommand(fCommandFactory.createCLIPasscount(context, reference, ignoreCount),
+ new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ breakpoint.setPassCount(ignoreCount);
+ rm.done();
+ }
+ });
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_2.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_2.java
index 9bd8f3ce809..5e0491fc403 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_2.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_2.java
@@ -9,7 +9,7 @@
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
- * Ericsson - Initial API and implementation
+ * Ericsson - Initial API and implementation
* Marc Khouzam (Ericsson) - Support for fast tracepoints (Bug 346320)
* Marc Khouzam (Ericsson) - Fetch groupIds when getting breakpoints (Bug 360735)
*******************************************************************************/
@@ -49,12 +49,13 @@ import org.eclipse.debug.core.ILaunch;
*
* @since 4.1
*/
-public class GDBBreakpoints_7_2 extends GDBBreakpoints_7_0
-{
+public class GDBBreakpoints_7_2 extends GDBBreakpoints_7_0 {
private IMICommandControl fConnection;
-
- private enum TracepointMode { FAST_THEN_NORMAL, FAST_ONLY, NORMAL_ONLY };
-
+
+ private enum TracepointMode {
+ FAST_THEN_NORMAL, FAST_ONLY, NORMAL_ONLY
+ };
+
private TracepointMode fTracepointMode = TracepointMode.NORMAL_ONLY;
public GDBBreakpoints_7_2(DsfSession session) {
@@ -75,17 +76,14 @@ public class GDBBreakpoints_7_2 extends GDBBreakpoints_7_0
}
private void doInitialize(final RequestMonitor rm) {
- // Get the services references
+ // Get the services references
fConnection = getServicesTracker().getService(IMICommandControl.class);
setTracepointMode();
-
+
// Register this service
- register(new String[] { IBreakpoints.class.getName(),
- IBreakpointsExtension.class.getName(),
- MIBreakpoints.class.getName(),
- GDBBreakpoints_7_0.class.getName(),
- GDBBreakpoints_7_2.class.getName() },
+ register(new String[] { IBreakpoints.class.getName(), IBreakpointsExtension.class.getName(),
+ MIBreakpoints.class.getName(), GDBBreakpoints_7_0.class.getName(), GDBBreakpoints_7_2.class.getName() },
new Hashtable<String, String>());
rm.done();
@@ -93,29 +91,30 @@ public class GDBBreakpoints_7_2 extends GDBBreakpoints_7_0
@Override
public void shutdown(RequestMonitor requestMonitor) {
- unregister();
+ unregister();
super.shutdown(requestMonitor);
}
-
- /**
+
+ /**
* {@inheritDoc}
- *
+ *
* Starting with GDB 7.2, also provides information about which process each breakpoint applies to.
*/
@Override
- public void getBreakpoints(final IBreakpointsTargetDMContext context, final DataRequestMonitor<IBreakpointDMContext[]> drm)
- {
+ public void getBreakpoints(final IBreakpointsTargetDMContext context,
+ final DataRequestMonitor<IBreakpointDMContext[]> drm) {
if (bpThreadGroupInfoAvailable()) {
// With GDB 7.6, we obtain the thread-groups to which a breakpoint applies
// directly in the -break-list command, so we don't need to do any special processing.
super.getBreakpoints(context, drm);
return;
}
-
+
// Validate the context
if (context == null) {
- drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_EXECUTION_CONTEXT, null));
- drm.done();
+ drm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_EXECUTION_CONTEXT, null));
+ drm.done();
return;
}
@@ -124,58 +123,61 @@ public class GDBBreakpoints_7_2 extends GDBBreakpoints_7_0
// In that case, return an empty list.
final Map<String, MIBreakpointDMData> breakpointContext = getBreakpointMap(context);
if (breakpointContext == null) {
- drm.setData(new IBreakpointDMContext[0]);
- drm.done();
+ drm.setData(new IBreakpointDMContext[0]);
+ drm.done();
return;
}
// Execute the command
fConnection.queueCommand(fConnection.getCommandFactory().createMIBreakList(context),
- new DataRequestMonitor<MIBreakListInfo>(getExecutor(), drm) {
- @Override
- protected void handleSuccess() {
- final MIBreakpoint[] breakpoints = getData().getMIBreakpoints();
-
- // Also fetch the information about which breakpoint belongs to which
- // process. We currently can only obtain this information from the CLI
- // command. This information is needed for breakpoint filtering.
- // Bug 360735
- fConnection.queueCommand(fConnection.getCommandFactory().createCLIInfoBreak(context),
- new ImmediateDataRequestMonitor<CLIInfoBreakInfo>(drm) {
- @Override
- protected void handleSuccess() {
- Map<String, String[]> groupIdMap = getData().getBreakpointToGroupMap();
-
- // Refresh the breakpoints map and format the result
- breakpointContext.clear();
- IBreakpointDMContext[] result = new IBreakpointDMContext[breakpoints.length];
- for (int i = 0; i < breakpoints.length; i++) {
- MIBreakpointDMData breakpointData = createMIBreakpointDMData(breakpoints[i]);
-
- // Now fill in the thread-group information into the breakpoint data
- // It is ok to get null. For example, pending breakpoints are not
- // associated to a thread-group; also, when debugging a single process,
- // the thread-group list is empty.
- String reference = breakpointData.getReference();
- String[] groupIds = groupIdMap.get(reference);
- breakpointData.setGroupIds(groupIds);
-
- result[i] = new MIBreakpointDMContext(GDBBreakpoints_7_2.this, new IDMContext[] { context }, reference);
- breakpointContext.put(reference, breakpointData);
- }
- drm.setData(result);
- drm.done();
- }
- });
- }
- });
+ new DataRequestMonitor<MIBreakListInfo>(getExecutor(), drm) {
+ @Override
+ protected void handleSuccess() {
+ final MIBreakpoint[] breakpoints = getData().getMIBreakpoints();
+
+ // Also fetch the information about which breakpoint belongs to which
+ // process. We currently can only obtain this information from the CLI
+ // command. This information is needed for breakpoint filtering.
+ // Bug 360735
+ fConnection.queueCommand(fConnection.getCommandFactory().createCLIInfoBreak(context),
+ new ImmediateDataRequestMonitor<CLIInfoBreakInfo>(drm) {
+ @Override
+ protected void handleSuccess() {
+ Map<String, String[]> groupIdMap = getData().getBreakpointToGroupMap();
+
+ // Refresh the breakpoints map and format the result
+ breakpointContext.clear();
+ IBreakpointDMContext[] result = new IBreakpointDMContext[breakpoints.length];
+ for (int i = 0; i < breakpoints.length; i++) {
+ MIBreakpointDMData breakpointData = createMIBreakpointDMData(
+ breakpoints[i]);
+
+ // Now fill in the thread-group information into the breakpoint data
+ // It is ok to get null. For example, pending breakpoints are not
+ // associated to a thread-group; also, when debugging a single process,
+ // the thread-group list is empty.
+ String reference = breakpointData.getReference();
+ String[] groupIds = groupIdMap.get(reference);
+ breakpointData.setGroupIds(groupIds);
+
+ result[i] = new MIBreakpointDMContext(GDBBreakpoints_7_2.this,
+ new IDMContext[] { context }, reference);
+ breakpointContext.put(reference, breakpointData);
+ }
+ drm.setData(result);
+ drm.done();
+ }
+ });
+ }
+ });
}
-
+
private void setTracepointMode() {
- ILaunch launch = (ILaunch)getSession().getModelAdapter(ILaunch.class);
+ ILaunch launch = (ILaunch) getSession().getModelAdapter(ILaunch.class);
String tpMode = IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_MODE_DEFAULT;
try {
- tpMode = launch.getLaunchConfiguration().getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_TRACEPOINT_MODE,
+ tpMode = launch.getLaunchConfiguration().getAttribute(
+ IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_TRACEPOINT_MODE,
IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_MODE_DEFAULT);
} catch (CoreException e) {
}
@@ -188,15 +190,18 @@ public class GDBBreakpoints_7_2 extends GDBBreakpoints_7_0
fTracepointMode = TracepointMode.FAST_THEN_NORMAL;
} else {
assert false : "Invalid tracepoint mode: " + tpMode; //$NON-NLS-1$
- fTracepointMode = TracepointMode.NORMAL_ONLY;
+ fTracepointMode = TracepointMode.NORMAL_ONLY;
}
}
- protected void sendTracepointCommand(final IBreakpointsTargetDMContext context, final Map<String, Object> attributes, boolean isFastTracepoint, final DataRequestMonitor<IBreakpointDMContext> drm) {
+ protected void sendTracepointCommand(final IBreakpointsTargetDMContext context,
+ final Map<String, Object> attributes, boolean isFastTracepoint,
+ final DataRequestMonitor<IBreakpointDMContext> drm) {
// Select the context breakpoints map
final Map<String, MIBreakpointDMData> contextBreakpoints = getBreakpointMap(context);
if (contextBreakpoints == null) {
- drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
+ drm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
drm.done();
return;
}
@@ -204,48 +209,54 @@ public class GDBBreakpoints_7_2 extends GDBBreakpoints_7_0
// Extract the relevant parameters (providing default values to avoid potential NPEs)
final String location = formatLocation(attributes);
if (location.equals(NULL_STRING)) {
- drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
+ drm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
drm.done();
return;
}
- final Boolean enabled = (Boolean) getProperty(attributes, MIBreakpoints.IS_ENABLED, true);
- final String condition = (String) getProperty(attributes, MIBreakpoints.CONDITION, NULL_STRING);
+ final Boolean enabled = (Boolean) getProperty(attributes, MIBreakpoints.IS_ENABLED, true);
+ final String condition = (String) getProperty(attributes, MIBreakpoints.CONDITION, NULL_STRING);
fConnection.queueCommand(
- fConnection.getCommandFactory().createMIBreakInsert(context, false, isFastTracepoint, condition, 0, location, "0", !enabled, true), //$NON-NLS-1$
+ fConnection.getCommandFactory().createMIBreakInsert(context, false, isFastTracepoint, condition, 0,
+ location, "0", !enabled, true), //$NON-NLS-1$
new DataRequestMonitor<MIBreakInsertInfo>(getExecutor(), drm) {
@Override
protected void handleSuccess() {
// With MI, an invalid location won't generate an error
if (getData().getMIBreakpoints().length == 0) {
- drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, BREAKPOINT_INSERTION_FAILURE, null));
+ drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED,
+ BREAKPOINT_INSERTION_FAILURE, null));
drm.done();
return;
}
// Create a breakpoint object and store it in the map
- final MIBreakpointDMData newBreakpoint = createMIBreakpointDMData(getData().getMIBreakpoints()[0]);
+ final MIBreakpointDMData newBreakpoint = createMIBreakpointDMData(
+ getData().getMIBreakpoints()[0]);
String reference = newBreakpoint.getNumber();
if (reference.isEmpty()) {
- drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, BREAKPOINT_INSERTION_FAILURE, null));
+ drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED,
+ BREAKPOINT_INSERTION_FAILURE, null));
drm.done();
return;
}
contextBreakpoints.put(reference, newBreakpoint);
// Format the return value
- MIBreakpointDMContext dmc = new MIBreakpointDMContext(GDBBreakpoints_7_2.this, new IDMContext[] { context }, reference);
+ MIBreakpointDMContext dmc = new MIBreakpointDMContext(GDBBreakpoints_7_2.this,
+ new IDMContext[] { context }, reference);
drm.setData(dmc);
// Flag the event
getSession().dispatchEvent(new BreakpointAddedEvent(dmc), getProperties());
- // Tracepoints are created with no passcount (passcount are not
+ // Tracepoints are created with no passcount (passcount are not
// the same thing as ignore-count, which is not supported by
// tracepoints). We have to set the passcount manually now.
// Same for commands.
- Map<String,Object> delta = new HashMap<String,Object>();
+ Map<String, Object> delta = new HashMap<String, Object>();
delta.put(MIBreakpoints.PASS_COUNT, getProperty(attributes, MIBreakpoints.PASS_COUNT, 0));
delta.put(MIBreakpoints.COMMANDS, getProperty(attributes, MIBreakpoints.COMMANDS, "")); //$NON-NLS-1$
modifyBreakpoint(dmc, delta, drm, false);
@@ -253,11 +264,13 @@ public class GDBBreakpoints_7_2 extends GDBBreakpoints_7_0
@Override
protected void handleError() {
- drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, BREAKPOINT_INSERTION_FAILURE, getStatus().getException()));
+ drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED,
+ BREAKPOINT_INSERTION_FAILURE, getStatus().getException()));
drm.done();
}
});
}
+
/**
* Add a tracepoint using MI. We have three settings:
* 1- set only a fast tracepoint but if it fails, set a normal tracepoint
@@ -265,39 +278,42 @@ public class GDBBreakpoints_7_2 extends GDBBreakpoints_7_0
* 3- only set a normal tracepoint even if a fast tracepoint could have been used
*/
@Override
- protected void addTracepoint(final IBreakpointsTargetDMContext context, final Map<String, Object> attributes, final DataRequestMonitor<IBreakpointDMContext> drm) {
+ protected void addTracepoint(final IBreakpointsTargetDMContext context, final Map<String, Object> attributes,
+ final DataRequestMonitor<IBreakpointDMContext> drm) {
// Unless we should only set normal tracepoints, we try to set a fast tracepoint.
boolean isFastTracepoint = fTracepointMode != TracepointMode.NORMAL_ONLY;
- sendTracepointCommand(context, attributes, isFastTracepoint, new ImmediateDataRequestMonitor<IBreakpointDMContext>(drm) {
- @Override
- protected void handleSuccess() {
- // Tracepoint was set successfully.
- drm.setData(getData());
- drm.done();
- }
- @Override
- protected void handleError() {
- // Tracepoint failed to be set.
- if (fTracepointMode == TracepointMode.FAST_THEN_NORMAL) {
- // In this case, we failed to set a fast tracepoint, but we should try to set a normal one.
- sendTracepointCommand(context, attributes, false, drm);
- } else {
- // We either failed to set a fast tracepoint and we should not try to set a normal one,
- // or we failed to set a normal one. Either way, we are done.
- drm.setStatus(getStatus());
- drm.done();
- }
- }
- });
+ sendTracepointCommand(context, attributes, isFastTracepoint,
+ new ImmediateDataRequestMonitor<IBreakpointDMContext>(drm) {
+ @Override
+ protected void handleSuccess() {
+ // Tracepoint was set successfully.
+ drm.setData(getData());
+ drm.done();
+ }
+
+ @Override
+ protected void handleError() {
+ // Tracepoint failed to be set.
+ if (fTracepointMode == TracepointMode.FAST_THEN_NORMAL) {
+ // In this case, we failed to set a fast tracepoint, but we should try to set a normal one.
+ sendTracepointCommand(context, attributes, false, drm);
+ } else {
+ // We either failed to set a fast tracepoint and we should not try to set a normal one,
+ // or we failed to set a normal one. Either way, we are done.
+ drm.setStatus(getStatus());
+ drm.done();
+ }
+ }
+ });
}
-
+
/**
* Does the MI command -break-list provide information
* about which thread-group a breakpoint applies to?
* The use of this method allows us to avoid duplicating code.
* See Bug 402217
- *
+ *
* @return true if the information is available (GDB >= 7.6),
* false otherwise.
* @since 4.2
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_4.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_4.java
index dde1cdc9251..522a73c33de 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_4.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_4.java
@@ -45,18 +45,18 @@ import org.eclipse.core.runtime.Status;
/**
* Breakpoints service for GDB 7.4.
- * Using breakpoint notifications introduced in 7.4 supports synchronization between the breakpoints
+ * Using breakpoint notifications introduced in 7.4 supports synchronization between the breakpoints
* set from the GDB console and the Breakpoints view as well as the tracepoints reported form trace files.
- *
+ *
* @since 4.2
*/
public class GDBBreakpoints_7_4 extends GDBBreakpoints_7_2 implements IEventListener {
- // Breakpoint notifications
- private static final String BREAKPOINT_PREFIX = "breakpoint-"; //$NON-NLS-1$
- private static final String BREAKPOINT_CREATED = BREAKPOINT_PREFIX + "created"; //$NON-NLS-1$
- private static final String BREAKPOINT_MODIFIED = BREAKPOINT_PREFIX + "modified"; //$NON-NLS-1$
- private static final String BREAKPOINT_DELETED = BREAKPOINT_PREFIX + "deleted"; //$NON-NLS-1$
+ // Breakpoint notifications
+ private static final String BREAKPOINT_PREFIX = "breakpoint-"; //$NON-NLS-1$
+ private static final String BREAKPOINT_CREATED = BREAKPOINT_PREFIX + "created"; //$NON-NLS-1$
+ private static final String BREAKPOINT_MODIFIED = BREAKPOINT_PREFIX + "modified"; //$NON-NLS-1$
+ private static final String BREAKPOINT_DELETED = BREAKPOINT_PREFIX + "deleted"; //$NON-NLS-1$
private IMICommandControl fConnection;
@@ -84,12 +84,10 @@ public class GDBBreakpoints_7_4 extends GDBBreakpoints_7_2 implements IEventList
fConnection.addEventListener(this);
// Register this service
- register(new String[] { IBreakpoints.class.getName(),
- IBreakpointsExtension.class.getName(),
- MIBreakpoints.class.getName(),
- GDBBreakpoints_7_0.class.getName(),
- GDBBreakpoints_7_2.class.getName(),
- GDBBreakpoints_7_4.class.getName() },
+ register(
+ new String[] { IBreakpoints.class.getName(), IBreakpointsExtension.class.getName(),
+ MIBreakpoints.class.getName(), GDBBreakpoints_7_0.class.getName(),
+ GDBBreakpoints_7_2.class.getName(), GDBBreakpoints_7_4.class.getName() },
new Hashtable<String, String>());
rm.done();
@@ -101,7 +99,7 @@ public class GDBBreakpoints_7_4 extends GDBBreakpoints_7_2 implements IEventList
if (control != null) {
control.removeEventListener(this);
}
- unregister();
+ unregister();
super.shutdown(requestMonitor);
}
@@ -109,23 +107,21 @@ public class GDBBreakpoints_7_4 extends GDBBreakpoints_7_2 implements IEventList
public void eventReceived(Object output) {
if (output instanceof MIOutput) {
MIBreakpointsSynchronizer bs = getServicesTracker().getService(MIBreakpointsSynchronizer.class);
- if (bs != null) {
- MIOOBRecord[] records = ((MIOutput)output).getMIOOBRecords();
- for(MIOOBRecord r : records) {
+ if (bs != null) {
+ MIOOBRecord[] records = ((MIOutput) output).getMIOOBRecords();
+ for (MIOOBRecord r : records) {
if (r instanceof MINotifyAsyncOutput) {
- MINotifyAsyncOutput notifyOutput = (MINotifyAsyncOutput)r;
+ MINotifyAsyncOutput notifyOutput = (MINotifyAsyncOutput) r;
String asyncClass = notifyOutput.getAsyncClass();
if (BREAKPOINT_CREATED.equals(asyncClass)) {
MIBreakpoint bpt = getMIBreakpointFromOutput(notifyOutput);
if (bpt != null)
bs.targetBreakpointCreated(bpt);
- }
- else if (BREAKPOINT_DELETED.equals(asyncClass)) {
+ } else if (BREAKPOINT_DELETED.equals(asyncClass)) {
String id = getMIBreakpointIdFromOutput(notifyOutput);
if (!id.isEmpty())
bs.targetBreakpointDeleted(id);
- }
- else if (BREAKPOINT_MODIFIED.equals(asyncClass)) {
+ } else if (BREAKPOINT_MODIFIED.equals(asyncClass)) {
MIBreakpoint bpt = getMIBreakpointFromOutput(notifyOutput);
if (bpt != null)
bs.targetBreakpointModified(bpt);
@@ -139,16 +135,16 @@ public class GDBBreakpoints_7_4 extends GDBBreakpoints_7_2 implements IEventList
private IMICommandControl getCommandControl() {
return fConnection;
}
-
+
private MIBreakpoint getMIBreakpointFromOutput(MINotifyAsyncOutput notifyOutput) {
MIBreakpoint bpt = null;
MIResult[] results = notifyOutput.getMIResults();
- for(int i = 0; i < results.length; i++) {
+ for (int i = 0; i < results.length; i++) {
String var = results[i].getVariable();
MIValue val = results[i].getMIValue();
if (var.equals("bkpt")) { //$NON-NLS-1$
if (val instanceof MITuple) {
- bpt = createMIBreakpoint((MITuple)val);
+ bpt = createMIBreakpoint((MITuple) val);
}
}
}
@@ -157,14 +153,13 @@ public class GDBBreakpoints_7_4 extends GDBBreakpoints_7_2 implements IEventList
private String getMIBreakpointIdFromOutput(MINotifyAsyncOutput notifyOutput) {
MIResult[] results = notifyOutput.getMIResults();
- for(int i = 0; i < results.length; i++) {
+ for (int i = 0; i < results.length; i++) {
String var = results[i].getVariable();
MIValue val = results[i].getMIValue();
if (var.equals("id") && val instanceof MIConst) { //$NON-NLS-1$
- try {
- return ((MIConst)val).getCString().trim();
- }
- catch(NumberFormatException e) {
+ try {
+ return ((MIConst) val).getCString().trim();
+ } catch (NumberFormatException e) {
GdbPlugin.log(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Invalid breakpoint id")); //$NON-NLS-1$
}
}
@@ -173,121 +168,101 @@ public class GDBBreakpoints_7_4 extends GDBBreakpoints_7_2 implements IEventList
}
@Override
- protected void addBreakpoint(
- final IBreakpointsTargetDMContext context,
- final Map<String, Object> attributes,
+ protected void addBreakpoint(final IBreakpointsTargetDMContext context, final Map<String, Object> attributes,
final DataRequestMonitor<IBreakpointDMContext> finalRm) {
final MIBreakpointsSynchronizer bs = getServicesTracker().getService(MIBreakpointsSynchronizer.class);
if (bs != null) {
- // Skip the breakpoints set from the console or from outside of Eclipse
+ // Skip the breakpoints set from the console or from outside of Eclipse
// because they are already installed on the target.
- bs.getTargetBreakpoint(
- context,
- attributes,
- new DataRequestMonitor<MIBreakpoint>(getExecutor(), finalRm) {
- @Override
- @ConfinedToDsfExecutor( "fExecutor" )
- protected void handleSuccess() {
- MIBreakpoint miBpt = getData();
- if (miBpt != null) {
- bs.removeCreatedTargetBreakpoint(context, miBpt);
- MIBreakpointDMData newBreakpoint = createMIBreakpointDMData(miBpt);
- getBreakpointMap(context).put(newBreakpoint.getNumber(), newBreakpoint);
- IBreakpointDMContext dmc =
- new MIBreakpointDMContext(GDBBreakpoints_7_4.this, new IDMContext[] { context }, newBreakpoint.getNumber());
- finalRm.setData(dmc);
- getSession().dispatchEvent(new BreakpointAddedEvent(dmc), getProperties());
- finalRm.done();
- }
- else {
- GDBBreakpoints_7_4.super.addBreakpoint(context, attributes, finalRm);
- }
- }
- });
- }
- else {
+ bs.getTargetBreakpoint(context, attributes, new DataRequestMonitor<MIBreakpoint>(getExecutor(), finalRm) {
+ @Override
+ @ConfinedToDsfExecutor("fExecutor")
+ protected void handleSuccess() {
+ MIBreakpoint miBpt = getData();
+ if (miBpt != null) {
+ bs.removeCreatedTargetBreakpoint(context, miBpt);
+ MIBreakpointDMData newBreakpoint = createMIBreakpointDMData(miBpt);
+ getBreakpointMap(context).put(newBreakpoint.getNumber(), newBreakpoint);
+ IBreakpointDMContext dmc = new MIBreakpointDMContext(GDBBreakpoints_7_4.this,
+ new IDMContext[] { context }, newBreakpoint.getNumber());
+ finalRm.setData(dmc);
+ getSession().dispatchEvent(new BreakpointAddedEvent(dmc), getProperties());
+ finalRm.done();
+ } else {
+ GDBBreakpoints_7_4.super.addBreakpoint(context, attributes, finalRm);
+ }
+ }
+ });
+ } else {
super.addBreakpoint(context, attributes, finalRm);
}
}
@Override
- protected void addTracepoint(
- final IBreakpointsTargetDMContext context,
- final Map<String, Object> attributes,
+ protected void addTracepoint(final IBreakpointsTargetDMContext context, final Map<String, Object> attributes,
final DataRequestMonitor<IBreakpointDMContext> drm) {
final MIBreakpointsSynchronizer bs = getServicesTracker().getService(MIBreakpointsSynchronizer.class);
if (bs != null) {
- // Skip the breakpoints set from the console or from outside of Eclipse
+ // Skip the breakpoints set from the console or from outside of Eclipse
// because they are already installed on the target.
- bs.getTargetBreakpoint(
- context,
- attributes,
- new DataRequestMonitor<MIBreakpoint>(getExecutor(), drm) {
- @Override
- @ConfinedToDsfExecutor( "fExecutor" )
- protected void handleSuccess() {
- MIBreakpoint miBpt = getData();
- if (miBpt != null) {
- bs.removeCreatedTargetBreakpoint(context, miBpt);
- MIBreakpointDMData newBreakpoint = createMIBreakpointDMData(miBpt);
- getBreakpointMap(context).put(newBreakpoint.getNumber(), newBreakpoint);
- IBreakpointDMContext dmc =
- new MIBreakpointDMContext(GDBBreakpoints_7_4.this, new IDMContext[] { context }, newBreakpoint.getNumber());
- drm.setData(dmc);
- getSession().dispatchEvent(new BreakpointAddedEvent(dmc), getProperties());
- drm.done();
- }
- else {
- GDBBreakpoints_7_4.super.addTracepoint(context, attributes, drm);
- }
- }
- });
- }
- else {
+ bs.getTargetBreakpoint(context, attributes, new DataRequestMonitor<MIBreakpoint>(getExecutor(), drm) {
+ @Override
+ @ConfinedToDsfExecutor("fExecutor")
+ protected void handleSuccess() {
+ MIBreakpoint miBpt = getData();
+ if (miBpt != null) {
+ bs.removeCreatedTargetBreakpoint(context, miBpt);
+ MIBreakpointDMData newBreakpoint = createMIBreakpointDMData(miBpt);
+ getBreakpointMap(context).put(newBreakpoint.getNumber(), newBreakpoint);
+ IBreakpointDMContext dmc = new MIBreakpointDMContext(GDBBreakpoints_7_4.this,
+ new IDMContext[] { context }, newBreakpoint.getNumber());
+ drm.setData(dmc);
+ getSession().dispatchEvent(new BreakpointAddedEvent(dmc), getProperties());
+ drm.done();
+ } else {
+ GDBBreakpoints_7_4.super.addTracepoint(context, attributes, drm);
+ }
+ }
+ });
+ } else {
super.addTracepoint(context, attributes, drm);
}
}
@Override
- protected void addWatchpoint(
- final IBreakpointsTargetDMContext context,
- final Map<String, Object> attributes,
+ protected void addWatchpoint(final IBreakpointsTargetDMContext context, final Map<String, Object> attributes,
final DataRequestMonitor<IBreakpointDMContext> drm) {
final MIBreakpointsSynchronizer bs = getServicesTracker().getService(MIBreakpointsSynchronizer.class);
if (bs != null) {
- // Skip the breakpoints set from the console or from outside of Eclipse
+ // Skip the breakpoints set from the console or from outside of Eclipse
// because they are already installed on the target.
- bs.getTargetBreakpoint(
- context,
- attributes,
- new DataRequestMonitor<MIBreakpoint>(getExecutor(), drm) {
- @Override
- @ConfinedToDsfExecutor( "fExecutor" )
- protected void handleSuccess() {
- MIBreakpoint miBpt = getData();
- if (miBpt != null) {
- bs.removeCreatedTargetBreakpoint(context, miBpt);
- MIBreakpointDMData newBreakpoint = createMIBreakpointDMData(miBpt);
- getBreakpointMap(context).put(newBreakpoint.getNumber(), newBreakpoint);
- IBreakpointDMContext dmc =
- new MIBreakpointDMContext(GDBBreakpoints_7_4.this, new IDMContext[] { context }, newBreakpoint.getNumber());
- drm.setData(dmc);
- getSession().dispatchEvent(new BreakpointAddedEvent(dmc), getProperties());
- drm.done();
- }
- else {
- GDBBreakpoints_7_4.super.addWatchpoint(context, attributes, drm);
- }
- }
- });
- }
- else {
+ bs.getTargetBreakpoint(context, attributes, new DataRequestMonitor<MIBreakpoint>(getExecutor(), drm) {
+ @Override
+ @ConfinedToDsfExecutor("fExecutor")
+ protected void handleSuccess() {
+ MIBreakpoint miBpt = getData();
+ if (miBpt != null) {
+ bs.removeCreatedTargetBreakpoint(context, miBpt);
+ MIBreakpointDMData newBreakpoint = createMIBreakpointDMData(miBpt);
+ getBreakpointMap(context).put(newBreakpoint.getNumber(), newBreakpoint);
+ IBreakpointDMContext dmc = new MIBreakpointDMContext(GDBBreakpoints_7_4.this,
+ new IDMContext[] { context }, newBreakpoint.getNumber());
+ drm.setData(dmc);
+ getSession().dispatchEvent(new BreakpointAddedEvent(dmc), getProperties());
+ drm.done();
+ } else {
+ GDBBreakpoints_7_4.super.addWatchpoint(context, attributes, drm);
+ }
+ }
+ });
+ } else {
super.addWatchpoint(context, attributes, drm);
}
}
@Override
- protected void deleteBreakpointFromTarget(IBreakpointsTargetDMContext context, String reference, RequestMonitor finalRm) {
+ protected void deleteBreakpointFromTarget(IBreakpointsTargetDMContext context, String reference,
+ RequestMonitor finalRm) {
MIBreakpointsSynchronizer bs = getServicesTracker().getService(MIBreakpointsSynchronizer.class);
if (bs != null) {
// Do nothing if the breakpoint is deleted from the console.
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_6.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_6.java
index 9e46bbe3313..436a5590d85 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_6.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_6.java
@@ -9,7 +9,7 @@
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
- * Marc Khouzam (Ericsson) - Initial API and implementation
+ * Marc Khouzam (Ericsson) - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.service;
@@ -28,8 +28,7 @@ import org.eclipse.cdt.dsf.service.DsfSession;
*
* @since 4.2
*/
-public class GDBBreakpoints_7_6 extends GDBBreakpoints_7_4
-{
+public class GDBBreakpoints_7_6 extends GDBBreakpoints_7_4 {
public GDBBreakpoints_7_6(DsfSession session) {
super(session);
}
@@ -46,13 +45,9 @@ public class GDBBreakpoints_7_6 extends GDBBreakpoints_7_4
private void doInitialize(final RequestMonitor rm) {
// Register this service
- register(new String[] { IBreakpoints.class.getName(),
- IBreakpointsExtension.class.getName(),
- MIBreakpoints.class.getName(),
- GDBBreakpoints_7_0.class.getName(),
- GDBBreakpoints_7_2.class.getName(),
- GDBBreakpoints_7_4.class.getName(),
- GDBBreakpoints_7_6.class.getName() },
+ register(new String[] { IBreakpoints.class.getName(), IBreakpointsExtension.class.getName(),
+ MIBreakpoints.class.getName(), GDBBreakpoints_7_0.class.getName(), GDBBreakpoints_7_2.class.getName(),
+ GDBBreakpoints_7_4.class.getName(), GDBBreakpoints_7_6.class.getName() },
new Hashtable<String, String>());
rm.done();
@@ -60,10 +55,10 @@ public class GDBBreakpoints_7_6 extends GDBBreakpoints_7_4
@Override
public void shutdown(RequestMonitor requestMonitor) {
- unregister();
+ unregister();
super.shutdown(requestMonitor);
}
-
+
@Override
protected boolean bpThreadGroupInfoAvailable() {
return true;
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_7.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_7.java
index 0d7039084f5..02761b5b580 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_7.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_7.java
@@ -41,11 +41,11 @@ import org.eclipse.core.runtime.Status;
/**
* Breakpoints service for GDB 7.7.
* This version supports dynamic printf
- *
+ *
* @since 4.4
*/
public class GDBBreakpoints_7_7 extends GDBBreakpoints_7_6 {
-
+
private IMICommandControl fConnection;
private IMIRunControl fRunControl;
private CommandFactory fCommandFactory;
@@ -71,18 +71,15 @@ public class GDBBreakpoints_7_7 extends GDBBreakpoints_7_6 {
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Service is not available")); //$NON-NLS-1$
return;
}
-
+
fCommandFactory = fConnection.getCommandFactory();
-
+
// Register this service
- register(new String[] { IBreakpoints.class.getName(),
- IBreakpointsExtension.class.getName(),
- MIBreakpoints.class.getName(),
- GDBBreakpoints_7_0.class.getName(),
- GDBBreakpoints_7_2.class.getName(),
- GDBBreakpoints_7_4.class.getName(),
- GDBBreakpoints_7_6.class.getName(),
- GDBBreakpoints_7_7.class.getName() },
+ register(
+ new String[] { IBreakpoints.class.getName(), IBreakpointsExtension.class.getName(),
+ MIBreakpoints.class.getName(), GDBBreakpoints_7_0.class.getName(),
+ GDBBreakpoints_7_2.class.getName(), GDBBreakpoints_7_4.class.getName(),
+ GDBBreakpoints_7_6.class.getName(), GDBBreakpoints_7_7.class.getName() },
new Hashtable<String, String>());
rm.done();
@@ -90,44 +87,37 @@ public class GDBBreakpoints_7_7 extends GDBBreakpoints_7_6 {
@Override
public void shutdown(RequestMonitor requestMonitor) {
- unregister();
+ unregister();
super.shutdown(requestMonitor);
}
@Override
- protected void addDynamicPrintf(
- final IBreakpointsTargetDMContext context,
- final Map<String, Object> attributes,
+ protected void addDynamicPrintf(final IBreakpointsTargetDMContext context, final Map<String, Object> attributes,
final DataRequestMonitor<IBreakpointDMContext> drm) {
final MIBreakpointsSynchronizer bs = getServicesTracker().getService(MIBreakpointsSynchronizer.class);
if (bs != null) {
- // Skip the dprintf set from the console or from outside of Eclipse
+ // Skip the dprintf set from the console or from outside of Eclipse
// because they are already installed on the target.
- bs.getTargetBreakpoint(
- context,
- attributes,
- new DataRequestMonitor<MIBreakpoint>(getExecutor(), drm) {
- @Override
- @ConfinedToDsfExecutor( "fExecutor" )
- protected void handleSuccess() {
- MIBreakpoint miBpt = getData();
- if (miBpt != null) {
- bs.removeCreatedTargetBreakpoint(context, miBpt);
- MIBreakpointDMData newBreakpoint = createMIBreakpointDMData(miBpt);
- getBreakpointMap(context).put(newBreakpoint.getNumber(), newBreakpoint);
- IBreakpointDMContext dmc =
- new MIBreakpointDMContext(GDBBreakpoints_7_7.this, new IDMContext[] { context }, newBreakpoint.getNumber());
- drm.setData(dmc);
- getSession().dispatchEvent(new BreakpointAddedEvent(dmc), getProperties());
- drm.done();
- }
- else {
- doAddDynamicPrintf(context, attributes, drm);
- }
- }
- });
- }
- else {
+ bs.getTargetBreakpoint(context, attributes, new DataRequestMonitor<MIBreakpoint>(getExecutor(), drm) {
+ @Override
+ @ConfinedToDsfExecutor("fExecutor")
+ protected void handleSuccess() {
+ MIBreakpoint miBpt = getData();
+ if (miBpt != null) {
+ bs.removeCreatedTargetBreakpoint(context, miBpt);
+ MIBreakpointDMData newBreakpoint = createMIBreakpointDMData(miBpt);
+ getBreakpointMap(context).put(newBreakpoint.getNumber(), newBreakpoint);
+ IBreakpointDMContext dmc = new MIBreakpointDMContext(GDBBreakpoints_7_7.this,
+ new IDMContext[] { context }, newBreakpoint.getNumber());
+ drm.setData(dmc);
+ getSession().dispatchEvent(new BreakpointAddedEvent(dmc), getProperties());
+ drm.done();
+ } else {
+ doAddDynamicPrintf(context, attributes, drm);
+ }
+ }
+ });
+ } else {
doAddDynamicPrintf(context, attributes, drm);
}
}
@@ -135,73 +125,81 @@ public class GDBBreakpoints_7_7 extends GDBBreakpoints_7_6 {
/**
* Add a Dynamic Printf.
*/
- protected void doAddDynamicPrintf(final IBreakpointsTargetDMContext context, Map<String, Object> attributes, final DataRequestMonitor<IBreakpointDMContext> finalRm)
- {
+ protected void doAddDynamicPrintf(final IBreakpointsTargetDMContext context, Map<String, Object> attributes,
+ final DataRequestMonitor<IBreakpointDMContext> finalRm) {
// Select the context breakpoints map
final Map<String, MIBreakpointDMData> contextBreakpoints = getBreakpointMap(context);
if (contextBreakpoints == null) {
- finalRm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
+ finalRm.done(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
return;
}
// Extract the relevant parameters (providing default values to avoid potential NPEs)
final String location = formatLocation(attributes);
if (location.equals(NULL_STRING)) {
- finalRm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
+ finalRm.done(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
return;
}
- final String printfStr = (String) getProperty(attributes, MIBreakpoints.PRINTF_STRING, ""); //$NON-NLS-1$
- final Boolean enabled = (Boolean) getProperty(attributes, MIBreakpoints.IS_ENABLED, true);
- final Boolean isTemporary = (Boolean) getProperty(attributes, MIBreakpointDMData.IS_TEMPORARY, false);
- final String condition = (String) getProperty(attributes, MIBreakpoints.CONDITION, NULL_STRING);
- final Integer ignoreCount = (Integer) getProperty(attributes, MIBreakpoints.IGNORE_COUNT, 0);
- String threadId = (String) getProperty(attributes, MIBreakpointDMData.THREAD_ID, "0"); //$NON-NLS-1$
- final int tid = Integer.parseInt(threadId);
-
- final Step insertDPrintf = new Step() {
- @Override
- public void execute(final RequestMonitor rm) {
- // Execute the command
- fConnection.queueCommand(
- fCommandFactory.createMIDPrintfInsert(context, isTemporary, condition, ignoreCount, tid, !enabled, location, printfStr),
- new DataRequestMonitor<MIBreakInsertInfo>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
-
- // With MI, an invalid location won't generate an error
- if (getData().getMIBreakpoints().length == 0) {
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, DYNAMIC_PRINTF_INSERTION_FAILURE, null));
- return;
- }
-
- // Create a breakpoint object and store it in the map
- final MIBreakpointDMData newBreakpoint = createMIBreakpointDMData(getData().getMIBreakpoints()[0]);
- String reference = newBreakpoint.getNumber();
- if (reference.isEmpty()) {
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, DYNAMIC_PRINTF_INSERTION_FAILURE, null));
- return;
- }
- contextBreakpoints.put(reference, newBreakpoint);
-
- // Format the return value
- MIBreakpointDMContext dmc = new MIBreakpointDMContext(GDBBreakpoints_7_7.this, new IDMContext[] { context }, reference);
- finalRm.setData(dmc);
-
- // Flag the event
- getSession().dispatchEvent(new BreakpointAddedEvent(dmc), getProperties());
-
- rm.done();
- }
-
- @Override
- protected void handleError() {
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, DYNAMIC_PRINTF_INSERTION_FAILURE, getStatus().getException()));
- }
- });
- }
- };
-
- fRunControl.executeWithTargetAvailable(context, new Step[] { insertDPrintf }, finalRm);
+ final String printfStr = (String) getProperty(attributes, MIBreakpoints.PRINTF_STRING, ""); //$NON-NLS-1$
+ final Boolean enabled = (Boolean) getProperty(attributes, MIBreakpoints.IS_ENABLED, true);
+ final Boolean isTemporary = (Boolean) getProperty(attributes, MIBreakpointDMData.IS_TEMPORARY, false);
+ final String condition = (String) getProperty(attributes, MIBreakpoints.CONDITION, NULL_STRING);
+ final Integer ignoreCount = (Integer) getProperty(attributes, MIBreakpoints.IGNORE_COUNT, 0);
+ String threadId = (String) getProperty(attributes, MIBreakpointDMData.THREAD_ID, "0"); //$NON-NLS-1$
+ final int tid = Integer.parseInt(threadId);
+
+ final Step insertDPrintf = new Step() {
+ @Override
+ public void execute(final RequestMonitor rm) {
+ // Execute the command
+ fConnection.queueCommand(
+ fCommandFactory.createMIDPrintfInsert(context, isTemporary, condition, ignoreCount, tid,
+ !enabled, location, printfStr),
+ new DataRequestMonitor<MIBreakInsertInfo>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+
+ // With MI, an invalid location won't generate an error
+ if (getData().getMIBreakpoints().length == 0) {
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED,
+ DYNAMIC_PRINTF_INSERTION_FAILURE, null));
+ return;
+ }
+
+ // Create a breakpoint object and store it in the map
+ final MIBreakpointDMData newBreakpoint = createMIBreakpointDMData(
+ getData().getMIBreakpoints()[0]);
+ String reference = newBreakpoint.getNumber();
+ if (reference.isEmpty()) {
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED,
+ DYNAMIC_PRINTF_INSERTION_FAILURE, null));
+ return;
+ }
+ contextBreakpoints.put(reference, newBreakpoint);
+
+ // Format the return value
+ MIBreakpointDMContext dmc = new MIBreakpointDMContext(GDBBreakpoints_7_7.this,
+ new IDMContext[] { context }, reference);
+ finalRm.setData(dmc);
+
+ // Flag the event
+ getSession().dispatchEvent(new BreakpointAddedEvent(dmc), getProperties());
+
+ rm.done();
+ }
+
+ @Override
+ protected void handleError() {
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED,
+ DYNAMIC_PRINTF_INSERTION_FAILURE, getStatus().getException()));
+ }
+ });
+ }
+ };
+
+ fRunControl.executeWithTargetAvailable(context, new Step[] { insertDPrintf }, finalRm);
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBDisassembly_7_3.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBDisassembly_7_3.java
index b22924c171a..9f082f2eba3 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBDisassembly_7_3.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBDisassembly_7_3.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
* William Riley (Renesas) - Bug 357270
@@ -43,7 +43,7 @@ public class GDBDisassembly_7_3 extends MIDisassembly implements IDisassembly3 {
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.cdt.dsf.service.AbstractDsfService#initialize(org.eclipse
* .cdt.dsf.concurrent.RequestMonitor)
@@ -59,11 +59,8 @@ public class GDBDisassembly_7_3 extends MIDisassembly implements IDisassembly3 {
}
private void doInitialize(final RequestMonitor rm) {
- register(new String[] { IDisassembly.class.getName(),
- IDisassembly2.class.getName(),
- IDisassembly3.class.getName(),
- MIDisassembly.class.getName(),
- GDBDisassembly_7_3.class.getName() },
+ register(new String[] { IDisassembly.class.getName(), IDisassembly2.class.getName(),
+ IDisassembly3.class.getName(), MIDisassembly.class.getName(), GDBDisassembly_7_3.class.getName() },
new Hashtable<String, String>());
rm.done();
@@ -73,90 +70,72 @@ public class GDBDisassembly_7_3 extends MIDisassembly implements IDisassembly3 {
// IDisassembly3
// /////////////////////////////////////////////////////////////////////////
@Override
- public void getInstructions(IDisassemblyDMContext context,
- BigInteger startAddress, BigInteger endAddress,
- DataRequestMonitor<IInstruction[]> drm)
- {
+ public void getInstructions(IDisassemblyDMContext context, BigInteger startAddress, BigInteger endAddress,
+ DataRequestMonitor<IInstruction[]> drm) {
// Ask for opCodes by default
getInstructions(context, startAddress, endAddress, true, drm);
}
@Override
- public void getInstructions(IDisassemblyDMContext context, String filename,
- int linenum, int lines,
- DataRequestMonitor<IInstruction[]> drm)
- {
+ public void getInstructions(IDisassemblyDMContext context, String filename, int linenum, int lines,
+ DataRequestMonitor<IInstruction[]> drm) {
// Ask for opCodes by default
getInstructions(context, filename, linenum, lines, true, drm);
}
@Override
- public void getMixedInstructions(IDisassemblyDMContext context,
- BigInteger startAddress, BigInteger endAddress,
- DataRequestMonitor<IMixedInstruction[]> drm)
- {
+ public void getMixedInstructions(IDisassemblyDMContext context, BigInteger startAddress, BigInteger endAddress,
+ DataRequestMonitor<IMixedInstruction[]> drm) {
// Ask for opCodes by default
getMixedInstructions(context, startAddress, endAddress, true, drm);
}
@Override
- public void getMixedInstructions(IDisassemblyDMContext context,
- String filename, int linenum, int lines,
- DataRequestMonitor<IMixedInstruction[]> drm)
- {
+ public void getMixedInstructions(IDisassemblyDMContext context, String filename, int linenum, int lines,
+ DataRequestMonitor<IMixedInstruction[]> drm) {
// Ask for opCodes by default
getMixedInstructions(context, filename, linenum, lines, true, drm);
}
-
+
@Override
- public void getInstructions(IDisassemblyDMContext context,
- BigInteger startAddress, BigInteger endAddress, boolean opCodes,
- DataRequestMonitor<IInstruction[]> drm)
- {
+ public void getInstructions(IDisassemblyDMContext context, BigInteger startAddress, BigInteger endAddress,
+ boolean opCodes, DataRequestMonitor<IInstruction[]> drm) {
getInstructions(context, startAddress, endAddress,
- opCodes ? MIDataDisassemble.DATA_DISASSEMBLE_MODE_DISASSEMBLY_OPCODES :
- MIDataDisassemble.DATA_DISASSEMBLE_MODE_DISASSEMBLY,
- drm);
+ opCodes ? MIDataDisassemble.DATA_DISASSEMBLE_MODE_DISASSEMBLY_OPCODES
+ : MIDataDisassemble.DATA_DISASSEMBLE_MODE_DISASSEMBLY,
+ drm);
}
@Override
- public void getInstructions(IDisassemblyDMContext context, String filename,
- int linenum, int lines, boolean opCodes,
- DataRequestMonitor<IInstruction[]> drm)
- {
+ public void getInstructions(IDisassemblyDMContext context, String filename, int linenum, int lines, boolean opCodes,
+ DataRequestMonitor<IInstruction[]> drm) {
getInstructions(context, filename, linenum, lines,
- opCodes ? MIDataDisassemble.DATA_DISASSEMBLE_MODE_DISASSEMBLY_OPCODES :
- MIDataDisassemble.DATA_DISASSEMBLE_MODE_DISASSEMBLY,
- drm);
+ opCodes ? MIDataDisassemble.DATA_DISASSEMBLE_MODE_DISASSEMBLY_OPCODES
+ : MIDataDisassemble.DATA_DISASSEMBLE_MODE_DISASSEMBLY,
+ drm);
}
@Override
- public void getMixedInstructions(IDisassemblyDMContext context,
- BigInteger startAddress, BigInteger endAddress, boolean opCodes,
- DataRequestMonitor<IMixedInstruction[]> drm)
- {
+ public void getMixedInstructions(IDisassemblyDMContext context, BigInteger startAddress, BigInteger endAddress,
+ boolean opCodes, DataRequestMonitor<IMixedInstruction[]> drm) {
getMixedInstructions(context, startAddress, endAddress,
- opCodes ? MIDataDisassemble.DATA_DISASSEMBLE_MODE_MIXED_OPCODES :
- MIDataDisassemble.DATA_DISASSEMBLE_MODE_MIXED,
- drm);
+ opCodes ? MIDataDisassemble.DATA_DISASSEMBLE_MODE_MIXED_OPCODES
+ : MIDataDisassemble.DATA_DISASSEMBLE_MODE_MIXED,
+ drm);
}
@Override
- public void getMixedInstructions(IDisassemblyDMContext context,
- String filename, int linenum, int lines, boolean opCodes,
- DataRequestMonitor<IMixedInstruction[]> drm)
- {
- getMixedInstructions(context, filename, linenum, lines,
- opCodes ? MIDataDisassemble.DATA_DISASSEMBLE_MODE_MIXED_OPCODES :
- MIDataDisassemble.DATA_DISASSEMBLE_MODE_MIXED,
- drm);
+ public void getMixedInstructions(IDisassemblyDMContext context, String filename, int linenum, int lines,
+ boolean opCodes, DataRequestMonitor<IMixedInstruction[]> drm) {
+ getMixedInstructions(context, filename, linenum, lines,
+ opCodes ? MIDataDisassemble.DATA_DISASSEMBLE_MODE_MIXED_OPCODES
+ : MIDataDisassemble.DATA_DISASSEMBLE_MODE_MIXED,
+ drm);
}
@Override
- public void alignOpCodeAddress(IDisassemblyDMContext context,
- BigInteger address, DataRequestMonitor<BigInteger> drm)
- {
- drm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
- NOT_SUPPORTED, "Not supported", null)); //$NON-NLS-1$
+ public void alignOpCodeAddress(IDisassemblyDMContext context, BigInteger address,
+ DataRequestMonitor<BigInteger> drm) {
+ drm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Not supported", null)); //$NON-NLS-1$
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBHardwareAndOS.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBHardwareAndOS.java
index a418e54af55..20012763ca3 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBHardwareAndOS.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBHardwareAndOS.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Marc Khouzam (Ericsson) - initial API and implementation
* Marc Khouzam (Ericsson) - Updated to use /proc/cpuinfo for remote targets (Bug 374024)
@@ -15,7 +15,7 @@
* Marc Dumais (Ericsson) - Bug 434889
* Teodor Madan (Freescale) - Activate multicore visualizer on non-linux hosts for remote case
* Marc Dumais (Ericsson) - Bug 464184
- *
+ *
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.service;
@@ -79,7 +79,7 @@ import org.osgi.framework.BundleContext;
/**
* This class implements the {@link IGDBHardwareAndOS} interface which gives access
* to hardware information about the target.
- *
+ *
* @since 4.1
*/
public class GDBHardwareAndOS extends AbstractDsfService implements IGDBHardwareAndOS2, ICachingService {
@@ -88,15 +88,13 @@ public class GDBHardwareAndOS extends AbstractDsfService implements IGDBHardware
static {
try {
sTempFolder = Files.createTempDirectory(GdbPlugin.PLUGIN_ID).toString() + '/';
- } catch (IOException | IllegalArgumentException | UnsupportedOperationException e ) {
+ } catch (IOException | IllegalArgumentException | UnsupportedOperationException e) {
sTempFolder = System.getProperty("java.io.tmpdir"); //$NON-NLS-1$
}
}
@Immutable
- protected static class GDBCPUDMC extends AbstractDMContext
- implements ICPUDMContext
- {
+ protected static class GDBCPUDMC extends AbstractDMContext implements ICPUDMContext {
/**
* String ID that is used to identify the thread in the GDB/MI protocol.
*/
@@ -104,32 +102,34 @@ public class GDBHardwareAndOS extends AbstractDsfService implements IGDBHardware
/**
*/
- protected GDBCPUDMC(String sessionId, IHardwareTargetDMContext targetDmc, String id) {
- super(sessionId, targetDmc == null ? new IDMContext[0] : new IDMContext[] { targetDmc });
- fId = id;
- }
+ protected GDBCPUDMC(String sessionId, IHardwareTargetDMContext targetDmc, String id) {
+ super(sessionId, targetDmc == null ? new IDMContext[0] : new IDMContext[] { targetDmc });
+ fId = id;
+ }
@Override
- public String getId(){
+ public String getId() {
return fId;
}
@Override
- public String toString() { return baseToString() + ".CPU[" + fId + "]"; } //$NON-NLS-1$ //$NON-NLS-2$
+ public String toString() {
+ return baseToString() + ".CPU[" + fId + "]"; //$NON-NLS-1$//$NON-NLS-2$
+ }
@Override
public boolean equals(Object obj) {
- return baseEquals(obj) && ((GDBCPUDMC)obj).fId.equals(fId);
+ return baseEquals(obj) && ((GDBCPUDMC) obj).fId.equals(fId);
}
@Override
- public int hashCode() { return baseHashCode() ^ fId.hashCode(); }
+ public int hashCode() {
+ return baseHashCode() ^ fId.hashCode();
+ }
}
- @Immutable
- protected static class GDBCoreDMC extends AbstractDMContext
- implements ICoreDMContext
- {
+ @Immutable
+ protected static class GDBCoreDMC extends AbstractDMContext implements ICoreDMContext {
private final String fId;
public GDBCoreDMC(String sessionId, ICPUDMContext CPUDmc, String id) {
@@ -138,90 +138,102 @@ public class GDBHardwareAndOS extends AbstractDsfService implements IGDBHardware
}
@Override
- public String getId(){ return fId; }
+ public String getId() {
+ return fId;
+ }
@Override
- public String toString() { return baseToString() + ".core[" + fId + "]"; } //$NON-NLS-1$ //$NON-NLS-2$
+ public String toString() {
+ return baseToString() + ".core[" + fId + "]"; //$NON-NLS-1$//$NON-NLS-2$
+ }
@Override
public boolean equals(Object obj) {
- return baseEquals(obj) &&
- (((GDBCoreDMC)obj).fId == null ? fId == null : ((GDBCoreDMC)obj).fId.equals(fId));
+ return baseEquals(obj)
+ && (((GDBCoreDMC) obj).fId == null ? fId == null : ((GDBCoreDMC) obj).fId.equals(fId));
}
@Override
- public int hashCode() { return baseHashCode() ^ (fId == null ? 0 : fId.hashCode()); }
+ public int hashCode() {
+ return baseHashCode() ^ (fId == null ? 0 : fId.hashCode());
+ }
}
-
- @Immutable
- protected static class GDBCPUDMData implements ICPUDMData {
- final int fNumCores;
-
- public GDBCPUDMData(int num) {
- fNumCores = num;
- }
-
- @Override
- public int getNumCores() { return fNumCores; }
- }
-
- @Immutable
- protected static class GDBCoreDMData implements ICoreDMData {
- final String fPhysicalId;
-
- public GDBCoreDMData(String id) {
- fPhysicalId = id;
- }
-
+
+ @Immutable
+ protected static class GDBCPUDMData implements ICPUDMData {
+ final int fNumCores;
+
+ public GDBCPUDMData(int num) {
+ fNumCores = num;
+ }
+
@Override
- public String getPhysicalId() { return fPhysicalId; }
- }
+ public int getNumCores() {
+ return fNumCores;
+ }
+ }
+ @Immutable
+ protected static class GDBCoreDMData implements ICoreDMData {
+ final String fPhysicalId;
+
+ public GDBCoreDMData(String id) {
+ fPhysicalId = id;
+ }
- /**
+ @Override
+ public String getPhysicalId() {
+ return fPhysicalId;
+ }
+ }
+
+ /**
* @since 4.2
*/
- @Immutable
- protected class GDBLoadInfo implements ILoadInfo {
- private String fLoad;
- private Map<String,String> fDetailedLoad;
-
- public GDBLoadInfo(String load, Map<String,String> detailedLoad) {
- fLoad = load;
- fDetailedLoad = detailedLoad;
- }
- public GDBLoadInfo(String load) {
- this(load, null);
- }
+ @Immutable
+ protected class GDBLoadInfo implements ILoadInfo {
+ private String fLoad;
+ private Map<String, String> fDetailedLoad;
+
+ public GDBLoadInfo(String load, Map<String, String> detailedLoad) {
+ fLoad = load;
+ fDetailedLoad = detailedLoad;
+ }
+
+ public GDBLoadInfo(String load) {
+ this(load, null);
+ }
+
@Override
public String getLoad() {
return fLoad;
}
+
@Override
- public Map<String,String> getDetailedLoad() {
+ public Map<String, String> getDetailedLoad() {
return fDetailedLoad;
}
- }
-
- // to save queued load info requests for later processing
- private Map<IDMContext, DataRequestMonitor<ILoadInfo>> fLoadInfoRequestCache;
-
- private IGDBControl fCommandControl;
- private IGDBBackend fBackend;
- private CommandFactory fCommandFactory;
-
- // A command cache to cache the data gotten from /proc/cpuinfo
- // Because we obtain the data differently for a local target
- // than a remote target, we can't buffer an actual MI command,
- // so instead, we use a MetaMICommand to "fetch the cpu info"
- // Since the CPU info does not change, this cache does not need
- // to be cleared.
+ }
+
+ // to save queued load info requests for later processing
+ private Map<IDMContext, DataRequestMonitor<ILoadInfo>> fLoadInfoRequestCache;
+
+ private IGDBControl fCommandControl;
+ private IGDBBackend fBackend;
+ private CommandFactory fCommandFactory;
+
+ // A command cache to cache the data gotten from /proc/cpuinfo
+ // Because we obtain the data differently for a local target
+ // than a remote target, we can't buffer an actual MI command,
+ // so instead, we use a MetaMICommand to "fetch the cpu info"
+ // Since the CPU info does not change, this cache does not need
+ // to be cleared.
private CommandCache fFetchCPUInfoCache;
// Track if the debug session has been fully initialized.
// Until then, we may not be connected to the remote target
// yet, and not be able to properly fetch the information we need.
- // Bug 374293
+ // Bug 374293
private boolean fSessionInitializationComplete;
// used to keep track when we last computed the load
@@ -234,33 +246,32 @@ public class GDBHardwareAndOS extends AbstractDsfService implements IGDBHardware
// and serve it again if requested within a short period of time.
private ProcStatCoreLoads fCachedLoads = null;
// lifetime of the load cache, in ms
- private final static int LOAD_CACHE_LIFETIME = 500;
-
-
- public GDBHardwareAndOS(DsfSession session) {
- super(session);
- }
-
- /**
- * This method initializes this service.
- *
- * @param requestMonitor
- * The request monitor indicating the operation is finished
- */
- @Override
- public void initialize(final RequestMonitor requestMonitor) {
- super.initialize(new RequestMonitor(ImmediateExecutor.getInstance(), requestMonitor) {
- @Override
- protected void handleSuccess() {
- doInitialize(requestMonitor);
+ private final static int LOAD_CACHE_LIFETIME = 500;
+
+ public GDBHardwareAndOS(DsfSession session) {
+ super(session);
+ }
+
+ /**
+ * This method initializes this service.
+ *
+ * @param requestMonitor
+ * The request monitor indicating the operation is finished
+ */
+ @Override
+ public void initialize(final RequestMonitor requestMonitor) {
+ super.initialize(new RequestMonitor(ImmediateExecutor.getInstance(), 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.
@@ -270,44 +281,41 @@ public class GDBHardwareAndOS extends AbstractDsfService implements IGDBHardware
fCommandControl = getServicesTracker().getService(IGDBControl.class);
fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
-
- fBackend = getServicesTracker().getService(IGDBBackend.class);
+
+ fBackend = getServicesTracker().getService(IGDBBackend.class);
// The cache does not go directly to the commandControl service.
// Instead is goes through a CPUInfoManager which will decide how to
// handle getting the required cpu info
fFetchCPUInfoCache = new CommandCache(getSession(), new CPUInfoManager());
- fFetchCPUInfoCache.setContextAvailable(fCommandControl.getContext(), true);
- fLoadInfoRequestCache = new HashMap<IDMContext, DataRequestMonitor<ILoadInfo>>();
+ fFetchCPUInfoCache.setContextAvailable(fCommandControl.getContext(), true);
+ fLoadInfoRequestCache = new HashMap<IDMContext, DataRequestMonitor<ILoadInfo>>();
+
+ getSession().addServiceEventListener(this, null);
- getSession().addServiceEventListener(this, null);
+ // Register this service.
+ register(new String[] { IGDBHardwareAndOS.class.getName(), IGDBHardwareAndOS2.class.getName(),
+ GDBHardwareAndOS.class.getName() }, new Hashtable<String, String>());
- // Register this service.
- register(new String[] { IGDBHardwareAndOS.class.getName(),
- IGDBHardwareAndOS2.class.getName(),
- GDBHardwareAndOS.class.getName() },
- new Hashtable<String, String>());
-
requestMonitor.done();
}
-
/**
* This method shuts down this service. It unregisters the service, stops
* receiving service events, and calls the superclass shutdown() method to
* finish the shutdown process.
- *
+ *
* @return void
*/
@Override
public void shutdown(RequestMonitor requestMonitor) {
- getSession().removeServiceEventListener(this);
- fFetchCPUInfoCache.reset();
- fLoadInfoRequestCache.clear();
+ getSession().removeServiceEventListener(this);
+ fFetchCPUInfoCache.reset();
+ fLoadInfoRequestCache.clear();
unregister();
super.shutdown(requestMonitor);
}
-
+
/**
* @return The bundle context of the plug-in to which this service belongs.
*/
@@ -324,19 +332,19 @@ public class GDBHardwareAndOS extends AbstractDsfService implements IGDBHardware
public void getCPUs(final IHardwareTargetDMContext dmc, final DataRequestMonitor<ICPUDMContext[]> rm) {
if (!fSessionInitializationComplete) {
// We are not ready to answer yet
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Debug session not initialized yet", null)); //$NON-NLS-1$
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Debug session not initialized yet", //$NON-NLS-1$
+ null));
return;
}
if (supportsProcPseudoFS()) {
- fFetchCPUInfoCache.execute(
- new MIMetaGetCPUInfo(fCommandControl.getContext()),
- new ImmediateDataRequestMonitor<MIMetaGetCPUInfoInfo>() {
- @Override
- protected void handleSuccess() {
- rm.done(parseCoresInfoForCPUs(dmc, getData().getInfo()));
- }
- });
+ fFetchCPUInfoCache.execute(new MIMetaGetCPUInfo(fCommandControl.getContext()),
+ new ImmediateDataRequestMonitor<MIMetaGetCPUInfoInfo>() {
+ @Override
+ protected void handleSuccess() {
+ rm.done(parseCoresInfoForCPUs(dmc, getData().getInfo()));
+ }
+ });
} else {
// No way to know the CPUs for Windows session.
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Operation not supported", null)); //$NON-NLS-1$
@@ -350,7 +358,7 @@ public class GDBHardwareAndOS extends AbstractDsfService implements IGDBHardware
if (Platform.getOS().equals(Platform.OS_LINUX))
return true;
- // for non-linux platform, support only remote (linux? ) targets
+ // for non-linux platform, support only remote (linux? ) targets
if (SessionType.REMOTE == fBackend.getSessionType()) {
return true;
}
@@ -362,17 +370,17 @@ public class GDBHardwareAndOS extends AbstractDsfService implements IGDBHardware
public void getCores(IDMContext dmc, final DataRequestMonitor<ICoreDMContext[]> rm) {
if (!fSessionInitializationComplete) {
// We are not ready to answer yet
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Debug session not initialized yet", null)); //$NON-NLS-1$
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Debug session not initialized yet", //$NON-NLS-1$
+ null));
return;
}
if (dmc instanceof ICPUDMContext) {
// Get the cores under this particular CPU
- final ICPUDMContext cpuDmc = (ICPUDMContext)dmc;
-
+ final ICPUDMContext cpuDmc = (ICPUDMContext) dmc;
+
if (supportsProcPseudoFS()) {
- fFetchCPUInfoCache.execute(
- new MIMetaGetCPUInfo(fCommandControl.getContext()),
+ fFetchCPUInfoCache.execute(new MIMetaGetCPUInfo(fCommandControl.getContext()),
new ImmediateDataRequestMonitor<MIMetaGetCPUInfoInfo>() {
@Override
protected void handleSuccess() {
@@ -404,7 +412,7 @@ public class GDBHardwareAndOS extends AbstractDsfService implements IGDBHardware
for (int i = 0; i < cpuIdsArray.length; i++) {
CPUs[i] = createCPUContext(dmc, cpuIdsArray[i]);
}
- return CPUs;
+ return CPUs;
}
/**
@@ -414,7 +422,7 @@ public class GDBHardwareAndOS extends AbstractDsfService implements IGDBHardware
Vector<ICoreDMContext> coreDmcs = new Vector<ICoreDMContext>();
for (ICoreInfo core : coresInfo) {
- if (core.getPhysicalId().equals(cpuDmc.getId())){
+ if (core.getPhysicalId().equals(cpuDmc.getId())) {
// This core belongs to the right CPU
coreDmcs.add(createCoreContext(cpuDmc, core.getId()));
}
@@ -434,7 +442,7 @@ public class GDBHardwareAndOS extends AbstractDsfService implements IGDBHardware
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid DMC type", null)); //$NON-NLS-1$
}
}
-
+
@Override
public ICPUDMContext createCPUContext(IHardwareTargetDMContext targetDmc, String CPUId) {
return new GDBCPUDMC(getSession().getId(), targetDmc, CPUId);
@@ -444,16 +452,16 @@ public class GDBHardwareAndOS extends AbstractDsfService implements IGDBHardware
public ICoreDMContext createCoreContext(ICPUDMContext cpuDmc, String coreId) {
return new GDBCoreDMC(getSession().getId(), cpuDmc, coreId);
}
-
- @DsfServiceEventHandler
- public void eventDispatched(DataModelInitializedEvent e) {
- // The launch sequence is complete, so we can start providing information.
- // If we don't wait for this event, we may provide results before we are
- // connected to the remote target which would be wrong.
- // Bug 374293
- fSessionInitializationComplete = true;
- }
-
+
+ @DsfServiceEventHandler
+ public void eventDispatched(DataModelInitializedEvent e) {
+ // The launch sequence is complete, so we can start providing information.
+ // If we don't wait for this event, we may provide results before we are
+ // connected to the remote target which would be wrong.
+ // Bug 374293
+ fSessionInitializationComplete = true;
+ }
+
@Override
public void flushCache(IDMContext context) {
// Although the CPUInfo does not change,
@@ -461,130 +469,142 @@ public class GDBHardwareAndOS extends AbstractDsfService implements IGDBHardware
// We would need to call this method from the UI somehow.
fFetchCPUInfoCache.reset(context);
}
-
+
/**
* A commandControl that will decide what to do when needing to find the CPUInfo.
* The class is used together with a CommandCache an MIMetaCommands to fetch
* information we need.
*/
private class CPUInfoManager implements ICommandControl {
- private final List<ICommandListener> fCommandProcessors = new ArrayList<ICommandListener>();
+ private final List<ICommandListener> fCommandProcessors = new ArrayList<ICommandListener>();
@Override
- public <V extends ICommandResult> ICommandToken queueCommand(final ICommand<V> command, DataRequestMonitor<V> rm) {
-
- final ICommandToken token = new ICommandToken() {
- @Override
- public ICommand<? extends ICommandResult> getCommand() {
- return command;
- }
- };
-
- // The class does not buffer commands itself, but sends them directly to the real
- // MICommandControl service. Therefore, we must immediately tell our calling cache that the command
- // has been sent, since we can never cancel it.
- processCommandSent(token);
-
- if (command instanceof MIMetaGetCPUInfo) {
- @SuppressWarnings("unchecked")
- final DataRequestMonitor<MIMetaGetCPUInfoInfo> drm = (DataRequestMonitor<MIMetaGetCPUInfoInfo>)rm;
- final ICommandControlDMContext dmc = (ICommandControlDMContext)command.getContext();
-
- if (fBackend.getSessionType() == SessionType.REMOTE) {
- // Ask GDB to fetch /proc/cpuinfo from the remote target, and then we parse it.
- String remoteFile = "/proc/cpuinfo"; //$NON-NLS-1$
- final String localFile = sTempFolder + "proc.cpuinfo." + getSession().getId(); //$NON-NLS-1$
- fCommandControl.queueCommand(
- fCommandFactory.createCLIRemoteGet(dmc, remoteFile, localFile),
- new ImmediateDataRequestMonitor<MIInfo>(rm) {
- @Override
- protected void handleSuccess() {
- ICoreInfo[] info = new CoreList(localFile).getCoreList();
- // Now that we processed the file, remove it to avoid polluting the file system
- new File(localFile).delete();
- drm.done(new MIMetaGetCPUInfoInfo(info));
- processCommandDone(token, drm.getData());
- }
- @Override
- protected void handleError() {
- // On some older linux versions, gdbserver is not able to read from /proc
- // because it is a pseudo filesystem.
- // We need to find some other method of getting the info we need.
-
- // For a remote session, we can use GDB's -list-thread-groups --available
- // command, which shows on which cores a process is running. This does
- // not necessarily give the exhaustive list of cores, but that is the best
- // we have in this case.
- //
- // In this case, we don't have knowledge about CPUs, so we lump all cores
- // into a single CPU.
-
- fCommandControl.queueCommand(
- fCommandFactory.createMIListThreadGroups(dmc, true),
- new ImmediateDataRequestMonitor<MIListThreadGroupsInfo>(drm) {
- @Override
- protected void handleSuccess() {
- // First extract the string id for every core GDB reports
- Set<String> coreIds = new HashSet<String>();
- IThreadGroupInfo[] groups = getData().getGroupList();
- for (IThreadGroupInfo group : groups) {
- coreIds.addAll(Arrays.asList(group.getCores()));
- }
-
- // Now create the context for each distinct core
- //
- // We don't have CPU info in this case so let's put them all under a single CPU
- final String defaultCPUId = "0"; //$NON-NLS-1$
- ICoreInfo[] info = new ICoreInfo[coreIds.size()];
- int i = 0;
- for (String id : coreIds) {
- info[i++] = new CoreInfo(id, defaultCPUId);
- }
- drm.done(new MIMetaGetCPUInfoInfo(info));
- processCommandDone(token, drm.getData());
- }
- });
- }
- });
- } else {
- // For a local session, parse /proc/cpuinfo directly.
- ICoreInfo[] info = new CoreList("/proc/cpuinfo").getCoreList(); //$NON-NLS-1$
+ public <V extends ICommandResult> ICommandToken queueCommand(final ICommand<V> command,
+ DataRequestMonitor<V> rm) {
+
+ final ICommandToken token = new ICommandToken() {
+ @Override
+ public ICommand<? extends ICommandResult> getCommand() {
+ return command;
+ }
+ };
+
+ // The class does not buffer commands itself, but sends them directly to the real
+ // MICommandControl service. Therefore, we must immediately tell our calling cache that the command
+ // has been sent, since we can never cancel it.
+ processCommandSent(token);
+
+ if (command instanceof MIMetaGetCPUInfo) {
+ @SuppressWarnings("unchecked")
+ final DataRequestMonitor<MIMetaGetCPUInfoInfo> drm = (DataRequestMonitor<MIMetaGetCPUInfoInfo>) rm;
+ final ICommandControlDMContext dmc = (ICommandControlDMContext) command.getContext();
+
+ if (fBackend.getSessionType() == SessionType.REMOTE) {
+ // Ask GDB to fetch /proc/cpuinfo from the remote target, and then we parse it.
+ String remoteFile = "/proc/cpuinfo"; //$NON-NLS-1$
+ final String localFile = sTempFolder + "proc.cpuinfo." + getSession().getId(); //$NON-NLS-1$
+ fCommandControl.queueCommand(fCommandFactory.createCLIRemoteGet(dmc, remoteFile, localFile),
+ new ImmediateDataRequestMonitor<MIInfo>(rm) {
+ @Override
+ protected void handleSuccess() {
+ ICoreInfo[] info = new CoreList(localFile).getCoreList();
+ // Now that we processed the file, remove it to avoid polluting the file system
+ new File(localFile).delete();
+ drm.done(new MIMetaGetCPUInfoInfo(info));
+ processCommandDone(token, drm.getData());
+ }
+
+ @Override
+ protected void handleError() {
+ // On some older linux versions, gdbserver is not able to read from /proc
+ // because it is a pseudo filesystem.
+ // We need to find some other method of getting the info we need.
+
+ // For a remote session, we can use GDB's -list-thread-groups --available
+ // command, which shows on which cores a process is running. This does
+ // not necessarily give the exhaustive list of cores, but that is the best
+ // we have in this case.
+ //
+ // In this case, we don't have knowledge about CPUs, so we lump all cores
+ // into a single CPU.
+
+ fCommandControl.queueCommand(fCommandFactory.createMIListThreadGroups(dmc, true),
+ new ImmediateDataRequestMonitor<MIListThreadGroupsInfo>(drm) {
+ @Override
+ protected void handleSuccess() {
+ // First extract the string id for every core GDB reports
+ Set<String> coreIds = new HashSet<String>();
+ IThreadGroupInfo[] groups = getData().getGroupList();
+ for (IThreadGroupInfo group : groups) {
+ coreIds.addAll(Arrays.asList(group.getCores()));
+ }
+
+ // Now create the context for each distinct core
+ //
+ // We don't have CPU info in this case so let's put them all under a single CPU
+ final String defaultCPUId = "0"; //$NON-NLS-1$
+ ICoreInfo[] info = new ICoreInfo[coreIds.size()];
+ int i = 0;
+ for (String id : coreIds) {
+ info[i++] = new CoreInfo(id, defaultCPUId);
+ }
+ drm.done(new MIMetaGetCPUInfoInfo(info));
+ processCommandDone(token, drm.getData());
+ }
+ });
+ }
+ });
+ } else {
+ // For a local session, parse /proc/cpuinfo directly.
+ ICoreInfo[] info = new CoreList("/proc/cpuinfo").getCoreList(); //$NON-NLS-1$
drm.done(new MIMetaGetCPUInfoInfo(info));
- processCommandDone(token, drm.getData());
- }
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR,
+ processCommandDone(token, drm.getData());
+ }
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR,
"Unexpected Meta command", null)); //$NON-NLS-1$
rm.done();
- }
- return token;
- }
-
+ }
+ return token;
+ }
+
// Need to support these as they are used by the commandCache
- @Override
- public void addCommandListener(ICommandListener processor) { fCommandProcessors.add(processor); }
- @Override
- public void removeCommandListener(ICommandListener processor) { fCommandProcessors.remove(processor); }
-
-
- private void processCommandSent(ICommandToken token) {
- for (ICommandListener processor : fCommandProcessors) {
- processor.commandSent(token);
- }
- }
-
- private void processCommandDone(ICommandToken token, ICommandResult result) {
- for (ICommandListener processor : fCommandProcessors) {
- processor.commandDone(token, result);
- }
- }
-
- @Override
- public void addEventListener(IEventListener processor) { assert false : "Not supported"; } //$NON-NLS-1$
@Override
- public void removeEventListener(IEventListener processor) { assert false : "Not supported"; } //$NON-NLS-1$
+ public void addCommandListener(ICommandListener processor) {
+ fCommandProcessors.add(processor);
+ }
+
@Override
- public void removeCommand(ICommandToken token) { assert false : "Not supported"; } //$NON-NLS-1$
+ public void removeCommandListener(ICommandListener processor) {
+ fCommandProcessors.remove(processor);
+ }
+
+ private void processCommandSent(ICommandToken token) {
+ for (ICommandListener processor : fCommandProcessors) {
+ processor.commandSent(token);
+ }
+ }
+
+ private void processCommandDone(ICommandToken token, ICommandResult result) {
+ for (ICommandListener processor : fCommandProcessors) {
+ processor.commandDone(token, result);
+ }
+ }
+
+ @Override
+ public void addEventListener(IEventListener processor) {
+ assert false : "Not supported"; //$NON-NLS-1$
+ }
+
+ @Override
+ public void removeEventListener(IEventListener processor) {
+ assert false : "Not supported"; //$NON-NLS-1$
+ }
+
+ @Override
+ public void removeCommand(ICommandToken token) {
+ assert false : "Not supported"; //$NON-NLS-1$
+ }
}
@@ -600,8 +620,7 @@ public class GDBHardwareAndOS extends AbstractDsfService implements IGDBHardware
* @since 4.2
*/
@Override
- public void getResourceClasses(IDMContext dmc,
- DataRequestMonitor<IResourceClass[]> rm) {
+ public void getResourceClasses(IDMContext dmc, DataRequestMonitor<IResourceClass[]> rm) {
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Operation not supported", null)); //$NON-NLS-1$
}
@@ -614,29 +633,29 @@ public class GDBHardwareAndOS extends AbstractDsfService implements IGDBHardware
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Operation not supported", null)); //$NON-NLS-1$
}
-
- /**
- * This method processes "load info" requests. The load is computed using a
- * sampling method; two readings of a local or remote /proc/stat file are done
- * with a delay in between. Then the load is computed from the two samples,
- * for all CPUs/cores known in the system.
- *
- * Because of the method used, it's possible that fast variations in CPU usage will
- * be missed. However longer load trends should be reflected in the results.
- *
- * To avoid generating too much load in the remote case, there is a cache that will
- * return the already computed load, if requested multiple times in a short period.
- * There is also a mechanism to queue subsequent requests if one is ongoing. Upon
- * completion of the ongoing request, any queued request is answered with the load
- * that was just computed.
- *
- * @since 4.2
- */
+ /**
+ * This method processes "load info" requests. The load is computed using a
+ * sampling method; two readings of a local or remote /proc/stat file are done
+ * with a delay in between. Then the load is computed from the two samples,
+ * for all CPUs/cores known in the system.
+ *
+ * Because of the method used, it's possible that fast variations in CPU usage will
+ * be missed. However longer load trends should be reflected in the results.
+ *
+ * To avoid generating too much load in the remote case, there is a cache that will
+ * return the already computed load, if requested multiple times in a short period.
+ * There is also a mechanism to queue subsequent requests if one is ongoing. Upon
+ * completion of the ongoing request, any queued request is answered with the load
+ * that was just computed.
+ *
+ * @since 4.2
+ */
@Override
public void getLoadInfo(final IDMContext context, final DataRequestMonitor<ILoadInfo> rm) {
if (!(context instanceof ICoreDMContext) && !(context instanceof ICPUDMContext)) {
- // we only support getting the load for a CPU or a core
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Load information not supported for this context type", null)); //$NON-NLS-1$
+ // we only support getting the load for a CPU or a core
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE,
+ "Load information not supported for this context type", null)); //$NON-NLS-1$
return;
}
@@ -644,31 +663,30 @@ public class GDBHardwareAndOS extends AbstractDsfService implements IGDBHardware
assert (LOAD_SAMPLE_DELAY >= 100);
// so the cache is useful
assert (LOAD_CACHE_LIFETIME >= LOAD_SAMPLE_DELAY);
-
+
// This way of computing the CPU load is only applicable to Linux
if (!supportsProcPseudoFS()) {
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Operation not supported", null)); //$NON-NLS-1$
return;
}
-
- // Is a request is already ongoing?
- if(fLoadRequestOngoing) {
+
+ // Is a request is already ongoing?
+ if (fLoadRequestOngoing) {
// queue current new request
fLoadInfoRequestCache.put(context, rm);
return;
}
// no request ongoing, so proceed
fLoadRequestOngoing = true;
-
- // caching mechanism to keep things sane, even if the views(s)
- // request load information very often.
+
+ // caching mechanism to keep things sane, even if the views(s)
+ // request load information very often.
long currentTime = System.currentTimeMillis();
-
+
// time to fetch fresh load information?
if (fLastCpuLoadRefresh + LOAD_CACHE_LIFETIME < currentTime) {
fLastCpuLoadRefresh = currentTime;
- }
- else {
+ } else {
// not time yet... re-use cached load data
processLoads(context, rm, fCachedLoads);
fLoadRequestOngoing = false;
@@ -676,122 +694,129 @@ public class GDBHardwareAndOS extends AbstractDsfService implements IGDBHardware
}
final ProcStatParser procStatParser = new ProcStatParser();
- final ICommandControlDMContext dmc = DMContexts.getAncestorOfType(context, ICommandControlDMContext.class);
- final String statFile = "/proc/stat"; //$NON-NLS-1$
- final String localFile = sTempFolder + "proc.stat." + getSession().getId(); //$NON-NLS-1$
-
- // Remote debugging? We will ask GDB to get us the /proc/stat file from target, twice, with a delay between.
- if (fBackend.getSessionType() == SessionType.REMOTE) {
- fCommandControl.queueCommand(
- fCommandFactory.createCLIRemoteGet(dmc, statFile, localFile),
- new ImmediateDataRequestMonitor<MIInfo>(rm) {
- @Override
- protected void handleCompleted() {
- if (! isSuccess()) {
- fLoadRequestOngoing = false;
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Can't get load info for CPU", null)); //$NON-NLS-1$
- return;
- }
-
- // Success - parse first set of stat counters
- try {
+ final ICommandControlDMContext dmc = DMContexts.getAncestorOfType(context, ICommandControlDMContext.class);
+ final String statFile = "/proc/stat"; //$NON-NLS-1$
+ final String localFile = sTempFolder + "proc.stat." + getSession().getId(); //$NON-NLS-1$
+
+ // Remote debugging? We will ask GDB to get us the /proc/stat file from target, twice, with a delay between.
+ if (fBackend.getSessionType() == SessionType.REMOTE) {
+ fCommandControl.queueCommand(fCommandFactory.createCLIRemoteGet(dmc, statFile, localFile),
+ new ImmediateDataRequestMonitor<MIInfo>(rm) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ fLoadRequestOngoing = false;
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR,
+ "Can't get load info for CPU", null)); //$NON-NLS-1$
+ return;
+ }
+
+ // Success - parse first set of stat counters
+ try {
procStatParser.parseStatFile(localFile);
} catch (Exception e) {
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Can't get load info for CPU", null)); //$NON-NLS-1$
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR,
+ "Can't get load info for CPU", null)); //$NON-NLS-1$
fLoadRequestOngoing = false;
return;
}
- // delete temp file
+ // delete temp file
new File(localFile).delete();
-
- getExecutor().schedule(new Runnable() {
- @Override
- public void run() {
- fCommandControl.queueCommand(
- fCommandFactory.createCLIRemoteGet(dmc, statFile, localFile),
- new ImmediateDataRequestMonitor<MIInfo>(rm) {
- @Override
- protected void handleCompleted() {
- if (! isSuccess()) {
- fLoadRequestOngoing = false;
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Can't get load info for CPU", null)); //$NON-NLS-1$
- return;
- }
-
- // Success - parse the second set of stat counters and compute loads
- try {
+
+ getExecutor().schedule(new Runnable() {
+ @Override
+ public void run() {
+ fCommandControl.queueCommand(
+ fCommandFactory.createCLIRemoteGet(dmc, statFile, localFile),
+ new ImmediateDataRequestMonitor<MIInfo>(rm) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ fLoadRequestOngoing = false;
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
+ INTERNAL_ERROR, "Can't get load info for CPU", null)); //$NON-NLS-1$
+ return;
+ }
+
+ // Success - parse the second set of stat counters and compute loads
+ try {
procStatParser.parseStatFile(localFile);
} catch (Exception e) {
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Can't get load info for CPU", null)); //$NON-NLS-1$
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
+ INTERNAL_ERROR, "Can't get load info for CPU", null)); //$NON-NLS-1$
fLoadRequestOngoing = false;
return;
}
- // delete temp file
- new File(localFile).delete();
-
- // Compute load
- fCachedLoads = procStatParser.getCpuLoad();
- processLoads(context, rm, fCachedLoads);
-
- // done with request
- fLoadRequestOngoing = false;
- // process any queued request
- for(Entry<IDMContext, DataRequestMonitor<ILoadInfo>> e : fLoadInfoRequestCache.entrySet()) {
- processLoads(e.getKey(), e.getValue(), fCachedLoads);
- }
- fLoadInfoRequestCache.clear();
- }
- });
- }
- }, LOAD_SAMPLE_DELAY, TimeUnit.MILLISECONDS);
- }
- });
- // Local debugging? Then we can read /proc/stat directly
- } else {
- // Read /proc/stat file for the first time
- try {
+ // delete temp file
+ new File(localFile).delete();
+
+ // Compute load
+ fCachedLoads = procStatParser.getCpuLoad();
+ processLoads(context, rm, fCachedLoads);
+
+ // done with request
+ fLoadRequestOngoing = false;
+ // process any queued request
+ for (Entry<IDMContext, DataRequestMonitor<ILoadInfo>> e : fLoadInfoRequestCache
+ .entrySet()) {
+ processLoads(e.getKey(), e.getValue(), fCachedLoads);
+ }
+ fLoadInfoRequestCache.clear();
+ }
+ });
+ }
+ }, LOAD_SAMPLE_DELAY, TimeUnit.MILLISECONDS);
+ }
+ });
+ // Local debugging? Then we can read /proc/stat directly
+ } else {
+ // Read /proc/stat file for the first time
+ try {
procStatParser.parseStatFile(statFile);
} catch (Exception e) {
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Can't get load info for CPU", null)); //$NON-NLS-1$
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Can't get load info for CPU", //$NON-NLS-1$
+ null));
fLoadRequestOngoing = false;
return;
}
-
- // Read /proc/stat file again after a delay
- getExecutor().schedule(new Runnable() {
- @Override
- public void run() {
- try {
- procStatParser.parseStatFile(statFile);
- } catch (Exception e) {
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Can't get load info for CPU", null)); //$NON-NLS-1$
- fLoadRequestOngoing = false;
- return;
- }
- // compute load
- fCachedLoads = procStatParser.getCpuLoad();
- processLoads(context, rm, fCachedLoads);
-
- // done with request
- fLoadRequestOngoing = false;
- // process any queued request
- for(Entry<IDMContext, DataRequestMonitor<ILoadInfo>> e : fLoadInfoRequestCache.entrySet()) {
- processLoads(e.getKey(), e.getValue(), fCachedLoads);
- }
- fLoadInfoRequestCache.clear();
- }
- }, LOAD_SAMPLE_DELAY, TimeUnit.MILLISECONDS);
- }
- }
-
+
+ // Read /proc/stat file again after a delay
+ getExecutor().schedule(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ procStatParser.parseStatFile(statFile);
+ } catch (Exception e) {
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR,
+ "Can't get load info for CPU", null)); //$NON-NLS-1$
+ fLoadRequestOngoing = false;
+ return;
+ }
+ // compute load
+ fCachedLoads = procStatParser.getCpuLoad();
+ processLoads(context, rm, fCachedLoads);
+
+ // done with request
+ fLoadRequestOngoing = false;
+ // process any queued request
+ for (Entry<IDMContext, DataRequestMonitor<ILoadInfo>> e : fLoadInfoRequestCache.entrySet()) {
+ processLoads(e.getKey(), e.getValue(), fCachedLoads);
+ }
+ fLoadInfoRequestCache.clear();
+ }
+ }, LOAD_SAMPLE_DELAY, TimeUnit.MILLISECONDS);
+ }
+ }
+
/**
- * For a given "load info" request, this method processes the load obtained from the
+ * For a given "load info" request, this method processes the load obtained from the
* proc stat parser and creates/sends the response.
* @param context
* @param rm
* @param loads
*/
- private void processLoads(final IDMContext context, final DataRequestMonitor<ILoadInfo> rm, final ProcStatCoreLoads loads) {
+ private void processLoads(final IDMContext context, final DataRequestMonitor<ILoadInfo> rm,
+ final ProcStatCoreLoads loads) {
// problem with fetching load info
if (loads == null) {
@@ -803,35 +828,33 @@ public class GDBHardwareAndOS extends AbstractDsfService implements IGDBHardware
String coreId = ((ICoreDMContext) context).getId();
// Integer precision sufficient for our purpose
float load = loads.getLoad(coreId);
- rm.done(new GDBLoadInfo(Integer.toString((int)load)));
- }
- else if (context instanceof ICPUDMContext) {
+ rm.done(new GDBLoadInfo(Integer.toString((int) load)));
+ } else if (context instanceof ICPUDMContext) {
// get the list of cores in that CPU
- getCores(context,
- new ImmediateDataRequestMonitor<ICoreDMContext[]>() {
- @Override
- protected void handleCompleted() {
- ICoreDMContext[] coreContexts = getData();
-
- if (!isSuccess() || coreContexts == null || coreContexts.length < 1) {
- // Unable to get any core data
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Can't get load info for CPU", null)); //$NON-NLS-1$
- return;
- }
+ getCores(context, new ImmediateDataRequestMonitor<ICoreDMContext[]>() {
+ @Override
+ protected void handleCompleted() {
+ ICoreDMContext[] coreContexts = getData();
+
+ if (!isSuccess() || coreContexts == null || coreContexts.length < 1) {
+ // Unable to get any core data
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR,
+ "Can't get load info for CPU", null)); //$NON-NLS-1$
+ return;
+ }
- int i = 0;
- float load = 0.0f;
- // compute the average load of cores in that CPU
- for (ICoreDMContext coreCtx : coreContexts) {
- String coreId = coreCtx.getId();
- load += loads.getLoad(coreId);
- i++;
- }
- load /= i;
- rm.done(new GDBLoadInfo(Integer.toString((int)load)));
- }
+ int i = 0;
+ float load = 0.0f;
+ // compute the average load of cores in that CPU
+ for (ICoreDMContext coreCtx : coreContexts) {
+ String coreId = coreCtx.getId();
+ load += loads.getLoad(coreId);
+ i++;
}
- );
+ load /= i;
+ rm.done(new GDBLoadInfo(Integer.toString((int) load)));
+ }
+ });
}
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBHardwareAndOS_7_10.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBHardwareAndOS_7_10.java
index 306e8b03495..84a56ebb196 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBHardwareAndOS_7_10.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBHardwareAndOS_7_10.java
@@ -24,91 +24,92 @@ import org.eclipse.cdt.internal.core.ICoreInfo;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-
/**
* This extension to the GDBHardwareAndOS service takes advantage of GDB providing CPU information (on Linux)
* @since 4.7
*/
public class GDBHardwareAndOS_7_10 extends GDBHardwareAndOS_7_5 {
private ICoreInfo[] coreListCache;
-
+
final static String CPUResourceClass = "cpus"; //$NON-NLS-1$
-
+
/** constructor */
public GDBHardwareAndOS_7_10(DsfSession session) {
super(session);
}
-
@Override
public void getCPUs(final IHardwareTargetDMContext dmc, final DataRequestMonitor<ICPUDMContext[]> rm) {
if (!getSessionInitializationComplete()) {
// We are not ready to answer yet
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Debug session not initialized yet", null)); //$NON-NLS-1$
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Debug session not initialized yet", //$NON-NLS-1$
+ null));
return;
}
-
+
if (coreListCache != null) {
rm.done(parseCoresInfoForCPUs(dmc, coreListCache));
return;
}
-
- getResourcesInformation(dmc, CPUResourceClass, new DataRequestMonitor<IResourcesInformation>(getExecutor(), rm) {
- @Override
- @ConfinedToDsfExecutor("getExecutor()")
- protected void handleCompleted() {
- if (isSuccess()) {
- coreListCache = new CoreList(getData()).getCoreList();
- rm.done(parseCoresInfoForCPUs(dmc, coreListCache));
- }
- else {
- // not Linux?
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Operation not supported", null)); //$NON-NLS-1$
- }
- }
- });
+
+ getResourcesInformation(dmc, CPUResourceClass,
+ new DataRequestMonitor<IResourcesInformation>(getExecutor(), rm) {
+ @Override
+ @ConfinedToDsfExecutor("getExecutor()")
+ protected void handleCompleted() {
+ if (isSuccess()) {
+ coreListCache = new CoreList(getData()).getCoreList();
+ rm.done(parseCoresInfoForCPUs(dmc, coreListCache));
+ } else {
+ // not Linux?
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED,
+ "Operation not supported", null)); //$NON-NLS-1$
+ }
+ }
+ });
}
-
+
@Override
public void getCores(IDMContext dmc, final DataRequestMonitor<ICoreDMContext[]> rm) {
if (!getSessionInitializationComplete()) {
// We are not ready to answer yet
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Debug session not initialized yet", null)); //$NON-NLS-1$
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Debug session not initialized yet", //$NON-NLS-1$
+ null));
return;
}
if (dmc instanceof ICPUDMContext) {
// Get the cores under this particular CPU
- final ICPUDMContext cpuDmc = (ICPUDMContext)dmc;
-
+ final ICPUDMContext cpuDmc = (ICPUDMContext) dmc;
+
if (coreListCache != null) {
rm.done(parseCoresInfoForCores(cpuDmc, coreListCache));
return;
}
-
- getResourcesInformation(dmc, CPUResourceClass, new DataRequestMonitor<IResourcesInformation>(getExecutor(), rm) {
- @Override
- @ConfinedToDsfExecutor("getExecutor()")
- protected void handleCompleted() {
- if (isSuccess()) {
- coreListCache = new CoreList(getData()).getCoreList();
- rm.done(parseCoresInfoForCores(cpuDmc, coreListCache));
- }
- else {
- // not Linux?
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Operation not supported", null)); //$NON-NLS-1$
- }
- }
- });
- }
- else {
+
+ getResourcesInformation(dmc, CPUResourceClass,
+ new DataRequestMonitor<IResourcesInformation>(getExecutor(), rm) {
+ @Override
+ @ConfinedToDsfExecutor("getExecutor()")
+ protected void handleCompleted() {
+ if (isSuccess()) {
+ coreListCache = new CoreList(getData()).getCoreList();
+ rm.done(parseCoresInfoForCores(cpuDmc, coreListCache));
+ } else {
+ // not Linux?
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED,
+ "Operation not supported", null)); //$NON-NLS-1$
+ }
+ }
+ });
+ } else {
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid DMC type", null)); //$NON-NLS-1$
}
}
-
+
@Override
public void flushCache(IDMContext context) {
coreListCache = null;
super.flushCache(context);
}
-
+
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBHardwareAndOS_7_5.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBHardwareAndOS_7_5.java
index 023d08b497c..ac79b7251c2 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBHardwareAndOS_7_5.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBHardwareAndOS_7_5.java
@@ -33,21 +33,19 @@ import org.eclipse.core.runtime.Status;
* @since 4.2
*/
public class GDBHardwareAndOS_7_5 extends GDBHardwareAndOS implements IGDBHardwareAndOS2 {
-
- public GDBHardwareAndOS_7_5(DsfSession session) {
- super(session);
- }
+ public GDBHardwareAndOS_7_5(DsfSession session) {
+ super(session);
+ }
- @Override
- public void initialize(final RequestMonitor requestMonitor) {
- super.initialize(new RequestMonitor(ImmediateExecutor.getInstance(), requestMonitor) {
- @Override
- protected void handleSuccess() {
- register(new String[] { IGDBHardwareAndOS2.class.getName() },
- new Hashtable<String, String>());
+ @Override
+ public void initialize(final RequestMonitor requestMonitor) {
+ super.initialize(new RequestMonitor(ImmediateExecutor.getInstance(), requestMonitor) {
+ @Override
+ protected void handleSuccess() {
+ register(new String[] { IGDBHardwareAndOS2.class.getName() }, new Hashtable<String, String>());
- requestMonitor.done();
+ requestMonitor.done();
}
});
}
@@ -73,7 +71,8 @@ public class GDBHardwareAndOS_7_5 extends GDBHardwareAndOS implements IGDBHardwa
}
@Override
- public void getResourcesInformation(final IDMContext dmc, final String resourceClass, final DataRequestMonitor<IResourcesInformation> rm) {
+ public void getResourcesInformation(final IDMContext dmc, final String resourceClass,
+ final DataRequestMonitor<IResourcesInformation> rm) {
IGDBControl control = getServicesTracker().getService(IGDBControl.class);
if (control == null) {
@@ -82,13 +81,14 @@ public class GDBHardwareAndOS_7_5 extends GDBHardwareAndOS implements IGDBHardwa
}
CommandFactory factory = control.getCommandFactory();
- control.queueCommand(factory.createMIInfoOS(dmc, resourceClass), new DataRequestMonitor<MIInfoOsInfo>(getExecutor(), rm) {
+ control.queueCommand(factory.createMIInfoOS(dmc, resourceClass),
+ new DataRequestMonitor<MIInfoOsInfo>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- rm.setData(getData().getResourcesInformation());
- rm.done();
- }
- });
+ @Override
+ protected void handleSuccess() {
+ rm.setData(getData().getResourcesInformation());
+ rm.done();
+ }
+ });
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBMemory.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBMemory.java
index f08c19441cd..7576a4ff969 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBMemory.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBMemory.java
@@ -10,7 +10,7 @@
*
* Contributors:
* Mentor Graphics - Initial API and implementation
- * John Dallaway - Add methods to get the endianness and address size (Bug 225609)
+ * John Dallaway - Add methods to get the endianness and address size (Bug 225609)
* Philippe Gil (AdaCore) - Switch to c language when getting sizeof(void *) when required (Bug 421541)
* Alvaro Sanchez-Leon (Ericsson AB) - [Memory] Support 16 bit addressable size (Bug 426730)
*******************************************************************************/
@@ -58,17 +58,17 @@ public class GDBMemory extends MIMemory implements IGDBMemory2 {
private IGDBControl fCommandControl;
/**
- * Cache of the address sizes for each memory context.
+ * Cache of the address sizes for each memory context.
*/
private Map<IMemoryDMContext, Integer> fAddressSizes = new HashMap<IMemoryDMContext, Integer>();
/**
- * Cache of the addressable sizes for each memory context.
+ * Cache of the addressable sizes for each memory context.
*/
private Map<IMemoryDMContext, Integer> fAddressableSizes = new HashMap<IMemoryDMContext, Integer>();
-
+
/**
- * Cache of the endianness for each memory context.
+ * Cache of the endianness for each memory context.
*/
private Map<IMemoryDMContext, Boolean> fIsBigEndian = new HashMap<>();
@@ -89,51 +89,39 @@ public class GDBMemory extends MIMemory implements IGDBMemory2 {
private void doInitialize(final RequestMonitor requestMonitor) {
fCommandControl = getServicesTracker().getService(IGDBControl.class);
getSession().addServiceEventListener(this, null);
- register(
- new String[] {
- IMemory.class.getName(),
- MIMemory.class.getName(),
- IGDBMemory.class.getName(),
- IGDBMemory2.class.getName(),
- GDBMemory.class.getName(),
- },
- new Hashtable<String, String>());
+ register(new String[] { IMemory.class.getName(), MIMemory.class.getName(), IGDBMemory.class.getName(),
+ IGDBMemory2.class.getName(), GDBMemory.class.getName(), }, new Hashtable<String, String>());
requestMonitor.done();
}
@Override
public void shutdown(RequestMonitor requestMonitor) {
unregister();
- getSession().removeServiceEventListener(this);
- fAddressableSizes.clear();
+ getSession().removeServiceEventListener(this);
+ fAddressableSizes.clear();
fAddressSizes.clear();
super.shutdown(requestMonitor);
}
@Override
- protected void readMemoryBlock(final IDMContext dmc, IAddress address,
- long offset, int word_size, int word_count, final DataRequestMonitor<MemoryByte[]> drm) {
- super.readMemoryBlock(
- dmc,
- address,
- offset,
- word_size,
- word_count,
- new DataRequestMonitor<MemoryByte[]>(ImmediateExecutor.getInstance(), drm) {
- @Override
- protected void handleSuccess() {
- IMemoryDMContext memDmc = DMContexts.getAncestorOfType(dmc, IMemoryDMContext.class);
- if (memDmc != null) {
- boolean bigEndian = isBigEndian(memDmc);
- for (MemoryByte b : getData()) {
- b.setBigEndian(bigEndian);
- b.setEndianessKnown(true);
+ protected void readMemoryBlock(final IDMContext dmc, IAddress address, long offset, int word_size, int word_count,
+ final DataRequestMonitor<MemoryByte[]> drm) {
+ super.readMemoryBlock(dmc, address, offset, word_size, word_count,
+ new DataRequestMonitor<MemoryByte[]>(ImmediateExecutor.getInstance(), drm) {
+ @Override
+ protected void handleSuccess() {
+ IMemoryDMContext memDmc = DMContexts.getAncestorOfType(dmc, IMemoryDMContext.class);
+ if (memDmc != null) {
+ boolean bigEndian = isBigEndian(memDmc);
+ for (MemoryByte b : getData()) {
+ b.setBigEndian(bigEndian);
+ b.setEndianessKnown(true);
+ }
}
+ drm.setData(getData());
+ drm.done();
}
- drm.setData(getData());
- drm.done();
- }
- });
+ });
}
@Override
@@ -146,56 +134,55 @@ public class GDBMemory extends MIMemory implements IGDBMemory2 {
// Need a global here as getSteps() can be called more than once.
private Step[] steps = null;
- private void determineSteps()
- {
+
+ private void determineSteps() {
ArrayList<Step> stepsList = new ArrayList<Step>();
-
+
if (fAddressSizes.get(memContext) == null) {
- stepsList.add(
- new Step() {
- // store original language
- @Override
- public void execute(final RequestMonitor requestMonitor) {
- fCommandControl.queueCommand(
- fCommandControl.getCommandFactory().createMIGDBShowLanguage(memContext),
- new ImmediateDataRequestMonitor<MIGDBShowLanguageInfo>(requestMonitor) {
- @Override
- protected void handleCompleted() {
- if (isSuccess()) {
- originalLanguage = getData().getLanguage();
- } else {
- abortLanguageSteps = true;
- }
- requestMonitor.done();
+ stepsList.add(new Step() {
+ // store original language
+ @Override
+ public void execute(final RequestMonitor requestMonitor) {
+ fCommandControl.queueCommand(
+ fCommandControl.getCommandFactory().createMIGDBShowLanguage(memContext),
+ new ImmediateDataRequestMonitor<MIGDBShowLanguageInfo>(requestMonitor) {
+ @Override
+ protected void handleCompleted() {
+ if (isSuccess()) {
+ originalLanguage = getData().getLanguage();
+ } else {
+ abortLanguageSteps = true;
}
- });
- }
- });
- stepsList.add(
- new Step() {
- // switch to c language
- @Override
- public void execute(final RequestMonitor requestMonitor) {
- if (abortLanguageSteps) {
- requestMonitor.done();
- return;
- }
+ requestMonitor.done();
+ }
+ });
+ }
+ });
+ stepsList.add(new Step() {
+ // switch to c language
+ @Override
+ public void execute(final RequestMonitor requestMonitor) {
+ if (abortLanguageSteps) {
+ requestMonitor.done();
+ return;
+ }
+
+ fCommandControl.queueCommand(
+ fCommandControl.getCommandFactory().createMIGDBSetLanguage(memContext,
+ MIGDBShowLanguageInfo.C),
+ new ImmediateDataRequestMonitor<MIInfo>(requestMonitor) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ abortLanguageSteps = true;
+ }
+ // Accept failure
+ requestMonitor.done();
+ }
+ });
+ }
+ });
- fCommandControl.queueCommand(
- fCommandControl.getCommandFactory().createMIGDBSetLanguage(memContext, MIGDBShowLanguageInfo.C),
- new ImmediateDataRequestMonitor<MIInfo>(requestMonitor) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- abortLanguageSteps = true;
- }
- // Accept failure
- requestMonitor.done();
- }
- });
- }
- });
-
stepsList.add(new Step() {
// Run this step even if the language commands where aborted, but accept failures.
// Resolve Addressable and Address size
@@ -210,93 +197,95 @@ public class GDBMemory extends MIMemory implements IGDBMemory2 {
//Preserve the addressable size per context
fAddressableSizes.put(memContext, minAddressableInOctets);
}
-
- readAddressSize(memContext, new ImmediateDataRequestMonitor<Integer>(requestMonitor) {
- @Override
- protected void handleCompleted() {
- if (isSuccess()) {
- //Preserve the address size per context
- fAddressSizes.put(memContext, getData());
- }
- // Accept failures
- requestMonitor.done();
- }
- });
+ readAddressSize(memContext,
+ new ImmediateDataRequestMonitor<Integer>(requestMonitor) {
+ @Override
+ protected void handleCompleted() {
+ if (isSuccess()) {
+ //Preserve the address size per context
+ fAddressSizes.put(memContext, getData());
+ }
+
+ // Accept failures
+ requestMonitor.done();
+ }
+ });
}
});
}
});
-
- stepsList.add(
- new Step() {
- // restore original language
- @Override
- public void execute(final RequestMonitor requestMonitor) {
- if (abortLanguageSteps) {
- requestMonitor.done();
- return;
- }
- fCommandControl.queueCommand(
- fCommandControl.getCommandFactory().createMIGDBSetLanguage(memContext, originalLanguage),
- new ImmediateDataRequestMonitor<MIInfo>(requestMonitor) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- // If we are unable to set the original language back things could be bad.
- // Let's try setting it to "auto" as a fall back. Log the situation as info.
- GdbPlugin.log(getStatus());
-
- fCommandControl.queueCommand(
- fCommandControl.getCommandFactory().createMIGDBSetLanguage(memContext, MIGDBShowLanguageInfo.AUTO),
- new ImmediateDataRequestMonitor<MIInfo>(requestMonitor) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- // This error could be bad because we've changed the language to C
- // but are unable to switch it back. Log the error.
- // If the language happens to be C anyway, everything will
- // continue to work, which is why we don't abort the sequence
- // (which would cause the entire session to fail).
- GdbPlugin.log(getStatus());
+ stepsList.add(new Step() {
+ // restore original language
+ @Override
+ public void execute(final RequestMonitor requestMonitor) {
+ if (abortLanguageSteps) {
+ requestMonitor.done();
+ return;
+ }
+
+ fCommandControl
+ .queueCommand(
+ fCommandControl.getCommandFactory().createMIGDBSetLanguage(memContext,
+ originalLanguage),
+ new ImmediateDataRequestMonitor<MIInfo>(requestMonitor) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ // If we are unable to set the original language back things could be bad.
+ // Let's try setting it to "auto" as a fall back. Log the situation as info.
+ GdbPlugin.log(getStatus());
+
+ fCommandControl.queueCommand(
+ fCommandControl.getCommandFactory()
+ .createMIGDBSetLanguage(memContext,
+ MIGDBShowLanguageInfo.AUTO),
+ new ImmediateDataRequestMonitor<MIInfo>(
+ requestMonitor) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ // This error could be bad because we've changed the language to C
+ // but are unable to switch it back. Log the error.
+ // If the language happens to be C anyway, everything will
+ // continue to work, which is why we don't abort the sequence
+ // (which would cause the entire session to fail).
+ GdbPlugin.log(getStatus());
+ }
+ // Accept failure
+ requestMonitor.done();
}
- // Accept failure
- requestMonitor.done();
- }
- });
- } else {
- requestMonitor.done();
+ });
+ } else {
+ requestMonitor.done();
+ }
}
- }
- });
- }
- });
-
+ });
+ }
+ });
+
}
if (fIsBigEndian.get(memContext) == null) {
- stepsList.add(
- new Step() {
- // read endianness
- @Override
- public void execute(final RequestMonitor requestMonitor) {
- readEndianness(
- memContext,
- new ImmediateDataRequestMonitor<Boolean>(requestMonitor) {
- @Override
- protected void handleCompleted() {
- if (isSuccess()) {
- fIsBigEndian.put(memContext, getData());
- }
- // Accept failure
- requestMonitor.done();
- }
- });
+ stepsList.add(new Step() {
+ // read endianness
+ @Override
+ public void execute(final RequestMonitor requestMonitor) {
+ readEndianness(memContext, new ImmediateDataRequestMonitor<Boolean>(requestMonitor) {
+ @Override
+ protected void handleCompleted() {
+ if (isSuccess()) {
+ fIsBigEndian.put(memContext, getData());
+ }
+ // Accept failure
+ requestMonitor.done();
}
});
+ }
+ });
}
-
+
steps = stepsList.toArray(new Step[stepsList.size()]);
}
@@ -342,14 +331,15 @@ public class GDBMemory extends MIMemory implements IGDBMemory2 {
Boolean isBigEndian = fIsBigEndian.get(context);
assert isBigEndian != null;
if (isBigEndian == null) {
- GdbPlugin.log(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Endianness was never initialized for " + context)); //$NON-NLS-1$
+ GdbPlugin.log(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Endianness was never initialized for " + context)); //$NON-NLS-1$
return false;
}
return isBigEndian.booleanValue();
}
/**
- * Address size is determined by space, in octets, used to store an address value (e.g. a pointer) on a target system.
+ * Address size is determined by space, in octets, used to store an address value (e.g. a pointer) on a target system.
*
* <p>NOTE: Implementation requires addressable memory size to be known</p>
* @param memContext
@@ -362,62 +352,59 @@ public class GDBMemory extends MIMemory implements IGDBMemory2 {
IExpressions exprService = getServicesTracker().getService(IExpressions.class);
IExpressionDMContext exprContext = exprService.createExpression(memContext, "sizeof (void*)"); //$NON-NLS-1$
CommandFactory commandFactory = fCommandControl.getCommandFactory();
- fCommandControl.queueCommand(
- commandFactory.createMIDataEvaluateExpression(exprContext),
- new DataRequestMonitor<MIDataEvaluateExpressionInfo>(ImmediateExecutor.getInstance(), drm) {
- @Override
- protected void handleSuccess() {
- try {
- // 'sizeof' returns number of bytes (aka 'chars').
- // Multiply with byte size in octets to get storage required to hold a pointer.
- Integer ptrBytes = Integer.decode(getData().getValue());
- drm.setData(ptrBytes * getAddressableSize(memContext));
- }
- catch(NumberFormatException e) {
- drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, String.format("Invalid address size: %s", getData().getValue()))); //$NON-NLS-1$
+ fCommandControl.queueCommand(commandFactory.createMIDataEvaluateExpression(exprContext),
+ new DataRequestMonitor<MIDataEvaluateExpressionInfo>(ImmediateExecutor.getInstance(), drm) {
+ @Override
+ protected void handleSuccess() {
+ try {
+ // 'sizeof' returns number of bytes (aka 'chars').
+ // Multiply with byte size in octets to get storage required to hold a pointer.
+ Integer ptrBytes = Integer.decode(getData().getValue());
+ drm.setData(ptrBytes * getAddressableSize(memContext));
+ } catch (NumberFormatException e) {
+ drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
+ String.format("Invalid address size: %s", getData().getValue()))); //$NON-NLS-1$
+ }
+ drm.done();
}
- drm.done();
- }
- });
+ });
}
/**
* The minimum addressable size is determined by the space used to store a "char" on a target system
* This is then resolved by retrieving a hex representation of -1 casted to the size of a "char"
- * e.g. from GDB command line
+ * e.g. from GDB command line
* > p/x (char)-1
- * > $7 = 0xffff
- *
- * Since two hex characters are representing one octet, for the above example this method should return 2
+ * > $7 = 0xffff
+ *
+ * Since two hex characters are representing one octet, for the above example this method should return 2
* @since 4.4
- *
+ *
*/
protected void readAddressableSize(IMemoryDMContext memContext, final DataRequestMonitor<Integer> drm) {
- //We use a CLI command here instead of the expression services, since the target may not be available
- //e.g. when using a remote launch.
- // Using MI directly is a possibility although there is no way to specify the required output format to hex.
+ //We use a CLI command here instead of the expression services, since the target may not be available
+ //e.g. when using a remote launch.
+ // Using MI directly is a possibility although there is no way to specify the required output format to hex.
CommandFactory commandFactory = fCommandControl.getCommandFactory();
- fCommandControl.queueCommand(
- commandFactory.createCLIAddressableSize(memContext),
- new DataRequestMonitor<CLIAddressableSizeInfo>(ImmediateExecutor.getInstance(), drm) {
- @Override
- protected void handleSuccess() {
- drm.setData(Integer.valueOf(getData().getAddressableSize()));
- drm.done();
- }
- });
+ fCommandControl.queueCommand(commandFactory.createCLIAddressableSize(memContext),
+ new DataRequestMonitor<CLIAddressableSizeInfo>(ImmediateExecutor.getInstance(), drm) {
+ @Override
+ protected void handleSuccess() {
+ drm.setData(Integer.valueOf(getData().getAddressableSize()));
+ drm.done();
+ }
+ });
}
-
+
protected void readEndianness(IMemoryDMContext memContext, final DataRequestMonitor<Boolean> drm) {
CommandFactory commandFactory = fCommandControl.getCommandFactory();
- fCommandControl.queueCommand(
- commandFactory.createCLIShowEndian(memContext),
- new DataRequestMonitor<CLIShowEndianInfo>(ImmediateExecutor.getInstance(), drm) {
- @Override
- protected void handleSuccess() {
- drm.setData(Boolean.valueOf(getData().isBigEndian()));
- drm.done();
- }
- });
+ fCommandControl.queueCommand(commandFactory.createCLIShowEndian(memContext),
+ new DataRequestMonitor<CLIShowEndianInfo>(ImmediateExecutor.getInstance(), drm) {
+ @Override
+ protected void handleSuccess() {
+ drm.setData(Boolean.valueOf(getData().isBigEndian()));
+ drm.done();
+ }
+ });
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBMemory_7_0.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBMemory_7_0.java
index 565f7d94c0a..c1618de5aac 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBMemory_7_0.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBMemory_7_0.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
* Alvaro Sanchez-Leon (Ericsson AB) - [Memory] Support 16 bit addressable size (Bug 426730)
@@ -40,25 +40,19 @@ public class GDBMemory_7_0 extends GDBMemory {
@Override
public void initialize(final RequestMonitor requestMonitor) {
- super.initialize(
- new ImmediateRequestMonitor(requestMonitor) {
- @Override
- public void handleSuccess() {
- doInitialize(requestMonitor);
- }});
+ super.initialize(new ImmediateRequestMonitor(requestMonitor) {
+ @Override
+ public void handleSuccess() {
+ doInitialize(requestMonitor);
+ }
+ });
}
private void doInitialize(final RequestMonitor requestMonitor) {
register(
- new String[] {
- MIMemory.class.getName(),
- IMemory.class.getName(),
- IGDBMemory.class.getName(),
- IGDBMemory2.class.getName(),
- GDBMemory.class.getName(),
- GDBMemory_7_0.class.getName()
- },
- new Hashtable<String, String>());
+ new String[] { MIMemory.class.getName(), IMemory.class.getName(), IGDBMemory.class.getName(),
+ IGDBMemory2.class.getName(), GDBMemory.class.getName(), GDBMemory_7_0.class.getName() },
+ new Hashtable<String, String>());
requestMonitor.done();
}
@@ -70,9 +64,8 @@ public class GDBMemory_7_0 extends GDBMemory {
}
@Override
- protected void readMemoryBlock(IDMContext dmc, IAddress address, long offset,
- int word_size, int word_count, DataRequestMonitor<MemoryByte[]> drm)
- {
+ protected void readMemoryBlock(IDMContext dmc, IAddress address, long offset, int word_size, int word_count,
+ DataRequestMonitor<MemoryByte[]> drm) {
IDMContext threadOrMemoryDmc = dmc;
// A memory context is a container. We have two limitations with GDB here:
@@ -83,7 +76,7 @@ public class GDBMemory_7_0 extends GDBMemory {
// we can have some threads running with others stopped, so we need to choose a thread that is
// actually stopped.
IMIContainerDMContext containerCtx = DMContexts.getAncestorOfType(dmc, IMIContainerDMContext.class);
- if(containerCtx != null) {
+ if (containerCtx != null) {
IGDBProcesses procService = getServicesTracker().getService(IGDBProcesses.class);
IRunControl runControl = getServicesTracker().getService(IRunControl.class);
@@ -99,7 +92,8 @@ public class GDBMemory_7_0 extends GDBMemory {
// Not so fast, Charlie. The context we were given may have
// a memory space qualifier. We need to preserve it.
if (dmc instanceof IMemorySpaceDMContext) {
- threadOrMemoryDmc = new MemorySpaceDMContext(getSession().getId(), ((IMemorySpaceDMContext)dmc).getMemorySpaceId(), threadOrMemoryDmc);
+ threadOrMemoryDmc = new MemorySpaceDMContext(getSession().getId(),
+ ((IMemorySpaceDMContext) dmc).getMemorySpaceId(), threadOrMemoryDmc);
}
break;
}
@@ -112,9 +106,8 @@ public class GDBMemory_7_0 extends GDBMemory {
}
@Override
- protected void writeMemoryBlock(IDMContext dmc, IAddress address, long offset,
- int word_size, int word_count, byte[] buffer, RequestMonitor rm)
- {
+ protected void writeMemoryBlock(IDMContext dmc, IAddress address, long offset, int word_size, int word_count,
+ byte[] buffer, RequestMonitor rm) {
IDMContext threadOrMemoryDmc = dmc;
// A memory context is a container. We have two limitations with GDB here:
@@ -125,7 +118,7 @@ public class GDBMemory_7_0 extends GDBMemory {
// we can have some threads running with others stopped, so we need to choose a thread that is
// actually stopped.
IMIContainerDMContext containerCtx = DMContexts.getAncestorOfType(dmc, IMIContainerDMContext.class);
- if(containerCtx != null) {
+ if (containerCtx != null) {
IGDBProcesses procService = getServicesTracker().getService(IGDBProcesses.class);
IRunControl runControl = getServicesTracker().getService(IRunControl.class);
@@ -141,7 +134,8 @@ public class GDBMemory_7_0 extends GDBMemory {
// Not so fast, Charlie. The context we were given may have
// a memory space qualifier. We need to preserve it.
if (dmc instanceof IMemorySpaceDMContext) {
- threadOrMemoryDmc = new MemorySpaceDMContext(getSession().getId(), ((IMemorySpaceDMContext)dmc).getMemorySpaceId(), threadOrMemoryDmc);
+ threadOrMemoryDmc = new MemorySpaceDMContext(getSession().getId(),
+ ((IMemorySpaceDMContext) dmc).getMemorySpaceId(), threadOrMemoryDmc);
}
break;
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBMemory_7_6.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBMemory_7_6.java
index 55dfd40e609..52d630c13f7 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBMemory_7_6.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBMemory_7_6.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Marc Khouzam (Ericsson) - initial API and implementation
* Alvaro Sanchez-Leon (Ericsson AB) - [Memory] Support 16 bit addressable size (Bug 426730)
@@ -41,7 +41,7 @@ import org.eclipse.core.runtime.Status;
/**
* Memory service that uses the enhancements from GDB 7.6:
* =memory-changed MI event
- *
+ *
* @since 4.2
*/
public class GDBMemory_7_6 extends GDBMemory_7_0 implements IEventListener {
@@ -54,31 +54,27 @@ public class GDBMemory_7_6 extends GDBMemory_7_0 implements IEventListener {
@Override
public void initialize(final RequestMonitor requestMonitor) {
- super.initialize(
- new ImmediateRequestMonitor(requestMonitor) {
- @Override
- public void handleSuccess() {
- doInitialize(requestMonitor);
- }});
+ super.initialize(new ImmediateRequestMonitor(requestMonitor) {
+ @Override
+ public void handleSuccess() {
+ doInitialize(requestMonitor);
+ }
+ });
}
private void doInitialize(final RequestMonitor requestMonitor) {
- register(new String[] { MIMemory.class.getName(),
- IMemory.class.getName(),
- IGDBMemory.class.getName(),
- IGDBMemory2.class.getName(),
- GDBMemory.class.getName(),
- GDBMemory_7_0.class.getName(),
- GDBMemory_7_6.class.getName()},
- new Hashtable<String, String>());
-
+ register(new String[] { MIMemory.class.getName(), IMemory.class.getName(), IGDBMemory.class.getName(),
+ IGDBMemory2.class.getName(), GDBMemory.class.getName(), GDBMemory_7_0.class.getName(),
+ GDBMemory_7_6.class.getName() }, new Hashtable<String, String>());
+
fConnection = getServicesTracker().getService(ICommandControlService.class);
if (fConnection == null) {
- requestMonitor.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "CommandControl Service is not available")); //$NON-NLS-1$
+ requestMonitor
+ .done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "CommandControl Service is not available")); //$NON-NLS-1$
return;
}
fConnection.addEventListener(this);
-
+
requestMonitor.done();
}
@@ -92,77 +88,81 @@ public class GDBMemory_7_6 extends GDBMemory_7_0 implements IEventListener {
@Override
public void eventReceived(Object output) {
if (output instanceof MIOutput) {
- MIOOBRecord[] records = ((MIOutput)output).getMIOOBRecords();
+ MIOOBRecord[] records = ((MIOutput) output).getMIOOBRecords();
for (MIOOBRecord r : records) {
if (r instanceof MINotifyAsyncOutput) {
- MINotifyAsyncOutput notifyOutput = (MINotifyAsyncOutput)r;
+ MINotifyAsyncOutput notifyOutput = (MINotifyAsyncOutput) r;
String asyncClass = notifyOutput.getAsyncClass();
// These events have been added with GDB 7.6
if ("memory-changed".equals(asyncClass)) { //$NON-NLS-1$
- String groupId = null;
- String addr = null;
- int count = 0;
+ String groupId = null;
+ String addr = null;
+ int count = 0;
+
+ MIResult[] results = notifyOutput.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ MIValue val = results[i].getMIValue();
+ if (var.equals("thread-group")) { //$NON-NLS-1$
+ if (val instanceof MIConst) {
+ groupId = ((MIConst) val).getString();
+ }
+ } else if (var.equals("addr")) { //$NON-NLS-1$
+ if (val instanceof MIConst) {
+ addr = ((MIConst) val).getString();
+ }
+ } else if (var.equals("len")) { //$NON-NLS-1$
+ if (val instanceof MIConst) {
+ try {
+ String lenStr = ((MIConst) val).getString().trim();
+ // count is expected in addressable units
+ if (lenStr.startsWith("0x")) { //$NON-NLS-1$
+ count = Integer.parseInt(lenStr.substring(2), 16);
+ } else {
+ count = Integer.parseInt(lenStr);
+ }
+ } catch (NumberFormatException e) {
+ assert false;
+ }
+ }
+ } else if (var.equals("type")) { //$NON-NLS-1$
+ if (val instanceof MIConst) {
+ if ("code".equals(((MIConst) val).getString())) { //$NON-NLS-1$
+ }
+ }
+ }
+ }
+
+ IMIProcesses procService = getServicesTracker().getService(IMIProcesses.class);
+ if (procService != null && groupId != null && addr != null && count > 0) {
+ IContainerDMContext containerDmc = procService
+ .createContainerContextFromGroupId(fConnection.getContext(), groupId);
+
+ // Now refresh our memory cache, it case it contained this address. Don't have
+ // it send the potential IMemoryChangedEvent as we will send it ourselves (see below).
+ final IMemoryDMContext memoryDMC = DMContexts.getAncestorOfType(containerDmc,
+ IMemoryDMContext.class);
- MIResult[] results = notifyOutput.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- MIValue val = results[i].getMIValue();
- if (var.equals("thread-group")) { //$NON-NLS-1$
- if (val instanceof MIConst) {
- groupId = ((MIConst)val).getString();
- }
- } else if (var.equals("addr")) { //$NON-NLS-1$
- if (val instanceof MIConst) {
- addr = ((MIConst)val).getString();
- }
- } else if (var.equals("len")) { //$NON-NLS-1$
- if (val instanceof MIConst) {
- try {
- String lenStr = ((MIConst)val).getString().trim();
- // count is expected in addressable units
- if (lenStr.startsWith("0x")) { //$NON-NLS-1$
- count = Integer.parseInt(lenStr.substring(2), 16);
- } else {
- count = Integer.parseInt(lenStr);
- }
- } catch (NumberFormatException e) {
- assert false;
- }
- }
- } else if (var.equals("type")) { //$NON-NLS-1$
- if (val instanceof MIConst) {
- if ("code".equals(((MIConst)val).getString())) { //$NON-NLS-1$
- }
- }
- }
- }
-
- IMIProcesses procService = getServicesTracker().getService(IMIProcesses.class);
- if (procService != null && groupId != null && addr != null && count > 0) {
- IContainerDMContext containerDmc =
- procService.createContainerContextFromGroupId(fConnection.getContext(), groupId);
-
- // Now refresh our memory cache, it case it contained this address. Don't have
- // it send the potential IMemoryChangedEvent as we will send it ourselves (see below).
- final IMemoryDMContext memoryDMC = DMContexts.getAncestorOfType(containerDmc, IMemoryDMContext.class);
-
- final IAddress address = new Addr64(addr);
- getMemoryCache(memoryDMC).refreshMemory(memoryDMC, address, 0, getAddressableSize(memoryDMC), count, false,
- new RequestMonitor(getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- // Only once the memory cache is updated, we send the IMemoryChangedEvent. If we were to do it
- // earlier, the memory view may not show the updated value.
- //
- // We must always send this event when GDB reports a memory change because it can mean that
- // an expression or register has changed, and therefore we must notify the different views
- // and services of it. We cannot rely on this event to be sent by the memory cache after being
- // refreshed, because if the memory cache does not contain this address, it will not send
- // the event.
- getSession().dispatchEvent(new MemoryChangedEvent(memoryDMC, new IAddress[] { address }), getProperties());
- }
- });
- }
+ final IAddress address = new Addr64(addr);
+ getMemoryCache(memoryDMC).refreshMemory(memoryDMC, address, 0,
+ getAddressableSize(memoryDMC), count, false,
+ new RequestMonitor(getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ // Only once the memory cache is updated, we send the IMemoryChangedEvent. If we were to do it
+ // earlier, the memory view may not show the updated value.
+ //
+ // We must always send this event when GDB reports a memory change because it can mean that
+ // an expression or register has changed, and therefore we must notify the different views
+ // and services of it. We cannot rely on this event to be sent by the memory cache after being
+ // refreshed, because if the memory cache does not contain this address, it will not send
+ // the event.
+ getSession().dispatchEvent(
+ new MemoryChangedEvent(memoryDMC, new IAddress[] { address }),
+ getProperties());
+ }
+ });
+ }
}
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBPatternMatchingExpressions.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBPatternMatchingExpressions.java
index a1c7175388c..79a778f04e2 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBPatternMatchingExpressions.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBPatternMatchingExpressions.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Marc Khouzam (Ericsson) - initial API and implementation
* Grzegorz Kuligowski - Cannot cast to type that contain commas (bug 393474)
@@ -82,10 +82,10 @@ public class GDBPatternMatchingExpressions extends AbstractDsfService implements
private final static String REGISTER_PREFIX = "$"; //$NON-NLS-1$
private final static String GLOB_EXPRESSION_PREFIX = "="; //$NON-NLS-1$
-
+
/**
* This regular expression describes the supported content of an array index range.
- * Valid range formats are are numbers, possibly separated by - and/or ,.
+ * Valid range formats are are numbers, possibly separated by - and/or ,.
* E.g, "23-56" or "32" or "23, 45-67, 12-15"
*/
private static final String ARRAY_INDEX_RANGE_REGEXP = "^*\\d+(\\s*-\\s*\\d+)?(\\s*,\\s*\\d+(\\s*-\\s*\\d+)?)*$";//$NON-NLS-1$
@@ -94,14 +94,14 @@ public class GDBPatternMatchingExpressions extends AbstractDsfService implements
* An expression-group is an expression that requires expansion into a (potentially empty)
* list of sub-expressions. Using an expression-group allows the user to create groups
* of expressions very quickly.
- *
+ *
* We support two aspects for expression-goups:
* 1- The glob syntax (http://www.kernel.org/doc/man-pages/online/pages/man7/glob.7.html)
* This allows to user to specify glob-patterns to match different expressions.
* 2- Separated expressions, each potentially using the glob-syntax
*/
protected static class ExpressionGroupDMC implements IExpressionGroupDMContext {
- /**
+ /**
* The expression context, as created by the main Expression service.
* We delegate the handling of the expression to it.
*/
@@ -114,7 +114,7 @@ public class GDBPatternMatchingExpressions extends AbstractDsfService implements
protected IExpressionDMContext getExprDelegate() {
return fExprDelegate;
}
-
+
@Override
public String getExpression() {
return fExprDelegate.getExpression();
@@ -124,23 +124,25 @@ public class GDBPatternMatchingExpressions extends AbstractDsfService implements
public String getSessionId() {
return fExprDelegate.getSessionId();
}
-
+
@Override
public IDMContext[] getParents() {
return fExprDelegate.getParents();
};
-
+
@Override
public <T> T getAdapter(Class<T> adapterType) {
return fExprDelegate.getAdapter(adapterType);
}
-
+
@Override
public boolean equals(Object obj) {
- if (this == obj) return true;
- if (!(obj instanceof ExpressionGroupDMC)) return false;
-
- return ((ExpressionGroupDMC)obj).fExprDelegate.equals(fExprDelegate);
+ if (this == obj)
+ return true;
+ if (!(obj instanceof ExpressionGroupDMC))
+ return false;
+
+ return ((ExpressionGroupDMC) obj).fExprDelegate.equals(fExprDelegate);
}
@Override
@@ -153,7 +155,7 @@ public class GDBPatternMatchingExpressions extends AbstractDsfService implements
return "Group: " + getExprDelegate().toString(); //$NON-NLS-1$
}
}
-
+
/**
* The model data interface for expression-groups
*/
@@ -163,11 +165,11 @@ public class GDBPatternMatchingExpressions extends AbstractDsfService implements
public ExpressionGroupDMData(String expr, int numChildren) {
assert expr != null;
-
- fRelativeExpression = expr;
- fNumChildren = numChildren;
+
+ fRelativeExpression = expr;
+ fNumChildren = numChildren;
}
-
+
@Override
public String getName() {
return fRelativeExpression;
@@ -207,30 +209,32 @@ public class GDBPatternMatchingExpressions extends AbstractDsfService implements
public boolean hasChildren() {
return fNumChildren > 0;
}
-
+
@Override
public boolean equals(Object other) {
- if (this == other) return true;
- if (!(other instanceof ExpressionGroupDMData)) return false;
- return fRelativeExpression.equals(((ExpressionGroupDMData)other).fRelativeExpression);
+ if (this == other)
+ return true;
+ if (!(other instanceof ExpressionGroupDMData))
+ return false;
+ return fRelativeExpression.equals(((ExpressionGroupDMData) other).fRelativeExpression);
}
-
+
@Override
public int hashCode() {
return fRelativeExpression.hashCode();
}
-
+
@Override
public String toString() {
return "ExprGroup: " + fRelativeExpression; //$NON-NLS-1$
}
}
-
+
/**
* The base expression service to which we delegate all non-expression-group logic.
*/
private IMIExpressions fDelegate;
-
+
public GDBPatternMatchingExpressions(DsfSession session, IMIExpressions delegate) {
super(session);
fDelegate = delegate;
@@ -238,12 +242,12 @@ public class GDBPatternMatchingExpressions extends AbstractDsfService implements
@Override
public void initialize(final RequestMonitor requestMonitor) {
- super.initialize(
- new ImmediateRequestMonitor(requestMonitor) {
- @Override
- public void handleSuccess() {
- doInitialize(requestMonitor);
- }});
+ super.initialize(new ImmediateRequestMonitor(requestMonitor) {
+ @Override
+ public void handleSuccess() {
+ doInitialize(requestMonitor);
+ }
+ });
}
private void doInitialize(final RequestMonitor requestMonitor) {
@@ -253,12 +257,11 @@ public class GDBPatternMatchingExpressions extends AbstractDsfService implements
// We must first register this service to let the original
// expression service know that it should not register itself.
- register(new String[] { IExpressions.class.getName(),
- IExpressions2.class.getName(),
- IExpressions3.class.getName(),
- IMIExpressions.class.getName() },
- new Hashtable<String, String>());
-
+ register(
+ new String[] { IExpressions.class.getName(), IExpressions2.class.getName(),
+ IExpressions3.class.getName(), IMIExpressions.class.getName() },
+ new Hashtable<String, String>());
+
// Second, we initialize the delegate so it can perform its duties
fDelegate.initialize(requestMonitor);
}
@@ -282,7 +285,7 @@ public class GDBPatternMatchingExpressions extends AbstractDsfService implements
@Override
public IExpressionDMContext createExpression(IDMContext ctx, String expression) {
IExpressionDMContext expressionDmc = fDelegate.createExpression(ctx, expression);
-
+
if (isExpressionGroup(expression)) {
return new ExpressionGroupDMC(expressionDmc);
} else {
@@ -294,38 +297,38 @@ public class GDBPatternMatchingExpressions extends AbstractDsfService implements
public ICastedExpressionDMContext createCastedExpression(IExpressionDMContext context, CastInfo castInfo) {
// Cannot cast an expression-group
assert (!(context instanceof IExpressionGroupDMContext));
-
+
return fDelegate.createCastedExpression(context, castInfo);
}
@Override
- public void getExpressionDataExtension(final IExpressionDMContext dmc, final DataRequestMonitor<IExpressionDMDataExtension> rm) {
+ public void getExpressionDataExtension(final IExpressionDMContext dmc,
+ final DataRequestMonitor<IExpressionDMDataExtension> rm) {
if (dmc instanceof IExpressionGroupDMContext) {
getSubExpressionCount(dmc, new ImmediateDataRequestMonitor<Integer>(rm) {
@Override
protected void handleSuccess() {
- rm.done(new ExpressionGroupDMData(((IExpressionGroupDMContext)dmc).getExpression(), getData()));
+ rm.done(new ExpressionGroupDMData(((IExpressionGroupDMContext) dmc).getExpression(), getData()));
}
});
- return;
- }
-
+ return;
+ }
+
fDelegate.getExpressionDataExtension(dmc, rm);
}
-
@Override
public void getExpressionData(final IExpressionDMContext dmc, final DataRequestMonitor<IExpressionDMData> rm) {
if (dmc instanceof IExpressionGroupDMContext) {
getSubExpressionCount(dmc, new ImmediateDataRequestMonitor<Integer>(rm) {
@Override
protected void handleSuccess() {
- rm.done(new ExpressionGroupDMData(((IExpressionGroupDMContext)dmc).getExpression(), getData()));
+ rm.done(new ExpressionGroupDMData(((IExpressionGroupDMContext) dmc).getExpression(), getData()));
}
});
- return;
- }
-
+ return;
+ }
+
fDelegate.getExpressionData(dmc, rm);
}
@@ -333,69 +336,75 @@ public class GDBPatternMatchingExpressions extends AbstractDsfService implements
public void getExpressionAddressData(IExpressionDMContext dmc, DataRequestMonitor<IExpressionDMAddress> rm) {
// An expression-group does not have an address
if (dmc instanceof IExpressionGroupDMContext) {
- rm.done(new IExpressionDMLocation() {
+ rm.done(new IExpressionDMLocation() {
@Override
public IAddress getAddress() {
return IExpressions.IExpressionDMLocation.INVALID_ADDRESS;
}
+
@Override
public int getSize() {
return 0;
}
+
@Override
public String getLocation() {
return ""; //$NON-NLS-1$
}
- });
- return;
- }
-
+ });
+ return;
+ }
+
fDelegate.getExpressionAddressData(dmc, rm);
}
@Override
public void getSubExpressions(IExpressionDMContext exprCtx, DataRequestMonitor<IExpressionDMContext[]> rm) {
if (exprCtx instanceof IExpressionGroupDMContext) {
- matchExpressionGroup((IExpressionGroupDMContext)exprCtx, -1, -1, rm);
+ matchExpressionGroup((IExpressionGroupDMContext) exprCtx, -1, -1, rm);
} else {
fDelegate.getSubExpressions(exprCtx, rm);
}
}
@Override
- public void getSubExpressions(IExpressionDMContext exprCtx, int startIndex, int length, DataRequestMonitor<IExpressionDMContext[]> rm) {
+ public void getSubExpressions(IExpressionDMContext exprCtx, int startIndex, int length,
+ DataRequestMonitor<IExpressionDMContext[]> rm) {
if (exprCtx instanceof IExpressionGroupDMContext) {
- matchExpressionGroup((IExpressionGroupDMContext)exprCtx, startIndex, length, rm);
+ matchExpressionGroup((IExpressionGroupDMContext) exprCtx, startIndex, length, rm);
} else {
- fDelegate.getSubExpressions(exprCtx, startIndex, length, rm);
+ fDelegate.getSubExpressions(exprCtx, startIndex, length, rm);
}
}
@Override
public void getSubExpressionCount(IExpressionDMContext dmc, final DataRequestMonitor<Integer> rm) {
if (dmc instanceof IExpressionGroupDMContext) {
- matchExpressionGroup((IExpressionGroupDMContext)dmc, -1, -1, new ImmediateDataRequestMonitor<IExpressionDMContext[]>(rm) {
- @Override
- protected void handleSuccess() {
- rm.done(getData().length);
- }
- });
+ matchExpressionGroup((IExpressionGroupDMContext) dmc, -1, -1,
+ new ImmediateDataRequestMonitor<IExpressionDMContext[]>(rm) {
+ @Override
+ protected void handleSuccess() {
+ rm.done(getData().length);
+ }
+ });
} else {
fDelegate.getSubExpressionCount(dmc, rm);
}
}
@Override
- public void getSubExpressionCount(IExpressionDMContext dmc, int maxNumberOfChildren, final DataRequestMonitor<Integer> rm) {
+ public void getSubExpressionCount(IExpressionDMContext dmc, int maxNumberOfChildren,
+ final DataRequestMonitor<Integer> rm) {
if (dmc instanceof IExpressionGroupDMContext) {
// No need to worry about maxNumberOfChildren for the case of an expression-group, since there won't be
// a very large amount of them.
- matchExpressionGroup((IExpressionGroupDMContext)dmc, -1, -1, new ImmediateDataRequestMonitor<IExpressionDMContext[]>(rm) {
- @Override
- protected void handleSuccess() {
- rm.done(getData().length);
- }
- });
+ matchExpressionGroup((IExpressionGroupDMContext) dmc, -1, -1,
+ new ImmediateDataRequestMonitor<IExpressionDMContext[]>(rm) {
+ @Override
+ protected void handleSuccess() {
+ rm.done(getData().length);
+ }
+ });
} else {
fDelegate.getSubExpressionCount(dmc, maxNumberOfChildren, rm);
}
@@ -410,29 +419,29 @@ public class GDBPatternMatchingExpressions extends AbstractDsfService implements
public void canWriteExpression(IExpressionDMContext dmc, DataRequestMonitor<Boolean> rm) {
// An expression-group's value cannot be modified
if (dmc instanceof IExpressionGroupDMContext) {
- rm.done(false);
- return;
- }
-
- fDelegate.canWriteExpression(dmc, rm);
+ rm.done(false);
+ return;
+ }
+
+ fDelegate.canWriteExpression(dmc, rm);
}
@Override
public void writeExpression(IExpressionDMContext dmc, String expressionValue, String formatId, RequestMonitor rm) {
// An expression-group's value cannot be modified
assert !(dmc instanceof IExpressionGroupDMContext);
- fDelegate.writeExpression(dmc, expressionValue, formatId, rm);
+ fDelegate.writeExpression(dmc, expressionValue, formatId, rm);
}
@Override
public void getAvailableFormats(IFormattedDataDMContext dmc, DataRequestMonitor<String[]> rm) {
// For an expression-group, we only show the NATURAL format
if (dmc instanceof IExpressionGroupDMContext) {
- rm.done(new String[] { IFormattedValues.NATURAL_FORMAT });
- return;
- }
-
- fDelegate.getAvailableFormats(dmc, rm);
+ rm.done(new String[] { IFormattedValues.NATURAL_FORMAT });
+ return;
+ }
+
+ fDelegate.getAvailableFormats(dmc, rm);
}
@Override
@@ -442,7 +451,8 @@ public class GDBPatternMatchingExpressions extends AbstractDsfService implements
}
@Override
- public void getFormattedExpressionValue(FormattedValueDMContext dmc, final DataRequestMonitor<FormattedValueDMData> rm) {
+ public void getFormattedExpressionValue(FormattedValueDMContext dmc,
+ final DataRequestMonitor<FormattedValueDMData> rm) {
IExpressionGroupDMContext exprGroup = DMContexts.getAncestorOfType(dmc, IExpressionGroupDMContext.class);
if (exprGroup != null) {
getSubExpressionCount(exprGroup, new ImmediateDataRequestMonitor<Integer>(rm) {
@@ -451,7 +461,7 @@ public class GDBPatternMatchingExpressions extends AbstractDsfService implements
int numChildren = getData();
String value;
if (numChildren == 0) {
- value = Messages.NoMatches;
+ value = Messages.NoMatches;
} else if (numChildren == 1) {
value = MessageFormat.format(Messages.UniqueMatch, numChildren);
} else {
@@ -460,32 +470,32 @@ public class GDBPatternMatchingExpressions extends AbstractDsfService implements
rm.done(new FormattedValueDMData(value));
}
});
- return;
- }
-
+ return;
+ }
+
fDelegate.getFormattedExpressionValue(dmc, rm);
}
@Override
- public void safeToAskForAllSubExpressions(IExpressionDMContext dmc, DataRequestMonitor<Boolean> rm) {
- // Always safe to ask for all sub-expression of an expression-group,
+ public void safeToAskForAllSubExpressions(IExpressionDMContext dmc, DataRequestMonitor<Boolean> rm) {
+ // Always safe to ask for all sub-expression of an expression-group,
// since we don't expect large amounts of children
if (dmc instanceof IExpressionGroupDMContext) {
- rm.done(true);
- return;
- }
-
+ rm.done(true);
+ return;
+ }
+
fDelegate.safeToAskForAllSubExpressions(dmc, rm);
}
@Override
public void flushCache(IDMContext context) {
if (fDelegate instanceof ICachingService) {
- ((ICachingService)fDelegate).flushCache(context);
+ ((ICachingService) fDelegate).flushCache(context);
}
}
-
- /**
+
+ /**
* Verify if we are dealing with an expression-group.
* @param expr The expression to verify
* @return True if expr is an expression-group. An
@@ -500,22 +510,22 @@ public class GDBPatternMatchingExpressions extends AbstractDsfService implements
// and after the regex, which achieves what we want.
// Note that checking if (expr.split(regex) > 1), will not notice
// an expression that has a separator only at the end.
- if (expr.matches(".*" + EXPRESSION_GROUP_SEPARATORS_REGEXP +".*")) { //$NON-NLS-1$ //$NON-NLS-2$
+ if (expr.matches(".*" + EXPRESSION_GROUP_SEPARATORS_REGEXP + ".*")) { //$NON-NLS-1$ //$NON-NLS-2$
// We are dealing with a group of expressions.
// It may not be a valid one, but it is one nonetheless.
return true;
}
-
+
// Not a list. Check if we are dealing with a glob-pattern.
return isGlobExpression(expr);
}
-
+
/**
* Verify if we are dealing with a glob-pattern.
* We support the expression '*' which will match all local variables
* as well as the expression '$*' which will match all registers.
* We support glob-patterns for any expression starting with '='
- *
+ *
* @param expr The expression to verify
* @return True if expr is a glob-pattern we support.
*/
@@ -536,10 +546,10 @@ public class GDBPatternMatchingExpressions extends AbstractDsfService implements
return false;
}
-
+
/**
* Verify if the glob-pattern represents a register.
- *
+ *
* @param expr The glob-pattern that may be a register-pattern
* @return True if expr follows the rules of an register-pattern
*/
@@ -552,17 +562,17 @@ public class GDBPatternMatchingExpressions extends AbstractDsfService implements
}
return false;
}
-
+
/**
* Verify if the glob-pattern should be handled as an array index range.
* When dealing with variables (on contrast to registers), the [] will
* map to array indices instead of ranges within the array name.
* For example =array[1-2] will map to array[1] and array[2] instead of
* array1 and array2.
- *
+ *
* If the range contains non-digits, the matching will not be handled
* as array indices.
- *
+ *
* @param expr The glob-pattern that may be an array-pattern
* @return True if expr follows the rules of an array-pattern
*/
@@ -576,7 +586,7 @@ public class GDBPatternMatchingExpressions extends AbstractDsfService implements
if (openBracketIndex < 1) {
return false;
}
-
+
// We don't support any characters after the closing bracket
// since we don't support any operations on an expression-group.
if (!expr.endsWith("]")) { //$NON-NLS-1$
@@ -585,22 +595,22 @@ public class GDBPatternMatchingExpressions extends AbstractDsfService implements
// We have a match for a variable which uses brackets.
// Check if the indices are integer ranges (using - or commas).
- try {
- Pattern pattern = Pattern.compile(ARRAY_INDEX_RANGE_REGEXP, Pattern.CASE_INSENSITIVE);
- Matcher matcher = pattern.matcher(expr.substring(openBracketIndex+1, expr.length()-1));
- if (!matcher.find()) {
- return false;
- }
- } catch(Exception e) {
- // If the user put an invalid pattern, we just ignore it
- return false;
- }
-
+ try {
+ Pattern pattern = Pattern.compile(ARRAY_INDEX_RANGE_REGEXP, Pattern.CASE_INSENSITIVE);
+ Matcher matcher = pattern.matcher(expr.substring(openBracketIndex + 1, expr.length() - 1));
+ if (!matcher.find()) {
+ return false;
+ }
+ } catch (Exception e) {
+ // If the user put an invalid pattern, we just ignore it
+ return false;
+ }
+
return true;
}
-
+
/**
- * Split the expression-group into a list of individual expression strings.
+ * Split the expression-group into a list of individual expression strings.
*/
protected List<String> splitExpressionsInGroup(IExpressionGroupDMContext groupDmc) {
// Split the list of expressions
@@ -617,137 +627,143 @@ public class GDBPatternMatchingExpressions extends AbstractDsfService implements
}
return expressions;
}
-
+
/**
* Find all expressions that match the specified expression-group.
* This method retains the order of the expressions in the expression-group, to show them
* in the same order as the one specified by the user. The matches of each expression within the group
* are sorted alphabetically however.
- *
+ *
* @param exprGroupDmc The expression-group context for which we want the matches (sub-expressions)
* @param startIndex The beginning of the range of matches (-1 means all matches)
* @param length The length of the range of matches (-1 means all matches)
* @param rm RequestMonitor that will contain the range of found matches.
*/
- protected void matchExpressionGroup(final IExpressionGroupDMContext exprGroupDmc, int startIndex, int length,
- final DataRequestMonitor<IExpressionDMContext[]> rm) {
+ protected void matchExpressionGroup(final IExpressionGroupDMContext exprGroupDmc, int startIndex, int length,
+ final DataRequestMonitor<IExpressionDMContext[]> rm) {
// First separate the group into different expressions.
// We need to create a new list, as we will modify it during our processing.
final List<String> exprList = new ArrayList<String>(splitExpressionsInGroup(exprGroupDmc));
// List to store the final result, which is all the sub-expressions of this group
- final ArrayList<IExpressionDMContext> subExprList = new ArrayList<IExpressionDMContext>();
-
- final int startIndex1 = (startIndex < 0) ? 0 : startIndex;
- final int length1 = (length < 0) ? Integer.MAX_VALUE : length;
-
- matchExpressionList(exprList, subExprList, exprGroupDmc, new ImmediateRequestMonitor(rm) {
- @Override
- protected void handleSuccess() {
- // It would be nice to allow identical elements, so that the user
- // can control their positioning. For example, the pattern $eax, $*, would show
- // the $eax first, followed by all other registers sorted alphabetically. In that case
- // $eax will be shown again within $*, but that would be ok.
- // However, the platform does not handle the same element being there twice.
- // Not only does selecting the element jump back and forth between the duplicates,
- // but children of duplicated elements are not always right. Because of this, we
- // remove all duplicates here.
- LinkedHashSet<IExpressionDMContext> uniqueSubExprSet = new LinkedHashSet<IExpressionDMContext>(subExprList);
- subExprList.clear();
- subExprList.addAll(uniqueSubExprSet);
-
- // Extract the range of interest from the final list
+ final ArrayList<IExpressionDMContext> subExprList = new ArrayList<IExpressionDMContext>();
+
+ final int startIndex1 = (startIndex < 0) ? 0 : startIndex;
+ final int length1 = (length < 0) ? Integer.MAX_VALUE : length;
+
+ matchExpressionList(exprList, subExprList, exprGroupDmc, new ImmediateRequestMonitor(rm) {
+ @Override
+ protected void handleSuccess() {
+ // It would be nice to allow identical elements, so that the user
+ // can control their positioning. For example, the pattern $eax, $*, would show
+ // the $eax first, followed by all other registers sorted alphabetically. In that case
+ // $eax will be shown again within $*, but that would be ok.
+ // However, the platform does not handle the same element being there twice.
+ // Not only does selecting the element jump back and forth between the duplicates,
+ // but children of duplicated elements are not always right. Because of this, we
+ // remove all duplicates here.
+ LinkedHashSet<IExpressionDMContext> uniqueSubExprSet = new LinkedHashSet<IExpressionDMContext>(
+ subExprList);
+ subExprList.clear();
+ subExprList.addAll(uniqueSubExprSet);
+
+ // Extract the range of interest from the final list
int endIndex = Math.min(startIndex1 + length1, subExprList.size());
List<IExpressionDMContext> subExprRangeList = subExprList.subList(startIndex1, endIndex);
- IExpressionDMContext[] subExprRange = subExprRangeList.toArray(new IExpressionDMContext[subExprRangeList.size()]);
- rm.done(subExprRange);
- }
- });
+ IExpressionDMContext[] subExprRange = subExprRangeList
+ .toArray(new IExpressionDMContext[subExprRangeList.size()]);
+ rm.done(subExprRange);
+ }
+ });
}
-
- /**
+
+ /**
* We use this recursive method to serialize the request for matches. Once one request is done,
* we create a new one. This allows us to guarantee that the resulting matches will
* be ordered in the same way every time.
*/
- private void matchExpressionList(final List<String> exprList, final List<IExpressionDMContext> subExprList, final IDMContext parentDmc,
- final RequestMonitor rm) {
- // We've finished parsing the list
- if (exprList.isEmpty()) {
- rm.done();
- return;
- }
-
- // Remove the next element from the list and process it. We handle glob-pattern matching if needed
- // and sort the result alphabetically in that case.
- String expr = exprList.remove(0);
-
- IExpressionDMContext exprDmc = createExpression(parentDmc, expr);
- if (exprDmc instanceof IExpressionGroupDMContext) {
- matchGlobExpression((IExpressionGroupDMContext)exprDmc, new ImmediateDataRequestMonitor<List<IExpressionDMContext>>(rm) {
- @Override
- protected void handleSuccess() {
- List<IExpressionDMContext> matches = getData();
- // Sort the matches to be more user-friendly
- Collections.sort(matches, new Comparator<IExpressionDMContext>() {
- @Override
- public int compare(IExpressionDMContext o1, IExpressionDMContext o2) {
- // For elements of the same array, we need to sort by index
- if (isArrayPattern(o1.getExpression()) && isArrayPattern(o2.getExpression())) {
- // Extract the array names and the array indices specification.
- // The regex used will remove both [ and ]
- String[] arrayExprParts1 = o1.getExpression().split("[\\[\\]]"); //$NON-NLS-1$
- assert arrayExprParts1 != null && arrayExprParts1.length == 2;
-
- String[] arrayExprParts2 = o2.getExpression().split("[\\[\\]]"); //$NON-NLS-1$
- assert arrayExprParts2 != null && arrayExprParts2.length == 2;
-
- // Compare array names
- if (arrayExprParts1[0].compareTo(arrayExprParts2[0]) == 0) {
- // We are dealing with the same array
- try {
- int arrayIndex1 = Integer.parseInt(arrayExprParts1[1]);
- int arrayIndex2 = Integer.parseInt(arrayExprParts2[1]);
-
- if (arrayIndex1 == arrayIndex2) return 0;
- if (arrayIndex1 > arrayIndex2) return 1;
- return -1;
- } catch (NumberFormatException e) {
- // Invalid array index. Fall-back to sorting lexically.
- }
- }
- }
- return o1.getExpression().compareTo(o2.getExpression());
- }
- });
-
- subExprList.addAll(matches);
- // Match the next expression from the list
- matchExpressionList(exprList, subExprList, parentDmc, rm);
- }
- });
- } else {
- // Just a normal expression
- subExprList.add(exprDmc);
- // Match the next expression from the list
- matchExpressionList(exprList, subExprList, parentDmc, rm);
- }
- }
-
+ private void matchExpressionList(final List<String> exprList, final List<IExpressionDMContext> subExprList,
+ final IDMContext parentDmc, final RequestMonitor rm) {
+ // We've finished parsing the list
+ if (exprList.isEmpty()) {
+ rm.done();
+ return;
+ }
+
+ // Remove the next element from the list and process it. We handle glob-pattern matching if needed
+ // and sort the result alphabetically in that case.
+ String expr = exprList.remove(0);
+
+ IExpressionDMContext exprDmc = createExpression(parentDmc, expr);
+ if (exprDmc instanceof IExpressionGroupDMContext) {
+ matchGlobExpression((IExpressionGroupDMContext) exprDmc,
+ new ImmediateDataRequestMonitor<List<IExpressionDMContext>>(rm) {
+ @Override
+ protected void handleSuccess() {
+ List<IExpressionDMContext> matches = getData();
+ // Sort the matches to be more user-friendly
+ Collections.sort(matches, new Comparator<IExpressionDMContext>() {
+ @Override
+ public int compare(IExpressionDMContext o1, IExpressionDMContext o2) {
+ // For elements of the same array, we need to sort by index
+ if (isArrayPattern(o1.getExpression()) && isArrayPattern(o2.getExpression())) {
+ // Extract the array names and the array indices specification.
+ // The regex used will remove both [ and ]
+ String[] arrayExprParts1 = o1.getExpression().split("[\\[\\]]"); //$NON-NLS-1$
+ assert arrayExprParts1 != null && arrayExprParts1.length == 2;
+
+ String[] arrayExprParts2 = o2.getExpression().split("[\\[\\]]"); //$NON-NLS-1$
+ assert arrayExprParts2 != null && arrayExprParts2.length == 2;
+
+ // Compare array names
+ if (arrayExprParts1[0].compareTo(arrayExprParts2[0]) == 0) {
+ // We are dealing with the same array
+ try {
+ int arrayIndex1 = Integer.parseInt(arrayExprParts1[1]);
+ int arrayIndex2 = Integer.parseInt(arrayExprParts2[1]);
+
+ if (arrayIndex1 == arrayIndex2)
+ return 0;
+ if (arrayIndex1 > arrayIndex2)
+ return 1;
+ return -1;
+ } catch (NumberFormatException e) {
+ // Invalid array index. Fall-back to sorting lexically.
+ }
+ }
+ }
+ return o1.getExpression().compareTo(o2.getExpression());
+ }
+ });
+
+ subExprList.addAll(matches);
+ // Match the next expression from the list
+ matchExpressionList(exprList, subExprList, parentDmc, rm);
+ }
+ });
+ } else {
+ // Just a normal expression
+ subExprList.add(exprDmc);
+ // Match the next expression from the list
+ matchExpressionList(exprList, subExprList, parentDmc, rm);
+ }
+ }
+
/**
* Find all expressions that match the specified glob-pattern.
- *
+ *
* @param exprDmc The expression context for which we want the matches (sub-expressions)
* @param rm RequestMonitor that will contain the unsorted matches.
*/
- protected void matchGlobExpression(final IExpressionGroupDMContext exprDmc, final DataRequestMonitor<List<IExpressionDMContext>> rm) {
+ protected void matchGlobExpression(final IExpressionGroupDMContext exprDmc,
+ final DataRequestMonitor<List<IExpressionDMContext>> rm) {
String fullExpr = exprDmc.getExpression().trim();
if (fullExpr.startsWith(GLOB_EXPRESSION_PREFIX)) {
// Strip the leading '=' and any extra spaces
fullExpr = fullExpr.substring(1).trim();
}
-
+
if (isRegisterPattern(fullExpr)) {
matchRegisters(exprDmc, rm);
} else {
@@ -760,8 +776,8 @@ public class GDBPatternMatchingExpressions extends AbstractDsfService implements
matchArrays(exprDmc, new ImmediateDataRequestMonitor<List<IExpressionDMContext>>(rm) {
@Override
protected void handleSuccess() {
- final List<IExpressionDMContext> exprList =
- getData() != null ? getData() : new ArrayList<IExpressions.IExpressionDMContext>();
+ final List<IExpressionDMContext> exprList = getData() != null ? getData()
+ : new ArrayList<IExpressions.IExpressionDMContext>();
matchLocals(exprDmc, new ImmediateDataRequestMonitor<List<IExpressionDMContext>>(rm) {
@Override
protected void handleSuccess() {
@@ -779,37 +795,38 @@ public class GDBPatternMatchingExpressions extends AbstractDsfService implements
/**
* Find all registers that match the specified glob-pattern.
- *
+ *
* @param globDmc The glob-expression context for which we want the matches (sub-expressions)
* @param rm RequestMonitor that will contain the unsorted matches.
*/
- protected void matchRegisters(final IExpressionGroupDMContext globDmc, final DataRequestMonitor<List<IExpressionDMContext>> rm) {
+ protected void matchRegisters(final IExpressionGroupDMContext globDmc,
+ final DataRequestMonitor<List<IExpressionDMContext>> rm) {
final IRegisters2 registerService = getServicesTracker().getService(IRegisters2.class);
if (registerService == null) {
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Register service unavailable", null)); //$NON-NLS-1$
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Register service unavailable", //$NON-NLS-1$
+ null));
return;
}
final IContainerDMContext contDmc = DMContexts.getAncestorOfType(globDmc, IContainerDMContext.class);
-
- registerService.getRegisters(
- new CompositeDMContext(new IDMContext[] { contDmc, globDmc } ),
+
+ registerService.getRegisters(new CompositeDMContext(new IDMContext[] { contDmc, globDmc }),
new ImmediateDataRequestMonitor<IRegisterDMContext[]>(rm) {
@Override
protected void handleSuccess() {
assert getData() instanceof MIRegisterDMC[];
ArrayList<IExpressionDMContext> matches = new ArrayList<IExpressionDMContext>();
-
+
String fullExpr = globDmc.getExpression().trim();
- if (fullExpr.startsWith(GLOB_EXPRESSION_PREFIX)) {
- // Strip the leading '=' and any extra spaces
- fullExpr = fullExpr.substring(1).trim();
- }
-
- for (MIRegisterDMC register : (MIRegisterDMC[])getData()) {
+ if (fullExpr.startsWith(GLOB_EXPRESSION_PREFIX)) {
+ // Strip the leading '=' and any extra spaces
+ fullExpr = fullExpr.substring(1).trim();
+ }
+
+ for (MIRegisterDMC register : (MIRegisterDMC[]) getData()) {
String potentialMatch = REGISTER_PREFIX + register.getName();
if (globMatches(fullExpr, potentialMatch)) {
- matches.add(createExpression(globDmc, potentialMatch));
+ matches.add(createExpression(globDmc, potentialMatch));
}
}
@@ -817,21 +834,22 @@ public class GDBPatternMatchingExpressions extends AbstractDsfService implements
}
});
}
-
+
/**
* Find all local variables that match the specified glob-pattern.
- *
+ *
* @param globDmc The glob-expression context for which we want the matches (sub-expressions)
* @param rm RequestMonitor that will contain the unsorted matches.
*/
- protected void matchLocals(final IExpressionGroupDMContext globDmc, final DataRequestMonitor<List<IExpressionDMContext>> rm) {
-
+ protected void matchLocals(final IExpressionGroupDMContext globDmc,
+ final DataRequestMonitor<List<IExpressionDMContext>> rm) {
+
final IStack stackService = getServicesTracker().getService(IStack.class);
if (stackService == null) {
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Stack service unavailable", null)); //$NON-NLS-1$
return;
}
-
+
IFrameDMContext frameCtx = DMContexts.getAncestorOfType(globDmc, IFrameDMContext.class);
if (frameCtx == null) {
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Stack frame unavailable", null)); //$NON-NLS-1$
@@ -841,68 +859,72 @@ public class GDBPatternMatchingExpressions extends AbstractDsfService implements
stackService.getLocals(frameCtx, new ImmediateDataRequestMonitor<IVariableDMContext[]>(rm) {
@Override
protected void handleSuccess() {
- IVariableDMContext[] localsDMCs = getData();
- final IVariableDMData[] localsDMData = new IVariableDMData[localsDMCs.length];
-
- final CountingRequestMonitor varNameCRM = new CountingRequestMonitor(getExecutor(), rm) {
- @Override
- public void handleSuccess() {
- ArrayList<IExpressionDMContext> matches = new ArrayList<IExpressionDMContext>(localsDMData.length);
-
- String fullExpr = globDmc.getExpression().trim();
- if (fullExpr.startsWith(GLOB_EXPRESSION_PREFIX)) {
- // Strip the leading '=' and any extra spaces
- fullExpr = fullExpr.substring(1).trim();
- }
-
- for (IVariableDMData localDMData : localsDMData) {
+ IVariableDMContext[] localsDMCs = getData();
+ final IVariableDMData[] localsDMData = new IVariableDMData[localsDMCs.length];
+
+ final CountingRequestMonitor varNameCRM = new CountingRequestMonitor(getExecutor(), rm) {
+ @Override
+ public void handleSuccess() {
+ ArrayList<IExpressionDMContext> matches = new ArrayList<IExpressionDMContext>(
+ localsDMData.length);
+
+ String fullExpr = globDmc.getExpression().trim();
+ if (fullExpr.startsWith(GLOB_EXPRESSION_PREFIX)) {
+ // Strip the leading '=' and any extra spaces
+ fullExpr = fullExpr.substring(1).trim();
+ }
+
+ for (IVariableDMData localDMData : localsDMData) {
String potentialMatch = localDMData.getName();
if (globMatches(fullExpr, potentialMatch)) {
matches.add(createExpression(globDmc, potentialMatch));
}
- }
-
- rm.done(matches);
- }
- };
-
- // Get all the names of the variables
- int count = 0;
- for (int index=0; index < localsDMCs.length; index++) {
+ }
+
+ rm.done(matches);
+ }
+ };
+
+ // Get all the names of the variables
+ int count = 0;
+ for (int index = 0; index < localsDMCs.length; index++) {
final int finalIndex = index;
- stackService.getVariableData(localsDMCs[finalIndex], new ImmediateDataRequestMonitor<IVariableDMData>(varNameCRM) {
- @Override
- public void handleSuccess() {
- localsDMData[finalIndex] = getData();
- varNameCRM.done();
- }
- });
-
- count++;
- }
- varNameCRM.setDoneCount(count);
+ stackService.getVariableData(localsDMCs[finalIndex],
+ new ImmediateDataRequestMonitor<IVariableDMData>(varNameCRM) {
+ @Override
+ public void handleSuccess() {
+ localsDMData[finalIndex] = getData();
+ varNameCRM.done();
+ }
+ });
+
+ count++;
+ }
+ varNameCRM.setDoneCount(count);
}
});
}
+
/**
* Find all arrays elements that match the specified glob-pattern.
- *
+ *
* @param globDmc The glob-expression context for which we want the matches (sub-expressions)
* @param rm RequestMonitor that will contain the unsorted matches.
*/
- protected void matchArrays(final IExpressionGroupDMContext globDmc, final DataRequestMonitor<List<IExpressionDMContext>> rm) {
+ protected void matchArrays(final IExpressionGroupDMContext globDmc,
+ final DataRequestMonitor<List<IExpressionDMContext>> rm) {
final IStack stackService = getServicesTracker().getService(IStack.class);
if (stackService == null) {
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Stack service unavailable", null)); //$NON-NLS-1$
return;
}
-
+
IFrameDMContext frameCtx = DMContexts.getAncestorOfType(globDmc, IFrameDMContext.class);
if (frameCtx == null) {
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Stack frame unavailable", null)); //$NON-NLS-1$
return;
}
-
+
String fullExpr = globDmc.getExpression().trim();
if (fullExpr.startsWith(GLOB_EXPRESSION_PREFIX)) {
// Strip the leading '=' and any extra spaces
@@ -915,100 +937,99 @@ public class GDBPatternMatchingExpressions extends AbstractDsfService implements
assert arrayExprParts != null && arrayExprParts.length == 2;
if (arrayExprParts == null || arrayExprParts.length < 2) {
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Error parsing array expression", null)); //$NON-NLS-1$
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Error parsing array expression", //$NON-NLS-1$
+ null));
return;
}
-
+
final String arrayName = arrayExprParts[0].trim();
final String arrayIndexSpec = arrayExprParts[1].trim();
stackService.getLocals(frameCtx, new ImmediateDataRequestMonitor<IVariableDMContext[]>(rm) {
@Override
protected void handleSuccess() {
- IVariableDMContext[] localsDMCs = getData();
- final IVariableDMData[] localsDMData = new IVariableDMData[localsDMCs.length];
-
- final CountingRequestMonitor varNameCRM = new CountingRequestMonitor(getExecutor(), rm) {
- @Override
- public void handleSuccess() {
- final ArrayList<IExpressionDMContext> matches = new ArrayList<IExpressionDMContext>();
- final CountingRequestMonitor elementMatchesCRM = new CountingRequestMonitor(getExecutor(), rm) {
- @Override
- public void handleSuccess() {
- rm.done(matches);
- }
- };
-
- int count = 0;
- for (IVariableDMData localDMData : localsDMData) {
- final String potentialMatch = localDMData.getName();
-
- if (globMatches(arrayName, potentialMatch)) {
- // We have a variable that matches the name part of the array.
- // Let's create the matching elements if that variable is an array.
- createPotentialArrayMatches(createExpression(globDmc, potentialMatch), arrayIndexSpec,
- new ImmediateDataRequestMonitor<List<IExpressionDMContext>>(elementMatchesCRM){
- @Override
- protected void handleSuccess() {
- if (getData() != null) {
- matches.addAll(getData());
- }
- elementMatchesCRM.done();
- }
- });
-
- count++;
- }
- }
- elementMatchesCRM.setDoneCount(count);
- }
- };
-
- // Get all the names of the variables
- int count = 0;
- for (int index=0; index < localsDMCs.length; index++) {
+ IVariableDMContext[] localsDMCs = getData();
+ final IVariableDMData[] localsDMData = new IVariableDMData[localsDMCs.length];
+
+ final CountingRequestMonitor varNameCRM = new CountingRequestMonitor(getExecutor(), rm) {
+ @Override
+ public void handleSuccess() {
+ final ArrayList<IExpressionDMContext> matches = new ArrayList<IExpressionDMContext>();
+ final CountingRequestMonitor elementMatchesCRM = new CountingRequestMonitor(getExecutor(), rm) {
+ @Override
+ public void handleSuccess() {
+ rm.done(matches);
+ }
+ };
+
+ int count = 0;
+ for (IVariableDMData localDMData : localsDMData) {
+ final String potentialMatch = localDMData.getName();
+
+ if (globMatches(arrayName, potentialMatch)) {
+ // We have a variable that matches the name part of the array.
+ // Let's create the matching elements if that variable is an array.
+ createPotentialArrayMatches(createExpression(globDmc, potentialMatch), arrayIndexSpec,
+ new ImmediateDataRequestMonitor<List<IExpressionDMContext>>(elementMatchesCRM) {
+ @Override
+ protected void handleSuccess() {
+ if (getData() != null) {
+ matches.addAll(getData());
+ }
+ elementMatchesCRM.done();
+ }
+ });
+
+ count++;
+ }
+ }
+ elementMatchesCRM.setDoneCount(count);
+ }
+ };
+
+ // Get all the names of the variables
+ int count = 0;
+ for (int index = 0; index < localsDMCs.length; index++) {
final int finalIndex = index;
- stackService.getVariableData(localsDMCs[finalIndex], new ImmediateDataRequestMonitor<IVariableDMData>(varNameCRM) {
- @Override
- public void handleSuccess() {
- localsDMData[finalIndex] = getData();
- varNameCRM.done();
- }
- });
-
- count++;
- }
- varNameCRM.setDoneCount(count);
+ stackService.getVariableData(localsDMCs[finalIndex],
+ new ImmediateDataRequestMonitor<IVariableDMData>(varNameCRM) {
+ @Override
+ public void handleSuccess() {
+ localsDMData[finalIndex] = getData();
+ varNameCRM.done();
+ }
+ });
+
+ count++;
+ }
+ varNameCRM.setDoneCount(count);
}
});
}
-
+
/**
* Creates requested array elements if exprDmc is indeed an array.
- *
+ *
* @param exprDmc The potential array expression to be used
* @param indexSpec The specification of the element indices
- * @param rm The list of created element expressions.
- * If exprDmc is not an array, the list will be empty but not null.
+ * @param rm The list of created element expressions.
+ * If exprDmc is not an array, the list will be empty but not null.
*/
- protected void createPotentialArrayMatches(final IExpressionDMContext exprDmc, final String indexSpec,
- final DataRequestMonitor<List<IExpressionDMContext>> rm) {
+ protected void createPotentialArrayMatches(final IExpressionDMContext exprDmc, final String indexSpec,
+ final DataRequestMonitor<List<IExpressionDMContext>> rm) {
// We check if the variable is an array or not. If it is an array,
// we create the elements based on the specified indices.
// If it is not an array, we don't need to handle it in this method
getExpressionData(exprDmc, new ImmediateDataRequestMonitor<IExpressionDMData>(rm) {
@Override
protected void handleCompleted() {
- boolean isArray =
- isSuccess() &&
- getData().getBasicType().equals(IExpressionDMData.BasicType.array);
+ boolean isArray = isSuccess() && getData().getBasicType().equals(IExpressionDMData.BasicType.array);
- final ArrayList<IExpressionDMContext> elements = new ArrayList<IExpressionDMContext>();
+ final ArrayList<IExpressionDMContext> elements = new ArrayList<IExpressionDMContext>();
if (isArray) {
// we must now create the elements based on the indices
- List<IExpressionDMContext> indicesDmcs =
- createArrayIndicesExpression(exprDmc, indexSpec);
+ List<IExpressionDMContext> indicesDmcs = createArrayIndicesExpression(exprDmc, indexSpec);
if (indicesDmcs != null) {
elements.addAll(indicesDmcs);
}
@@ -1021,7 +1042,7 @@ public class GDBPatternMatchingExpressions extends AbstractDsfService implements
/**
* Create all the expressions characterizing the specified arrayDmc and
* indexSpec pattern.
- *
+ *
* @param arrayDmc The expression context that represents the array itself
* @param indexSpec A string describing the range of indexes to be used.
* Valid range formats are described by {@code ARRAY_INDEX_RANGE_REGEXP}
@@ -1032,27 +1053,27 @@ public class GDBPatternMatchingExpressions extends AbstractDsfService implements
* could be a valid expression (i.e., the index 3-2=1 in this case)
*/
protected List<IExpressionDMContext> createArrayIndicesExpression(IExpressionDMContext arrayDmc, String indexSpec) {
- ArrayList<IExpressionDMContext> expressionDMCs = new ArrayList<IExpressionDMContext>();
- String arrayName = arrayDmc.getExpression();
- IDMContext parentDmc = arrayDmc.getParents()[0];
-
+ ArrayList<IExpressionDMContext> expressionDMCs = new ArrayList<IExpressionDMContext>();
+ String arrayName = arrayDmc.getExpression();
+ IDMContext parentDmc = arrayDmc.getParents()[0];
+
// First split the indexRange by comma
String[] ranges = indexSpec.split(","); //$NON-NLS-1$
-
+
for (String range : ranges) {
// Get rid of any useless spaces
range = range.trim();
-
+
// Try to split the range with the - separator
String[] rangeNumbers = range.split("-");//$NON-NLS-1$
if (rangeNumbers.length == 2) {
try {
int lowIndex = Integer.parseInt(rangeNumbers[0]);
int highIndex = Integer.parseInt(rangeNumbers[1]);
-
+
if (lowIndex <= highIndex) {
for (int i = lowIndex; i <= highIndex; i++) {
- expressionDMCs.add(createExpression(parentDmc, arrayName + "[" + i + "]")); //$NON-NLS-1$ //$NON-NLS-2$
+ expressionDMCs.add(createExpression(parentDmc, arrayName + "[" + i + "]")); //$NON-NLS-1$ //$NON-NLS-2$
}
continue;
@@ -1061,16 +1082,16 @@ public class GDBPatternMatchingExpressions extends AbstractDsfService implements
// Ignore and fall back on using range as-is below
}
}
-
+
// Leave range as-is, which could be a single digit, or some non-expected expression
expressionDMCs.add(createExpression(parentDmc, arrayName + "[" + range + "]")); //$NON-NLS-1$ //$NON-NLS-2$
}
return expressionDMCs;
}
-
+
/**
* Verify if the potentialMatch variable matches the glob-pattern.
- *
+ *
* @param globPattern The glob-pattern to match
* @param potentialMatch The string that must match globPattern.
* @return True if potentialMatch does match globPattern.
@@ -1079,95 +1100,95 @@ public class GDBPatternMatchingExpressions extends AbstractDsfService implements
// Convert the glob-pattern into java regex to do the matching
boolean inBrackets = false;
- char[] patternArray = globPattern.toCharArray();
- char[] resultArray = new char[patternArray.length * 2 + 2];
- int pos = 0;
+ char[] patternArray = globPattern.toCharArray();
+ char[] resultArray = new char[patternArray.length * 2 + 2];
+ int pos = 0;
- // Must match from the very beginning
- resultArray[pos++] = '^';
+ // Must match from the very beginning
+ resultArray[pos++] = '^';
for (int i = 0; i < patternArray.length; i++) {
- switch(patternArray[i]) {
- case '?':
- if (inBrackets) {
- resultArray[pos++] = '?';
- } else {
- resultArray[pos++] = '.';
- }
- break;
-
- case '*':
- if (!inBrackets) {
- resultArray[pos++] = '.';
- }
- resultArray[pos++] = '*';
- break;
-
- case '-':
- if (!inBrackets) {
- resultArray[pos++] = '\\';
- }
- resultArray[pos++] = '-';
- break;
-
- case '[':
- inBrackets = true;
- resultArray[pos++] = '[';
-
- if (i < patternArray.length - 1) {
- switch (patternArray[i+1]) {
- case '!':
- case '^':
- resultArray[pos++] = '^';
- i++;
- break;
-
- case ']':
- resultArray[pos++] = ']';
- i++;
- break;
- }
- }
- break;
-
- case ']':
- resultArray[pos++] = ']';
- inBrackets = false;
- break;
-
- case '\\':
- if (i == 0 && patternArray.length > 1 && patternArray[1] == '~') {
- resultArray[pos++] = '~';
- ++i;
- } else {
- resultArray[pos++] = '\\';
- if (i < patternArray.length - 1 && "*?[]".indexOf(patternArray[i+1]) != -1) { //$NON-NLS-1$
- resultArray[pos++] = patternArray[++i];
- } else {
- resultArray[pos++] = '\\';
- }
- }
- break;
-
- default:
- // We must escape characters that are not digits or arrays
- // specifically, "^$.{}()+|<>"
- if (!Character.isLetterOrDigit(patternArray[i])) {
- resultArray[pos++] = '\\';
- }
- resultArray[pos++] = patternArray[i];
- break;
- }
+ switch (patternArray[i]) {
+ case '?':
+ if (inBrackets) {
+ resultArray[pos++] = '?';
+ } else {
+ resultArray[pos++] = '.';
+ }
+ break;
+
+ case '*':
+ if (!inBrackets) {
+ resultArray[pos++] = '.';
+ }
+ resultArray[pos++] = '*';
+ break;
+
+ case '-':
+ if (!inBrackets) {
+ resultArray[pos++] = '\\';
+ }
+ resultArray[pos++] = '-';
+ break;
+
+ case '[':
+ inBrackets = true;
+ resultArray[pos++] = '[';
+
+ if (i < patternArray.length - 1) {
+ switch (patternArray[i + 1]) {
+ case '!':
+ case '^':
+ resultArray[pos++] = '^';
+ i++;
+ break;
+
+ case ']':
+ resultArray[pos++] = ']';
+ i++;
+ break;
+ }
+ }
+ break;
+
+ case ']':
+ resultArray[pos++] = ']';
+ inBrackets = false;
+ break;
+
+ case '\\':
+ if (i == 0 && patternArray.length > 1 && patternArray[1] == '~') {
+ resultArray[pos++] = '~';
+ ++i;
+ } else {
+ resultArray[pos++] = '\\';
+ if (i < patternArray.length - 1 && "*?[]".indexOf(patternArray[i + 1]) != -1) { //$NON-NLS-1$
+ resultArray[pos++] = patternArray[++i];
+ } else {
+ resultArray[pos++] = '\\';
+ }
+ }
+ break;
+
+ default:
+ // We must escape characters that are not digits or arrays
+ // specifically, "^$.{}()+|<>"
+ if (!Character.isLetterOrDigit(patternArray[i])) {
+ resultArray[pos++] = '\\';
+ }
+ resultArray[pos++] = patternArray[i];
+ break;
+ }
}
// Must match until the very end
- resultArray[pos++] = '$';
-
- try {
- Pattern pattern = Pattern.compile(new String(resultArray, 0, pos), Pattern.CASE_INSENSITIVE);
- Matcher matcher = pattern.matcher(potentialMatch);
- return matcher.find();
- } catch(Exception e) {
- // If the user put an invalid pattern, we just ignore it
- return false;
- }
+ resultArray[pos++] = '$';
+
+ try {
+ Pattern pattern = Pattern.compile(new String(resultArray, 0, pos), Pattern.CASE_INSENSITIVE);
+ Matcher matcher = pattern.matcher(potentialMatch);
+ return matcher.find();
+ } catch (Exception e) {
+ // If the user put an invalid pattern, we just ignore it
+ return false;
+ }
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses.java
index 51261c12da0..fc70fe604b7 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
* Anton Gorenkov - Need to use a process factory (Bug 210366)
@@ -73,69 +73,65 @@ import org.eclipse.debug.core.model.IProcess;
import org.osgi.framework.BundleContext;
public class GDBProcesses extends MIProcesses implements IGDBProcesses {
-
+
private class GDBContainerDMC extends MIContainerDMC implements IMemoryDMContext {
public GDBContainerDMC(String sessionId, IProcessDMContext processDmc, String groupId) {
super(sessionId, processDmc, groupId);
}
}
-
- private IGDBControl fGdb;
- private IGDBBackend fBackend;
- private CommandFactory fCommandFactory;
-
- // Indicates if we are currently connected to an inferior
- // We only need a boolean type since we only support single process debugging
- // in this version of the service
- private boolean fConnected;
-
- // A map of pid to names. It is filled when we get all the
- // processes that are running
- private Map<Integer, String> fProcessNames = new HashMap<Integer, String>();
-
- // Id of our process. Currently, we only know it for an attach session.
- private String fProcId;
-
- // If we can use a PTY, we store it here
+
+ private IGDBControl fGdb;
+ private IGDBBackend fBackend;
+ private CommandFactory fCommandFactory;
+
+ // Indicates if we are currently connected to an inferior
+ // We only need a boolean type since we only support single process debugging
+ // in this version of the service
+ private boolean fConnected;
+
+ // A map of pid to names. It is filled when we get all the
+ // processes that are running
+ private Map<Integer, String> fProcessNames = new HashMap<Integer, String>();
+
+ // Id of our process. Currently, we only know it for an attach session.
+ private String fProcId;
+
+ // If we can use a PTY, we store it here
private PTY fPty;
- public GDBProcesses(DsfSession session) {
- super(session);
- }
+ public GDBProcesses(DsfSession session) {
+ super(session);
+ }
- @Override
- public void initialize(final RequestMonitor requestMonitor) {
- super.initialize(new ImmediateRequestMonitor(requestMonitor) {
- @Override
- protected void handleSuccess() {
- doInitialize(requestMonitor);
+ @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) {
-
- fGdb = getServicesTracker().getService(IGDBControl.class);
- fBackend = getServicesTracker().getService(IGDBBackend.class);
+
+ fGdb = getServicesTracker().getService(IGDBControl.class);
+ fBackend = getServicesTracker().getService(IGDBBackend.class);
fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
// Register this service.
- register(new String[] { IProcesses.class.getName(),
- IMIProcesses.class.getName(),
- IGDBProcesses.class.getName(),
- MIProcesses.class.getName(),
- GDBProcesses.class.getName() },
- new Hashtable<String, String>());
-
- getSession().addServiceEventListener(this, null);
+ register(new String[] { IProcesses.class.getName(), IMIProcesses.class.getName(), IGDBProcesses.class.getName(),
+ MIProcesses.class.getName(), GDBProcesses.class.getName() }, new Hashtable<String, String>());
+
+ getSession().addServiceEventListener(this, null);
requestMonitor.done();
}
@@ -143,10 +139,10 @@ public class GDBProcesses extends MIProcesses implements IGDBProcesses {
@Override
public void shutdown(RequestMonitor requestMonitor) {
unregister();
- getSession().removeServiceEventListener(this);
+ getSession().removeServiceEventListener(this);
super.shutdown(requestMonitor);
}
-
+
/**
* @return The bundle context of the plug-in to which this service belongs.
*/
@@ -156,31 +152,31 @@ public class GDBProcesses extends MIProcesses implements IGDBProcesses {
}
@Override
- public IMIContainerDMContext createContainerContext(IProcessDMContext processDmc,
- String groupId) {
+ public IMIContainerDMContext createContainerContext(IProcessDMContext processDmc, String groupId) {
return new GDBContainerDMC(getSession().getId(), processDmc, groupId);
}
-
- /** @since 4.0 */
+
+ /** @since 4.0 */
@Override
- public IMIContainerDMContext createContainerContextFromGroupId(ICommandControlDMContext controlDmc, String groupId) {
- IProcessDMContext processDmc;
+ public IMIContainerDMContext createContainerContextFromGroupId(ICommandControlDMContext controlDmc,
+ String groupId) {
+ IProcessDMContext processDmc;
if (fProcId != null) {
processDmc = createProcessContext(controlDmc, fProcId);
} else {
processDmc = createProcessContext(controlDmc, MIProcesses.UNKNOWN_PROCESS_ID);
}
- return createContainerContext(processDmc, groupId);
- }
+ return createContainerContext(processDmc, groupId);
+ }
@Override
public void getExecutionData(IThreadDMContext dmc, DataRequestMonitor<IThreadDMData> rm) {
if (dmc instanceof IMIProcessDMContext) {
- String pidStr = ((IMIProcessDMContext)dmc).getProcId();
+ String pidStr = ((IMIProcessDMContext) dmc).getProcId();
// In our context hierarchy we don't actually use the pid in this version, because in this version,
// we only debug a single process. This means we will not have a proper pid in all cases
// inside the context, so must find it another way. Note that this method is also called to find the name
- // of processes to attach to, and in this case, we do have the proper pid.
+ // of processes to attach to, and in this case, we do have the proper pid.
if (pidStr == null || pidStr.length() == 0) {
pidStr = fProcId;
}
@@ -189,7 +185,7 @@ public class GDBProcesses extends MIProcesses implements IGDBProcesses {
pid = Integer.parseInt(pidStr);
} catch (NumberFormatException e) {
}
-
+
String name = fProcessNames.get(pid);
if (name == null) {
// Hmm. Strange. But if the pid is our inferior's, we can just use the binary name
@@ -198,7 +194,7 @@ public class GDBProcesses extends MIProcesses implements IGDBProcesses {
}
}
if (name == null) {
- // This could happen if a process has terminated but the
+ // This could happen if a process has terminated but the
// debug session is not terminated because the preference
// to keep GDB running has been selected.
name = "Unknown name"; //$NON-NLS-1$
@@ -208,7 +204,7 @@ public class GDBProcesses extends MIProcesses implements IGDBProcesses {
// Therefore, we assume we are looking for our own process
name = fBackend.getProgramPath().lastSegment();
}
-
+
rm.setData(new MIThreadDMData(name, pidStr));
rm.done();
} else {
@@ -218,82 +214,81 @@ public class GDBProcesses extends MIProcesses implements IGDBProcesses {
@Override
public void isDebuggerAttachSupported(IDMContext dmc, DataRequestMonitor<Boolean> rm) {
- if (fBackend.getIsAttachSession() && !fConnected) {
- rm.setData(true);
- } else {
- rm.setData(false);
- }
+ if (fBackend.getIsAttachSession() && !fConnected) {
+ rm.setData(true);
+ } else {
+ rm.setData(false);
+ }
rm.done();
}
@Override
- public void attachDebuggerToProcess(IProcessDMContext procCtx, DataRequestMonitor<IDMContext> rm) {
+ public void attachDebuggerToProcess(IProcessDMContext procCtx, DataRequestMonitor<IDMContext> rm) {
attachDebuggerToProcess(procCtx, null, rm);
}
-
- /**
+
+ /**
* @since 4.0
*/
@Override
- public void attachDebuggerToProcess(final IProcessDMContext procCtx, String binaryPath, final DataRequestMonitor<IDMContext> rm) {
+ public void attachDebuggerToProcess(final IProcessDMContext procCtx, String binaryPath,
+ final DataRequestMonitor<IDMContext> rm) {
final IMIContainerDMContext containerDmc = createContainerContext(procCtx, MIProcesses.UNIQUE_GROUP_ID);
DataRequestMonitor<MIInfo> attachRm = new ImmediateDataRequestMonitor<MIInfo>(rm) {
@Override
protected void handleSuccess() {
- GDBProcesses.super.attachDebuggerToProcess(
- procCtx,
- new ImmediateDataRequestMonitor<IDMContext>(rm) {
- @Override
- protected void handleSuccess() {
- // For an attach, we actually know the pid, so let's remember it
- fProcId = ((IMIProcessDMContext)procCtx).getProcId();
- final IDMContext ctx = getData();
- rm.setData(ctx);
-
- ImmediateExecutor.getInstance().execute(
- new Sequence(getExecutor(), rm) {
-
- private Step[] fSteps = new Step[] {
- // Initialize memory data for this process
- new Step() {
- @Override
- public void execute(RequestMonitor memoryDataRm) {
- IGDBMemory memory = getServicesTracker().getService(IGDBMemory.class);
- IMemoryDMContext memContext = DMContexts.getAncestorOfType(ctx, IMemoryDMContext.class);
- if (memory == null || memContext == null) {
- memoryDataRm.done();
- return;
- }
- memory.initializeMemoryData(memContext, memoryDataRm);
- };
- },
-
- // Start tracking breakpoints.
- new Step() {
- @Override
- public void execute(RequestMonitor trackBpRm) {
- MIBreakpointsManager bpmService = getServicesTracker().getService(MIBreakpointsManager.class);
- IContainerDMContext containerDmc = DMContexts.getAncestorOfType(ctx, IContainerDMContext.class);
- bpmService.startTrackingBpForProcess(containerDmc, trackBpRm);
- };
+ GDBProcesses.super.attachDebuggerToProcess(procCtx, new ImmediateDataRequestMonitor<IDMContext>(rm) {
+ @Override
+ protected void handleSuccess() {
+ // For an attach, we actually know the pid, so let's remember it
+ fProcId = ((IMIProcessDMContext) procCtx).getProcId();
+ final IDMContext ctx = getData();
+ rm.setData(ctx);
+
+ ImmediateExecutor.getInstance().execute(new Sequence(getExecutor(), rm) {
+
+ private Step[] fSteps = new Step[] {
+ // Initialize memory data for this process
+ new Step() {
+ @Override
+ public void execute(RequestMonitor memoryDataRm) {
+ IGDBMemory memory = getServicesTracker().getService(IGDBMemory.class);
+ IMemoryDMContext memContext = DMContexts.getAncestorOfType(ctx,
+ IMemoryDMContext.class);
+ if (memory == null || memContext == null) {
+ memoryDataRm.done();
+ return;
}
+ memory.initializeMemoryData(memContext, memoryDataRm);
};
+ },
+
+ // Start tracking breakpoints.
+ new Step() {
@Override
- public Step[] getSteps() {
- return fSteps;
- }
-
- });
+ public void execute(RequestMonitor trackBpRm) {
+ MIBreakpointsManager bpmService = getServicesTracker()
+ .getService(MIBreakpointsManager.class);
+ IContainerDMContext containerDmc = DMContexts.getAncestorOfType(ctx,
+ IContainerDMContext.class);
+ bpmService.startTrackingBpForProcess(containerDmc, trackBpRm);
+ };
+ } };
+
+ @Override
+ public Step[] getSteps() {
+ return fSteps;
}
+
});
+ }
+ });
}
};
-
+
if (binaryPath != null) {
- fGdb.queueCommand(
- fCommandFactory.createMIFileExecAndSymbols(containerDmc, binaryPath),
- attachRm);
+ fGdb.queueCommand(fCommandFactory.createMIFileExecAndSymbols(containerDmc, binaryPath), attachRm);
return;
}
@@ -302,55 +297,53 @@ public class GDBProcesses extends MIProcesses implements IGDBProcesses {
}
@Override
- public void canDetachDebuggerFromProcess(IDMContext dmc, DataRequestMonitor<Boolean> rm) {
- if (fConnected) {
- rm.setData(true);
- } else {
- rm.setData(false);
- }
- rm.done();
- }
+ public void canDetachDebuggerFromProcess(IDMContext dmc, DataRequestMonitor<Boolean> rm) {
+ if (fConnected) {
+ rm.setData(true);
+ } else {
+ rm.setData(false);
+ }
+ rm.done();
+ }
@Override
- public void detachDebuggerFromProcess(IDMContext dmc, final RequestMonitor rm) {
- super.detachDebuggerFromProcess(
- dmc,
- new RequestMonitor(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- fProcId = null;
- rm.done();
- }
- });
+ public void detachDebuggerFromProcess(IDMContext dmc, final RequestMonitor rm) {
+ super.detachDebuggerFromProcess(dmc, new RequestMonitor(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ fProcId = null;
+ rm.done();
+ }
+ });
}
-
+
@Override
- public void debugNewProcess(IDMContext dmc, String file,
- Map<String, Object> attributes, DataRequestMonitor<IDMContext> rm) {
- ImmediateExecutor.getInstance().execute(
- getDebugNewProcessSequence(getExecutor(), true, dmc, file, attributes, rm));
+ public void debugNewProcess(IDMContext dmc, String file, Map<String, Object> attributes,
+ DataRequestMonitor<IDMContext> rm) {
+ ImmediateExecutor.getInstance()
+ .execute(getDebugNewProcessSequence(getExecutor(), true, dmc, file, attributes, rm));
}
-
+
/**
* Return the sequence that is to be used to create a new process.
* Allows others to extend more easily.
* @since 4.0
*/
- protected Sequence getDebugNewProcessSequence(DsfExecutor executor, boolean isInitial, IDMContext dmc, String file,
- Map<String, Object> attributes, DataRequestMonitor<IDMContext> rm) {
+ protected Sequence getDebugNewProcessSequence(DsfExecutor executor, boolean isInitial, IDMContext dmc, String file,
+ Map<String, Object> attributes, DataRequestMonitor<IDMContext> rm) {
return new DebugNewProcessSequence(executor, isInitial, dmc, file, attributes, rm);
}
-
+
@Override
public void getProcessesBeingDebugged(IDMContext dmc, DataRequestMonitor<IDMContext[]> rm) {
- if (fConnected) {
- super.getProcessesBeingDebugged(dmc, rm);
- } else {
- rm.setData(new IDMContext[0]);
- rm.done();
- }
+ if (fConnected) {
+ super.getProcessesBeingDebugged(dmc, rm);
+ } else {
+ rm.setData(new IDMContext[0]);
+ rm.done();
+ }
}
-
+
@Override
public void getRunningProcesses(IDMContext dmc, final DataRequestMonitor<IProcessDMContext[]> rm) {
final ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
@@ -385,90 +378,90 @@ public class GDBProcesses extends MIProcesses implements IGDBProcesses {
private IProcessDMContext[] makeProcessDMCs(ICommandControlDMContext controlDmc, IProcessInfo[] processes) {
IProcessDMContext[] procDmcs = new IMIProcessDMContext[processes.length];
- for (int i=0; i<procDmcs.length; i++) {
- procDmcs[i] = createProcessContext(controlDmc, Integer.toString(processes[i].getPid()));
+ for (int i = 0; i < procDmcs.length; i++) {
+ procDmcs[i] = createProcessContext(controlDmc, Integer.toString(processes[i].getPid()));
}
return procDmcs;
}
-
+
@Override
- public void terminate(IThreadDMContext thread, final RequestMonitor rm) {
+ public void terminate(IThreadDMContext thread, final RequestMonitor rm) {
// For a core session, there is no concept of killing the inferior,
// so lets kill GDB
- if (fBackend.getSessionType() == SessionType.CORE) {
+ if (fBackend.getSessionType() == SessionType.CORE) {
fGdb.terminate(rm);
} else if (thread instanceof IMIProcessDMContext) {
- getDebuggingContext(
- thread,
- new ImmediateDataRequestMonitor<IDMContext>(rm) {
- @Override
- protected void handleSuccess() {
- if (getData() instanceof IMIContainerDMContext) {
- IMIRunControl runControl = getServicesTracker().getService(IMIRunControl.class);
- if (runControl != null && !runControl.isTargetAcceptingCommands()) {
- fBackend.interrupt();
- }
-
- final IMIContainerDMContext container = (IMIContainerDMContext)getData();
- fGdb.queueCommand(
- fCommandFactory.createMIInterpreterExecConsoleKill(container),
- new ImmediateDataRequestMonitor<MIInfo>(rm) {
- @Override
- protected void handleSuccess() {
- // Before GDB 7.0, we must send a container exited event ourselves
- getSession().dispatchEvent(
- new ContainerExitedDMEvent(container), getProperties());
-
- rm.done();
- }
- });
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid process context.", null)); //$NON-NLS-1$
- rm.done();
- }
+ getDebuggingContext(thread, new ImmediateDataRequestMonitor<IDMContext>(rm) {
+ @Override
+ protected void handleSuccess() {
+ if (getData() instanceof IMIContainerDMContext) {
+ IMIRunControl runControl = getServicesTracker().getService(IMIRunControl.class);
+ if (runControl != null && !runControl.isTargetAcceptingCommands()) {
+ fBackend.interrupt();
}
- });
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid process context.", null)); //$NON-NLS-1$
- rm.done();
- }
+
+ final IMIContainerDMContext container = (IMIContainerDMContext) getData();
+ fGdb.queueCommand(fCommandFactory.createMIInterpreterExecConsoleKill(container),
+ new ImmediateDataRequestMonitor<MIInfo>(rm) {
+ @Override
+ protected void handleSuccess() {
+ // Before GDB 7.0, we must send a container exited event ourselves
+ getSession().dispatchEvent(new ContainerExitedDMEvent(container),
+ getProperties());
+
+ rm.done();
+ }
+ });
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR,
+ "Invalid process context.", null)); //$NON-NLS-1$
+ rm.done();
+ }
+ }
+ });
+ } else {
+ rm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid process context.", null)); //$NON-NLS-1$
+ rm.done();
+ }
}
-
- /** @since 4.0 */
+
+ /** @since 4.0 */
@Override
- public IMIExecutionDMContext[] getExecutionContexts(IMIContainerDMContext containerDmc) {
- assert false; // This is not being used before GDB 7.0
- return null;
- }
-
+ public IMIExecutionDMContext[] getExecutionContexts(IMIContainerDMContext containerDmc) {
+ assert false; // This is not being used before GDB 7.0
+ return null;
+ }
+
/** @since 4.0 */
@Override
- public void canRestart(IContainerDMContext containerDmc, DataRequestMonitor<Boolean> rm) {
- if (fBackend.getIsAttachSession() || fBackend.getSessionType() == SessionType.CORE) {
- rm.setData(false);
- rm.done();
- return;
- }
-
- // Before GDB6.8, the Linux gdbserver would restart a new
- // process when getting a -exec-run but the communication
- // with GDB had a bug and everything hung.
- // with GDB6.8 the program restarts properly one time,
- // but on a second attempt, gdbserver crashes.
- // So, lets just turn off the Restart for Remote debugging
- if (fBackend.getSessionType() == SessionType.REMOTE) {
- rm.setData(false);
- rm.done();
- return;
- }
-
- rm.setData(true);
- rm.done();
+ public void canRestart(IContainerDMContext containerDmc, DataRequestMonitor<Boolean> rm) {
+ if (fBackend.getIsAttachSession() || fBackend.getSessionType() == SessionType.CORE) {
+ rm.setData(false);
+ rm.done();
+ return;
+ }
+
+ // Before GDB6.8, the Linux gdbserver would restart a new
+ // process when getting a -exec-run but the communication
+ // with GDB had a bug and everything hung.
+ // with GDB6.8 the program restarts properly one time,
+ // but on a second attempt, gdbserver crashes.
+ // So, lets just turn off the Restart for Remote debugging
+ if (fBackend.getSessionType() == SessionType.REMOTE) {
+ rm.setData(false);
+ rm.done();
+ return;
+ }
+
+ rm.setData(true);
+ rm.done();
}
-
+
/** @since 4.0 */
@Override
- public void restart(IContainerDMContext containerDmc, Map<String, Object> attributes, DataRequestMonitor<IContainerDMContext> rm) {
+ public void restart(IContainerDMContext containerDmc, Map<String, Object> attributes,
+ DataRequestMonitor<IContainerDMContext> rm) {
// Before performing the restart, check if the process is properly suspended.
// Don't need to worry about non-stop before GDB 7.0, so we can simply
// interrupt the backend, if needed
@@ -482,79 +475,81 @@ public class GDBProcesses extends MIProcesses implements IGDBProcesses {
// a new process with a new pid, so we should create a container for it, and not use the old container with the old pid.
// We must create the process dmc explicitly because using createContainerContextFromGroupId() may automatically insert
// the old pid.
- IProcessDMContext processDmc = createProcessContext(fGdb.getContext(), MIProcesses.UNKNOWN_PROCESS_ID);
- IContainerDMContext newContainerDmc = createContainerContext(processDmc, MIProcesses.UNIQUE_GROUP_ID);
+ IProcessDMContext processDmc = createProcessContext(fGdb.getContext(), MIProcesses.UNKNOWN_PROCESS_ID);
+ IContainerDMContext newContainerDmc = createContainerContext(processDmc, MIProcesses.UNIQUE_GROUP_ID);
startOrRestart(newContainerDmc, attributes, true, rm);
}
-
+
/** @since 4.0 */
@Override
- public void start(IContainerDMContext containerDmc, Map<String, Object> attributes, DataRequestMonitor<IContainerDMContext> rm) {
+ public void start(IContainerDMContext containerDmc, Map<String, Object> attributes,
+ DataRequestMonitor<IContainerDMContext> rm) {
startOrRestart(containerDmc, attributes, false, rm);
}
-
+
/**
* This method does the necessary work to setup the input/output streams for the
* inferior process, by either preparing the PTY to be used, to simply leaving
* the PTY null, which indicates that the input/output streams of the CLI should
* be used instead; this decision is based on the type of session.
- *
+ *
* @since 4.0
*/
protected void initializeInputOutput(IContainerDMContext containerDmc, final RequestMonitor rm) {
- if (fBackend.getSessionType() == SessionType.REMOTE || fBackend.getIsAttachSession()) {
- // These types do not use a PTY
- fPty = null;
- rm.done();
- } else {
- // These types always use a PTY
- try {
- fPty = new PTY();
+ if (fBackend.getSessionType() == SessionType.REMOTE || fBackend.getIsAttachSession()) {
+ // These types do not use a PTY
+ fPty = null;
+ rm.done();
+ } else {
+ // These types always use a PTY
+ try {
+ fPty = new PTY();
fPty.validateSlaveName();
- // Tell GDB to use this PTY
- fGdb.queueCommand(
- fCommandFactory.createMIInferiorTTYSet((IMIContainerDMContext)containerDmc, fPty.getSlaveName()),
- new ImmediateDataRequestMonitor<MIInfo>(rm) {
- @Override
- protected void handleFailure() {
- // We were not able to tell GDB to use the PTY
- // so we won't use it at all.
- fPty = null;
- rm.done();
- }
- });
- } catch (IOException e) {
- fPty = null;
- rm.done();
- }
- }
+ // Tell GDB to use this PTY
+ fGdb.queueCommand(fCommandFactory.createMIInferiorTTYSet((IMIContainerDMContext) containerDmc,
+ fPty.getSlaveName()), new ImmediateDataRequestMonitor<MIInfo>(rm) {
+ @Override
+ protected void handleFailure() {
+ // We were not able to tell GDB to use the PTY
+ // so we won't use it at all.
+ fPty = null;
+ rm.done();
+ }
+ });
+ } catch (IOException e) {
+ fPty = null;
+ rm.done();
+ }
+ }
}
+
/**
* @since 4.0
*/
- protected void createConsole(final IContainerDMContext containerDmc, final boolean restart, final RequestMonitor rm) {
- if (fBackend.getSessionType() == SessionType.REMOTE || fBackend.getIsAttachSession()) {
- // Remote or attach sessions shouldn't have a console, since the inferior is not started
- // by eclipse but by gdbserver
- rm.done();
- return;
- }
-
+ protected void createConsole(final IContainerDMContext containerDmc, final boolean restart,
+ final RequestMonitor rm) {
+ if (fBackend.getSessionType() == SessionType.REMOTE || fBackend.getIsAttachSession()) {
+ // Remote or attach sessions shouldn't have a console, since the inferior is not started
+ // by eclipse but by gdbserver
+ rm.done();
+ return;
+ }
+
initializeInputOutput(containerDmc, new ImmediateRequestMonitor(rm) {
@Override
protected void handleSuccess() {
Process inferiorProcess;
- if (fPty == null) {
- inferiorProcess = new MIInferiorProcess(containerDmc, fBackend.getMIOutputStream());
- } else {
- inferiorProcess = new MIInferiorProcess(containerDmc, fPty);
- }
+ if (fPty == null) {
+ inferiorProcess = new MIInferiorProcess(containerDmc, fBackend.getMIOutputStream());
+ } else {
+ inferiorProcess = new MIInferiorProcess(containerDmc, fPty);
+ }
- final Process inferior = inferiorProcess;
+ final Process inferior = inferiorProcess;
final String label = fBackend.getProgramPath().lastSegment();
- final ILaunch launch = (ILaunch)getSession().getModelAdapter(ILaunch.class);
+ final ILaunch launch = (ILaunch) getSession().getModelAdapter(ILaunch.class);
// Add the inferior to the launch.
// This cannot be done on the executor or things deadlock.
@@ -574,16 +569,17 @@ public class GDBProcesses extends MIProcesses implements IGDBProcesses {
}
// Add the inferior
- // Need to go through DebugPlugin.newProcess so that we can use
+ // Need to go through DebugPlugin.newProcess so that we can use
// the overrideable process factory to allow others to override.
// First set attribute to specify we want to create an inferior process.
// Bug 210366
Map<String, String> attributes = new HashMap<String, String>();
- attributes.put(IGdbDebugConstants.PROCESS_TYPE_CREATION_ATTR,
- IGdbDebugConstants.INFERIOR_PROCESS_CREATION_VALUE);
- IProcess runtimeInferior = DebugPlugin.newProcess(launch, inferior, label, attributes);
- // Now set the inferior groupId
- runtimeInferior.setAttribute(IGdbDebugConstants.INFERIOR_GROUPID_ATTR, MIProcesses.UNIQUE_GROUP_ID);
+ attributes.put(IGdbDebugConstants.PROCESS_TYPE_CREATION_ATTR,
+ IGdbDebugConstants.INFERIOR_PROCESS_CREATION_VALUE);
+ IProcess runtimeInferior = DebugPlugin.newProcess(launch, inferior, label, attributes);
+ // Now set the inferior groupId
+ runtimeInferior.setAttribute(IGdbDebugConstants.INFERIOR_GROUPID_ATTR,
+ MIProcesses.UNIQUE_GROUP_ID);
rm.done();
}
@@ -592,121 +588,122 @@ public class GDBProcesses extends MIProcesses implements IGDBProcesses {
});
}
- /**
- * Insert breakpoint at entry if set, and start or restart the program.
- *
- * @since 4.0
- */
- protected void startOrRestart(final IContainerDMContext containerDmc, final Map<String, Object> attributes,
- boolean restart, final DataRequestMonitor<IContainerDMContext> requestMonitor) {
- if (fBackend.getIsAttachSession()) {
- // When attaching to a running process, we do not need to set a breakpoint or
- // start the program; it is left up to the user.
- requestMonitor.setData(containerDmc);
- requestMonitor.done();
- return;
- }
-
- createConsole(containerDmc, restart, new ImmediateRequestMonitor(requestMonitor) {
- @Override
- protected void handleSuccess() {
- final DataRequestMonitor<MIInfo> execMonitor = new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor) {
- @Override
- protected void handleSuccess() {
- if (fBackend.getSessionType() != SessionType.REMOTE) {
- // Don't send the ContainerStarted event for a remote session because
- // it has already been done by MIRunControlEventProcessor when receiving
- // the ^connect
- getSession().dispatchEvent(new ContainerStartedDMEvent(containerDmc), getProperties());
- }
- requestMonitor.setData(containerDmc);
- requestMonitor.done();
- }
- };
-
- final ICommand<MIInfo> execCommand;
- if (useContinueCommand()) {
- execCommand = fCommandFactory.createMIExecContinue(containerDmc);
- } else {
- execCommand = fCommandFactory.createMIExecRun(containerDmc);
- }
-
- boolean stopInMain = CDebugUtils.getAttribute(attributes,
- ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN,
- LaunchUtils.getStopAtMainDefault());
-
- if (!stopInMain) {
- // Just start the program.
- fGdb.queueCommand(execCommand, execMonitor);
- } else {
- String stopSymbol = CDebugUtils.getAttribute(attributes,
- ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL,
- LaunchUtils.getStopAtMainSymbolDefault());
-
- // Insert a breakpoint at the requested stop symbol.
- IBreakpointsTargetDMContext bpTarget = DMContexts.getAncestorOfType(containerDmc, IBreakpointsTargetDMContext.class);
- fGdb.queueCommand(
- fCommandFactory.createMIBreakInsert(bpTarget, true, false, null, 0, stopSymbol, "0"), //$NON-NLS-1$
- new DataRequestMonitor<MIBreakInsertInfo>(getExecutor(), requestMonitor) {
- @Override
- protected void handleSuccess() {
- // After the break-insert is done, execute the -exec-run or -exec-continue command.
- fGdb.queueCommand(execCommand, execMonitor);
- }
- });
- }
- }
- });
- }
-
- /**
- * This method indicates if we should use the -exec-continue command
- * instead of the -exec-run command.
- * This method can be overridden to allow for customization.
- * @since 4.0
- */
- protected boolean useContinueCommand() {
- // When doing remote debugging, we use -exec-continue instead of -exec-run
- // Restart does not apply to remote sessions
- return fBackend.getSessionType() == SessionType.REMOTE;
- }
-
- @Override
- @DsfServiceEventHandler
- public void eventDispatched(IStartedDMEvent e) {
- if (e.getDMContext() instanceof IContainerDMContext) {
- fConnected = true;
- }
- super.eventDispatched(e);
+ /**
+ * Insert breakpoint at entry if set, and start or restart the program.
+ *
+ * @since 4.0
+ */
+ protected void startOrRestart(final IContainerDMContext containerDmc, final Map<String, Object> attributes,
+ boolean restart, final DataRequestMonitor<IContainerDMContext> requestMonitor) {
+ if (fBackend.getIsAttachSession()) {
+ // When attaching to a running process, we do not need to set a breakpoint or
+ // start the program; it is left up to the user.
+ requestMonitor.setData(containerDmc);
+ requestMonitor.done();
+ return;
+ }
+
+ createConsole(containerDmc, restart, new ImmediateRequestMonitor(requestMonitor) {
+ @Override
+ protected void handleSuccess() {
+ final DataRequestMonitor<MIInfo> execMonitor = new DataRequestMonitor<MIInfo>(getExecutor(),
+ requestMonitor) {
+ @Override
+ protected void handleSuccess() {
+ if (fBackend.getSessionType() != SessionType.REMOTE) {
+ // Don't send the ContainerStarted event for a remote session because
+ // it has already been done by MIRunControlEventProcessor when receiving
+ // the ^connect
+ getSession().dispatchEvent(new ContainerStartedDMEvent(containerDmc), getProperties());
+ }
+ requestMonitor.setData(containerDmc);
+ requestMonitor.done();
+ }
+ };
+
+ final ICommand<MIInfo> execCommand;
+ if (useContinueCommand()) {
+ execCommand = fCommandFactory.createMIExecContinue(containerDmc);
+ } else {
+ execCommand = fCommandFactory.createMIExecRun(containerDmc);
+ }
+
+ boolean stopInMain = CDebugUtils.getAttribute(attributes,
+ ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN,
+ LaunchUtils.getStopAtMainDefault());
+
+ if (!stopInMain) {
+ // Just start the program.
+ fGdb.queueCommand(execCommand, execMonitor);
+ } else {
+ String stopSymbol = CDebugUtils.getAttribute(attributes,
+ ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL,
+ LaunchUtils.getStopAtMainSymbolDefault());
+
+ // Insert a breakpoint at the requested stop symbol.
+ IBreakpointsTargetDMContext bpTarget = DMContexts.getAncestorOfType(containerDmc,
+ IBreakpointsTargetDMContext.class);
+ fGdb.queueCommand(
+ fCommandFactory.createMIBreakInsert(bpTarget, true, false, null, 0, stopSymbol, "0"), //$NON-NLS-1$
+ new DataRequestMonitor<MIBreakInsertInfo>(getExecutor(), requestMonitor) {
+ @Override
+ protected void handleSuccess() {
+ // After the break-insert is done, execute the -exec-run or -exec-continue command.
+ fGdb.queueCommand(execCommand, execMonitor);
+ }
+ });
+ }
+ }
+ });
+ }
+
+ /**
+ * This method indicates if we should use the -exec-continue command
+ * instead of the -exec-run command.
+ * This method can be overridden to allow for customization.
+ * @since 4.0
+ */
+ protected boolean useContinueCommand() {
+ // When doing remote debugging, we use -exec-continue instead of -exec-run
+ // Restart does not apply to remote sessions
+ return fBackend.getSessionType() == SessionType.REMOTE;
+ }
+
+ @Override
+ @DsfServiceEventHandler
+ public void eventDispatched(IStartedDMEvent e) {
+ if (e.getDMContext() instanceof IContainerDMContext) {
+ fConnected = true;
+ }
+ super.eventDispatched(e);
+ }
+
+ @Override
+ @DsfServiceEventHandler
+ public void eventDispatched(IExitedDMEvent e) {
+ if (e.getDMContext() instanceof IContainerDMContext) {
+ fConnected = false;
+
+ if (Platform.getPreferencesService().getBoolean(GdbPlugin.PLUGIN_ID,
+ IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, true, null)) {
+ // If the inferior finishes, let's terminate GDB
+ fGdb.terminate(new ImmediateRequestMonitor());
+ }
+ }
+ super.eventDispatched(e);
}
- @Override
- @DsfServiceEventHandler
- public void eventDispatched(IExitedDMEvent e) {
- if (e.getDMContext() instanceof IContainerDMContext) {
- fConnected = false;
-
- if (Platform.getPreferencesService().getBoolean(GdbPlugin.PLUGIN_ID,
- IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB,
- true, null)) {
- // If the inferior finishes, let's terminate GDB
- fGdb.terminate(new ImmediateRequestMonitor());
- }
- }
- super.eventDispatched(e);
- }
-
- /**
+ /**
* @since 3.0
*/
- @DsfServiceEventHandler
- public void eventDispatched(MIStoppedEvent e) {
-// Postponed because 'info program' yields different result on different platforms.
-// https://bugs.eclipse.org/bugs/show_bug.cgi?id=305385#c20
-//
-// // Get the PID of the inferior through gdb (if we don't have it already)
-//
-//
-// fGdb.getInferiorProcess().update();
- }
+ @DsfServiceEventHandler
+ public void eventDispatched(MIStoppedEvent e) {
+ // Postponed because 'info program' yields different result on different platforms.
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=305385#c20
+ //
+ // // Get the PID of the inferior through gdb (if we don't have it already)
+ //
+ //
+ // fGdb.getInferiorProcess().update();
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java
index c4ac020b57b..82288507b27 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java
@@ -7,12 +7,12 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
* Onur Akdemir (TUBITAK BILGEM-ITI) - Multi-process debugging (Bug 237306)
* John Dallaway - GDB 7.x MI thread details field ignored (Bug 325556)
- * Marc Khouzam (Ericsson) - Make each thread an IDisassemblyDMContext (bug 352748)
+ * Marc Khouzam (Ericsson) - Make each thread an IDisassemblyDMContext (bug 352748)
* Andy Jin (QNX) - Not output thread osId as a string when it is null (Bug 397039)
* Marc Khouzam (Ericsson) - Move IBreakpointsTargetDMContext from MIContainerDMC
* to GDBContainerDMC to ease inheritance (Bug 389945)
@@ -119,38 +119,36 @@ import org.osgi.framework.BundleContext;
* This class implements the IProcesses interface for GDB 7.0
* which supports the new -list-thread-groups command.
*/
-public class GDBProcesses_7_0 extends AbstractDsfService
- implements IGDBProcesses, ICachingService, IEventListener {
+public class GDBProcesses_7_0 extends AbstractDsfService implements IGDBProcesses, ICachingService, IEventListener {
/**
* The maximum amount of exited processes we can show.
* Each one is shown in the debug view.
*/
private final static int MAX_NUMBER_EXITED_PROCESS = 5;
-
+
// Below is the context hierarchy that is implemented between the
- // MIProcesses service and the MIRunControl service for the MI
+ // MIProcesses service and the MIRunControl service for the MI
// implementation of DSF:
//
// MIControlDMContext (ICommandControlDMContext)
// |
// MIProcessDMC (IProcess)
// / \
- // / \
+ // / \
// MIContainerDMC MIThreadDMC (IThread)
// (IContainer) /
// \ /
// MIExecutionDMC
// (IExecution)
//
-
+
/**
* Context representing a thread in GDB/MI
*/
@Immutable
- private static class MIExecutionDMC extends AbstractDMContext
- implements IMIExecutionDMContext, IDisassemblyDMContext
- {
+ private static class MIExecutionDMC extends AbstractDMContext
+ implements IMIExecutionDMContext, IDisassemblyDMContext {
/**
* String ID that is used to identify the thread in the GDB/MI protocol.
*/
@@ -161,29 +159,30 @@ public class GDBProcesses_7_0 extends AbstractDsfService
* Instead clients should call {@link IMIProcesses#createExecutionContext()}
* to create instances of this context based on the thread ID.
* <p/>
- *
+ *
* @param sessionId Session that this context belongs to.
* @param containerDmc The container that this context belongs to.
* @param threadDmc The thread context parents of this context.
* @param threadId GDB/MI thread identifier.
*/
- protected MIExecutionDMC(String sessionId, IContainerDMContext containerDmc, IThreadDMContext threadDmc, String threadId) {
- super(sessionId,
- containerDmc == null && threadDmc == null ? new IDMContext[0] :
- containerDmc == null ? new IDMContext[] { threadDmc } :
- threadDmc == null ? new IDMContext[] { containerDmc } :
- new IDMContext[] { containerDmc, threadDmc });
- fThreadId = threadId;
- }
+ protected MIExecutionDMC(String sessionId, IContainerDMContext containerDmc, IThreadDMContext threadDmc,
+ String threadId) {
+ super(sessionId,
+ containerDmc == null && threadDmc == null ? new IDMContext[0]
+ : containerDmc == null ? new IDMContext[] { threadDmc }
+ : threadDmc == null ? new IDMContext[] { containerDmc }
+ : new IDMContext[] { containerDmc, threadDmc });
+ fThreadId = threadId;
+ }
/**
* Returns the GDB/MI thread identifier of this context.
* @return
*/
- @Override
- public String getThreadId() {
- return fThreadId;
- }
+ @Override
+ public String getThreadId() {
+ return fThreadId;
+ }
/* Unused; reintroduce if needed
public String getId(){
@@ -192,24 +191,26 @@ public class GDBProcesses_7_0 extends AbstractDsfService
*/
@Override
- public String toString() { return baseToString() + ".thread[" + fThreadId + "]"; } //$NON-NLS-1$ //$NON-NLS-2$
+ public String toString() {
+ return baseToString() + ".thread[" + fThreadId + "]"; //$NON-NLS-1$//$NON-NLS-2$
+ }
@Override
public boolean equals(Object obj) {
- return baseEquals(obj) && ((MIExecutionDMC)obj).fThreadId.equals(fThreadId);
+ return baseEquals(obj) && ((MIExecutionDMC) obj).fThreadId.equals(fThreadId);
}
@Override
- public int hashCode() { return baseHashCode() ^ fThreadId.hashCode(); }
+ public int hashCode() {
+ return baseHashCode() ^ fThreadId.hashCode();
+ }
}
/**
- * Context representing a thread group of GDB/MI.
+ * Context representing a thread group of GDB/MI.
*/
- @Immutable
- static class MIContainerDMC extends AbstractDMContext
- implements IMIContainerDMContext, IDisassemblyDMContext
- {
+ @Immutable
+ static class MIContainerDMC extends AbstractDMContext implements IMIContainerDMContext, IDisassemblyDMContext {
/**
* String ID that is used to identify the thread group in the GDB/MI protocol.
*/
@@ -219,7 +220,7 @@ public class GDBProcesses_7_0 extends AbstractDsfService
* Constructor for the context. It should not be called directly by clients.
* Instead clients should call {@link IMIProcesses#createContainerContext
* to create instances of this context based on the group name.
- *
+ *
* @param sessionId Session that this context belongs to.
* @param processDmc The process context that is the parent of this context.
* @param groupId GDB/MI thread group identifier.
@@ -233,118 +234,129 @@ public class GDBProcesses_7_0 extends AbstractDsfService
* Returns the GDB/MI thread group identifier of this context.
*/
@Override
- public String getGroupId(){ return fId; }
+ public String getGroupId() {
+ return fId;
+ }
@Override
- public String toString() { return baseToString() + ".threadGroup[" + fId + "]"; } //$NON-NLS-1$ //$NON-NLS-2$
+ public String toString() {
+ return baseToString() + ".threadGroup[" + fId + "]"; //$NON-NLS-1$//$NON-NLS-2$
+ }
@Override
public boolean equals(Object obj) {
- return baseEquals(obj) &&
- (((MIContainerDMC)obj).fId == null ? fId == null : ((MIContainerDMC)obj).fId.equals(fId));
+ return baseEquals(obj)
+ && (((MIContainerDMC) obj).fId == null ? fId == null : ((MIContainerDMC) obj).fId.equals(fId));
}
@Override
- public int hashCode() { return baseHashCode() ^ (fId == null ? 0 : fId.hashCode()); }
+ public int hashCode() {
+ return baseHashCode() ^ (fId == null ? 0 : fId.hashCode());
+ }
}
- private static class GDBContainerDMC extends MIContainerDMC
- implements IMemoryDMContext, IBreakpointsTargetDMContext
- {
+ private static class GDBContainerDMC extends MIContainerDMC
+ implements IMemoryDMContext, IBreakpointsTargetDMContext {
public GDBContainerDMC(String sessionId, IProcessDMContext processDmc, String groupId) {
super(sessionId, processDmc, groupId);
}
}
-
+
/**
- * Context representing a thread.
+ * Context representing a thread.
* @since 4.0
*/
- @Immutable
- protected static class MIThreadDMC extends AbstractDMContext
- implements IThreadDMContext
- {
- /**
- * ID used by GDB to refer to threads.
- */
- private final String fId;
-
- /**
- * Constructor for the context. It should not be called directly by clients.
- * Instead clients should call {@link IMIProcesses#createThreadContext}
- * to create instances of this context based on the thread ID.
- * <p/>
- *
- * @param sessionId Session that this context belongs to.
- * @param processDmc The process that this thread belongs to.
- * @param id thread identifier.
- */
- public MIThreadDMC(String sessionId, IProcessDMContext processDmc, String id) {
+ @Immutable
+ protected static class MIThreadDMC extends AbstractDMContext implements IThreadDMContext {
+ /**
+ * ID used by GDB to refer to threads.
+ */
+ private final String fId;
+
+ /**
+ * Constructor for the context. It should not be called directly by clients.
+ * Instead clients should call {@link IMIProcesses#createThreadContext}
+ * to create instances of this context based on the thread ID.
+ * <p/>
+ *
+ * @param sessionId Session that this context belongs to.
+ * @param processDmc The process that this thread belongs to.
+ * @param id thread identifier.
+ */
+ public MIThreadDMC(String sessionId, IProcessDMContext processDmc, String id) {
super(sessionId, processDmc == null ? new IDMContext[0] : new IDMContext[] { processDmc });
- fId = id;
- }
+ fId = id;
+ }
- /**
- * Returns the thread identifier of this context.
- * @return
- */
- public String getId(){ return fId; }
+ /**
+ * Returns the thread identifier of this context.
+ * @return
+ */
+ public String getId() {
+ return fId;
+ }
- @Override
- public String toString() { return baseToString() + ".OSthread[" + fId + "]"; } //$NON-NLS-1$ //$NON-NLS-2$
+ @Override
+ public String toString() {
+ return baseToString() + ".OSthread[" + fId + "]"; //$NON-NLS-1$//$NON-NLS-2$
+ }
@Override
public boolean equals(Object obj) {
- return baseEquals(obj) &&
- (((MIThreadDMC)obj).fId == null ? fId == null : ((MIThreadDMC)obj).fId.equals(fId));
+ return baseEquals(obj)
+ && (((MIThreadDMC) obj).fId == null ? fId == null : ((MIThreadDMC) obj).fId.equals(fId));
}
@Override
- public int hashCode() { return baseHashCode() ^ (fId == null ? 0 : fId.hashCode()); }
- }
-
- @Immutable
- private static class MIProcessDMC extends AbstractDMContext
- implements IMIProcessDMContext
- {
- /**
- * ID given by the OS.
- */
- private final String fId;
-
- /**
- * Constructor for the context. It should not be called directly by clients.
- * Instead clients should call {@link IMIProcesses#createProcessContext}
- * to create instances of this context based on the PID.
- * <p/>
- *
- * @param sessionId Session that this context belongs to.
- * @param controlDmc The control context parent of this process.
- * @param id process identifier.
- */
- public MIProcessDMC(String sessionId, ICommandControlDMContext controlDmc, String id) {
+ public int hashCode() {
+ return baseHashCode() ^ (fId == null ? 0 : fId.hashCode());
+ }
+ }
+
+ @Immutable
+ private static class MIProcessDMC extends AbstractDMContext implements IMIProcessDMContext {
+ /**
+ * ID given by the OS.
+ */
+ private final String fId;
+
+ /**
+ * Constructor for the context. It should not be called directly by clients.
+ * Instead clients should call {@link IMIProcesses#createProcessContext}
+ * to create instances of this context based on the PID.
+ * <p/>
+ *
+ * @param sessionId Session that this context belongs to.
+ * @param controlDmc The control context parent of this process.
+ * @param id process identifier.
+ */
+ public MIProcessDMC(String sessionId, ICommandControlDMContext controlDmc, String id) {
super(sessionId, controlDmc == null ? new IDMContext[0] : new IDMContext[] { controlDmc });
- fId = id;
- }
-
- @Override
- public String getProcId() { return fId; }
+ fId = id;
+ }
+
+ @Override
+ public String getProcId() {
+ return fId;
+ }
- @Override
- public String toString() { return baseToString() + ".proc[" + fId + "]"; } //$NON-NLS-1$ //$NON-NLS-2$
+ @Override
+ public String toString() {
+ return baseToString() + ".proc[" + fId + "]"; //$NON-NLS-1$//$NON-NLS-2$
+ }
@Override
public boolean equals(Object obj) {
// We treat the UNKNOWN_PROCESS_ID as a wildcard. Any processId (except null) will be considered
// equal to the UNKNOWN_PROCESS_ID. This is important because before starting a process, we don't
// have a pid yet, but we still need to create a process context, and we must use UNKNOWN_PROCESS_ID.
- // Bug 336890
+ // Bug 336890
if (!baseEquals(obj)) {
return false;
}
- MIProcessDMC other = (MIProcessDMC)obj;
+ MIProcessDMC other = (MIProcessDMC) obj;
if (fId == null || other.fId == null) {
return fId == null && other.fId == null;
}
@@ -353,48 +365,51 @@ public class GDBProcesses_7_0 extends AbstractDsfService
if (fId.equals(MIProcesses.UNKNOWN_PROCESS_ID) || other.fId.equals(MIProcesses.UNKNOWN_PROCESS_ID)) {
return true;
}
-
+
return fId.equals(other.fId);
}
@Override
- public int hashCode() {
+ public int hashCode() {
// We cannot use fId in the hashCode. This is because we support
// the wildCard MIProcesses.UNKNOWN_PROCESS_ID which is equal to any other fId.
// But we also need the hashCode of the wildCard to be the same
// as the one of all other fIds, which is why we need a constant hashCode
// See bug 336890
- return baseHashCode();
- }
- }
-
- /**
- * A process context representing a process that has exited.
- * Since an exited process no longer has a pid, we need another way
- * of characterizing it. We use the groupId instead.
- * Note that with GDB 7.0 and 7.1, the groupId is the pid, so that
- * does not help us, but since we only handle single-process debugging
- * for those versions of GDB, we don't need any id to know we are
- * dealing with our single process.
- * Starting with GDB 7.2, we handle multi-process, but then we
- * can use the groupId as a persistent identifier of each process,
- * even an exited one.
- * @since 4.7
- */
- @Immutable
- protected static class MIExitedProcessDMC extends MIProcessDMC
- {
- private final String fGroupId;
-
- public MIExitedProcessDMC(String sessionId, ICommandControlDMContext controlDmc, String pid, String groupId) {
+ return baseHashCode();
+ }
+ }
+
+ /**
+ * A process context representing a process that has exited.
+ * Since an exited process no longer has a pid, we need another way
+ * of characterizing it. We use the groupId instead.
+ * Note that with GDB 7.0 and 7.1, the groupId is the pid, so that
+ * does not help us, but since we only handle single-process debugging
+ * for those versions of GDB, we don't need any id to know we are
+ * dealing with our single process.
+ * Starting with GDB 7.2, we handle multi-process, but then we
+ * can use the groupId as a persistent identifier of each process,
+ * even an exited one.
+ * @since 4.7
+ */
+ @Immutable
+ protected static class MIExitedProcessDMC extends MIProcessDMC {
+ private final String fGroupId;
+
+ public MIExitedProcessDMC(String sessionId, ICommandControlDMContext controlDmc, String pid, String groupId) {
super(sessionId, controlDmc, pid);
- fGroupId = groupId;
- }
-
- public String getGroupId() { return fGroupId; }
+ fGroupId = groupId;
+ }
+
+ public String getGroupId() {
+ return fGroupId;
+ }
- @Override
- public String toString() { return super.toString() + ".group[" + getGroupId() + "]"; } //$NON-NLS-1$ //$NON-NLS-2$
+ @Override
+ public String toString() {
+ return super.toString() + ".group[" + getGroupId() + "]"; //$NON-NLS-1$//$NON-NLS-2$
+ }
@Override
public boolean equals(Object obj) {
@@ -402,7 +417,7 @@ public class GDBProcesses_7_0 extends AbstractDsfService
return false;
}
- MIExitedProcessDMC other = (MIExitedProcessDMC)obj;
+ MIExitedProcessDMC other = (MIExitedProcessDMC) obj;
if (fGroupId == null || other.fGroupId == null) {
return fGroupId == null && other.fGroupId == null;
}
@@ -411,59 +426,67 @@ public class GDBProcesses_7_0 extends AbstractDsfService
}
@Override
- public int hashCode() {
+ public int hashCode() {
return super.hashCode() ^ (fGroupId == null ? 0 : fGroupId.hashCode());
}
- }
-
- /**
- * The data of a corresponding thread or process.
- */
- @Immutable
- protected static class MIThreadDMData implements IThreadDMData {
- final String fName;
- final String fId;
-
- public MIThreadDMData(String name, String id) {
- fName = name;
- fId = id;
- }
-
- @Override
- public String getId() { return fId; }
-
- @Override
- public String getName() { return fName; }
-
- @Override
+ }
+
+ /**
+ * The data of a corresponding thread or process.
+ */
+ @Immutable
+ protected static class MIThreadDMData implements IThreadDMData {
+ final String fName;
+ final String fId;
+
+ public MIThreadDMData(String name, String id) {
+ fName = name;
+ fId = id;
+ }
+
+ @Override
+ public String getId() {
+ return fId;
+ }
+
+ @Override
+ public String getName() {
+ return fName;
+ }
+
+ @Override
public boolean isDebuggerAttached() {
return true;
}
- }
-
- /**
- * The data corresponding to an exited process.
- * @since 4.7
- */
- @Immutable
- protected static class MIExitedProcessDMData implements IGdbThreadExitedDMData {
- final String fName;
- final String fId;
- final Integer fExitCode;
-
- public MIExitedProcessDMData(String name, String id, Integer exitCode) {
- fName = name;
- fId = id;
- fExitCode = exitCode;
- }
-
- @Override
- public String getId() { return fId; }
-
- @Override
- public String getName() { return fName; }
-
- @Override
+ }
+
+ /**
+ * The data corresponding to an exited process.
+ * @since 4.7
+ */
+ @Immutable
+ protected static class MIExitedProcessDMData implements IGdbThreadExitedDMData {
+ final String fName;
+ final String fId;
+ final Integer fExitCode;
+
+ public MIExitedProcessDMData(String name, String id, Integer exitCode) {
+ fName = name;
+ fId = id;
+ fExitCode = exitCode;
+ }
+
+ @Override
+ public String getId() {
+ return fId;
+ }
+
+ @Override
+ public String getName() {
+ return fName;
+ }
+
+ @Override
public boolean isDebuggerAttached() {
return false;
}
@@ -472,268 +495,277 @@ public class GDBProcesses_7_0 extends AbstractDsfService
public Integer getExitCode() {
return fExitCode;
}
- }
-
- /**
- * This class provides an implementation of both a process context and process data.
- * It is used to be able to return a list of processes including their data all at once.
- * @since 4.0
- */
- @Immutable
- protected static class MIProcessDMCAndData extends MIProcessDMC implements IGdbThreadDMData2 {
- final String fName;
- // Note that cores are only available from GDB 7.1.
- final String[] fCores;
- final String fOwner;
- final String fDescription;
-
- public MIProcessDMCAndData(String sessionId, ICommandControlDMContext controlDmc,
- String id, String name, String[] cores, String owner) {
- this(sessionId, controlDmc, id, name, cores, owner, null);
- }
-
- /**
+ }
+
+ /**
+ * This class provides an implementation of both a process context and process data.
+ * It is used to be able to return a list of processes including their data all at once.
+ * @since 4.0
+ */
+ @Immutable
+ protected static class MIProcessDMCAndData extends MIProcessDMC implements IGdbThreadDMData2 {
+ final String fName;
+ // Note that cores are only available from GDB 7.1.
+ final String[] fCores;
+ final String fOwner;
+ final String fDescription;
+
+ public MIProcessDMCAndData(String sessionId, ICommandControlDMContext controlDmc, String id, String name,
+ String[] cores, String owner) {
+ this(sessionId, controlDmc, id, name, cores, owner, null);
+ }
+
+ /**
* @since 5.6
*/
- public MIProcessDMCAndData(String sessionId, ICommandControlDMContext controlDmc,
- String id, String name, String[] cores, String owner, String description) {
- super(sessionId, controlDmc, id);
- fName = name;
- fCores = cores;
- fOwner = owner;
- fDescription = description;
- }
-
- @Override
- public String getId() { return getProcId(); }
-
- @Override
- public String getName() { return fName; }
-
- @Override
- public String getDescription() { return fDescription; }
-
- @Override
- public boolean isDebuggerAttached() {
+ public MIProcessDMCAndData(String sessionId, ICommandControlDMContext controlDmc, String id, String name,
+ String[] cores, String owner, String description) {
+ super(sessionId, controlDmc, id);
+ fName = name;
+ fCores = cores;
+ fOwner = owner;
+ fDescription = description;
+ }
+
+ @Override
+ public String getId() {
+ return getProcId();
+ }
+
+ @Override
+ public String getName() {
+ return fName;
+ }
+
+ @Override
+ public String getDescription() {
+ return fDescription;
+ }
+
+ @Override
+ public boolean isDebuggerAttached() {
return true;
}
- @Override
- public String[] getCores() { return fCores; }
+ @Override
+ public String[] getCores() {
+ return fCores;
+ }
- @Override
- public String getOwner() { return fOwner; }
+ @Override
+ public String getOwner() {
+ return fOwner;
+ }
@Override
- public String toString() { return baseToString() +
- ".proc[" + getId() + "," + getName() + "," + getOwner() + "]"; } //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$//$NON-NLS-4$
+ public String toString() {
+ return baseToString() + ".proc[" + getId() + "," + getName() + "," + getOwner() + "]"; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
+ }
@Override
public boolean equals(Object obj) {
- return super.equals(obj) &&
- (((MIProcessDMCAndData)obj).fName == null ? fName == null : ((MIProcessDMCAndData)obj).fName.equals(fName)) &&
- (((MIProcessDMCAndData)obj).fOwner == null ? fOwner == null : ((MIProcessDMCAndData)obj).fOwner.equals(fOwner));
+ return super.equals(obj)
+ && (((MIProcessDMCAndData) obj).fName == null ? fName == null
+ : ((MIProcessDMCAndData) obj).fName.equals(fName))
+ && (((MIProcessDMCAndData) obj).fOwner == null ? fOwner == null
+ : ((MIProcessDMCAndData) obj).fOwner.equals(fOwner));
}
@Override
- public int hashCode() { return super.hashCode() ^
- (fName == null ? 0 : fName.hashCode()) ^
- (fOwner == null ? 0 : fOwner.hashCode()) ; }
- }
-
- /**
- * Event indicating that an container (debugged process) has started. This event
- * implements the {@link IStartedMDEvent} from the IRunControl service.
- */
- public static class ContainerStartedDMEvent extends AbstractDMEvent<IExecutionDMContext>
- implements IStartedDMEvent
- {
- public ContainerStartedDMEvent(IContainerDMContext context) {
- super(context);
- }
- }
-
- /**
- * Event indicating that an container is no longer being debugged. This event
- * implements the {@link IExitedMDEvent} from the IRunControl service.
- */
- public static class ContainerExitedDMEvent extends AbstractDMEvent<IExecutionDMContext>
- implements IExitedDMEvent
- {
- public ContainerExitedDMEvent(IContainerDMContext context) {
- super(context);
- }
- }
-
- /**
+ public int hashCode() {
+ return super.hashCode() ^ (fName == null ? 0 : fName.hashCode()) ^ (fOwner == null ? 0 : fOwner.hashCode());
+ }
+ }
+
+ /**
+ * Event indicating that an container (debugged process) has started. This event
+ * implements the {@link IStartedMDEvent} from the IRunControl service.
+ */
+ public static class ContainerStartedDMEvent extends AbstractDMEvent<IExecutionDMContext>
+ implements IStartedDMEvent {
+ public ContainerStartedDMEvent(IContainerDMContext context) {
+ super(context);
+ }
+ }
+
+ /**
+ * Event indicating that an container is no longer being debugged. This event
+ * implements the {@link IExitedMDEvent} from the IRunControl service.
+ */
+ public static class ContainerExitedDMEvent extends AbstractDMEvent<IExecutionDMContext> implements IExitedDMEvent {
+ public ContainerExitedDMEvent(IContainerDMContext context) {
+ super(context);
+ }
+ }
+
+ /**
* @since 4.7
*/
- protected static class ProcessRemovedDMEvent extends AbstractDMEvent<IThreadDMContext>
- implements IThreadRemovedDMEvent
- {
- public ProcessRemovedDMEvent(IProcessDMContext context) {
- super(context);
- }
- }
-
- /**
- * A map of thread id to thread group id. We use this to find out to which threadGroup a thread belongs.
- */
- private Map<String, String> fThreadToGroupMap = new HashMap<String, String>();
- /**
- * A map of thread group id to process id. We use this to find out to which pid a group refers.
- */
- private Map<String, String> fGroupToPidMap = new HashMap<String, String>();
-
- private IGDBControl fCommandControl;
- private IGDBBackend fBackend;
- private CommandFactory fCommandFactory;
-
- // A cache for commands about the threadGroups
+ protected static class ProcessRemovedDMEvent extends AbstractDMEvent<IThreadDMContext>
+ implements IThreadRemovedDMEvent {
+ public ProcessRemovedDMEvent(IProcessDMContext context) {
+ super(context);
+ }
+ }
+
+ /**
+ * A map of thread id to thread group id. We use this to find out to which threadGroup a thread belongs.
+ */
+ private Map<String, String> fThreadToGroupMap = new HashMap<String, String>();
+ /**
+ * A map of thread group id to process id. We use this to find out to which pid a group refers.
+ */
+ private Map<String, String> fGroupToPidMap = new HashMap<String, String>();
+
+ private IGDBControl fCommandControl;
+ private IGDBBackend fBackend;
+ private CommandFactory fCommandFactory;
+
+ // A cache for commands about the threadGroups
private CommandCache fContainerCommandCache;
//A cache for commands about the threads
private CommandCache fThreadCommandCache;
-
+
// A temporary cache to avoid using -list-thread-groups --available more than once at the same time.
// We cannot cache this command because it lists all available processes, which can
// change at any time. However, it is inefficient to send more than one of this command at
// the same time. This cache will help us avoid that. The idea is that we cache the command,
- // but as soon as it returns, we clear the cache. So the cache will only trigger for those
+ // but as soon as it returns, we clear the cache. So the cache will only trigger for those
// overlapping situations. Using this cache also allows to handle the all-stop case
// when the target can be unavailable and instead of hanging, the cache will return an error.
private CommandCache fListThreadGroupsAvailableCache;
- // A map of process id to process names. A name is fetched whenever we start
+ // A map of process id to process names. A name is fetched whenever we start
// debugging a process, and removed when we stop.
// This allows us to make sure that if a pid is re-used, we will not use an
// old name for it. Bug 275497
// This map also serves as a list of processes we are currently debugging.
// This is important because we cannot always ask GDB for the list, since it may
// be running at the time. Bug 303503
- private Map<String, String> fDebuggedProcessesAndNames = new HashMap<>();
-
- /**
- * A map that keeps track of the PTY associated with an inferior (groupId)
- */
- private Map<String, PTY> fGroupIdToPTYMap = new HashMap<>();
- /**
- * A list of groupIds that have exited.
- */
- private List<String> fExitedGroupId = new ArrayList<>();
-
- /**
- * Information about an exited process
- * @since 4.7
- */
- protected class ExitedProcInfo {
- private String pid;
- private String name;
- private Integer exitCode;
-
- public ExitedProcInfo(String aPid, String aName) {
- pid = aPid;
- name = aName;
- }
-
- protected String getPid() {
- return pid;
- }
-
- protected String getName() {
- return name;
- }
-
- protected Integer getExitCode() {
+ private Map<String, String> fDebuggedProcessesAndNames = new HashMap<>();
+
+ /**
+ * A map that keeps track of the PTY associated with an inferior (groupId)
+ */
+ private Map<String, PTY> fGroupIdToPTYMap = new HashMap<>();
+ /**
+ * A list of groupIds that have exited.
+ */
+ private List<String> fExitedGroupId = new ArrayList<>();
+
+ /**
+ * Information about an exited process
+ * @since 4.7
+ */
+ protected class ExitedProcInfo {
+ private String pid;
+ private String name;
+ private Integer exitCode;
+
+ public ExitedProcInfo(String aPid, String aName) {
+ pid = aPid;
+ name = aName;
+ }
+
+ protected String getPid() {
+ return pid;
+ }
+
+ protected String getName() {
+ return name;
+ }
+
+ protected Integer getExitCode() {
return exitCode;
}
-
- protected void setExitCode(Integer code) {
+
+ protected void setExitCode(Integer code) {
exitCode = code;
}
- }
-
- /**
- * A LRU (least-recently-used) map that limits the amount of exited process list.
- * Once the limit is reached, oldest exited processes are automatically removed
- * when new ones are inserted. This avoids the risk of growing the list
- * of exited processes too much and showing too many in the debug view.
- */
- private class LRUExitedProcessMap extends LinkedHashMap<String, ExitedProcInfo> {
- public static final long serialVersionUID = 0;
-
- @Override
- protected boolean removeEldestEntry(Entry<String, ExitedProcInfo> eldest) {
- return size() > MAX_NUMBER_EXITED_PROCESS;
- }
- }
-
- /**
- * Map of groupId to ExitedProcInfo.
- * This map contains the information of each process that has exited.
- * Note that we must maintain this information ourselves since GDB
- * sometimes prunes its list of inferiors, which implies we cannot
- * count on GDB to keep track of exited processes.
- */
- private Map<String, ExitedProcInfo> fProcExitedMap = new LRUExitedProcessMap();
-
- /**
- * Set of groupId of processes that we detached from.
- * The content is very short-lived as it is only kept until
- * we receive the =thread-group-exited event from GDB
- * and need to know if the process in question was detached from.
- * Using this set, we can know if we should store the process
- * in the fExitedProcesses map or not.
- */
- private Set<String> fProcDetachedSet = new HashSet<>();
-
- private static final String FAKE_THREAD_ID = "0"; //$NON-NLS-1$
-
- /**
- * Keeps track of how many processes we are currently connected to
- */
- private int fNumConnected;
-
- /**
- * Keeps track if we are dealing with the very first process of GDB.
- */
- private boolean fInitialProcess = true;
-
- public GDBProcesses_7_0(DsfSession session) {
- super(session);
- }
-
- /**
- * This method initializes this service.
- *
- * @param requestMonitor
- * The request monitor indicating the operation is finished
- */
- @Override
- public void initialize(final RequestMonitor requestMonitor) {
- super.initialize(new ImmediateRequestMonitor(requestMonitor) {
- @Override
- protected void handleSuccess() {
- doInitialize(requestMonitor);
+ }
+
+ /**
+ * A LRU (least-recently-used) map that limits the amount of exited process list.
+ * Once the limit is reached, oldest exited processes are automatically removed
+ * when new ones are inserted. This avoids the risk of growing the list
+ * of exited processes too much and showing too many in the debug view.
+ */
+ private class LRUExitedProcessMap extends LinkedHashMap<String, ExitedProcInfo> {
+ public static final long serialVersionUID = 0;
+
+ @Override
+ protected boolean removeEldestEntry(Entry<String, ExitedProcInfo> eldest) {
+ return size() > MAX_NUMBER_EXITED_PROCESS;
+ }
+ }
+
+ /**
+ * Map of groupId to ExitedProcInfo.
+ * This map contains the information of each process that has exited.
+ * Note that we must maintain this information ourselves since GDB
+ * sometimes prunes its list of inferiors, which implies we cannot
+ * count on GDB to keep track of exited processes.
+ */
+ private Map<String, ExitedProcInfo> fProcExitedMap = new LRUExitedProcessMap();
+
+ /**
+ * Set of groupId of processes that we detached from.
+ * The content is very short-lived as it is only kept until
+ * we receive the =thread-group-exited event from GDB
+ * and need to know if the process in question was detached from.
+ * Using this set, we can know if we should store the process
+ * in the fExitedProcesses map or not.
+ */
+ private Set<String> fProcDetachedSet = new HashSet<>();
+
+ private static final String FAKE_THREAD_ID = "0"; //$NON-NLS-1$
+
+ /**
+ * Keeps track of how many processes we are currently connected to
+ */
+ private int fNumConnected;
+
+ /**
+ * Keeps track if we are dealing with the very first process of GDB.
+ */
+ private boolean fInitialProcess = true;
+
+ public GDBProcesses_7_0(DsfSession session) {
+ super(session);
+ }
+
+ /**
+ * This method initializes this service.
+ *
+ * @param requestMonitor
+ * The request monitor indicating the operation is finished
+ */
+ @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) {
-
+
fCommandControl = getServicesTracker().getService(IGDBControl.class);
- fBackend = getServicesTracker().getService(IGDBBackend.class);
- BufferedCommandControl bufferedCommandControl = new BufferedCommandControl(fCommandControl, getExecutor(), 2);
+ fBackend = getServicesTracker().getService(IGDBBackend.class);
+ BufferedCommandControl bufferedCommandControl = new BufferedCommandControl(fCommandControl, getExecutor(), 2);
- fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
+ fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
// These caches store the result of a command when received; also, these caches
// are manipulated when receiving events. Currently, events are received after
@@ -743,45 +775,41 @@ public class GDBProcesses_7_0 extends AbstractDsfService
// To solve this, we use a bufferedCommandControl that will delay the command
// result by two scheduling of the executor.
// See bug 280461
- fContainerCommandCache = new CommandCache(getSession(), bufferedCommandControl);
- fContainerCommandCache.setContextAvailable(fCommandControl.getContext(), true);
- fThreadCommandCache = new CommandCache(getSession(), bufferedCommandControl);
- fThreadCommandCache.setContextAvailable(fCommandControl.getContext(), true);
-
- // No need to use the bufferedCommandControl for the listThreadGroups cache
- // because it is not being affected by events.
- fListThreadGroupsAvailableCache = new CommandCache(getSession(), fCommandControl);
- fListThreadGroupsAvailableCache.setContextAvailable(fCommandControl.getContext(), true);
-
- getSession().addServiceEventListener(this, null);
- fCommandControl.addEventListener(this);
+ fContainerCommandCache = new CommandCache(getSession(), bufferedCommandControl);
+ fContainerCommandCache.setContextAvailable(fCommandControl.getContext(), true);
+ fThreadCommandCache = new CommandCache(getSession(), bufferedCommandControl);
+ fThreadCommandCache.setContextAvailable(fCommandControl.getContext(), true);
+
+ // No need to use the bufferedCommandControl for the listThreadGroups cache
+ // because it is not being affected by events.
+ fListThreadGroupsAvailableCache = new CommandCache(getSession(), fCommandControl);
+ fListThreadGroupsAvailableCache.setContextAvailable(fCommandControl.getContext(), true);
+
+ getSession().addServiceEventListener(this, null);
+ fCommandControl.addEventListener(this);
// Register this service.
- register(new String[] { IProcesses.class.getName(),
- IMIProcesses.class.getName(),
- IGDBProcesses.class.getName(),
- GDBProcesses_7_0.class.getName() },
- new Hashtable<String, String>());
-
+ register(new String[] { IProcesses.class.getName(), IMIProcesses.class.getName(), IGDBProcesses.class.getName(),
+ GDBProcesses_7_0.class.getName() }, new Hashtable<String, String>());
+
requestMonitor.done();
}
-
/**
* This method shuts down this service. It unregisters the service, stops
* receiving service events, and calls the superclass shutdown() method to
* finish the shutdown process.
- *
+ *
* @return void
*/
@Override
public void shutdown(RequestMonitor requestMonitor) {
unregister();
- getSession().removeServiceEventListener(this);
- fCommandControl.removeEventListener(this);
+ getSession().removeServiceEventListener(this);
+ fCommandControl.removeEventListener(this);
super.shutdown(requestMonitor);
}
-
+
/**
* @return The bundle context of the plug-in to which this service belongs.
*/
@@ -789,12 +817,12 @@ public class GDBProcesses_7_0 extends AbstractDsfService
protected BundleContext getBundleContext() {
return GdbPlugin.getBundleContext();
}
-
+
/** @since 4.0 */
protected Map<String, String> getThreadToGroupMap() {
return fThreadToGroupMap;
}
-
+
/** @since 4.0 */
protected Map<String, String> getGroupToPidMap() {
return fGroupToPidMap;
@@ -819,7 +847,7 @@ public class GDBProcesses_7_0 extends AbstractDsfService
protected void setIsInitialProcess(boolean isInitial) {
fInitialProcess = isInitial;
}
-
+
/**@since 4.7 */
protected Map<String, ExitedProcInfo> getExitedProcesses() {
return fProcExitedMap;
@@ -829,14 +857,15 @@ public class GDBProcesses_7_0 extends AbstractDsfService
protected Set<String> getDetachedProcesses() {
return fProcDetachedSet;
}
-
- /**
+
+ /**
* Returns the groupId that is associated with the provided pId
- * @since 4.0
+ * @since 4.0
*/
protected String getGroupFromPid(String pid) {
- if (pid == null) return null;
-
+ if (pid == null)
+ return null;
+
for (Map.Entry<String, String> entry : getGroupToPidMap().entrySet()) {
if (pid.equals(entry.getValue())) {
return entry.getKey();
@@ -844,135 +873,136 @@ public class GDBProcesses_7_0 extends AbstractDsfService
}
return null;
}
-
+
@Override
- public IThreadDMContext createThreadContext(IProcessDMContext processDmc, String threadId) {
- return new MIThreadDMC(getSession().getId(), processDmc, threadId);
- }
+ public IThreadDMContext createThreadContext(IProcessDMContext processDmc, String threadId) {
+ return new MIThreadDMC(getSession().getId(), processDmc, threadId);
+ }
@Override
- public IProcessDMContext createProcessContext(ICommandControlDMContext controlDmc, String pid) {
- return new MIProcessDMC(getSession().getId(), controlDmc, pid);
- }
-
+ public IProcessDMContext createProcessContext(ICommandControlDMContext controlDmc, String pid) {
+ return new MIProcessDMC(getSession().getId(), controlDmc, pid);
+ }
+
/**
* Create a special context describing a process that has exited.
* @param controlDmc Its parent context.
* @param groupId The GDB groupId to which this process refers to. Since an exited process no longer
* has a pid, we use this id to characterize it uniquely.
- * Note that with GDB 7.0 and 7.1, the groupId is the pid, so that
- * does not help us, but since we only handle single-process debugging
- * for those versions of GDB, we don't need any id to know we are
- * dealing with our single process.
- * Starting with GDB 7.2, we handle multi-process, but then we
- * can use the groupId as a persistent identifier of each process,
- * even an exited one.
+ * Note that with GDB 7.0 and 7.1, the groupId is the pid, so that
+ * does not help us, but since we only handle single-process debugging
+ * for those versions of GDB, we don't need any id to know we are
+ * dealing with our single process.
+ * Starting with GDB 7.2, we handle multi-process, but then we
+ * can use the groupId as a persistent identifier of each process,
+ * even an exited one.
*/
- private IProcessDMContext createExitedProcessContext(ICommandControlDMContext controlDmc, String pid, String groupId) {
- return new MIExitedProcessDMC(getSession().getId(), controlDmc, pid, groupId);
- }
-
+ private IProcessDMContext createExitedProcessContext(ICommandControlDMContext controlDmc, String pid,
+ String groupId) {
+ return new MIExitedProcessDMC(getSession().getId(), controlDmc, pid, groupId);
+ }
+
@Override
- public IMIExecutionDMContext createExecutionContext(IContainerDMContext containerDmc,
- IThreadDMContext threadDmc,
- String threadId) {
- return new MIExecutionDMC(getSession().getId(), containerDmc, threadDmc, threadId);
- }
+ public IMIExecutionDMContext createExecutionContext(IContainerDMContext containerDmc, IThreadDMContext threadDmc,
+ String threadId) {
+ return new MIExecutionDMC(getSession().getId(), containerDmc, threadDmc, threadId);
+ }
@Override
- public IMIContainerDMContext createContainerContext(IProcessDMContext processDmc,
- String groupId) {
- return new GDBContainerDMC(getSession().getId(), processDmc, groupId);
- }
+ public IMIContainerDMContext createContainerContext(IProcessDMContext processDmc, String groupId) {
+ return new GDBContainerDMC(getSession().getId(), processDmc, groupId);
+ }
@Override
- public IMIContainerDMContext createContainerContextFromThreadId(ICommandControlDMContext controlDmc, String threadId) {
- String groupId = getThreadToGroupMap().get(threadId);
- if (groupId == null) {
- // this can happen if the threadId was 'all'
- // In such a case, we choose the first process we find
- // This works when we run a single process
- // but will break for multi-process!!!
- if (getThreadToGroupMap().isEmpty()) {
- groupId = MIProcesses.UNIQUE_GROUP_ID;
- } else {
- Collection<String> values = getThreadToGroupMap().values();
- for (String value : values) {
- groupId = value;
- break;
- }
- }
- }
-
- return createContainerContextFromGroupId(controlDmc, groupId);
- }
-
- /** @since 4.0 */
+ public IMIContainerDMContext createContainerContextFromThreadId(ICommandControlDMContext controlDmc,
+ String threadId) {
+ String groupId = getThreadToGroupMap().get(threadId);
+ if (groupId == null) {
+ // this can happen if the threadId was 'all'
+ // In such a case, we choose the first process we find
+ // This works when we run a single process
+ // but will break for multi-process!!!
+ if (getThreadToGroupMap().isEmpty()) {
+ groupId = MIProcesses.UNIQUE_GROUP_ID;
+ } else {
+ Collection<String> values = getThreadToGroupMap().values();
+ for (String value : values) {
+ groupId = value;
+ break;
+ }
+ }
+ }
+
+ return createContainerContextFromGroupId(controlDmc, groupId);
+ }
+
+ /** @since 4.0 */
@Override
- public IMIContainerDMContext createContainerContextFromGroupId(ICommandControlDMContext controlDmc, String groupId) {
- if (groupId == null || groupId.length() == 0) {
- // This happens when we are doing non-attach, so for GDB < 7.2, we know that in that case
- // we are single process, so lets see if we have the group in our map.
- assert getGroupToPidMap().size() <= 1 : "More than one process in our map"; //$NON-NLS-1$
- if (getGroupToPidMap().size() == 1) {
- for (String key : getGroupToPidMap().keySet()) {
- groupId = key;
- break;
- }
- }
- }
-
- String pid = getGroupToPidMap().get(groupId);
- if (pid == null) {
- // For GDB 7.0 and 7.1, the groupId is the pid, so we can use it directly
- pid = groupId;
- }
- IProcessDMContext processDmc = createProcessContext(controlDmc, pid);
- return createContainerContext(processDmc, groupId);
- }
-
+ public IMIContainerDMContext createContainerContextFromGroupId(ICommandControlDMContext controlDmc,
+ String groupId) {
+ if (groupId == null || groupId.length() == 0) {
+ // This happens when we are doing non-attach, so for GDB < 7.2, we know that in that case
+ // we are single process, so lets see if we have the group in our map.
+ assert getGroupToPidMap().size() <= 1 : "More than one process in our map"; //$NON-NLS-1$
+ if (getGroupToPidMap().size() == 1) {
+ for (String key : getGroupToPidMap().keySet()) {
+ groupId = key;
+ break;
+ }
+ }
+ }
+
+ String pid = getGroupToPidMap().get(groupId);
+ if (pid == null) {
+ // For GDB 7.0 and 7.1, the groupId is the pid, so we can use it directly
+ pid = groupId;
+ }
+ IProcessDMContext processDmc = createProcessContext(controlDmc, pid);
+ return createContainerContext(processDmc, groupId);
+ }
+
@Override
- public IMIExecutionDMContext[] getExecutionContexts(IMIContainerDMContext containerDmc) {
+ public IMIExecutionDMContext[] getExecutionContexts(IMIContainerDMContext containerDmc) {
if (isExitedProcess(containerDmc)) {
// No threads for an exited process
return new IMIExecutionDMContext[0];
}
-
- String groupId = containerDmc.getGroupId();
- List<IMIExecutionDMContext> execDmcList = new ArrayList<IMIExecutionDMContext>();
- Iterator<Map.Entry<String, String>> iterator = getThreadToGroupMap().entrySet().iterator();
- while (iterator.hasNext()){
- Map.Entry<String, String> entry = iterator.next();
- if (entry.getValue().equals(groupId)) {
- String threadId = entry.getKey();
- IProcessDMContext procDmc = DMContexts.getAncestorOfType(containerDmc, IProcessDMContext.class);
- IMIExecutionDMContext execDmc = createExecutionContext(containerDmc,
- createThreadContext(procDmc, threadId),
- threadId);
- execDmcList.add(execDmc);
- }
- }
- return execDmcList.toArray(new IMIExecutionDMContext[0]);
- }
+
+ String groupId = containerDmc.getGroupId();
+ List<IMIExecutionDMContext> execDmcList = new ArrayList<IMIExecutionDMContext>();
+ Iterator<Map.Entry<String, String>> iterator = getThreadToGroupMap().entrySet().iterator();
+ while (iterator.hasNext()) {
+ Map.Entry<String, String> entry = iterator.next();
+ if (entry.getValue().equals(groupId)) {
+ String threadId = entry.getKey();
+ IProcessDMContext procDmc = DMContexts.getAncestorOfType(containerDmc, IProcessDMContext.class);
+ IMIExecutionDMContext execDmc = createExecutionContext(containerDmc,
+ createThreadContext(procDmc, threadId), threadId);
+ execDmcList.add(execDmc);
+ }
+ }
+ return execDmcList.toArray(new IMIExecutionDMContext[0]);
+ }
@Override
public void getExecutionData(IThreadDMContext dmc, final DataRequestMonitor<IThreadDMData> rm) {
if (dmc instanceof MIExitedProcessDMC) {
- ExitedProcInfo info = getExitedProcesses().get(((MIExitedProcessDMC)dmc).getGroupId());
+ ExitedProcInfo info = getExitedProcesses().get(((MIExitedProcessDMC) dmc).getGroupId());
if (info != null) {
rm.done(new MIExitedProcessDMData(info.getName(), info.getPid(), info.getExitCode()));
} else {
// This can happen for example, when restarting an exited process,
// where we've deleted the process from our table, but it has
// yet to be cleaned up from the view
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Unavailable info about exited process", null)); //$NON-NLS-1$
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE,
+ "Unavailable info about exited process", null)); //$NON-NLS-1$
}
-
+
return;
}
-
+
if (dmc instanceof IMIProcessDMContext) {
- String id = ((IMIProcessDMContext)dmc).getProcId();
+ String id = ((IMIProcessDMContext) dmc).getProcId();
String name = null;
if (fBackend.getSessionType() == SessionType.CORE || "42000".equals(id)) { //$NON-NLS-1$
// For the Core session, the process is no longer running.
@@ -1001,273 +1031,285 @@ public class GDBProcesses_7_0 extends AbstractDsfService
// GDB is debugging a new process. Let's fetch its
// name and remember it. In order to get the name,
// we have to request all running processes, not
- // just the ones being debugged. We got a lot more
+ // just the ones being debugged. We got a lot more
// information when we request all processes.
- final String finalPId = id;
+ final String finalPId = id;
fListThreadGroupsAvailableCache.execute(
- fCommandFactory.createMIListThreadGroups(fCommandControl.getContext(), true),
- new DataRequestMonitor<MIListThreadGroupsInfo>(getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- // We cannot actually cache this command since the process
- // list may change. But this cache allows to avoid overlapping
- // sending of this command and proper handling if the target is
- // unavailable.
- fListThreadGroupsAvailableCache.reset();
-
- // Note that the output of the "-list-thread-groups --available" command
- // still shows the pid as a groupId, even for GDB 7.2.
- String name = null;
- if (isSuccess()) {
- for (IThreadGroupInfo groupInfo : getData().getGroupList()) {
- if (groupInfo.getPid().equals(finalPId)) {
- name = groupInfo.getName();
- fDebuggedProcessesAndNames.put(finalPId, name);
- break;
+ fCommandFactory.createMIListThreadGroups(fCommandControl.getContext(), true),
+ new DataRequestMonitor<MIListThreadGroupsInfo>(getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ // We cannot actually cache this command since the process
+ // list may change. But this cache allows to avoid overlapping
+ // sending of this command and proper handling if the target is
+ // unavailable.
+ fListThreadGroupsAvailableCache.reset();
+
+ // Note that the output of the "-list-thread-groups --available" command
+ // still shows the pid as a groupId, even for GDB 7.2.
+ String name = null;
+ if (isSuccess()) {
+ for (IThreadGroupInfo groupInfo : getData().getGroupList()) {
+ if (groupInfo.getPid().equals(finalPId)) {
+ name = groupInfo.getName();
+ fDebuggedProcessesAndNames.put(finalPId, name);
+ break;
+ }
+ }
+ } else {
+ // Looks like this gdb doesn't truly support
+ // "-list-thread-groups --available". Get the
+ // process list natively if we're debugging locally
+ if (fBackend.getSessionType() == SessionType.LOCAL) {
+ try {
+ IProcessList list = CCorePlugin.getDefault().getProcessList();
+ if (list != null) {
+ int pId_int = Integer.parseInt(finalPId);
+ for (IProcessInfo procInfo : list.getProcessList()) {
+ if (procInfo.getPid() == pId_int) {
+ name = procInfo.getName();
+ fDebuggedProcessesAndNames.put(finalPId, name);
+ break;
+ }
+ }
+ }
+ } catch (Exception e) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
+ REQUEST_FAILED, "Could not get process name", e)); //$NON-NLS-1$
+ }
}
}
- } else {
- // Looks like this gdb doesn't truly support
- // "-list-thread-groups --available". Get the
- // process list natively if we're debugging locally
- if (fBackend.getSessionType() == SessionType.LOCAL) {
- try {
- IProcessList list = CCorePlugin.getDefault().getProcessList();
- if (list != null) {
- int pId_int = Integer.parseInt(finalPId);
- for (IProcessInfo procInfo : list.getProcessList()) {
- if (procInfo.getPid() == pId_int) {
- name = procInfo.getName();
- fDebuggedProcessesAndNames.put(finalPId, name);
- break;
- }
- }
- }
- } catch (Exception e) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, "Could not get process name", e)); //$NON-NLS-1$
- }
- }
- }
-
- if (name == null) {
- // No way to get the name right now, so use the binary file name (absolute path)
- name = fBackend.getProgramPath().toOSString();
- fDebuggedProcessesAndNames.put(finalPId, name);
+
+ if (name == null) {
+ // No way to get the name right now, so use the binary file name (absolute path)
+ name = fBackend.getProgramPath().toOSString();
+ fDebuggedProcessesAndNames.put(finalPId, name);
+ }
+ rm.done(new MIThreadDMData(name, finalPId));
}
- rm.done(new MIThreadDMData(name, finalPId));
- }
- });
+ });
return;
}
} else {
// We don't have the name in our map. This could happen
- // if a process has terminated but the
+ // if a process has terminated but the
// debug session is not terminated because the preference
// to keep GDB running has been selected or because there
// are other processes part of that session.
- name = "Unknown name"; //$NON-NLS-1$
+ name = "Unknown name"; //$NON-NLS-1$
}
}
rm.setData(new MIThreadDMData(name, id));
- rm.done();
+ rm.done();
} else if (dmc instanceof MIThreadDMC) {
- final MIThreadDMC threadDmc = (MIThreadDMC)dmc;
-
+ final MIThreadDMC threadDmc = (MIThreadDMC) dmc;
+
ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
- fThreadCommandCache.execute(fCommandFactory.createMIThreadInfo(controlDmc, threadDmc.getId()),
- new DataRequestMonitor<MIThreadInfoInfo>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- IThreadDMData threadData = null;
- if (getData().getThreadList().length != 0) {
- MIThread thread = getData().getThreadList()[0];
- if (thread.getThreadId().equals(threadDmc.getId())) {
- String id = ""; //$NON-NLS-1$
- if (thread.getOsId() != null) {
- id = thread.getOsId();
- }
- // append thread details (if any) to the thread ID
- // as for GDB 6.x with CLIInfoThreadsInfo#getOsId()
- final String details = thread.getDetails();
- if (details != null && !details.isEmpty()) {
- if (!id.isEmpty()) id += " "; //$NON-NLS-1$
- id += "(" + details + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- // We must indicate and empty id by using null
- if (id.isEmpty()) id = null;
-
- threadData = new MIThreadDMData("", id); //$NON-NLS-1$
- }
- }
-
- if (threadData != null) {
- rm.setData(threadData);
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Could not get thread info", null)); //$NON-NLS-1$
- }
- rm.done();
- }
- });
+ fThreadCommandCache.execute(fCommandFactory.createMIThreadInfo(controlDmc, threadDmc.getId()),
+ new DataRequestMonitor<MIThreadInfoInfo>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ IThreadDMData threadData = null;
+ if (getData().getThreadList().length != 0) {
+ MIThread thread = getData().getThreadList()[0];
+ if (thread.getThreadId().equals(threadDmc.getId())) {
+ String id = ""; //$NON-NLS-1$
+ if (thread.getOsId() != null) {
+ id = thread.getOsId();
+ }
+ // append thread details (if any) to the thread ID
+ // as for GDB 6.x with CLIInfoThreadsInfo#getOsId()
+ final String details = thread.getDetails();
+ if (details != null && !details.isEmpty()) {
+ if (!id.isEmpty())
+ id += " "; //$NON-NLS-1$
+ id += "(" + details + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ // We must indicate and empty id by using null
+ if (id.isEmpty())
+ id = null;
+
+ threadData = new MIThreadDMData("", id); //$NON-NLS-1$
+ }
+ }
+
+ if (threadData != null) {
+ rm.setData(threadData);
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE,
+ "Could not get thread info", null)); //$NON-NLS-1$
+ }
+ rm.done();
+ }
+ });
} else {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid DMC type", null)); //$NON-NLS-1$
rm.done();
}
}
-
+
@Override
- public void getDebuggingContext(IThreadDMContext dmc, DataRequestMonitor<IDMContext> rm) {
- if (dmc instanceof MIExitedProcessDMC) {
- MIExitedProcessDMC exitedProc = (MIExitedProcessDMC)dmc;
+ public void getDebuggingContext(IThreadDMContext dmc, DataRequestMonitor<IDMContext> rm) {
+ if (dmc instanceof MIExitedProcessDMC) {
+ MIExitedProcessDMC exitedProc = (MIExitedProcessDMC) dmc;
IMIContainerDMContext containerDmc = createContainerContext(exitedProc, exitedProc.getGroupId());
- rm.setData(containerDmc);
- } else if (dmc instanceof MIProcessDMC) {
- MIProcessDMC procDmc = (MIProcessDMC)dmc;
+ rm.setData(containerDmc);
+ } else if (dmc instanceof MIProcessDMC) {
+ MIProcessDMC procDmc = (MIProcessDMC) dmc;
IMIContainerDMContext containerDmc = createContainerContext(procDmc, getGroupFromPid(procDmc.getProcId()));
- rm.setData(containerDmc);
- } else if (dmc instanceof MIThreadDMC) {
- MIThreadDMC threadDmc = (MIThreadDMC)dmc;
- IMIProcessDMContext procDmc = DMContexts.getAncestorOfType(dmc, IMIProcessDMContext.class);
+ rm.setData(containerDmc);
+ } else if (dmc instanceof MIThreadDMC) {
+ MIThreadDMC threadDmc = (MIThreadDMC) dmc;
+ IMIProcessDMContext procDmc = DMContexts.getAncestorOfType(dmc, IMIProcessDMContext.class);
IMIContainerDMContext containerDmc = createContainerContext(procDmc, getGroupFromPid(procDmc.getProcId()));
- rm.setData(createExecutionContext(containerDmc, threadDmc, threadDmc.getId()));
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid thread context.", null)); //$NON-NLS-1$
- }
-
- rm.done();
- }
-
- /** @since 4.0 */
- protected boolean doIsDebuggerAttachSupported() {
- return fBackend.getIsAttachSession() && fNumConnected == 0;
- }
-
+ rm.setData(createExecutionContext(containerDmc, threadDmc, threadDmc.getId()));
+ } else {
+ rm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid thread context.", null)); //$NON-NLS-1$
+ }
+
+ rm.done();
+ }
+
+ /** @since 4.0 */
+ protected boolean doIsDebuggerAttachSupported() {
+ return fBackend.getIsAttachSession() && fNumConnected == 0;
+ }
+
@Override
- public void isDebuggerAttachSupported(IDMContext dmc, DataRequestMonitor<Boolean> rm) {
- rm.setData(doIsDebuggerAttachSupported());
- rm.done();
- }
+ public void isDebuggerAttachSupported(IDMContext dmc, DataRequestMonitor<Boolean> rm) {
+ rm.setData(doIsDebuggerAttachSupported());
+ rm.done();
+ }
@Override
- public void attachDebuggerToProcess(IProcessDMContext procCtx, DataRequestMonitor<IDMContext> rm) {
+ public void attachDebuggerToProcess(IProcessDMContext procCtx, DataRequestMonitor<IDMContext> rm) {
attachDebuggerToProcess(procCtx, null, rm);
}
-
- /**
+
+ /**
* @since 4.0
*/
@Override
- public void attachDebuggerToProcess(final IProcessDMContext procCtx, final String binaryPath, final DataRequestMonitor<IDMContext> dataRm) {
+ 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[] {
- // For remote attach, we must set the binary first
- // For a local attach, GDB can figure out the binary automatically,
- // so we don't specify it.
- new Step() {
- @Override
- public void execute(RequestMonitor rm) {
-
- if (isInitialProcess()) {
- // To be proper, set the initialProcess variable to false
- // it may be necessary for a class that extends this class
- setIsInitialProcess(false);
- }
-
- // There is no groupId until we attach, so we can use the default groupId
- fContainerDmc = createContainerContext(procCtx, MIProcesses.UNIQUE_GROUP_ID);
-
- if (binaryPath != null) {
- fCommandControl.queueCommand(
- fCommandFactory.createMIFileExecAndSymbols(fContainerDmc, binaryPath),
- new ImmediateDataRequestMonitor<MIInfo>(rm));
- return;
- }
-
- rm.done();
- }
- },
- // Attach to the process
- new Step() {
- @Override
- public void execute(RequestMonitor rm) {
- // For non-stop mode, we do a non-interrupting attach
- // Bug 333284
- boolean shouldInterrupt = true;
+ 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[] {
+ // For remote attach, we must set the binary first
+ // For a local attach, GDB can figure out the binary automatically,
+ // so we don't specify it.
+ new Step() {
+ @Override
+ public void execute(RequestMonitor rm) {
+
+ if (isInitialProcess()) {
+ // To be proper, set the initialProcess variable to false
+ // it may be necessary for a class that extends this class
+ setIsInitialProcess(false);
+ }
+
+ // There is no groupId until we attach, so we can use the default groupId
+ fContainerDmc = createContainerContext(procCtx, MIProcesses.UNIQUE_GROUP_ID);
+
+ if (binaryPath != null) {
+ fCommandControl.queueCommand(
+ fCommandFactory.createMIFileExecAndSymbols(fContainerDmc, binaryPath),
+ new ImmediateDataRequestMonitor<MIInfo>(rm));
+ return;
+ }
+
+ rm.done();
+ }
+ },
+ // Attach to the process
+ 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 DataRequestMonitor<MIInfo>(getExecutor(), rm));
- }
- },
- new Step() {
- @Override
- public void execute(RequestMonitor rm) {
+ fCommandControl.queueCommand(
+ fCommandFactory.createMITargetAttach(fContainerDmc,
+ ((IMIProcessDMContext) procCtx).getProcId(), shouldInterrupt),
+ new DataRequestMonitor<MIInfo>(getExecutor(), rm));
+ }
+ }, new Step() {
+ @Override
+ public void execute(RequestMonitor rm) {
// By now, GDB has reported the groupId that was created for this process
- fContainerDmc = createContainerContext(procCtx, getGroupFromPid(((IMIProcessDMContext)procCtx).getProcId()));
-
- // Store the fully formed container context so it can be returned to the caller.
- dataRm.setData(fContainerDmc);
+ fContainerDmc = createContainerContext(procCtx,
+ getGroupFromPid(((IMIProcessDMContext) procCtx).getProcId()));
+
+ // Store the fully formed container context so it can be returned to the caller.
+ dataRm.setData(fContainerDmc);
// Initialize memory data for this process.
IGDBMemory memory = getServicesTracker().getService(IGDBMemory.class);
- IMemoryDMContext memContext = DMContexts.getAncestorOfType(fContainerDmc, IMemoryDMContext.class);
+ IMemoryDMContext memContext = DMContexts.getAncestorOfType(fContainerDmc,
+ IMemoryDMContext.class);
if (memory == null || memContext == null) {
rm.done();
return;
}
memory.initializeMemoryData(memContext, rm);
- }
- },
- new Step() {
- @Override
- public void execute(RequestMonitor rm) {
+ }
+ }, new Step() {
+ @Override
+ public void execute(RequestMonitor rm) {
// Start tracking breakpoints.
- MIBreakpointsManager bpmService = getServicesTracker().getService(MIBreakpointsManager.class);
+ MIBreakpointsManager bpmService = getServicesTracker()
+ .getService(MIBreakpointsManager.class);
bpmService.startTrackingBpForProcess(fContainerDmc, rm);
- }
- },
- // Turn on reverse debugging if it was enabled as a launch option
- new Step() {
- @Override
- public void execute(RequestMonitor rm) {
+ }
+ },
+ // Turn on reverse debugging if it was enabled as a launch option
+ new Step() {
+ @Override
+ public void execute(RequestMonitor rm) {
doReverseDebugStep(procCtx, rm);
- }
- },
- };
+ }
+ }, };
- @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();
- }
+ @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();
+ }
}
/** @since 5.0 */
protected void doReverseDebugStep(final IProcessDMContext procCtx, RequestMonitor rm) {
- // Turn on reverse debugging if it was enabled as a launch option
+ // Turn on reverse debugging if it was enabled as a launch option
IReverseRunControl reverseService = getServicesTracker().getService(IReverseRunControl.class);
if (reverseService != null) {
ILaunch launch = procCtx.getAdapter(ILaunch.class);
if (launch != null) {
try {
- boolean reverseEnabled =
- launch.getLaunchConfiguration().getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE,
- IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_DEFAULT);
+ boolean reverseEnabled = launch.getLaunchConfiguration().getAttribute(
+ IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE,
+ IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_DEFAULT);
if (reverseEnabled) {
reverseService.enableReverseMode(fCommandControl.getContext(), true, rm);
return;
@@ -1280,29 +1322,29 @@ public class GDBProcesses_7_0 extends AbstractDsfService
rm.done();
}
- /** @since 4.0 */
- protected boolean doCanDetachDebuggerFromProcess() {
- return fNumConnected > 0;
- }
-
- private boolean isExitedProcess(IDMContext dmc) {
- return DMContexts.getAncestorOfType(dmc, MIExitedProcessDMC.class) != null;
- }
-
+ /** @since 4.0 */
+ protected boolean doCanDetachDebuggerFromProcess() {
+ return fNumConnected > 0;
+ }
+
+ private boolean isExitedProcess(IDMContext dmc) {
+ return DMContexts.getAncestorOfType(dmc, MIExitedProcessDMC.class) != null;
+ }
+
@Override
- public void canDetachDebuggerFromProcess(IDMContext dmc, DataRequestMonitor<Boolean> rm) {
+ public void canDetachDebuggerFromProcess(IDMContext dmc, DataRequestMonitor<Boolean> rm) {
MIExitedProcessDMC exitedProc = DMContexts.getAncestorOfType(dmc, MIExitedProcessDMC.class);
if (exitedProc != null) {
// Allow to use the disconnect button to remove an exited process
rm.done(true);
return;
}
- rm.done(doCanDetachDebuggerFromProcess());
- }
+ rm.done(doCanDetachDebuggerFromProcess());
+ }
@Override
- public void detachDebuggerFromProcess(final IDMContext dmc, final RequestMonitor rm) {
- MIExitedProcessDMC exitedProc = DMContexts.getAncestorOfType(dmc, MIExitedProcessDMC.class);
+ public void detachDebuggerFromProcess(final IDMContext dmc, final RequestMonitor rm) {
+ MIExitedProcessDMC exitedProc = DMContexts.getAncestorOfType(dmc, MIExitedProcessDMC.class);
if (exitedProc != null) {
// For an exited process, remove the entry from our table to stop showing it, and
// remove the entry from the launch itself to remove the process's console
@@ -1312,16 +1354,17 @@ public class GDBProcesses_7_0 extends AbstractDsfService
getSession().dispatchEvent(new ProcessRemovedDMEvent(exitedProc), null);
return;
}
-
- ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
- final IMIProcessDMContext procDmc = DMContexts.getAncestorOfType(dmc, IMIProcessDMContext.class);
- if (controlDmc != null && procDmc != null) {
- if (!doCanDetachDebuggerFromProcess()) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Detach not supported.", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
+ ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
+ final IMIProcessDMContext procDmc = DMContexts.getAncestorOfType(dmc, IMIProcessDMContext.class);
+
+ if (controlDmc != null && procDmc != null) {
+ if (!doCanDetachDebuggerFromProcess()) {
+ rm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Detach not supported.", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
IMIRunControl runControl = getServicesTracker().getService(IMIRunControl.class);
if (runControl != null && !runControl.isTargetAcceptingCommands()) {
@@ -1334,22 +1377,21 @@ public class GDBProcesses_7_0 extends AbstractDsfService
if (containerDmc != null) {
getDetachedProcesses().add(containerDmc.getGroupId());
}
- fCommandControl.queueCommand(
- fCommandFactory.createMITargetDetach(controlDmc, procDmc.getProcId()),
- new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
- @Override
- protected void handleFailure() {
- // The detach failed
- if (containerDmc != null) {
- getDetachedProcesses().remove(containerDmc.getGroupId());
- }
- super.handleFailure();
- }
- });
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid context.", null)); //$NON-NLS-1$
- rm.done();
- }
+ fCommandControl.queueCommand(fCommandFactory.createMITargetDetach(controlDmc, procDmc.getProcId()),
+ new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
+ @Override
+ protected void handleFailure() {
+ // The detach failed
+ if (containerDmc != null) {
+ getDetachedProcesses().remove(containerDmc.getGroupId());
+ }
+ super.handleFailure();
+ }
+ });
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid context.", null)); //$NON-NLS-1$
+ rm.done();
+ }
}
@Override
@@ -1366,17 +1408,17 @@ public class GDBProcesses_7_0 extends AbstractDsfService
@Override
public void isDebugNewProcessSupported(IDMContext dmc, DataRequestMonitor<Boolean> rm) {
rm.setData(doIsDebugNewProcessSupported());
- rm.done();
+ rm.done();
}
/** @since 4.0 */
protected boolean doIsDebugNewProcessSupported() {
return false;
}
-
+
@Override
- public void debugNewProcess(IDMContext dmc, String file,
- Map<String, Object> attributes, DataRequestMonitor<IDMContext> rm) {
+ public void debugNewProcess(IDMContext dmc, String file, Map<String, Object> attributes,
+ DataRequestMonitor<IDMContext> rm) {
// Store the current value of the initialProcess variable because we will use it later
// and we are about to change it.
@@ -1386,26 +1428,27 @@ public class GDBProcesses_7_0 extends AbstractDsfService
} else {
// If we are trying to create another process than the initial one, see if we are allowed
if (!doIsDebugNewProcessSupported()) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Not allowed to create a new process", null)); //$NON-NLS-1$
- rm.done();
- return;
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE,
+ "Not allowed to create a new process", null)); //$NON-NLS-1$
+ rm.done();
+ return;
}
}
- ImmediateExecutor.getInstance().execute(
- getDebugNewProcessSequence(getExecutor(), isInitial, dmc, file, attributes, rm));
+ ImmediateExecutor.getInstance()
+ .execute(getDebugNewProcessSequence(getExecutor(), isInitial, dmc, file, attributes, rm));
}
-
+
/**
* Return the sequence that is to be used to create a new process the specified process.
* Allows others to extend more easily.
* @since 4.0
*/
- protected Sequence getDebugNewProcessSequence(DsfExecutor executor, boolean isInitial, IDMContext dmc, String file,
- Map<String, Object> attributes, DataRequestMonitor<IDMContext> rm) {
+ protected Sequence getDebugNewProcessSequence(DsfExecutor executor, boolean isInitial, IDMContext dmc, String file,
+ Map<String, Object> attributes, DataRequestMonitor<IDMContext> rm) {
return new DebugNewProcessSequence(executor, isInitial, dmc, file, attributes, rm);
}
-
+
@Override
public void getProcessesBeingDebugged(final IDMContext dmc, final DataRequestMonitor<IDMContext[]> rm) {
final ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
@@ -1416,9 +1459,8 @@ public class GDBProcesses_7_0 extends AbstractDsfService
rm.done(new IMIExecutionDMContext[0]);
return;
}
-
- fThreadCommandCache.execute(
- fCommandFactory.createMIListThreadGroups(controlDmc, containerDmc.getGroupId()),
+
+ fThreadCommandCache.execute(fCommandFactory.createMIListThreadGroups(controlDmc, containerDmc.getGroupId()),
new DataRequestMonitor<MIListThreadGroupsInfo>(getExecutor(), rm) {
@Override
protected void handleSuccess() {
@@ -1427,39 +1469,40 @@ public class GDBProcesses_7_0 extends AbstractDsfService
}
});
} else {
-
- final DataRequestMonitor<IMIContainerDMContext[]> addExitedDRM =
- new ImmediateDataRequestMonitor<IMIContainerDMContext[]>(rm) {
+
+ final DataRequestMonitor<IMIContainerDMContext[]> addExitedDRM = new ImmediateDataRequestMonitor<IMIContainerDMContext[]>(
+ rm) {
@Override
protected void handleCompleted() {
List<IMIContainerDMContext> containerDmcs = new ArrayList<>(Arrays.asList(getData()));
-
+
// Add the exited processes to our list in reverse order of insertion so that
// the latest exited process is at the top
List<Entry<String, ExitedProcInfo>> entries = new ArrayList<>(getExitedProcesses().entrySet());
- for (int i = entries.size() - 1; i >= 0 ; i--) {
- Entry<String, ExitedProcInfo> entry = entries.get(i);
- String groupId = entry.getKey();
+ for (int i = entries.size() - 1; i >= 0; i--) {
+ Entry<String, ExitedProcInfo> entry = entries.get(i);
+ String groupId = entry.getKey();
String pid = entry.getValue().getPid();
IProcessDMContext processDmc = createExitedProcessContext(controlDmc, pid, groupId);
containerDmcs.add(createContainerContext(processDmc, groupId));
}
-
+
rm.done(containerDmcs.toArray(new IMIContainerDMContext[containerDmcs.size()]));
};
};
- fContainerCommandCache.execute(
- fCommandFactory.createMIListThreadGroups(controlDmc),
+ fContainerCommandCache.execute(fCommandFactory.createMIListThreadGroups(controlDmc),
new DataRequestMonitor<MIListThreadGroupsInfo>(getExecutor(), addExitedDRM) {
@Override
protected void handleSuccess() {
addExitedDRM.done(makeContainerDMCs(controlDmc, getData().getGroupList()));
}
+
@Override
protected void handleFailure() {
// If the target is not available, generate the list ourselves
- IMIContainerDMContext[] containerDmcs = new IMIContainerDMContext[getGroupToPidMap().size()];
+ IMIContainerDMContext[] containerDmcs = new IMIContainerDMContext[getGroupToPidMap()
+ .size()];
int i = 0;
for (String groupId : getGroupToPidMap().keySet()) {
containerDmcs[i++] = createContainerContextFromGroupId(controlDmc, groupId);
@@ -1478,16 +1521,14 @@ public class GDBProcesses_7_0 extends AbstractDsfService
// So create thread-id = 0 when no thread is reported.
// This hack is necessary to prevent AbstractMIControl from issuing a thread-select
// because it doesn't work if the application was not compiled with pthread.
- return new IMIExecutionDMContext[]{createExecutionContext(containerDmc,
- createThreadContext(procDmc, FAKE_THREAD_ID),
- FAKE_THREAD_ID)};
+ return new IMIExecutionDMContext[] { createExecutionContext(containerDmc,
+ createThreadContext(procDmc, FAKE_THREAD_ID), FAKE_THREAD_ID) };
} else {
IExecutionDMContext[] executionDmcs = new IMIExecutionDMContext[threadInfos.length];
for (int i = 0; i < threadInfos.length; i++) {
String threadId = threadInfos[i].getThreadId();
- executionDmcs[i] = createExecutionContext(containerDmc,
- createThreadContext(procDmc, threadId),
- threadId);
+ executionDmcs[i] = createExecutionContext(containerDmc, createThreadContext(procDmc, threadId),
+ threadId);
}
return executionDmcs;
}
@@ -1500,21 +1541,21 @@ public class GDBProcesses_7_0 extends AbstractDsfService
// code can be removed when GDB 7.2 is released
// START OF WORKAROUND
if (groups.length == 0 && fBackend.getSessionType() == SessionType.CORE) {
- return new IMIContainerDMContext[] {createContainerContextFromGroupId(controlDmc, MIProcesses.UNIQUE_GROUP_ID)};
+ return new IMIContainerDMContext[] {
+ createContainerContextFromGroupId(controlDmc, MIProcesses.UNIQUE_GROUP_ID) };
}
// END OF WORKAROUND to be removed when GDB 7.2 is available
-
+
// With GDB 7.1, we can receive a bogus process when we are not debugging anything
- // -list-thread-groups
- // ^done,groups=[{id="0",type="process",pid="0"}]
+ // -list-thread-groups
+ // ^done,groups=[{id="0",type="process",pid="0"}]
// As for GDB 7.2, the pid field is missing altogether in this case
// -list-thread-groups
// ^done,groups=[{id="i1",type="process"}]
// Just ignore that entry
List<IMIContainerDMContext> containerDmcs = new ArrayList<IMIContainerDMContext>(groups.length);
for (IThreadGroupInfo group : groups) {
- if (group.getPid() == null ||
- group.getPid().isEmpty() || group.getPid().equals("0")) { //$NON-NLS-1$
+ if (group.getPid() == null || group.getPid().isEmpty() || group.getPid().equals("0")) { //$NON-NLS-1$
continue;
}
String groupId = group.getGroupId();
@@ -1527,65 +1568,61 @@ public class GDBProcesses_7_0 extends AbstractDsfService
public void getRunningProcesses(final IDMContext dmc, final DataRequestMonitor<IProcessDMContext[]> rm) {
final ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
if (controlDmc != null) {
- fListThreadGroupsAvailableCache.execute(
- fCommandFactory.createMIListThreadGroups(controlDmc, true),
- new DataRequestMonitor<MIListThreadGroupsInfo>(getExecutor(), rm) {
- @Override
- protected void handleCompleted() {
- // We cannot actually cache this command since the process
- // list may change. But this cache allows to avoid overlapping
- // sending of this command.
- fListThreadGroupsAvailableCache.reset();
-
- if (isSuccess()) {
- rm.setData(makeProcessDMCAndData(controlDmc, getData().getGroupList()));
- } else {
- // Looks like this gdb doesn't truly support
- // "-list-thread-groups --available". If we're
- // debugging locally, resort to getting the
- // list natively (as we do with gdb 6.8). If
- // we're debugging remotely, the user is out
- // of luck
- if (fBackend.getSessionType() == SessionType.LOCAL) {
- IProcessList list = null;
- try {
- list = CCorePlugin.getDefault().getProcessList();
- } catch (CoreException e) {
- }
-
- if (list == null) {
- rm.setData(new IProcessDMContext[0]);
+ fListThreadGroupsAvailableCache.execute(fCommandFactory.createMIListThreadGroups(controlDmc, true),
+ new DataRequestMonitor<MIListThreadGroupsInfo>(getExecutor(), rm) {
+ @Override
+ protected void handleCompleted() {
+ // We cannot actually cache this command since the process
+ // list may change. But this cache allows to avoid overlapping
+ // sending of this command.
+ fListThreadGroupsAvailableCache.reset();
+
+ if (isSuccess()) {
+ rm.setData(makeProcessDMCAndData(controlDmc, getData().getGroupList()));
+ } else {
+ // Looks like this gdb doesn't truly support
+ // "-list-thread-groups --available". If we're
+ // debugging locally, resort to getting the
+ // list natively (as we do with gdb 6.8). If
+ // we're debugging remotely, the user is out
+ // of luck
+ if (fBackend.getSessionType() == SessionType.LOCAL) {
+ IProcessList list = null;
+ try {
+ list = CCorePlugin.getDefault().getProcessList();
+ } catch (CoreException e) {
+ }
+
+ if (list == null) {
+ rm.setData(new IProcessDMContext[0]);
+ } else {
+ IProcessInfo[] procInfos = list.getProcessList();
+ rm.setData(makeProcessDMCAndData(controlDmc, procInfos));
+ }
} else {
- IProcessInfo[] procInfos = list.getProcessList();
- rm.setData(makeProcessDMCAndData(controlDmc, procInfos));
+ rm.setData(new IProcessDMContext[0]);
}
}
- else {
- rm.setData(new IProcessDMContext[0]);
- }
+ rm.done();
}
- rm.done();
- }
- });
+ });
} else {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid context.", null)); //$NON-NLS-1$
rm.done();
}
}
-
+
/**
* Create the joint process DMC and data based on IProcessInfo, which is a local listing.
* @since 4.0
*/
- protected MIProcessDMCAndData[] makeProcessDMCAndData(ICommandControlDMContext controlDmc, IProcessInfo[] processes) {
+ protected MIProcessDMCAndData[] makeProcessDMCAndData(ICommandControlDMContext controlDmc,
+ IProcessInfo[] processes) {
MIProcessDMCAndData[] procDmcs = new MIProcessDMCAndData[processes.length];
- for (int i=0; i<procDmcs.length; i++) {
- procDmcs[i] = new MIProcessDMCAndData(controlDmc.getSessionId(),
- controlDmc,
- Integer.toString(processes[i].getPid()),
- processes[i].getName(),
- null, null);
+ for (int i = 0; i < procDmcs.length; i++) {
+ procDmcs[i] = new MIProcessDMCAndData(controlDmc.getSessionId(), controlDmc,
+ Integer.toString(processes[i].getPid()), processes[i].getName(), null, null);
}
return procDmcs;
}
@@ -1594,17 +1631,13 @@ public class GDBProcesses_7_0 extends AbstractDsfService
* Create the joint process DMC and data based on IThreadGroupInfo, which is obtained from GDB.
* @since 4.0
*/
- protected MIProcessDMCAndData[] makeProcessDMCAndData(ICommandControlDMContext controlDmc, IThreadGroupInfo[] processes) {
+ protected MIProcessDMCAndData[] makeProcessDMCAndData(ICommandControlDMContext controlDmc,
+ IThreadGroupInfo[] processes) {
MIProcessDMCAndData[] procDmcs = new MIProcessDMCAndData[processes.length];
- int i=0;
+ int i = 0;
for (IThreadGroupInfo process : processes) {
- procDmcs[i++] = new MIProcessDMCAndData(controlDmc.getSessionId(),
- controlDmc,
- process.getGroupId(),
- process.getName(),
- process.getCores(),
- process.getUser(),
- process.getDesciption());
+ procDmcs[i++] = new MIProcessDMCAndData(controlDmc.getSessionId(), controlDmc, process.getGroupId(),
+ process.getName(), process.getCores(), process.getUser(), process.getDesciption());
}
return procDmcs;
}
@@ -1612,14 +1645,13 @@ public class GDBProcesses_7_0 extends AbstractDsfService
@Override
public void isRunNewProcessSupported(IDMContext dmc, DataRequestMonitor<Boolean> rm) {
rm.setData(false);
- rm.done();
+ rm.done();
}
-
+
@Override
- public void runNewProcess(IDMContext dmc, String file,
- Map<String, Object> attributes, DataRequestMonitor<IProcessDMContext> rm) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
- NOT_SUPPORTED, "Not supported", null)); //$NON-NLS-1$
+ public void runNewProcess(IDMContext dmc, String file, Map<String, Object> attributes,
+ DataRequestMonitor<IProcessDMContext> rm) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Not supported", null)); //$NON-NLS-1$
rm.done();
}
@@ -1628,85 +1660,87 @@ public class GDBProcesses_7_0 extends AbstractDsfService
if (thread instanceof MIExitedProcessDMC) {
// For an exited process, remove the entry from our table to stop showing it, and
// remove the entry from the launch itself to remove the process's console
- String groupId = ((MIExitedProcessDMC)thread).getGroupId();
+ String groupId = ((MIExitedProcessDMC) thread).getGroupId();
getExitedProcesses().remove(groupId);
removeProcessFromLaunch(groupId);
- getSession().dispatchEvent(new ProcessRemovedDMEvent((IProcessDMContext)thread), null);
+ getSession().dispatchEvent(new ProcessRemovedDMEvent((IProcessDMContext) thread), null);
} else if (fBackend.getSessionType() == SessionType.CORE) {
- // For a core session, there is no concept of killing the inferior,
- // so lets kill GDB
- fCommandControl.terminate(rm);
- } else if (thread instanceof IMIProcessDMContext) {
- getDebuggingContext(
- thread,
- new ImmediateDataRequestMonitor<IDMContext>(rm) {
- @Override
- protected void handleSuccess() {
- if (getData() instanceof IMIContainerDMContext) {
- IMIRunControl runControl = getServicesTracker().getService(IMIRunControl.class);
- if (runControl != null && !runControl.isTargetAcceptingCommands()) {
- fBackend.interrupt();
- }
-
- fCommandControl.queueCommand(
- fCommandFactory.createMIInterpreterExecConsoleKill((IMIContainerDMContext)getData()),
- new ImmediateDataRequestMonitor<MIInfo>(rm));
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid process context.", null)); //$NON-NLS-1$
- rm.done();
- }
+ // For a core session, there is no concept of killing the inferior,
+ // so lets kill GDB
+ fCommandControl.terminate(rm);
+ } else if (thread instanceof IMIProcessDMContext) {
+ getDebuggingContext(thread, new ImmediateDataRequestMonitor<IDMContext>(rm) {
+ @Override
+ protected void handleSuccess() {
+ if (getData() instanceof IMIContainerDMContext) {
+ IMIRunControl runControl = getServicesTracker().getService(IMIRunControl.class);
+ if (runControl != null && !runControl.isTargetAcceptingCommands()) {
+ fBackend.interrupt();
}
- });
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid process context.", null)); //$NON-NLS-1$
- rm.done();
- }
+
+ fCommandControl.queueCommand(
+ fCommandFactory.createMIInterpreterExecConsoleKill((IMIContainerDMContext) getData()),
+ new ImmediateDataRequestMonitor<MIInfo>(rm));
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR,
+ "Invalid process context.", null)); //$NON-NLS-1$
+ rm.done();
+ }
+ }
+ });
+ } else {
+ rm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid process context.", null)); //$NON-NLS-1$
+ rm.done();
+ }
}
-
+
/** @since 4.0 */
@Override
- public void canRestart(IContainerDMContext containerDmc, DataRequestMonitor<Boolean> rm) {
- if (fBackend.getIsAttachSession() || fBackend.getSessionType() == SessionType.CORE) {
- rm.setData(false);
- rm.done();
- return;
- }
-
- // Before GDB6.8, the Linux gdbserver would restart a new
- // process when getting a -exec-run but the communication
- // with GDB had a bug and everything hung.
- // with GDB6.8 the program restarts properly one time,
- // but on a second attempt, gdbserver crashes.
- // So, lets just turn off the Restart for Remote debugging
- if (fBackend.getSessionType() == SessionType.REMOTE) {
- rm.setData(false);
- rm.done();
- return;
- }
-
- rm.setData(true);
- rm.done();
- }
-
- /**
+ public void canRestart(IContainerDMContext containerDmc, DataRequestMonitor<Boolean> rm) {
+ if (fBackend.getIsAttachSession() || fBackend.getSessionType() == SessionType.CORE) {
+ rm.setData(false);
+ rm.done();
+ return;
+ }
+
+ // Before GDB6.8, the Linux gdbserver would restart a new
+ // process when getting a -exec-run but the communication
+ // with GDB had a bug and everything hung.
+ // with GDB6.8 the program restarts properly one time,
+ // but on a second attempt, gdbserver crashes.
+ // So, lets just turn off the Restart for Remote debugging
+ if (fBackend.getSessionType() == SessionType.REMOTE) {
+ rm.setData(false);
+ rm.done();
+ return;
+ }
+
+ rm.setData(true);
+ rm.done();
+ }
+
+ /**
* Creates the container context that is to be used for the new process that will
* be created by the restart operation.
* This container does not have its pid yet, while the container of the process
* that is being restarted does have its pid.
* Also, for GDB 7.0 and 7.1, the groupId being the pid, we cannot use the old
* container's groupId, but must use the default groupId until the pid is created.
- *
+ *
* @since 4.0
*/
protected IMIContainerDMContext createContainerContextForRestart(String groupId) {
- IProcessDMContext processDmc = createProcessContext(fCommandControl.getContext(), MIProcesses.UNKNOWN_PROCESS_ID);
- // Don't use the groupId passed in, since it is the old pid.
+ IProcessDMContext processDmc = createProcessContext(fCommandControl.getContext(),
+ MIProcesses.UNKNOWN_PROCESS_ID);
+ // Don't use the groupId passed in, since it is the old pid.
return createContainerContext(processDmc, MIProcesses.UNIQUE_GROUP_ID);
}
-
+
/** @since 4.0 */
@Override
- public void restart(IContainerDMContext containerDmc, final Map<String, Object> attributes, final DataRequestMonitor<IContainerDMContext> rm) {
+ public void restart(IContainerDMContext containerDmc, final Map<String, Object> attributes,
+ final DataRequestMonitor<IContainerDMContext> rm) {
// Before performing the restart, check if the process is properly suspended.
// For such a case, we usually use IMIRunControl.isTargetAcceptingCommands().
// However, in non-stop, although the target is accepting command, a restart
@@ -1719,8 +1753,8 @@ public class GDBProcesses_7_0 extends AbstractDsfService
// just yet.
// Bug 246740
- final String groupId = ((IMIContainerDMContext)containerDmc).getGroupId();
-
+ final String groupId = ((IMIContainerDMContext) containerDmc).getGroupId();
+
// This request monitor actually performs the restart
RequestMonitor restartRm = new ImmediateRequestMonitor(rm) {
@Override
@@ -1730,19 +1764,20 @@ public class GDBProcesses_7_0 extends AbstractDsfService
// Pass in the groupId because starting with GDB 7.2, we must re-use the same groupId.
IContainerDMContext newContainerDmc = createContainerContextForRestart(groupId);
- startOrRestart(newContainerDmc, attributes, true, new ImmediateDataRequestMonitor<IContainerDMContext>(rm) {
- @Override
- protected void handleCompleted() {
- // In case the process we restarted was already exited, remove it from our list
- // We do this here for GDB 7.1, because we know the proper groupId here which
- // will change when the new restarted process will start. For GDB >= 7.2
- // the groupId is fixed so we don't have to do this right away, but it won't hurt.
- getExitedProcesses().remove(groupId);
-
- setData(getData());
- super.handleCompleted();
- };
- });
+ startOrRestart(newContainerDmc, attributes, true,
+ new ImmediateDataRequestMonitor<IContainerDMContext>(rm) {
+ @Override
+ protected void handleCompleted() {
+ // In case the process we restarted was already exited, remove it from our list
+ // We do this here for GDB 7.1, because we know the proper groupId here which
+ // will change when the new restarted process will start. For GDB >= 7.2
+ // the groupId is fixed so we don't have to do this right away, but it won't hurt.
+ getExitedProcesses().remove(groupId);
+
+ setData(getData());
+ super.handleCompleted();
+ };
+ });
};
};
@@ -1755,19 +1790,19 @@ public class GDBProcesses_7_0 extends AbstractDsfService
restartRm.done();
}
}
-
+
/** @since 4.0 */
@Override
- public void start(IContainerDMContext containerDmc, Map<String, Object> attributes, DataRequestMonitor<IContainerDMContext> rm) {
+ public void start(IContainerDMContext containerDmc, Map<String, Object> attributes,
+ DataRequestMonitor<IContainerDMContext> rm) {
startOrRestart(containerDmc, attributes, false, rm);
}
-
+
/** @since 4.0 */
- protected void startOrRestart(IContainerDMContext containerDmc, Map<String, Object> attributes,
- boolean restart, DataRequestMonitor<IContainerDMContext> rm) {
- ImmediateExecutor.getInstance().execute(
- getStartOrRestartProcessSequence(
- getExecutor(), containerDmc, attributes, restart, rm));
+ protected void startOrRestart(IContainerDMContext containerDmc, Map<String, Object> attributes, boolean restart,
+ DataRequestMonitor<IContainerDMContext> rm) {
+ ImmediateExecutor.getInstance()
+ .execute(getStartOrRestartProcessSequence(getExecutor(), containerDmc, attributes, restart, rm));
}
/**
@@ -1775,19 +1810,18 @@ public class GDBProcesses_7_0 extends AbstractDsfService
* Allows others to extend more easily.
* @since 4.0
*/
- protected Sequence getStartOrRestartProcessSequence(DsfExecutor executor, IContainerDMContext containerDmc,
- Map<String, Object> attributes, boolean restart,
- DataRequestMonitor<IContainerDMContext> rm) {
+ protected Sequence getStartOrRestartProcessSequence(DsfExecutor executor, IContainerDMContext containerDmc,
+ Map<String, Object> attributes, boolean restart, DataRequestMonitor<IContainerDMContext> rm) {
return new StartOrRestartProcessSequence_7_0(executor, containerDmc, attributes, restart, rm);
}
-
+
/**
* Removes the process with the specified groupId from the launch.
- *
+ *
* @return The label used for the console of that process.
*/
private String removeProcessFromLaunch(String groupId) {
- ILaunch launch = (ILaunch)getSession().getModelAdapter(ILaunch.class);
+ ILaunch launch = (ILaunch) getSession().getModelAdapter(ILaunch.class);
IProcess[] launchProcesses = launch.getProcesses();
for (IProcess process : launchProcesses) {
if (process instanceof InferiorRuntimeProcess) {
@@ -1796,8 +1830,8 @@ public class GDBProcesses_7_0 extends AbstractDsfService
// if the groupAttribute is not set in the process we know we are dealing
// with single process debugging so the one process is the one we want.
// If the groupAttribute is set, then we must make sure it is the proper inferior
- if (groupAttribute == null || groupAttribute.equals(MIProcesses.UNIQUE_GROUP_ID) ||
- groupAttribute.equals(groupId)) {
+ if (groupAttribute == null || groupAttribute.equals(MIProcesses.UNIQUE_GROUP_ID)
+ || groupAttribute.equals(groupId)) {
launch.removeProcess(process);
return process.getLabel();
}
@@ -1810,34 +1844,35 @@ public class GDBProcesses_7_0 extends AbstractDsfService
* Add the specified process to the launch.
*/
private void addProcessToLaunch(Process inferior, String groupId, String label) {
- // Add the inferior to the launch.
+ // Add the inferior to the launch.
// This cannot be done on the executor or things deadlock.
DebugPlugin.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
// Add the inferior
- // Need to go through DebugPlugin.newProcess so that we can use
+ // Need to go through DebugPlugin.newProcess so that we can use
// the overrideable process factory to allow others to override.
// First set attribute to specify we want to create an inferior process.
// Bug 210366
- ILaunch launch = (ILaunch)getSession().getModelAdapter(ILaunch.class);
+ ILaunch launch = (ILaunch) getSession().getModelAdapter(ILaunch.class);
Map<String, String> attributes = new HashMap<String, String>();
- attributes.put(IGdbDebugConstants.PROCESS_TYPE_CREATION_ATTR,
+ attributes.put(IGdbDebugConstants.PROCESS_TYPE_CREATION_ATTR,
IGdbDebugConstants.INFERIOR_PROCESS_CREATION_VALUE);
- IProcess runtimeInferior = DebugPlugin.newProcess(launch, inferior, label != null ? label : "", attributes); //$NON-NLS-1$
+ IProcess runtimeInferior = DebugPlugin.newProcess(launch, inferior, label != null ? label : "", //$NON-NLS-1$
+ attributes);
// Now set the inferior groupId
runtimeInferior.setAttribute(IGdbDebugConstants.INFERIOR_GROUPID_ATTR, groupId);
}
});
}
-
- /**
+
+ /**
* @since 5.2
*/
@Override
public void addInferiorToLaunch(IContainerDMContext containerDmc, String label, PTY pty, RequestMonitor rm) {
if (containerDmc instanceof IMIContainerDMContext) {
- String groupId = ((IMIContainerDMContext)containerDmc).getGroupId();
+ String groupId = ((IMIContainerDMContext) containerDmc).getGroupId();
// Create an MIInferiorProcess to track the new instance of the process,
// remove the old one from the launch, and add the new one to the launch.
Process inferiorProcess;
@@ -1850,34 +1885,36 @@ public class GDBProcesses_7_0 extends AbstractDsfService
addProcessToLaunch(inferiorProcess, groupId, label);
}
rm.done();
- }
-
- @DsfServiceEventHandler
- public void eventDispatched(final MIThreadGroupCreatedEvent e) {
- IProcessDMContext procDmc = e.getDMContext();
- IMIContainerDMContext containerDmc = e.getGroupId() != null ? createContainerContext(procDmc, e.getGroupId()) : null;
- getSession().dispatchEvent(new ContainerStartedDMEvent(containerDmc), getProperties());
- }
-
- @DsfServiceEventHandler
- public void eventDispatched(final MIThreadGroupExitedEvent e) {
- IProcessDMContext procDmc = e.getDMContext();
- IMIContainerDMContext containerDmc = e.getGroupId() != null ? createContainerContext(procDmc, e.getGroupId()) : null;
+ }
+
+ @DsfServiceEventHandler
+ public void eventDispatched(final MIThreadGroupCreatedEvent e) {
+ IProcessDMContext procDmc = e.getDMContext();
+ IMIContainerDMContext containerDmc = e.getGroupId() != null ? createContainerContext(procDmc, e.getGroupId())
+ : null;
+ getSession().dispatchEvent(new ContainerStartedDMEvent(containerDmc), getProperties());
+ }
+
+ @DsfServiceEventHandler
+ public void eventDispatched(final MIThreadGroupExitedEvent e) {
+ IProcessDMContext procDmc = e.getDMContext();
+ IMIContainerDMContext containerDmc = e.getGroupId() != null ? createContainerContext(procDmc, e.getGroupId())
+ : null;
getSession().dispatchEvent(new ContainerExitedDMEvent(containerDmc), getProperties());
- }
-
- @DsfServiceEventHandler
- public void eventDispatched(IResumedDMEvent e) {
- if (e instanceof IContainerResumedDMEvent) {
- // This will happen in all-stop mode
- fContainerCommandCache.setContextAvailable(e.getDMContext(), false);
- fThreadCommandCache.setContextAvailable(e.getDMContext(), false);
- fListThreadGroupsAvailableCache.setContextAvailable(e.getDMContext(), false);
- } else {
- // This will happen in non-stop mode
- // Keep target available for Container commands
- }
- }
+ }
+
+ @DsfServiceEventHandler
+ public void eventDispatched(IResumedDMEvent e) {
+ if (e instanceof IContainerResumedDMEvent) {
+ // This will happen in all-stop mode
+ fContainerCommandCache.setContextAvailable(e.getDMContext(), false);
+ fThreadCommandCache.setContextAvailable(e.getDMContext(), false);
+ fListThreadGroupsAvailableCache.setContextAvailable(e.getDMContext(), false);
+ } else {
+ // This will happen in non-stop mode
+ // Keep target available for Container commands
+ }
+ }
/** @since 5.2 */
protected MIInferiorProcess createInferiorProcess(IContainerDMContext container, OutputStream outputStream) {
@@ -1889,113 +1926,114 @@ public class GDBProcesses_7_0 extends AbstractDsfService
return new MIInferiorProcess(container, pty);
}
- private void handleRestartingProcess(IMIContainerDMContext containerDmc) {
+ private void handleRestartingProcess(IMIContainerDMContext containerDmc) {
String label = removeProcessFromLaunch(containerDmc.getGroupId());
if (label != null) {
// We only add the process to the launch if the original process was part of the launch.
// For example, in the attach case, there is no process added to the launch
// We re-use the same PTY as the one used before the restart.
- addInferiorToLaunch(containerDmc, label, fGroupIdToPTYMap.get(containerDmc.getGroupId()), new ImmediateRequestMonitor());
- }
- }
-
- @DsfServiceEventHandler
- public void eventDispatched(ISuspendedDMEvent e) {
- if (e instanceof IContainerSuspendedDMEvent) {
- // This will happen in all-stop mode
- fContainerCommandCache.setContextAvailable(fCommandControl.getContext(), true);
- fThreadCommandCache.setContextAvailable(fCommandControl.getContext(), true);
- fListThreadGroupsAvailableCache.setContextAvailable(fCommandControl.getContext(), true);
- } else {
- // This will happen in non-stop mode
- }
-
- // If user is debugging a gdb target that doesn't send thread
+ addInferiorToLaunch(containerDmc, label, fGroupIdToPTYMap.get(containerDmc.getGroupId()),
+ new ImmediateRequestMonitor());
+ }
+ }
+
+ @DsfServiceEventHandler
+ public void eventDispatched(ISuspendedDMEvent e) {
+ if (e instanceof IContainerSuspendedDMEvent) {
+ // This will happen in all-stop mode
+ fContainerCommandCache.setContextAvailable(fCommandControl.getContext(), true);
+ fThreadCommandCache.setContextAvailable(fCommandControl.getContext(), true);
+ fListThreadGroupsAvailableCache.setContextAvailable(fCommandControl.getContext(), true);
+ } else {
+ // This will happen in non-stop mode
+ }
+
+ // If user is debugging a gdb target that doesn't send thread
// creation events, make sure we don't use cached thread
// information. Reset the cache after every suspend. See bugzilla
// 280631
- try {
+ try {
if (fBackend.getUpdateThreadListOnSuspend()) {
// We need to clear the cache for the context that we use to fill the cache,
// and it is the controDMC in this case.
- ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(e.getDMContext(), ICommandControlDMContext.class);
+ ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(e.getDMContext(),
+ ICommandControlDMContext.class);
fThreadCommandCache.reset(controlDmc);
}
- } catch (CoreException exc) {}
- }
-
- // Event handler when a thread or threadGroup starts
- @DsfServiceEventHandler
- public void eventDispatched(IStartedDMEvent e) {
- if (e.getDMContext() instanceof IMIContainerDMContext) {
- String groupId = ((IMIContainerDMContext)e.getDMContext()).getGroupId();
+ } catch (CoreException exc) {
+ }
+ }
+
+ // Event handler when a thread or threadGroup starts
+ @DsfServiceEventHandler
+ public void eventDispatched(IStartedDMEvent e) {
+ if (e.getDMContext() instanceof IMIContainerDMContext) {
+ String groupId = ((IMIContainerDMContext) e.getDMContext()).getGroupId();
if (fExitedGroupId.remove(groupId)) {
- // The process in question is restarting.
- handleRestartingProcess((IMIContainerDMContext)e.getDMContext());
- }
-
- fContainerCommandCache.reset();
- fNumConnected++;
- } else {
- fThreadCommandCache.reset();
- }
- }
-
- // Event handler when a thread or a threadGroup exits
- @DsfServiceEventHandler
- public void eventDispatched(IExitedDMEvent e) {
- if (e.getDMContext() instanceof IMIContainerDMContext) {
- fExitedGroupId.add(((IMIContainerDMContext)e.getDMContext()).getGroupId());
-
- fContainerCommandCache.reset();
-
- assert fNumConnected > 0;
- fNumConnected--;
-
- if (fNumConnected == 0 &&
- Platform.getPreferencesService().getBoolean(GdbPlugin.PLUGIN_ID,
- IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB,
- true, null)) {
- // If the last process we are debugging finishes and does not restart
- // let's terminate GDB. We wait a small delay to see if the process will restart.
- // We also do this for a remote attach session, since the 'auto terminate' preference
- // is enabled. If users want to keep the session alive to attach to another process,
- // they can simply disable that preference
- getExecutor().schedule(new DsfRunnable() {
- @Override
- public void run() {
- // Verify the process didn't restart by checking that we still have nothing connected
- if (fNumConnected == 0) {
- fCommandControl.terminate(new ImmediateRequestMonitor());
- }
- }
- }, 500, TimeUnit.MILLISECONDS);
- }
- } else {
- fThreadCommandCache.reset();
- }
- }
-
- /**
+ // The process in question is restarting.
+ handleRestartingProcess((IMIContainerDMContext) e.getDMContext());
+ }
+
+ fContainerCommandCache.reset();
+ fNumConnected++;
+ } else {
+ fThreadCommandCache.reset();
+ }
+ }
+
+ // Event handler when a thread or a threadGroup exits
+ @DsfServiceEventHandler
+ public void eventDispatched(IExitedDMEvent e) {
+ if (e.getDMContext() instanceof IMIContainerDMContext) {
+ fExitedGroupId.add(((IMIContainerDMContext) e.getDMContext()).getGroupId());
+
+ fContainerCommandCache.reset();
+
+ assert fNumConnected > 0;
+ fNumConnected--;
+
+ if (fNumConnected == 0 && Platform.getPreferencesService().getBoolean(GdbPlugin.PLUGIN_ID,
+ IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, true, null)) {
+ // If the last process we are debugging finishes and does not restart
+ // let's terminate GDB. We wait a small delay to see if the process will restart.
+ // We also do this for a remote attach session, since the 'auto terminate' preference
+ // is enabled. If users want to keep the session alive to attach to another process,
+ // they can simply disable that preference
+ getExecutor().schedule(new DsfRunnable() {
+ @Override
+ public void run() {
+ // Verify the process didn't restart by checking that we still have nothing connected
+ if (fNumConnected == 0) {
+ fCommandControl.terminate(new ImmediateRequestMonitor());
+ }
+ }
+ }, 500, TimeUnit.MILLISECONDS);
+ }
+ } else {
+ fThreadCommandCache.reset();
+ }
+ }
+
+ /**
* @since 5.2
*/
- @DsfServiceEventHandler
- public void eventDispatched(ICommandControlShutdownDMEvent e) {
- // Now that the debug session is over, close the persistent PTY streams
- for (PTY pty : fGroupIdToPTYMap.values()) {
- if (pty instanceof PersistentPTY) {
- try {
- ((PersistentPTY)pty).closeStreams();
+ @DsfServiceEventHandler
+ public void eventDispatched(ICommandControlShutdownDMEvent e) {
+ // Now that the debug session is over, close the persistent PTY streams
+ for (PTY pty : fGroupIdToPTYMap.values()) {
+ if (pty instanceof PersistentPTY) {
+ try {
+ ((PersistentPTY) pty).closeStreams();
} catch (IOException e1) {
}
- }
- }
- fGroupIdToPTYMap.clear();
-
- fExitedGroupId.clear();
- }
-
- @Override
+ }
+ }
+ fGroupIdToPTYMap.clear();
+
+ fExitedGroupId.clear();
+ }
+
+ @Override
public void flushCache(IDMContext context) {
fContainerCommandCache.reset(context);
fThreadCommandCache.reset(context);
@@ -2008,69 +2046,69 @@ public class GDBProcesses_7_0 extends AbstractDsfService
/*
* Catch =thread-created/exited and =thread-group-exited events to update our
- * groupId to threadId map.
+ * groupId to threadId map.
*/
@Override
public void eventReceived(Object output) {
- for (MIOOBRecord oobr : ((MIOutput)output).getMIOOBRecords()) {
+ for (MIOOBRecord oobr : ((MIOutput) output).getMIOOBRecords()) {
if (oobr instanceof MINotifyAsyncOutput) {
- MINotifyAsyncOutput exec = (MINotifyAsyncOutput) oobr;
- String miEvent = exec.getAsyncClass();
- if ("thread-created".equals(miEvent) || "thread-exited".equals(miEvent)) { //$NON-NLS-1$ //$NON-NLS-2$
- String threadId = null;
- String groupId = null;
-
- MIResult[] results = exec.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- MIValue val = results[i].getMIValue();
- if (var.equals("group-id")) { //$NON-NLS-1$
- if (val instanceof MIConst) {
- groupId = ((MIConst) val).getString();
- }
- } else if (var.equals("id")) { //$NON-NLS-1$
- if (val instanceof MIConst) {
- threadId = ((MIConst) val).getString();
- }
- }
- }
-
- if ("thread-created".equals(miEvent)) { //$NON-NLS-1$
- // Update the thread to groupId map with the new groupId
- getThreadToGroupMap().put(threadId, groupId);
- } else {
- getThreadToGroupMap().remove(threadId);
- }
- // "thread-group-created" was used before GDB 7.2, while "thread-group-started" is used with GDB 7.2
- } else if ("thread-group-created".equals(miEvent) || "thread-group-started".equals(miEvent)) { //$NON-NLS-1$ //$NON-NLS-2$
- String groupId = null;
- String pId = null;
-
- MIResult[] results = exec.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- MIValue val = results[i].getMIValue();
- if (var.equals("id")) { //$NON-NLS-1$
- if (val instanceof MIConst) {
- groupId = ((MIConst) val).getString().trim();
- }
- } else if (var.equals("pid")) { //$NON-NLS-1$
- // Available starting with GDB 7.2
- if (val instanceof MIConst) {
- pId = ((MIConst) val).getString().trim();
- }
- }
- }
-
- if (pId == null) {
- // Before GDB 7.2, the groupId was the pid of the process
- pId = groupId;
- }
-
- if (groupId != null) {
+ MINotifyAsyncOutput exec = (MINotifyAsyncOutput) oobr;
+ String miEvent = exec.getAsyncClass();
+ if ("thread-created".equals(miEvent) || "thread-exited".equals(miEvent)) { //$NON-NLS-1$ //$NON-NLS-2$
+ String threadId = null;
+ String groupId = null;
+
+ MIResult[] results = exec.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ MIValue val = results[i].getMIValue();
+ if (var.equals("group-id")) { //$NON-NLS-1$
+ if (val instanceof MIConst) {
+ groupId = ((MIConst) val).getString();
+ }
+ } else if (var.equals("id")) { //$NON-NLS-1$
+ if (val instanceof MIConst) {
+ threadId = ((MIConst) val).getString();
+ }
+ }
+ }
+
+ if ("thread-created".equals(miEvent)) { //$NON-NLS-1$
+ // Update the thread to groupId map with the new groupId
+ getThreadToGroupMap().put(threadId, groupId);
+ } else {
+ getThreadToGroupMap().remove(threadId);
+ }
+ // "thread-group-created" was used before GDB 7.2, while "thread-group-started" is used with GDB 7.2
+ } else if ("thread-group-created".equals(miEvent) || "thread-group-started".equals(miEvent)) { //$NON-NLS-1$ //$NON-NLS-2$
+ String groupId = null;
+ String pId = null;
+
+ MIResult[] results = exec.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ MIValue val = results[i].getMIValue();
+ if (var.equals("id")) { //$NON-NLS-1$
+ if (val instanceof MIConst) {
+ groupId = ((MIConst) val).getString().trim();
+ }
+ } else if (var.equals("pid")) { //$NON-NLS-1$
+ // Available starting with GDB 7.2
+ if (val instanceof MIConst) {
+ pId = ((MIConst) val).getString().trim();
+ }
+ }
+ }
+
+ if (pId == null) {
+ // Before GDB 7.2, the groupId was the pid of the process
+ pId = groupId;
+ }
+
+ if (groupId != null) {
// In case the process that just started was already exited (so we are dealing
- // with a restart), remove it from our list.
- // Do this here to handle the restart case triggered by GDB itself
+ // with a restart), remove it from our list.
+ // Do this here to handle the restart case triggered by GDB itself
// (user typing 'run' from the GDB console). In this case, we don't know yet
// we are dealing with a restart, but when we see the process come back, we
// know to remove it from the exited list. Note that this won't work
@@ -2078,51 +2116,51 @@ public class GDBProcesses_7_0 extends AbstractDsfService
// one. Not worth fixing for such an old version.
getExitedProcesses().remove(groupId);
- getGroupToPidMap().put(groupId, pId);
-
- // Mark that we know this new process, but don't fetch its
- // name until it is requested.
- fDebuggedProcessesAndNames.put(pId, ""); //$NON-NLS-1$
- }
- } else if ("thread-group-exited".equals(miEvent)) { //$NON-NLS-1$
- String groupId = null;
-
- MIResult[] results = exec.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- MIValue val = results[i].getMIValue();
- if (var.equals("id")) { //$NON-NLS-1$
- if (val instanceof MIConst) {
- groupId = ((MIConst) val).getString().trim();
- }
- }
- }
-
- if (groupId != null) {
- String pId = getGroupToPidMap().remove(groupId);
-
- // GDB is no longer debugging this process. Remove it from our list
- String name = fDebuggedProcessesAndNames.remove(pId);
- if (!getDetachedProcesses().remove(groupId)) {
- // If the process was not detached,
- // store it in the list of exited processes.
- getExitedProcesses().put(groupId, new ExitedProcInfo(pId, name));
- }
-
- // Remove any entries for that group from our thread to group map
- // When detaching from a group, we won't have received any thread-exited event
- // but we don't want to keep those entries.
- if (getThreadToGroupMap().containsValue(groupId)) {
- Iterator<Map.Entry<String, String>> iterator = getThreadToGroupMap().entrySet().iterator();
- while (iterator.hasNext()){
- if (iterator.next().getValue().equals(groupId)) {
- iterator.remove();
- }
- }
- }
- }
- }
- }
- }
+ getGroupToPidMap().put(groupId, pId);
+
+ // Mark that we know this new process, but don't fetch its
+ // name until it is requested.
+ fDebuggedProcessesAndNames.put(pId, ""); //$NON-NLS-1$
+ }
+ } else if ("thread-group-exited".equals(miEvent)) { //$NON-NLS-1$
+ String groupId = null;
+
+ MIResult[] results = exec.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ MIValue val = results[i].getMIValue();
+ if (var.equals("id")) { //$NON-NLS-1$
+ if (val instanceof MIConst) {
+ groupId = ((MIConst) val).getString().trim();
+ }
+ }
+ }
+
+ if (groupId != null) {
+ String pId = getGroupToPidMap().remove(groupId);
+
+ // GDB is no longer debugging this process. Remove it from our list
+ String name = fDebuggedProcessesAndNames.remove(pId);
+ if (!getDetachedProcesses().remove(groupId)) {
+ // If the process was not detached,
+ // store it in the list of exited processes.
+ getExitedProcesses().put(groupId, new ExitedProcInfo(pId, name));
+ }
+
+ // Remove any entries for that group from our thread to group map
+ // When detaching from a group, we won't have received any thread-exited event
+ // but we don't want to keep those entries.
+ if (getThreadToGroupMap().containsValue(groupId)) {
+ Iterator<Map.Entry<String, String>> iterator = getThreadToGroupMap().entrySet().iterator();
+ while (iterator.hasNext()) {
+ if (iterator.next().getValue().equals(groupId)) {
+ iterator.remove();
+ }
+ }
+ }
+ }
+ }
+ }
+ }
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_1.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_1.java
index e3eaa2d0ae5..abfaa3f0da3 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_1.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_1.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
* Andy Jin (QNX) - Not output thread osId as a string when it is null (Bug 397039)
@@ -50,7 +50,7 @@ import org.eclipse.core.runtime.Status;
/**
* This class implements the IProcesses interface for GDB 7.1
* which provides new information about cores for threads and processes.
- *
+ *
* @since 4.0
*/
public class GDBProcesses_7_1 extends GDBProcesses_7_0 {
@@ -65,18 +65,22 @@ public class GDBProcesses_7_1 extends GDBProcesses_7_0 {
}
@Override
- public String[] getCores() { return fCores; }
+ public String[] getCores() {
+ return fCores;
+ }
@Override
- public String getOwner() { return null; }
+ public String getOwner() {
+ return null;
+ }
}
- private CommandFactory fCommandFactory;
- // This cache is used when we send command to get the cores.
- // The value of the cores can change at any time, but we provide
- // an updated value whenever there is a suspended event.
- private CommandCache fCommandForCoresCache;
- private IGDBControl fCommandControl;
+ private CommandFactory fCommandFactory;
+ // This cache is used when we send command to get the cores.
+ // The value of the cores can change at any time, but we provide
+ // an updated value whenever there is a suspended event.
+ private CommandCache fCommandForCoresCache;
+ private IGDBControl fCommandControl;
public GDBProcesses_7_1(DsfSession session) {
super(session);
@@ -95,7 +99,7 @@ public class GDBProcesses_7_1 extends GDBProcesses_7_0 {
/**
* 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.
@@ -111,19 +115,19 @@ public class GDBProcesses_7_1 extends GDBProcesses_7_0 {
// To solve this, we use a bufferedCommandControl that will delay the command
// result by two scheduling of the executor.
// See bug 280461
- fCommandForCoresCache = new CommandCache(getSession(),
- new BufferedCommandControl(fCommandControl, getExecutor(), 2));
- fCommandForCoresCache.setContextAvailable(fCommandControl.getContext(), true);
+ fCommandForCoresCache = new CommandCache(getSession(),
+ new BufferedCommandControl(fCommandControl, getExecutor(), 2));
+ fCommandForCoresCache.setContextAvailable(fCommandControl.getContext(), true);
- fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
- getSession().addServiceEventListener(this, null);
+ fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
+ getSession().addServiceEventListener(this, null);
- requestMonitor.done();
+ requestMonitor.done();
}
@Override
public void shutdown(RequestMonitor requestMonitor) {
- getSession().removeServiceEventListener(this);
+ getSession().removeServiceEventListener(this);
super.shutdown(requestMonitor);
}
@@ -145,12 +149,12 @@ public class GDBProcesses_7_1 extends GDBProcesses_7_0 {
rm.done(firstLevelData);
return;
}
-
- ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
- final String groupId = getGroupFromPid(((IMIProcessDMContext)dmc).getProcId());
- fCommandForCoresCache.execute(
- fCommandFactory.createMIListThreadGroups(controlDmc),
+ ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc,
+ ICommandControlDMContext.class);
+ final String groupId = getGroupFromPid(((IMIProcessDMContext) dmc).getProcId());
+
+ fCommandForCoresCache.execute(fCommandFactory.createMIListThreadGroups(controlDmc),
new ImmediateDataRequestMonitor<MIListThreadGroupsInfo>(rm) {
@Override
protected void handleCompleted() {
@@ -166,46 +170,46 @@ public class GDBProcesses_7_1 extends GDBProcesses_7_0 {
}
}
}
- rm.setData(new MIThreadDMData_7_1(firstLevelData.getName(),
- firstLevelData.getId(),
- cores));
- rm.done();
+ rm.setData(new MIThreadDMData_7_1(firstLevelData.getName(), firstLevelData.getId(),
+ cores));
+ rm.done();
}
});
- }
+ }
});
} else if (dmc instanceof MIThreadDMC) {
// Starting with GDB 7.1, we can obtain the core on which a thread
// is currently located. The info is a new field in -thread-info
- final MIThreadDMC threadDmc = (MIThreadDMC)dmc;
+ final MIThreadDMC threadDmc = (MIThreadDMC) dmc;
ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
fCommandForCoresCache.execute(fCommandFactory.createMIThreadInfo(controlDmc, threadDmc.getId()),
new ImmediateDataRequestMonitor<MIThreadInfoInfo>(rm) {
- @Override
- protected void handleSuccess() {
- IThreadDMData threadData = null;
- if (getData().getThreadList().length != 0) {
- MIThread thread = getData().getThreadList()[0];
- if (thread.getThreadId().equals(threadDmc.getId())) {
- threadData = createThreadDMData(thread);
- }
- }
+ @Override
+ protected void handleSuccess() {
+ IThreadDMData threadData = null;
+ if (getData().getThreadList().length != 0) {
+ MIThread thread = getData().getThreadList()[0];
+ if (thread.getThreadId().equals(threadDmc.getId())) {
+ threadData = createThreadDMData(thread);
+ }
+ }
- if (threadData != null) {
- rm.setData(threadData);
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Could not get thread info", null)); //$NON-NLS-1$
- }
- rm.done();
- }
- });
+ if (threadData != null) {
+ rm.setData(threadData);
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE,
+ "Could not get thread info", null)); //$NON-NLS-1$
+ }
+ rm.done();
+ }
+ });
} else {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid DMC type", null)); //$NON-NLS-1$
rm.done();
}
}
-
+
/**
* @since 4.6
*/
@@ -219,17 +223,19 @@ public class GDBProcesses_7_1 extends GDBProcesses_7_0 {
// as for GDB 6.x with CLIInfoThreadsInfo#getOsId()
final String details = thread.getDetails();
if (details != null && !details.isEmpty()) {
- if (!id.isEmpty()) id += " "; //$NON-NLS-1$
+ if (!id.isEmpty())
+ id += " "; //$NON-NLS-1$
id += "(" + details + ")"; //$NON-NLS-1$ //$NON-NLS-2$
}
// We must indicate and empty id by using null
- if (id.isEmpty()) id = null;
+ if (id.isEmpty())
+ id = null;
String name = thread.getName();
String core = thread.getCore();
return new MIThreadDMData_7_1(name == null ? "" : name, id, core == null ? null : new String[] { core }); //$NON-NLS-1$
}
-
+
@DsfServiceEventHandler
public void eventDispatched_7_1(IResumedDMEvent e) {
if (e instanceof IContainerResumedDMEvent) {
@@ -243,32 +249,32 @@ public class GDBProcesses_7_1 extends GDBProcesses_7_0 {
// Something has suspended, core allocation could have changed
// during the time it was running.
- @DsfServiceEventHandler
- public void eventDispatched_7_1(ISuspendedDMEvent e) {
- if (e instanceof IContainerSuspendedDMEvent) {
- // This will happen in all-stop mode
- fCommandForCoresCache.setContextAvailable(fCommandControl.getContext(), true);
- } else {
- // This will happen in non-stop mode
- }
-
- fCommandForCoresCache.reset();
- }
-
- // Event handler when a thread or threadGroup starts, core allocation
- // could have changed
- @DsfServiceEventHandler
- public void eventDispatched_7_1(IStartedDMEvent e) {
- fCommandForCoresCache.reset();
+ @DsfServiceEventHandler
+ public void eventDispatched_7_1(ISuspendedDMEvent e) {
+ if (e instanceof IContainerSuspendedDMEvent) {
+ // This will happen in all-stop mode
+ fCommandForCoresCache.setContextAvailable(fCommandControl.getContext(), true);
+ } else {
+ // This will happen in non-stop mode
+ }
+
+ fCommandForCoresCache.reset();
}
-
- // Event handler when a thread or a threadGroup exits, core allocation
- // could have changed
- @DsfServiceEventHandler
- public void eventDispatched_7_1(IExitedDMEvent e) {
- fCommandForCoresCache.reset();
- }
-
+
+ // Event handler when a thread or threadGroup starts, core allocation
+ // could have changed
+ @DsfServiceEventHandler
+ public void eventDispatched_7_1(IStartedDMEvent e) {
+ fCommandForCoresCache.reset();
+ }
+
+ // Event handler when a thread or a threadGroup exits, core allocation
+ // could have changed
+ @DsfServiceEventHandler
+ public void eventDispatched_7_1(IExitedDMEvent e) {
+ fCommandForCoresCache.reset();
+ }
+
@Override
public void flushCache(IDMContext context) {
fCommandForCoresCache.reset(context);
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_10.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_10.java
index 53d1242e648..138ee09d2d0 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_10.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_10.java
@@ -40,67 +40,69 @@ import org.eclipse.debug.core.ILaunch;
*/
public class GDBProcesses_7_10 extends GDBProcesses_7_4 {
- public GDBProcesses_7_10(DsfSession session) {
- super(session);
- }
-
- @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);
- }
+ public GDBProcesses_7_10(DsfSession session) {
+ super(session);
+ }
- @Override
- protected void doReverseDebugStep(IProcessDMContext procCtx, RequestMonitor rm) {
- // Select reverse debugging mode to what was enabled as a launch option
- IReverseRunControl2 reverseService = getServicesTracker().getService(IReverseRunControl2.class);
- if (reverseService != null) {
- ILaunch launch = procCtx.getAdapter(ILaunch.class);
- if (launch != null) {
- try {
- boolean reverseEnabled =
- launch.getLaunchConfiguration().getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE,
- IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_DEFAULT);
+ @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
+ protected void doReverseDebugStep(IProcessDMContext procCtx, RequestMonitor rm) {
+ // Select reverse debugging mode to what was enabled as a launch option
+ IReverseRunControl2 reverseService = getServicesTracker().getService(IReverseRunControl2.class);
+ if (reverseService != null) {
+ ILaunch launch = procCtx.getAdapter(ILaunch.class);
+ if (launch != null) {
+ try {
+ 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);
+ 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)) {
+ } 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)) {
+ 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)) {
+ } 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(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();
- }
- } else {
+ } catch (CoreException e) {
+ // Ignore, just don't set reverse method
+ rm.done();
+ }
+ } else {
// Ignore, just don't set reverse method
- rm.done();
- }
- } else {
- // If we don't have an IReverseRunControl2 service, fall-back to our previous behavior
- super.doReverseDebugStep(procCtx, rm);
- }
- }
+ rm.done();
+ }
+ } else {
+ // If we don't have an IReverseRunControl2 service, fall-back to our previous behavior
+ super.doReverseDebugStep(procCtx, rm);
+ }
+ }
}
-
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_12.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_12.java
index 377c1ccb8e6..ce585b07ce8 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_12.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_12.java
@@ -39,9 +39,8 @@ public class GDBProcesses_7_12 extends GDBProcesses_7_11 {
}
@Override
- protected Sequence getStartOrRestartProcessSequence(DsfExecutor executor,
- IContainerDMContext containerDmc, Map<String, Object> attributes, boolean restart,
- DataRequestMonitor<IContainerDMContext> rm) {
+ protected Sequence getStartOrRestartProcessSequence(DsfExecutor executor, IContainerDMContext containerDmc,
+ Map<String, Object> attributes, boolean restart, DataRequestMonitor<IContainerDMContext> rm) {
return new StartOrRestartProcessSequence_7_12(executor, containerDmc, attributes, restart, rm);
}
@@ -59,36 +58,35 @@ public class GDBProcesses_7_12 extends GDBProcesses_7_11 {
// to get the prompt back, and only then kill the process.
// https://sourceware.org/bugzilla/show_bug.cgi?id=20766
if (thread instanceof IMIProcessDMContext) {
- getDebuggingContext(
- thread,
- new ImmediateDataRequestMonitor<IDMContext>(rm) {
- @Override
- protected void handleSuccess() {
- if (getData() instanceof IMIContainerDMContext) {
- IMIContainerDMContext containerDmc = (IMIContainerDMContext)getData();
- IMIRunControl runControl = getServicesTracker().getService(IMIRunControl.class);
- if (runControl != null && !runControl.isSuspended(containerDmc)) {
- runControl.suspend(containerDmc, new ImmediateRequestMonitor(rm) {
- @Override
- protected void handleCompleted() {
- GDBProcesses_7_12.super.terminate(thread, rm);
- }
- });
- } else {
- GDBProcesses_7_12.super.terminate(thread, rm);
- }
+ getDebuggingContext(thread, new ImmediateDataRequestMonitor<IDMContext>(rm) {
+ @Override
+ protected void handleSuccess() {
+ if (getData() instanceof IMIContainerDMContext) {
+ IMIContainerDMContext containerDmc = (IMIContainerDMContext) getData();
+ IMIRunControl runControl = getServicesTracker().getService(IMIRunControl.class);
+ if (runControl != null && !runControl.isSuspended(containerDmc)) {
+ runControl.suspend(containerDmc, new ImmediateRequestMonitor(rm) {
+ @Override
+ protected void handleCompleted() {
+ GDBProcesses_7_12.super.terminate(thread, rm);
+ }
+ });
} else {
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid process context.", null)); //$NON-NLS-1$
+ GDBProcesses_7_12.super.terminate(thread, rm);
}
+ } else {
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR,
+ "Invalid process context.", null)); //$NON-NLS-1$
}
- });
+ }
+ });
} else {
super.terminate(thread, rm);
}
}
-
+
@Override
- public void detachDebuggerFromProcess(IDMContext dmc, RequestMonitor rm) {
+ public void detachDebuggerFromProcess(IDMContext dmc, RequestMonitor rm) {
if (DMContexts.getAncestorOfType(dmc, MIExitedProcessDMC.class) != null) {
super.detachDebuggerFromProcess(dmc, rm);
return;
@@ -119,9 +117,9 @@ public class GDBProcesses_7_12 extends GDBProcesses_7_11 {
GDBProcesses_7_12.super.detachDebuggerFromProcess(dmc, rm);
}
});
- } else {
+ } else {
super.detachDebuggerFromProcess(dmc, rm);
- }
+ }
}
/**
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java
index f2ee007747e..0fb2509259b 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Onur Akdemir (TUBITAK BILGEM-ITI) - Multi-process debugging (Bug 237306)
* Marc Khouzam (Ericsson) - Workaround for Bug 352998
@@ -72,18 +72,19 @@ import com.ibm.icu.text.MessageFormat;
/**
* Adding support for multi-process with GDB 7.2
- *
+ *
* @since 4.0
*/
public class GDBProcesses_7_2 extends GDBProcesses_7_1 implements IMultiTerminate, IMultiDetach {
abstract private class ConditionalRequestMonitor extends ImmediateDataRequestMonitor<Boolean> {
- private Iterator<? extends IDMContext> fIterator;
- private boolean fAll = true;
- private DataRequestMonitor<Boolean> fParentMonitor;
+ private Iterator<? extends IDMContext> fIterator;
+ private boolean fAll = true;
+ private DataRequestMonitor<Boolean> fParentMonitor;
- private ConditionalRequestMonitor(Iterator<? extends IDMContext> it, boolean all, DataRequestMonitor<Boolean> parentMonitor) {
+ private ConditionalRequestMonitor(Iterator<? extends IDMContext> it, boolean all,
+ DataRequestMonitor<Boolean> parentMonitor) {
super(parentMonitor);
fAll = all;
fParentMonitor = parentMonitor;
@@ -91,7 +92,7 @@ public class GDBProcesses_7_2 extends GDBProcesses_7_1 implements IMultiTerminat
}
@Override
- protected void handleCompleted() {
+ protected void handleCompleted() {
if (!isSuccess()) {
fParentMonitor.setStatus(getStatus());
fParentMonitor.done();
@@ -101,27 +102,28 @@ public class GDBProcesses_7_2 extends GDBProcesses_7_1 implements IMultiTerminat
if (getData() != fAll) {
fParentMonitor.setData(getData());
fParentMonitor.done();
- }
- else if (!fIterator.hasNext()) {
+ } else if (!fIterator.hasNext()) {
fParentMonitor.setData(fAll);
fParentMonitor.done();
- }
- else {
+ } else {
proceed(fIterator, fAll, fParentMonitor);
}
- }
-
- abstract protected void proceed(Iterator<? extends IDMContext> it, boolean all, DataRequestMonitor<Boolean> parentMonitor);
+ }
+
+ abstract protected void proceed(Iterator<? extends IDMContext> it, boolean all,
+ DataRequestMonitor<Boolean> parentMonitor);
}
-
- private class CanDetachRequestMonitor extends ConditionalRequestMonitor {
- private CanDetachRequestMonitor(Iterator<? extends IDMContext> it, boolean all, DataRequestMonitor<Boolean> parentMonitor) {
+ private class CanDetachRequestMonitor extends ConditionalRequestMonitor {
+
+ private CanDetachRequestMonitor(Iterator<? extends IDMContext> it, boolean all,
+ DataRequestMonitor<Boolean> parentMonitor) {
super(it, all, parentMonitor);
}
@Override
- protected void proceed(Iterator<? extends IDMContext> it, boolean all, DataRequestMonitor<Boolean> parentMonitor) {
+ protected void proceed(Iterator<? extends IDMContext> it, boolean all,
+ DataRequestMonitor<Boolean> parentMonitor) {
canDetachDebuggerFromProcess(it.next(), new CanDetachRequestMonitor(it, all, parentMonitor));
}
@@ -129,13 +131,15 @@ public class GDBProcesses_7_2 extends GDBProcesses_7_1 implements IMultiTerminat
private class CanTerminateRequestMonitor extends ConditionalRequestMonitor {
- private CanTerminateRequestMonitor(Iterator<? extends IDMContext> it, boolean all, DataRequestMonitor<Boolean> parentMonitor) {
+ private CanTerminateRequestMonitor(Iterator<? extends IDMContext> it, boolean all,
+ DataRequestMonitor<Boolean> parentMonitor) {
super(it, all, parentMonitor);
}
@Override
- protected void proceed(Iterator<? extends IDMContext> it, boolean all, DataRequestMonitor<Boolean> parentMonitor) {
- canTerminate((IThreadDMContext)it.next(), new CanTerminateRequestMonitor(it, all, parentMonitor));
+ protected void proceed(Iterator<? extends IDMContext> it, boolean all,
+ DataRequestMonitor<Boolean> parentMonitor) {
+ canTerminate((IThreadDMContext) it.next(), new CanTerminateRequestMonitor(it, all, parentMonitor));
}
}
@@ -144,48 +148,47 @@ public class GDBProcesses_7_2 extends GDBProcesses_7_1 implements IMultiTerminat
* @since 5.1
*/
protected static class ContainerCreatedDMEvent extends AbstractDMEvent<IExecutionDMContext>
- implements ICreatedDMEvent
- {
+ implements ICreatedDMEvent {
public ContainerCreatedDMEvent(IContainerDMContext context) {
super(context);
}
}
- /**
+ /**
* The first thread-group id used by GDB.
* GDB starts up with certain things already setup, and we need
* to prepare some things using this id.
* @since 5.1
*/
public static final String INITIAL_THREAD_GROUP_ID = "i1"; //$NON-NLS-1$
-
+
/**
- * The id of the single thread to be used during event visualization.
- * @since 4.1
- */
- protected static final String TRACE_VISUALIZATION_THREAD_ID = "1"; //$NON-NLS-1$
+ * The id of the single thread to be used during event visualization.
+ * @since 4.1
+ */
+ protected static final String TRACE_VISUALIZATION_THREAD_ID = "1"; //$NON-NLS-1$
- private CommandFactory fCommandFactory;
- private IGDBControl fCommandControl;
- private IGDBBackend fBackend;
+ private CommandFactory fCommandFactory;
+ private IGDBControl fCommandControl;
+ private IGDBBackend fBackend;
+
+ private final static String INVALID = "invalid"; //$NON-NLS-1$
- private final static String INVALID = "invalid"; //$NON-NLS-1$
-
/**
* Keep track if we need to reconnect to the target
* due to a workaround because of a GDB 7.2 bug.
* Bug 352998
*/
private boolean fNeedToReconnect;
-
- /**
- * Set of processes that are currently being restarted.
- * We use this set for such things as not removing breakpoints
- * because we know the process will be restarted.
- */
+
+ /**
+ * Set of processes that are currently being restarted.
+ * We use this set for such things as not removing breakpoints
+ * because we know the process will be restarted.
+ */
private Set<IContainerDMContext> fProcRestarting = new HashSet<IContainerDMContext>();
- /**
+ /**
* Indicates that we are currently visualizing trace data.
*/
private boolean fTraceVisualization;
@@ -207,32 +210,34 @@ public class GDBProcesses_7_2 extends GDBProcesses_7_1 implements IMultiTerminat
/**
* 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>());
+ register(new String[] { IMultiDetach.class.getName(), IMultiTerminate.class.getName() },
+ new Hashtable<String, String>());
fCommandControl = getServicesTracker().getService(IGDBControl.class);
- fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
- fBackend = getServicesTracker().getService(IGDBBackend.class);
-
- // We know we missed the very first =thread-group-added event
+ fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
+ fBackend = getServicesTracker().getService(IGDBBackend.class);
+
+ // We know we missed the very first =thread-group-added event
// because GDB sends it as soon as it starts, but we are not
// ready to receive it at that time. We send it now instead.
- IMIContainerDMContext initialContainer = createContainerContextFromGroupId(fCommandControl.getContext(), INITIAL_THREAD_GROUP_ID);
- getSession().dispatchEvent(new ContainerCreatedDMEvent(initialContainer), getProperties());
+ IMIContainerDMContext initialContainer = createContainerContextFromGroupId(fCommandControl.getContext(),
+ INITIAL_THREAD_GROUP_ID);
+ getSession().dispatchEvent(new ContainerCreatedDMEvent(initialContainer), getProperties());
- requestMonitor.done();
+ requestMonitor.done();
}
@Override
public void shutdown(RequestMonitor requestMonitor) {
super.shutdown(requestMonitor);
}
-
+
/** @since 4.1 */
protected boolean getTraceVisualization() {
return fTraceVisualization;
@@ -242,19 +247,20 @@ public class GDBProcesses_7_2 extends GDBProcesses_7_1 implements IMultiTerminat
protected void setTraceVisualization(boolean visualizing) {
fTraceVisualization = visualizing;
}
-
+
+ @Override
+ public IMIContainerDMContext createContainerContextFromGroupId(ICommandControlDMContext controlDmc,
+ String groupId) {
+ String pid = getGroupToPidMap().get(groupId);
+ if (pid == null) {
+ // For GDB 7.2, the groupId is no longer the pid, so use our wildcard pid instead
+ pid = MIProcesses.UNKNOWN_PROCESS_ID;
+ }
+ IProcessDMContext processDmc = createProcessContext(controlDmc, pid);
+ return createContainerContext(processDmc, groupId);
+ }
+
@Override
- public IMIContainerDMContext createContainerContextFromGroupId(ICommandControlDMContext controlDmc, String groupId) {
- String pid = getGroupToPidMap().get(groupId);
- if (pid == null) {
- // For GDB 7.2, the groupId is no longer the pid, so use our wildcard pid instead
- pid = MIProcesses.UNKNOWN_PROCESS_ID;
- }
- IProcessDMContext processDmc = createProcessContext(controlDmc, pid);
- return createContainerContext(processDmc, groupId);
- }
-
- @Override
protected boolean doIsDebuggerAttachSupported() {
// Multi-process is not applicable to post-mortem sessions (core)
// or to non-attach remote sessions.
@@ -265,7 +271,7 @@ public class GDBProcesses_7_2 extends GDBProcesses_7_1 implements IMultiTerminat
if (fBackend.getSessionType() == SessionType.REMOTE && !fBackend.getIsAttachSession()) {
return false;
}
-
+
// Multi-process does not work for all-stop right now
IMIRunControl runControl = getServicesTracker().getService(IMIRunControl.class);
if (runControl != null && runControl.getRunMode() == MIRunMode.ALL_STOP) {
@@ -279,15 +285,16 @@ public class GDBProcesses_7_2 extends GDBProcesses_7_1 implements IMultiTerminat
}
@Override
- public void attachDebuggerToProcess(IProcessDMContext procCtx, DataRequestMonitor<IDMContext> rm) {
+ public void attachDebuggerToProcess(IProcessDMContext procCtx, DataRequestMonitor<IDMContext> rm) {
attachDebuggerToProcess(procCtx, null, rm);
}
-
- /**
+
+ /**
* @since 4.0
*/
@Override
- public void attachDebuggerToProcess(final IProcessDMContext procCtx, final String binaryPath, final DataRequestMonitor<IDMContext> dataRm) {
+ public void attachDebuggerToProcess(final IProcessDMContext procCtx, final String binaryPath,
+ final DataRequestMonitor<IDMContext> dataRm) {
if (procCtx instanceof IMIProcessDMContext) {
if (!doIsDebuggerAttachSupported()) {
dataRm.setStatus(
@@ -296,12 +303,12 @@ public class GDBProcesses_7_2 extends GDBProcesses_7_1 implements IMultiTerminat
return;
}
- // Use a sequence for better control of each step
- ImmediateExecutor.getInstance().execute(new Sequence(getExecutor(), dataRm) {
- private IMIContainerDMContext fContainerDmc;
+ // Use a sequence for better control of each step
+ ImmediateExecutor.getInstance().execute(new Sequence(getExecutor(), dataRm) {
+ private IMIContainerDMContext fContainerDmc;
- private Step[] steps = new Step[] {
- // first check if requested process is already targetted
+ private Step[] steps = new Step[] {
+ // first check if requested process is already targetted
new Step() {
@Override
public void execute(final RequestMonitor rm) {
@@ -334,116 +341,116 @@ public class GDBProcesses_7_2 extends GDBProcesses_7_1 implements IMultiTerminat
}
},
- // 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, INITIAL_THREAD_GROUP_ID);
- 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) {
- // Because of a GDB 7.2 bug, for remote-attach sessions,
- // we need to be disconnected from the target
- // when we set the very first binary to be used.
- // So, lets disconnect.
- // Bug 352998
- if (needFixForGDB72Bug352998()) {
- // The bug only applies to remote sessions
- if (fBackend.getSessionType() == SessionType.REMOTE) {
- assert fBackend.getIsAttachSession();
- assert binaryPath != null;
-
- // We only need the workaround for the very first process we attach to
- if (isInitialProcess()) {
- ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(procCtx, ICommandControlDMContext.class);
- fCommandControl.queueCommand(
- fCommandFactory.createMITargetDisconnect(controlDmc),
- new ImmediateDataRequestMonitor<MIInfo>(rm) {
- @Override
- protected void handleSuccess() {
- fNeedToReconnect = true;
- rm.done();
- }
- });
- return;
- }
- }
- }
-
- 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() {
- // Because of a GDB 7.2 bug, for remote-attach sessions,
- // we need to be disconnected from the target
- // when we set the very first binary to be used.
- // Now that we have disconnected and set the binary,
- // we may need to reconnect to the target.
- // If we were unable to set the binary (e.g., if the specified path
- // is invalid) we also need to reconnect to the target before
- // aborting the rest of the sequence.
- // Bug 352998
-
- if (fNeedToReconnect) {
- fNeedToReconnect = false;
-
- // Set the status in case it is an error, so that when rm.done() is automatically
- // called, we continue to abort the sequence if we are dealing with a failure.
- rm.setStatus(getStatus());
-
- connectToTarget(procCtx, rm);
- } else {
- super.handleCompleted();
- }
- };
- });
- return;
- }
-
- assert fNeedToReconnect == false;
- 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;
+ // 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, INITIAL_THREAD_GROUP_ID);
+ 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) {
+ // Because of a GDB 7.2 bug, for remote-attach sessions,
+ // we need to be disconnected from the target
+ // when we set the very first binary to be used.
+ // So, lets disconnect.
+ // Bug 352998
+ if (needFixForGDB72Bug352998()) {
+ // The bug only applies to remote sessions
+ if (fBackend.getSessionType() == SessionType.REMOTE) {
+ assert fBackend.getIsAttachSession();
+ assert binaryPath != null;
+
+ // We only need the workaround for the very first process we attach to
+ if (isInitialProcess()) {
+ ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(procCtx,
+ ICommandControlDMContext.class);
+ fCommandControl.queueCommand(
+ fCommandFactory.createMITargetDisconnect(controlDmc),
+ new ImmediateDataRequestMonitor<MIInfo>(rm) {
+ @Override
+ protected void handleSuccess() {
+ fNeedToReconnect = true;
+ rm.done();
+ }
+ });
+ return;
+ }
+ }
+ }
+
+ 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() {
+ // Because of a GDB 7.2 bug, for remote-attach sessions,
+ // we need to be disconnected from the target
+ // when we set the very first binary to be used.
+ // Now that we have disconnected and set the binary,
+ // we may need to reconnect to the target.
+ // If we were unable to set the binary (e.g., if the specified path
+ // is invalid) we also need to reconnect to the target before
+ // aborting the rest of the sequence.
+ // Bug 352998
+
+ if (fNeedToReconnect) {
+ fNeedToReconnect = false;
+
+ // Set the status in case it is an error, so that when rm.done() is automatically
+ // called, we continue to abort the sequence if we are dealing with a failure.
+ rm.setStatus(getStatus());
+
+ connectToTarget(procCtx, rm);
+ } else {
+ super.handleCompleted();
+ }
+ };
+ });
+ return;
+ }
+
+ assert fNeedToReconnect == false;
+ 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;
@@ -452,67 +459,71 @@ public class GDBProcesses_7_2 extends GDBProcesses_7_1 implements IMultiTerminat
boolean extraNewline = targetAttachRequiresTrailingNewline();
ICommand<MIInfo> miTargetAttach = fCommandFactory.createMITargetAttach(fContainerDmc,
((IMIProcessDMContext) procCtx).getProcId(), shouldInterrupt, extraNewline);
- fCommandControl.queueCommand(
- miTargetAttach,
+ fCommandControl.queueCommand(miTargetAttach,
new ImmediateDataRequestMonitor<MIInfo>(rm));
}
- },
+ },
// Initialize memory data for this process.
- new Step() {
- @Override
- public void execute(RequestMonitor rm) {
+ new Step() {
+ @Override
+ public void execute(RequestMonitor rm) {
IGDBMemory memory = getServicesTracker().getService(IGDBMemory.class);
- IMemoryDMContext memContext = DMContexts.getAncestorOfType(fContainerDmc, IMemoryDMContext.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);
- }
- },
- // Turn on reverse debugging if it was enabled as a launch option
- new Step() {
- @Override
- public void execute(RequestMonitor rm) {
+ }
+ },
+ // Start tracking this process' breakpoints.
+ new Step() {
+ @Override
+ public void execute(RequestMonitor rm) {
+ MIBreakpointsManager bpmService = getServicesTracker()
+ .getService(MIBreakpointsManager.class);
+ bpmService.startTrackingBpForProcess(fContainerDmc, rm);
+ }
+ },
+ // Turn on reverse debugging if it was enabled as a launch option
+ new Step() {
+ @Override
+ public void execute(RequestMonitor rm) {
doReverseDebugStep(procCtx, rm);
- }
- },
- // 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) {
+ }
+ },
+ // 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);
+ 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();
- }
+ }
+ }, };
+
+ @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();
+ }
}
/**
* GDB 7.11 had a bug that -target-attach sometimes did not flush its error
* response. However sending a newline forced GDB to flush the buffer.
- *
+ *
* See Bug 522367
- *
+ *
* @return whether to add extra newline.
* @since 5.4
*/
@@ -527,45 +538,39 @@ public class GDBProcesses_7_2 extends GDBProcesses_7_1 implements IMultiTerminat
Map<String, Object> attributes = null;
try {
attributes = launch.getLaunchConfiguration().getAttributes();
- } catch (CoreException e) {}
+ } catch (CoreException e) {
+ }
- boolean isTcpConnection = CDebugUtils.getAttribute(
- attributes,
- IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP,
- false);
+ boolean isTcpConnection = CDebugUtils.getAttribute(attributes,
+ IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP, false);
if (isTcpConnection) {
- String remoteTcpHost = CDebugUtils.getAttribute(
- attributes,
- IGDBLaunchConfigurationConstants.ATTR_HOST, INVALID);
- String remoteTcpPort = CDebugUtils.getAttribute(
- attributes,
- IGDBLaunchConfigurationConstants.ATTR_PORT, INVALID);
+ String remoteTcpHost = CDebugUtils.getAttribute(attributes, IGDBLaunchConfigurationConstants.ATTR_HOST,
+ INVALID);
+ String remoteTcpPort = CDebugUtils.getAttribute(attributes, IGDBLaunchConfigurationConstants.ATTR_PORT,
+ INVALID);
- fCommandControl.queueCommand(
- fCommandFactory.createMITargetSelect(fCommandControl.getContext(),
- remoteTcpHost, remoteTcpPort, true),
- new ImmediateDataRequestMonitor<MIInfo>(rm));
+ fCommandControl.queueCommand(fCommandFactory.createMITargetSelect(fCommandControl.getContext(),
+ remoteTcpHost, remoteTcpPort, true), new ImmediateDataRequestMonitor<MIInfo>(rm));
} else {
- String serialDevice = CDebugUtils.getAttribute(
- attributes,
- IGDBLaunchConfigurationConstants.ATTR_DEV, INVALID);
+ String serialDevice = CDebugUtils.getAttribute(attributes, IGDBLaunchConfigurationConstants.ATTR_DEV,
+ INVALID);
fCommandControl.queueCommand(
- fCommandFactory.createMITargetSelect(fCommandControl.getContext(),
- serialDevice, true),
- new ImmediateDataRequestMonitor<MIInfo>(rm));
+ fCommandFactory.createMITargetSelect(fCommandControl.getContext(), serialDevice, true),
+ new ImmediateDataRequestMonitor<MIInfo>(rm));
}
} else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Cannot reconnect to target.", null)); //$NON-NLS-1$
- rm.done();
- }
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Cannot reconnect to target.", //$NON-NLS-1$
+ null));
+ rm.done();
+ }
}
-
+
@Override
- public void detachDebuggerFromProcess(IDMContext dmc, final RequestMonitor rm) {
-
- MIExitedProcessDMC exitedProc = DMContexts.getAncestorOfType(dmc, MIExitedProcessDMC.class);
+ public void detachDebuggerFromProcess(IDMContext dmc, final RequestMonitor rm) {
+
+ MIExitedProcessDMC exitedProc = DMContexts.getAncestorOfType(dmc, MIExitedProcessDMC.class);
if (exitedProc != null) {
super.detachDebuggerFromProcess(dmc, rm);
return;
@@ -573,64 +578,63 @@ public class GDBProcesses_7_2 extends GDBProcesses_7_1 implements IMultiTerminat
ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
final IMIContainerDMContext containerDmc = DMContexts.getAncestorOfType(dmc, IMIContainerDMContext.class);
-
- if (controlDmc != null && containerDmc != null) {
- if (!doCanDetachDebuggerFromProcess()) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Detach not supported.", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
+
+ if (controlDmc != null && containerDmc != null) {
+ if (!doCanDetachDebuggerFromProcess()) {
+ rm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Detach not supported.", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
IMIRunControl runControl = getServicesTracker().getService(IMIRunControl.class);
if (runControl != null && !runControl.isTargetAcceptingCommands()) {
fBackend.interrupt();
}
-
+
// Remember that this process was detached so we don't show it as an exited process.
// We must set this before sending the detach command to gdb to avoid race conditions
getDetachedProcesses().add(containerDmc.getGroupId());
- fCommandControl.queueCommand(
- fCommandFactory.createMITargetDetach(controlDmc, containerDmc.getGroupId()),
- new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
- @Override
- protected void handleCompleted() {
- if (isSuccess()) {
- // Bug in GDB 7.2 where removing an inferior will lead to a crash when running other processes.
- // I'm hoping it will be fixed in 7.2.1
-// fCommandControl.queueCommand(
-// fCommandFactory.createMIRemoveInferior(fCommandControl.getContext(), containerDmc.getGroupId()),
-// new DataRequestMonitor<MIInfo>(getExecutor(), rm));
- rm.done();
- } else {
- // This command fails with GDB 7.2 because of a GDB bug, which was fixed with GDB 7.2.1
- // In case we get here, we assume we are using GDB 7.2 (although we should not) and we work
- // around it.
- // Also, with GDB 7.2, removing the inferior does not work because of another bug, so we just don't do it.
- fCommandControl.queueCommand(
- fCommandFactory.createMITargetDetach(containerDmc),
- new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
- @Override
- protected void handleFailure() {
- // Detach failed
- getDetachedProcesses().remove(containerDmc.getGroupId());
- super.handleFailure();
- };
- });
- }
- }
- });
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid context.", null)); //$NON-NLS-1$
- rm.done();
- }
- }
-
+ fCommandControl.queueCommand(fCommandFactory.createMITargetDetach(controlDmc, containerDmc.getGroupId()),
+ new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
+ @Override
+ protected void handleCompleted() {
+ if (isSuccess()) {
+ // Bug in GDB 7.2 where removing an inferior will lead to a crash when running other processes.
+ // I'm hoping it will be fixed in 7.2.1
+ // fCommandControl.queueCommand(
+ // fCommandFactory.createMIRemoveInferior(fCommandControl.getContext(), containerDmc.getGroupId()),
+ // new DataRequestMonitor<MIInfo>(getExecutor(), rm));
+ rm.done();
+ } else {
+ // This command fails with GDB 7.2 because of a GDB bug, which was fixed with GDB 7.2.1
+ // In case we get here, we assume we are using GDB 7.2 (although we should not) and we work
+ // around it.
+ // Also, with GDB 7.2, removing the inferior does not work because of another bug, so we just don't do it.
+ fCommandControl.queueCommand(fCommandFactory.createMITargetDetach(containerDmc),
+ new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
+ @Override
+ protected void handleFailure() {
+ // Detach failed
+ getDetachedProcesses().remove(containerDmc.getGroupId());
+ super.handleFailure();
+ };
+ });
+ }
+ }
+ });
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid context.", null)); //$NON-NLS-1$
+ rm.done();
+ }
+ }
+
@Override
protected boolean doIsDebugNewProcessSupported() {
// Multi-process is not applicable to post-mortem sessions (core)
// or to non-attach remote sessions.
SessionType type = fBackend.getSessionType();
-
+
if (type == SessionType.CORE) {
return false;
}
@@ -645,7 +649,7 @@ public class GDBProcesses_7_2 extends GDBProcesses_7_1 implements IMultiTerminat
// Only one process is allowed in all-stop (for now)
return getNumConnected() == 0;
// NOTE: when we support multi-process in all-stop mode,
- // we will need to interrupt the target to when starting
+ // we will need to interrupt the target to when starting
// the new process.
}
@@ -653,11 +657,11 @@ public class GDBProcesses_7_2 extends GDBProcesses_7_1 implements IMultiTerminat
}
@Override
- protected Sequence getDebugNewProcessSequence(DsfExecutor executor, boolean isInitial, IDMContext dmc, String file,
- Map<String, Object> attributes, DataRequestMonitor<IDMContext> rm) {
+ protected Sequence getDebugNewProcessSequence(DsfExecutor executor, boolean isInitial, IDMContext dmc, String file,
+ Map<String, Object> attributes, DataRequestMonitor<IDMContext> rm) {
return new DebugNewProcessSequence_7_2(executor, isInitial, dmc, file, attributes, rm);
}
-
+
@Override
public void getProcessesBeingDebugged(final IDMContext dmc, final DataRequestMonitor<IDMContext[]> rm) {
if (getTraceVisualization()) {
@@ -666,18 +670,17 @@ public class GDBProcesses_7_2 extends GDBProcesses_7_1 implements IMultiTerminat
final IMIContainerDMContext containerDmc = DMContexts.getAncestorOfType(dmc, IMIContainerDMContext.class);
if (containerDmc != null) {
IProcessDMContext procDmc = DMContexts.getAncestorOfType(containerDmc, IProcessDMContext.class);
- rm.setData(new IMIExecutionDMContext[]{createExecutionContext(containerDmc,
- createThreadContext(procDmc, TRACE_VISUALIZATION_THREAD_ID),
- TRACE_VISUALIZATION_THREAD_ID)});
+ rm.setData(new IMIExecutionDMContext[] { createExecutionContext(containerDmc,
+ createThreadContext(procDmc, TRACE_VISUALIZATION_THREAD_ID), TRACE_VISUALIZATION_THREAD_ID) });
rm.done();
return;
}
}
-
+
super.getProcessesBeingDebugged(dmc, rm);
}
-
- /**
+
+ /**
* Creates the container context that is to be used for the new process that will
* be created by the restart operation.
* This container does not have its pid yet, while the container of the process
@@ -685,18 +688,19 @@ public class GDBProcesses_7_2 extends GDBProcesses_7_1 implements IMultiTerminat
* Starting with GDB 7.2, the groupId stays the same when restarting a process, so
* we should re-use it; this is particularly important since we support multi-process
* and we need the proper groupId
- *
+ *
* @since 4.0
*/
@Override
protected IMIContainerDMContext createContainerContextForRestart(String groupId) {
- IProcessDMContext processDmc = createProcessContext(fCommandControl.getContext(), MIProcesses.UNKNOWN_PROCESS_ID);
+ IProcessDMContext processDmc = createProcessContext(fCommandControl.getContext(),
+ MIProcesses.UNKNOWN_PROCESS_ID);
return createContainerContext(processDmc, groupId);
}
@Override
public void restart(final IContainerDMContext containerDmc, Map<String, Object> attributes,
- DataRequestMonitor<IContainerDMContext> rm) {
+ DataRequestMonitor<IContainerDMContext> rm) {
fProcRestarting.add(containerDmc);
super.restart(containerDmc, attributes, new ImmediateDataRequestMonitor<IContainerDMContext>(rm) {
@Override
@@ -709,20 +713,21 @@ public class GDBProcesses_7_2 extends GDBProcesses_7_1 implements IMultiTerminat
}
});
}
-
- /**
+
+ /**
* @since 5.1
*/
- @DsfServiceEventHandler
- public void eventDispatched(MIThreadGroupAddedEvent e) {
- IProcessDMContext procDmc = e.getDMContext();
- IMIContainerDMContext containerDmc = e.getGroupId() != null ? createContainerContext(procDmc, e.getGroupId()) : null;
- getSession().dispatchEvent(new ContainerCreatedDMEvent(containerDmc), getProperties());
- }
-
- /** @since 4.0 */
- @DsfServiceEventHandler
- @Override
+ @DsfServiceEventHandler
+ public void eventDispatched(MIThreadGroupAddedEvent e) {
+ IProcessDMContext procDmc = e.getDMContext();
+ IMIContainerDMContext containerDmc = e.getGroupId() != null ? createContainerContext(procDmc, e.getGroupId())
+ : null;
+ getSession().dispatchEvent(new ContainerCreatedDMEvent(containerDmc), getProperties());
+ }
+
+ /** @since 4.0 */
+ @DsfServiceEventHandler
+ @Override
public void eventDispatched(IExitedDMEvent e) {
IDMContext dmc = e.getDMContext();
@@ -756,34 +761,34 @@ public class GDBProcesses_7_2 extends GDBProcesses_7_1 implements IMultiTerminat
}
}
}
-
- super.eventDispatched(e);
- }
-
- /**
- * GDB 7.2 has a bug which causes a gdbserver crash if we set the binary after we
- * have connected to the target. Because GDB 7.2.1 was not released when CDT 8.0
- * was released, we need to workaround the bug in Eclipse.
- *
- * This method can be overridden to easily disable the workaround, for versions
- * of GDB that no longer have the bug.
- *
- * See http://sourceware.org/ml/gdb-patches/2011-03/msg00531.html
- * and Bug 352998
- *
- * @since 4.1
- */
- protected boolean needFixForGDB72Bug352998() {
- return true;
- }
-
- /**
+
+ super.eventDispatched(e);
+ }
+
+ /**
+ * GDB 7.2 has a bug which causes a gdbserver crash if we set the binary after we
+ * have connected to the target. Because GDB 7.2.1 was not released when CDT 8.0
+ * was released, we need to workaround the bug in Eclipse.
+ *
+ * This method can be overridden to easily disable the workaround, for versions
+ * of GDB that no longer have the bug.
+ *
+ * See http://sourceware.org/ml/gdb-patches/2011-03/msg00531.html
+ * and Bug 352998
+ *
+ * @since 4.1
+ */
+ protected boolean needFixForGDB72Bug352998() {
+ return true;
+ }
+
+ /**
* @since 4.1
*/
- @DsfServiceEventHandler
- public void eventDispatched(ITraceRecordSelectedChangedDMEvent e) {
- setTraceVisualization(e.isVisualizationModeEnabled());
- }
+ @DsfServiceEventHandler
+ public void eventDispatched(ITraceRecordSelectedChangedDMEvent e) {
+ setTraceVisualization(e.isVisualizationModeEnabled());
+ }
/**
* @since 4.6
@@ -892,4 +897,3 @@ public class GDBProcesses_7_2 extends GDBProcesses_7_1 implements IMultiTerminat
}
}
}
-
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2_1.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2_1.java
index 16a8975c144..810f97cac40 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2_1.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2_1.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Marc Khouzam (Ericsson) - initial API and implementation
*******************************************************************************/
@@ -18,18 +18,17 @@ import org.eclipse.cdt.dsf.service.DsfSession;
/**
* Version for GDB 7.2.1, which does not need a workaround
* for a bug in GDB 7.2 (Bug 352998)
- *
+ *
* @since 4.1
*/
public class GDBProcesses_7_2_1 extends GDBProcesses_7_2 {
-
+
public GDBProcesses_7_2_1(DsfSession session) {
super(session);
}
@Override
- protected boolean needFixForGDB72Bug352998() {
- return false;
- }
+ protected boolean needFixForGDB72Bug352998() {
+ return false;
+ }
}
-
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_3.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_3.java
index 2c103552311..6b6a1a7ca94 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_3.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_3.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Marc Khouzam (Ericsson) - initial API and implementation
*******************************************************************************/
@@ -29,22 +29,21 @@ import org.eclipse.cdt.utils.pty.PTY;
/**
* Version for GDB 7.3
- *
+ *
* @since 4.7
*/
public class GDBProcesses_7_3 extends GDBProcesses_7_2_1 {
-
+
public GDBProcesses_7_3(DsfSession session) {
super(session);
}
@Override
- protected Sequence getStartOrRestartProcessSequence(DsfExecutor executor, IContainerDMContext containerDmc,
- Map<String, Object> attributes, boolean restart,
- DataRequestMonitor<IContainerDMContext> rm) {
+ protected Sequence getStartOrRestartProcessSequence(DsfExecutor executor, IContainerDMContext containerDmc,
+ Map<String, Object> attributes, boolean restart, DataRequestMonitor<IContainerDMContext> rm) {
return new StartOrRestartProcessSequence_7_3(executor, containerDmc, attributes, restart, rm);
}
-
+
@Override
protected MIInferiorProcess createInferiorProcess(IContainerDMContext container, OutputStream outputStream) {
return new MIInferiorProcess_7_3(container, outputStream);
@@ -56,7 +55,7 @@ public class GDBProcesses_7_3 extends GDBProcesses_7_2_1 {
}
@Override
- @DsfServiceEventHandler
+ @DsfServiceEventHandler
public void eventDispatched(MIThreadGroupExitedEvent e) {
super.eventDispatched(e);
@@ -70,9 +69,8 @@ public class GDBProcesses_7_3 extends GDBProcesses_7_2_1 {
// Must use 'decode' since GDB returns an octal value
info.setExitCode(Integer.decode(exitCode));
} catch (NumberFormatException exception) {
- }
+ }
}
}
}
}
-
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_4.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_4.java
index 75b5028b286..1fd70622348 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_4.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_4.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Marc Khouzam (Ericsson) - initial API and implementation
*******************************************************************************/
@@ -19,11 +19,11 @@ import org.eclipse.cdt.dsf.service.DsfSession;
/**
* Adapt to GDB 7.4 where breakpoints are for all inferiors at once.
- *
+ *
* @since 4.4
*/
public class GDBProcesses_7_4 extends GDBProcesses_7_3 {
-
+
public GDBProcesses_7_4(DsfSession session) {
super(session);
}
@@ -31,20 +31,15 @@ public class GDBProcesses_7_4 extends GDBProcesses_7_3 {
/**
* A container context that is not an IBreakpointsTargetDMContext.
*/
- private static class GDBContainerDMC_7_4 extends MIContainerDMC
- implements IMemoryDMContext
- {
+ private static class GDBContainerDMC_7_4 extends MIContainerDMC implements IMemoryDMContext {
public GDBContainerDMC_7_4(String sessionId, IProcessDMContext processDmc, String groupId) {
super(sessionId, processDmc, groupId);
}
}
-
+
@Override
- public IMIContainerDMContext createContainerContext(IProcessDMContext processDmc,
- String groupId) {
- return new GDBContainerDMC_7_4(getSession().getId(), processDmc, groupId);
- }
-
+ public IMIContainerDMContext createContainerContext(IProcessDMContext processDmc, String groupId) {
+ return new GDBContainerDMC_7_4(getSession().getId(), processDmc, groupId);
+ }
}
-
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRegisters.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRegisters.java
index 338b9d677af..05e2f1f9536 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRegisters.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRegisters.java
@@ -57,7 +57,7 @@ import org.eclipse.osgi.util.NLS;
* <p>An extension of MIRegisters to support management of Register Groups as per the IRegisters2 interface.</p>
* <p>The managed registered groups are user-defined subsets of the complete list of Registers reported by GDB for a specific Target</p>
* <p>This class also triggers the read/write (persistence) of the user-defined Register Groups during the start/shutdown process of a session respectively.
- * It optionally supports persistence of user-defined Register Groups per container/process,
+ * It optionally supports persistence of user-defined Register Groups per container/process,
* see {@link #getPersistenceIdForRegisterGroupContainer(IContainerDMContext)}.</p>
* @since 4.6
*/
@@ -146,7 +146,7 @@ public class GDBRegisters extends MIRegisters implements IRegisters2 {
return nameMap;
}
-
+
/**
* Needed when group name(s) change but the associated group objects remain the same
*/
@@ -218,7 +218,7 @@ public class GDBRegisters extends MIRegisters implements IRegisters2 {
Map<String, MIRegisterDMC> registerNameMap = new HashMap<String, MIRegisterDMC>();
for (IRegisterDMContext register : registers) {
- assert(register instanceof MIRegisterDMC);
+ assert (register instanceof MIRegisterDMC);
MIRegisterDMC registerDmc = (MIRegisterDMC) register;
registerNameMap.put(registerDmc.getName(), registerDmc);
}
@@ -245,7 +245,7 @@ public class GDBRegisters extends MIRegisters implements IRegisters2 {
public boolean isEnabled() {
return fEnabled;
}
-
+
@Override
public String getContainerId() {
IContainerDMContext parent = fgroup.getContainerParent();
@@ -296,23 +296,21 @@ public class GDBRegisters extends MIRegisters implements IRegisters2 {
}
}
- @Override
- public void initialize(final RequestMonitor requestMonitor) {
- super.initialize(
- new ImmediateRequestMonitor(requestMonitor) {
- @Override
- public void handleSuccess() {
- doInitialize(requestMonitor);
- }});
- }
-
- private void doInitialize(final RequestMonitor requestMonitor) {
- register(new String[]{IRegisters.class.getName(),
- IRegisters2.class.getName(),
- MIRegisters.class.getName(),
- GDBRegisters.class.getName()}, new Hashtable<String,String>());
- requestMonitor.done();
- }
+ @Override
+ public void initialize(final RequestMonitor requestMonitor) {
+ super.initialize(new ImmediateRequestMonitor(requestMonitor) {
+ @Override
+ public void handleSuccess() {
+ doInitialize(requestMonitor);
+ }
+ });
+ }
+
+ private void doInitialize(final RequestMonitor requestMonitor) {
+ register(new String[] { IRegisters.class.getName(), IRegisters2.class.getName(), MIRegisters.class.getName(),
+ GDBRegisters.class.getName() }, new Hashtable<String, String>());
+ requestMonitor.done();
+ }
@Override
public void getRegisterGroups(final IDMContext ctx, final DataRequestMonitor<IRegisterGroupDMContext[]> rm) {
@@ -366,9 +364,9 @@ public class GDBRegisters extends MIRegisters implements IRegisters2 {
@Override
public void getRegisterGroupData(final IRegisterGroupDMContext regGroupDmc,
final DataRequestMonitor<IRegisterGroupDMData> rm) {
-
+
assert (regGroupDmc instanceof MIRegisterGroupDMC);
-
+
if (regGroupDmc instanceof MIRegisterGroupDMC) {
MIRegisterGroupDMC groupDmc = (MIRegisterGroupDMC) regGroupDmc;
rm.setData(createRegisterGroupData(groupDmc));
@@ -405,10 +403,10 @@ public class GDBRegisters extends MIRegisters implements IRegisters2 {
if (fGroupToRegistersMap.get(groupDmc) == null) {
fGroupToRegistersMap.put(groupDmc, new MIRegisterDMC[0]);
}
-
+
return groupData;
}
-
+
@Override
public void getRegisters(final IDMContext aCtx, final DataRequestMonitor<IRegisterDMContext[]> rm) {
findRegisterGroup(aCtx, ROOT_GROUP_NAME, new ImmediateDataRequestMonitor<IRegisterGroupDMContext>() {
@@ -418,19 +416,19 @@ public class GDBRegisters extends MIRegisters implements IRegisters2 {
IRegisterGroupDMContext rootGroup = getData();
assert (rootGroup instanceof MIRegisterGroupDMC);
final MIRegisterGroupDMC rootGroupContext = (MIRegisterGroupDMC) rootGroup;
-
+
//if the received context does not contain a register group i.e.is null, the default group to resolve registers is the root group
MIRegisterGroupDMC tGroupDmc = DMContexts.getAncestorOfType(aCtx, MIRegisterGroupDMC.class);
-
+
IDMContext tCtx = aCtx;
if (tGroupDmc == null) {
tGroupDmc = rootGroupContext;
//We need a register group as part of the context to resolve registers
- tCtx = new CompositeDMContext(new IDMContext[] {aCtx, tGroupDmc});
+ tCtx = new CompositeDMContext(new IDMContext[] { aCtx, tGroupDmc });
}
final IDMContext ctx = tCtx;
-
+
final MIRegisterGroupDMC groupDmc = tGroupDmc;
// check if base registers have been loaded already
MIRegisterDMC[] baseRegisters = fGroupToRegistersMap.get(groupDmc);
@@ -460,24 +458,26 @@ public class GDBRegisters extends MIRegisters implements IRegisters2 {
}
// Fetch the register base from GDB
- GDBRegisters.super.getRegisters(compCtx, new DataRequestMonitor<IRegisterDMContext[]>(getExecutor(), rm) {
- @Override
- @ConfinedToDsfExecutor("fExecutor")
- protected void handleSuccess() {
- IRegisterDMContext[] iregisters = getData();
- MIRegisterDMC[] registers = Arrays.copyOf(iregisters, iregisters.length, MIRegisterDMC[].class);
-
- // associate group to bare registers i.e. not associated to a specific execution context
- fGroupToRegistersMap.put(rootGroupContext, toBareRegisters(registers));
- if (groupDmc.getName().equals(ROOT_GROUP_NAME)) {
- buildGroupRegisters(ctx, registers, rm);
- return;
- }
-
- // Now proceed to resolve the requested user group registers
- getUserGroupRegisters(ctx, rm);
- }
- });
+ GDBRegisters.super.getRegisters(compCtx,
+ new DataRequestMonitor<IRegisterDMContext[]>(getExecutor(), rm) {
+ @Override
+ @ConfinedToDsfExecutor("fExecutor")
+ protected void handleSuccess() {
+ IRegisterDMContext[] iregisters = getData();
+ MIRegisterDMC[] registers = Arrays.copyOf(iregisters, iregisters.length,
+ MIRegisterDMC[].class);
+
+ // associate group to bare registers i.e. not associated to a specific execution context
+ fGroupToRegistersMap.put(rootGroupContext, toBareRegisters(registers));
+ if (groupDmc.getName().equals(ROOT_GROUP_NAME)) {
+ buildGroupRegisters(ctx, registers, rm);
+ return;
+ }
+
+ // Now proceed to resolve the requested user group registers
+ getUserGroupRegisters(ctx, rm);
+ }
+ });
} else {
if (groupDmc.getName().equals(ROOT_GROUP_NAME)) {
buildGroupRegisters(ctx, registerBase, rm);
@@ -499,7 +499,8 @@ public class GDBRegisters extends MIRegisters implements IRegisters2 {
}
@Override
- public void addRegisterGroup(final IDMContext containerContext, final String groupName, final IRegisterDMContext[] registers, RequestMonitor rm) {
+ public void addRegisterGroup(final IDMContext containerContext, final String groupName,
+ final IRegisterDMContext[] registers, RequestMonitor rm) {
if (registers == null || registers.length < 1) {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED,
Messages.RegisterGroup_invalid_number_of_registers, null));
@@ -534,8 +535,8 @@ public class GDBRegisters extends MIRegisters implements IRegisters2 {
// Make sure the name is not currently in use
if (fContextToGroupsMap.getGroupNameMap(contDmc).get(groupName) != null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, NLS.bind(
- Messages.RegisterGroup_name_used, groupName), null));
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED,
+ NLS.bind(Messages.RegisterGroup_name_used, groupName), null));
rm.done();
return;
}
@@ -569,30 +570,31 @@ public class GDBRegisters extends MIRegisters implements IRegisters2 {
@Override
public void editRegisterGroup(IRegisterGroupDMContext group, String newGroupName, IRegisterDMContext[] iRegisters,
RequestMonitor rm) {
-
+
if (iRegisters != null && iRegisters.length == 0) {
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED,
- Messages.RegisterGroup_invalid_number_of_registers, null));
- return;
+ Messages.RegisterGroup_invalid_number_of_registers, null));
+ return;
}
-
+
if (!(group instanceof MIRegisterGroupDMC)) {
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Unknown DMC type", null)); //$NON-NLS-1$
- return;
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Unknown DMC type", null)); //$NON-NLS-1$
+ return;
}
-
+
IContainerDMContext contDmc = DMContexts.getAncestorOfType(group, IContainerDMContext.class);
if (contDmc == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE,
- "Unable to edit Register group, Invalid Container", null)); //$NON-NLS-1$
- rm.done();
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE,
+ "Unable to edit Register group, Invalid Container", null)); //$NON-NLS-1$
+ rm.done();
}
-
+
MIRegisterGroupDMC miGroup = ((MIRegisterGroupDMC) group);
if (!canEditRegisterGroup(group)) {
// Should not happen as canEdit is expected to be called before edit
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Cannot currently edit register groups", null)); //$NON-NLS-1$
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE,
+ "Cannot currently edit register groups", null)); //$NON-NLS-1$
return;
}
@@ -604,7 +606,7 @@ public class GDBRegisters extends MIRegisters implements IRegisters2 {
rm.done();
return;
}
-
+
// Make sure the name is not currently in use
if (!miGroup.getName().equals(newGroupName)) {
// we are updating the name, lets make sure this new name is not in use
@@ -615,20 +617,20 @@ public class GDBRegisters extends MIRegisters implements IRegisters2 {
return;
}
}
-
+
miGroup.setName(newGroupName);
//make sure we update the group name cache
fContextToGroupsMap.resetGroupNameMap(contDmc);
-
+
generateRegisterGroupChangedEvent(miGroup);
} else {
// Request to keep name the same
}
-
+
if (iRegisters != null) {
assert (iRegisters.length > 0);
-
+
// transform to MIRegistersDMC[]
MIRegisterDMC[] registers = arrangeRegisters(iRegisters);
@@ -646,7 +648,7 @@ public class GDBRegisters extends MIRegisters implements IRegisters2 {
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.cdt.dsf.debug.service.IRegisters2#removeRegisterGroups(org.eclipse.cdt.dsf.debug.service.IRegisters
* .IRegisterGroupDMContext[], org.eclipse.cdt.dsf.concurrent.RequestMonitor)
@@ -672,7 +674,7 @@ public class GDBRegisters extends MIRegisters implements IRegisters2 {
/**
* Reset this class i.e. does not impact saved groups within launch configuration
- *
+ *
* @param rm
*/
public void reset(final RequestMonitor rm) {
@@ -687,16 +689,17 @@ public class GDBRegisters extends MIRegisters implements IRegisters2 {
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.cdt.dsf.mi.service.MIRegisters#findRegisterGroup(org.eclipse.cdt.dsf.datamodel.IDMContext,
* java.lang.String, org.eclipse.cdt.dsf.concurrent.DataRequestMonitor)
*/
@Override
- public void findRegisterGroup(final IDMContext ctx, final String name, final DataRequestMonitor<IRegisterGroupDMContext> rm) {
+ public void findRegisterGroup(final IDMContext ctx, final String name,
+ final DataRequestMonitor<IRegisterGroupDMContext> rm) {
final IContainerDMContext contDmc = DMContexts.getAncestorOfType(ctx, IContainerDMContext.class);
if (contDmc == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE,
- "Container context not found", null)); //$NON-NLS-1$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Container context not found", //$NON-NLS-1$
+ null));
rm.done();
return;
}
@@ -719,7 +722,8 @@ public class GDBRegisters extends MIRegisters implements IRegisters2 {
/**
* Call it only after getRegisterGroups has been called at least once, so the context to groups map is not empty
*/
- private void findRegisterGroup(IContainerDMContext contDmc, String name, DataRequestMonitor<IRegisterGroupDMContext> rm) {
+ private void findRegisterGroup(IContainerDMContext contDmc, String name,
+ DataRequestMonitor<IRegisterGroupDMContext> rm) {
Map<String, MIRegisterGroupDMC> nameToGroup = fContextToGroupsMap.getGroupNameMap(contDmc);
if (nameToGroup != null) {
rm.setData(nameToGroup.get(name));
@@ -729,27 +733,27 @@ public class GDBRegisters extends MIRegisters implements IRegisters2 {
rm.done();
}
-
+
@Override
public void shutdown(RequestMonitor rm) {
save();
super.shutdown(rm);
}
- /**
- * Save the register group settings into the underlying launch configuration.
- */
+ /**
+ * Save the register group settings into the underlying launch configuration.
+ */
public void save() {
- IRegisterGroupDescriptor[] groups = buildDescriptors();
- ILaunchConfiguration launchConfig = getLaunchConfig();
- if (launchConfig != null) {
- RegisterGroupsPersistance serializer = new RegisterGroupsPersistance(launchConfig);
- try {
- serializer.saveGroups(groups);
- } catch (CoreException e) {
- GdbPlugin.log(e);
- }
- }
+ IRegisterGroupDescriptor[] groups = buildDescriptors();
+ ILaunchConfiguration launchConfig = getLaunchConfig();
+ if (launchConfig != null) {
+ RegisterGroupsPersistance serializer = new RegisterGroupsPersistance(launchConfig);
+ try {
+ serializer.saveGroups(groups);
+ } catch (CoreException e) {
+ GdbPlugin.log(e);
+ }
+ }
}
@@ -759,7 +763,7 @@ public class GDBRegisters extends MIRegisters implements IRegisters2 {
private MIRegisterDMC[] arrangeRegisters(IRegisterDMContext[] iRegisters) {
TreeMap<Integer, MIRegisterDMC> sortedRegisters = new TreeMap<Integer, MIRegisterDMC>();
for (int i = 0; i < iRegisters.length; i++) {
- assert(iRegisters[i] instanceof MIRegisterDMC);
+ assert (iRegisters[i] instanceof MIRegisterDMC);
MIRegisterDMC register = (MIRegisterDMC) iRegisters[i];
sortedRegisters.put(register.getRegNo(), register);
}
@@ -801,16 +805,17 @@ public class GDBRegisters extends MIRegisters implements IRegisters2 {
// This could be revisited in case there is performance concerns which does not seem an issue at this
// point.
MIRegisterGroupDMC[] groupsCtx = fContextToGroupsMap.get(containerDmc);
- assert(groupsCtx != null);
-
- if (groupsCtx != null) {
+ assert (groupsCtx != null);
+
+ if (groupsCtx != null) {
List<MIRegisterGroupDMC> groupsList = new ArrayList<MIRegisterGroupDMC>(Arrays.asList(groupsCtx));
-
+
// Removing a single group
groupsList.remove(group);
-
+
// Back to context map without the given group
- fContextToGroupsMap.put(containerDmc, groupsList.toArray(new MIRegisterGroupDMC[groupsList.size()]));
+ fContextToGroupsMap.put(containerDmc,
+ groupsList.toArray(new MIRegisterGroupDMC[groupsList.size()]));
// Now remove the group from the groups to registers map
if (fGroupToRegistersMap.remove(group) != null) {
updatedContainers.add(containerDmc);
@@ -822,10 +827,10 @@ public class GDBRegisters extends MIRegisters implements IRegisters2 {
return;
}
}
-
+
// Sending only one update per container
for (IContainerDMContext container : updatedContainers) {
- getSession().dispatchEvent(new GroupsChangedDMEvent(container), null);
+ getSession().dispatchEvent(new GroupsChangedDMEvent(container), null);
}
}
@@ -909,12 +914,12 @@ public class GDBRegisters extends MIRegisters implements IRegisters2 {
MIRegisterGroupDMC[] readGroupsFromMemento(final IContainerDMContext contDmc) {
String containerId = getPersistenceIdForRegisterGroupContainer(contDmc);
-
+
RegisterGroupsPersistance deserializer = new RegisterGroupsPersistance(getLaunchConfig());
IRegisterGroupDescriptor[] groupDescriptions;
try {
groupDescriptions = deserializer.parseGroups(containerId);
- } catch(CoreException e) {
+ } catch (CoreException e) {
return new MIRegisterGroupDMC[0];
}
@@ -927,21 +932,21 @@ public class GDBRegisters extends MIRegisters implements IRegisters2 {
return groups.toArray(new MIRegisterGroupDMC[groups.size()]);
}
-
+
/**
- * @return the persistence id for the register group in the given contDmc container context,
- * or null to associate the Register Groups in the given container to the launch itself (this is the default behavior).
- *
+ * @return the persistence id for the register group in the given contDmc container context,
+ * or null to associate the Register Groups in the given container to the launch itself (this is the default behavior).
+ *
* Subclasses may override. Alternatively simply use override {@link #useProcessIdAsRegisterGroupPersistanceId()} to return true to have
- * the process id be used as the persistence id.
- *
+ * the process id be used as the persistence id.
+ *
* Note that for this to work correctly the id returned for a given container must be same across launch sessions,
* otherwise persistence info will be lost. (Hence why null is the default behavior)
- *
+ *
* @since 5.3
*/
protected String getPersistenceIdForRegisterGroupContainer(final IContainerDMContext contDmc) {
- if(useProcessIdAsRegisterGroupPersistanceId()) {
+ if (useProcessIdAsRegisterGroupPersistanceId()) {
IMIProcessDMContext processDmc = DMContexts.getAncestorOfType(contDmc, IMIProcessDMContext.class);
return processDmc == null ? null : processDmc.getProcId();
} else {
@@ -950,11 +955,11 @@ public class GDBRegisters extends MIRegisters implements IRegisters2 {
}
/**
- * @return whether the process id should be used as a container id for the persistence
+ * @return whether the process id should be used as a container id for the persistence
* of the register groups. Subclasses may override.
- *
+ *
* @see #getPersistenceIdForRegisterGroupContainer(IContainerDMContext)
- *
+ *
* @since 5.3
*/
protected boolean useProcessIdAsRegisterGroupPersistanceId() {
@@ -1027,8 +1032,7 @@ public class GDBRegisters extends MIRegisters implements IRegisters2 {
@Override
protected void generateRegisterChangedEvent(final IRegisterDMContext dmc) {
// notify the register value change
- getSession().dispatchEvent(new RegisterChangedDMEvent(dmc), getProperties());
-
+ getSession().dispatchEvent(new RegisterChangedDMEvent(dmc), getProperties());
// Propagate notification to all groups.
// A change of a single register needs to be propagated to all groups within the same Container/Process
@@ -1037,11 +1041,11 @@ public class GDBRegisters extends MIRegisters implements IRegisters2 {
IContainerDMContext containerDmc = DMContexts.getAncestorOfType(dmc, IContainerDMContext.class);
generateRegistersChangedEvent(containerDmc);
}
-
+
private void generateRegistersChangedEvent(IContainerDMContext containerDmc) {
- //resolve the groups for the current container (process) context
+ //resolve the groups for the current container (process) context
final MIRegisterGroupDMC[] groups = fContextToGroupsMap.get(containerDmc);
-
+
//trigger notification to all groups in the container
for (int i = 0; i < groups.length; i++) {
//We need final locals variables from the loop. Use a method call for this
@@ -1056,7 +1060,7 @@ public class GDBRegisters extends MIRegisters implements IRegisters2 {
return groupDmc;
}
};
-
+
getSession().dispatchEvent(event, getProperties());
}
@@ -1067,12 +1071,10 @@ public class GDBRegisters extends MIRegisters implements IRegisters2 {
return groupDmc;
}
};
-
+
getSession().dispatchEvent(event, getProperties());
}
-
-
/**
* Create Registers from specific execution context to a generic register context, e.g. not associated to a specific
* execution context.
@@ -1162,9 +1164,9 @@ public class GDBRegisters extends MIRegisters implements IRegisters2 {
rm.done();
return;
}
-
- for(IRegisterGroupDMContext group : groups) {
- assert(group instanceof MIRegisterGroupDMC);
+
+ for (IRegisterGroupDMContext group : groups) {
+ assert (group instanceof MIRegisterGroupDMC);
MIRegisterGroupDMC miGroup = (MIRegisterGroupDMC) group;
if (miGroup.getName().equals(ROOT_GROUP_NAME)) {
// Not allowed to remove the root group
@@ -1176,7 +1178,7 @@ public class GDBRegisters extends MIRegisters implements IRegisters2 {
rm.setData(true);
rm.done();
-
+
}
@Override
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl.java
index c76ee4ae87a..f3d79fc88d2 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl.java
@@ -7,18 +7,17 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
- * Ericsson AB - Modified for additional functionality
- * Nokia - create and use backend service.
+ * Ericsson AB - Modified for additional functionality
+ * Nokia - create and use backend service.
* Alvaro Sanchez-Leon (Ericsson AB) - Support for Step into selection (bug 244865)
* Alvaro Sanchez-Leon (Ericsson AB) - Bug 415362
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.service;
-
import java.util.Arrays;
import java.util.Hashtable;
import java.util.Iterator;
@@ -67,78 +66,90 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
public class GDBRunControl extends MIRunControl {
-
+
private static class RunToLineActiveOperation {
private IMIExecutionDMContext fThreadContext;
private String fBpId;
private String fFileLocation;
private String fAddrLocation;
private boolean fSkipBreakpoints;
-
- public RunToLineActiveOperation(IMIExecutionDMContext threadContext,
- String bpId, String fileLoc, String addr, boolean skipBreakpoints) {
+
+ public RunToLineActiveOperation(IMIExecutionDMContext threadContext, String bpId, String fileLoc, String addr,
+ boolean skipBreakpoints) {
fThreadContext = threadContext;
fBpId = bpId;
fFileLocation = fileLoc;
fAddrLocation = addr;
fSkipBreakpoints = skipBreakpoints;
}
-
- public IMIExecutionDMContext getThreadContext() { return fThreadContext; }
- public String getBreakointId() { return fBpId; }
- public String getFileLocation() { return fFileLocation; }
- public String getAddrLocation() { return fAddrLocation; }
- public boolean shouldSkipBreakpoints() { return fSkipBreakpoints; }
+
+ public IMIExecutionDMContext getThreadContext() {
+ return fThreadContext;
+ }
+
+ public String getBreakointId() {
+ return fBpId;
+ }
+
+ public String getFileLocation() {
+ return fFileLocation;
+ }
+
+ public String getAddrLocation() {
+ return fAddrLocation;
+ }
+
+ public boolean shouldSkipBreakpoints() {
+ return fSkipBreakpoints;
+ }
}
-
- private IGDBBackend fGdb;
+
+ private IGDBBackend fGdb;
private IMIProcesses fProcService;
private CommandFactory fCommandFactory;
private ICommandControlService fConnection;
-
+
// Record list of execution contexts
private IExecutionDMContext[] fOldExecutionCtxts;
private RunToLineActiveOperation fRunToLineActiveOperation = null;
-
+
private StepIntoSelectionActiveOperation fStepInToSelectionActiveOperation = null;
- public GDBRunControl(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(final RequestMonitor requestMonitor) {
-
- fGdb = getServicesTracker().getService(IGDBBackend.class);
- fProcService = getServicesTracker().getService(IMIProcesses.class);
- fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
- fConnection = getServicesTracker().getService(ICommandControlService.class);
-
- register(new String[]{IRunControl.class.getName(),
- IRunControl2.class.getName(),
- IRunControl3.class.getName(),
- IMIRunControl.class.getName(),
- MIRunControl.class.getName(),
- GDBRunControl.class.getName()}, new Hashtable<String,String>());
- requestMonitor.done();
- }
-
- @Override
- public void shutdown(final RequestMonitor requestMonitor) {
- unregister();
- super.shutdown(requestMonitor);
- }
-
+ public GDBRunControl(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(final RequestMonitor requestMonitor) {
+
+ fGdb = getServicesTracker().getService(IGDBBackend.class);
+ fProcService = getServicesTracker().getService(IMIProcesses.class);
+ fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
+ fConnection = getServicesTracker().getService(ICommandControlService.class);
+
+ register(
+ new String[] { IRunControl.class.getName(), IRunControl2.class.getName(), IRunControl3.class.getName(),
+ IMIRunControl.class.getName(), MIRunControl.class.getName(), GDBRunControl.class.getName() },
+ new Hashtable<String, String>());
+ requestMonitor.done();
+ }
+
+ @Override
+ public void shutdown(final RequestMonitor requestMonitor) {
+ unregister();
+ super.shutdown(requestMonitor);
+ }
+
/**
* Allows us to know if run control operations should be
* enabled or disabled. Run control operations are
@@ -149,60 +160,56 @@ public class GDBRunControl extends MIRunControl {
return fGdb.getSessionType() != SessionType.CORE;
}
- @Override
+ @Override
public IMIExecutionDMContext createMIExecutionContext(IContainerDMContext container, String threadId) {
- IProcessDMContext procDmc = DMContexts.getAncestorOfType(container, IProcessDMContext.class);
-
- IThreadDMContext threadDmc = null;
- if (procDmc != null) {
- // For now, reuse the threadId as the OSThreadId
- threadDmc = fProcService.createThreadContext(procDmc, threadId);
- }
-
- return fProcService.createExecutionContext(container, threadDmc, threadId);
- }
-
- @Override
- public void suspend(final IExecutionDMContext context, final RequestMonitor rm){
- canSuspend(
- context,
- new DataRequestMonitor<Boolean>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- if (getData()) {
- int interruptTimeout = getInterruptTimeout();
- // A local Windows attach session requires us to interrupt
- // the inferior instead of gdb. This deficiency was fixed
- // in gdb 7.0. Note that there's a GDBRunControl_7_0,
- // so we're dealing with gdb < 7.0 if we get here.
- // Refer to https://bugs.eclipse.org/bugs/show_bug.cgi?id=304096#c56
- // if you have the stomach for it.
- if (fGdb.getIsAttachSession()
- && fGdb.getSessionType() != SessionType.REMOTE
- && Platform.getOS().equals(Platform.OS_WIN32)) {
- IMIProcessDMContext processDmc = DMContexts.getAncestorOfType(context, IMIProcessDMContext.class);
- String inferiorPid = processDmc.getProcId();
- if (inferiorPid != null) {
- fGdb.interruptInferiorAndWait(Long.parseLong(inferiorPid), interruptTimeout, rm);
- }
- else {
- assert false : "why don't we have the inferior's pid?"; //$NON-NLS-1$
- fGdb.interruptAndWait(interruptTimeout, rm);
- }
- }
- else {
- fGdb.interruptAndWait(interruptTimeout, rm);
- }
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Context cannot be suspended.", null)); //$NON-NLS-1$
- rm.done();
- }
- }
- });
- }
-
-
- /*
+ IProcessDMContext procDmc = DMContexts.getAncestorOfType(container, IProcessDMContext.class);
+
+ IThreadDMContext threadDmc = null;
+ if (procDmc != null) {
+ // For now, reuse the threadId as the OSThreadId
+ threadDmc = fProcService.createThreadContext(procDmc, threadId);
+ }
+
+ return fProcService.createExecutionContext(container, threadDmc, threadId);
+ }
+
+ @Override
+ public void suspend(final IExecutionDMContext context, final RequestMonitor rm) {
+ canSuspend(context, new DataRequestMonitor<Boolean>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ if (getData()) {
+ int interruptTimeout = getInterruptTimeout();
+ // A local Windows attach session requires us to interrupt
+ // the inferior instead of gdb. This deficiency was fixed
+ // in gdb 7.0. Note that there's a GDBRunControl_7_0,
+ // so we're dealing with gdb < 7.0 if we get here.
+ // Refer to https://bugs.eclipse.org/bugs/show_bug.cgi?id=304096#c56
+ // if you have the stomach for it.
+ if (fGdb.getIsAttachSession() && fGdb.getSessionType() != SessionType.REMOTE
+ && Platform.getOS().equals(Platform.OS_WIN32)) {
+ IMIProcessDMContext processDmc = DMContexts.getAncestorOfType(context,
+ IMIProcessDMContext.class);
+ String inferiorPid = processDmc.getProcId();
+ if (inferiorPid != null) {
+ fGdb.interruptInferiorAndWait(Long.parseLong(inferiorPid), interruptTimeout, rm);
+ } else {
+ assert false : "why don't we have the inferior's pid?"; //$NON-NLS-1$
+ fGdb.interruptAndWait(interruptTimeout, rm);
+ }
+ } else {
+ fGdb.interruptAndWait(interruptTimeout, rm);
+ }
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE,
+ "Context cannot be suspended.", null)); //$NON-NLS-1$
+ rm.done();
+ }
+ }
+ });
+ }
+
+ /*
* This is a HACK. Remove this method when GDB starts to account exited threads id in -thread-list-id command.
* Exited threads are reported in -thread-list-id command even after an exit event is raised by GDB
* Hence, this method needs a special handling in case of GDB.
@@ -210,210 +217,215 @@ public class GDBRunControl extends MIRunControl {
* See bug 200615 for details.
*/
@Override
- public void getExecutionContexts(IContainerDMContext containerDmc, final DataRequestMonitor<IExecutionDMContext[]> rm) {
- fProcService.getProcessesBeingDebugged(
- containerDmc,
- new DataRequestMonitor<IDMContext[]>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- if (getData() instanceof IExecutionDMContext[]) {
- IExecutionDMContext[] execDmcs = (IExecutionDMContext[])getData();
- raiseExitEvents(execDmcs);
- fOldExecutionCtxts = execDmcs;
- rm.setData(fOldExecutionCtxts);
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid contexts", null)); //$NON-NLS-1$
- }
- rm.done();
- }
- });
- }
+ public void getExecutionContexts(IContainerDMContext containerDmc,
+ final DataRequestMonitor<IExecutionDMContext[]> rm) {
+ fProcService.getProcessesBeingDebugged(containerDmc, new DataRequestMonitor<IDMContext[]>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ if (getData() instanceof IExecutionDMContext[]) {
+ IExecutionDMContext[] execDmcs = (IExecutionDMContext[]) getData();
+ raiseExitEvents(execDmcs);
+ fOldExecutionCtxts = execDmcs;
+ rm.setData(fOldExecutionCtxts);
+ } else {
+ rm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid contexts", null)); //$NON-NLS-1$
+ }
+ rm.done();
+ }
+ });
+ }
- private void raiseExitEvents(IExecutionDMContext[] ctxts){
- if(ctxts == null || fOldExecutionCtxts == null)
+ private void raiseExitEvents(IExecutionDMContext[] ctxts) {
+ if (ctxts == null || fOldExecutionCtxts == null)
return;
List<IExecutionDMContext> list = Arrays.asList(ctxts);
List<IExecutionDMContext> oldThreadList = Arrays.asList(fOldExecutionCtxts);
Iterator<IExecutionDMContext> iterator = oldThreadList.iterator();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
IExecutionDMContext ctxt = iterator.next();
- if(! list.contains(ctxt)){
- IContainerDMContext containerDmc = DMContexts.getAncestorOfType(ctxt, IContainerDMContext.class);
- MIEvent<?> e = new MIThreadExitEvent(containerDmc, ((IMIExecutionDMContext)ctxt).getThreadId());
- // Dispatch DsfMIThreadExitEvent
- getSession().dispatchEvent(e, getProperties());
+ if (!list.contains(ctxt)) {
+ IContainerDMContext containerDmc = DMContexts.getAncestorOfType(ctxt, IContainerDMContext.class);
+ MIEvent<?> e = new MIThreadExitEvent(containerDmc, ((IMIExecutionDMContext) ctxt).getThreadId());
+ // Dispatch DsfMIThreadExitEvent
+ getSession().dispatchEvent(e, getProperties());
}
}
}
-
+
/**
* @since 2.0
*/
- @Override
+ @Override
public void canResume(IExecutionDMContext context, DataRequestMonitor<Boolean> rm) {
if (!runControlOperationsEnabled()) {
- rm.setData(false);
- rm.done();
- return;
- }
- super.canResume(context, rm);
- }
-
+ rm.setData(false);
+ rm.done();
+ return;
+ }
+ super.canResume(context, rm);
+ }
+
/**
* @since 2.0
*/
- @Override
+ @Override
public void canSuspend(IExecutionDMContext context, DataRequestMonitor<Boolean> rm) {
if (!runControlOperationsEnabled()) {
- rm.setData(false);
- rm.done();
- return;
- }
- super.canSuspend(context, rm);
- }
+ rm.setData(false);
+ rm.done();
+ return;
+ }
+ super.canSuspend(context, rm);
+ }
/**
* @since 2.0
*/
- @Override
+ @Override
public void canStep(final IExecutionDMContext context, StepType stepType, final DataRequestMonitor<Boolean> rm) {
if (!runControlOperationsEnabled()) {
- rm.setData(false);
- rm.done();
- return;
- }
-
- if (context instanceof IContainerDMContext) {
- rm.setData(false);
- rm.done();
- return;
- }
-
- if (stepType == StepType.STEP_RETURN) {
- // A step return will always be done in the top stack frame.
- // If the top stack frame is the only stack frame, it does not make sense
- // to do a step return since GDB will reject it.
- MIStack stackService = getServicesTracker().getService(MIStack.class);
- if (stackService != null) {
- // Check that the stack is at least two deep.
- stackService.getStackDepth(context, 2, new DataRequestMonitor<Integer>(getExecutor(), rm) {
- @Override
- public void handleCompleted() {
- if (isSuccess() && getData() == 1) {
- rm.setData(false);
- rm.done();
- } else {
- canResume(context, rm);
- }
- }
- });
- return;
- }
- }
-
- canResume(context, rm);
- }
+ rm.setData(false);
+ rm.done();
+ return;
+ }
+
+ if (context instanceof IContainerDMContext) {
+ rm.setData(false);
+ rm.done();
+ return;
+ }
+
+ if (stepType == StepType.STEP_RETURN) {
+ // A step return will always be done in the top stack frame.
+ // If the top stack frame is the only stack frame, it does not make sense
+ // to do a step return since GDB will reject it.
+ MIStack stackService = getServicesTracker().getService(MIStack.class);
+ if (stackService != null) {
+ // Check that the stack is at least two deep.
+ stackService.getStackDepth(context, 2, new DataRequestMonitor<Integer>(getExecutor(), rm) {
+ @Override
+ public void handleCompleted() {
+ if (isSuccess() && getData() == 1) {
+ rm.setData(false);
+ rm.done();
+ } else {
+ canResume(context, rm);
+ }
+ }
+ });
+ return;
+ }
+ }
+
+ canResume(context, rm);
+ }
/** @since 3.0 */
@Override
- public void runToLocation(IExecutionDMContext context, final String location, final boolean skipBreakpoints, final RequestMonitor rm){
- assert context != null;
-
- final IMIExecutionDMContext dmc = DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
- if (dmc == null){
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Given context: " + context + " is not an execution context.", null)); //$NON-NLS-1$ //$NON-NLS-2$
- rm.done();
- return;
+ public void runToLocation(IExecutionDMContext context, final String location, final boolean skipBreakpoints,
+ final RequestMonitor rm) {
+ assert context != null;
+
+ final IMIExecutionDMContext dmc = DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
+ if (dmc == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED,
+ "Given context: " + context + " is not an execution context.", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ rm.done();
+ return;
}
- if (doCanResume(dmc)) {
- IBreakpointsTargetDMContext bpDmc = DMContexts.getAncestorOfType(context, IBreakpointsTargetDMContext.class);
- getConnection().queueCommand(
- fCommandFactory.createMIBreakInsert(bpDmc, true, false, null, 0,
- location, dmc.getThreadId()),
- new DataRequestMonitor<MIBreakInsertInfo>(getExecutor(), rm) {
- @Override
- public void handleSuccess() {
- // We must set are RunToLineActiveOperation *before* we do the resume
- // or else we may get the stopped event, before we have set this variable.
- String bpId = getData().getMIBreakpoints()[0].getNumber();
- String addr = getData().getMIBreakpoints()[0].getAddress();
- fRunToLineActiveOperation = new RunToLineActiveOperation(dmc, bpId, location, addr, skipBreakpoints);
-
- resume(dmc, new RequestMonitor(getExecutor(), rm) {
- @Override
- public void handleFailure() {
- IBreakpointsTargetDMContext bpDmc = DMContexts.getAncestorOfType(fRunToLineActiveOperation.getThreadContext(),
- IBreakpointsTargetDMContext.class);
- String bpId = fRunToLineActiveOperation.getBreakointId();
-
- getConnection().queueCommand(fCommandFactory.createMIBreakDelete(bpDmc, new String[] {bpId}),
- new DataRequestMonitor<MIInfo>(getExecutor(), null));
- fRunToLineActiveOperation = null;
- fStepInToSelectionActiveOperation = null;
-
- super.handleFailure();
- }
- });
- }
- });
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED,
- "Cannot resume given DMC.", null)); //$NON-NLS-1$
- rm.done();
- }
+ if (doCanResume(dmc)) {
+ IBreakpointsTargetDMContext bpDmc = DMContexts.getAncestorOfType(context,
+ IBreakpointsTargetDMContext.class);
+ getConnection().queueCommand(
+ fCommandFactory.createMIBreakInsert(bpDmc, true, false, null, 0, location, dmc.getThreadId()),
+ new DataRequestMonitor<MIBreakInsertInfo>(getExecutor(), rm) {
+ @Override
+ public void handleSuccess() {
+ // We must set are RunToLineActiveOperation *before* we do the resume
+ // or else we may get the stopped event, before we have set this variable.
+ String bpId = getData().getMIBreakpoints()[0].getNumber();
+ String addr = getData().getMIBreakpoints()[0].getAddress();
+ fRunToLineActiveOperation = new RunToLineActiveOperation(dmc, bpId, location, addr,
+ skipBreakpoints);
+
+ resume(dmc, new RequestMonitor(getExecutor(), rm) {
+ @Override
+ public void handleFailure() {
+ IBreakpointsTargetDMContext bpDmc = DMContexts.getAncestorOfType(
+ fRunToLineActiveOperation.getThreadContext(),
+ IBreakpointsTargetDMContext.class);
+ String bpId = fRunToLineActiveOperation.getBreakointId();
+
+ getConnection().queueCommand(
+ fCommandFactory.createMIBreakDelete(bpDmc, new String[] { bpId }),
+ new DataRequestMonitor<MIInfo>(getExecutor(), null));
+ fRunToLineActiveOperation = null;
+ fStepInToSelectionActiveOperation = null;
+
+ super.handleFailure();
+ }
+ });
+ }
+ });
+ } else {
+ rm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Cannot resume given DMC.", null)); //$NON-NLS-1$
+ rm.done();
+ }
}
- /**
- * @nooverride This method is not intended to be re-implemented or extended by clients.
- * @noreference This method is not intended to be referenced by clients.
- *
- * @since 2.0
- */
- @DsfServiceEventHandler
- public void eventDispatched(MIInferiorExitEvent e) {
- if (fRunToLineActiveOperation != null) {
- IBreakpointsTargetDMContext bpDmc = DMContexts.getAncestorOfType(fRunToLineActiveOperation.getThreadContext(),
- IBreakpointsTargetDMContext.class);
- String bpId = fRunToLineActiveOperation.getBreakointId();
-
- getConnection().queueCommand(fCommandFactory.createMIBreakDelete(bpDmc, new String[] {bpId}),
- new DataRequestMonitor<MIInfo>(getExecutor(), null));
- fRunToLineActiveOperation = null;
- fStepInToSelectionActiveOperation = null;
- }
- }
+ /**
+ * @nooverride This method is not intended to be re-implemented or extended by clients.
+ * @noreference This method is not intended to be referenced by clients.
+ *
+ * @since 2.0
+ */
+ @DsfServiceEventHandler
+ public void eventDispatched(MIInferiorExitEvent e) {
+ if (fRunToLineActiveOperation != null) {
+ IBreakpointsTargetDMContext bpDmc = DMContexts
+ .getAncestorOfType(fRunToLineActiveOperation.getThreadContext(), IBreakpointsTargetDMContext.class);
+ String bpId = fRunToLineActiveOperation.getBreakointId();
+
+ getConnection().queueCommand(fCommandFactory.createMIBreakDelete(bpDmc, new String[] { bpId }),
+ new DataRequestMonitor<MIInfo>(getExecutor(), null));
+ fRunToLineActiveOperation = null;
+ fStepInToSelectionActiveOperation = null;
+ }
+ }
/** @since 2.0 */
- @Override
- @DsfServiceEventHandler
+ @Override
+ @DsfServiceEventHandler
public void eventDispatched(final MIStoppedEvent e) {
- // A disabled signal event is due to interrupting the target
- // to set a breakpoint. This can happen during a run-to-line
- // or step-into operation, so we need to check it first.
- if (fDisableNextSignalEvent && e instanceof MISignalEvent) {
- fDisableNextSignalEvent = false;
- fSilencedSignalEvent = e;
- // We don't broadcast this stopped event
- return;
- }
-
- if (processRunToLineStoppedEvent(e)) {
+ // A disabled signal event is due to interrupting the target
+ // to set a breakpoint. This can happen during a run-to-line
+ // or step-into operation, so we need to check it first.
+ if (fDisableNextSignalEvent && e instanceof MISignalEvent) {
+ fDisableNextSignalEvent = false;
+ fSilencedSignalEvent = e;
+ // We don't broadcast this stopped event
+ return;
+ }
+
+ if (processRunToLineStoppedEvent(e)) {
// If RunToLine is not completed
return;
}
if (!processStepIntoSelection(e)) {
//Step into Selection is not in progress broadcast the stop event
- super.eventDispatched(e);
+ super.eventDispatched(e);
}
}
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.dsf.mi.service.MIRunControl#eventDispatched(org.eclipse.cdt.dsf.mi.service.command.events.MIRunningEvent)
- */
- @Override
- @DsfServiceEventHandler
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.dsf.mi.service.MIRunControl#eventDispatched(org.eclipse.cdt.dsf.mi.service.command.events.MIRunningEvent)
+ */
+ @Override
+ @DsfServiceEventHandler
public void eventDispatched(final MIRunningEvent e) {
if (fDisableNextRunningEvent) {
// Leave the action to the super class
@@ -434,15 +446,15 @@ public class GDBRunControl extends MIRunControl {
}
// No event dispatched if RuntoLine or StepIntoSelection operations are active and a previous event is not a
- // Suspended event, i.e. only one Running event distributed per operation
+ // Suspended event, i.e. only one Running event distributed per operation
}
-
- private boolean processRunToLineStoppedEvent(final MIStoppedEvent e) {
- if (fRunToLineActiveOperation != null) {
- String bpId = ""; //$NON-NLS-1$
- if (e instanceof MIBreakpointHitEvent) {
- bpId = ((MIBreakpointHitEvent)e).getNumber();
- }
+
+ private boolean processRunToLineStoppedEvent(final MIStoppedEvent e) {
+ if (fRunToLineActiveOperation != null) {
+ String bpId = ""; //$NON-NLS-1$
+ if (e instanceof MIBreakpointHitEvent) {
+ bpId = ((MIBreakpointHitEvent) e).getNumber();
+ }
// Here we check three different things to see if we are stopped at the right place
// 1- The actual location in the file. But this does not work for breakpoints that
@@ -459,66 +471,69 @@ public class GDBRunControl extends MIRunControl {
boolean equalAddrLocation = false;
boolean equalBpId = bpId.equals(fRunToLineActiveOperation.getBreakointId());
MIFrame frame = e.getFrame();
- if(frame != null) {
- String fileLocation = frame.getFile() + ":" + frame.getLine(); //$NON-NLS-1$
+ if (frame != null) {
+ String fileLocation = frame.getFile() + ":" + frame.getLine(); //$NON-NLS-1$
String addrLocation = frame.getAddress();
equalFileLocation = fileLocation.equals(fRunToLineActiveOperation.getFileLocation());
equalAddrLocation = addrLocation.equals(fRunToLineActiveOperation.getAddrLocation());
}
-
+
if (equalFileLocation || equalAddrLocation || equalBpId) {
- // We stopped at the right place. All is well.
+ // We stopped at the right place. All is well.
fRunToLineActiveOperation = null;
- } else {
- // Didn't stop at the right place yet
- if (fRunToLineActiveOperation.shouldSkipBreakpoints() && e instanceof MIBreakpointHitEvent) {
- getConnection().queueCommand(
- fCommandFactory.createMIExecContinue(fRunToLineActiveOperation.getThreadContext()),
- new DataRequestMonitor<MIInfo>(getExecutor(), null));
-
- // Don't send the stop event since we are resuming again.
- return true;
- } else {
- // Stopped at another breakpoint that we should not skip.
- // Or got an interrupt signal from a suspend command.
- // Or got an interrupt signal because the user set/changed a breakpoint. This last case is tricky.
- // We could let the run-to-line continue its job, however, I'm thinking that if the user creates
- // a new breakpoint, she may want to force the program to stop, in a way to abort the run-to-line.
- // So, let's cancel the run-to-line in this case.
- //
- // Just remove our temporary one since we don't want it to hit later
- IBreakpointsTargetDMContext bpDmc = DMContexts.getAncestorOfType(fRunToLineActiveOperation.getThreadContext(),
- IBreakpointsTargetDMContext.class);
-
- getConnection().queueCommand(fCommandFactory.createMIBreakDelete(bpDmc, new String[] {fRunToLineActiveOperation.getBreakointId()}),
- new DataRequestMonitor<MIInfo>(getExecutor(), null));
- fRunToLineActiveOperation = null;
- fStepInToSelectionActiveOperation = null;
- }
- }
- }
-
- return false;
- }
-
+ } else {
+ // Didn't stop at the right place yet
+ if (fRunToLineActiveOperation.shouldSkipBreakpoints() && e instanceof MIBreakpointHitEvent) {
+ getConnection().queueCommand(
+ fCommandFactory.createMIExecContinue(fRunToLineActiveOperation.getThreadContext()),
+ new DataRequestMonitor<MIInfo>(getExecutor(), null));
+
+ // Don't send the stop event since we are resuming again.
+ return true;
+ } else {
+ // Stopped at another breakpoint that we should not skip.
+ // Or got an interrupt signal from a suspend command.
+ // Or got an interrupt signal because the user set/changed a breakpoint. This last case is tricky.
+ // We could let the run-to-line continue its job, however, I'm thinking that if the user creates
+ // a new breakpoint, she may want to force the program to stop, in a way to abort the run-to-line.
+ // So, let's cancel the run-to-line in this case.
+ //
+ // Just remove our temporary one since we don't want it to hit later
+ IBreakpointsTargetDMContext bpDmc = DMContexts.getAncestorOfType(
+ fRunToLineActiveOperation.getThreadContext(), IBreakpointsTargetDMContext.class);
+
+ getConnection().queueCommand(
+ fCommandFactory.createMIBreakDelete(bpDmc,
+ new String[] { fRunToLineActiveOperation.getBreakointId() }),
+ new DataRequestMonitor<MIInfo>(getExecutor(), null));
+ fRunToLineActiveOperation = null;
+ fStepInToSelectionActiveOperation = null;
+ }
+ }
+ }
+
+ return false;
+ }
+
private boolean processStepIntoSelection(final MIStoppedEvent e) {
if (fStepInToSelectionActiveOperation == null) {
return false;
}
-
+
// First check if it is the right thread that stopped
- final IMIExecutionDMContext threadDmc = DMContexts.getAncestorOfType(e.getDMContext(), IMIExecutionDMContext.class);
+ final IMIExecutionDMContext threadDmc = DMContexts.getAncestorOfType(e.getDMContext(),
+ IMIExecutionDMContext.class);
if (fStepInToSelectionActiveOperation.getThreadContext().equals(threadDmc)) {
final MIFrame frame = e.getFrame();
- assert(fRunToLineActiveOperation == null);
-
+ assert (fRunToLineActiveOperation == null);
+
if (fStepInToSelectionActiveOperation.getRunToLineFrame() == null) {
- assert(fStepInToSelectionActiveOperation.getLine() == frame.getLine());
+ assert (fStepInToSelectionActiveOperation.getLine() == frame.getLine());
// Shall now be at the runToline location
fStepInToSelectionActiveOperation.setRunToLineFrame(frame);
}
-
+
// Step - Not at the right place just yet
// Initiate an async call chain parent
getStackDepth(threadDmc, new DataRequestMonitor<Integer>(getExecutor(), null) {
@@ -527,18 +542,18 @@ public class GDBRunControl extends MIRunControl {
@Override
protected void handleSuccess() {
int frameDepth = getStackDepth();
-
+
if (frameDepth > originalStackDepth) {
//shall be true as this is using stepinto step type vs instruction stepinto
- assert(frameDepth == originalStackDepth + 1);
-
+ assert (frameDepth == originalStackDepth + 1);
+
// Check for a match
- if (StepIntoSelectionUtils.sameSignature(frame, fStepInToSelectionActiveOperation)) {
+ if (StepIntoSelectionUtils.sameSignature(frame, fStepInToSelectionActiveOperation)) {
// Hit !!
stopStepIntoSelection(e);
return;
}
-
+
// Located deeper in the stack, Shall continue step / search
// Step return
continueStepping(e, StepType.STEP_RETURN);
@@ -555,11 +570,12 @@ public class GDBRunControl extends MIRunControl {
// search line i.e. missed the
// target function !!
StepIntoSelectionUtils.missedSelectedTarget(fStepInToSelectionActiveOperation);
- stopStepIntoSelection(e);
+ stopStepIntoSelection(e);
}
} else {
// missed the target point
- StepIntoSelectionUtils.missedSelectedTarget(fStepInToSelectionActiveOperation); }
+ StepIntoSelectionUtils.missedSelectedTarget(fStepInToSelectionActiveOperation);
+ }
}
@Override
@@ -591,55 +607,57 @@ public class GDBRunControl extends MIRunControl {
return stackDepth.intValue();
}
});
-
+
//Processing step into selection
return true;
}
-
+
//All threads stopped, however outside the scope of the step into selection context
//We need to abort the step into selection and broadcast the stop
fStepInToSelectionActiveOperation = null;
return false;
}
-
+
private void stopStepIntoSelection(final MIStoppedEvent e) {
fStepInToSelectionActiveOperation = null;
// Need to broadcast the stop
super.eventDispatched(e);
- }
+ }
- /**
+ /**
* @since 4.2
*/
- protected int getInterruptTimeout() {
- return IGDBBackend.INTERRUPT_TIMEOUT_DEFAULT;
+ protected int getInterruptTimeout() {
+ return IGDBBackend.INTERRUPT_TIMEOUT_DEFAULT;
}
private void continueStepping(final MIStoppedEvent event, StepType steptype) {
- step(fStepInToSelectionActiveOperation.getThreadContext(), steptype, false, new RequestMonitor(getExecutor(), null) {
- @Override
- protected void handleFailure() {
- // log error
- if (getStatus() != null) {
- GdbPlugin.getDefault().getLog().log(getStatus());
- }
+ step(fStepInToSelectionActiveOperation.getThreadContext(), steptype, false,
+ new RequestMonitor(getExecutor(), null) {
+ @Override
+ protected void handleFailure() {
+ // log error
+ if (getStatus() != null) {
+ GdbPlugin.getDefault().getLog().log(getStatus());
+ }
- stopStepIntoSelection(event);
- }
- });
+ stopStepIntoSelection(event);
+ }
+ });
}
-
+
// ------------------------------------------------------------------------
// Step into Selection
// ------------------------------------------------------------------------
- private void stepIntoSelection(final IExecutionDMContext context, final int baseLine, final String baseLineLocation, final boolean skipBreakpoints, final IFunctionDeclaration targetFunction,
- final RequestMonitor rm) {
+ private void stepIntoSelection(final IExecutionDMContext context, final int baseLine, final String baseLineLocation,
+ final boolean skipBreakpoints, final IFunctionDeclaration targetFunction, final RequestMonitor rm) {
assert context != null;
final IMIExecutionDMContext dmc = DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
if (dmc == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Given context: " + context + " is not an MI execution context.", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR,
+ "Given context: " + context + " is not an MI execution context.", null)); //$NON-NLS-1$ //$NON-NLS-2$
rm.done();
return;
}
@@ -651,7 +669,8 @@ public class GDBRunControl extends MIRunControl {
}
if (fLatestEvent == null || !(fLatestEvent instanceof SuspendedEvent)) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Given context: " + context + " invalid suspended event.", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE,
+ "Given context: " + context + " invalid suspended event.", null)); //$NON-NLS-1$ //$NON-NLS-2$
rm.done();
return;
}
@@ -659,7 +678,8 @@ public class GDBRunControl extends MIRunControl {
SuspendedEvent suspendedEvent = (SuspendedEvent) fLatestEvent;
final MIFrame currentFrame = suspendedEvent.getMIEvent().getFrame();
if (currentFrame == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Given event: " + suspendedEvent + " with invalid frame.", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE,
+ "Given event: " + suspendedEvent + " with invalid frame.", null)); //$NON-NLS-1$ //$NON-NLS-2$
rm.done();
return;
}
@@ -682,14 +702,15 @@ public class GDBRunControl extends MIRunControl {
if ((currentFrame.getFile() + ":" + currentFrame.getLine()).endsWith(baseLineLocation)) { //$NON-NLS-1$
// Save the step into selection information
- fStepInToSelectionActiveOperation = new StepIntoSelectionActiveOperation(dmc, baseLine, targetFunction, framesSize,
- currentFrame);
+ fStepInToSelectionActiveOperation = new StepIntoSelectionActiveOperation(dmc, baseLine,
+ targetFunction, framesSize, currentFrame);
// Ready to step into a function selected
// within a current line
step(dmc, StepType.STEP_INTO, rms);
} else {
// Save the step into selection information
- fStepInToSelectionActiveOperation = new StepIntoSelectionActiveOperation(dmc, baseLine, targetFunction, framesSize, null);
+ fStepInToSelectionActiveOperation = new StepIntoSelectionActiveOperation(dmc, baseLine,
+ targetFunction, framesSize, null);
// Pointing to a line different than the current line
// Needs to RunToLine before stepping to the selection
runToLocation(dmc, baseLineLocation, skipBreakpoints, rms);
@@ -705,42 +726,46 @@ public class GDBRunControl extends MIRunControl {
* @since 4.2
*/
@Override
- public void canStepIntoSelection(IExecutionDMContext context, String sourceFile, int lineNumber, IFunctionDeclaration selectedFunction, DataRequestMonitor<Boolean> rm) {
+ public void canStepIntoSelection(IExecutionDMContext context, String sourceFile, int lineNumber,
+ IFunctionDeclaration selectedFunction, DataRequestMonitor<Boolean> rm) {
canStep(context, StepType.STEP_INTO, rm);
}
-
+
/**
* @since 4.2
*/
@Override
- public void stepIntoSelection(final IExecutionDMContext context, String sourceFile, final int lineNumber, final boolean skipBreakpoints, final IFunctionDeclaration selectedFunction, final RequestMonitor rm) {
+ public void stepIntoSelection(final IExecutionDMContext context, String sourceFile, final int lineNumber,
+ final boolean skipBreakpoints, final IFunctionDeclaration selectedFunction, final RequestMonitor rm) {
determineDebuggerPath(context, sourceFile, new ImmediateDataRequestMonitor<String>(rm) {
@Override
protected void handleSuccess() {
- stepIntoSelection(context, lineNumber, getData() + ":" + Integer.toString(lineNumber), skipBreakpoints, selectedFunction, rm); //$NON-NLS-1$
+ stepIntoSelection(context, lineNumber, getData() + ":" + Integer.toString(lineNumber), skipBreakpoints, //$NON-NLS-1$
+ selectedFunction, rm);
}
});
}
-
+
/**
* Help method used when the stopped event has not been broadcasted e.g. in the middle of step into selection
- *
+ *
* @param dmc
* @param rm
*/
private void getStackDepth(final IMIExecutionDMContext dmc, final DataRequestMonitor<Integer> rm) {
if (dmc != null) {
- fConnection.queueCommand(fCommandFactory.createMIStackInfoDepth(dmc), new DataRequestMonitor<MIStackInfoDepthInfo>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- rm.setData(getData().getDepth());
- rm.done();
- }
- });
+ fConnection.queueCommand(fCommandFactory.createMIStackInfoDepth(dmc),
+ new DataRequestMonitor<MIStackInfoDepthInfo>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ rm.setData(getData().getDepth());
+ rm.done();
+ }
+ });
} else {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid context", null)); //$NON-NLS-1$
rm.done();
}
}
-
+
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0.java
index e286d91ce9b..73dc77835ec 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0.java
@@ -7,12 +7,12 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* Ericsson - Modified for additional functionality
* Ericsson - Version 7.0
- * Nokia - create and use backend service.
+ * Nokia - create and use backend service.
* Ericsson - Added IReverseControl support
* Marc Khouzam (Ericsson) - Added IReverseModeChangedDMEvent (Bug 399163)
* Marc Khouzam (Ericsson) - Started inheriting from GDBRunControl (Bug 405123)
@@ -21,7 +21,6 @@
package org.eclipse.cdt.dsf.gdb.service;
-
import java.util.Hashtable;
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
@@ -51,17 +50,17 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
public class GDBRunControl_7_0 extends GDBRunControl implements IReverseRunControl {
-
+
/** @since 4.2 */
protected static class GdbReverseModeChangedDMEvent extends AbstractDMEvent<ICommandControlDMContext>
- implements IReverseModeChangedDMEvent {
+ implements IReverseModeChangedDMEvent {
private boolean fIsEnabled;
-
+
public GdbReverseModeChangedDMEvent(ICommandControlDMContext context, boolean enabled) {
super(context);
fIsEnabled = enabled;
}
-
+
@Override
public boolean isReverseModeEnabled() {
return fIsEnabled;
@@ -69,14 +68,14 @@ public class GDBRunControl_7_0 extends GDBRunControl implements IReverseRunContr
}
private IMICommandControl fCommandControl;
- private IGDBBackend fGdb;
+ private IGDBBackend fGdb;
private IMIProcesses fProcService;
private CommandFactory fCommandFactory;
private boolean fReverseSupported = true;
private boolean fReverseStepping = false;
private boolean fReverseModeEnabled = false;
-
+
/**
* This variable allows us to know if run control operation
* should be enabled or disabled. Run control operations are
@@ -85,34 +84,34 @@ 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
+ * @since 5.0
*/
public boolean getReverseSupported() {
return fReverseSupported;
}
-
- public GDBRunControl_7_0(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(final RequestMonitor requestMonitor) {
-
- fGdb = getServicesTracker().getService(IGDBBackend.class);
- fProcService = getServicesTracker().getService(IMIProcesses.class);
- fCommandControl = getServicesTracker().getService(IMICommandControl.class);
- fCommandFactory = fCommandControl.getCommandFactory();
+
+ public GDBRunControl_7_0(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(final RequestMonitor requestMonitor) {
+
+ fGdb = getServicesTracker().getService(IGDBBackend.class);
+ fProcService = getServicesTracker().getService(IMIProcesses.class);
+ fCommandControl = getServicesTracker().getService(IMICommandControl.class);
+ fCommandFactory = fCommandControl.getCommandFactory();
if (fGdb.getSessionType() == SessionType.CORE) {
// No execution for core files, so no support for reverse
@@ -120,64 +119,58 @@ public class GDBRunControl_7_0 extends GDBRunControl implements IReverseRunContr
fReverseSupported = false;
}
- register(new String[]{IRunControl.class.getName(),
- IRunControl2.class.getName(),
- IMIRunControl.class.getName(),
- MIRunControl.class.getName(),
- IReverseRunControl.class.getName(),
- GDBRunControl.class.getName(),
- GDBRunControl_7_0.class.getName()},
- new Hashtable<String,String>());
- requestMonitor.done();
- }
-
- @Override
- public void shutdown(final RequestMonitor requestMonitor) {
- unregister();
- super.shutdown(requestMonitor);
- }
-
- @Override
+ register(new String[] { IRunControl.class.getName(), IRunControl2.class.getName(),
+ IMIRunControl.class.getName(), MIRunControl.class.getName(), IReverseRunControl.class.getName(),
+ GDBRunControl.class.getName(), GDBRunControl_7_0.class.getName() }, new Hashtable<String, String>());
+ requestMonitor.done();
+ }
+
+ @Override
+ public void shutdown(final RequestMonitor requestMonitor) {
+ unregister();
+ super.shutdown(requestMonitor);
+ }
+
+ @Override
protected boolean runControlOperationsEnabled() {
return fRunControlOperationsEnabled;
}
- @Override
- public void suspend(IExecutionDMContext context, final RequestMonitor rm){
- canSuspend(
- context,
- new DataRequestMonitor<Boolean>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- if (getData()) {
- fGdb.interruptAndWait(getInterruptTimeout(), rm);
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Context cannot be suspended.", null)); //$NON-NLS-1$
- rm.done();
- }
- }
- });
- }
+ @Override
+ public void suspend(IExecutionDMContext context, final RequestMonitor rm) {
+ canSuspend(context, new DataRequestMonitor<Boolean>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ if (getData()) {
+ fGdb.interruptAndWait(getInterruptTimeout(), rm);
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE,
+ "Context cannot be suspended.", null)); //$NON-NLS-1$
+ rm.done();
+ }
+ }
+ });
+ }
@Override
- public void getExecutionContexts(IContainerDMContext containerDmc, final DataRequestMonitor<IExecutionDMContext[]> rm) {
- fProcService.getProcessesBeingDebugged(
- containerDmc,
- new DataRequestMonitor<IDMContext[]>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- if (getData() instanceof IExecutionDMContext[]) {
- IExecutionDMContext[] execDmcs = (IExecutionDMContext[])getData();
- rm.setData(execDmcs);
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid contexts", null)); //$NON-NLS-1$
- }
- rm.done();
- }
- });
- }
-
- /** @since 2.0 */
+ public void getExecutionContexts(IContainerDMContext containerDmc,
+ final DataRequestMonitor<IExecutionDMContext[]> rm) {
+ fProcService.getProcessesBeingDebugged(containerDmc, new DataRequestMonitor<IDMContext[]>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ if (getData() instanceof IExecutionDMContext[]) {
+ IExecutionDMContext[] execDmcs = (IExecutionDMContext[]) getData();
+ rm.setData(execDmcs);
+ } else {
+ rm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid contexts", null)); //$NON-NLS-1$
+ }
+ rm.done();
+ }
+ });
+ }
+
+ /** @since 2.0 */
@Override
public void canReverseResume(IExecutionDMContext context, DataRequestMonitor<Boolean> rm) {
if (!runControlOperationsEnabled()) {
@@ -190,9 +183,10 @@ public class GDBRunControl_7_0 extends GDBRunControl implements IReverseRunContr
rm.done();
}
- /** @since 2.0 */
+ /** @since 2.0 */
@Override
- public void canReverseStep(final IExecutionDMContext context, StepType stepType, final DataRequestMonitor<Boolean> rm) {
+ public void canReverseStep(final IExecutionDMContext context, StepType stepType,
+ final DataRequestMonitor<Boolean> rm) {
if (!runControlOperationsEnabled()) {
rm.setData(false);
rm.done();
@@ -200,194 +194,199 @@ public class GDBRunControl_7_0 extends GDBRunControl implements IReverseRunContr
}
if (context instanceof IContainerDMContext) {
- rm.setData(false);
- rm.done();
- return;
- }
-
- if (stepType == StepType.STEP_RETURN) {
-
- // Check the stuff we know first, before going to the backend for
- // stack info
- if (!fReverseModeEnabled || !doCanResume(context)) {
- rm.setData(false);
- rm.done();
- return;
- }
-
- // A step return will always be done in the top stack frame.
- // If the top stack frame is the only stack frame, it does not make sense
- // to do a step return since GDB will reject it.
- MIStack stackService = getServicesTracker().getService(MIStack.class);
- if (stackService != null) {
- // Check that the stack is at least two deep.
- stackService.getStackDepth(context, 2, new DataRequestMonitor<Integer>(getExecutor(), rm) {
- @Override
- public void handleCompleted() {
- if (isSuccess() && getData() == 1) {
- rm.setData(false);
- rm.done();
- } else {
- canReverseResume(context, rm);
- }
- }
- });
- return;
- }
- }
-
- canReverseResume(context, rm);
+ rm.setData(false);
+ rm.done();
+ return;
+ }
+
+ if (stepType == StepType.STEP_RETURN) {
+
+ // Check the stuff we know first, before going to the backend for
+ // stack info
+ if (!fReverseModeEnabled || !doCanResume(context)) {
+ rm.setData(false);
+ rm.done();
+ return;
+ }
+
+ // A step return will always be done in the top stack frame.
+ // If the top stack frame is the only stack frame, it does not make sense
+ // to do a step return since GDB will reject it.
+ MIStack stackService = getServicesTracker().getService(MIStack.class);
+ if (stackService != null) {
+ // Check that the stack is at least two deep.
+ stackService.getStackDepth(context, 2, new DataRequestMonitor<Integer>(getExecutor(), rm) {
+ @Override
+ public void handleCompleted() {
+ if (isSuccess() && getData() == 1) {
+ rm.setData(false);
+ rm.done();
+ } else {
+ canReverseResume(context, rm);
+ }
+ }
+ });
+ return;
+ }
+ }
+
+ canReverseResume(context, rm);
}
- /** @since 2.0 */
+ /** @since 2.0 */
@Override
public boolean isReverseStepping(IExecutionDMContext context) {
return !isTerminated() && fReverseStepping;
}
- /** @since 2.0 */
+ /** @since 2.0 */
@Override
public void reverseResume(final IExecutionDMContext context, final RequestMonitor rm) {
if (fReverseModeEnabled && doCanResume(context)) {
ICommand<MIInfo> cmd = null;
- if (context instanceof IContainerDMContext) {
- cmd = fCommandFactory.createMIExecReverseContinue(context);
- } else {
- IMIExecutionDMContext dmc = DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
- if (dmc == null){
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Given context: " + context + " is not an execution context.", null)); //$NON-NLS-1$ //$NON-NLS-2$
- rm.done();
- return;
- }
- cmd = fCommandFactory.createMIExecReverseContinue(dmc);
- }
-
- setResumePending(true);
- // Cygwin GDB will accept commands and execute them after the step
- // which is not what we want, so mark the target as unavailable
- // as soon as we send a resume command.
- getCache().setContextAvailable(context, false);
-
- getConnection().queueCommand(cmd, new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
- @Override
- public void handleFailure() {
- setResumePending(false);
- getCache().setContextAvailable(context, true);
- }
- });
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Given context: " + context + ", is already running or reverse not enabled.", null)); //$NON-NLS-1$ //$NON-NLS-2$
- rm.done();
- }
-
+ if (context instanceof IContainerDMContext) {
+ cmd = fCommandFactory.createMIExecReverseContinue(context);
+ } else {
+ IMIExecutionDMContext dmc = DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
+ if (dmc == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE,
+ "Given context: " + context + " is not an execution context.", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ rm.done();
+ return;
+ }
+ cmd = fCommandFactory.createMIExecReverseContinue(dmc);
+ }
+
+ setResumePending(true);
+ // Cygwin GDB will accept commands and execute them after the step
+ // which is not what we want, so mark the target as unavailable
+ // as soon as we send a resume command.
+ getCache().setContextAvailable(context, false);
+
+ getConnection().queueCommand(cmd, new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
+ @Override
+ public void handleFailure() {
+ setResumePending(false);
+ getCache().setContextAvailable(context, true);
+ }
+ });
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE,
+ "Given context: " + context + ", is already running or reverse not enabled.", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ rm.done();
+ }
+
}
- /** @since 2.0 */
+ /** @since 2.0 */
@Override
public void reverseStep(final IExecutionDMContext context, StepType stepType, final RequestMonitor rm) {
- assert context != null;
+ assert context != null;
+
+ IMIExecutionDMContext dmc = DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
+ if (dmc == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED,
+ "Given context: " + context + " is not an execution context.", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ rm.done();
+ return;
+ }
- IMIExecutionDMContext dmc = DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
- if (dmc == null){
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Given context: " + context + " is not an execution context.", null)); //$NON-NLS-1$ //$NON-NLS-2$
- rm.done();
- return;
+ if (!fReverseModeEnabled || !doCanResume(context)) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Cannot resume context", null)); //$NON-NLS-1$
+ rm.done();
+ return;
}
-
- if (!fReverseModeEnabled || !doCanResume(context)) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Cannot resume context", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- ICommand<MIInfo> cmd = null;
- switch(stepType) {
- case STEP_INTO:
- cmd = fCommandFactory.createMIExecReverseStep(dmc, 1);
- break;
- case STEP_OVER:
- cmd = fCommandFactory.createMIExecReverseNext(dmc, 1);
- break;
- case STEP_RETURN:
- // The -exec-finish command operates on the selected stack frame, but here we always
- // want it to operate on the top stack frame. So we manually create a top-frame
- // context to use with the MI command.
- // We get a local instance of the stack service because the stack service can be shut
- // down before the run control service is shut down. So it is possible for the
- // getService() request below to return null.
- MIStack stackService = getServicesTracker().getService(MIStack.class);
- if (stackService != null) {
- IFrameDMContext topFrameDmc = stackService.createFrameDMContext(dmc, 0);
- cmd = fCommandFactory.createMIExecUncall(topFrameDmc);
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Cannot create context for command, stack service not available.", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
- break;
- case INSTRUCTION_STEP_INTO:
- cmd = fCommandFactory.createMIExecReverseStepInstruction(dmc, 1);
- break;
- case INSTRUCTION_STEP_OVER:
- cmd = fCommandFactory.createMIExecReverseNextInstruction(dmc, 1);
- break;
- default:
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Given step type not supported", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- setResumePending(true);
- fReverseStepping = true;
- getCache().setContextAvailable(context, false);
-
- getConnection().queueCommand(cmd, new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
- @Override
- public void handleFailure() {
- setResumePending(false);
- fReverseStepping = false;
- getCache().setContextAvailable(context, true);
- }
- });
+
+ ICommand<MIInfo> cmd = null;
+ switch (stepType) {
+ case STEP_INTO:
+ cmd = fCommandFactory.createMIExecReverseStep(dmc, 1);
+ break;
+ case STEP_OVER:
+ cmd = fCommandFactory.createMIExecReverseNext(dmc, 1);
+ break;
+ case STEP_RETURN:
+ // The -exec-finish command operates on the selected stack frame, but here we always
+ // want it to operate on the top stack frame. So we manually create a top-frame
+ // context to use with the MI command.
+ // We get a local instance of the stack service because the stack service can be shut
+ // down before the run control service is shut down. So it is possible for the
+ // getService() request below to return null.
+ MIStack stackService = getServicesTracker().getService(MIStack.class);
+ if (stackService != null) {
+ IFrameDMContext topFrameDmc = stackService.createFrameDMContext(dmc, 0);
+ cmd = fCommandFactory.createMIExecUncall(topFrameDmc);
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED,
+ "Cannot create context for command, stack service not available.", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+ break;
+ case INSTRUCTION_STEP_INTO:
+ cmd = fCommandFactory.createMIExecReverseStepInstruction(dmc, 1);
+ break;
+ case INSTRUCTION_STEP_OVER:
+ cmd = fCommandFactory.createMIExecReverseNextInstruction(dmc, 1);
+ break;
+ default:
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Given step type not supported", //$NON-NLS-1$
+ null));
+ rm.done();
+ return;
+ }
+
+ setResumePending(true);
+ fReverseStepping = true;
+ getCache().setContextAvailable(context, false);
+
+ getConnection().queueCommand(cmd, new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
+ @Override
+ public void handleFailure() {
+ setResumePending(false);
+ fReverseStepping = false;
+ getCache().setContextAvailable(context, true);
+ }
+ });
}
- /** @since 2.0 */
+ /** @since 2.0 */
@Override
public void canEnableReverseMode(ICommandControlDMContext context, DataRequestMonitor<Boolean> rm) {
rm.setData(fReverseSupported);
rm.done();
}
- /** @since 2.0 */
+ /** @since 2.0 */
@Override
- public void isReverseModeEnabled(ICommandControlDMContext context, DataRequestMonitor<Boolean> rm) {
+ public void isReverseModeEnabled(ICommandControlDMContext context, DataRequestMonitor<Boolean> rm) {
rm.setData(fReverseModeEnabled);
rm.done();
}
- /** @since 2.0 */
+ /** @since 2.0 */
@Override
- public void enableReverseMode(ICommandControlDMContext context, final boolean enable, final RequestMonitor rm) {
- if (!fReverseSupported) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Reverse mode is not supported.", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- if (fReverseModeEnabled == enable) {
- rm.done();
- return;
- }
-
- getConnection().queueCommand(
- fCommandFactory.createCLIRecord(context, enable),
- new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
- @Override
- public void handleSuccess() {
- setReverseModeEnabled(enable);
- rm.done();
- }
- });
+ public void enableReverseMode(ICommandControlDMContext context, final boolean enable, final RequestMonitor rm) {
+ if (!fReverseSupported) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Reverse mode is not supported.", //$NON-NLS-1$
+ null));
+ rm.done();
+ return;
+ }
+
+ if (fReverseModeEnabled == enable) {
+ rm.done();
+ return;
+ }
+
+ getConnection().queueCommand(fCommandFactory.createCLIRecord(context, enable),
+ new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
+ @Override
+ public void handleSuccess() {
+ setReverseModeEnabled(enable);
+ rm.done();
+ }
+ });
}
// Overridden to use the new MI command -exec-jump
@@ -397,8 +396,9 @@ public class GDBRunControl_7_0 extends GDBRunControl implements IReverseRunContr
assert context != null;
final IMIExecutionDMContext dmc = DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
- if (dmc == null){
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Given context: " + context + " is not an thread execution context.", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ if (dmc == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR,
+ "Given context: " + context + " is not an thread execution context.", null)); //$NON-NLS-1$ //$NON-NLS-2$
rm.done();
return;
}
@@ -408,8 +408,7 @@ public class GDBRunControl_7_0 extends GDBRunControl implements IReverseRunContr
getCache().setContextAvailable(dmc, false);
getConnection().queueCommand(
// The MI command -exec-jump was added in GDB 7.0
- fCommandFactory.createMIExecJump(dmc, location),
- new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
+ fCommandFactory.createMIExecJump(dmc, location), new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
@Override
protected void handleFailure() {
setResumePending(false);
@@ -419,33 +418,34 @@ public class GDBRunControl_7_0 extends GDBRunControl implements IReverseRunContr
}
});
} else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED,
- "Cannot resume given DMC.", null)); //$NON-NLS-1$
- rm.done();
- }
+ rm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Cannot resume given DMC.", null)); //$NON-NLS-1$
+ rm.done();
+ }
}
- /**
+ /**
* @since 3.0
*/
- @DsfServiceEventHandler
- public void eventDispatched(ITraceRecordSelectedChangedDMEvent e) {
- if (e.isVisualizationModeEnabled()) {
- // We have started looking at trace records. We can no longer
- // do run control operations.
- fRunControlOperationsEnabled = false;
- } else {
- // We stopped looking at trace data and gone back to debugger mode
- fRunControlOperationsEnabled = true;
- }
- }
-
- /** @since 2.0 */
- public void setReverseModeEnabled(boolean enabled) {
- if (fReverseModeEnabled != enabled) {
- fReverseModeEnabled = enabled;
- getSession().dispatchEvent(new GdbReverseModeChangedDMEvent(fCommandControl.getContext(), fReverseModeEnabled),
- getProperties());
- }
- }
+ @DsfServiceEventHandler
+ public void eventDispatched(ITraceRecordSelectedChangedDMEvent e) {
+ if (e.isVisualizationModeEnabled()) {
+ // We have started looking at trace records. We can no longer
+ // do run control operations.
+ fRunControlOperationsEnabled = false;
+ } else {
+ // We stopped looking at trace data and gone back to debugger mode
+ fRunControlOperationsEnabled = true;
+ }
+ }
+
+ /** @since 2.0 */
+ public void setReverseModeEnabled(boolean enabled) {
+ if (fReverseModeEnabled != enabled) {
+ fReverseModeEnabled = enabled;
+ getSession().dispatchEvent(
+ new GdbReverseModeChangedDMEvent(fCommandControl.getContext(), fReverseModeEnabled),
+ getProperties());
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0_NS.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0_NS.java
index 80b92f31ca8..51c5dede46e 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0_NS.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0_NS.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* Ericsson AB - Modified for handling of multiple threads
@@ -126,7 +126,8 @@ import org.osgi.framework.BundleContext;
* sync with the service state.
* @since 1.1
*/
-public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunControl, IMultiRunControl, ICachingService, IRunControl3 {
+public class GDBRunControl_7_0_NS extends AbstractDsfService
+ implements IMIRunControl, IMultiRunControl, ICachingService, IRunControl3 {
// /////////////////////////////////////////////////////////////////////////
// CONSTANTS
// /////////////////////////////////////////////////////////////////////////
@@ -135,40 +136,46 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
private static class ExecutionData implements IExecutionDMData2 {
private final StateChangeReason fReason;
private final String fDetails;
-
+
ExecutionData(StateChangeReason reason, String details) {
fReason = reason;
fDetails = details;
}
@Override
- public StateChangeReason getStateChangeReason() { return fReason; }
+ public StateChangeReason getStateChangeReason() {
+ return fReason;
+ }
@Override
- public String getDetails() { return fDetails; }
+ public String getDetails() {
+ return fDetails;
+ }
}
/**
* Base class for events generated by the MI Run Control service. Most events
* generated by the MI Run Control service are directly caused by some MI event.
* Other services may need access to the extended MI data carried in the event.
- *
+ *
* @param <V> DMC that this event refers to
* @param <T> MIInfo object that is the direct cause of this event
* @see MIRunControl
*/
@Immutable
- private static class RunControlEvent<V extends IDMContext, T extends MIEvent<? extends IDMContext>> extends AbstractDMEvent<V>
- implements IDMEvent<V>, IMIDMEvent
- {
+ private static class RunControlEvent<V extends IDMContext, T extends MIEvent<? extends IDMContext>>
+ extends AbstractDMEvent<V> implements IDMEvent<V>, IMIDMEvent {
final private T fMIInfo;
+
public RunControlEvent(V dmc, T miInfo) {
super(dmc);
fMIInfo = miInfo;
}
@Override
- public T getMIEvent() { return fMIInfo; }
+ public T getMIEvent() {
+ return fMIInfo;
+ }
}
/**
@@ -177,18 +184,17 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
*/
@Immutable
protected static class SuspendedEvent extends RunControlEvent<IExecutionDMContext, MIStoppedEvent>
- implements ISuspendedDMEvent
- {
+ implements ISuspendedDMEvent {
SuspendedEvent(IExecutionDMContext ctx, MIStoppedEvent miInfo) {
super(ctx, miInfo);
}
@Override
public StateChangeReason getReason() {
- if (getMIEvent() instanceof MICatchpointHitEvent) { // must precede MIBreakpointHitEvent
+ if (getMIEvent() instanceof MICatchpointHitEvent) { // must precede MIBreakpointHitEvent
return StateChangeReason.EVENT_BREAKPOINT;
- } else if (getMIEvent() instanceof MITracepointSelectedEvent) { // must precede MIBreakpointHitEvent
- return StateChangeReason.UNKNOWN; // Don't display anything here, the details will take care of it
+ } else if (getMIEvent() instanceof MITracepointSelectedEvent) { // must precede MIBreakpointHitEvent
+ return StateChangeReason.UNKNOWN; // Don't display anything here, the details will take care of it
} else if (getMIEvent() instanceof MIBreakpointHitEvent) {
return StateChangeReason.BREAKPOINT;
} else if (getMIEvent() instanceof MISteppingRangeEvent) {
@@ -197,66 +203,63 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
return StateChangeReason.STEP;
} else if (getMIEvent() instanceof MISharedLibEvent) {
return StateChangeReason.SHAREDLIB;
- }else if (getMIEvent() instanceof MISignalEvent) {
+ } else if (getMIEvent() instanceof MISignalEvent) {
return StateChangeReason.SIGNAL;
- }else if (getMIEvent() instanceof MIWatchpointTriggerEvent) {
+ } else if (getMIEvent() instanceof MIWatchpointTriggerEvent) {
return StateChangeReason.WATCHPOINT;
- }else if (getMIEvent() instanceof MIErrorEvent) {
+ } else if (getMIEvent() instanceof MIErrorEvent) {
return StateChangeReason.ERROR;
- }else {
+ } else {
return StateChangeReason.USER_REQUEST;
}
}
-
+
public String getDetails() {
MIStoppedEvent event = getMIEvent();
- if (event instanceof MICatchpointHitEvent) { // must precede MIBreakpointHitEvent
- return ((MICatchpointHitEvent)event).getReason();
- } else if (event instanceof MITracepointSelectedEvent) { // must precede MIBreakpointHitEvent
- return ((MITracepointSelectedEvent)event).getReason();
+ if (event instanceof MICatchpointHitEvent) { // must precede MIBreakpointHitEvent
+ return ((MICatchpointHitEvent) event).getReason();
+ } else if (event instanceof MITracepointSelectedEvent) { // must precede MIBreakpointHitEvent
+ return ((MITracepointSelectedEvent) event).getReason();
} else if (event instanceof MISharedLibEvent) {
- return ((MISharedLibEvent)event).getLibrary();
+ return ((MISharedLibEvent) event).getLibrary();
} else if (event instanceof MISignalEvent) {
- return ((MISignalEvent)event).getName() + ':' + ((MISignalEvent)event).getMeaning();
+ return ((MISignalEvent) event).getName() + ':' + ((MISignalEvent) event).getMeaning();
} else if (event instanceof MIWatchpointTriggerEvent) {
- return ((MIWatchpointTriggerEvent)event).getExpression();
+ return ((MIWatchpointTriggerEvent) event).getExpression();
} else if (event instanceof MIErrorEvent) {
- return ((MIErrorEvent)event).getMessage();
+ return ((MIErrorEvent) event).getMessage();
}
return null;
}
}
- /**
- * Indicates that the given thread has been suspended on a breakpoint.
- * @since 4.0
- */
- @Immutable
- protected static class BreakpointHitEvent extends SuspendedEvent
- implements IBreakpointHitDMEvent
- {
- final private IBreakpointDMContext[] fBreakpoints;
-
- BreakpointHitEvent(IExecutionDMContext ctx, MIBreakpointHitEvent miInfo, IBreakpointDMContext bpCtx) {
- super(ctx, miInfo);
-
- fBreakpoints = new IBreakpointDMContext[] { bpCtx };
- }
-
- @Override
- public IBreakpointDMContext[] getBreakpoints() {
- return fBreakpoints;
- }
- }
+ /**
+ * Indicates that the given thread has been suspended on a breakpoint.
+ * @since 4.0
+ */
+ @Immutable
+ protected static class BreakpointHitEvent extends SuspendedEvent implements IBreakpointHitDMEvent {
+ final private IBreakpointDMContext[] fBreakpoints;
+
+ BreakpointHitEvent(IExecutionDMContext ctx, MIBreakpointHitEvent miInfo, IBreakpointDMContext bpCtx) {
+ super(ctx, miInfo);
+
+ fBreakpoints = new IBreakpointDMContext[] { bpCtx };
+ }
+
+ @Override
+ public IBreakpointDMContext[] getBreakpoints() {
+ return fBreakpoints;
+ }
+ }
/**
* @since 4.0
*/
@Immutable
protected static class ResumedEvent extends RunControlEvent<IExecutionDMContext, MIRunningEvent>
- implements IResumedDMEvent
- {
+ implements IResumedDMEvent {
ResumedEvent(IExecutionDMContext ctx, MIRunningEvent miInfo) {
super(ctx, miInfo);
}
@@ -264,7 +267,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
@Override
public StateChangeReason getReason() {
if (getMIEvent() != null) {
- switch(getMIEvent().getType()) {
+ switch (getMIEvent().getType()) {
case MIRunningEvent.CONTINUE:
return StateChangeReason.USER_REQUEST;
case MIRunningEvent.NEXT:
@@ -288,9 +291,8 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
* @since 4.0
*/
@Immutable
- protected static class StartedDMEvent extends RunControlEvent<IExecutionDMContext,MIThreadCreatedEvent>
- implements IStartedDMEvent
- {
+ protected static class StartedDMEvent extends RunControlEvent<IExecutionDMContext, MIThreadCreatedEvent>
+ implements IStartedDMEvent {
StartedDMEvent(IMIExecutionDMContext executionDmc, MIThreadCreatedEvent miInfo) {
super(executionDmc, miInfo);
}
@@ -300,9 +302,8 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
* @since 4.0
*/
@Immutable
- protected static class ExitedDMEvent extends RunControlEvent<IExecutionDMContext,MIThreadExitEvent>
- implements IExitedDMEvent
- {
+ protected static class ExitedDMEvent extends RunControlEvent<IExecutionDMContext, MIThreadExitEvent>
+ implements IExitedDMEvent {
ExitedDMEvent(IMIExecutionDMContext executionDmc, MIThreadExitEvent miInfo) {
super(executionDmc, miInfo);
}
@@ -338,23 +339,37 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
private String fFileLocation;
private String fAddrLocation;
private boolean fSkipBreakpoints;
-
+
/** @since 5.0 */
- public RunToLineActiveOperation(IMIExecutionDMContext threadContext,
- String bpId, String fileLoc, String addr, boolean skipBreakpoints) {
+ public RunToLineActiveOperation(IMIExecutionDMContext threadContext, String bpId, String fileLoc, String addr,
+ boolean skipBreakpoints) {
fThreadContext = threadContext;
fBpId = bpId;
fFileLocation = fileLoc;
fAddrLocation = addr;
fSkipBreakpoints = skipBreakpoints;
}
-
- public IMIExecutionDMContext getThreadContext() { return fThreadContext; }
+
+ public IMIExecutionDMContext getThreadContext() {
+ return fThreadContext;
+ }
+
/** @since 5.0 */
- public String getBreakpointId() { return fBpId; }
- public String getFileLocation() { return fFileLocation; }
- public String getAddrLocation() { return fAddrLocation; }
- public boolean shouldSkipBreakpoints() { return fSkipBreakpoints; }
+ public String getBreakpointId() {
+ return fBpId;
+ }
+
+ public String getFileLocation() {
+ return fFileLocation;
+ }
+
+ public String getAddrLocation() {
+ return fAddrLocation;
+ }
+
+ public boolean shouldSkipBreakpoints() {
+ return fSkipBreakpoints;
+ }
}
// /////////////////////////////////////////////////////////////////////////
@@ -364,14 +379,14 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
private ICommandControlService fConnection;
private CommandFactory fCommandFactory;
private IGDBProcesses fProcessService;
-
+
private boolean fTerminated = false;
// ThreadStates indexed by the execution context
protected Map<IMIExecutionDMContext, MIThreadRunState> fThreadRunStates = new HashMap<IMIExecutionDMContext, MIThreadRunState>();
private RunToLineActiveOperation fRunToLineActiveOperation = null;
-
+
private StepIntoSelectionActiveOperation fStepInToSelectionActiveOperation = null;
/** @since 4.0 */
@@ -384,18 +399,18 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
fRunToLineActiveOperation = operation;
}
- /**
+ /**
* Set of threads for which the next MIRunning event should be silenced.
*/
private Set<IMIExecutionDMContext> fDisableNextRunningEventDmcSet = new HashSet<IMIExecutionDMContext>();
- /**
+ /**
* Set of threads for which the next MISignal (MIStopped) event should be silenced.
*/
private Set<IMIExecutionDMContext> fDisableNextSignalEventDmcSet = new HashSet<IMIExecutionDMContext>();
- /**
+ /**
* Map that stores the silenced MIStopped event for the specified thread, in case we need to use it for a failure.
*/
- private Map<IMIExecutionDMContext,MIStoppedEvent> fSilencedSignalEventMap = new HashMap<IMIExecutionDMContext, MIStoppedEvent>();
+ private Map<IMIExecutionDMContext, MIStoppedEvent> fSilencedSignalEventMap = new HashMap<IMIExecutionDMContext, MIStoppedEvent>();
/**
* This variable allows us to know if run control operation
@@ -403,12 +418,11 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
* always enabled except when visualizing tracepoints.
*/
private boolean fRunControlOperationsEnabled = true;
-
+
///////////////////////////////////////////////////////////////////////////
// Initialization and shutdown
///////////////////////////////////////////////////////////////////////////
-
public GDBRunControl_7_0_NS(DsfSession session) {
super(session);
}
@@ -424,23 +438,21 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
}
private void doInitialize(final RequestMonitor rm) {
- register(new String[]{ IRunControl.class.getName(),
- IRunControl2.class.getName(),
- IMIRunControl.class.getName(),
- IMultiRunControl.class.getName(),
- IRunControl3.class.getName()},
- new Hashtable<String,String>());
+ register(
+ new String[] { IRunControl.class.getName(), IRunControl2.class.getName(), IMIRunControl.class.getName(),
+ IMultiRunControl.class.getName(), IRunControl3.class.getName() },
+ new Hashtable<String, String>());
fConnection = getServicesTracker().getService(ICommandControlService.class);
fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
fProcessService = getServicesTracker().getService(IGDBProcesses.class);
-
+
getSession().addServiceEventListener(this, null);
rm.done();
}
@Override
public void shutdown(final RequestMonitor rm) {
- unregister();
+ unregister();
getSession().removeServiceEventListener(this);
super.shutdown(rm);
}
@@ -454,7 +466,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
protected void setRunControlOperationsEnabled(boolean runControlEnabled) {
fRunControlOperationsEnabled = runControlEnabled;
}
-
+
///////////////////////////////////////////////////////////////////////////
// AbstractDsfService
///////////////////////////////////////////////////////////////////////////
@@ -488,12 +500,14 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
for (IMIExecutionDMContext threadContext : fThreadRunStates.keySet()) {
if (DMContexts.isAncestorOf(threadContext, context)) {
hasThread = true;
- if (isSuspended(threadContext)) return true;
+ if (isSuspended(threadContext))
+ return true;
}
}
// If this container does not have any threads, it means it wasn't started
// yet or it was terminated, so we can consider it suspended
- if (hasThread == false) return true;
+ if (hasThread == false)
+ return true;
}
// Default case
@@ -506,10 +520,10 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
rm.done(false);
return;
}
-
+
rm.done(doCanSuspend(context));
}
-
+
/**
* @since 4.5
*/
@@ -567,7 +581,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
private void doSuspend(final IMIExecutionDMContext context, final RequestMonitor rm) {
if (!doCanSuspend(context)) {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED,
- "Given context: " + context + ", is already suspended.", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ "Given context: " + context + ", is already suspended.", null)); //$NON-NLS-1$ //$NON-NLS-2$
rm.done();
return;
}
@@ -575,8 +589,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
// Start the job before sending the interrupt command
// to make sure we don't miss the *stopped event
final MonitorSuspendJob monitorJob = new MonitorSuspendJob(context, 0, rm);
- fConnection.queueCommand(
- fCommandFactory.createMIExecInterrupt(context),
+ fConnection.queueCommand(fCommandFactory.createMIExecInterrupt(context),
new ImmediateDataRequestMonitor<MIInfo>() {
@Override
protected void handleSuccess() {
@@ -584,7 +597,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
// will take care of completing the RM once it gets the
// *stopped event.
}
-
+
@Override
protected void handleFailure() {
// In case of failure, we must cancel the monitoring job
@@ -603,93 +616,93 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
protected void doSuspend(IMIContainerDMContext context, final RequestMonitor rm) {
if (!doCanSuspend(context)) {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED,
- "Given context: " + context + ", is already suspended.", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ "Given context: " + context + ", is already suspended.", null)); //$NON-NLS-1$ //$NON-NLS-2$
rm.done();
return;
}
-
+
String groupId = context.getGroupId();
- fConnection.queueCommand(fCommandFactory.createMIExecInterrupt(context, groupId), new DataRequestMonitor<MIInfo>(getExecutor(), rm));
- }
-
- /**
- * Job that waits for a *stopped event after a suspend operation on a thread.
- *
- * If the suspend operation receives its corresponding *stopped event in time,
- * the job will mark the RM with a success status. If the event is not received
- * before the timeout, the job will fail the request monitor.
- *
- * @since 4.5
- */
- protected class MonitorSuspendJob extends Job {
- // Bug 310274. Until we have a preference to configure timeouts,
- // we need a large enough default timeout to accommodate slow
- // remote sessions.
- private final static int TIMEOUT_DEFAULT_VALUE = 5000;
-
- private final RequestMonitor fRequestMonitor;
- private final IMIExecutionDMContext fThread;
-
- public MonitorSuspendJob(IMIExecutionDMContext dmc, int timeout, RequestMonitor rm) {
- super("Suspend monitor job."); //$NON-NLS-1$
- setSystem(true);
- fThread = dmc;
- fRequestMonitor = rm;
-
- if (timeout <= 0) {
- timeout = TIMEOUT_DEFAULT_VALUE; // default of 5 seconds
- }
-
- // Register to listen for the stopped event
- getSession().addServiceEventListener(this, null);
-
- schedule(timeout);
- }
-
- /**
- * Cleanup job and cancel it.
- * This method is required because super.canceling() is only called
- * if the job is actually running.
- */
- public boolean cleanAndCancel() {
- if (getExecutor().isInExecutorThread()) {
- getSession().removeServiceEventListener(this);
- } else {
- getExecutor().submit(
- new DsfRunnable() {
- @Override
- public void run() {
- getSession().removeServiceEventListener(MonitorSuspendJob.this);
- }
- });
- }
- return cancel();
- }
-
- @DsfServiceEventHandler
- public void eventDispatched(MIStoppedEvent e) {
- if (fThread.equals(e.getDMContext())) {
- // The thread we were waiting for did stop
- if (cleanAndCancel()) {
- fRequestMonitor.done();
- }
- }
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- // This will be called when the timeout is hit and no *stopped event was received
- getExecutor().submit(
- new DsfRunnable() {
- @Override
- public void run() {
- getSession().removeServiceEventListener(MonitorSuspendJob.this);
- fRequestMonitor.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.REQUEST_FAILED, "Suspend operation timeout.", null)); //$NON-NLS-1$
- }
- });
- return Status.OK_STATUS;
- }
- }
+ fConnection.queueCommand(fCommandFactory.createMIExecInterrupt(context, groupId),
+ new DataRequestMonitor<MIInfo>(getExecutor(), rm));
+ }
+
+ /**
+ * Job that waits for a *stopped event after a suspend operation on a thread.
+ *
+ * If the suspend operation receives its corresponding *stopped event in time,
+ * the job will mark the RM with a success status. If the event is not received
+ * before the timeout, the job will fail the request monitor.
+ *
+ * @since 4.5
+ */
+ protected class MonitorSuspendJob extends Job {
+ // Bug 310274. Until we have a preference to configure timeouts,
+ // we need a large enough default timeout to accommodate slow
+ // remote sessions.
+ private final static int TIMEOUT_DEFAULT_VALUE = 5000;
+
+ private final RequestMonitor fRequestMonitor;
+ private final IMIExecutionDMContext fThread;
+
+ public MonitorSuspendJob(IMIExecutionDMContext dmc, int timeout, RequestMonitor rm) {
+ super("Suspend monitor job."); //$NON-NLS-1$
+ setSystem(true);
+ fThread = dmc;
+ fRequestMonitor = rm;
+
+ if (timeout <= 0) {
+ timeout = TIMEOUT_DEFAULT_VALUE; // default of 5 seconds
+ }
+
+ // Register to listen for the stopped event
+ getSession().addServiceEventListener(this, null);
+
+ schedule(timeout);
+ }
+
+ /**
+ * Cleanup job and cancel it.
+ * This method is required because super.canceling() is only called
+ * if the job is actually running.
+ */
+ public boolean cleanAndCancel() {
+ if (getExecutor().isInExecutorThread()) {
+ getSession().removeServiceEventListener(this);
+ } else {
+ getExecutor().submit(new DsfRunnable() {
+ @Override
+ public void run() {
+ getSession().removeServiceEventListener(MonitorSuspendJob.this);
+ }
+ });
+ }
+ return cancel();
+ }
+
+ @DsfServiceEventHandler
+ public void eventDispatched(MIStoppedEvent e) {
+ if (fThread.equals(e.getDMContext())) {
+ // The thread we were waiting for did stop
+ if (cleanAndCancel()) {
+ fRequestMonitor.done();
+ }
+ }
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ // This will be called when the timeout is hit and no *stopped event was received
+ getExecutor().submit(new DsfRunnable() {
+ @Override
+ public void run() {
+ getSession().removeServiceEventListener(MonitorSuspendJob.this);
+ fRequestMonitor.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
+ IDsfStatusConstants.REQUEST_FAILED, "Suspend operation timeout.", null)); //$NON-NLS-1$
+ }
+ });
+ return Status.OK_STATUS;
+ }
+ }
// ------------------------------------------------------------------------
// Resume
@@ -701,7 +714,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
rm.done(false);
return;
}
-
+
rm.done(doCanResume(context));
}
@@ -710,7 +723,8 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
// Thread case
if (context instanceof IMIExecutionDMContext) {
MIThreadRunState threadState = fThreadRunStates.get(context);
- return (threadState == null) ? false : !fTerminated && threadState.fSuspended && !threadState.fResumePending;
+ return (threadState == null) ? false
+ : !fTerminated && threadState.fSuspended && !threadState.fResumePending;
}
// Process case
@@ -756,40 +770,42 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
private void doResume(IMIExecutionDMContext context, final RequestMonitor rm) {
if (!doCanResume(context)) {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE,
- "Given context: " + context + ", is already running.", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ "Given context: " + context + ", is already running.", null)); //$NON-NLS-1$ //$NON-NLS-2$
rm.done();
return;
}
final MIThreadRunState threadState = fThreadRunStates.get(context);
if (threadState == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE,
- "Given context: " + context + " can't be found.", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE,
+ "Given context: " + context + " can't be found.", null)); //$NON-NLS-1$ //$NON-NLS-2$
rm.done();
return;
}
-
+
threadState.fResumePending = true;
- fConnection.queueCommand(fCommandFactory.createMIExecContinue(context), new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
- @Override
- protected void handleFailure() {
- threadState.fResumePending = false;
- super.handleFailure();
- }
- });
+ fConnection.queueCommand(fCommandFactory.createMIExecContinue(context),
+ new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
+ @Override
+ protected void handleFailure() {
+ threadState.fResumePending = false;
+ super.handleFailure();
+ }
+ });
}
/** @since 5.0 */
protected void doResume(IMIContainerDMContext context, final RequestMonitor rm) {
if (!doCanResume(context)) {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE,
- "Given context: " + context + ", is already running.", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ "Given context: " + context + ", is already running.", null)); //$NON-NLS-1$ //$NON-NLS-2$
rm.done();
return;
}
String groupId = context.getGroupId();
- fConnection.queueCommand(fCommandFactory.createMIExecContinue(context, groupId), new DataRequestMonitor<MIInfo>(getExecutor(), rm));
+ fConnection.queueCommand(fCommandFactory.createMIExecContinue(context, groupId),
+ new DataRequestMonitor<MIInfo>(getExecutor(), rm));
}
// ------------------------------------------------------------------------
@@ -815,29 +831,29 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
rm.done(false);
return;
}
-
+
// If it's a thread, just look it up
if (context instanceof IMIExecutionDMContext) {
- if (stepType == StepType.STEP_RETURN) {
- // A step return will always be done in the top stack frame.
- // If the top stack frame is the only stack frame, it does not make sense
- // to do a step return since GDB will reject it.
- MIStack stackService = getServicesTracker().getService(MIStack.class);
- if (stackService != null) {
- // Check that the stack is at least two deep.
- stackService.getStackDepth(context, 2, new DataRequestMonitor<Integer>(getExecutor(), rm) {
- @Override
- public void handleCompleted() {
- if (isSuccess() && getData() == 1) {
- rm.done(false);
- } else {
- canResume(context, rm);
- }
- }
- });
- return;
- }
- }
+ if (stepType == StepType.STEP_RETURN) {
+ // A step return will always be done in the top stack frame.
+ // If the top stack frame is the only stack frame, it does not make sense
+ // to do a step return since GDB will reject it.
+ MIStack stackService = getServicesTracker().getService(MIStack.class);
+ if (stackService != null) {
+ // Check that the stack is at least two deep.
+ stackService.getStackDepth(context, 2, new DataRequestMonitor<Integer>(getExecutor(), rm) {
+ @Override
+ public void handleCompleted() {
+ if (isSuccess() && getData() == 1) {
+ rm.done(false);
+ } else {
+ canResume(context, rm);
+ }
+ }
+ });
+ return;
+ }
+ }
canResume(context, rm);
return;
@@ -859,7 +875,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
IMIExecutionDMContext dmc = DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
if (dmc == null) {
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR,
- "Given context: " + context + " is not an MI execution context.", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ "Given context: " + context + " is not an MI execution context.", null)); //$NON-NLS-1$ //$NON-NLS-2$
return;
}
@@ -871,7 +887,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
final MIThreadRunState threadState = fThreadRunStates.get(context);
if (threadState == null) {
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE,
- "Given context: " + context + " can't be found.", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ "Given context: " + context + " can't be found.", null)); //$NON-NLS-1$ //$NON-NLS-2$
return;
}
@@ -907,11 +923,11 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
cmd = fCommandFactory.createMIExecNextInstruction(dmc);
break;
default:
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
- INTERNAL_ERROR, "Given step type not supported", null)); //$NON-NLS-1$
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Given step type not supported", //$NON-NLS-1$
+ null));
return;
}
-
+
threadState.fResumePending = true;
threadState.fStepping = true;
fConnection.queueCommand(cmd, new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
@@ -921,7 +937,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
threadState.fStepping = false;
super.handleFailure();
- }
+ }
});
}
@@ -929,77 +945,80 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
// Run to line
// ------------------------------------------------------------------------
- private void runToLocation(final IExecutionDMContext context, final String location, final boolean skipBreakpoints, final RequestMonitor rm){
+ private void runToLocation(final IExecutionDMContext context, final String location, final boolean skipBreakpoints,
+ final RequestMonitor rm) {
assert context != null;
final IMIExecutionDMContext dmc = DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
if (dmc == null) {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR,
- "Given context: " + context + " is not an MI execution context.", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ "Given context: " + context + " is not an MI execution context.", null)); //$NON-NLS-1$ //$NON-NLS-2$
rm.done();
return;
}
if (!doCanResume(dmc)) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE,
- "Cannot resume context", null)); //$NON-NLS-1$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Cannot resume context", null)); //$NON-NLS-1$
rm.done();
return;
}
MIThreadRunState threadState = fThreadRunStates.get(dmc);
if (threadState == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE,
- "Given context: " + context + " can't be found.", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE,
+ "Given context: " + context + " can't be found.", null)); //$NON-NLS-1$ //$NON-NLS-2$
rm.done();
return;
}
- IBreakpointsTargetDMContext bpDmc = DMContexts.getAncestorOfType(context, IBreakpointsTargetDMContext.class);
- fConnection.queueCommand(
- fCommandFactory.createMIBreakInsert(bpDmc, true, false, null, 0,
- location, dmc.getThreadId()),
- new DataRequestMonitor<MIBreakInsertInfo>(getExecutor(), rm) {
- @Override
- public void handleSuccess() {
- // We must set are RunToLineActiveOperation *before* we do the resume
- // or else we may get the stopped event, before we have set this variable.
- String bpId = getData().getMIBreakpoints()[0].getNumber();
- String addr = getData().getMIBreakpoints()[0].getAddress();
- fRunToLineActiveOperation = new RunToLineActiveOperation(dmc, bpId, location, addr, skipBreakpoints);
-
- resume(dmc, new RequestMonitor(getExecutor(), rm) {
- @Override
- public void handleFailure() {
- IBreakpointsTargetDMContext bpDmc = DMContexts.getAncestorOfType(fRunToLineActiveOperation.getThreadContext(),
- IBreakpointsTargetDMContext.class);
- String bpId = fRunToLineActiveOperation.getBreakpointId();
-
- fConnection.queueCommand(fCommandFactory.createMIBreakDelete(bpDmc, new String[] {bpId}),
- new DataRequestMonitor<MIInfo>(getExecutor(), null));
- fRunToLineActiveOperation = null;
- fStepInToSelectionActiveOperation = null;
+ IBreakpointsTargetDMContext bpDmc = DMContexts.getAncestorOfType(context, IBreakpointsTargetDMContext.class);
+ fConnection.queueCommand(
+ fCommandFactory.createMIBreakInsert(bpDmc, true, false, null, 0, location, dmc.getThreadId()),
+ new DataRequestMonitor<MIBreakInsertInfo>(getExecutor(), rm) {
+ @Override
+ public void handleSuccess() {
+ // We must set are RunToLineActiveOperation *before* we do the resume
+ // or else we may get the stopped event, before we have set this variable.
+ String bpId = getData().getMIBreakpoints()[0].getNumber();
+ String addr = getData().getMIBreakpoints()[0].getAddress();
+ fRunToLineActiveOperation = new RunToLineActiveOperation(dmc, bpId, location, addr,
+ skipBreakpoints);
+
+ resume(dmc, new RequestMonitor(getExecutor(), rm) {
+ @Override
+ public void handleFailure() {
+ IBreakpointsTargetDMContext bpDmc = DMContexts.getAncestorOfType(
+ fRunToLineActiveOperation.getThreadContext(),
+ IBreakpointsTargetDMContext.class);
+ String bpId = fRunToLineActiveOperation.getBreakpointId();
+
+ fConnection.queueCommand(
+ fCommandFactory.createMIBreakDelete(bpDmc, new String[] { bpId }),
+ new DataRequestMonitor<MIInfo>(getExecutor(), null));
+ fRunToLineActiveOperation = null;
+ fStepInToSelectionActiveOperation = null;
- super.handleFailure();
- }
- });
- }
- });
+ super.handleFailure();
+ }
+ });
+ }
+ });
}
// ------------------------------------------------------------------------
// Step into Selection
// ------------------------------------------------------------------------
- private void stepIntoSelection(final IExecutionDMContext context, final int baseLine, final String baseLineLocation, final boolean skipBreakpoints, final IFunctionDeclaration targetFunction,
- final RequestMonitor rm) {
+ private void stepIntoSelection(final IExecutionDMContext context, final int baseLine, final String baseLineLocation,
+ final boolean skipBreakpoints, final IFunctionDeclaration targetFunction, final RequestMonitor rm) {
assert context != null;
final IMIExecutionDMContext dmc = DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
if (dmc == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Given context: " + context + " is not an MI execution context.", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR,
+ "Given context: " + context + " is not an MI execution context.", null)); //$NON-NLS-1$ //$NON-NLS-2$
rm.done();
return;
}
@@ -1012,13 +1031,15 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
MIThreadRunState threadState = fThreadRunStates.get(dmc);
if (threadState == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Given context: " + context + " can't be found.", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE,
+ "Given context: " + context + " can't be found.", null)); //$NON-NLS-1$ //$NON-NLS-2$
rm.done();
return;
}
if (threadState.fLatestEvent == null || !(threadState.fLatestEvent instanceof SuspendedEvent)) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Given context: " + context + " invalid suspended event.", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE,
+ "Given context: " + context + " invalid suspended event.", null)); //$NON-NLS-1$ //$NON-NLS-2$
rm.done();
return;
}
@@ -1026,7 +1047,8 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
SuspendedEvent suspendedEvent = (SuspendedEvent) threadState.fLatestEvent;
final MIFrame currentFrame = suspendedEvent.getMIEvent().getFrame();
if (currentFrame == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Given event: " + suspendedEvent + " invalid frame in suspended event.", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE,
+ "Given event: " + suspendedEvent + " invalid frame in suspended event.", null)); //$NON-NLS-1$ //$NON-NLS-2$
rm.done();
return;
}
@@ -1049,14 +1071,15 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
if ((currentFrame.getFile() + ":" + currentFrame.getLine()).endsWith(baseLineLocation)) { //$NON-NLS-1$
// Save the step into selection information
- fStepInToSelectionActiveOperation = new StepIntoSelectionActiveOperation(dmc, baseLine, targetFunction, framesSize,
- currentFrame);
+ fStepInToSelectionActiveOperation = new StepIntoSelectionActiveOperation(dmc, baseLine,
+ targetFunction, framesSize, currentFrame);
// Ready to step into a function selected
// within a current line
step(dmc, StepType.STEP_INTO, rms);
} else {
// Save the step into selection information
- fStepInToSelectionActiveOperation = new StepIntoSelectionActiveOperation(dmc, baseLine, targetFunction, framesSize, null);
+ fStepInToSelectionActiveOperation = new StepIntoSelectionActiveOperation(dmc, baseLine,
+ targetFunction, framesSize, null);
// Pointing to a line different than the current line
// Needs to RunToLine before stepping to the selection
runToLocation(dmc, baseLineLocation, skipBreakpoints, rms);
@@ -1077,29 +1100,27 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
final IMIExecutionDMContext dmc = DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
if (dmc == null) {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR,
- "Given context: " + context + " is not an MI execution context.", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ "Given context: " + context + " is not an MI execution context.", null)); //$NON-NLS-1$ //$NON-NLS-2$
rm.done();
return;
}
if (!doCanResume(dmc)) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE,
- "Cannot resume context", null)); //$NON-NLS-1$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Cannot resume context", null)); //$NON-NLS-1$
rm.done();
return;
}
final MIThreadRunState threadState = fThreadRunStates.get(dmc);
if (threadState == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE,
- "Given context: " + context + " can't be found.", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE,
+ "Given context: " + context + " can't be found.", null)); //$NON-NLS-1$ //$NON-NLS-2$
rm.done();
return;
}
threadState.fResumePending = true;
- fConnection.queueCommand(
- fCommandFactory.createMIExecJump(dmc, location),
+ fConnection.queueCommand(fCommandFactory.createMIExecJump(dmc, location),
new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
@Override
protected void handleFailure() {
@@ -1113,55 +1134,55 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
// ------------------------------------------------------------------------
@Override
- public void getExecutionContexts(final IContainerDMContext containerDmc, final DataRequestMonitor<IExecutionDMContext[]> rm) {
- IMIProcesses procService = getServicesTracker().getService(IMIProcesses.class);
- procService.getProcessesBeingDebugged(
- containerDmc,
- new DataRequestMonitor<IDMContext[]>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- if (getData() instanceof IExecutionDMContext[]) {
- rm.setData((IExecutionDMContext[])getData());
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid contexts", null)); //$NON-NLS-1$
- }
- rm.done();
- }
- });
+ public void getExecutionContexts(final IContainerDMContext containerDmc,
+ final DataRequestMonitor<IExecutionDMContext[]> rm) {
+ IMIProcesses procService = getServicesTracker().getService(IMIProcesses.class);
+ procService.getProcessesBeingDebugged(containerDmc, new DataRequestMonitor<IDMContext[]>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ if (getData() instanceof IExecutionDMContext[]) {
+ rm.setData((IExecutionDMContext[]) getData());
+ } else {
+ rm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid contexts", null)); //$NON-NLS-1$
+ }
+ rm.done();
+ }
+ });
}
@Override
public void getExecutionData(IExecutionDMContext dmc, DataRequestMonitor<IExecutionDMData> rm) {
MIThreadRunState threadState = fThreadRunStates.get(dmc);
if (threadState == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,INVALID_HANDLE,
- "Given context: " + dmc + " is not a recognized execution context.", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE,
+ "Given context: " + dmc + " is not a recognized execution context.", null)); //$NON-NLS-1$ //$NON-NLS-2$
rm.done();
return;
}
if (dmc instanceof IMIExecutionDMContext) {
- rm.setData(new ExecutionData(threadState.fSuspended ? threadState.fStateChangeReason : null, threadState.fStateChangeDetails));
+ rm.setData(new ExecutionData(threadState.fSuspended ? threadState.fStateChangeReason : null,
+ threadState.fStateChangeDetails));
} else {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE,
- "Given context: " + dmc + " is not a recognized execution context.", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ "Given context: " + dmc + " is not a recognized execution context.", null)); //$NON-NLS-1$ //$NON-NLS-2$
}
rm.done();
}
-
private IMIExecutionDMContext createMIExecutionContext(IContainerDMContext container, String threadId) {
- IMIProcesses procService = getServicesTracker().getService(IMIProcesses.class);
+ IMIProcesses procService = getServicesTracker().getService(IMIProcesses.class);
- IProcessDMContext procDmc = DMContexts.getAncestorOfType(container, IProcessDMContext.class);
-
- IThreadDMContext threadDmc = null;
- if (procDmc != null) {
- // For now, reuse the threadId as the OSThreadId
- threadDmc = procService.createThreadContext(procDmc, threadId);
- }
+ IProcessDMContext procDmc = DMContexts.getAncestorOfType(container, IProcessDMContext.class);
- return procService.createExecutionContext(container, threadDmc, threadId);
+ IThreadDMContext threadDmc = null;
+ if (procDmc != null) {
+ // For now, reuse the threadId as the OSThreadId
+ threadDmc = procService.createThreadContext(procDmc, threadId);
+ }
+
+ return procService.createExecutionContext(container, threadDmc, threadId);
}
private void updateThreadState(IMIExecutionDMContext context, ResumedEvent event) {
@@ -1175,7 +1196,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
threadState.fSuspended = false;
threadState.fResumePending = false;
threadState.fStateChangeReason = reason;
- threadState.fStateChangeDetails = null; // we have no details of interest for a resume
+ threadState.fStateChangeDetails = null; // we have no details of interest for a resume
threadState.fStepping = isStepping;
threadState.fLatestEvent = event;
}
@@ -1202,31 +1223,31 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
* in non-stop mode, it turns out that GDB has trouble with some commands
* like breakpoints. The safe way to do it is to make sure we have at least
* one thread suspended.
- *
+ *
* Basically, we must make sure one thread is suspended before making
- * certain operations (currently breakpoints). If that is not the case, we must
+ * certain operations (currently breakpoints). If that is not the case, we must
* first suspend one thread, then perform the specified operations,
* and finally resume that thread..
* See https://bugs.eclipse.org/bugs/show_bug.cgi?id=242943
* and https://bugs.eclipse.org/bugs/show_bug.cgi?id=282273
- *
- * Note that for multi-process, we need to interrupt all processes
- * that share the same binary before doing a breakpoint operation on any of
- * those processes. For simplicity, the logic below interrupts one thread of
- * every process being debugged, without differentiating on the executable.
- * Although it may seem wasteful to interrupt all processes when not necessary,
- * in truth it is not so much; when making a breakpoint operation in Eclipse, that
- * operation is propagated to all processes anyway, so they will all need to be
- * interrupted. The case where we are wasteful is when we start or stop debugging
- * a process (starting a process, attaching to one, auto-attaching to one,
- * detaching from one, terminating one); in those cases, we only want to apply the
- * breakpoint operation to that one process and any other using the same binary.
- * The wastefulness is not such a big deal for that case, and is worth the simpler
- * solution.
- * Of course, it can always be improved later on.
+ *
+ * Note that for multi-process, we need to interrupt all processes
+ * that share the same binary before doing a breakpoint operation on any of
+ * those processes. For simplicity, the logic below interrupts one thread of
+ * every process being debugged, without differentiating on the executable.
+ * Although it may seem wasteful to interrupt all processes when not necessary,
+ * in truth it is not so much; when making a breakpoint operation in Eclipse, that
+ * operation is propagated to all processes anyway, so they will all need to be
+ * interrupted. The case where we are wasteful is when we start or stop debugging
+ * a process (starting a process, attaching to one, auto-attaching to one,
+ * detaching from one, terminating one); in those cases, we only want to apply the
+ * breakpoint operation to that one process and any other using the same binary.
+ * The wastefulness is not such a big deal for that case, and is worth the simpler
+ * solution.
+ * Of course, it can always be improved later on.
* See http://bugs.eclipse.org/337893
* ******************************************************************************/
-
+
/**
* Utility class to store the parameters of the executeWithTargetAvailable() operations.
* @since 4.0
@@ -1235,7 +1256,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
public IDMContext ctx;
public Sequence.Step[] steps;
public RequestMonitor rm;
-
+
public TargetAvailableOperationInfo(IDMContext ctx, Step[] steps, RequestMonitor rm) {
super();
this.ctx = ctx;
@@ -1243,7 +1264,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
this.rm = rm;
}
};
-
+
// The set of threads that we will actually be suspended to make the containers suspended.
private Set<IMIExecutionDMContext> fExecutionDmcToSuspendSet = new HashSet<IMIExecutionDMContext>();
@@ -1253,7 +1274,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
// This allows us to know if we can add more steps to execute or if we missed
// our opportunity
private boolean fCurrentlyExecutingSteps;
-
+
// MultiRequestMonitor that allows us to track all the different steps we are
// executing. Once all steps are executed, we can complete this MultiRM and
// allow the global sequence to continue.
@@ -1268,25 +1289,25 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
private int fNumStepsStillExecuting;
// Queue of executeWithTargetAvailable() operations that need to be processed.
private LinkedList<TargetAvailableOperationInfo> fOperationsPending = new LinkedList<TargetAvailableOperationInfo>();
-
- /**
- * Returns whether there is currently an ExecuteWithTargetAvailable() operation ongoing.
- * @since 4.0
+
+ /**
+ * Returns whether there is currently an ExecuteWithTargetAvailable() operation ongoing.
+ * @since 4.0
*/
protected boolean isTargetAvailableOperationOngoing() {
return fOngoingOperation;
}
-
+
/** @since 4.0 */
protected void setTargetAvailableOperationOngoing(boolean ongoing) {
fOngoingOperation = ongoing;
}
-
+
/**
* Returns whether we are current in the process of executing the steps
* that were passed to ExecuteWithTargetAvailable().
* When this value is true, we can send more steps to be executed.
- * @since 4.0
+ * @since 4.0
*/
protected boolean isCurrentlyExecutingSteps() {
return fCurrentlyExecutingSteps;
@@ -1299,24 +1320,23 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
/**
* Returns the requestMonitor that will be run once all steps sent to
- * ExecuteWithTargetAvailable() have been executed.
- * @since 4.0
+ * ExecuteWithTargetAvailable() have been executed.
+ * @since 4.0
*/
protected MultiRequestMonitor<RequestMonitor> getExecuteQueuedStepsRM() {
return fExecuteQueuedOpsStepMonitor;
}
-
+
/** @since 4.0 */
protected void setExecuteQueuedStepsRM(MultiRequestMonitor<RequestMonitor> rm) {
fExecuteQueuedOpsStepMonitor = rm;
}
-
/**
* Returns the number of batches of steps sent to ExecuteWithTargetAvailable()
* that are still executing. Once this number reaches zero, we can complete
* the overall ExecuteWithTargetAvailable() operation.
- * @since 4.0
+ * @since 4.0
*/
protected int getNumStepsStillExecuting() {
return fNumStepsStillExecuting;
@@ -1344,7 +1364,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
*/
protected void executeSteps(final TargetAvailableOperationInfo info) {
fNumStepsStillExecuting++;
-
+
// This RM propagates any error to the original rm of the actual steps.
// Even in case of errors for these steps, we want to continue the overall sequence
RequestMonitor stepsRm = new ImmediateRequestMonitor() {
@@ -1369,10 +1389,13 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
fExecuteQueuedOpsStepMonitor.add(stepsRm);
getExecutor().execute(new Sequence(getExecutor(), stepsRm) {
- @Override public Step[] getSteps() { return info.steps; }
- });
+ @Override
+ public Step[] getSteps() {
+ return info.steps;
+ }
+ });
}
-
+
/**
* @since 3.0
*/
@@ -1385,30 +1408,27 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
// We always go through our queue, even if we only have a single call to this method
fOperationsPending.add(new TargetAvailableOperationInfo(ctx, steps, rm));
-
+
// Steps that need to be executed to perform the operation
- final Step[] sequenceSteps = new Step[] {
- new IsTargetAvailableStep(ctx),
- new MakeTargetAvailableStep(),
- new ExecuteQueuedOperationsStep(),
- new RestoreTargetStateStep(),
- };
-
+ final Step[] sequenceSteps = new Step[] { new IsTargetAvailableStep(ctx), new MakeTargetAvailableStep(),
+ new ExecuteQueuedOperationsStep(), new RestoreTargetStateStep(), };
+
// Once all the sequence is completed, we need to see if we have received
// another request that we now need to process
RequestMonitor sequenceCompletedRm = new RequestMonitor(getExecutor(), null) {
@Override
protected void handleSuccess() {
- fOngoingOperation = false;
-
- if (!fOperationsPending.isEmpty()) {
- // Darn, more operations came in. Trigger their processing
- // by calling executeWithTargetAvailable() on the last one
- TargetAvailableOperationInfo info = fOperationsPending.removeLast();
- executeWithTargetAvailable(info.ctx, info.steps, info.rm);
- }
- // no other rm.done() needs to be called, they have all been handled already
+ fOngoingOperation = false;
+
+ if (!fOperationsPending.isEmpty()) {
+ // Darn, more operations came in. Trigger their processing
+ // by calling executeWithTargetAvailable() on the last one
+ TargetAvailableOperationInfo info = fOperationsPending.removeLast();
+ executeWithTargetAvailable(info.ctx, info.steps, info.rm);
+ }
+ // no other rm.done() needs to be called, they have all been handled already
}
+
@Override
protected void handleFailure() {
// If the sequence failed, we have to give up on the operation(s).
@@ -1425,9 +1445,12 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
super.handleFailure();
}
};
-
+
getExecutor().execute(new Sequence(getExecutor(), sequenceCompletedRm) {
- @Override public Step[] getSteps() { return sequenceSteps; }
+ @Override
+ public Step[] getSteps() {
+ return sequenceSteps;
+ }
});
} else {
// We are currently already executing such an operation
@@ -1441,45 +1464,41 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
}
}
}
-
-
+
/**
* This part of the sequence looks for all threads that will need to be suspended.
* @since 3.0
*/
protected class IsTargetAvailableStep extends Sequence.Step {
final IDMContext fCtx;
-
+
public IsTargetAvailableStep(IDMContext ctx) {
fCtx = ctx;
}
-
+
private void getThreadToSuspend(IContainerDMContext containerDmc, final RequestMonitor rm) {
// If the process is running, get its first thread which we will need to suspend
- fProcessService.getProcessesBeingDebugged(
- containerDmc,
- new ImmediateDataRequestMonitor<IDMContext[]>(rm) {
- @Override
- protected void handleSuccess() {
- IDMContext[] threads = getData();
- if (threads != null && threads.length > 0) {
- // Choose the first thread as the one to suspend
- fExecutionDmcToSuspendSet.add((IMIExecutionDMContext)threads[0]);
- }
- rm.done();
- }
- });
+ fProcessService.getProcessesBeingDebugged(containerDmc, new ImmediateDataRequestMonitor<IDMContext[]>(rm) {
+ @Override
+ protected void handleSuccess() {
+ IDMContext[] threads = getData();
+ if (threads != null && threads.length > 0) {
+ // Choose the first thread as the one to suspend
+ fExecutionDmcToSuspendSet.add((IMIExecutionDMContext) threads[0]);
+ }
+ rm.done();
+ }
+ });
}
@Override
public void execute(final RequestMonitor rm) {
// Clear any old data before we start
fExecutionDmcToSuspendSet.clear();
-
+
// Get all processes being debugged to see which one are running
// and need to be interrupted
- fProcessService.getProcessesBeingDebugged(
- fConnection.getContext(),
+ fProcessService.getProcessesBeingDebugged(fConnection.getContext(),
new ImmediateDataRequestMonitor<IDMContext[]>(rm) {
@Override
protected void handleSuccess() {
@@ -1493,10 +1512,10 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
// Go through every process to see if it is running.
// If it is running, get its first thread so we can interrupt it.
CountingRequestMonitor crm = new ImmediateCountingRequestMonitor(rm);
-
+
int numThreadsToSuspend = 0;
for (IDMContext dmc : getData()) {
- IContainerDMContext containerDmc = (IContainerDMContext)dmc;
+ IContainerDMContext containerDmc = (IContainerDMContext) dmc;
if (!isSuspended(containerDmc)) {
numThreadsToSuspend++;
getThreadToSuspend(containerDmc, crm);
@@ -1515,17 +1534,17 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
*/
protected class MakeTargetAvailableStep extends Sequence.Step {
- /* public constructor required, so upper classes can override executeWithTargetAvailable */
- /** @since 4.5 */
- public MakeTargetAvailableStep() {
- }
+ /* public constructor required, so upper classes can override executeWithTargetAvailable */
+ /** @since 4.5 */
+ public MakeTargetAvailableStep() {
+ }
@Override
public void execute(final RequestMonitor rm) {
// Interrupt every first thread of the running processes
CountingRequestMonitor crm = new ImmediateCountingRequestMonitor(rm);
crm.setDoneCount(fExecutionDmcToSuspendSet.size());
-
+
for (final IMIExecutionDMContext thread : fExecutionDmcToSuspendSet) {
assert !fDisableNextRunningEventDmcSet.contains(thread);
assert !fDisableNextSignalEventDmcSet.contains(thread);
@@ -1533,8 +1552,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
// Don't broadcast the next stopped signal event
fDisableNextSignalEventDmcSet.add(thread);
- suspend(thread,
- new ImmediateRequestMonitor(crm) {
+ suspend(thread, new ImmediateRequestMonitor(crm) {
@Override
protected void handleFailure() {
// We weren't able to suspend, so abort the operation
@@ -1547,8 +1565,8 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
@Override
public void rollBack(RequestMonitor rm) {
- Sequence.Step restoreStep = new RestoreTargetStateStep();
- restoreStep.execute(rm);
+ Sequence.Step restoreStep = new RestoreTargetStateStep();
+ restoreStep.execute(rm);
}
};
@@ -1559,25 +1577,26 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
*/
protected class ExecuteQueuedOperationsStep extends Sequence.Step {
- /* public constructor required, so upper classes can override executeWithTargetAvailable */
- /** @since 4.5 */
- public ExecuteQueuedOperationsStep() {
- }
+ /* public constructor required, so upper classes can override executeWithTargetAvailable */
+ /** @since 4.5 */
+ public ExecuteQueuedOperationsStep() {
+ }
@Override
public void execute(final RequestMonitor rm) {
fCurrentlyExecutingSteps = true;
-
+
// It is important to use an ImmediateExecutor for this RM, to make sure we don't risk getting a new
// call to ExecuteWithTargetAvailable() when we just finished executing the steps.
- fExecuteQueuedOpsStepMonitor = new MultiRequestMonitor<RequestMonitor>(ImmediateExecutor.getInstance(), rm) {
+ fExecuteQueuedOpsStepMonitor = new MultiRequestMonitor<RequestMonitor>(ImmediateExecutor.getInstance(),
+ rm) {
@Override
protected void handleCompleted() {
assert fOperationsPending.size() == 0;
-
+
// We don't handle errors here. Instead, we have already propagated any
// errors to each rm for each set of steps
-
+
fCurrentlyExecutingSteps = false;
// Continue the sequence
rm.done();
@@ -1585,15 +1604,15 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
};
// Tell the RM that we need to confirm when we are done adding sub-rms
fExecuteQueuedOpsStepMonitor.requireDoneAdding();
-
+
// All pending operations are independent of each other so we can
// run them concurrently.
while (!fOperationsPending.isEmpty()) {
- executeSteps(fOperationsPending.poll());
+ executeSteps(fOperationsPending.poll());
}
}
};
-
+
/**
* If the sequence had to interrupt the execution context of interest,
* this step will resume it again to reach the same state as when we started.
@@ -1601,17 +1620,17 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
*/
protected class RestoreTargetStateStep extends Sequence.Step {
- /* public constructor required, so upper classes can override executeWithTargetAvailable */
- /** @since 4.5 */
- public RestoreTargetStateStep() {
- }
+ /* public constructor required, so upper classes can override executeWithTargetAvailable */
+ /** @since 4.5 */
+ public RestoreTargetStateStep() {
+ }
@Override
public void execute(final RequestMonitor rm) {
// Resume every thread we had interrupted
CountingRequestMonitor crm = new ImmediateCountingRequestMonitor(rm);
crm.setDoneCount(fExecutionDmcToSuspendSet.size());
-
+
for (final IMIExecutionDMContext thread : fExecutionDmcToSuspendSet) {
assert !fDisableNextRunningEventDmcSet.contains(thread);
@@ -1619,8 +1638,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
// Can't use the resume() call because we 'silently' stopped
// so resume() will not know we are actually stopped
- fConnection.queueCommand(
- fCommandFactory.createMIExecContinue(thread),
+ fConnection.queueCommand(fCommandFactory.createMIExecContinue(thread),
new ImmediateDataRequestMonitor<MIInfo>(crm) {
@Override
protected void handleSuccess() {
@@ -1650,18 +1668,18 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
}
};
- /* ******************************************************************************
- * End of section to support operations even when the target is unavailable.
- * ******************************************************************************/
+ /* ******************************************************************************
+ * End of section to support operations even when the target is unavailable.
+ * ******************************************************************************/
///////////////////////////////////////////////////////////////////////////
// Event handlers
///////////////////////////////////////////////////////////////////////////
- /**
- * @nooverride This method is not intended to be re-implemented or extended by clients.
- * @noreference This method is not intended to be referenced by clients.
- */
+ /**
+ * @nooverride This method is not intended to be re-implemented or extended by clients.
+ * @noreference This method is not intended to be referenced by clients.
+ */
@DsfServiceEventHandler
public void eventDispatched(final MIRunningEvent e) {
if (fDisableNextRunningEventDmcSet.remove(e.getDMContext())) {
@@ -1689,15 +1707,15 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
}
}
- /**
- * @nooverride This method is not intended to be re-implemented or extended by clients.
- * @noreference This method is not intended to be referenced by clients.
- */
+ /**
+ * @nooverride This method is not intended to be re-implemented or extended by clients.
+ * @noreference This method is not intended to be referenced by clients.
+ */
@DsfServiceEventHandler
public void eventDispatched(final MIStoppedEvent e) {
- // A disabled signal event is due to interrupting the target
- // to set a breakpoint. This can happen during a run-to-line
- // or step-into operation, so we need to check it first.
+ // A disabled signal event is due to interrupting the target
+ // to set a breakpoint. This can happen during a run-to-line
+ // or step-into operation, so we need to check it first.
IMIExecutionDMContext threadDmc = DMContexts.getAncestorOfType(e.getDMContext(), IMIExecutionDMContext.class);
if (e instanceof MISignalEvent && fDisableNextSignalEventDmcSet.remove(threadDmc)) {
fSilencedSignalEventMap.put(threadDmc, e);
@@ -1721,7 +1739,8 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
MIBreakpointDMContext bp = null;
if (e instanceof MIBreakpointHitEvent) {
String bpId = ((MIBreakpointHitEvent) e).getNumber();
- IBreakpointsTargetDMContext bpsTarget = DMContexts.getAncestorOfType(e.getDMContext(), IBreakpointsTargetDMContext.class);
+ IBreakpointsTargetDMContext bpsTarget = DMContexts.getAncestorOfType(e.getDMContext(),
+ IBreakpointsTargetDMContext.class);
if (bpsTarget != null && !bpId.isEmpty()) {
bp = new MIBreakpointDMContext(getSession().getId(), new IDMContext[] { bpsTarget }, bpId);
event = new BreakpointHitEvent(e.getDMContext(), (MIBreakpointHitEvent) e, bp);
@@ -1738,20 +1757,21 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
if (fStepInToSelectionActiveOperation == null) {
return false;
}
-
+
// First check if it is the right thread that stopped
- final IMIExecutionDMContext threadDmc = DMContexts.getAncestorOfType(e.getDMContext(), IMIExecutionDMContext.class);
+ final IMIExecutionDMContext threadDmc = DMContexts.getAncestorOfType(e.getDMContext(),
+ IMIExecutionDMContext.class);
if (fStepInToSelectionActiveOperation.getThreadContext().equals(threadDmc)) {
final MIFrame frame = e.getFrame();
- assert(fRunToLineActiveOperation == null);
-
+ assert (fRunToLineActiveOperation == null);
+
if (fStepInToSelectionActiveOperation.getRunToLineFrame() == null) {
- assert(fStepInToSelectionActiveOperation.getLine() == frame.getLine());
+ assert (fStepInToSelectionActiveOperation.getLine() == frame.getLine());
// Shall now be at the runToline location
fStepInToSelectionActiveOperation.setRunToLineFrame(frame);
}
-
+
// Step - Not at the right place just yet
// Initiate an async call chain parent
getStackDepth(threadDmc, new DataRequestMonitor<Integer>(getExecutor(), null) {
@@ -1760,18 +1780,18 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
@Override
protected void handleSuccess() {
int frameDepth = getStackDepth();
-
+
if (frameDepth > originalStackDepth) {
//shall be true as this is using stepinto step type vs instruction stepinto
- assert(frameDepth == originalStackDepth + 1);
-
+ assert (frameDepth == originalStackDepth + 1);
+
// Check for a match
- if (StepIntoSelectionUtils.sameSignature(frame, fStepInToSelectionActiveOperation)) {
+ if (StepIntoSelectionUtils.sameSignature(frame, fStepInToSelectionActiveOperation)) {
// Hit !!
stopStepIntoSelection(e);
return;
}
-
+
// Located deeper in the stack, Shall continue step / search
// Step return
continueStepping(e, StepType.STEP_RETURN);
@@ -1788,7 +1808,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
// search line i.e. missed the
// target function !!
StepIntoSelectionUtils.missedSelectedTarget(fStepInToSelectionActiveOperation);
- stopStepIntoSelection(e);
+ stopStepIntoSelection(e);
}
} else {
// missed the target point
@@ -1825,11 +1845,11 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
return stackDepth.intValue();
}
});
-
+
//Processing step into selection
return true;
}
-
+
//The thread related to this event is outside the scope of the step into selection context
return false;
}
@@ -1841,24 +1861,25 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
}
private void continueStepping(final MIStoppedEvent event, StepType steptype) {
- step(fStepInToSelectionActiveOperation.getThreadContext(), steptype, false, new RequestMonitor(getExecutor(), null) {
- @Override
- protected void handleFailure() {
- // log error
- if (getStatus() != null) {
- GdbPlugin.getDefault().getLog().log(getStatus());
- }
+ step(fStepInToSelectionActiveOperation.getThreadContext(), steptype, false,
+ new RequestMonitor(getExecutor(), null) {
+ @Override
+ protected void handleFailure() {
+ // log error
+ if (getStatus() != null) {
+ GdbPlugin.getDefault().getLog().log(getStatus());
+ }
- stopStepIntoSelection(event);
- }
- });
+ stopStepIntoSelection(event);
+ }
+ });
}
private boolean processRunToLineStoppedEvent(final MIStoppedEvent e) {
if (fRunToLineActiveOperation == null) {
return false;
}
-
+
// First check if it is the right thread that stopped
IMIExecutionDMContext threadDmc = DMContexts.getAncestorOfType(e.getDMContext(), IMIExecutionDMContext.class);
if (fRunToLineActiveOperation.getThreadContext().equals(threadDmc)) {
@@ -1881,7 +1902,8 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
// So this works for the large majority of cases. The case that won't work is when the user
// does a runToLine to a line that is non-executable AND has another breakpoint AND
// has multiple addresses for the breakpoint. I'm mean, come on!
- if (fileLocation.equals(fRunToLineActiveOperation.getFileLocation()) || addrLocation.equals(fRunToLineActiveOperation.getAddrLocation())
+ if (fileLocation.equals(fRunToLineActiveOperation.getFileLocation())
+ || addrLocation.equals(fRunToLineActiveOperation.getAddrLocation())
|| bpId.equals(fRunToLineActiveOperation.getBreakpointId())) {
// We stopped at the right place. All is well.
// Run to line completed
@@ -1889,7 +1911,9 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
} else {
// The right thread stopped but not at the right place yet
if (fRunToLineActiveOperation.shouldSkipBreakpoints() && e instanceof MIBreakpointHitEvent) {
- fConnection.queueCommand(fCommandFactory.createMIExecContinue(fRunToLineActiveOperation.getThreadContext()), new DataRequestMonitor<MIInfo>(getExecutor(), null));
+ fConnection.queueCommand(
+ fCommandFactory.createMIExecContinue(fRunToLineActiveOperation.getThreadContext()),
+ new DataRequestMonitor<MIInfo>(getExecutor(), null));
// Continue i.e. Don't send the stop event since we are
// resuming again.
@@ -1901,9 +1925,13 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
// Note that in Non-stop, we don't cancel a run-to-line when a new
// breakpoint is inserted. This is because the new breakpoint could
// be for another thread altogether and should not affect the current thread.
- IBreakpointsTargetDMContext bpDmc = DMContexts.getAncestorOfType(fRunToLineActiveOperation.getThreadContext(), IBreakpointsTargetDMContext.class);
+ IBreakpointsTargetDMContext bpDmc = DMContexts.getAncestorOfType(
+ fRunToLineActiveOperation.getThreadContext(), IBreakpointsTargetDMContext.class);
- fConnection.queueCommand(fCommandFactory.createMIBreakDelete(bpDmc, new String[] { fRunToLineActiveOperation.getBreakpointId() }), new DataRequestMonitor<MIInfo>(getExecutor(), null));
+ fConnection.queueCommand(
+ fCommandFactory.createMIBreakDelete(bpDmc,
+ new String[] { fRunToLineActiveOperation.getBreakpointId() }),
+ new DataRequestMonitor<MIInfo>(getExecutor(), null));
fRunToLineActiveOperation = null;
fStepInToSelectionActiveOperation = null;
}
@@ -1924,13 +1952,13 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
if (e.getStrId() != null) {
executionCtx = createMIExecutionContext(containerDmc, e.getStrId());
}
- getSession().dispatchEvent(new StartedDMEvent(executionCtx, e), getProperties());
+ getSession().dispatchEvent(new StartedDMEvent(executionCtx, e), getProperties());
}
- /**
- * @nooverride This method is not intended to be re-implemented or extended by clients.
- * @noreference This method is not intended to be referenced by clients.
- */
+ /**
+ * @nooverride This method is not intended to be re-implemented or extended by clients.
+ * @noreference This method is not intended to be referenced by clients.
+ */
@DsfServiceEventHandler
public void eventDispatched(final MIThreadExitEvent e) {
IContainerDMContext containerDmc = e.getDMContext();
@@ -1941,82 +1969,81 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
getSession().dispatchEvent(new ExitedDMEvent(executionCtx, e), getProperties());
}
- /**
- * @nooverride This method is not intended to be re-implemented or extended by clients.
- * @noreference This method is not intended to be referenced by clients.
- */
+ /**
+ * @nooverride This method is not intended to be re-implemented or extended by clients.
+ * @noreference This method is not intended to be referenced by clients.
+ */
@DsfServiceEventHandler
public void eventDispatched(ResumedEvent e) {
IExecutionDMContext ctx = e.getDMContext();
- if (ctx instanceof IMIExecutionDMContext) {
- updateThreadState((IMIExecutionDMContext)ctx, e);
+ if (ctx instanceof IMIExecutionDMContext) {
+ updateThreadState((IMIExecutionDMContext) ctx, e);
}
}
- /**
- * @nooverride This method is not intended to be re-implemented or extended by clients.
- * @noreference This method is not intended to be referenced by clients.
- */
+ /**
+ * @nooverride This method is not intended to be re-implemented or extended by clients.
+ * @noreference This method is not intended to be referenced by clients.
+ */
@DsfServiceEventHandler
public void eventDispatched(SuspendedEvent e) {
IExecutionDMContext ctx = e.getDMContext();
- if (ctx instanceof IMIExecutionDMContext) {
- updateThreadState((IMIExecutionDMContext)ctx, e);
+ if (ctx instanceof IMIExecutionDMContext) {
+ updateThreadState((IMIExecutionDMContext) ctx, e);
}
}
- /**
- * @nooverride This method is not intended to be re-implemented or extended by clients.
- * @noreference This method is not intended to be referenced by clients.
- */
+ /**
+ * @nooverride This method is not intended to be re-implemented or extended by clients.
+ * @noreference This method is not intended to be referenced by clients.
+ */
@DsfServiceEventHandler
public void eventDispatched(StartedDMEvent e) {
IExecutionDMContext executionCtx = e.getDMContext();
- if (executionCtx instanceof IMIExecutionDMContext) {
+ if (executionCtx instanceof IMIExecutionDMContext) {
if (fThreadRunStates.get(executionCtx) == null) {
- fThreadRunStates.put((IMIExecutionDMContext)executionCtx, new MIThreadRunState());
+ fThreadRunStates.put((IMIExecutionDMContext) executionCtx, new MIThreadRunState());
}
}
}
- /**
- * @nooverride This method is not intended to be re-implemented or extended by clients.
- * @noreference This method is not intended to be referenced by clients.
- */
+ /**
+ * @nooverride This method is not intended to be re-implemented or extended by clients.
+ * @noreference This method is not intended to be referenced by clients.
+ */
@DsfServiceEventHandler
public void eventDispatched(ExitedDMEvent e) {
fThreadRunStates.remove(e.getDMContext());
}
-
- /**
- * @nooverride This method is not intended to be re-implemented or extended by clients.
- * @noreference This method is not intended to be referenced by clients.
- */
+
+ /**
+ * @nooverride This method is not intended to be re-implemented or extended by clients.
+ * @noreference This method is not intended to be referenced by clients.
+ */
@DsfServiceEventHandler
public void eventDispatched(ICommandControlShutdownDMEvent e) {
fTerminated = true;
}
+ /**
+ * @nooverride This method is not intended to be re-implemented or extended by clients.
+ * @noreference This method is not intended to be referenced by clients.
+ *
+ * @since 2.0
+ */
+ @DsfServiceEventHandler
+ public void eventDispatched(MIInferiorExitEvent e) {
+ if (fRunToLineActiveOperation != null) {
+ IBreakpointsTargetDMContext bpDmc = DMContexts
+ .getAncestorOfType(fRunToLineActiveOperation.getThreadContext(), IBreakpointsTargetDMContext.class);
+ String bpId = fRunToLineActiveOperation.getBreakpointId();
- /**
- * @nooverride This method is not intended to be re-implemented or extended by clients.
- * @noreference This method is not intended to be referenced by clients.
- *
- * @since 2.0
- */
- @DsfServiceEventHandler
- public void eventDispatched(MIInferiorExitEvent e) {
- if (fRunToLineActiveOperation != null) {
- IBreakpointsTargetDMContext bpDmc = DMContexts.getAncestorOfType(fRunToLineActiveOperation.getThreadContext(),
- IBreakpointsTargetDMContext.class);
- String bpId = fRunToLineActiveOperation.getBreakpointId();
-
- fConnection.queueCommand(fCommandFactory.createMIBreakDelete(bpDmc, new String[] {bpId}),
- new DataRequestMonitor<MIInfo>(getExecutor(), null));
- fRunToLineActiveOperation = null;
- }
- fStepInToSelectionActiveOperation = null;
- }
+ fConnection.queueCommand(fCommandFactory.createMIBreakDelete(bpDmc, new String[] { bpId }),
+ new DataRequestMonitor<MIInfo>(getExecutor(), null));
+ fRunToLineActiveOperation = null;
+ }
+ fStepInToSelectionActiveOperation = null;
+ }
@Override
public void flushCache(IDMContext context) {
@@ -2028,52 +2055,51 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
* @since 4.1
*/
protected void refreshThreadStates() {
- fConnection.queueCommand(
- fCommandFactory.createMIThreadInfo(fConnection.getContext()),
- new DataRequestMonitor<MIThreadInfoInfo>(getExecutor(), null) {
- @Override
- protected void handleSuccess() {
- MIThread[] threadList = getData().getThreadList();
- for (MIThread thread : threadList) {
- String threadId = thread.getThreadId();
- IMIContainerDMContext containerDmc =
- fProcessService.createContainerContextFromThreadId(fConnection.getContext(), threadId);
- IProcessDMContext processDmc = DMContexts.getAncestorOfType(containerDmc, IProcessDMContext.class);
- IThreadDMContext threadDmc =
- fProcessService.createThreadContext(processDmc, threadId);
- IMIExecutionDMContext execDmc = fProcessService.createExecutionContext(containerDmc, threadDmc, threadId);
-
- MIThreadRunState threadState = fThreadRunStates.get(execDmc);
- if (threadState != null) {
- // We may not know this thread. This can happen when dealing with a remote
- // where thread events are not reported immediately.
- // However, the -thread-info command we just sent will make
- // GDB send those events. Therefore, we can just ignore threads we don't
- // know about, and wait for those events.
- if (MIThread.MI_THREAD_STATE_RUNNING.equals(thread.getState())) {
- if (threadState.fSuspended == true) {
- // We missed a resumed event! Send it now.
- IResumedDMEvent resumedEvent = new ResumedEvent(execDmc, null);
- fConnection.getSession().dispatchEvent(resumedEvent, getProperties());
- }
- } else if (MIThread.MI_THREAD_STATE_STOPPED.equals(thread.getState())) {
- if (threadState.fSuspended == false) {
- // We missed a suspend event! Send it now.
- ISuspendedDMEvent suspendedEvent = new SuspendedEvent(execDmc, null);
- fConnection.getSession().dispatchEvent(suspendedEvent, getProperties());
+ fConnection.queueCommand(fCommandFactory.createMIThreadInfo(fConnection.getContext()),
+ new DataRequestMonitor<MIThreadInfoInfo>(getExecutor(), null) {
+ @Override
+ protected void handleSuccess() {
+ MIThread[] threadList = getData().getThreadList();
+ for (MIThread thread : threadList) {
+ String threadId = thread.getThreadId();
+ IMIContainerDMContext containerDmc = fProcessService
+ .createContainerContextFromThreadId(fConnection.getContext(), threadId);
+ IProcessDMContext processDmc = DMContexts.getAncestorOfType(containerDmc,
+ IProcessDMContext.class);
+ IThreadDMContext threadDmc = fProcessService.createThreadContext(processDmc, threadId);
+ IMIExecutionDMContext execDmc = fProcessService.createExecutionContext(containerDmc,
+ threadDmc, threadId);
+
+ MIThreadRunState threadState = fThreadRunStates.get(execDmc);
+ if (threadState != null) {
+ // We may not know this thread. This can happen when dealing with a remote
+ // where thread events are not reported immediately.
+ // However, the -thread-info command we just sent will make
+ // GDB send those events. Therefore, we can just ignore threads we don't
+ // know about, and wait for those events.
+ if (MIThread.MI_THREAD_STATE_RUNNING.equals(thread.getState())) {
+ if (threadState.fSuspended == true) {
+ // We missed a resumed event! Send it now.
+ IResumedDMEvent resumedEvent = new ResumedEvent(execDmc, null);
+ fConnection.getSession().dispatchEvent(resumedEvent, getProperties());
+ }
+ } else if (MIThread.MI_THREAD_STATE_STOPPED.equals(thread.getState())) {
+ if (threadState.fSuspended == false) {
+ // We missed a suspend event! Send it now.
+ ISuspendedDMEvent suspendedEvent = new SuspendedEvent(execDmc, null);
+ fConnection.getSession().dispatchEvent(suspendedEvent, getProperties());
+ }
+ } else {
+ assert false : "Invalid thread state: " + thread.getState(); //$NON-NLS-1$
}
- } else {
- assert false : "Invalid thread state: " + thread.getState(); //$NON-NLS-1$
}
}
}
- }
- });
+ });
}
-
- private void moveToLocation(final IExecutionDMContext context,
- final String location, final Map<String, Object> bpAttributes,
- final RequestMonitor rm) {
+
+ private void moveToLocation(final IExecutionDMContext context, final String location,
+ final Map<String, Object> bpAttributes, final RequestMonitor rm) {
// first create a temporary breakpoint to stop the execution at
// the location we are about to jump to
@@ -2081,7 +2107,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
IBreakpointsTargetDMContext bpDmc = DMContexts.getAncestorOfType(context, IBreakpointsTargetDMContext.class);
if (bpService != null && bpDmc != null) {
bpService.insertBreakpoint(bpDmc, bpAttributes,
- new DataRequestMonitor<IBreakpointDMContext>(getExecutor(),rm) {
+ new DataRequestMonitor<IBreakpointDMContext>(getExecutor(), rm) {
@Override
protected void handleSuccess() {
// Now resume at the proper location
@@ -2089,8 +2115,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
}
});
} else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
- IDsfStatusConstants.NOT_SUPPORTED,
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED,
"Unable to set breakpoint", null)); //$NON-NLS-1$
rm.done();
}
@@ -2103,8 +2128,8 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
* @since 3.0
*/
@Override
- public void canRunToLine(IExecutionDMContext context, String sourceFile,
- int lineNumber, DataRequestMonitor<Boolean> rm) {
+ public void canRunToLine(IExecutionDMContext context, String sourceFile, int lineNumber,
+ DataRequestMonitor<Boolean> rm) {
canResume(context, rm);
}
@@ -2115,15 +2140,15 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
* @since 3.0
*/
@Override
- public void runToLine(final IExecutionDMContext context, String sourceFile,
- final int lineNumber, final boolean skipBreakpoints, final RequestMonitor rm) {
-
- determineDebuggerPath(context, sourceFile, new ImmediateDataRequestMonitor<String>(rm) {
- @Override
- protected void handleSuccess() {
- runToLocation(context, getData() + ":" + Integer.toString(lineNumber), skipBreakpoints, rm); //$NON-NLS-1$
- }
- });
+ public void runToLine(final IExecutionDMContext context, String sourceFile, final int lineNumber,
+ final boolean skipBreakpoints, final RequestMonitor rm) {
+
+ determineDebuggerPath(context, sourceFile, new ImmediateDataRequestMonitor<String>(rm) {
+ @Override
+ protected void handleSuccess() {
+ runToLocation(context, getData() + ":" + Integer.toString(lineNumber), skipBreakpoints, rm); //$NON-NLS-1$
+ }
+ });
}
/* (non-Javadoc)
@@ -2133,8 +2158,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
* @since 3.0
*/
@Override
- public void canRunToAddress(IExecutionDMContext context, IAddress address,
- DataRequestMonitor<Boolean> rm) {
+ public void canRunToAddress(IExecutionDMContext context, IAddress address, DataRequestMonitor<Boolean> rm) {
canResume(context, rm);
}
@@ -2145,8 +2169,8 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
* @since 3.0
*/
@Override
- public void runToAddress(IExecutionDMContext context, IAddress address,
- boolean skipBreakpoints, RequestMonitor rm) {
+ public void runToAddress(IExecutionDMContext context, IAddress address, boolean skipBreakpoints,
+ RequestMonitor rm) {
runToLocation(context, "*0x" + address.toString(16), skipBreakpoints, rm); //$NON-NLS-1$
}
@@ -2157,9 +2181,10 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
* @since 3.0
*/
@Override
- public void canMoveToLine(IExecutionDMContext context, String sourceFile,
- int lineNumber, boolean resume, DataRequestMonitor<Boolean> rm) {
- canResume(context, rm); }
+ public void canMoveToLine(IExecutionDMContext context, String sourceFile, int lineNumber, boolean resume,
+ DataRequestMonitor<Boolean> rm) {
+ canResume(context, rm);
+ }
/* (non-Javadoc)
* @see org.eclipse.cdt.dsf.debug.service.IRunControl2#moveToLine(org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext, java.lang.String, int, boolean, org.eclipse.cdt.dsf.concurrent.RequestMonitor)
@@ -2168,37 +2193,36 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
* @since 3.0
*/
@Override
- public void moveToLine(final IExecutionDMContext context, String sourceFile,
- final int lineNumber, final boolean resume, final RequestMonitor rm) {
+ public void moveToLine(final IExecutionDMContext context, String sourceFile, final int lineNumber,
+ final boolean resume, final RequestMonitor rm) {
final IMIExecutionDMContext threadExecDmc = DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
if (threadExecDmc == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Invalid thread context", null)); //$NON-NLS-1$
- rm.done();
- }
- else
- {
- determineDebuggerPath(context, sourceFile, new ImmediateDataRequestMonitor<String>(rm) {
- @Override
- protected void handleSuccess() {
- String debuggerPath = getData();
-
- String location = debuggerPath + ":" + lineNumber; //$NON-NLS-1$
- if (resume) {
- resumeAtLocation(context, location, rm);
- } else {
- // Create the breakpoint attributes
- Map<String,Object> attr = new HashMap<String,Object>();
- attr.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.BREAKPOINT);
- attr.put(MIBreakpoints.FILE_NAME, debuggerPath);
- attr.put(MIBreakpoints.LINE_NUMBER, lineNumber);
- attr.put(MIBreakpointDMData.IS_TEMPORARY, true);
- attr.put(MIBreakpointDMData.THREAD_ID, threadExecDmc.getThreadId());
-
- // Now do the operation
- moveToLocation(context, location, attr, rm);
- }
- }
- });
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED,
+ "Invalid thread context", null)); //$NON-NLS-1$
+ rm.done();
+ } else {
+ determineDebuggerPath(context, sourceFile, new ImmediateDataRequestMonitor<String>(rm) {
+ @Override
+ protected void handleSuccess() {
+ String debuggerPath = getData();
+
+ String location = debuggerPath + ":" + lineNumber; //$NON-NLS-1$
+ if (resume) {
+ resumeAtLocation(context, location, rm);
+ } else {
+ // Create the breakpoint attributes
+ Map<String, Object> attr = new HashMap<String, Object>();
+ attr.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.BREAKPOINT);
+ attr.put(MIBreakpoints.FILE_NAME, debuggerPath);
+ attr.put(MIBreakpoints.LINE_NUMBER, lineNumber);
+ attr.put(MIBreakpointDMData.IS_TEMPORARY, true);
+ attr.put(MIBreakpointDMData.THREAD_ID, threadExecDmc.getThreadId());
+
+ // Now do the operation
+ moveToLocation(context, location, attr, rm);
+ }
+ }
+ });
}
}
@@ -2209,36 +2233,33 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
* @since 3.0
*/
@Override
- public void canMoveToAddress(IExecutionDMContext context, IAddress address,
- boolean resume, DataRequestMonitor<Boolean> rm) {
+ public void canMoveToAddress(IExecutionDMContext context, IAddress address, boolean resume,
+ DataRequestMonitor<Boolean> rm) {
canResume(context, rm);
- }
+ }
/** (non-Javadoc)
* @see org.eclipse.cdt.dsf.debug.service.IRunControl2#moveToAddress(org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext, org.eclipse.cdt.core.IAddress, boolean, org.eclipse.cdt.dsf.concurrent.RequestMonitor)
* @since 3.0
*/
@Override
- public void moveToAddress(IExecutionDMContext context, IAddress address,
- boolean resume, RequestMonitor rm) {
+ public void moveToAddress(IExecutionDMContext context, IAddress address, boolean resume, RequestMonitor rm) {
IMIExecutionDMContext threadExecDmc = DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
if (threadExecDmc == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Invalid thread context", null)); //$NON-NLS-1$
- rm.done();
- }
- else
- {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED,
+ "Invalid thread context", null)); //$NON-NLS-1$
+ rm.done();
+ } else {
String location = "*0x" + address.toString(16); //$NON-NLS-1$
if (resume)
resumeAtLocation(context, location, rm);
- else
- {
+ else {
// Create the breakpoint attributes
- Map<String,Object> attr = new HashMap<String,Object>();
+ Map<String, Object> attr = new HashMap<String, Object>();
attr.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.BREAKPOINT);
attr.put(MIBreakpoints.ADDRESS, "0x" + address.toString(16)); //$NON-NLS-1$
attr.put(MIBreakpointDMData.IS_TEMPORARY, true);
- attr.put(MIBreakpointDMData.THREAD_ID, threadExecDmc.getThreadId());
+ attr.put(MIBreakpointDMData.THREAD_ID, threadExecDmc.getThreadId());
// Now do the operation
moveToLocation(context, location, attr, rm);
@@ -2261,45 +2282,45 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
/**
* Determine the path that should be sent to the debugger as per the source lookup service.
- *
+ *
* @param dmc A context that can be used to obtain the sourcelookup context.
* @param hostPath The path of the file on the host, which must be converted.
* @param rm The result of the conversion.
*/
- private void determineDebuggerPath(IDMContext dmc, String hostPath, final DataRequestMonitor<String> rm)
- {
- ISourceLookup sourceLookup = getServicesTracker().getService(ISourceLookup.class);
- ISourceLookupDMContext srcDmc = DMContexts.getAncestorOfType(dmc, ISourceLookupDMContext.class);
- if (sourceLookup == null || srcDmc == null) {
- // Source lookup not available for given context, use the host
- // path for the debugger path.
- // Hack around a MinGW bug; see 369622 (and also 196154 and 232415)
- rm.done(adjustDebuggerPath(hostPath));
- return;
- }
-
- sourceLookup.getDebuggerPath(srcDmc, hostPath, new DataRequestMonitor<String>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- // Hack around a MinGW bug; see 369622 (and also 196154 and 232415)
- rm.done(adjustDebuggerPath(getData()));
- }
- });
- }
-
- /**
+ private void determineDebuggerPath(IDMContext dmc, String hostPath, final DataRequestMonitor<String> rm) {
+ ISourceLookup sourceLookup = getServicesTracker().getService(ISourceLookup.class);
+ ISourceLookupDMContext srcDmc = DMContexts.getAncestorOfType(dmc, ISourceLookupDMContext.class);
+ if (sourceLookup == null || srcDmc == null) {
+ // Source lookup not available for given context, use the host
+ // path for the debugger path.
+ // Hack around a MinGW bug; see 369622 (and also 196154 and 232415)
+ rm.done(adjustDebuggerPath(hostPath));
+ return;
+ }
+
+ sourceLookup.getDebuggerPath(srcDmc, hostPath, new DataRequestMonitor<String>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ // Hack around a MinGW bug; see 369622 (and also 196154 and 232415)
+ rm.done(adjustDebuggerPath(getData()));
+ }
+ });
+ }
+
+ /**
* See bug 196154
- *
+ *
* @param path
* the absolute path to the source file
* @return the adjusted path provided by the breakpoints service
*/
- private String adjustDebuggerPath(String path) {
- IBreakpoints breakpoints = getServicesTracker().getService(IBreakpoints.class);
- return (breakpoints instanceof IMIBreakpointPathAdjuster) ?
- ((IMIBreakpointPathAdjuster)breakpoints).adjustDebuggerPath(path) : path;
- }
-
+ private String adjustDebuggerPath(String path) {
+ IBreakpoints breakpoints = getServicesTracker().getService(IBreakpoints.class);
+ return (breakpoints instanceof IMIBreakpointPathAdjuster)
+ ? ((IMIBreakpointPathAdjuster) breakpoints).adjustDebuggerPath(path)
+ : path;
+ }
+
///////////////////////////////////////////////////////////////////////////
// IMultiRunControl implementation
///////////////////////////////////////////////////////////////////////////
@@ -2310,321 +2331,331 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
///////////////////////////////////////////////////////////////////////////
// Multi-resume implementation:
- //
- // If one or more more threads of one or many processes are selected, we want to
- // resume each thread (once).
- //
- // If one or more more processes are selected, we want to resume each process (once).
- //
- // If a process is selected along with one or more threads of that same process,
- // what does the user want us to do? Selecting the process will resume all its
- // threads, but what do we do with the selected threads? Why are they
- // selected? In an attempt to be user friendly, lets assume that the user
- // wants to resume the entire process, so we ignore the selected threads part of that
- // process since they will be resumed anyway.
- //
- // The same logic applies to multi-suspend.
+ //
+ // If one or more more threads of one or many processes are selected, we want to
+ // resume each thread (once).
+ //
+ // If one or more more processes are selected, we want to resume each process (once).
+ //
+ // If a process is selected along with one or more threads of that same process,
+ // what does the user want us to do? Selecting the process will resume all its
+ // threads, but what do we do with the selected threads? Why are they
+ // selected? In an attempt to be user friendly, lets assume that the user
+ // wants to resume the entire process, so we ignore the selected threads part of that
+ // process since they will be resumed anyway.
+ //
+ // The same logic applies to multi-suspend.
///////////////////////////////////////////////////////////////////////////
- /** @since 4.1 */
- @Override
- public void canResumeSome(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm) {
- assert contexts != null;
-
- if (fRunControlOperationsEnabled == false) {
- rm.done(false);
- return;
- }
-
- List<IExecutionDMContext> execDmcToResumeList = extractContextsForOperation(contexts);
-
- // If any of the threads or processes can be resumed, we allow
- // the user to perform the operation.
- for (IExecutionDMContext execDmc : execDmcToResumeList) {
- if (doCanResume(execDmc)) {
- rm.done(true);
- return;
- }
- }
-
- // Didn't find anything that could be resumed.
- rm.done(false);
- }
-
- /** @since 4.1 */
- @Override
- public void canResumeAll(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm) {
- assert contexts != null;
-
- if (fRunControlOperationsEnabled == false) {
- rm.done(false);
- return;
- }
-
- List<IExecutionDMContext> execDmcToResumeList = extractContextsForOperation(contexts);
-
- // If any of the threads or processes cannot be resumed, we don't allow
- // the user to perform the operation.
- for (IExecutionDMContext execDmc : execDmcToResumeList) {
- if (!doCanResume(execDmc)) {
- rm.done(false);
- return;
- }
- }
-
- // Everything can be resumed
- rm.done(true);
- }
-
- /**
- * {@inheritDoc}
- *
- * For GDB, a separate resume command will be sent, one for each context
- * that can be resumed.
- * @since 4.1
- */
- @Override
- public void resume(IExecutionDMContext[] contexts, RequestMonitor rm) {
- assert contexts != null;
-
- List<IExecutionDMContext> execDmcToResumeList = extractContextsForOperation(contexts);
-
- CountingRequestMonitor crm = new CountingRequestMonitor(getExecutor(), rm);
- int count = 0;
-
- // Perform resume operation on each thread or process that can be resumed
- for (IExecutionDMContext execDmc : execDmcToResumeList) {
- if (doCanResume(execDmc)) {
- count++;
- resume(execDmc, crm);
- }
- }
-
- crm.setDoneCount(count);
- }
+ /** @since 4.1 */
+ @Override
+ public void canResumeSome(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm) {
+ assert contexts != null;
+
+ if (fRunControlOperationsEnabled == false) {
+ rm.done(false);
+ return;
+ }
+
+ List<IExecutionDMContext> execDmcToResumeList = extractContextsForOperation(contexts);
+
+ // If any of the threads or processes can be resumed, we allow
+ // the user to perform the operation.
+ for (IExecutionDMContext execDmc : execDmcToResumeList) {
+ if (doCanResume(execDmc)) {
+ rm.done(true);
+ return;
+ }
+ }
+
+ // Didn't find anything that could be resumed.
+ rm.done(false);
+ }
+
+ /** @since 4.1 */
+ @Override
+ public void canResumeAll(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm) {
+ assert contexts != null;
+
+ if (fRunControlOperationsEnabled == false) {
+ rm.done(false);
+ return;
+ }
+
+ List<IExecutionDMContext> execDmcToResumeList = extractContextsForOperation(contexts);
+
+ // If any of the threads or processes cannot be resumed, we don't allow
+ // the user to perform the operation.
+ for (IExecutionDMContext execDmc : execDmcToResumeList) {
+ if (!doCanResume(execDmc)) {
+ rm.done(false);
+ return;
+ }
+ }
+
+ // Everything can be resumed
+ rm.done(true);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * For GDB, a separate resume command will be sent, one for each context
+ * that can be resumed.
+ * @since 4.1
+ */
+ @Override
+ public void resume(IExecutionDMContext[] contexts, RequestMonitor rm) {
+ assert contexts != null;
+
+ List<IExecutionDMContext> execDmcToResumeList = extractContextsForOperation(contexts);
+
+ CountingRequestMonitor crm = new CountingRequestMonitor(getExecutor(), rm);
+ int count = 0;
+
+ // Perform resume operation on each thread or process that can be resumed
+ for (IExecutionDMContext execDmc : execDmcToResumeList) {
+ if (doCanResume(execDmc)) {
+ count++;
+ resume(execDmc, crm);
+ }
+ }
+
+ crm.setDoneCount(count);
+ }
///////////////////////////////////////////////////////////////////////////
- // Multi-suspend implementation:
- // see details of the multi-resume implementation above.
+ // Multi-suspend implementation:
+ // see details of the multi-resume implementation above.
///////////////////////////////////////////////////////////////////////////
- /** @since 4.1 */
- @Override
- public void canSuspendSome(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm) {
- assert contexts != null;
-
- if (fRunControlOperationsEnabled == false) {
- rm.done(false);
- return;
- }
-
- List<IExecutionDMContext> execDmcToSuspendList = extractContextsForOperation(contexts);
-
- // If any of the threads or processes can be suspended, we allow
- // the user to perform the operation.
- for (IExecutionDMContext execDmc : execDmcToSuspendList) {
- if (doCanSuspend(execDmc)) {
- rm.done(true);
- return;
- }
- }
-
- // Didn't find anything that could be suspended.
- rm.done(false);
- }
-
- /** @since 4.1 */
- @Override
- public void canSuspendAll(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm) {
- assert contexts != null;
-
- if (fRunControlOperationsEnabled == false) {
- rm.done(false);
- return;
- }
-
- List<IExecutionDMContext> execDmcToSuspendList = extractContextsForOperation(contexts);
-
- // If any of the threads or processes cannot be suspended, we don't allow
- // the user to perform the operation.
- for (IExecutionDMContext execDmc : execDmcToSuspendList) {
- if (!doCanSuspend(execDmc)) {
- rm.done(false);
- return;
- }
- }
-
- // Everything can be suspended
- rm.done(true);
- }
-
- /** @since 4.1 */
- @Override
- public void isSuspendedSome(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm) {
- assert contexts != null;
-
- List<IExecutionDMContext> execDmcSuspendedList = extractContextsForOperation(contexts);
-
- // Look for any thread or process that is suspended
- for (IExecutionDMContext execDmc : execDmcSuspendedList) {
- if (isSuspended(execDmc)) {
- rm.done(true);
- return;
- }
- }
-
- // Didn't find anything that was suspended.
+ /** @since 4.1 */
+ @Override
+ public void canSuspendSome(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm) {
+ assert contexts != null;
+
+ if (fRunControlOperationsEnabled == false) {
+ rm.done(false);
+ return;
+ }
+
+ List<IExecutionDMContext> execDmcToSuspendList = extractContextsForOperation(contexts);
+
+ // If any of the threads or processes can be suspended, we allow
+ // the user to perform the operation.
+ for (IExecutionDMContext execDmc : execDmcToSuspendList) {
+ if (doCanSuspend(execDmc)) {
+ rm.done(true);
+ return;
+ }
+ }
+
+ // Didn't find anything that could be suspended.
rm.done(false);
- }
+ }
- /** @since 4.1 */
- @Override
- public void isSuspendedAll(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm) {
- assert contexts != null;
+ /** @since 4.1 */
+ @Override
+ public void canSuspendAll(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm) {
+ assert contexts != null;
- List<IExecutionDMContext> execDmcSuspendedList = extractContextsForOperation(contexts);
+ if (fRunControlOperationsEnabled == false) {
+ rm.done(false);
+ return;
+ }
- // Look for any thread or process that is not suspended
- for (IExecutionDMContext execDmc : execDmcSuspendedList) {
- if (!isSuspended(execDmc)) {
- rm.done(false);
- return;
- }
- }
+ List<IExecutionDMContext> execDmcToSuspendList = extractContextsForOperation(contexts);
- // Everything is suspended.
+ // If any of the threads or processes cannot be suspended, we don't allow
+ // the user to perform the operation.
+ for (IExecutionDMContext execDmc : execDmcToSuspendList) {
+ if (!doCanSuspend(execDmc)) {
+ rm.done(false);
+ return;
+ }
+ }
+
+ // Everything can be suspended
rm.done(true);
- }
-
- /**
- * {@inheritDoc}
- *
- * For GDB, a separate suspend command will be sent, one for each context
- * that can be suspended.
- * @since 4.1
- */
- @Override
- public void suspend(IExecutionDMContext[] contexts, RequestMonitor rm) {
- assert contexts != null;
-
- List<IExecutionDMContext> execDmcToSuspendList = extractContextsForOperation(contexts);
-
- CountingRequestMonitor crm = new CountingRequestMonitor(getExecutor(), rm);
- int count = 0;
-
- // Perform resume operation on each thread or process that can be resumed
- for (IExecutionDMContext execDmc : execDmcToSuspendList) {
- if (doCanSuspend(execDmc)) {
- count++;
- suspend(execDmc, crm);
- }
- }
-
- crm.setDoneCount(count);
- }
+ }
+
+ /** @since 4.1 */
+ @Override
+ public void isSuspendedSome(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm) {
+ assert contexts != null;
+
+ List<IExecutionDMContext> execDmcSuspendedList = extractContextsForOperation(contexts);
+
+ // Look for any thread or process that is suspended
+ for (IExecutionDMContext execDmc : execDmcSuspendedList) {
+ if (isSuspended(execDmc)) {
+ rm.done(true);
+ return;
+ }
+ }
+
+ // Didn't find anything that was suspended.
+ rm.done(false);
+ }
+
+ /** @since 4.1 */
+ @Override
+ public void isSuspendedAll(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm) {
+ assert contexts != null;
+
+ List<IExecutionDMContext> execDmcSuspendedList = extractContextsForOperation(contexts);
+
+ // Look for any thread or process that is not suspended
+ for (IExecutionDMContext execDmc : execDmcSuspendedList) {
+ if (!isSuspended(execDmc)) {
+ rm.done(false);
+ return;
+ }
+ }
+
+ // Everything is suspended.
+ rm.done(true);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * For GDB, a separate suspend command will be sent, one for each context
+ * that can be suspended.
+ * @since 4.1
+ */
+ @Override
+ public void suspend(IExecutionDMContext[] contexts, RequestMonitor rm) {
+ assert contexts != null;
+
+ List<IExecutionDMContext> execDmcToSuspendList = extractContextsForOperation(contexts);
+
+ CountingRequestMonitor crm = new CountingRequestMonitor(getExecutor(), rm);
+ int count = 0;
+
+ // Perform resume operation on each thread or process that can be resumed
+ for (IExecutionDMContext execDmc : execDmcToSuspendList) {
+ if (doCanSuspend(execDmc)) {
+ count++;
+ suspend(execDmc, crm);
+ }
+ }
+
+ crm.setDoneCount(count);
+ }
///////////////////////////////////////////////////////////////////////////
// Multi-step implementation. Not implemented yet. See bug 330974.
///////////////////////////////////////////////////////////////////////////
- /** @since 4.1 */
- @Override
- public void canStepSome(IExecutionDMContext[] contexts, StepType stepType, DataRequestMonitor<Boolean> rm) {
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "Not implemented.", null)); //$NON-NLS-1$
- }
-
- /** @since 4.1 */
- @Override
- public void canStepAll(IExecutionDMContext[] contexts, StepType stepType, DataRequestMonitor<Boolean> rm) {
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "Not implemented.", null)); //$NON-NLS-1$
- }
-
- /** @since 4.1 */
- @Override
- public void isSteppingSome(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm) {
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "Not implemented.", null)); //$NON-NLS-1$
- }
-
- /** @since 4.1 */
- @Override
- public void isSteppingAll(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm) {
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "Not implemented.", null)); //$NON-NLS-1$
- }
-
- /** @since 4.1 */
- @Override
- public void step(IExecutionDMContext[] contexts, StepType stepType, RequestMonitor rm) {
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "Not implemented.", null)); //$NON-NLS-1$
- }
-
- /**
- * Removes duplicates from the list of execution contexts, in case the same thread
- * or process is present more than once.
- *
- * Also, remove any thread that is part of a process that is also present. This is
- * because an operation on the process will affect all its threads anyway.
- */
- private List<IExecutionDMContext> extractContextsForOperation(IExecutionDMContext[] contexts) {
- // Remove duplicate contexts by using a set
- Set<IExecutionDMContext> specifiedExedDmcSet = new HashSet<IExecutionDMContext>(Arrays.asList(contexts));
-
- // A list that ignores threads for which the process is also present
- List<IExecutionDMContext> execDmcForOperationList = new ArrayList<IExecutionDMContext>(specifiedExedDmcSet.size());
-
- // Check for the case of a process selected along with some of its threads
- for (IExecutionDMContext execDmc : specifiedExedDmcSet) {
- if (execDmc instanceof IContainerDMContext) {
- // This is a process: it is automatically part of our list
- execDmcForOperationList.add(execDmc);
- } else {
- // Get the process for this thread
- IContainerDMContext containerDmc = DMContexts.getAncestorOfType(execDmc, IContainerDMContext.class);
- // Check if that process is also present
- if (specifiedExedDmcSet.contains(containerDmc) == false) {
- // This thread does not belong to a process that is selected, so we keep it.
- execDmcForOperationList.add(execDmc);
- }
- }
- }
- return execDmcForOperationList;
- }
+ /** @since 4.1 */
+ @Override
+ public void canStepSome(IExecutionDMContext[] contexts, StepType stepType, DataRequestMonitor<Boolean> rm) {
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "Not implemented.", //$NON-NLS-1$
+ null));
+ }
+
+ /** @since 4.1 */
+ @Override
+ public void canStepAll(IExecutionDMContext[] contexts, StepType stepType, DataRequestMonitor<Boolean> rm) {
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "Not implemented.", //$NON-NLS-1$
+ null));
+ }
+
+ /** @since 4.1 */
+ @Override
+ public void isSteppingSome(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm) {
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "Not implemented.", //$NON-NLS-1$
+ null));
+ }
+
+ /** @since 4.1 */
+ @Override
+ public void isSteppingAll(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm) {
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "Not implemented.", //$NON-NLS-1$
+ null));
+ }
+
+ /** @since 4.1 */
+ @Override
+ public void step(IExecutionDMContext[] contexts, StepType stepType, RequestMonitor rm) {
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "Not implemented.", //$NON-NLS-1$
+ null));
+ }
+
+ /**
+ * Removes duplicates from the list of execution contexts, in case the same thread
+ * or process is present more than once.
+ *
+ * Also, remove any thread that is part of a process that is also present. This is
+ * because an operation on the process will affect all its threads anyway.
+ */
+ private List<IExecutionDMContext> extractContextsForOperation(IExecutionDMContext[] contexts) {
+ // Remove duplicate contexts by using a set
+ Set<IExecutionDMContext> specifiedExedDmcSet = new HashSet<IExecutionDMContext>(Arrays.asList(contexts));
+
+ // A list that ignores threads for which the process is also present
+ List<IExecutionDMContext> execDmcForOperationList = new ArrayList<IExecutionDMContext>(
+ specifiedExedDmcSet.size());
+
+ // Check for the case of a process selected along with some of its threads
+ for (IExecutionDMContext execDmc : specifiedExedDmcSet) {
+ if (execDmc instanceof IContainerDMContext) {
+ // This is a process: it is automatically part of our list
+ execDmcForOperationList.add(execDmc);
+ } else {
+ // Get the process for this thread
+ IContainerDMContext containerDmc = DMContexts.getAncestorOfType(execDmc, IContainerDMContext.class);
+ // Check if that process is also present
+ if (specifiedExedDmcSet.contains(containerDmc) == false) {
+ // This thread does not belong to a process that is selected, so we keep it.
+ execDmcForOperationList.add(execDmc);
+ }
+ }
+ }
+ return execDmcForOperationList;
+ }
/**
* @since 4.2
*/
@Override
- public void canStepIntoSelection(IExecutionDMContext context, String sourceFile, int lineNumber, IFunctionDeclaration selectedFunction, DataRequestMonitor<Boolean> rm) {
+ public void canStepIntoSelection(IExecutionDMContext context, String sourceFile, int lineNumber,
+ IFunctionDeclaration selectedFunction, DataRequestMonitor<Boolean> rm) {
canStep(context, StepType.STEP_INTO, rm);
}
-
+
/**
* @since 4.2
*/
@Override
- public void stepIntoSelection(final IExecutionDMContext context, String sourceFile, final int lineNumber, final boolean skipBreakpoints, final IFunctionDeclaration selectedFunction, final RequestMonitor rm) {
+ public void stepIntoSelection(final IExecutionDMContext context, String sourceFile, final int lineNumber,
+ final boolean skipBreakpoints, final IFunctionDeclaration selectedFunction, final RequestMonitor rm) {
determineDebuggerPath(context, sourceFile, new ImmediateDataRequestMonitor<String>(rm) {
@Override
protected void handleSuccess() {
- stepIntoSelection(context, lineNumber, getData() + ":" + Integer.toString(lineNumber), skipBreakpoints, selectedFunction, rm); //$NON-NLS-1$
+ stepIntoSelection(context, lineNumber, getData() + ":" + Integer.toString(lineNumber), skipBreakpoints, //$NON-NLS-1$
+ selectedFunction, rm);
}
});
}
-
+
/**
* Help method used when the stopped event has not been broadcasted e.g. in the middle of step into selection
- *
+ *
* @param dmc
* @param rm
*/
private void getStackDepth(final IMIExecutionDMContext dmc, final DataRequestMonitor<Integer> rm) {
if (dmc != null) {
- fConnection.queueCommand(fCommandFactory.createMIStackInfoDepth(dmc), new DataRequestMonitor<MIStackInfoDepthInfo>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- rm.setData(getData().getDepth());
- rm.done();
- }
- });
+ fConnection.queueCommand(fCommandFactory.createMIStackInfoDepth(dmc),
+ new DataRequestMonitor<MIStackInfoDepthInfo>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ rm.setData(getData().getDepth());
+ rm.done();
+ }
+ });
} else {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid context", null)); //$NON-NLS-1$
rm.done();
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_10.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_10.java
index 22d1724ed0c..30b42550d31 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_10.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_10.java
@@ -49,13 +49,12 @@ public class GDBRunControl_7_10 extends GDBRunControl_7_6 implements IReverseRun
@Override
public void initialize(final RequestMonitor requestMonitor) {
- super.initialize(
- new ImmediateRequestMonitor(requestMonitor) {
- @Override
- public void handleSuccess() {
- doInitialize(requestMonitor);
- }
- });
+ super.initialize(new ImmediateRequestMonitor(requestMonitor) {
+ @Override
+ public void handleSuccess() {
+ doInitialize(requestMonitor);
+ }
+ });
}
private void doInitialize(RequestMonitor requestMonitor) {
@@ -71,8 +70,7 @@ public class GDBRunControl_7_10 extends GDBRunControl_7_6 implements IReverseRun
// Don't register as an event listener because our base class does it already
- register(new String[]{ IReverseRunControl2.class.getName() },
- new Hashtable<String,String>());
+ register(new String[] { IReverseRunControl2.class.getName() }, new Hashtable<String, String>());
requestMonitor.done();
}
@@ -90,16 +88,16 @@ public class GDBRunControl_7_10 extends GDBRunControl_7_6 implements IReverseRun
/** @since 5.1 */
protected void setReverseTraceMethod(ReverseDebugMethod traceMethod) {
- if (fReverseTraceMethod != traceMethod) {
+ if (fReverseTraceMethod != traceMethod) {
boolean enabled = false;
fReverseTraceMethod = traceMethod;
if (fReverseTraceMethod != ReverseDebugMethod.OFF) {
enabled = true;
}
setReverseModeEnabled(enabled);
- }
+ }
}
-
+
@Override
public void getReverseTraceMethod(ICommandControlDMContext context, DataRequestMonitor<ReverseDebugMethod> rm) {
rm.setData(fReverseTraceMethod);
@@ -107,9 +105,11 @@ public class GDBRunControl_7_10 extends GDBRunControl_7_6 implements IReverseRun
}
@Override
- public void enableReverseMode(final ICommandControlDMContext context,final ReverseDebugMethod traceMethod, final RequestMonitor rm) {
+ public void enableReverseMode(final ICommandControlDMContext context, final ReverseDebugMethod 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$
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Reverse mode is not supported.", //$NON-NLS-1$
+ null));
return;
}
@@ -119,66 +119,66 @@ public class GDBRunControl_7_10 extends GDBRunControl_7_6 implements IReverseRun
}
if (fReverseTraceMethod == ReverseDebugMethod.OFF || traceMethod == ReverseDebugMethod.OFF) {
- getConnection().queueCommand(
- fCommandFactory.createCLIRecord(context, traceMethod),
+ getConnection().queueCommand(fCommandFactory.createCLIRecord(context, traceMethod),
+ new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
+ @Override
+ public void handleSuccess() {
+ boolean enabled = false;
+ fReverseTraceMethod = traceMethod;
+ if (fReverseTraceMethod != ReverseDebugMethod.OFF) {
+ 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, ReverseDebugMethod.OFF),
new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
@Override
public void handleSuccess() {
- boolean enabled = false;
- fReverseTraceMethod = traceMethod;
- if (fReverseTraceMethod != ReverseDebugMethod.OFF) {
- 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$
+ 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 = ReverseDebugMethod.OFF;
+ rm.done();
+ }
+ });
}
});
- return;
- }
-
- getConnection().queueCommand(
- fCommandFactory.createCLIRecord(context, ReverseDebugMethod.OFF),
- 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 = ReverseDebugMethod.OFF;
- rm.done();
- }
- });
- }
- });
}
-
@Override
public void eventReceived(Object output) {
if (output instanceof MIOutput) {
- MIOOBRecord[] records = ((MIOutput)output).getMIOOBRecords();
+ MIOOBRecord[] records = ((MIOutput) output).getMIOOBRecords();
for (MIOOBRecord r : records) {
if (r instanceof MINotifyAsyncOutput) {
- MINotifyAsyncOutput notifyOutput = (MINotifyAsyncOutput)r;
+ MINotifyAsyncOutput notifyOutput = (MINotifyAsyncOutput) r;
String asyncClass = notifyOutput.getAsyncClass();
// These events have been added with GDB 7.6
if ("record-started".equals(asyncClass) || //$NON-NLS-1$
- "record-stopped".equals(asyncClass)) { //$NON-NLS-1$
+ "record-stopped".equals(asyncClass)) { //$NON-NLS-1$
if ("record-stopped".equals(asyncClass)) { //$NON-NLS-1$
setReverseTraceMethod(ReverseDebugMethod.OFF);
} else {
@@ -190,18 +190,18 @@ public class GDBRunControl_7_10 extends GDBRunControl_7_6 implements IReverseRun
} else {
// Don't know what the new method is. Let's ask GDB
getConnection().queueCommand(
- fCommandFactory.createCLIInfoRecord(getConnection().getContext()),
- new DataRequestMonitor<CLIInfoRecordInfo>(getExecutor(), null) {
- @Override
- public void handleCompleted() {
- if (isSuccess()) {
- setReverseTraceMethod(getData().getReverseMethod());
- } else {
- // Use a default value in case of error
- setReverseTraceMethod(ReverseDebugMethod.SOFTWARE);
+ fCommandFactory.createCLIInfoRecord(getConnection().getContext()),
+ new DataRequestMonitor<CLIInfoRecordInfo>(getExecutor(), null) {
+ @Override
+ public void handleCompleted() {
+ if (isSuccess()) {
+ setReverseTraceMethod(getData().getReverseMethod());
+ } else {
+ // Use a default value in case of error
+ setReverseTraceMethod(ReverseDebugMethod.SOFTWARE);
+ }
}
- }
- });
+ });
}
}
}
@@ -209,7 +209,7 @@ public class GDBRunControl_7_10 extends GDBRunControl_7_6 implements IReverseRun
}
}
}
-
+
/**
* @return The ReverseDebugMethod as specified by the =record-started event.
* Returns null if the event does provide that information (GDB < 7.12)
@@ -218,9 +218,9 @@ public class GDBRunControl_7_10 extends GDBRunControl_7_6 implements IReverseRun
// With GDB 7.12, we are provided with the type of record
// that was started.
// =record-started,thread-group="i1",method="btrace",format="bts"
- // =record-started,thread-group="i1",method="btrace",format="pt"
+ // =record-started,thread-group="i1",method="btrace",format="pt"
// =record-started,thread-group="i1",method="full"
-
+
String methodStr = ""; //$NON-NLS-1$
String formatStr = ""; //$NON-NLS-1$
MIResult[] results = notifyOutput.getMIResults();
@@ -229,21 +229,21 @@ public class GDBRunControl_7_10 extends GDBRunControl_7_6 implements IReverseRun
MIValue val = results[i].getMIValue();
if (var.equals("method")) { //$NON-NLS-1$
if (val instanceof MIConst) {
- methodStr = ((MIConst)val).getString();
+ methodStr = ((MIConst) val).getString();
}
} else if (var.equals("format")) { //$NON-NLS-1$
if (val instanceof MIConst) {
- formatStr = ((MIConst)val).getString();
+ formatStr = ((MIConst) val).getString();
}
}
}
-
+
if (methodStr.equals("full")) { //$NON-NLS-1$
assert formatStr.isEmpty() : "Unexpected format string for full method in =record-started: " + formatStr; //$NON-NLS-1$
return ReverseDebugMethod.SOFTWARE;
- }
-
- if (methodStr.equals("btrace")){ //$NON-NLS-1$
+ }
+
+ if (methodStr.equals("btrace")) { //$NON-NLS-1$
if (formatStr.equals("bts")) { //$NON-NLS-1$
return ReverseDebugMethod.BRANCH_TRACE;
} else if (formatStr.equals("pt")) { //$NON-NLS-1$
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_12.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_12.java
index 666765e2148..b578bb90b5f 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_12.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_12.java
@@ -64,34 +64,32 @@ public class GDBRunControl_7_12 extends GDBRunControl_7_10 {
}
private void doInitialize(final RequestMonitor rm) {
- fCommandControl = getServicesTracker().getService(IMICommandControl.class);
- fGDBBackEnd = getServicesTracker().getService(IGDBBackend.class);
+ fCommandControl = getServicesTracker().getService(IMICommandControl.class);
+ fGDBBackEnd = getServicesTracker().getService(IGDBBackend.class);
- fCommandFactory = fCommandControl.getCommandFactory();
-
- register(new String[]{ GDBRunControl_7_12.class.getName() },
- new Hashtable<String,String>());
+ fCommandFactory = fCommandControl.getCommandFactory();
+
+ register(new String[] { GDBRunControl_7_12.class.getName() }, new Hashtable<String, String>());
rm.done();
}
- @Override
- public void suspend(IExecutionDMContext context, final RequestMonitor rm){
- canSuspend(
- context,
- new DataRequestMonitor<Boolean>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- if (getData()) {
- // Thread or Process
- doSuspend(context, rm);
- } else {
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Context cannot be suspended.", null)); //$NON-NLS-1$
- }
- }
- });
- }
-
+ @Override
+ public void suspend(IExecutionDMContext context, final RequestMonitor rm) {
+ canSuspend(context, new DataRequestMonitor<Boolean>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ if (getData()) {
+ // Thread or Process
+ doSuspend(context, rm);
+ } else {
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE,
+ "Context cannot be suspended.", null)); //$NON-NLS-1$
+ }
+ }
+ });
+ }
+
private void doSuspend(IExecutionDMContext context, final RequestMonitor rm) {
// We use the MI interrupt command when working in async mode.
// Since this run control service is specifically for all-stop mode,
@@ -126,7 +124,7 @@ public class GDBRunControl_7_12 extends GDBRunControl_7_10 {
@Override
public boolean isTargetAcceptingCommands() {
- // We shall directly return true if the async mode is ON,
+ // We shall directly return true if the async mode is ON,
// Since this run control service is specifically for all-stop mode,
// The only possibility to be running asynchronously is if the Full GDB console
// is being used.
@@ -140,30 +138,32 @@ public class GDBRunControl_7_12 extends GDBRunControl_7_10 {
/**
* @since 5.2
*/
- @DsfServiceEventHandler
- public void eventDispatched(ISuspendedDMEvent event) {
+ @DsfServiceEventHandler
+ public void eventDispatched(ISuspendedDMEvent event) {
assert event instanceof IMIDMEvent;
-
+
if (event instanceof IMIDMEvent) {
- Object evt = ((IMIDMEvent)event).getMIEvent();
+ Object evt = ((IMIDMEvent) event).getMIEvent();
if (evt instanceof MIBreakpointHitEvent) {
- MIBreakpointHitEvent miEvt = (MIBreakpointHitEvent)evt;
-
+ MIBreakpointHitEvent miEvt = (MIBreakpointHitEvent) evt;
+
for (EnableReverseAtLocOperation enableReverse : fBpIdToReverseOpMap.values()) {
if (breakpointHitMatchesLocation(miEvt, enableReverse)) {
// We are now stopped at the right place to initiate the recording for reverse mode
// Remove the operation from our internal map and process it
fBpIdToReverseOpMap.remove(enableReverse.fBpId);
IContainerDMContext containerContext = enableReverse.getContainerContext();
- ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(containerContext, ICommandControlDMContext.class);
+ ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(containerContext,
+ ICommandControlDMContext.class);
ReverseDebugMethod reverseMethod = enableReverse.getReverseDebugMethod();
if (controlDmc != null && reverseMethod != null) {
enableReverseMode(controlDmc, reverseMethod, new RequestMonitor(getExecutor(), null) {
@Override
protected void handleSuccess() {
if (enableReverse.shouldTriggerContinue()) {
- fCommandControl.queueCommand(fCommandFactory.createMIExecContinue(containerContext),
+ fCommandControl.queueCommand(
+ fCommandFactory.createMIExecContinue(containerContext),
new ImmediateDataRequestMonitor<MIInfo>());
}
}
@@ -231,10 +231,8 @@ public class GDBRunControl_7_12 extends GDBRunControl_7_10 {
if (fContainerContext != null
&& fContainerContext.equals(((EnableReverseAtLocOperation) other).fContainerContext)
&& fTraceMethod != null
- && fTraceMethod.equals(((EnableReverseAtLocOperation) other).fTraceMethod)
- && fBpId != null
- && fBpId.equals(((EnableReverseAtLocOperation) other).fBpId)
- && fFileLocation != null
+ && fTraceMethod.equals(((EnableReverseAtLocOperation) other).fTraceMethod) && fBpId != null
+ && fBpId.equals(((EnableReverseAtLocOperation) other).fBpId) && fFileLocation != null
&& fFileLocation.equals(((EnableReverseAtLocOperation) other).fFileLocation)
&& fAddrLocation != null
&& fAddrLocation.equals(((EnableReverseAtLocOperation) other).fAddrLocation)
@@ -248,34 +246,34 @@ public class GDBRunControl_7_12 extends GDBRunControl_7_10 {
/**
* Changes the reverse debugging method as soon as the program is suspended at the specified breakpoint location
- *
+ *
* It is recommended to use this request before the program runs or restarts in order to prevent timing issues and
* miss a suspend event
- *
+ *
* Note, using the break point id to determine the stop location would be sufficient although in the case where
* multiple break points are inserted in the same location, GDB will only report one of them (e.g. GDB 7.12)
- *
+ *
* Having the MIBreakpoint will give us access to the address, file and line number as well which can be used as
* alternatives to determine a matched location.
- *
- * This method is specially useful when using async mode with i.e. with GDB 7.12.
- * Activating reverse debugging when the target is running may trigger an unresponsive GDB, this triggered the
+ *
+ * This method is specially useful when using async mode with i.e. with GDB 7.12.
+ * Activating reverse debugging when the target is running may trigger an unresponsive GDB, this triggered the
* creation of this method
- *
+ *
*/
void enableReverseModeAtBpLocation(final IContainerDMContext containerContext, final ReverseDebugMethod traceMethod,
- MIBreakpoint bp, boolean triggerContinue) {
+ MIBreakpoint bp, boolean triggerContinue) {
// Using an internal convention for file location i.e. file:lineNumber
String fileLoc = bp.getFile() + ":" + bp.getLine(); //$NON-NLS-1$
- fBpIdToReverseOpMap.put(bp.getNumber(), new EnableReverseAtLocOperation(containerContext, traceMethod,
- bp.getNumber(), fileLoc, bp.getAddress(), triggerContinue));
+ fBpIdToReverseOpMap.put(bp.getNumber(), new EnableReverseAtLocOperation(containerContext, traceMethod,
+ bp.getNumber(), fileLoc, bp.getAddress(), triggerContinue));
}
- private boolean breakpointHitMatchesLocation(MIBreakpointHitEvent e, EnableReverseAtLocOperation enableReverse) {
- if (enableReverse != null) {
- String bpId = e.getNumber();
+ private boolean breakpointHitMatchesLocation(MIBreakpointHitEvent e, EnableReverseAtLocOperation enableReverse) {
+ if (enableReverse != null) {
+ String bpId = e.getNumber();
// Here we check three different things to see if we are stopped at the right place
// 1- The actual location in the file. But this does not work for breakpoints that
@@ -292,87 +290,86 @@ public class GDBRunControl_7_12 extends GDBRunControl_7_10 {
boolean equalAddrLocation = false;
boolean equalBpId = bpId.equals(enableReverse.getBreakointId());
MIFrame frame = e.getFrame();
- if(frame != null) {
- String fileLocation = frame.getFile() + ":" + frame.getLine(); //$NON-NLS-1$
+ if (frame != null) {
+ String fileLocation = frame.getFile() + ":" + frame.getLine(); //$NON-NLS-1$
String addrLocation = frame.getAddress();
equalFileLocation = fileLocation.equals(enableReverse.getFileLocation());
equalAddrLocation = addrLocation.equals(enableReverse.getAddrLocation());
}
-
+
if (equalFileLocation || equalAddrLocation || equalBpId) {
- // We stopped at the right place
+ // We stopped at the right place
return true;
- }
- }
-
- return false;
- }
-
- protected class MonitorSuspendJob extends Job {
- // Bug 310274. Until we have a preference to configure timeouts,
- // we need a large enough default timeout to accommodate slow
- // remote sessions.
- private final static int TIMEOUT_DEFAULT_VALUE = 5000;
-
- private final RequestMonitor fRequestMonitor;
-
- public MonitorSuspendJob(int timeout, RequestMonitor rm) {
- super("Suspend monitor job."); //$NON-NLS-1$
- setSystem(true);
- fRequestMonitor = rm;
-
- if (timeout <= 0) {
- timeout = TIMEOUT_DEFAULT_VALUE; // default of 5 seconds
- }
-
- // Register to listen for the stopped event
- getSession().addServiceEventListener(this, null);
-
- schedule(timeout);
- }
-
- /**
- * Cleanup job and cancel it.
- * This method is required because super.canceling() is only called
- * if the job is actually running.
- */
- public boolean cleanAndCancel() {
- if (getExecutor().isInExecutorThread()) {
- getSession().removeServiceEventListener(this);
- } else {
- getExecutor().submit(
- new DsfRunnable() {
- @Override
- public void run() {
- getSession().removeServiceEventListener(MonitorSuspendJob.this);
- }
- });
- }
- return cancel();
- }
-
- @DsfServiceEventHandler
- public void eventDispatched(MIStoppedEvent e) {
- if (e.getDMContext() != null && e.getDMContext() instanceof IMIExecutionDMContext ) {
- // For all-stop, this means all threads have stopped
- if (cleanAndCancel()) {
- fRequestMonitor.done();
- }
- }
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- // This will be called when the timeout is hit and no *stopped event was received
- getExecutor().submit(
- new DsfRunnable() {
- @Override
- public void run() {
- getSession().removeServiceEventListener(MonitorSuspendJob.this);
- fRequestMonitor.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.REQUEST_FAILED, "Suspend operation timeout.", null)); //$NON-NLS-1$
- }
- });
- return Status.OK_STATUS;
- }
- }
+ }
+ }
+
+ return false;
+ }
+
+ protected class MonitorSuspendJob extends Job {
+ // Bug 310274. Until we have a preference to configure timeouts,
+ // we need a large enough default timeout to accommodate slow
+ // remote sessions.
+ private final static int TIMEOUT_DEFAULT_VALUE = 5000;
+
+ private final RequestMonitor fRequestMonitor;
+
+ public MonitorSuspendJob(int timeout, RequestMonitor rm) {
+ super("Suspend monitor job."); //$NON-NLS-1$
+ setSystem(true);
+ fRequestMonitor = rm;
+
+ if (timeout <= 0) {
+ timeout = TIMEOUT_DEFAULT_VALUE; // default of 5 seconds
+ }
+
+ // Register to listen for the stopped event
+ getSession().addServiceEventListener(this, null);
+
+ schedule(timeout);
+ }
+
+ /**
+ * Cleanup job and cancel it.
+ * This method is required because super.canceling() is only called
+ * if the job is actually running.
+ */
+ public boolean cleanAndCancel() {
+ if (getExecutor().isInExecutorThread()) {
+ getSession().removeServiceEventListener(this);
+ } else {
+ getExecutor().submit(new DsfRunnable() {
+ @Override
+ public void run() {
+ getSession().removeServiceEventListener(MonitorSuspendJob.this);
+ }
+ });
+ }
+ return cancel();
+ }
+
+ @DsfServiceEventHandler
+ public void eventDispatched(MIStoppedEvent e) {
+ if (e.getDMContext() != null && e.getDMContext() instanceof IMIExecutionDMContext) {
+ // For all-stop, this means all threads have stopped
+ if (cleanAndCancel()) {
+ fRequestMonitor.done();
+ }
+ }
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ // This will be called when the timeout is hit and no *stopped event was received
+ getExecutor().submit(new DsfRunnable() {
+ @Override
+ public void run() {
+ getSession().removeServiceEventListener(MonitorSuspendJob.this);
+ fRequestMonitor.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
+ IDsfStatusConstants.REQUEST_FAILED, "Suspend operation timeout.", null)); //$NON-NLS-1$
+ }
+ });
+ return Status.OK_STATUS;
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_2_NS.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_2_NS.java
index 5d4df58c617..b6db40e9d46 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_2_NS.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_2_NS.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
* Marc Khouzam (Ericsson) - Wait for *stopped event when suspending (bug 429621)
@@ -38,20 +38,19 @@ import org.eclipse.core.runtime.Status;
/**
* Version of the non-stop runControl for GDB 7.2.
- *
+ *
* @since 4.0
*/
-public class GDBRunControl_7_2_NS extends GDBRunControl_7_0_NS
-{
+public class GDBRunControl_7_2_NS extends GDBRunControl_7_0_NS {
private ICommandControlService fConnection;
private CommandFactory fCommandFactory;
-
+
/**
* Keeps track if we are currently visualizing trace data or not
*/
private boolean fTraceVisualization;
-
+
///////////////////////////////////////////////////////////////////////////
// Initialization and shutdown
///////////////////////////////////////////////////////////////////////////
@@ -71,14 +70,9 @@ public class GDBRunControl_7_2_NS extends GDBRunControl_7_0_NS
}
private void doInitialize(final RequestMonitor rm) {
- register(new String[]{ IRunControl.class.getName(),
- IRunControl2.class.getName(),
- IMIRunControl.class.getName(),
- IMultiRunControl.class.getName(),
- GDBRunControl_7_0_NS.class.getName(),
- GDBRunControl_7_2_NS.class.getName(),
- },
- new Hashtable<String,String>());
+ register(new String[] { IRunControl.class.getName(), IRunControl2.class.getName(),
+ IMIRunControl.class.getName(), IMultiRunControl.class.getName(), GDBRunControl_7_0_NS.class.getName(),
+ GDBRunControl_7_2_NS.class.getName(), }, new Hashtable<String, String>());
fConnection = getServicesTracker().getService(ICommandControlService.class);
fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
getSession().addServiceEventListener(this, null);
@@ -101,7 +95,7 @@ public class GDBRunControl_7_2_NS extends GDBRunControl_7_0_NS
protected void setTraceVisualization(boolean visualizing) {
fTraceVisualization = visualizing;
}
-
+
// Now that the flag --thread-group is globally supported
// by GDB 7.2, we have to make sure not to use it twice.
// Bug 340262
@@ -109,13 +103,14 @@ public class GDBRunControl_7_2_NS extends GDBRunControl_7_0_NS
protected void doSuspend(IMIContainerDMContext context, RequestMonitor rm) {
if (!doCanSuspend(context)) {
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED,
- "Given context: " + context + ", is already suspended.", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ "Given context: " + context + ", is already suspended.", null)); //$NON-NLS-1$ //$NON-NLS-2$
return;
}
-
- fConnection.queueCommand(fCommandFactory.createMIExecInterrupt(context), new DataRequestMonitor<MIInfo>(getExecutor(), rm));
+
+ fConnection.queueCommand(fCommandFactory.createMIExecInterrupt(context),
+ new DataRequestMonitor<MIInfo>(getExecutor(), rm));
}
-
+
// Now that the flag --thread-group is globally supported
// by GDB 7.2, we have to make sure not to use it twice.
// Bug 340262
@@ -124,26 +119,27 @@ public class GDBRunControl_7_2_NS extends GDBRunControl_7_0_NS
protected void doResume(IMIContainerDMContext context, final RequestMonitor rm) {
if (!doCanResume(context)) {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE,
- "Given context: " + context + ", is already running.", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ "Given context: " + context + ", is already running.", null)); //$NON-NLS-1$ //$NON-NLS-2$
rm.done();
return;
}
- fConnection.queueCommand(fCommandFactory.createMIExecContinue(context), new DataRequestMonitor<MIInfo>(getExecutor(), rm));
+ fConnection.queueCommand(fCommandFactory.createMIExecContinue(context),
+ new DataRequestMonitor<MIInfo>(getExecutor(), rm));
}
-
- /**
+
+ /**
* @since 4.1
*/
- @DsfServiceEventHandler
- public void eventDispatched(ITraceRecordSelectedChangedDMEvent e) {
- setTraceVisualization(e.isVisualizationModeEnabled());
-
- // Disable or re-enable run control operations if we are looking
- // at trace data or we are not, respectively.
- setRunControlOperationsEnabled(!e.isVisualizationModeEnabled());
- }
-
+ @DsfServiceEventHandler
+ public void eventDispatched(ITraceRecordSelectedChangedDMEvent e) {
+ setTraceVisualization(e.isVisualizationModeEnabled());
+
+ // Disable or re-enable run control operations if we are looking
+ // at trace data or we are not, respectively.
+ setRunControlOperationsEnabled(!e.isVisualizationModeEnabled());
+ }
+
@Override
protected void refreshThreadStates() {
// We should not refresh the thread state while we are visualizing trace data.
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_6.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_6.java
index 7a36aba9801..74fbee2f833 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_6.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_6.java
@@ -7,14 +7,13 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Marc Khouzam (Ericsson) - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.service;
-
import java.util.Hashtable;
import org.eclipse.cdt.dsf.concurrent.ImmediateRequestMonitor;
@@ -39,25 +38,25 @@ import org.eclipse.core.runtime.Status;
public class GDBRunControl_7_6 extends GDBRunControl_7_0 implements IEventListener {
private ICommandControl fCommandControl;
-
- public GDBRunControl_7_6(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(final RequestMonitor requestMonitor) {
-
- fCommandControl = getServicesTracker().getService(ICommandControl.class);
-
+ public GDBRunControl_7_6(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(final RequestMonitor requestMonitor) {
+
+ fCommandControl = getServicesTracker().getService(ICommandControl.class);
+
if (fCommandControl == null) {
requestMonitor.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Service is not available")); //$NON-NLS-1$
return;
@@ -65,40 +64,37 @@ public class GDBRunControl_7_6 extends GDBRunControl_7_0 implements IEventListen
fCommandControl.addEventListener(this);
- register(new String[]{IRunControl.class.getName(),
- IRunControl2.class.getName(),
- IMIRunControl.class.getName(),
- MIRunControl.class.getName(),
- GDBRunControl_7_0.class.getName(),
- GDBRunControl_7_6.class.getName(),
- IReverseRunControl.class.getName()},
- new Hashtable<String,String>());
- requestMonitor.done();
- }
+ register(
+ new String[] { IRunControl.class.getName(), IRunControl2.class.getName(), IMIRunControl.class.getName(),
+ MIRunControl.class.getName(), GDBRunControl_7_0.class.getName(),
+ GDBRunControl_7_6.class.getName(), IReverseRunControl.class.getName() },
+ new Hashtable<String, String>());
+ requestMonitor.done();
+ }
- @Override
- public void shutdown(final RequestMonitor requestMonitor) {
- if (fCommandControl != null) {
- fCommandControl.removeEventListener(this);
- }
+ @Override
+ public void shutdown(final RequestMonitor requestMonitor) {
+ if (fCommandControl != null) {
+ fCommandControl.removeEventListener(this);
+ }
unregister();
- super.shutdown(requestMonitor);
- }
+ super.shutdown(requestMonitor);
+ }
@Override
public void eventReceived(Object output) {
if (output instanceof MIOutput) {
- MIOOBRecord[] records = ((MIOutput)output).getMIOOBRecords();
+ MIOOBRecord[] records = ((MIOutput) output).getMIOOBRecords();
for (MIOOBRecord r : records) {
if (r instanceof MINotifyAsyncOutput) {
- MINotifyAsyncOutput notifyOutput = (MINotifyAsyncOutput)r;
+ MINotifyAsyncOutput notifyOutput = (MINotifyAsyncOutput) r;
String asyncClass = notifyOutput.getAsyncClass();
// These events have been added with GDB 7.6
if ("record-started".equals(asyncClass) || //$NON-NLS-1$
- "record-stopped".equals(asyncClass)) { //$NON-NLS-1$
-
- boolean enable = "record-started".equals(asyncClass); //$NON-NLS-1$
- setReverseModeEnabled(enable);
+ "record-stopped".equals(asyncClass)) { //$NON-NLS-1$
+
+ boolean enable = "record-started".equals(asyncClass); //$NON-NLS-1$
+ setReverseModeEnabled(enable);
}
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBSourceLookup.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBSourceLookup.java
index 77b3f0d9b35..3a292ea7953 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBSourceLookup.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBSourceLookup.java
@@ -37,7 +37,7 @@ import org.eclipse.core.runtime.Status;
/**
* Default implementation of {@link IGDBSourceLookup}
- *
+ *
* @since 5.0
*/
public class GDBSourceLookup extends CSourceLookup implements IGDBSourceLookup {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBTraceControl_7_2.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBTraceControl_7_2.java
index d832074930e..55c3642ac9a 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBTraceControl_7_2.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBTraceControl_7_2.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - Initial API and implementation
* Dmitry Kozlov (Mentor Graphics) - Add support for IGDBTraceControl2 (Bug 390827)
@@ -57,7 +57,7 @@ import org.osgi.framework.BundleContext;
/**
* This class implements the IGDBTraceControl interface which gives access
* to the debugger's tracing functionality.
- *
+ *
* @since 3.0
*/
public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTraceControl2, ICachingService {
@@ -90,8 +90,8 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
*/
@Override
public boolean equals(Object obj) {
- return baseEquals(obj) && (fReference == null ? ((MITraceRecordDMContext) obj).fReference == null :
- (fReference.equals(((MITraceRecordDMContext) obj).fReference)));
+ return baseEquals(obj) && (fReference == null ? ((MITraceRecordDMContext) obj).fReference == null
+ : (fReference.equals(((MITraceRecordDMContext) obj).fReference)));
}
/* (non-Javadoc)
@@ -107,7 +107,7 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
*/
@Override
public String toString() {
- return baseToString() + ".reference(" + fReference + ")"; //$NON-NLS-1$//$NON-NLS-2$
+ return baseToString() + ".reference(" + fReference + ")"; //$NON-NLS-1$//$NON-NLS-2$
}
}
@@ -115,7 +115,8 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
* Trace record context used to indicate that there is no current trace record selected.
*/
@Immutable
- protected static final class InvalidTraceRecordDMContext extends AbstractDMContext implements ITraceRecordDMContext {
+ protected static final class InvalidTraceRecordDMContext extends AbstractDMContext
+ implements ITraceRecordDMContext {
/**
* @param session the DsfSession for this service
@@ -153,7 +154,7 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
*/
@Override
public String toString() {
- return baseToString() + ".noTraceRecord"; //$NON-NLS-1$
+ return baseToString() + ".noTraceRecord"; //$NON-NLS-1$
}
}
@@ -161,13 +162,13 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
private String fName;
private String fValue;
private String fInitialValue;
-
+
public TraceVariableDMData(String name, String initial, String value) {
fName = name;
fInitialValue = initial;
fValue = value;
}
-
+
@Override
public String getName() {
return fName;
@@ -183,13 +184,13 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
return fInitialValue;
}
}
-
+
private class TraceRecordDMData implements ITraceRecordDMData {
private String fContent;
private String fTracepointNum;
private String fTimestamp;
private String fFrameNumber;
-
+
public TraceRecordDMData(String content, String tracepointNum, String frameNumber, String timestamp) {
fContent = content;
fTracepointNum = tracepointNum;
@@ -206,7 +207,7 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
public String getTracepointNumber() {
return fTracepointNum;
}
-
+
@Override
public String getRecordId() {
return fFrameNumber;
@@ -217,51 +218,56 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
return fTimestamp;
}
}
-
+
private class TraceStatusDMData implements ITraceStatusDMData2 {
private MITraceStatusInfo fInfo;
public TraceStatusDMData(MITraceStatusInfo info) {
fInfo = info;
}
-
+
/**
* Create a status when tracing is not supported
*/
public TraceStatusDMData() {
this(null);
}
-
+
@Override
public int getFreeBufferSize() {
- if (fInfo == null) return 0;
+ if (fInfo == null)
+ return 0;
return fInfo.getFreeBufferSize();
}
-
+
@Override
public int getNumberOfCreatedFrames() {
- if (fInfo == null) return 0;
+ if (fInfo == null)
+ return 0;
return fInfo.getNumberOfCreatedFrames();
}
@Override
public int getNumberOfCollectedFrame() {
- if (fInfo == null) return 0;
+ if (fInfo == null)
+ return 0;
return fInfo.getNumberOfCollectedFrame();
}
-
+
@Override
public int getTotalBufferSize() {
- if (fInfo == null) return 0;
+ if (fInfo == null)
+ return 0;
return fInfo.getTotalBufferSize();
}
-
+
@Override
public boolean isTracingActive() {
- if (fInfo == null) return false;
+ if (fInfo == null)
+ return false;
return fInfo.isTracingActive();
}
-
+
@Override
public boolean isTracingSupported() {
return fInfo != null;
@@ -269,28 +275,32 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
@Override
public boolean isCircularBuffer() {
- if (fInfo == null) return false;
+ if (fInfo == null)
+ return false;
return fInfo.isCircularBuffer();
}
-
+
@Override
public boolean isTracingFromFile() {
- if (fInfo == null) return false;
+ if (fInfo == null)
+ return false;
return fInfo.isTracingFromFile();
}
@Override
public boolean isDisconnectedTracingEnabled() {
- if (fInfo == null) return false;
+ if (fInfo == null)
+ return false;
return fInfo.isDisconnectedTracingEnabled();
}
-
+
@Override
public STOP_REASON_ENUM getStopReason() {
- if (fInfo == null) return null;
+ if (fInfo == null)
+ return null;
return fInfo.getStopReason();
}
-
+
@Override
public Integer getStoppingTracepoint() {
if (fInfo.getStopReason() == null) {
@@ -298,31 +308,35 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
}
return fInfo.getStopTracepoint();
}
-
+
@Override
public String getUserName() {
- if (fInfo == null) return ""; //$NON-NLS-1$
+ if (fInfo == null)
+ return ""; //$NON-NLS-1$
return fInfo.getUserName() == null ? "" : fInfo.getUserName(); //$NON-NLS-1$
}
@Override
public String getNotes() {
- if (fInfo == null) return ""; //$NON-NLS-1$
+ if (fInfo == null)
+ return ""; //$NON-NLS-1$
return fInfo.getNotes() == null ? "" : fInfo.getNotes(); //$NON-NLS-1$
}
@Override
public String getStartTime() {
- if (fInfo == null) return ""; //$NON-NLS-1$
+ if (fInfo == null)
+ return ""; //$NON-NLS-1$
return fInfo.getStartTime() == null ? "" : fInfo.getStartTime(); //$NON-NLS-1$
}
@Override
public String getStopTime() {
- if (fInfo == null) return ""; //$NON-NLS-1$
+ if (fInfo == null)
+ return ""; //$NON-NLS-1$
return fInfo.getStopTime() == null ? "" : fInfo.getStopTime(); //$NON-NLS-1$
}
-
+
@Override
public String getStopErrorDescription() {
if (getStopReason() != STOP_REASON_ENUM.ERROR) {
@@ -343,7 +357,7 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
public String getCurrentTraceFrameId() {
// Not currently provided by -trace-status
if (fCurrentRecordDmc instanceof MITraceRecordDMContext) {
- return ((MITraceRecordDMContext)fCurrentRecordDmc).getRecordId();
+ return ((MITraceRecordDMContext) fCurrentRecordDmc).getRecordId();
}
return null;
}
@@ -357,56 +371,56 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
return null;
}
}
-
+
private static class TracingSupportedChangeEvent extends AbstractDMEvent<ITraceTargetDMContext>
- implements ITracingSupportedChangeDMEvent {
+ implements ITracingSupportedChangeDMEvent {
private final boolean fTracingSupported;
-
- public TracingSupportedChangeEvent(ITraceTargetDMContext context, boolean supported) {
- super(context);
- fTracingSupported = supported;
- }
- @Override
+ public TracingSupportedChangeEvent(ITraceTargetDMContext context, boolean supported) {
+ super(context);
+ fTracingSupported = supported;
+ }
+
+ @Override
public boolean isTracingSupported() {
return fTracingSupported;
}
}
private static class TracingStartedEvent extends AbstractDMEvent<ITraceTargetDMContext>
- implements ITracingStartedDMEvent {
- public TracingStartedEvent(ITraceTargetDMContext context) {
- super(context);
- }
+ implements ITracingStartedDMEvent {
+ public TracingStartedEvent(ITraceTargetDMContext context) {
+ super(context);
+ }
}
-
+
private static class TracingStoppedEvent extends AbstractDMEvent<ITraceTargetDMContext>
- implements ITracingStoppedDMEvent {
+ implements ITracingStoppedDMEvent {
public TracingStoppedEvent(ITraceTargetDMContext context) {
super(context);
}
}
-
+
public static class TraceRecordSelectedChangedEvent extends AbstractDMEvent<ITraceRecordDMContext>
- implements ITraceRecordSelectedChangedDMEvent {
+ implements ITraceRecordSelectedChangedDMEvent {
final boolean fVisualModeEnabled;
-
- public TraceRecordSelectedChangedEvent(ITraceRecordDMContext context) {
- super(context);
- fVisualModeEnabled = !(context instanceof InvalidTraceRecordDMContext);
- }
- @Override
+ public TraceRecordSelectedChangedEvent(ITraceRecordDMContext context) {
+ super(context);
+ fVisualModeEnabled = !(context instanceof InvalidTraceRecordDMContext);
+ }
+
+ @Override
public boolean isVisualizationModeEnabled() {
return fVisualModeEnabled;
}
- }
+ }
- private CommandCache fTraceStatusCache;
+ private CommandCache fTraceStatusCache;
private ICommandControlService fConnection;
private CommandFactory fCommandFactory;
private IGDBBackend fBackend;
-
+
private ITraceRecordDMContext fCurrentRecordDmc;
private int fTracepointIndexForTraceRecord;
@@ -421,7 +435,7 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
/**
* This method initializes this service.
- *
+ *
* @param requestMonitor
* The request monitor indicating the operation is finished
*/
@@ -434,28 +448,26 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
}
});
}
-
+
/**
* 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 this service.
- register(new String[] {IGDBTraceControl.class.getName(),
- IGDBTraceControl2.class.getName()},
- new Hashtable<String, String>());
-
+ register(new String[] { IGDBTraceControl.class.getName(), IGDBTraceControl2.class.getName() },
+ new Hashtable<String, String>());
fConnection = getServicesTracker().getService(ICommandControlService.class);
- fTraceStatusCache = new CommandCache(getSession(), fConnection);
- fTraceStatusCache.setContextAvailable(fConnection.getContext(), true);
-
- fBackend = getServicesTracker().getService(IGDBBackend.class);
- fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
+ fTraceStatusCache = new CommandCache(getSession(), fConnection);
+ fTraceStatusCache.setContextAvailable(fConnection.getContext(), true);
+
+ fBackend = getServicesTracker().getService(IGDBBackend.class);
+ fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
requestMonitor.done();
}
@@ -464,7 +476,7 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
* This method shuts down this service. It unregisters the service, stops
* receiving service events, and calls the superclass shutdown() method to
* finish the shutdown process.
- *
+ *
* @return void
*/
@Override
@@ -472,7 +484,7 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
unregister();
super.shutdown(requestMonitor);
}
-
+
/**
* @return The bundle context of the plug-in to which this service belongs.
*/
@@ -485,683 +497,680 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
protected boolean isTracingCurrentlySupported() {
return fIsTracingCurrentlySupported;
}
-
+
/** @since 4.4 */
protected CommandCache getTraceStatusCache() {
return fTraceStatusCache;
}
-
+
@Override
- public void canStartTracing(ITraceTargetDMContext context, final DataRequestMonitor<Boolean> rm) {
- if (context == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- if (fIsTracingCurrentlySupported == false) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Tracing not supported", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- if (fBackend.getSessionType() == SessionType.CORE) {
- rm.setData(false);
- rm.done();
- return;
- }
-
- if (fCurrentRecordDmc != null) {
- // We are visualizing data, no more tracing possible.
- rm.setData(false);
- rm.done();
- return;
- }
-
- rm.setData(true);
- rm.done();
- }
-
+ public void canStartTracing(ITraceTargetDMContext context, final DataRequestMonitor<Boolean> rm) {
+ if (context == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ if (fIsTracingCurrentlySupported == false) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Tracing not supported", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ if (fBackend.getSessionType() == SessionType.CORE) {
+ rm.setData(false);
+ rm.done();
+ return;
+ }
+
+ if (fCurrentRecordDmc != null) {
+ // We are visualizing data, no more tracing possible.
+ rm.setData(false);
+ rm.done();
+ return;
+ }
+
+ rm.setData(true);
+ rm.done();
+ }
+
@Override
- public void startTracing(final ITraceTargetDMContext context, final RequestMonitor rm) {
- if (context == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- canStartTracing(context, new DataRequestMonitor<Boolean>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- if (!getData()) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Cannot start tracing", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- fConnection.queueCommand(
- fCommandFactory.createMITraceStart(context),
- new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- fTraceStatusCache.reset(context);
-
- fIsTracingActive = true;
- getSession().dispatchEvent(new TracingStartedEvent(context), getProperties());
- rm.done();
- }
- @Override
- protected void handleError() {
- // Send an event to cause a refresh of the button states
- IDMEvent<ITraceTargetDMContext> event;
- if (fIsTracingActive) {
- event = new TracingStartedEvent(context);
- } else {
- event = new TracingStoppedEvent(context);
- }
- getSession().dispatchEvent(event, getProperties());
- rm.done();
- }
- });
- }
- });
- }
-
+ public void startTracing(final ITraceTargetDMContext context, final RequestMonitor rm) {
+ if (context == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ canStartTracing(context, new DataRequestMonitor<Boolean>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ if (!getData()) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Cannot start tracing", //$NON-NLS-1$
+ null));
+ rm.done();
+ return;
+ }
+
+ fConnection.queueCommand(fCommandFactory.createMITraceStart(context),
+ new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ fTraceStatusCache.reset(context);
+
+ fIsTracingActive = true;
+ getSession().dispatchEvent(new TracingStartedEvent(context), getProperties());
+ rm.done();
+ }
+
+ @Override
+ protected void handleError() {
+ // Send an event to cause a refresh of the button states
+ IDMEvent<ITraceTargetDMContext> event;
+ if (fIsTracingActive) {
+ event = new TracingStartedEvent(context);
+ } else {
+ event = new TracingStoppedEvent(context);
+ }
+ getSession().dispatchEvent(event, getProperties());
+ rm.done();
+ }
+ });
+ }
+ });
+ }
+
@Override
- public void canStopTracing(ITraceTargetDMContext context, DataRequestMonitor<Boolean> rm) {
- if (context == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- if (fIsTracingCurrentlySupported == false) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Tracing not supported", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- if (fBackend.getSessionType() == SessionType.CORE) {
- rm.setData(false);
- rm.done();
- return;
- }
-
- if (fCurrentRecordDmc != null) {
- // We are visualizing data, no more tracing possible.
- rm.setData(false);
- rm.done();
- return;
- }
-
- isTracing(context, rm);
- }
-
+ public void canStopTracing(ITraceTargetDMContext context, DataRequestMonitor<Boolean> rm) {
+ if (context == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ if (fIsTracingCurrentlySupported == false) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Tracing not supported", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ if (fBackend.getSessionType() == SessionType.CORE) {
+ rm.setData(false);
+ rm.done();
+ return;
+ }
+
+ if (fCurrentRecordDmc != null) {
+ // We are visualizing data, no more tracing possible.
+ rm.setData(false);
+ rm.done();
+ return;
+ }
+
+ isTracing(context, rm);
+ }
+
@Override
- public void stopTracing(final ITraceTargetDMContext context, final RequestMonitor rm) {
- if (context == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- canStopTracing(context, new DataRequestMonitor<Boolean>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- if (!getData()) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Cannot stop tracing", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- fConnection.queueCommand(
- fCommandFactory.createMITraceStop(context),
- new DataRequestMonitor<MITraceStopInfo>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- fTraceStatusCache.reset(context);
-
- MITraceStopInfo info = getData();
-
- // Update the tracing state in case it was stopped by the backend
- if (fIsTracingActive != info.isTracingActive()) {
- fIsTracingActive = info.isTracingActive();
- if (!fIsTracingActive) {
- getSession().dispatchEvent(new TracingStoppedEvent(context), getProperties());
- }
- }
-
- fTraceRecordsStored = info.getNumberOfCollectedFrame();
- rm.done();
- }
- });
- }
- });
- }
-
+ public void stopTracing(final ITraceTargetDMContext context, final RequestMonitor rm) {
+ if (context == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ canStopTracing(context, new DataRequestMonitor<Boolean>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ if (!getData()) {
+ rm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Cannot stop tracing", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ fConnection.queueCommand(fCommandFactory.createMITraceStop(context),
+ new DataRequestMonitor<MITraceStopInfo>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ fTraceStatusCache.reset(context);
+
+ MITraceStopInfo info = getData();
+
+ // Update the tracing state in case it was stopped by the backend
+ if (fIsTracingActive != info.isTracingActive()) {
+ fIsTracingActive = info.isTracingActive();
+ if (!fIsTracingActive) {
+ getSession().dispatchEvent(new TracingStoppedEvent(context), getProperties());
+ }
+ }
+
+ fTraceRecordsStored = info.getNumberOfCollectedFrame();
+ rm.done();
+ }
+ });
+ }
+ });
+ }
+
@Override
- public void isTracing(ITraceTargetDMContext context, final DataRequestMonitor<Boolean> rm) {
- if (context == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- if (fBackend.getSessionType() == SessionType.CORE) {
- rm.setData(false);
- rm.done();
- return;
- }
-
- // Although tracing can be automatically stopped on the target, we
- // don't go to the backend for this call, or we would make too many calls
- // Instead, we can use our buffered state; we simply won't know about an
- // automatic stop until a forced refresh. (Note that the MI notification
- // about automatic stops, is not available until GDB 7.2 is released)
- rm.setData(fIsTracingActive);
- rm.done();
- }
-
+ public void isTracing(ITraceTargetDMContext context, final DataRequestMonitor<Boolean> rm) {
+ if (context == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ if (fBackend.getSessionType() == SessionType.CORE) {
+ rm.setData(false);
+ rm.done();
+ return;
+ }
+
+ // Although tracing can be automatically stopped on the target, we
+ // don't go to the backend for this call, or we would make too many calls
+ // Instead, we can use our buffered state; we simply won't know about an
+ // automatic stop until a forced refresh. (Note that the MI notification
+ // about automatic stops, is not available until GDB 7.2 is released)
+ rm.setData(fIsTracingActive);
+ rm.done();
+ }
+
@Override
public void canSaveTraceData(ITraceTargetDMContext context, DataRequestMonitor<Boolean> rm) {
- if (context == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- if (fIsTracingCurrentlySupported == false) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Tracing not supported", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- if (fBackend.getSessionType() == SessionType.CORE) {
- rm.setData(false);
- rm.done();
- return;
- }
+ if (context == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ if (fIsTracingCurrentlySupported == false) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Tracing not supported", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ if (fBackend.getSessionType() == SessionType.CORE) {
+ rm.setData(false);
+ rm.done();
+ return;
+ }
rm.setData(fTraceRecordsStored > 0);
rm.done();
}
@Override
- public void saveTraceData(final ITraceTargetDMContext context, final String file,
- final boolean remoteSave, final RequestMonitor rm) {
- if (context == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- canSaveTraceData(context, new DataRequestMonitor<Boolean>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- if (!getData()) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Cannot save trace data", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- fConnection.queueCommand(
- fCommandFactory.createMITraceSave(context, file, remoteSave),
- new DataRequestMonitor<MIInfo>(getExecutor(), rm));
- }
- });
+ public void saveTraceData(final ITraceTargetDMContext context, final String file, final boolean remoteSave,
+ final RequestMonitor rm) {
+ if (context == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ canSaveTraceData(context, new DataRequestMonitor<Boolean>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ if (!getData()) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Cannot save trace data", //$NON-NLS-1$
+ null));
+ rm.done();
+ return;
+ }
+
+ fConnection.queueCommand(fCommandFactory.createMITraceSave(context, file, remoteSave),
+ new DataRequestMonitor<MIInfo>(getExecutor(), rm));
+ }
+ });
}
@Override
public void canLoadTraceData(ITraceTargetDMContext context, DataRequestMonitor<Boolean> rm) {
- if (context == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- // If this service has been instantiated, it means we support loading trace data.
- // Unlike the other operations, loading trace data does not require any GDB special state
- // (like being connected to a target)
+ if (context == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ // If this service has been instantiated, it means we support loading trace data.
+ // Unlike the other operations, loading trace data does not require any GDB special state
+ // (like being connected to a target)
rm.setData(true);
rm.done();
}
@Override
public void loadTraceData(final ITraceTargetDMContext context, final String file, final RequestMonitor rm) {
- if (context == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- canLoadTraceData(context, new DataRequestMonitor<Boolean>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- if (!getData()) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Cannot load trace data", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- fConnection.queueCommand(
- fCommandFactory.createMITargetSelectTFile(context, file),
- new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- fTraceStatusCache.reset(context);
-
- fIsTracingCurrentlySupported = true;
- // Workaround for GDB pre-release where we don't get the details
- // of the frame when we load a trace file.
- // To get around this, we can force a select of record 0
- final ITraceRecordDMContext initialRecord = createTraceRecordContext(context, "0"); //$NON-NLS-1$
- selectTraceRecord(initialRecord, new ImmediateRequestMonitor(rm) {
- @Override
- protected void handleSuccess() {
- // This event will indicate to the other services that we are visualizing trace data.
- getSession().dispatchEvent(new TraceRecordSelectedChangedEvent(initialRecord), getProperties());
- rm.done();
- }
- });
- }
- });
- }
- });
+ if (context == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ canLoadTraceData(context, new DataRequestMonitor<Boolean>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ if (!getData()) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Cannot load trace data", //$NON-NLS-1$
+ null));
+ rm.done();
+ return;
+ }
+
+ fConnection.queueCommand(fCommandFactory.createMITargetSelectTFile(context, file),
+ new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ fTraceStatusCache.reset(context);
+
+ fIsTracingCurrentlySupported = true;
+ // Workaround for GDB pre-release where we don't get the details
+ // of the frame when we load a trace file.
+ // To get around this, we can force a select of record 0
+ final ITraceRecordDMContext initialRecord = createTraceRecordContext(context, "0"); //$NON-NLS-1$
+ selectTraceRecord(initialRecord, new ImmediateRequestMonitor(rm) {
+ @Override
+ protected void handleSuccess() {
+ // This event will indicate to the other services that we are visualizing trace data.
+ getSession().dispatchEvent(new TraceRecordSelectedChangedEvent(initialRecord),
+ getProperties());
+ rm.done();
+ }
+ });
+ }
+ });
+ }
+ });
}
-
+
@Override
- public void getTraceStatus(final ITraceTargetDMContext context, final DataRequestMonitor<ITraceStatusDMData> rm) {
- if (context == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- if (fIsTracingFeatureAvailable == false) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Tracing not supported", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- // Start an automatic one-time flushing of the TraceStatusCache.
- // This avoids sending -trace-status multiples time in a very short
- // amount of time. We still have to clear the cache very quickly
- // because -trace-status can change very fast as it reports
- // the number of frames collected. Having a small interval of
- // stale data is currently not a big deal, and not user-visible.
- // Bug 353034
- getExecutor().schedule(new Runnable() {
- @Override public void run() { fTraceStatusCache.reset(context); }
+ public void getTraceStatus(final ITraceTargetDMContext context, final DataRequestMonitor<ITraceStatusDMData> rm) {
+ if (context == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ if (fIsTracingFeatureAvailable == false) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Tracing not supported", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ // Start an automatic one-time flushing of the TraceStatusCache.
+ // This avoids sending -trace-status multiples time in a very short
+ // amount of time. We still have to clear the cache very quickly
+ // because -trace-status can change very fast as it reports
+ // the number of frames collected. Having a small interval of
+ // stale data is currently not a big deal, and not user-visible.
+ // Bug 353034
+ getExecutor().schedule(new Runnable() {
+ @Override
+ public void run() {
+ fTraceStatusCache.reset(context);
+ }
}, 300, TimeUnit.MILLISECONDS);
-
- fTraceStatusCache.execute(
- fCommandFactory.createMITraceStatus(context),
- new DataRequestMonitor<MITraceStatusInfo>(getExecutor(), rm) {
- @Override
- protected void handleError() {
- // The MI command
- fIsTracingFeatureAvailable = false;
- super.handleError();
- }
- @Override
- protected void handleSuccess() {
- MITraceStatusInfo info = getData();
-
- if (fIsTracingCurrentlySupported != info.isTracingSupported()) {
- fIsTracingCurrentlySupported = info.isTracingSupported();
- getSession().dispatchEvent(new TracingSupportedChangeEvent(context, fIsTracingCurrentlySupported), getProperties());
- }
-
- if (fIsTracingCurrentlySupported) {
- // Update the tracing state in case it was stopped by the backend
- if (fIsTracingActive != info.isTracingActive()) {
- fIsTracingActive = info.isTracingActive();
- if (fIsTracingActive) {
- getSession().dispatchEvent(new TracingStartedEvent(context), getProperties());
- } else {
- getSession().dispatchEvent(new TracingStoppedEvent(context), getProperties());
- }
- }
-
- fTraceRecordsStored = info.getNumberOfCollectedFrame();
-
- rm.setData(new TraceStatusDMData(info));
- } else {
- fTraceRecordsStored = 0;
- fIsTracingActive = false;
- rm.setData(new TraceStatusDMData());
- }
- rm.done();
- }
- });
- }
-
+
+ fTraceStatusCache.execute(fCommandFactory.createMITraceStatus(context),
+ new DataRequestMonitor<MITraceStatusInfo>(getExecutor(), rm) {
+ @Override
+ protected void handleError() {
+ // The MI command
+ fIsTracingFeatureAvailable = false;
+ super.handleError();
+ }
+
+ @Override
+ protected void handleSuccess() {
+ MITraceStatusInfo info = getData();
+
+ if (fIsTracingCurrentlySupported != info.isTracingSupported()) {
+ fIsTracingCurrentlySupported = info.isTracingSupported();
+ getSession().dispatchEvent(
+ new TracingSupportedChangeEvent(context, fIsTracingCurrentlySupported),
+ getProperties());
+ }
+
+ if (fIsTracingCurrentlySupported) {
+ // Update the tracing state in case it was stopped by the backend
+ if (fIsTracingActive != info.isTracingActive()) {
+ fIsTracingActive = info.isTracingActive();
+ if (fIsTracingActive) {
+ getSession().dispatchEvent(new TracingStartedEvent(context), getProperties());
+ } else {
+ getSession().dispatchEvent(new TracingStoppedEvent(context), getProperties());
+ }
+ }
+
+ fTraceRecordsStored = info.getNumberOfCollectedFrame();
+
+ rm.setData(new TraceStatusDMData(info));
+ } else {
+ fTraceRecordsStored = 0;
+ fIsTracingActive = false;
+ rm.setData(new TraceStatusDMData());
+ }
+ rm.done();
+ }
+ });
+ }
+
@Override
- public void createTraceVariable(ITraceTargetDMContext context,
- String varName,
- String varValue,
- RequestMonitor rm) {
- if (context == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- if (fIsTracingCurrentlySupported == false) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Tracing not supported", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
+ public void createTraceVariable(ITraceTargetDMContext context, String varName, String varValue, RequestMonitor rm) {
+ if (context == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ if (fIsTracingCurrentlySupported == false) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Tracing not supported", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
if (varValue == null) {
- fConnection.queueCommand(
- fCommandFactory.createMITraceDefineVariable(context, varName),
- new DataRequestMonitor<MIInfo>(getExecutor(), rm));
+ fConnection.queueCommand(fCommandFactory.createMITraceDefineVariable(context, varName),
+ new DataRequestMonitor<MIInfo>(getExecutor(), rm));
} else {
- fConnection.queueCommand(
- fCommandFactory.createMITraceDefineVariable(context, varName, varValue),
+ fConnection.queueCommand(fCommandFactory.createMITraceDefineVariable(context, varName, varValue),
new DataRequestMonitor<MIInfo>(getExecutor(), rm));
}
}
-
@Override
- public void getTraceVariables(ITraceTargetDMContext context, final DataRequestMonitor<ITraceVariableDMData[]> rm) {
- if (context == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- if (fIsTracingCurrentlySupported == false) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Tracing not supported", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- // It may be possible to cache this call, if we can figure out that all the cases
- // where to data can change, to clear the cache in those cases
- fConnection.queueCommand(
- fCommandFactory.createMITraceListVariables(context),
+ public void getTraceVariables(ITraceTargetDMContext context, final DataRequestMonitor<ITraceVariableDMData[]> rm) {
+ if (context == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ if (fIsTracingCurrentlySupported == false) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Tracing not supported", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ // It may be possible to cache this call, if we can figure out that all the cases
+ // where to data can change, to clear the cache in those cases
+ fConnection.queueCommand(fCommandFactory.createMITraceListVariables(context),
new DataRequestMonitor<MITraceListVariablesInfo>(getExecutor(), rm) {
@Override
protected void handleSuccess() {
MITraceVariableInfo[] vars = getData().getTraceVariables();
TraceVariableDMData[] varDataArray = new TraceVariableDMData[vars.length];
for (int i = 0; i < vars.length; i++) {
- varDataArray[i] = new TraceVariableDMData(vars[i].getName(),
- vars[i].getInitialValue(),
- vars[i].getCurrentValue());
+ varDataArray[i] = new TraceVariableDMData(vars[i].getName(), vars[i].getInitialValue(),
+ vars[i].getCurrentValue());
}
-
+
rm.setData(varDataArray);
rm.done();
}
});
}
-
- /**
- * Create a trace record context
- * @since 4.0
- */
- @Override
- public ITraceRecordDMContext createTraceRecordContext(ITraceTargetDMContext ctx, String recordId) {
- return new MITraceRecordDMContext(getSession(), ctx, recordId);
- }
+ /**
+ * Create a trace record context
+ * @since 4.0
+ */
@Override
- public ITraceRecordDMContext createNextRecordContext(ITraceRecordDMContext ctx) {
- ITraceTargetDMContext targetDmc = DMContexts.getAncestorOfType(ctx, ITraceTargetDMContext.class);
- if (ctx instanceof InvalidTraceRecordDMContext) {
- // No specified context, so we return the context for the first
- return createTraceRecordContext(targetDmc, "0"); //$NON-NLS-1$
- }
- if (ctx instanceof MITraceRecordDMContext) {
- String recordId = ((MITraceRecordDMContext)ctx).getRecordId();
- int recordIndex = Integer.parseInt(recordId);
- recordIndex++;
- if (recordIndex == fTraceRecordsStored) {
- // Loop back to the front
- recordIndex = 0;
- }
- return new MITraceRecordDMContext(getSession(),
- targetDmc,
- Integer.toString(recordIndex));
- }
- return null;
- }
+ public ITraceRecordDMContext createTraceRecordContext(ITraceTargetDMContext ctx, String recordId) {
+ return new MITraceRecordDMContext(getSession(), ctx, recordId);
+ }
@Override
- public ITraceRecordDMContext createPrevRecordContext(ITraceRecordDMContext ctx) {
- if (ctx instanceof MITraceRecordDMContext) {
- ITraceTargetDMContext targetDmc = DMContexts.getAncestorOfType(ctx, ITraceTargetDMContext.class);
- String recordId = ((MITraceRecordDMContext)ctx).getRecordId();
- int recordIndex = Integer.parseInt(recordId);
- if (recordIndex == 0) {
- // Loop back to the end
- recordIndex = fTraceRecordsStored; // The last index of a trace record (zero-based)
- }
- recordIndex--;
- return new MITraceRecordDMContext(getSession(),
- targetDmc,
- Integer.toString(recordIndex));
- }
- return null;
- }
+ public ITraceRecordDMContext createNextRecordContext(ITraceRecordDMContext ctx) {
+ ITraceTargetDMContext targetDmc = DMContexts.getAncestorOfType(ctx, ITraceTargetDMContext.class);
+ if (ctx instanceof InvalidTraceRecordDMContext) {
+ // No specified context, so we return the context for the first
+ return createTraceRecordContext(targetDmc, "0"); //$NON-NLS-1$
+ }
+ if (ctx instanceof MITraceRecordDMContext) {
+ String recordId = ((MITraceRecordDMContext) ctx).getRecordId();
+ int recordIndex = Integer.parseInt(recordId);
+ recordIndex++;
+ if (recordIndex == fTraceRecordsStored) {
+ // Loop back to the front
+ recordIndex = 0;
+ }
+ return new MITraceRecordDMContext(getSession(), targetDmc, Integer.toString(recordIndex));
+ }
+ return null;
+ }
+ @Override
+ public ITraceRecordDMContext createPrevRecordContext(ITraceRecordDMContext ctx) {
+ if (ctx instanceof MITraceRecordDMContext) {
+ ITraceTargetDMContext targetDmc = DMContexts.getAncestorOfType(ctx, ITraceTargetDMContext.class);
+ String recordId = ((MITraceRecordDMContext) ctx).getRecordId();
+ int recordIndex = Integer.parseInt(recordId);
+ if (recordIndex == 0) {
+ // Loop back to the end
+ recordIndex = fTraceRecordsStored; // The last index of a trace record (zero-based)
+ }
+ recordIndex--;
+ return new MITraceRecordDMContext(getSession(), targetDmc, Integer.toString(recordIndex));
+ }
+ return null;
+ }
@Override
- public void getCurrentTraceRecordContext(ITraceTargetDMContext context, DataRequestMonitor<ITraceRecordDMContext> drm) {
- if (fCurrentRecordDmc == null) {
- drm.setData(new InvalidTraceRecordDMContext(getSession(), context));
- } else {
- drm.setData(fCurrentRecordDmc);
- }
- drm.done();
- }
+ public void getCurrentTraceRecordContext(ITraceTargetDMContext context,
+ DataRequestMonitor<ITraceRecordDMContext> drm) {
+ if (fCurrentRecordDmc == null) {
+ drm.setData(new InvalidTraceRecordDMContext(getSession(), context));
+ } else {
+ drm.setData(fCurrentRecordDmc);
+ }
+ drm.done();
+ }
@Override
- public void selectTraceRecord(final ITraceRecordDMContext context, final RequestMonitor rm) {
- if (fIsTracingCurrentlySupported == false) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Tracing not supported", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- if (context instanceof MITraceRecordDMContext) {
- ITraceTargetDMContext targetDmc = DMContexts.getAncestorOfType(context, ITraceTargetDMContext.class);
- String recordId = ((MITraceRecordDMContext)context).getRecordId();
- final int reference = Integer.parseInt(recordId);
-
- if (reference < 0) {
- // This was the old way to indicate that we want to exit visualization mode.
- // We continue supporting it for backward compatibility
- stopTraceVisualization(targetDmc, rm);
- return;
- }
-
- fConnection.queueCommand(
- fCommandFactory.createMITraceFindFrameNumber(targetDmc, reference),
- new DataRequestMonitor<MITraceFindInfo>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- if (getData().isFound() == false) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Could not find trace record", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- fCurrentRecordDmc = context;
- fTracepointIndexForTraceRecord = getData().getTraceRecord().getTracepointId();
-
- // We could rely on the TraceRecordSelectedChangedEvent to update all the views, but this
- // would require a lot of changes.
- // Notice that looking at a new trace record should behave in the same manner
- // as when the debugger suspends during normal execution; therefore we can simply
- // trigger an MIStoppedEvent, as if reported by GDB. Note that we do this already for
- // cases where GDB is missing such a event (like older versions of GDB when using a CLI command)
- IMIProcesses procService = getServicesTracker().getService(IMIProcesses.class);
- if (procService == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Could not find necessary services", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- final MIResultRecord rr = getData().getMIOutput().getMIResultRecord();
- if (rr == null) {
- assert false;
- rm.done();
- return;
- }
-
- // First find the process we are using.
- ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(context, ICommandControlDMContext.class);
- procService.getProcessesBeingDebugged(
- controlDmc,
- new DataRequestMonitor<IDMContext[]>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- assert getData() != null;
- assert getData().length == 1;
-
- if (getData() == null || getData().length < 1) {
- rm.done();
- return;
- }
-
- // Choose the first process for now, until gdb can tell
- // us which process the trace record is associated with.
- // Or maybe GDB already tells us by only reporting a single
- // process?
- IContainerDMContext processContainerDmc = (IContainerDMContext)(getData()[0]);
-
- // Now find the proper thread. We must do this here because in post-mortem debugging
- // we cannot rely on MIRunControl using 'thread', as it will fail
- IMIProcesses procService = getServicesTracker().getService(IMIProcesses.class);
- if (procService == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Could not find necessary services", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- procService.getProcessesBeingDebugged(
- processContainerDmc,
- new DataRequestMonitor<IDMContext[]>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- assert getData() != null;
- assert getData().length == 1;
-
- if (getData() == null || getData().length < 1) {
- rm.done();
- return;
- }
-
- IExecutionDMContext execDmc = (IExecutionDMContext)getData()[0];
- MIEvent<?> event = MITracepointSelectedEvent.parse(execDmc, rr.getToken(), rr.getMIResults());
- getSession().dispatchEvent(event, getProperties());
-
- rm.done();
- }
- });
- }
- });
- }
- });
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid trace record context.", null)); //$NON-NLS-1$
- rm.done();
- }
- }
+ public void selectTraceRecord(final ITraceRecordDMContext context, final RequestMonitor rm) {
+ if (fIsTracingCurrentlySupported == false) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Tracing not supported", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ if (context instanceof MITraceRecordDMContext) {
+ ITraceTargetDMContext targetDmc = DMContexts.getAncestorOfType(context, ITraceTargetDMContext.class);
+ String recordId = ((MITraceRecordDMContext) context).getRecordId();
+ final int reference = Integer.parseInt(recordId);
+
+ if (reference < 0) {
+ // This was the old way to indicate that we want to exit visualization mode.
+ // We continue supporting it for backward compatibility
+ stopTraceVisualization(targetDmc, rm);
+ return;
+ }
+
+ fConnection.queueCommand(fCommandFactory.createMITraceFindFrameNumber(targetDmc, reference),
+ new DataRequestMonitor<MITraceFindInfo>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ if (getData().isFound() == false) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR,
+ "Could not find trace record", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ fCurrentRecordDmc = context;
+ fTracepointIndexForTraceRecord = getData().getTraceRecord().getTracepointId();
+
+ // We could rely on the TraceRecordSelectedChangedEvent to update all the views, but this
+ // would require a lot of changes.
+ // Notice that looking at a new trace record should behave in the same manner
+ // as when the debugger suspends during normal execution; therefore we can simply
+ // trigger an MIStoppedEvent, as if reported by GDB. Note that we do this already for
+ // cases where GDB is missing such a event (like older versions of GDB when using a CLI command)
+ IMIProcesses procService = getServicesTracker().getService(IMIProcesses.class);
+ if (procService == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR,
+ "Could not find necessary services", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ final MIResultRecord rr = getData().getMIOutput().getMIResultRecord();
+ if (rr == null) {
+ assert false;
+ rm.done();
+ return;
+ }
+
+ // First find the process we are using.
+ ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(context,
+ ICommandControlDMContext.class);
+ procService.getProcessesBeingDebugged(controlDmc,
+ new DataRequestMonitor<IDMContext[]>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ assert getData() != null;
+ assert getData().length == 1;
+
+ if (getData() == null || getData().length < 1) {
+ rm.done();
+ return;
+ }
+
+ // Choose the first process for now, until gdb can tell
+ // us which process the trace record is associated with.
+ // Or maybe GDB already tells us by only reporting a single
+ // process?
+ IContainerDMContext processContainerDmc = (IContainerDMContext) (getData()[0]);
+
+ // Now find the proper thread. We must do this here because in post-mortem debugging
+ // we cannot rely on MIRunControl using 'thread', as it will fail
+ IMIProcesses procService = getServicesTracker()
+ .getService(IMIProcesses.class);
+ if (procService == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
+ INTERNAL_ERROR, "Could not find necessary services", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ procService.getProcessesBeingDebugged(processContainerDmc,
+ new DataRequestMonitor<IDMContext[]>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ assert getData() != null;
+ assert getData().length == 1;
+
+ if (getData() == null || getData().length < 1) {
+ rm.done();
+ return;
+ }
+
+ IExecutionDMContext execDmc = (IExecutionDMContext) getData()[0];
+ MIEvent<?> event = MITracepointSelectedEvent.parse(execDmc,
+ rr.getToken(), rr.getMIResults());
+ getSession().dispatchEvent(event, getProperties());
+
+ rm.done();
+ }
+ });
+ }
+ });
+ }
+ });
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid trace record context.", //$NON-NLS-1$
+ null));
+ rm.done();
+ }
+ }
/** @since 4.4 */
@Override
public void stopTraceVisualization(final ITraceTargetDMContext context, final RequestMonitor rm) {
- if (fIsTracingCurrentlySupported == false) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Tracing not supported", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- if (fBackend.getSessionType() == SessionType.CORE) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Cannot stop visualizing for a post mortem session", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- fConnection.queueCommand(
- fCommandFactory.createMITraceFindNone(context),
- new DataRequestMonitor<MITraceFindInfo>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- assert getData().isFound() == false;
- fCurrentRecordDmc = null;
- // This event will indicate to the other services that we are no longer visualizing trace data.
- ITraceRecordDMContext invalidDmc = new InvalidTraceRecordDMContext(getSession(), context);
- getSession().dispatchEvent(new TraceRecordSelectedChangedEvent(invalidDmc), getProperties());
-
- rm.done();
- return;
- }
- });
- }
-
+ if (fIsTracingCurrentlySupported == false) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Tracing not supported", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ if (fBackend.getSessionType() == SessionType.CORE) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED,
+ "Cannot stop visualizing for a post mortem session", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ fConnection.queueCommand(fCommandFactory.createMITraceFindNone(context),
+ new DataRequestMonitor<MITraceFindInfo>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ assert getData().isFound() == false;
+ fCurrentRecordDmc = null;
+ // This event will indicate to the other services that we are no longer visualizing trace data.
+ ITraceRecordDMContext invalidDmc = new InvalidTraceRecordDMContext(getSession(), context);
+ getSession().dispatchEvent(new TraceRecordSelectedChangedEvent(invalidDmc), getProperties());
+
+ rm.done();
+ return;
+ }
+ });
+ }
+
@Override
- public void getTraceRecordData(final ITraceRecordDMContext context, final DataRequestMonitor<ITraceRecordDMData> rm) {
- if (context instanceof MITraceRecordDMContext) {
-
- RequestMonitor tdumpRm = new ImmediateRequestMonitor(rm) {
+ public void getTraceRecordData(final ITraceRecordDMContext context,
+ final DataRequestMonitor<ITraceRecordDMData> rm) {
+ if (context instanceof MITraceRecordDMContext) {
+
+ RequestMonitor tdumpRm = new ImmediateRequestMonitor(rm) {
@Override
protected void handleSuccess() {
- fConnection.queueCommand(
- fCommandFactory.createCLITraceDump(context),
+ fConnection.queueCommand(fCommandFactory.createCLITraceDump(context),
new DataRequestMonitor<CLITraceDumpInfo>(getExecutor(), rm) {
@Override
protected void handleSuccess() {
- TraceRecordDMData data = new TraceRecordDMData(
- getData().getContent(),
- getData().getTracepointNumber(),
- getData().getFrameNumber(),
- getData().getTimestamp()
- );
+ TraceRecordDMData data = new TraceRecordDMData(getData().getContent(),
+ getData().getTracepointNumber(), getData().getFrameNumber(),
+ getData().getTimestamp());
rm.setData(data);
rm.done();
}
});
}
};
-
- // If we are pointing to the right context, we can do the tdump right away,
- // if not, we should first select the record.
- // This is because 'tdump' does not take any parameters to specify
- // which record we want to dump.
- if (fCurrentRecordDmc.equals(context)) {
- tdumpRm.done();
- } else {
- selectTraceRecord(context, tdumpRm);
- }
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid trace record context.", null)); //$NON-NLS-1$
- rm.done();
- }
+
+ // If we are pointing to the right context, we can do the tdump right away,
+ // if not, we should first select the record.
+ // This is because 'tdump' does not take any parameters to specify
+ // which record we want to dump.
+ if (fCurrentRecordDmc.equals(context)) {
+ tdumpRm.done();
+ } else {
+ selectTraceRecord(context, tdumpRm);
+ }
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid trace record context.", //$NON-NLS-1$
+ null));
+ rm.done();
+ }
}
-
+
/** @since 4.4 */
@Override
- public void setCircularTraceBuffer(final ITraceTargetDMContext context, boolean useCircularBuffer, final RequestMonitor rm) {
- if (context == null) {
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
- return;
- }
-
- if (fIsTracingCurrentlySupported == false) {
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Tracing not supported", null)); //$NON-NLS-1$
- return;
- }
-
- fConnection.queueCommand(
- fCommandFactory.createMIGDBSetCircularTraceBuffer(context, useCircularBuffer),
+ public void setCircularTraceBuffer(final ITraceTargetDMContext context, boolean useCircularBuffer,
+ final RequestMonitor rm) {
+ if (context == null) {
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
+ return;
+ }
+
+ if (fIsTracingCurrentlySupported == false) {
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Tracing not supported", null)); //$NON-NLS-1$
+ return;
+ }
+
+ fConnection.queueCommand(fCommandFactory.createMIGDBSetCircularTraceBuffer(context, useCircularBuffer),
new ImmediateDataRequestMonitor<MIInfo>(rm) {
@Override
protected void handleSuccess() {
@@ -1173,26 +1182,26 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
/** @since 4.4 */
@Override
- public void setDisconnectedTracing(final ITraceTargetDMContext context, boolean disconnectedTracing,final RequestMonitor rm) {
+ public void setDisconnectedTracing(final ITraceTargetDMContext context, boolean disconnectedTracing,
+ final RequestMonitor rm) {
if (context == null) {
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
return;
}
-
+
if (fIsTracingCurrentlySupported == false) {
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Tracing not supported", null)); //$NON-NLS-1$
return;
}
-
- fConnection.queueCommand(
- fCommandFactory.createMIGDBSetDisconnectedTracing(context, disconnectedTracing),
+
+ fConnection.queueCommand(fCommandFactory.createMIGDBSetDisconnectedTracing(context, disconnectedTracing),
new ImmediateDataRequestMonitor<MIInfo>(rm) {
@Override
protected void handleSuccess() {
fTraceStatusCache.reset(context);
rm.done();
}
- });
+ });
}
/** @since 4.4 */
@@ -1211,6 +1220,6 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
@Override
public void flushCache(IDMContext context) {
- fTraceStatusCache.reset(context);
+ fTraceStatusCache.reset(context);
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBTraceControl_7_4.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBTraceControl_7_4.java
index cb34e3e3788..cb850372f59 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBTraceControl_7_4.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBTraceControl_7_4.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Marc Khouzam (Ericsson) - Initial API and implementation
*******************************************************************************/
@@ -30,7 +30,7 @@ import org.eclipse.debug.core.ILaunchConfiguration;
/**
* This class adds extra support for Trace Control for GDB 7.4
- *
+ *
* @since 4.4
*/
public class GDBTraceControl_7_4 extends GDBTraceControl_7_2 {
@@ -51,18 +51,16 @@ public class GDBTraceControl_7_4 extends GDBTraceControl_7_2 {
}
});
}
-
+
private void doInitialize(RequestMonitor requestMonitor) {
// Register this service.
- register(new String[] {IGDBTraceControl.class.getName(),
- IGDBTraceControl2.class.getName(),
- GDBTraceControl_7_2.class.getName(),
- GDBTraceControl_7_4.class.getName()},
- new Hashtable<String, String>());
-
+ register(
+ new String[] { IGDBTraceControl.class.getName(), IGDBTraceControl2.class.getName(),
+ GDBTraceControl_7_2.class.getName(), GDBTraceControl_7_4.class.getName() },
+ new Hashtable<String, String>());
fConnection = getServicesTracker().getService(ICommandControlService.class);
- fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
+ fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
requestMonitor.done();
}
@@ -75,22 +73,21 @@ public class GDBTraceControl_7_4 extends GDBTraceControl_7_2 {
@Override
public void setTraceUser(final ITraceTargetDMContext context, String userName, final RequestMonitor rm) {
- if (context == null) {
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
- return;
- }
-
- if (isTracingCurrentlySupported() == false) {
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Tracing not supported", null)); //$NON-NLS-1$
- return;
- }
-
- fConnection.queueCommand(
- fCommandFactory.createMIGDBSetTraceUser(context, userName),
+ if (context == null) {
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
+ return;
+ }
+
+ if (isTracingCurrentlySupported() == false) {
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Tracing not supported", null)); //$NON-NLS-1$
+ return;
+ }
+
+ fConnection.queueCommand(fCommandFactory.createMIGDBSetTraceUser(context, userName),
new ImmediateDataRequestMonitor<MIInfo>(rm) {
@Override
protected void handleSuccess() {
- getTraceStatusCache().reset(context);
+ getTraceStatusCache().reset(context);
rm.done();
}
});
@@ -98,24 +95,23 @@ public class GDBTraceControl_7_4 extends GDBTraceControl_7_2 {
@Override
public void setTraceNotes(final ITraceTargetDMContext context, String note, final RequestMonitor rm) {
- if (context == null) {
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
- return;
- }
+ if (context == null) {
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
+ return;
+ }
- if (isTracingCurrentlySupported() == false) {
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Tracing not supported", null)); //$NON-NLS-1$
- return;
- }
+ if (isTracingCurrentlySupported() == false) {
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Tracing not supported", null)); //$NON-NLS-1$
+ return;
+ }
- getTraceStatusCache().reset(context);
+ getTraceStatusCache().reset(context);
- fConnection.queueCommand(
- fCommandFactory.createMIGDBSetTraceNotes(context, note),
+ fConnection.queueCommand(fCommandFactory.createMIGDBSetTraceNotes(context, note),
new ImmediateDataRequestMonitor<MIInfo>(rm) {
@Override
protected void handleSuccess() {
- getTraceStatusCache().reset(context);
+ getTraceStatusCache().reset(context);
rm.done();
}
});
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GdbDebugServicesFactory.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GdbDebugServicesFactory.java
index e90ca2813e4..20072bceb2d 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GdbDebugServicesFactory.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GdbDebugServicesFactory.java
@@ -7,10 +7,10 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
- * Nokia - create and use backend service.
+ * Nokia - create and use backend service.
* Onur Akdemir (TUBITAK BILGEM-ITI) - Multi-process debugging (Bug 237306)
* Marc Khouzam (Ericsson) - Support for GDB 7.4 (Bug 367788)
* Marc Khouzam (Ericsson) - Include IGDBHardware service for the multicore visualizer (Bug 335027)
@@ -75,9 +75,9 @@ public class GdbDebugServicesFactory extends AbstractDsfDebugServicesFactory {
/** @since 4.0 */
public static final String GDB_6_8_VERSION = "6.8"; //$NON-NLS-1$
/** @since 4.0 */
- public static final String GDB_7_0_VERSION = "7.0"; //$NON-NLS-1$
+ public static final String GDB_7_0_VERSION = "7.0"; //$NON-NLS-1$
/** @since 4.0 */
- public static final String GDB_7_1_VERSION = "7.1"; //$NON-NLS-1$
+ public static final String GDB_7_1_VERSION = "7.1"; //$NON-NLS-1$
/** @since 4.0 */
public static final String GDB_7_2_VERSION = "7.2"; //$NON-NLS-1$
/** @since 4.1 */
@@ -101,7 +101,7 @@ public class GdbDebugServicesFactory extends AbstractDsfDebugServicesFactory {
private final String fVersion;
private final ILaunchConfiguration fConfiguration;
-
+
/** @since 5.0 */
public GdbDebugServicesFactory(String version, ILaunchConfiguration config) {
fVersion = version;
@@ -141,48 +141,46 @@ public class GdbDebugServicesFactory extends AbstractDsfDebugServicesFactory {
return LaunchUtils.getIsNonStopMode(configuration);
}
- public String getVersion() { return fVersion; }
-
+ public String getVersion() {
+ return fVersion;
+ }
+
@Override
- @SuppressWarnings("unchecked")
- public <V> V createService(Class<V> clazz, DsfSession session, Object ... optionalArguments) {
+ @SuppressWarnings("unchecked")
+ public <V> V createService(Class<V> clazz, DsfSession session, Object... optionalArguments) {
if (MIBreakpointsManager.class.isAssignableFrom(clazz)) {
- return (V)createBreakpointManagerService(session);
- }
- else if (ICommandControl.class.isAssignableFrom(clazz)) {
+ return (V) createBreakpointManagerService(session);
+ } else if (ICommandControl.class.isAssignableFrom(clazz)) {
for (Object arg : optionalArguments) {
if (arg instanceof ILaunchConfiguration) {
- return (V)createCommandControl(session, (ILaunchConfiguration)arg);
+ return (V) createCommandControl(session, (ILaunchConfiguration) arg);
}
}
- }
- else if (IMIBackend.class.isAssignableFrom(clazz)) {
+ } else if (IMIBackend.class.isAssignableFrom(clazz)) {
for (Object arg : optionalArguments) {
if (arg instanceof ILaunchConfiguration) {
- return (V)createBackendGDBService(session, (ILaunchConfiguration)arg);
+ return (V) createBackendGDBService(session, (ILaunchConfiguration) arg);
}
}
} else if (IGDBTraceControl.class.isAssignableFrom(clazz)) {
for (Object arg : optionalArguments) {
if (arg instanceof ILaunchConfiguration) {
- return (V)createTraceControlService(session, (ILaunchConfiguration)arg);
+ return (V) createTraceControlService(session, (ILaunchConfiguration) arg);
}
}
} else if (IGDBHardwareAndOS.class.isAssignableFrom(clazz)) {
for (Object arg : optionalArguments) {
if (arg instanceof ILaunchConfiguration) {
- return (V)createHardwareAndOSService(session, (ILaunchConfiguration)arg);
+ return (V) createHardwareAndOSService(session, (ILaunchConfiguration) arg);
}
}
- }
- else if (MIBreakpointsSynchronizer.class.isAssignableFrom(clazz)) {
- return (V)createBreakpointsSynchronizerService(session);
- }
- else if (IGDBFocusSynchronizer.class.isAssignableFrom(clazz)) {
- return (V)createFocusSynchronizerService(session);
+ } else if (MIBreakpointsSynchronizer.class.isAssignableFrom(clazz)) {
+ return (V) createBreakpointsSynchronizerService(session);
+ } else if (IGDBFocusSynchronizer.class.isAssignableFrom(clazz)) {
+ return (V) createFocusSynchronizerService(session);
}
- return super.createService(clazz, session, optionalArguments);
+ return super.createService(clazz, session, optionalArguments);
}
protected MIBreakpointsManager createBreakpointManagerService(DsfSession session) {
@@ -216,10 +214,10 @@ public class GdbDebugServicesFactory extends AbstractDsfDebugServicesFactory {
}
return new MIBreakpoints(session);
}
-
+
protected ICommandControl createCommandControl(DsfSession session, ILaunchConfiguration config) {
if (compareVersionWith(GDB_7_12_VERSION) >= 0) {
- return new GDBControl_7_12(session, config, new CommandFactory_6_8());
+ return new GDBControl_7_12(session, config, new CommandFactory_6_8());
}
if (compareVersionWith(GDB_7_7_VERSION) >= 0) {
return new GDBControl_7_7(session, config, new CommandFactory_6_8());
@@ -253,7 +251,7 @@ public class GdbDebugServicesFactory extends AbstractDsfDebugServicesFactory {
}
return new MIDisassembly(session);
}
-
+
@Override
protected IExpressions createExpressionService(DsfSession session) {
// Replace the standard Expressions service with a version that supports pattern matching.
@@ -281,7 +279,7 @@ public class GdbDebugServicesFactory extends AbstractDsfDebugServicesFactory {
protected IModules createModulesService(DsfSession session) {
return new MIModules(session);
}
-
+
@Override
protected IProcesses createProcessesService(DsfSession session) {
if (compareVersionWith(GDB_7_12_VERSION) >= 0) {
@@ -349,12 +347,12 @@ public class GdbDebugServicesFactory extends AbstractDsfDebugServicesFactory {
protected ISourceLookup createSourceLookupService(DsfSession session) {
return new GDBSourceLookup(session);
}
-
+
@Override
protected IStack createStackService(DsfSession session) {
return new MIStack(session);
}
-
+
/** @since 3.0 */
protected IGDBTraceControl createTraceControlService(DsfSession session, ILaunchConfiguration config) {
if (compareVersionWith(GDB_7_4_VERSION) >= 0) {
@@ -369,9 +367,9 @@ public class GdbDebugServicesFactory extends AbstractDsfDebugServicesFactory {
// It could be done with restricted functionality for GDB 7.1 and maybe even 7.0
// but the service would have to be properly coded, as some MI commands don't exists
// in those older GDB versions. Also, gdbserver only supports tracing starting with 7.2
- return null;
+ return null;
}
-
+
/** @since 4.1 */
protected IGDBHardwareAndOS createHardwareAndOSService(DsfSession session, ILaunchConfiguration config) {
if (compareVersionWith(GDB_7_10_VERSION) >= 0) {
@@ -382,27 +380,27 @@ public class GdbDebugServicesFactory extends AbstractDsfDebugServicesFactory {
}
return new GDBHardwareAndOS(session);
}
-
+
/**
* @since 4.2
*/
protected MIBreakpointsSynchronizer createBreakpointsSynchronizerService(DsfSession session) {
return new MIBreakpointsSynchronizer(session);
}
-
+
/**
* @since 5.2
*/
protected IGDBFocusSynchronizer createFocusSynchronizerService(DsfSession session) {
return new GDBFocusSynchronizer(session);
}
-
+
/**
- * Compares the GDB version of the current debug session with the one specified by
- * parameter 'version'. Returns -1, 0, or 1 if the current version is less than,
+ * Compares the GDB version of the current debug session with the one specified by
+ * parameter 'version'. Returns -1, 0, or 1 if the current version is less than,
* equal to, or greater than the specified version, respectively.
* @param version The version to compare with
- * @return -1, 0, or 1 if the current version is less than, equal to, or greater than
+ * @return -1, 0, or 1 if the current version is less than, equal to, or greater than
* the specified version, respectively.
* @since 4.8
*/
@@ -414,28 +412,25 @@ public class GdbDebugServicesFactory extends AbstractDsfDebugServicesFactory {
* A static method that will compare the version of GDB for the specified session and
* the minimum GDB version required by the caller. A warning will be logged if the
* running version is not sufficient.
- *
+ *
* @param session The debug session running GDB
* @param minVersion The minimum version of GDB required
* @param service The service requesting the check.
- *
+ *
* @since 4.8
*/
public static void validateGdbVersion(DsfSession session, String minVersion, IDsfService service) {
- ILaunch launch = (ILaunch)session.getModelAdapter(ILaunch.class);
+ ILaunch launch = (ILaunch) session.getModelAdapter(ILaunch.class);
if (launch instanceof GdbLaunch) {
- IDsfDebugServicesFactory servicesFactory = ((GdbLaunch)launch).getServiceFactory();
+ IDsfDebugServicesFactory servicesFactory = ((GdbLaunch) launch).getServiceFactory();
if (servicesFactory instanceof GdbDebugServicesFactory) {
- String version = ((GdbDebugServicesFactory)servicesFactory).getVersion();
+ String version = ((GdbDebugServicesFactory) servicesFactory).getVersion();
if (LaunchUtils.compareVersions(minVersion, version) > 0) {
assert false;
-
+
GdbPlugin.log(
- new Status(
- IStatus.WARNING, GdbPlugin.PLUGIN_ID,
- NLS.bind(
- Messages.GDB_Version_Mismatch,
- new Object[] { version, service.getClass().getName(), minVersion })));
+ new Status(IStatus.WARNING, GdbPlugin.PLUGIN_ID, NLS.bind(Messages.GDB_Version_Mismatch,
+ new Object[] { version, service.getClass().getName(), minVersion })));
}
return;
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBBackend.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBBackend.java
index ea6783bb786..e283b628d65 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBBackend.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBBackend.java
@@ -44,7 +44,7 @@ import org.eclipse.core.runtime.IPath;
*/
public interface IGDBBackend extends IMIBackend {
- /**
+ /**
* ID to use when requesting that the interruptAndWait call wait for an
* implementation-specific default.
* @since 3.0 */
@@ -52,15 +52,15 @@ public interface IGDBBackend extends IMIBackend {
/**
* Get path of the debugged program on host.
- *
+ *
* @return IPath
*/
public IPath getProgramPath();
/**
* Get init file for GDB.
- *
- * @return file name, may have relative or absolute path, or empty string ("")
+ *
+ * @return file name, may have relative or absolute path, or empty string ("")
* indicating an init file is not specified.
* @throws CoreException
* - error in getting the option.
@@ -69,7 +69,7 @@ public interface IGDBBackend extends IMIBackend {
/**
* get arguments for the debugged program.
- *
+ *
* @return String
* @throws CoreException
* - error in getting the option.
@@ -77,8 +77,8 @@ public interface IGDBBackend extends IMIBackend {
public String getProgramArguments() throws CoreException;
/**
- * Get working directory for GDB.
- *
+ * Get working directory for GDB.
+ *
* @return IPath - null if no meaningful value found.
* @throws CoreException
* - if any error occurs.
@@ -95,35 +95,35 @@ public interface IGDBBackend extends IMIBackend {
* Returns the list of user-specified variables.
* If no variables are specified, should return an empty list.
* Should not return null.
- *
- * @since 3.0
+ *
+ * @since 3.0
*/
public Properties getEnvironmentVariables() throws CoreException;
-
- /**
+
+ /**
* Returns whether the native environment should be cleared before
* setting the user-specified environment variables.
- *
+ *
* @since 3.0 */
public boolean getClearEnvironment() throws CoreException;
-
+
/**
* Sends an interrupt signal to the GDB process.
*/
public void interrupt();
-
+
/**
- * Interrupts the backend and wait to confirm the interrupt
- * succeeded. The request monitor indicates to the caller if
+ * Interrupts the backend and wait to confirm the interrupt
+ * succeeded. The request monitor indicates to the caller if
* the interrupt succeeded or not.
- *
+ *
* @param timeout Maximum number of milliseconds to wait to confirm
* that the backend has been interrupted. A value
- * of INTERRUPT_TIMEOUT_DEFAULT specifies to use an
+ * of INTERRUPT_TIMEOUT_DEFAULT specifies to use an
* implementation-specific default value.
* Using a value of 0 or a negative value has unspecified
- * behavior.
- *
+ * behavior.
+ *
* @since 3.0
*/
public void interruptAndWait(int timeout, RequestMonitor rm);
@@ -144,7 +144,7 @@ public interface IGDBBackend extends IMIBackend {
/**
* @return true if the ongoing session is attaching to a program locally or remotely.
- */
+ */
public boolean getIsAttachSession();
/**
@@ -156,20 +156,20 @@ public interface IGDBBackend extends IMIBackend {
* doesn't find out about new or destroyed threads unless it polls gdb. The
* user will enable this behavior if he is debugging such a target
* (typically an embedded one)
- *
+ *
* @since 3.0
*/
public boolean getUpdateThreadListOnSuspend() throws CoreException;
-
+
/**
* @return True if the full GDB console should be used. False otherwise.
- *
+ *
* @since 5.2
*/
default boolean isFullGdbConsoleSupported() {
return false;
}
-
+
/**
* @return The real GDB process that was started for the debug session
* @since 5.2
@@ -177,7 +177,7 @@ public interface IGDBBackend extends IMIBackend {
default Process getProcess() {
throw new RuntimeException();
}
-
+
/**
* Returns the PTY used when starting the GDB process.
* Can be null if no PTY was used.
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBHardwareAndOS.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBHardwareAndOS.java
index 6409ffde763..ddfa314a993 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBHardwareAndOS.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBHardwareAndOS.java
@@ -22,94 +22,95 @@ import org.eclipse.cdt.dsf.service.IDsfService;
* <strong>EXPERIMENTAL</strong>. This class or interface has been added as part
* of a work in progress. There is no guarantee that this API will work or that
* it will remain the same.
- *
+ *
* The IGDBHardware service provides access to information about the target
* hardware, such as the number of cores.
- *
+ *
* @since 4.1
*/
public interface IGDBHardwareAndOS extends IDsfService {
- /**
- * The physical target that has CPUs and Cores.
- */
- public interface IHardwareTargetDMContext extends IDMContext {}
+ /**
+ * The physical target that has CPUs and Cores.
+ */
+ public interface IHardwareTargetDMContext extends IDMContext {
+ }
+
+ /**
+ * A physical container of cores.
+ */
+ public interface ICPUDMContext extends IDMContext {
+ String getId();
+ }
+
+ /**
+ * A logical core. Without SMT (Simultaneous Multi-Threading),
+ * a logical core is a physical core. However, with SMT, each
+ * physical core will have two logical cores.
+ * This context represents each logical core.
+ */
+ public interface ICoreDMContext extends IDMContext {
+ String getId();
+ }
+
+ /**
+ * Model data interface corresponding to ICPUDMContext.
+ */
+ public interface ICPUDMData extends IDMData {
+ /** Number of cores contained in this CPU */
+ int getNumCores();
+ }
+
+ /**
+ * Model data interface corresponding to ICoreDMContext.
+ */
+ public interface ICoreDMData extends IDMData {
+ /**
+ * The physical id of the core. Multiple cores can have
+ * the same physical id in the case of Simultaneous Multi-Threading.
+ */
+ String getPhysicalId();
+ }
- /**
- * A physical container of cores.
- */
- public interface ICPUDMContext extends IDMContext {
- String getId();
- }
+ //
+ // Events, e.g., a core halting, starting, etc
+ //
- /**
- * A logical core. Without SMT (Simultaneous Multi-Threading),
- * a logical core is a physical core. However, with SMT, each
- * physical core will have two logical cores.
- * This context represents each logical core.
- */
- public interface ICoreDMContext extends IDMContext {
- String getId();
- }
-
- /**
- * Model data interface corresponding to ICPUDMContext.
- */
- public interface ICPUDMData extends IDMData {
- /** Number of cores contained in this CPU */
- int getNumCores();
- }
+ /**
+ * Returns an array of CPUs, based on the specified context.
+ *
+ * @param context The context to which this method applies.
+ */
+ public void getCPUs(IHardwareTargetDMContext context, DataRequestMonitor<ICPUDMContext[]> rm);
- /**
- * Model data interface corresponding to ICoreDMContext.
- */
- public interface ICoreDMData extends IDMData {
- /**
- * The physical id of the core. Multiple cores can have
- * the same physical id in the case of Simultaneous Multi-Threading.
- */
- String getPhysicalId();
- }
+ /**
+ * Returns an array of cores, based on the specified context.
+ *
+ * @param context The context to which this method applies.
+ * For an IHardwareTargetDMContext, all cores will be returned;
+ * for an ICPUDMContext, the cores on that CPU will be returned.
+ */
+ public void getCores(IDMContext context, DataRequestMonitor<ICoreDMContext[]> rm);
- //
- // Events, e.g., a core halting, starting, etc
- //
-
- /**
- * Returns an array of CPUs, based on the specified context.
- *
- * @param context The context to which this method applies.
- */
- public void getCPUs(IHardwareTargetDMContext context, DataRequestMonitor<ICPUDMContext[]> rm);
+ /**
+ * Retrieves data for a given ICPUDMContext or ICoreDMContext context.
+ */
+ public void getExecutionData(IDMContext dmc, DataRequestMonitor<IDMData> rm);
- /**
- * Returns an array of cores, based on the specified context.
- *
- * @param context The context to which this method applies.
- * For an IHardwareTargetDMContext, all cores will be returned;
- * for an ICPUDMContext, the cores on that CPU will be returned.
- */
- public void getCores(IDMContext context, DataRequestMonitor<ICoreDMContext[]> rm);
-
- /**
- * Retrieves data for a given ICPUDMContext or ICoreDMContext context.
- */
- public void getExecutionData(IDMContext dmc, DataRequestMonitor<IDMData> rm);
-
- /**
- * Create a CPU context.
- *
- * @param targetDmc The parent context of this context
- * @param CPUId The id of the CPU
- */
- public ICPUDMContext createCPUContext(IHardwareTargetDMContext targetDmc, String CPUId);
+ /**
+ * Create a CPU context.
+ *
+ * @param targetDmc The parent context of this context
+ * @param CPUId The id of the CPU
+ */
+ public ICPUDMContext createCPUContext(IHardwareTargetDMContext targetDmc, String CPUId);
- /**
- * Create a core context.
- *
- * @param cpuDmc The parent CPU context of this context
- * @param coreId The id of the core
- */
- public ICoreDMContext createCoreContext(ICPUDMContext cpuDmc, String coreId);
+ /**
+ * Create a core context.
+ *
+ * @param cpuDmc The parent CPU context of this context
+ * @param coreId The id of the core
+ */
+ public ICoreDMContext createCoreContext(ICPUDMContext cpuDmc, String coreId);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBHardwareAndOS2.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBHardwareAndOS2.java
index 44ffc72846d..801ff69f7ae 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBHardwareAndOS2.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBHardwareAndOS2.java
@@ -30,7 +30,7 @@ import org.eclipse.cdt.dsf.datamodel.IDMContext;
* @since 4.2
*/
public interface IGDBHardwareAndOS2 extends IGDBHardwareAndOS {
-
+
/** Returns true if information returned by the other methods is available.
* If false is returned, it means that session initialization is in progress,
* and further request should be made after DataModelInitializedEvent is fired.
@@ -38,60 +38,59 @@ public interface IGDBHardwareAndOS2 extends IGDBHardwareAndOS {
public boolean isAvailable();
/** Information about OS resource class. */
- public interface IResourceClass
- {
+ public interface IResourceClass {
/** The id of this resource class, used in GDB requests. */
public String getId();
+
/** Human-friendly description of this class, suitable for direct display in UI. */
public String getHumanDescription();
}
- /**
- * Return a list of OS resource classes GDB knows about
- */
- public void getResourceClasses(IDMContext dmc, DataRequestMonitor<IResourceClass[]> rm);
+ /**
+ * Return a list of OS resource classes GDB knows about
+ */
+ public void getResourceClasses(IDMContext dmc, DataRequestMonitor<IResourceClass[]> rm);
+
+ /** Information about OS resources of specific resource class
+ * This is conceptually a table. GDB provides column headers, and
+ * data rows, but does not provide any additional information about
+ * the meaning
+ */
+ public interface IResourcesInformation {
+ /** Return the names of the columns in resource table. */
+ public String[] getColumnNames();
+
+ /** Returns rows of the resource table. Each element is an array
+ * of the size equal to getColumnNames().length
+ */
+ public String[][] getContent();
+ }
- /** Information about OS resources of specific resource class
- * This is conceptually a table. GDB provides column headers, and
- * data rows, but does not provide any additional information about
- * the meaning
- */
- public interface IResourcesInformation
- {
- /** Return the names of the columns in resource table. */
- public String[] getColumnNames();
- /** Returns rows of the resource table. Each element is an array
- * of the size equal to getColumnNames().length
- */
- public String[][] getContent();
- }
+ /**
+ * Return table describing resources of specified class.
+ */
+ void getResourcesInformation(IDMContext dmc, String resourceClassId, DataRequestMonitor<IResourcesInformation> rm);
- /**
- * Return table describing resources of specified class.
- */
- void getResourcesInformation(IDMContext dmc, String resourceClassId, DataRequestMonitor<IResourcesInformation> rm);
-
-
- /**
- * Information about the CPU/core load for one given CPU or core
- */
- public interface ILoadInfo
- {
+ /**
+ * Information about the CPU/core load for one given CPU or core
+ */
+ public interface ILoadInfo {
/**
* A string representing the current load (between "0" and "100")
*/
public String getLoad();
+
/**
- * Used to give more details about a CPU's/core's load. For instance
- * the breakdown of the different load types and their proportion: system,
+ * Used to give more details about a CPU's/core's load. For instance
+ * the breakdown of the different load types and their proportion: system,
* user, I/O, interrupts, etc.
*/
- public Map<String,String> getDetailedLoad();
- }
-
- /**
- * Computes CPU/core load information according to context and
- * asynchronously returns the result in a ILoadInfo object
- */
- void getLoadInfo(IDMContext dmc, DataRequestMonitor<ILoadInfo> rm);
+ public Map<String, String> getDetailedLoad();
+ }
+
+ /**
+ * Computes CPU/core load information according to context and
+ * asynchronously returns the result in a ILoadInfo object
+ */
+ void getLoadInfo(IDMContext dmc, DataRequestMonitor<ILoadInfo> rm);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBMemory.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBMemory.java
index 844a3a17fda..0c45f44a637 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBMemory.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBMemory.java
@@ -18,17 +18,17 @@ import org.eclipse.cdt.dsf.debug.service.IMemory;
/**
* Provides access to memory related data such as address size and endianness.
- *
+ *
* @since 4.2
*/
public interface IGDBMemory extends IMemory {
/**
- * This method is required to retrieve data from GDB asynchronously. The Platform's
+ * This method is required to retrieve data from GDB asynchronously. The Platform's
* memory related API is not asynchronous, so the data can not be acquired on demand.
*/
public void initializeMemoryData(IMemoryDMContext ctx, RequestMonitor rm);
-
+
/**
* Returns the address size (in octets) of the memory specified by the given context.
*/
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBMemory2.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBMemory2.java
index 27c05d95779..a77a1118559 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBMemory2.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBMemory2.java
@@ -7,23 +7,22 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Alvaro Sanchez-Leon (Ericsson AB) - [Memory] Support 16 bit addressable size (Bug 426730)
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.service;
-
/**
* Extension interface to provide access to the addressable size of a memory context
- *
+ *
* @since 4.4
*/
public interface IGDBMemory2 extends IGDBMemory {
-
+
/**
* Returns the addressable size (in octets) of the memory specified by the given context
*/
public int getAddressableSize(IMemoryDMContext context);
-
+
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBProcesses.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBProcesses.java
index dd127f13211..2b3db9dbcf5 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBProcesses.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBProcesses.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
* Ericsson - added support for core-awareness
@@ -32,136 +32,140 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
public interface IGDBProcesses extends IMIProcesses {
-
- /**
- * This interface extends the DSF ThreadDMData to provide
- * the cores on which a process or a thread is located as well
- * as the owner of the process.
- *
+
+ /**
+ * This interface extends the DSF ThreadDMData to provide
+ * the cores on which a process or a thread is located as well
+ * as the owner of the process.
+ *
* @since 4.0
*/
- interface IGdbThreadDMData extends IThreadDMData {
- /**
- * @return The list of identifiers of the cores on which the thread
- * or process is currently located. A thread will typically
- * be located on a single core at a time, while a process will
- * be located on all cores on which one of the process' threads
- * is located. Returns null if the information is not available.
- */
- String[] getCores();
-
- /**
- * @return The owner of the process, usually a user ID. Returns null if the
- * information is not available. For threads, this method can return
- * null or the owner of the parent process, if available.
- */
- String getOwner();
- }
+ interface IGdbThreadDMData extends IThreadDMData {
+ /**
+ * @return The list of identifiers of the cores on which the thread
+ * or process is currently located. A thread will typically
+ * be located on a single core at a time, while a process will
+ * be located on all cores on which one of the process' threads
+ * is located. Returns null if the information is not available.
+ */
+ String[] getCores();
- /**
- * This interface extends the {@link IGdbThreadDMData} to provide a description
- * for a process or thread.
- *
+ /**
+ * @return The owner of the process, usually a user ID. Returns null if the
+ * information is not available. For threads, this method can return
+ * null or the owner of the parent process, if available.
+ */
+ String getOwner();
+ }
+
+ /**
+ * This interface extends the {@link IGdbThreadDMData} to provide a description
+ * for a process or thread.
+ *
* @since 5.6
*/
- public interface IGdbThreadDMData2 extends IGdbThreadDMData {
+ public interface IGdbThreadDMData2 extends IGdbThreadDMData {
- /**
- * @return The description for this process or thread. Usually
- * the program and its arguments.
- */
- String getDescription();
- }
+ /**
+ * @return The description for this process or thread. Usually
+ * the program and its arguments.
+ */
+ String getDescription();
+ }
- /**
- * This interface describes an exited thread/process.
- *
+ /**
+ * This interface describes an exited thread/process.
+ *
* @since 4.7
*/
- interface IGdbThreadExitedDMData extends IThreadDMData {
- /**
+ interface IGdbThreadExitedDMData extends IThreadDMData {
+ /**
* @return The exit code of this process.
* Returns null if the exit code is not known.
*/
Integer getExitCode();
- }
-
- /**
- * Indicates that a process or thread is no longer being tracked by
- * the session. This event usually refers to exited elements that
- * were still being shown to the user but that have now been removed.
+ }
+
+ /**
+ * Indicates that a process or thread is no longer being tracked by
+ * the session. This event usually refers to exited elements that
+ * were still being shown to the user but that have now been removed.
* @since 4.7
*/
- interface IThreadRemovedDMEvent extends IDMEvent<IThreadDMContext> {}
-
- /**
- * Get a list of all execution contexts belonging to a container. This call is synchronous,
- * unlike the call to getProcessesBeingDebugged(). However, some services may not be able
- * to fulfill this request synchronously and will have to rely on getProcessesBeingDebugged().
- *
- * @param containerDmc The container for which we want to get the execution contexts
- */
- IMIExecutionDMContext[] getExecutionContexts(IMIContainerDMContext containerDmc);
-
- /**
- * Returns whether the specified process can be restarted.
- *
- * @param containerDmc The process that should be restarted
- * @param rm The requestMonitor that returns if a restart is allowed on the specified process.
- *
- * @since 4.0
- */
- void canRestart(IContainerDMContext containerDmc, DataRequestMonitor<Boolean> rm);
-
- /**
- * Request that the specified process be restarted.
- *
- * @param containerDmc The process that should be restarted
- * @param attributes Different attributes that affect the restart operation. This is
- * usually the launch configuration attributes
- * @param rm The requetMonitor that indicates that the restart request has been completed. It will
- * contain the IContainerDMContext fully filled with the data of the restarted process.
- *
- * @since 4.0
- */
- void restart(IContainerDMContext containerDmc, Map<String, Object> attributes, DataRequestMonitor<IContainerDMContext> rm);
-
- /**
- * Request that the specified process be started.
- *
- * @param containerDmc The process that should be started.
- * @param attributes Different attributes that affect the start operation. This is
- * usually the launch configuration attributes
- * @param rm The requestMonitor that indicates that the start request has been completed. It will
- * contain the IContainerDMContext fully filled with the data of the newly started process.
- *
- * @since 4.0
- */
- void start(IContainerDMContext containerDmc, Map<String, Object> attributes, DataRequestMonitor<IContainerDMContext> rm);
-
- /**
- * Attaches debugger to the given process.
- * When attaching to a process, a debugging context can now be used to characterize the process.
- * This method can optionally choose to return this IDMContext inside the DataRequestMonitor.
- * This can be useful for backends that do not have the ability to obtain the different
- * debugging IDMContexts through {@link #getProcessesBeingDebugged(IDMContext, DataRequestMonitor)
- *
- * @param file Binary to use for the process.
- * @since 4.0
- */
- void attachDebuggerToProcess(IProcessDMContext procCtx, String file, DataRequestMonitor<IDMContext> rm);
+ interface IThreadRemovedDMEvent extends IDMEvent<IThreadDMContext> {
+ }
+
+ /**
+ * Get a list of all execution contexts belonging to a container. This call is synchronous,
+ * unlike the call to getProcessesBeingDebugged(). However, some services may not be able
+ * to fulfill this request synchronously and will have to rely on getProcessesBeingDebugged().
+ *
+ * @param containerDmc The container for which we want to get the execution contexts
+ */
+ IMIExecutionDMContext[] getExecutionContexts(IMIContainerDMContext containerDmc);
+
+ /**
+ * Returns whether the specified process can be restarted.
+ *
+ * @param containerDmc The process that should be restarted
+ * @param rm The requestMonitor that returns if a restart is allowed on the specified process.
+ *
+ * @since 4.0
+ */
+ void canRestart(IContainerDMContext containerDmc, DataRequestMonitor<Boolean> rm);
+
+ /**
+ * Request that the specified process be restarted.
+ *
+ * @param containerDmc The process that should be restarted
+ * @param attributes Different attributes that affect the restart operation. This is
+ * usually the launch configuration attributes
+ * @param rm The requetMonitor that indicates that the restart request has been completed. It will
+ * contain the IContainerDMContext fully filled with the data of the restarted process.
+ *
+ * @since 4.0
+ */
+ void restart(IContainerDMContext containerDmc, Map<String, Object> attributes,
+ DataRequestMonitor<IContainerDMContext> rm);
+
+ /**
+ * Request that the specified process be started.
+ *
+ * @param containerDmc The process that should be started.
+ * @param attributes Different attributes that affect the start operation. This is
+ * usually the launch configuration attributes
+ * @param rm The requestMonitor that indicates that the start request has been completed. It will
+ * contain the IContainerDMContext fully filled with the data of the newly started process.
+ *
+ * @since 4.0
+ */
+ void start(IContainerDMContext containerDmc, Map<String, Object> attributes,
+ DataRequestMonitor<IContainerDMContext> rm);
+
+ /**
+ * Attaches debugger to the given process.
+ * When attaching to a process, a debugging context can now be used to characterize the process.
+ * This method can optionally choose to return this IDMContext inside the DataRequestMonitor.
+ * This can be useful for backends that do not have the ability to obtain the different
+ * debugging IDMContexts through {@link #getProcessesBeingDebugged(IDMContext, DataRequestMonitor)
+ *
+ * @param file Binary to use for the process.
+ * @since 4.0
+ */
+ void attachDebuggerToProcess(IProcessDMContext procCtx, String file, DataRequestMonitor<IDMContext> rm);
/**
- * Adds a process representing the inferior to the launch. An I/O console will be created if necessary.
- *
- * @param containerDmc The inferior for which a a process will be added to the launch.
- * @param label The name to use for the console if created.
- * @param pty The PTY to be used by the console for I/O
- * @param rm The requestMonitor that indicates that the request has been completed.
- *
+ * Adds a process representing the inferior to the launch. An I/O console will be created if necessary.
+ *
+ * @param containerDmc The inferior for which a a process will be added to the launch.
+ * @param label The name to use for the console if created.
+ * @param pty The PTY to be used by the console for I/O
+ * @param rm The requestMonitor that indicates that the request has been completed.
+ *
* @since 5.2
*/
- default void addInferiorToLaunch(IContainerDMContext containerDmc, String label, PTY pty, RequestMonitor rm) {
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "Not supported", null)); //$NON-NLS-1$
+ default void addInferiorToLaunch(IContainerDMContext containerDmc, String label, PTY pty, RequestMonitor rm) {
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "Not supported", //$NON-NLS-1$
+ null));
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBSourceLookup.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBSourceLookup.java
index 4ced4b1b5c4..b227246293a 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBSourceLookup.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBSourceLookup.java
@@ -23,7 +23,7 @@ import org.eclipse.cdt.dsf.debug.service.ISourceLookup;
* handle the path mapping source container type -
* {@link MappingSourceContainer} - on the GDB side using GDB's
* "set substitute-path" mechanism.
- *
+ *
* @since 5.0
*/
public interface IGDBSourceLookup extends ISourceLookup {
@@ -31,7 +31,7 @@ public interface IGDBSourceLookup extends ISourceLookup {
/**
* Initialise the source substitutions on the GDB backend (aka do the
* initial "set substitute-path"s)
- *
+ *
* @param sourceLookupCtx
* @param rm
*/
@@ -40,7 +40,7 @@ public interface IGDBSourceLookup extends ISourceLookup {
/**
* Update the source substitutions on the GDB backend (aka modify the
* "set substitute-path"s)
- *
+ *
* @param sourceLookupCtx
* @param rm
* with the result set to True if a change was made
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBTraceControl.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBTraceControl.java
index daea2e05eda..ad757f61ff2 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBTraceControl.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBTraceControl.java
@@ -25,138 +25,153 @@ import org.eclipse.cdt.dsf.service.IDsfService;
/**
* The TraceControl service provides access to the debugger Tracing functionality.
* It is used to do such things as start and stop tracing.
- *
+ *
* @since 3.0
*/
public interface IGDBTraceControl extends IDsfService {
- /**
- * Marker interface for a context on which trace operations can be performed
- */
- public interface ITraceTargetDMContext extends IDMContext {}
-
- /**
- * Specific Trace Record context. It describes tracing data.
- */
- @Immutable
- public interface ITraceRecordDMContext extends IDMContext {
- /**
- * Returns the GDB id to the trace record. Can return null
- * if the context does not point to a valid trace record.
- * @since 4.0
- */
- String getRecordId();
- }
-
- /**
- * This is the model data interface that corresponds to ITraceRecordDMContext.
- */
- public interface ITraceRecordDMData extends IDMData {
- /**
- * Return the content of the trace record in the form of a string
- * @since 4.0
- */
- String getContent();
- /**
- * Return the timestamp of the trace record. Can return null.
- * @since 4.0
- */
- String getTimestamp();
- /**
- * Return the GDB tracepoint number
- * @since 4.0
- */
- String getTracepointNumber();
- /**
- * Returns the GDB id to the trace record
- * @since 4.0
- */
- String getRecordId();
- }
-
- /**
+ /**
+ * Marker interface for a context on which trace operations can be performed
+ */
+ public interface ITraceTargetDMContext extends IDMContext {
+ }
+
+ /**
+ * Specific Trace Record context. It describes tracing data.
+ */
+ @Immutable
+ public interface ITraceRecordDMContext extends IDMContext {
+ /**
+ * Returns the GDB id to the trace record. Can return null
+ * if the context does not point to a valid trace record.
+ * @since 4.0
+ */
+ String getRecordId();
+ }
+
+ /**
+ * This is the model data interface that corresponds to ITraceRecordDMContext.
+ */
+ public interface ITraceRecordDMData extends IDMData {
+ /**
+ * Return the content of the trace record in the form of a string
+ * @since 4.0
+ */
+ String getContent();
+
+ /**
+ * Return the timestamp of the trace record. Can return null.
+ * @since 4.0
+ */
+ String getTimestamp();
+
+ /**
+ * Return the GDB tracepoint number
+ * @since 4.0
+ */
+ String getTracepointNumber();
+
+ /**
+ * Returns the GDB id to the trace record
+ * @since 4.0
+ */
+ String getRecordId();
+ }
+
+ /**
* Trace events
*/
- public interface ITracingSupportedChangeDMEvent extends IDMEvent<ITraceTargetDMContext> {
- boolean isTracingSupported();
- }
- public interface ITracingStartedDMEvent extends IDMEvent<ITraceTargetDMContext> {}
- public interface ITracingStoppedDMEvent extends IDMEvent<ITraceTargetDMContext> {}
- public interface ITraceRecordSelectedChangedDMEvent extends IDMEvent<ITraceRecordDMContext> {
- boolean isVisualizationModeEnabled();
- }
-
- /**
- * Returns whether tracing can be started on the specified trace target
- */
- public void canStartTracing(ITraceTargetDMContext context, DataRequestMonitor<Boolean> rm);
- /**
- * Start tracing on the specified trace target
- */
- public void startTracing(ITraceTargetDMContext context, RequestMonitor rm);
- /**
- * Returns whether tracing can be stopped on the specified trace target
- */
- public void canStopTracing(ITraceTargetDMContext context, DataRequestMonitor<Boolean> rm);
- /**
- * Stop tracing on the specified trace target
- */
- public void stopTracing(ITraceTargetDMContext context, RequestMonitor rm);
- /**
- * Returns true if tracing is ongoing.
- */
- public void isTracing(ITraceTargetDMContext context, DataRequestMonitor<Boolean> rm);
-
- /**
- * Returns true if trace data can be saved to file
- */
- public void canSaveTraceData(ITraceTargetDMContext context, DataRequestMonitor<Boolean> rm);
-
- /**
- * Save trace data (all trace records) to the specified file in a format suitable for {@link loadTraceData}
- * If 'remoteSave' is true, the storage will be done on the target.
- */
- public void saveTraceData(ITraceTargetDMContext context,
- String file, boolean remoteSave,
- RequestMonitor rm);
-
- /**
- * Returns true if trace data can be loaded from a file
- */
- public void canLoadTraceData(ITraceTargetDMContext context, DataRequestMonitor<Boolean> rm);
-
- /**
- * Load trace data (all trace records) from the specified file. A file created from a call to
- * {@link saveTraceData} should have the correct format to be loaded by this call.
- */
- public void loadTraceData(ITraceTargetDMContext context,
- String file,
- RequestMonitor rm);
-
- /**
- * Request that the backend use the specified trace record.
- */
- public void selectTraceRecord(ITraceRecordDMContext context, RequestMonitor rm);
-
- /**
- * Get the data associated to current GDB tracepoint record
- */
- public void getTraceRecordData(ITraceRecordDMContext context, DataRequestMonitor<ITraceRecordDMData> rm);
-
- /////////////////////////////////////////////////
- // GDB specific part
- /////////////////////////////////////////////////
-
- public static enum STOP_REASON_ENUM { REQUEST, PASSCOUNT, OVERFLOW, DISCONNECTION, ERROR, UNKNOWN };
-
- public interface ITraceStatusDMData extends IDMData {
- boolean isTracingSupported();
- boolean isTracingActive();
- int getNumberOfCollectedFrame();
- int getTotalBufferSize();
- int getFreeBufferSize();
-
- STOP_REASON_ENUM getStopReason();
+ public interface ITracingSupportedChangeDMEvent extends IDMEvent<ITraceTargetDMContext> {
+ boolean isTracingSupported();
+ }
+
+ public interface ITracingStartedDMEvent extends IDMEvent<ITraceTargetDMContext> {
+ }
+
+ public interface ITracingStoppedDMEvent extends IDMEvent<ITraceTargetDMContext> {
+ }
+
+ public interface ITraceRecordSelectedChangedDMEvent extends IDMEvent<ITraceRecordDMContext> {
+ boolean isVisualizationModeEnabled();
+ }
+
+ /**
+ * Returns whether tracing can be started on the specified trace target
+ */
+ public void canStartTracing(ITraceTargetDMContext context, DataRequestMonitor<Boolean> rm);
+
+ /**
+ * Start tracing on the specified trace target
+ */
+ public void startTracing(ITraceTargetDMContext context, RequestMonitor rm);
+
+ /**
+ * Returns whether tracing can be stopped on the specified trace target
+ */
+ public void canStopTracing(ITraceTargetDMContext context, DataRequestMonitor<Boolean> rm);
+
+ /**
+ * Stop tracing on the specified trace target
+ */
+ public void stopTracing(ITraceTargetDMContext context, RequestMonitor rm);
+
+ /**
+ * Returns true if tracing is ongoing.
+ */
+ public void isTracing(ITraceTargetDMContext context, DataRequestMonitor<Boolean> rm);
+
+ /**
+ * Returns true if trace data can be saved to file
+ */
+ public void canSaveTraceData(ITraceTargetDMContext context, DataRequestMonitor<Boolean> rm);
+
+ /**
+ * Save trace data (all trace records) to the specified file in a format suitable for {@link loadTraceData}
+ * If 'remoteSave' is true, the storage will be done on the target.
+ */
+ public void saveTraceData(ITraceTargetDMContext context, String file, boolean remoteSave, RequestMonitor rm);
+
+ /**
+ * Returns true if trace data can be loaded from a file
+ */
+ public void canLoadTraceData(ITraceTargetDMContext context, DataRequestMonitor<Boolean> rm);
+
+ /**
+ * Load trace data (all trace records) from the specified file. A file created from a call to
+ * {@link saveTraceData} should have the correct format to be loaded by this call.
+ */
+ public void loadTraceData(ITraceTargetDMContext context, String file, RequestMonitor rm);
+
+ /**
+ * Request that the backend use the specified trace record.
+ */
+ public void selectTraceRecord(ITraceRecordDMContext context, RequestMonitor rm);
+
+ /**
+ * Get the data associated to current GDB tracepoint record
+ */
+ public void getTraceRecordData(ITraceRecordDMContext context, DataRequestMonitor<ITraceRecordDMData> rm);
+
+ /////////////////////////////////////////////////
+ // GDB specific part
+ /////////////////////////////////////////////////
+
+ public static enum STOP_REASON_ENUM {
+ REQUEST, PASSCOUNT, OVERFLOW, DISCONNECTION, ERROR, UNKNOWN
+ };
+
+ public interface ITraceStatusDMData extends IDMData {
+ boolean isTracingSupported();
+
+ boolean isTracingActive();
+
+ int getNumberOfCollectedFrame();
+
+ int getTotalBufferSize();
+
+ int getFreeBufferSize();
+
+ STOP_REASON_ENUM getStopReason();
/**
* Returns the id of the tracepoint that caused the stop.
@@ -167,100 +182,112 @@ public interface IGDBTraceControl extends IDsfService {
/** @since 4.4 */
public interface ITraceStatusDMData2 extends ITraceStatusDMData {
- /**
+ /**
* Returns the user-name of the user that started or stopped a trace. Returns an
* empty string if no user-name is available.
*/
- String getUserName();
- /**
+ String getUserName();
+
+ /**
* Returns the traces notes related to a started or stopped trace. Returns an
* empty string if no notes are defined.
*/
- String getNotes();
- /**
+ String getNotes();
+
+ /**
* Returns the start-time of an on-going trace.
* Returns an empty string if no start-time is available or if no trace was started.
*/
- String getStartTime();
- /**
+ String getStartTime();
+
+ /**
* Returns the stop-time of the last trace experiment.
* Returns an empty string if no stop-time is available, if a trace is currently
* running or if no trace was ever started.
*/
- String getStopTime();
+ String getStopTime();
+
/**
* Returns true if trace visualization is done from a trace file
* as compared to one from an ongoing execution.
*/
boolean isTracingFromFile();
- /**
- * Returns true if an ongoing tracing experiment will continue after
+
+ /**
+ * Returns true if an ongoing tracing experiment will continue after
* GDB disconnects from the target.
*/
boolean isDisconnectedTracingEnabled();
- /**
+
+ /**
* Returns true if the buffer being used or to be used to record
* the trace data is a circular buffer (overwriting/flight-recorder), or not.
*/
boolean isCircularBuffer();
- /**
+
+ /**
* Returns the number of created frames of the current trace experiment.
*/
int getNumberOfCreatedFrames();
+
/**
* Returns the error description if the trace was stopped due to an error (getStopReason() returns ERROR).
* Returns null if the trace is not stopped, or if it is not stopped by an ERROR.
* Can return an empty string in other cases if no description is available.
*/
String getStopErrorDescription();
- /**
+
+ /**
* Returns the trace file path when isTracingFromFile() is true. Can return
* an empty string if the file path is not available.
* Should return null if isTracingFromFile() is false;
*/
String getTraceFile();
-
- /**
- * If a trace frame is currently being examined, this method will return
- * its id. Returns null if no trace frame is in focus.
- */
- String getCurrentTraceFrameId();
-
- /**
- * If a trace frame is currently being examined, this method will return
- * the GDB tracepoint number that triggered the trace record in focus.
- * Returns null if no trace frame is in focus (if getCurrentTraceFrameId() == null).
- */
- Integer getTracepointNumberForCurrentTraceFrame();
+
+ /**
+ * If a trace frame is currently being examined, this method will return
+ * its id. Returns null if no trace frame is in focus.
+ */
+ String getCurrentTraceFrameId();
+
+ /**
+ * If a trace frame is currently being examined, this method will return
+ * the GDB tracepoint number that triggered the trace record in focus.
+ * Returns null if no trace frame is in focus (if getCurrentTraceFrameId() == null).
+ */
+ Integer getTracepointNumberForCurrentTraceFrame();
}
- public interface ITraceVariableDMData extends IDMData {
- String getName();
- String getValue();
- String getInitialValue();
- }
-
- /**
- * Request the tracing status of the specified trace target
- */
- public void getTraceStatus(ITraceTargetDMContext context, DataRequestMonitor<ITraceStatusDMData> rm);
-
- /**
- * Create a new trace state variable with an optional value
- */
- public void createTraceVariable(ITraceTargetDMContext context,
- String varName,
- String varValue,
- RequestMonitor rm);
-
- /**
- * Get a list of all trace state variables and their values
- */
- public void getTraceVariables(ITraceTargetDMContext context, DataRequestMonitor<ITraceVariableDMData[]> rm);
+ public interface ITraceVariableDMData extends IDMData {
+ String getName();
+
+ String getValue();
+
+ String getInitialValue();
+ }
+
+ /**
+ * Request the tracing status of the specified trace target
+ */
+ public void getTraceStatus(ITraceTargetDMContext context, DataRequestMonitor<ITraceStatusDMData> rm);
+
+ /**
+ * Create a new trace state variable with an optional value
+ */
+ public void createTraceVariable(ITraceTargetDMContext context, String varName, String varValue, RequestMonitor rm);
+
+ /**
+ * Get a list of all trace state variables and their values
+ */
+ public void getTraceVariables(ITraceTargetDMContext context, DataRequestMonitor<ITraceVariableDMData[]> rm);
/** @since 4.0 */
public ITraceRecordDMContext createTraceRecordContext(ITraceTargetDMContext ctx, String recordId);
- public void getCurrentTraceRecordContext(ITraceTargetDMContext context, DataRequestMonitor<ITraceRecordDMContext> drm);
+
+ public void getCurrentTraceRecordContext(ITraceTargetDMContext context,
+ DataRequestMonitor<ITraceRecordDMContext> drm);
+
public ITraceRecordDMContext createNextRecordContext(ITraceRecordDMContext ctx);
+
public ITraceRecordDMContext createPrevRecordContext(ITraceRecordDMContext ctx);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBTraceControl2.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBTraceControl2.java
index 9dcb5897042..1bb23e4e21d 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBTraceControl2.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBTraceControl2.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Dmitry Kozlov (Mentor Graphics) - initial API and implementation (Bug 390827)
*******************************************************************************/
@@ -24,27 +24,27 @@ public interface IGDBTraceControl2 extends IGDBTraceControl {
/**
* Stops the visualization of trace data.
- */
+ */
public void stopTraceVisualization(ITraceTargetDMContext context, RequestMonitor rm);
-
- /**
+
+ /**
* Enables/disables the user of a circular trace buffer to collect trace data.
*/
public void setCircularTraceBuffer(ITraceTargetDMContext context, boolean useCircularBuffer, RequestMonitor rm);
- /**
- * Enables/disables disconnected tracing. When this flag is enabled, an ongoing tracing experiment will
+ /**
+ * Enables/disables disconnected tracing. When this flag is enabled, an ongoing tracing experiment will
* continue even if GDB disconnects from the target.
*/
public void setDisconnectedTracing(ITraceTargetDMContext context, boolean disconnectedTracing, RequestMonitor rm);
-
- /**
+
+ /**
* Sets the name of the user that is performing tracing operations.
* This name will be persisted during a disconnected tracing experiment.
*/
public void setTraceUser(ITraceTargetDMContext context, String userName, RequestMonitor rm);
-
- /**
+
+ /**
* Sets some information about the tracing experiment.
* This information will be persisted during a disconnected tracing experiment.
*/
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IReverseRunControl.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IReverseRunControl.java
index 922aecf7404..e44f338ff8c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IReverseRunControl.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IReverseRunControl.java
@@ -22,82 +22,82 @@ import org.eclipse.cdt.dsf.debug.service.IRunControl.StepType;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
/**
- * This interface provides access to controlling and monitoring the reverse execution
+ * This interface provides access to controlling and monitoring the reverse execution
* state of a process being debugged.
- *
+ *
* @since 2.0
*/
public interface IReverseRunControl {
- /**
- * Indicates that the enablement of reverse debugging has changed.
- *
- * @since 4.2
- */
- interface IReverseModeChangedDMEvent extends IDMEvent<ICommandControlDMContext> {
- /**
- * @return the new state of reverse mode.
- */
- boolean isReverseModeEnabled();
- };
+ /**
+ * Indicates that the enablement of reverse debugging has changed.
+ *
+ * @since 4.2
+ */
+ interface IReverseModeChangedDMEvent extends IDMEvent<ICommandControlDMContext> {
+ /**
+ * @return the new state of reverse mode.
+ */
+ boolean isReverseModeEnabled();
+ };
- /**
- * Establish if a reverse-resume operation is allowed on the specified context.
- *
- * @param context The thread or process on which the reverse operation will apply
- * @param rm Will contain the result of the operation, true or false, not null.
- */
+ /**
+ * Establish if a reverse-resume operation is allowed on the specified context.
+ *
+ * @param context The thread or process on which the reverse operation will apply
+ * @param rm Will contain the result of the operation, true or false, not null.
+ */
void canReverseResume(IExecutionDMContext context, DataRequestMonitor<Boolean> rm);
-
- /**
- * Perform a reverse-resume operation on the specified context.
- *
- * @param context The thread or process on which the reverse operation will apply
- */
- void reverseResume(IExecutionDMContext context, RequestMonitor requestMonitor);
-
- /**
- * Returns whether a reverse-step operation is on-going for the specified context.
- *
- * @param context The thread or process on which the reverse operation will apply
- * @return True if a reverse-steop operation is on-going, false otherwise.
- */
- boolean isReverseStepping(IExecutionDMContext context);
-
- /**
- * Establish if a reverse-step operation is allowed on the specified context.
- *
- * @param context The thread or process on which the reverse operation will apply
- * @param rm Will contain the result of the operation, true or false, not null.
- */
- void canReverseStep(IExecutionDMContext context, StepType stepType, DataRequestMonitor<Boolean> rm);
-
- /**
- * Perform a reverse-step operation on the specified context with the specified step type.
- *
- * @param context The thread or process on which the reverse operation will apply
- * @param stepType The step type to be used for the operation
- */
- void reverseStep(IExecutionDMContext context, StepType stepType, RequestMonitor requestMonitor);
-
- /**
- * Establish if it is possible to enable reverse debugging.
- *
- * @param rm Will contain the result of the operation, true or false, not null.
- */
- void canEnableReverseMode(ICommandControlDMContext context, DataRequestMonitor<Boolean> rm);
-
- /**
- * Establish if reverse debugging is enabled.
- *
- * @param rm Will contain the result of the operation, true or false, not null.
- */
- void isReverseModeEnabled(ICommandControlDMContext context, DataRequestMonitor<Boolean> rm);
- /**
- * Enable or disable reverse debugging based on the enable parameter.
- *
- * @param enable True if reverse debugging should enabled, false for disabled.
- */
- void enableReverseMode(ICommandControlDMContext context, boolean enable, RequestMonitor rm);
+ /**
+ * Perform a reverse-resume operation on the specified context.
+ *
+ * @param context The thread or process on which the reverse operation will apply
+ */
+ void reverseResume(IExecutionDMContext context, RequestMonitor requestMonitor);
+
+ /**
+ * Returns whether a reverse-step operation is on-going for the specified context.
+ *
+ * @param context The thread or process on which the reverse operation will apply
+ * @return True if a reverse-steop operation is on-going, false otherwise.
+ */
+ boolean isReverseStepping(IExecutionDMContext context);
+
+ /**
+ * Establish if a reverse-step operation is allowed on the specified context.
+ *
+ * @param context The thread or process on which the reverse operation will apply
+ * @param rm Will contain the result of the operation, true or false, not null.
+ */
+ void canReverseStep(IExecutionDMContext context, StepType stepType, DataRequestMonitor<Boolean> rm);
+
+ /**
+ * Perform a reverse-step operation on the specified context with the specified step type.
+ *
+ * @param context The thread or process on which the reverse operation will apply
+ * @param stepType The step type to be used for the operation
+ */
+ void reverseStep(IExecutionDMContext context, StepType stepType, RequestMonitor requestMonitor);
+
+ /**
+ * Establish if it is possible to enable reverse debugging.
+ *
+ * @param rm Will contain the result of the operation, true or false, not null.
+ */
+ void canEnableReverseMode(ICommandControlDMContext context, DataRequestMonitor<Boolean> rm);
+
+ /**
+ * Establish if reverse debugging is enabled.
+ *
+ * @param rm Will contain the result of the operation, true or false, not null.
+ */
+ void isReverseModeEnabled(ICommandControlDMContext context, DataRequestMonitor<Boolean> rm);
+
+ /**
+ * Enable or disable reverse debugging based on the enable parameter.
+ *
+ * @param enable True if reverse debugging should enabled, false for disabled.
+ */
+ void enableReverseMode(ICommandControlDMContext context, boolean enable, RequestMonitor rm);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IReverseRunControl2.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IReverseRunControl2.java
index 58e2d9a9da6..5087a82bbfe 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IReverseRunControl2.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IReverseRunControl2.java
@@ -21,13 +21,13 @@ import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommand
/** @since 5.0 */
public interface IReverseRunControl2 extends IReverseRunControl {
- /**
- * Get the reverse debugging method.
- */
- void getReverseTraceMethod(ICommandControlDMContext context, DataRequestMonitor<ReverseDebugMethod> rm);
+ /**
+ * Get the reverse debugging method.
+ */
+ void getReverseTraceMethod(ICommandControlDMContext context, DataRequestMonitor<ReverseDebugMethod> rm);
- /**
- * Change reverse debugging method based on the method parameter.
- */
- void enableReverseMode(ICommandControlDMContext context, ReverseDebugMethod traceMethod, RequestMonitor rm);
+ /**
+ * Change reverse debugging method based on the method parameter.
+ */
+ void enableReverseMode(ICommandControlDMContext context, ReverseDebugMethod traceMethod, RequestMonitor rm);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/Messages.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/Messages.java
index 6fb09fc23a0..96f205e62c9 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/Messages.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/Messages.java
@@ -35,7 +35,7 @@ class Messages extends NLS {
public static String RegisterGroup_invalid_number_of_registers;
public static String GDB_Version_Mismatch;
public static String PTY_Console_not_available;
-
+
static {
// initialize resource bundle
NLS.initializeMessages(Messages.class.getName(), Messages.class);
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/SessionType.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/SessionType.java
index 3ccb0f88d19..9a2200c3c6c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/SessionType.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/SessionType.java
@@ -7,10 +7,12 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.service;
-public enum SessionType { LOCAL, REMOTE, CORE }
+public enum SessionType {
+ LOCAL, REMOTE, CORE
+}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_0.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_0.java
index 0a7ff692183..2fe91716e45 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_0.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_0.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
* Sergey Prigogin (Google)
@@ -59,9 +59,9 @@ import org.eclipse.core.runtime.Status;
* This class causes a process to start (run for the first time), or to
* be restarted. The complexity is due to the handling of reverse debugging,
* which this class transparently enables if necessary.
- *
+ *
* This sequence is used for GDB >= 7.0 which supports reverse debugging.
- *
+ *
* @since 4.0
*/
public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
@@ -70,7 +70,7 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
private IGDBProcesses fProcService;
private IReverseRunControl fReverseService;
private IGDBBackend fBackend;
-
+
private DsfServicesTracker fTracker;
// This variable will be used to store the original container context,
@@ -78,32 +78,32 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
// container context. This new container context has for parent the process
// context, which holds the new pid.
private IContainerDMContext fContainerDmc;
-
+
// If the user requested a stop_on_main, this variable will hold the breakpoint
private MIBreakpoint fUserBreakpoint;
// Since the stop_on_main option allows the user to set the breakpoint on any
// symbol, we use this variable to know if the stop_on_main breakpoint was really
// on the main() method.
private boolean fUserBreakpointIsOnMain;
-
+
private MIBreakpoint fBreakPointForReverse;
private boolean fReverseEnabled;
private final Map<String, Object> fAttributes;
-
+
// Indicates if the sequence is being used for a restart or a start
private final boolean fRestart;
-
+
private PTY fPty;
-
+
// Store the dataRM so that we can fill it with the new container context, which we must return
// Although we can access this through Sequence.getRequestMonitor(), we would loose the type-checking.
// Therefore, doing it like this is more future-proof.
private final DataRequestMonitor<IContainerDMContext> fDataRequestMonitor;
-
+
protected IContainerDMContext getContainerContext() {
return fContainerDmc;
}
-
+
protected MIBreakpoint getUserBreakpoint() {
return fUserBreakpoint;
}
@@ -123,18 +123,18 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
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);
-
+
assert executor != null;
assert containerDmc != null;
if (attributes == null) {
// If no attributes are specified, simply use an empty map.
attributes = new HashMap<String, Object>();
}
-
+
fContainerDmc = containerDmc;
fAttributes = attributes;
fRestart = restart;
@@ -144,23 +144,22 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
@Override
protected String[] getExecutionOrder(String group) {
if (GROUP_TOP_LEVEL.equals(group)) {
- return new String[] {
- "stepInitializeBaseSequence", //$NON-NLS-1$
- "stepInsertStopOnMainBreakpoint", //$NON-NLS-1$
- "stepSetBreakpointForReverse", //$NON-NLS-1$
- "stepInitializeInputOutput", //$NON-NLS-1$
- "stepCreateConsole", //$NON-NLS-1$
- "stepRunProgram", //$NON-NLS-1$
- "stepSetReverseOff", //$NON-NLS-1$
- "stepEnableReverse", //$NON-NLS-1$
- "stepContinue", //$NON-NLS-1$
- "stepCleanupBaseSequence", //$NON-NLS-1$
+ return new String[] { "stepInitializeBaseSequence", //$NON-NLS-1$
+ "stepInsertStopOnMainBreakpoint", //$NON-NLS-1$
+ "stepSetBreakpointForReverse", //$NON-NLS-1$
+ "stepInitializeInputOutput", //$NON-NLS-1$
+ "stepCreateConsole", //$NON-NLS-1$
+ "stepRunProgram", //$NON-NLS-1$
+ "stepSetReverseOff", //$NON-NLS-1$
+ "stepEnableReverse", //$NON-NLS-1$
+ "stepContinue", //$NON-NLS-1$
+ "stepCleanupBaseSequence", //$NON-NLS-1$
};
}
return null;
}
-
- /**
+
+ /**
* Initialize the members of the StartOrRestartProcessSequence_7_0 class.
* This step is mandatory for the rest of the sequence to complete.
*/
@@ -168,51 +167,52 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
public void stepInitializeBaseSequence(RequestMonitor rm) {
fTracker = new DsfServicesTracker(GdbPlugin.getBundleContext(), fContainerDmc.getSessionId());
fCommandControl = fTracker.getService(IGDBControl.class);
- fCommandFactory = fTracker.getService(IMICommandControl.class).getCommandFactory();
+ fCommandFactory = fTracker.getService(IMICommandControl.class).getCommandFactory();
fProcService = fTracker.getService(IGDBProcesses.class);
fBackend = fTracker.getService(IGDBBackend.class);
- if (fCommandControl == null || fCommandFactory == null || fProcService == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR, "Cannot obtain service", null)); //$NON-NLS-1$
+ if (fCommandControl == null || fCommandFactory == null || fProcService == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR,
+ "Cannot obtain service", null)); //$NON-NLS-1$
rm.done();
return;
}
-
+
fReverseService = fTracker.getService(IReverseRunControl.class);
if (fReverseService != null) {
// Although the option to use reverse debugging could be on, we only check
// it if we actually have a reverse debugging service. There is no point
// in trying to handle reverse debugging if it is not available.
- fReverseEnabled = CDebugUtils.getAttribute(fAttributes,
+ fReverseEnabled = CDebugUtils.getAttribute(fAttributes,
IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE,
IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_DEFAULT);
}
rm.done();
}
-
- /**
+
+ /**
* Rollback method for {@link #stepInitializeBaseSequence()}
*/
@RollBack("stepInitializeBaseSequence")
public void rollBackInitializeBaseSequence(RequestMonitor rm) {
- if (fTracker != null) fTracker.dispose();
+ if (fTracker != null)
+ fTracker.dispose();
fTracker = null;
rm.done();
}
-
+
/**
* If the user requested a 'stopAtMain', let's set the temporary breakpoint
* where the user specified.
*/
@Execute
public void stepInsertStopOnMainBreakpoint(final RequestMonitor rm) {
- boolean userRequestedStop = CDebugUtils.getAttribute(fAttributes,
- ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN,
- LaunchUtils.getStopAtMainDefault());
+ boolean userRequestedStop = CDebugUtils.getAttribute(fAttributes,
+ ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, LaunchUtils.getStopAtMainDefault());
if (userRequestedStop) {
- String userStopSymbol = CDebugUtils.getAttribute(fAttributes,
+ String userStopSymbol = CDebugUtils.getAttribute(fAttributes,
ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL,
LaunchUtils.getStopAtMainSymbolDefault());
@@ -247,10 +247,11 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
@Execute
public void stepSetBreakpointForReverse(final RequestMonitor rm) {
if (fReverseEnabled) {
- IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(getContainerContext(), IBreakpointsTargetDMContext.class);
+ IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(getContainerContext(),
+ IBreakpointsTargetDMContext.class);
fCommandControl.queueCommand(
- fCommandFactory.createMIBreakInsert(bpTargetDmc, true, false, null, 0,
+ fCommandFactory.createMIBreakInsert(bpTargetDmc, true, false, null, 0,
ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT, "0"), //$NON-NLS-1$
new ImmediateDataRequestMonitor<MIBreakInsertInfo>(rm) {
@Override
@@ -260,7 +261,8 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
if (breakpoints.length > 0) {
fBreakPointForReverse = breakpoints[0];
if (fUserBreakpoint != null) {
- fUserBreakpointIsOnMain = fBreakPointForReverse.getAddress().equals(fUserBreakpoint.getAddress());
+ fUserBreakpointIsOnMain = fBreakPointForReverse.getAddress()
+ .equals(fUserBreakpoint.getAddress());
}
}
}
@@ -271,37 +273,36 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
rm.done();
}
}
-
- /**
- * This method does the necessary work to setup the input/output streams for the
- * inferior process, by either preparing the PTY to be used, or by simply leaving
- * the PTY null, which indicates that the input/output streams are handled externally;
- * this decision is based on the type of session.
- */
+
+ /**
+ * This method does the necessary work to setup the input/output streams for the
+ * inferior process, by either preparing the PTY to be used, or by simply leaving
+ * the PTY null, which indicates that the input/output streams are handled externally;
+ * this decision is based on the type of session.
+ */
@Execute
- public void stepInitializeInputOutput(final RequestMonitor rm) {
- if (fBackend.getSessionType() == SessionType.REMOTE) {
- // The program input and output for a remote session is handled by gdbserver.
- // Therefore, no need to create a pty.
- fPty = null;
- rm.done();
- } else {
- if (fRestart) {
- // For a restart we re-use the previous PersistentPTY (or no pty if we couldn't tell GDB about it)
- assert fPty instanceof PersistentPTY || fPty == null;
- rm.done();
- return;
- }
-
+ public void stepInitializeInputOutput(final RequestMonitor rm) {
+ if (fBackend.getSessionType() == SessionType.REMOTE) {
+ // The program input and output for a remote session is handled by gdbserver.
+ // Therefore, no need to create a pty.
+ fPty = null;
+ rm.done();
+ } else {
+ if (fRestart) {
+ // For a restart we re-use the previous PersistentPTY (or no pty if we couldn't tell GDB about it)
+ assert fPty instanceof PersistentPTY || fPty == null;
+ rm.done();
+ return;
+ }
+
boolean externalConsoleDefault = Platform.getPreferencesService().getBoolean(GdbPlugin.PLUGIN_ID,
IGdbDebugPreferenceConstants.PREF_EXTERNAL_CONSOLE,
IGDBLaunchConfigurationConstants.DEBUGGER_EXTERNAL_CONSOLE_DEFAULT, null);
- boolean externalConsole = CDebugUtils.getAttribute(fAttributes,
- IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_EXTERNAL_CONSOLE,
- externalConsoleDefault);
- if (externalConsole) {
- initializeExternalConsole(new ImmediateRequestMonitor(rm) {
+ boolean externalConsole = CDebugUtils.getAttribute(fAttributes,
+ IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_EXTERNAL_CONSOLE, externalConsoleDefault);
+ if (externalConsole) {
+ initializeExternalConsole(new ImmediateRequestMonitor(rm) {
@Override
protected void handleCompleted() {
if (isSuccess()) {
@@ -310,13 +311,13 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
} else {
initializePty(rm);
}
- }
- });
- } else {
+ }
+ });
+ } else {
initializePty(rm);
- }
- }
- }
+ }
+ }
+ }
private void initializeExternalConsole(final RequestMonitor rm) {
fCommandControl.queueCommand(fCommandFactory.createMIGDBShowNewConsole(getContainerContext()),
@@ -343,15 +344,15 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
fPty.validateSlaveName();
// Tell GDB to use this PTY
- fCommandControl.queueCommand(
- fCommandFactory.createMIInferiorTTYSet((IMIContainerDMContext)getContainerContext(), fPty.getSlaveName()),
+ fCommandControl.queueCommand(fCommandFactory
+ .createMIInferiorTTYSet((IMIContainerDMContext) getContainerContext(), fPty.getSlaveName()),
new ImmediateDataRequestMonitor<MIInfo>(rm) {
@Override
protected void handleFailure() {
// We were not able to tell GDB to use the PTY
// so we won't use it at all.
- fPty = null;
- rm.done();
+ fPty = null;
+ rm.done();
}
});
} catch (IOException e) {
@@ -359,9 +360,9 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
rm.done();
}
}
-
- /**
- * @since 4.7
+
+ /**
+ * @since 4.7
* @deprecated The creation of MIInferiorProcess has been moved to the IGDBProcesses service
*/
@Deprecated
@@ -369,8 +370,8 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
return new MIInferiorProcess(container, outputStream);
}
- /**
- * @since 4.7
+ /**
+ * @since 4.7
* @deprecated The creation of MIInferiorProcess has been moved to the IGDBProcesses service
*/
@Deprecated
@@ -383,12 +384,12 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
*/
@Execute
public void stepCreateConsole(RequestMonitor rm) {
- if (fBackend.getSessionType() == SessionType.REMOTE) {
- // The program output for a remote session is handled by gdbserver. Therefore,
- // no need to create an inferior process and add it to the launch.
- rm.done();
- return;
- }
+ if (fBackend.getSessionType() == SessionType.REMOTE) {
+ // The program output for a remote session is handled by gdbserver. Therefore,
+ // no need to create an inferior process and add it to the launch.
+ rm.done();
+ return;
+ }
if (fRestart) {
// For a restart, the IGDBProcesses service already handles creating the new
@@ -398,7 +399,7 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
return;
}
- // For multi-process, we cannot simply use the name given by the backend service
+ // For multi-process, we cannot simply use the name given by the backend service
// because we may not be starting that process, but another one.
// Instead, we can look in the attributes for the binary name, which we stored
// there for this case, specifically.
@@ -408,11 +409,9 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
if (defaultPathName == null) {
defaultPathName = ""; //$NON-NLS-1$
}
- String progPathName =
- CDebugUtils.getAttribute(fAttributes,
- ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME,
- defaultPathName);
- final String pathLabel = new Path(progPathName).lastSegment();
+ String progPathName = CDebugUtils.getAttribute(fAttributes, ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME,
+ defaultPathName);
+ final String pathLabel = new Path(progPathName).lastSegment();
// Adds the inferior to the launch which will also create the console
fProcService.addInferiorToLaunch(fContainerDmc, pathLabel, fPty, new ImmediateRequestMonitor() {
@@ -424,7 +423,7 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
}
});
}
-
+
/**
* Now, run the program.
*/
@@ -434,7 +433,7 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
if (useContinueCommand()) {
command = fCommandFactory.createMIExecContinue(fContainerDmc);
} else {
- command = fCommandFactory.createMIExecRun(fContainerDmc);
+ command = fCommandFactory.createMIExecRun(fContainerDmc);
}
fCommandControl.queueCommand(command, new ImmediateDataRequestMonitor<MIInfo>(rm) {
@Override
@@ -442,11 +441,12 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
// Now that the process is started, the pid has been allocated
// so we need to fetch the proper container context
// We replace our current context which does not have the pid, with one that has the pid.
- if (fContainerDmc instanceof IMIContainerDMContext) {
- fContainerDmc = fProcService.createContainerContextFromGroupId(fCommandControl.getContext(), ((IMIContainerDMContext)fContainerDmc).getGroupId());
-
+ if (fContainerDmc instanceof IMIContainerDMContext) {
+ fContainerDmc = fProcService.createContainerContextFromGroupId(fCommandControl.getContext(),
+ ((IMIContainerDMContext) fContainerDmc).getGroupId());
+
// This is the container context that this sequence is supposed to return: set the dataRm
- fDataRequestMonitor.setData(fContainerDmc);
+ fDataRequestMonitor.setData(fContainerDmc);
} else {
assert false : "Container context was not an IMIContainerDMContext"; //$NON-NLS-1$
}
@@ -454,7 +454,7 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
}
});
}
-
+
/**
* In case of a restart, we must mark reverse debugging as disabled because
* GDB has turned it off. We may have to turn it back on after.
@@ -469,7 +469,7 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
}
rm.done();
}
-
+
/**
* Since we have started the program, we can turn on reverse debugging if needed.
* We know the program will stop since we set a breakpoint on main, to enable reverse.
@@ -482,10 +482,10 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
rm.done();
}
}
-
+
/**
* Finally, if we are enabling reverse, and the userSymbolStop is not on main,
- * we should do a continue because we are currently stopped on main but that
+ * we should do a continue because we are currently stopped on main but that
* is not what the user requested
*/
@Execute
@@ -497,7 +497,7 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
rm.done();
}
}
-
+
/**
* Cleanup now that the sequence has been run.
*/
@@ -507,21 +507,21 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
fTracker = null;
rm.done();
}
-
- /**
- * This method indicates if we should use the -exec-continue command
- * instead of the -exec-run command.
- * This method can be overridden to allow for customization.
- */
- protected boolean useContinueCommand() {
- // Note that restart does not apply to remote sessions
- IGDBBackend backend = fTracker.getService(IGDBBackend.class);
+
+ /**
+ * This method indicates if we should use the -exec-continue command
+ * instead of the -exec-run command.
+ * This method can be overridden to allow for customization.
+ */
+ protected boolean useContinueCommand() {
+ // Note that restart does not apply to remote sessions
+ IGDBBackend backend = fTracker.getService(IGDBBackend.class);
if (backend == null) {
return false;
}
- // When doing remote non-attach debugging, we use -exec-continue instead of -exec-run
+ // When doing remote non-attach debugging, we use -exec-continue instead of -exec-run
// For remote attach, if we get here it is that we are starting a new process
// (multi-process), so we want to use -exec-run
- return backend.getSessionType() == SessionType.REMOTE && !backend.getIsAttachSession();
- }
+ return backend.getSessionType() == SessionType.REMOTE && !backend.getIsAttachSession();
+ }
} \ No newline at end of file
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_10.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_10.java
index f1c38f19e82..9e8a4a1ae3c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_10.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_10.java
@@ -40,97 +40,100 @@ import org.eclipse.core.runtime.Status;
*/
public class StartOrRestartProcessSequence_7_10 extends StartOrRestartProcessSequence_7_3 {
- private IGDBControl fCommandControl;
- private IReverseRunControl2 fReverseService;
- private ReverseDebugMethod fReverseMode = ReverseDebugMethod.SOFTWARE;
- 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 ImmediateRequestMonitor(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 reverseMode = CDebugUtils.getAttribute(fAttributes,
- IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE_MODE,
- IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_MODE_DEFAULT);
-
- if (reverseMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_MODE_HARDWARE)) {
- String hwTracePref = Platform.getPreferencesService().getString(GdbPlugin.PLUGIN_ID,
- IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_HARDWARE,
- IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_GDB_TRACE, null);
-
+ private IGDBControl fCommandControl;
+ private IReverseRunControl2 fReverseService;
+ private ReverseDebugMethod fReverseMode = ReverseDebugMethod.SOFTWARE;
+ 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 ImmediateRequestMonitor(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 reverseMode = CDebugUtils.getAttribute(fAttributes,
+ IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE_MODE,
+ IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_MODE_DEFAULT);
+
+ if (reverseMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_MODE_HARDWARE)) {
+ String hwTracePref = Platform.getPreferencesService().getString(GdbPlugin.PLUGIN_ID,
+ IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_HARDWARE,
+ IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_GDB_TRACE, null);
+
if (hwTracePref.equals(IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_BRANCH_TRACE)) {
- fReverseMode = ReverseDebugMethod.BRANCH_TRACE;
- } else if (hwTracePref.equals(IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_PROCESSOR_TRACE)) {
- fReverseMode = ReverseDebugMethod.PROCESSOR_TRACE;
- } else {
- fReverseMode = ReverseDebugMethod.GDB_TRACE;
- }
- } else if (reverseMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_MODE_SOFTWARE)) {
- fReverseMode = ReverseDebugMethod.SOFTWARE;
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR, "Unexpected reverse debugging type: " + reverseMode, null)); //$NON-NLS-1$
- }
- }
-
- rm.done();
- }
- });
- }
-
- /**
+ fReverseMode = ReverseDebugMethod.BRANCH_TRACE;
+ } else if (hwTracePref
+ .equals(IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_PROCESSOR_TRACE)) {
+ fReverseMode = ReverseDebugMethod.PROCESSOR_TRACE;
+ } else {
+ fReverseMode = ReverseDebugMethod.GDB_TRACE;
+ }
+ } else if (reverseMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_MODE_SOFTWARE)) {
+ fReverseMode = ReverseDebugMethod.SOFTWARE;
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR,
+ "Unexpected reverse debugging type: " + reverseMode, null)); //$NON-NLS-1$
+ }
+ }
+
+ rm.done();
+ }
+ });
+ }
+
+ /**
* @since 5.2
*/
- protected ReverseDebugMethod getReverseMode() {
- return fReverseMode;
- }
-
- /**
- * 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();
- }
- }
+ protected ReverseDebugMethod getReverseMode() {
+ return fReverseMode;
+ }
+
+ /**
+ * 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();
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_12.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_12.java
index 810ebddebe6..a1288c0385d 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_12.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_12.java
@@ -36,7 +36,7 @@ public class StartOrRestartProcessSequence_7_12 extends StartOrRestartProcessSeq
}
/**
- * Initialize the members of the StartOrRestartProcessSequence_7_12 class.
+ * Initialize the members of the StartOrRestartProcessSequence_7_12 class.
* This step is mandatory for the rest of the sequence to complete.
*/
@Override
@@ -64,7 +64,7 @@ public class StartOrRestartProcessSequence_7_12 extends StartOrRestartProcessSeq
// Need to insert reverse mode off before ordering the reverse start at a specified location
orderList.add(orderList.indexOf("stepCreateConsole") + 1, "stepSetReverseOff2"); //$NON-NLS-1$ //$NON-NLS-2$
- // Order the activation of reverse debugging before starting the program, it will be executed once the
+ // Order the activation of reverse debugging before starting the program, it will be executed once the
// program stops at the specified location.
orderList.add(orderList.indexOf("stepSetReverseOff2") + 1, "stepSetReverseModeAtLocation"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -80,7 +80,7 @@ public class StartOrRestartProcessSequence_7_12 extends StartOrRestartProcessSeq
}
/**
- * Request the enabling of reverse debugging, it will be applied once the program
+ * Request the enabling of reverse debugging, it will be applied once the program
* stops at the breakpoint inserted for reverse debugging
*/
@Execute
@@ -89,7 +89,7 @@ public class StartOrRestartProcessSequence_7_12 extends StartOrRestartProcessSeq
if (getReverseEnabled() && fReverseService != null && bp != null) {
// Order to continue execution if there is no user break point inserted at main
fReverseService.enableReverseModeAtBpLocation(getContainerContext(), getReverseMode(), bp,
- !getUserBreakpointIsOnMain());
+ !getUserBreakpointIsOnMain());
}
rm.done();
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_3.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_3.java
index 1b933775bb5..53379567e19 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_3.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_3.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Marc Khouzam (Ericsson) - initial API and implementation
*******************************************************************************/
@@ -24,7 +24,7 @@ import org.eclipse.cdt.dsf.mi.service.command.MIInferiorProcess_7_3;
import org.eclipse.cdt.utils.pty.PTY;
/**
- * Specialization for GDB >= 7.3
+ * Specialization for GDB >= 7.3
* @since 4.7
*/
public class StartOrRestartProcessSequence_7_3 extends StartOrRestartProcessSequence_7_0 {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/CommandFactory_6_8.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/CommandFactory_6_8.java
index 90d72c03ef4..8ff5bbcea9c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/CommandFactory_6_8.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/CommandFactory_6_8.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
@@ -20,7 +20,7 @@ import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakInsert;
import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakInsertInfo;
/**
- * A command factory for commands that should only be used starting with GDB 6.8
+ * A command factory for commands that should only be used starting with GDB 6.8
* @since 4.0 */
public class CommandFactory_6_8 extends CommandFactory {
@@ -30,14 +30,16 @@ public class CommandFactory_6_8 extends CommandFactory {
}
@Override
- public ICommand<MIBreakInsertInfo> createMIBreakInsert(IBreakpointsTargetDMContext ctx, boolean isTemporary,
+ public ICommand<MIBreakInsertInfo> createMIBreakInsert(IBreakpointsTargetDMContext ctx, boolean isTemporary,
boolean isHardware, String condition, int ignoreCount, String line, String tid) {
return new MIBreakInsert(ctx, isTemporary, isHardware, condition, ignoreCount, line, tid, true);
}
@Override
public ICommand<MIBreakInsertInfo> createMIBreakInsert(IBreakpointsTargetDMContext ctx, boolean isTemporary,
- boolean isHardware, String condition, int ignoreCount, String location, String tid, boolean disabled, boolean isTracepoint) {
- return new MIBreakInsert(ctx, isTemporary, isHardware, condition, ignoreCount, location, tid, disabled, isTracepoint, true);
+ boolean isHardware, String condition, int ignoreCount, String location, String tid, boolean disabled,
+ boolean isTracepoint) {
+ return new MIBreakInsert(ctx, isTemporary, isHardware, condition, ignoreCount, location, tid, disabled,
+ isTracepoint, true);
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/CustomTimeoutsMap.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/CustomTimeoutsMap.java
index fd6e014367d..99934d0a0ad 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/CustomTimeoutsMap.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/CustomTimeoutsMap.java
@@ -33,50 +33,45 @@ public class CustomTimeoutsMap extends HashMap<String, Integer> {
super();
}
- public CustomTimeoutsMap( CustomTimeoutsMap map ) {
- super( map );
+ public CustomTimeoutsMap(CustomTimeoutsMap map) {
+ super(map);
}
private static final long serialVersionUID = -8281280275781904870L;
public String getMemento() {
StringBuilder sb = new StringBuilder();
- for ( Map.Entry<String, Integer> entry : entrySet() ) {
- sb.append( entry.getKey() );
- sb.append( ',' );
- sb.append( entry.getValue().intValue() );
- sb.append( ';' );
+ for (Map.Entry<String, Integer> entry : entrySet()) {
+ sb.append(entry.getKey());
+ sb.append(',');
+ sb.append(entry.getValue().intValue());
+ sb.append(';');
}
return sb.toString();
}
-
- public void initializeFromMemento( String memento ) {
+
+ public void initializeFromMemento(String memento) {
clear();
- StringTokenizer st = new StringTokenizer( memento, ";" ); //$NON-NLS-1$
- MultiStatus ms = new MultiStatus( GdbPlugin.PLUGIN_ID, 0, Messages.CustomTimeoutsMap_Error_initializing_custom_timeouts, null );
- while( st.hasMoreTokens() ) {
+ StringTokenizer st = new StringTokenizer(memento, ";"); //$NON-NLS-1$
+ MultiStatus ms = new MultiStatus(GdbPlugin.PLUGIN_ID, 0,
+ Messages.CustomTimeoutsMap_Error_initializing_custom_timeouts, null);
+ while (st.hasMoreTokens()) {
String token = st.nextToken();
- String[] tokenParts = token.split( "," ); //$NON-NLS-1$
- if ( tokenParts.length == 2 && tokenParts[0].length() > 0 && tokenParts[1].length() > 0 ) {
+ String[] tokenParts = token.split(","); //$NON-NLS-1$
+ if (tokenParts.length == 2 && tokenParts[0].length() > 0 && tokenParts[1].length() > 0) {
try {
- put( tokenParts[0], Integer.valueOf( tokenParts[1] ) );
- }
- catch( NumberFormatException e ) {
- ms.add( new Status(
- IStatus.ERROR,
- GdbPlugin.PLUGIN_ID,
- String.format( Messages.CustomTimeoutsMap_Invalid_custom_timeout_value, tokenParts[0] ) ) );
+ put(tokenParts[0], Integer.valueOf(tokenParts[1]));
+ } catch (NumberFormatException e) {
+ ms.add(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
+ String.format(Messages.CustomTimeoutsMap_Invalid_custom_timeout_value, tokenParts[0])));
}
- }
- else {
- ms.add( new Status(
- IStatus.ERROR,
- GdbPlugin.PLUGIN_ID,
- Messages.CustomTimeoutsMap_Invalid_custom_timeout_data ) );
+ } else {
+ ms.add(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
+ Messages.CustomTimeoutsMap_Invalid_custom_timeout_data));
}
}
- if ( !ms.isOK() ) {
- GdbPlugin.getDefault().getLog().log( ms );
+ if (!ms.isOK()) {
+ GdbPlugin.getDefault().getLog().log(ms);
}
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBBackendCLIProcess.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBBackendCLIProcess.java
index cf5503285c9..d50e9a7b24b 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBBackendCLIProcess.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBBackendCLIProcess.java
@@ -1,19 +1,18 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2012 Nokia Corporation.
+/*******************************************************************************
+ * Copyright (c) 2009, 2012 Nokia Corporation.
*
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Nokia - initial version. May 5, 2009
- *******************************************************************************/
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Nokia - initial version. May 5, 2009
+ *******************************************************************************/
package org.eclipse.cdt.dsf.gdb.service.command;
-
-
+
import java.io.IOException;
import java.util.concurrent.RejectedExecutionException;
@@ -23,58 +22,62 @@ import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService;
import org.eclipse.cdt.dsf.mi.service.IMIBackend;
import org.eclipse.cdt.dsf.mi.service.command.MIBackendCLIProcess;
import org.eclipse.cdt.dsf.service.DsfSession;
-
-/**
+
+/**
* Note that starting with GDB 7.12, as long as a PTY is available,
* this process is no longer used. Instead, the real GDB process,
* along with its console will be used directly. A second PTY
* will be used to communicate using MI.
-
- * @author LWang
+
+ * @author LWang
* @since 2.0
- *
- */
-public class GDBBackendCLIProcess extends MIBackendCLIProcess {
-
- /**
- * @param commandControl
- * @param backend
- * @throws IOException
- */
- public GDBBackendCLIProcess(ICommandControlService commandControl,
- IMIBackend backend) throws IOException {
- super(commandControl, backend);
- assert(commandControl instanceof IGDBControl);
- }
-
- @Override
- public void destroy() {
- try {
- // This is called when user terminate the "launch" or "gdb" process
- // in Debug View. We need to kill inferior too. Fix bug
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=234467
- //
- getSession().getExecutor().execute(new DsfRunnable() { @Override public void run() {
- if (!DsfSession.isSessionActive(getSession().getId())) return;
- if (isDisposed()) return;
+ *
+ */
+public class GDBBackendCLIProcess extends MIBackendCLIProcess {
+
+ /**
+ * @param commandControl
+ * @param backend
+ * @throws IOException
+ */
+ public GDBBackendCLIProcess(ICommandControlService commandControl, IMIBackend backend) throws IOException {
+ super(commandControl, backend);
+ assert (commandControl instanceof IGDBControl);
+ }
+
+ @Override
+ public void destroy() {
+ try {
+ // This is called when user terminate the "launch" or "gdb" process
+ // in Debug View. We need to kill inferior too. Fix bug
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=234467
+ //
+ getSession().getExecutor().execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ if (!DsfSession.isSessionActive(getSession().getId()))
+ return;
+ if (isDisposed())
+ return;
+
+ ((IGDBControl) getCommandControlService())
+ .terminate(new RequestMonitor(getSession().getExecutor(), null));
+ }
+ });
+ } catch (RejectedExecutionException e) {
+ // Session disposed.
+ }
+ }
- ((IGDBControl)getCommandControlService()).terminate(
- new RequestMonitor(getSession().getExecutor(), null));
- }});
- } catch (RejectedExecutionException e) {
- // Session disposed.
- }
- }
-
- /**
- * @since 3.0
- */
- @Override
- protected boolean isMissingSecondaryPromptCommand(String operation) {
- // The 'actions' command does not get a secondary prompt!
- if (operation.startsWith("ac") && "actions".indexOf(operation) != -1) { //$NON-NLS-1$ //$NON-NLS-2$
- return true;
- }
- return false;
- }
+ /**
+ * @since 3.0
+ */
+ @Override
+ protected boolean isMissingSecondaryPromptCommand(String operation) {
+ // The 'actions' command does not get a secondary prompt!
+ if (operation.startsWith("ac") && "actions".indexOf(operation) != -1) { //$NON-NLS-1$ //$NON-NLS-2$
+ return true;
+ }
+ return false;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBBackendProcessWithoutIO.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBBackendProcessWithoutIO.java
index fa357336438..954c7c158aa 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBBackendProcessWithoutIO.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBBackendProcessWithoutIO.java
@@ -25,11 +25,11 @@ import org.eclipse.cdt.dsf.mi.service.IMIBackend;
* This class is therefore a representation of the GDB process that will be
* added to the launch. This class is not the real GDB process but simply an
* entry for the launch to handle user actions but no IO.
- *
+ *
* This class extends {@link GDBBackendCLIProcess} to re-use its implementation
* of the {@link Process} abstract methods, but disables all I/O and
* local CLI handling.
- *
+ *
* @since 5.2
*/
public class GDBBackendProcessWithoutIO extends GDBBackendCLIProcess implements IGDBBackendProcessWithoutIO {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl.java
index 19ddb039839..11cbc0d9c2b 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* Ericsson - Modified for additional features in DSF Reference implementation
@@ -16,7 +16,7 @@
* Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121)
* Mikhail Khodjaiants (Mentor Graphics) - Refactor common code in GDBControl* classes (bug 372795)
* Marc Khouzam (Ericsson) - Pass errorStream to startCommandProcessing() (Bug 350837)
- * Mikhail Khodjaiants (Mentor Graphics) - Terminate should cancel the initialization sequence
+ * Mikhail Khodjaiants (Mentor Graphics) - Terminate should cancel the initialization sequence
* if it is still running (bug 373845)
* Marc Khouzam (Ericsson) - Terminate the session if we lose the connection to the remote target (bug 422586)
* Marc Khouzam (Ericsson) - Allow to override the creation of the ControlDMC (Bug 389945)
@@ -96,8 +96,8 @@ import org.eclipse.debug.core.IStatusHandler;
import org.osgi.framework.BundleContext;
/**
- * GDB Debugger control implementation. This implementation extends the
- * base MI control implementation to provide the GDB-specific debugger
+ * GDB Debugger control implementation. This implementation extends the
+ * base MI control implementation to provide the GDB-specific debugger
* features. This includes:<br>
* - CLI console support,<br>
* - inferior process status tracking.<br>
@@ -106,45 +106,43 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
private static final int STATUS_CODE_COMMAND_TIMED_OUT = 20100;
- /**
- * Event indicating that the back end process has started.
- */
- private static class GDBControlInitializedDMEvent extends AbstractDMEvent<ICommandControlDMContext>
- implements ICommandControlInitializedDMEvent
- {
- public GDBControlInitializedDMEvent(ICommandControlDMContext context) {
- super(context);
- }
- }
-
- /**
- * Event indicating that the CommandControl (back end process) has terminated.
- */
- private static class GDBControlShutdownDMEvent extends AbstractDMEvent<ICommandControlDMContext>
- implements ICommandControlShutdownDMEvent
- {
- public GDBControlShutdownDMEvent(ICommandControlDMContext context) {
- super(context);
- }
- }
+ /**
+ * Event indicating that the back end process has started.
+ */
+ private static class GDBControlInitializedDMEvent extends AbstractDMEvent<ICommandControlDMContext>
+ implements ICommandControlInitializedDMEvent {
+ public GDBControlInitializedDMEvent(ICommandControlDMContext context) {
+ super(context);
+ }
+ }
+
+ /**
+ * Event indicating that the CommandControl (back end process) has terminated.
+ */
+ private static class GDBControlShutdownDMEvent extends AbstractDMEvent<ICommandControlDMContext>
+ implements ICommandControlShutdownDMEvent {
+ public GDBControlShutdownDMEvent(ICommandControlDMContext context) {
+ super(context);
+ }
+ }
private class TimeoutListener implements ICommandTimeoutListener {
@Override
public void commandTimedOut(final ICommandToken token) {
getExecutor().execute(new DsfRunnable() {
-
+
@Override
public void run() {
GDBControl.this.commandTimedOut(token);
}
});
- }
+ }
}
/**
* An event processor that handles some GDB life cycle events.
- * Currently, it detects a lost connection with the remote.
+ * Currently, it detects a lost connection with the remote.
*/
private class ControlEventProcessor implements IEventProcessor {
@@ -152,26 +150,26 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
addCommandListener(this);
addEventListener(this);
}
-
+
@Override
public void dispose() {
- removeEventListener(this);
- removeCommandListener(this);
+ removeEventListener(this);
+ removeCommandListener(this);
}
-
+
@Override
public void eventReceived(Object output) {
if (output instanceof MIOutput) {
- verifyConnectionLost((MIOutput)output);
+ verifyConnectionLost((MIOutput) output);
} else {
assert false;
}
}
@Override
- public void commandDone(ICommandToken token, ICommandResult cmdResult) {
+ public void commandDone(ICommandToken token, ICommandResult cmdResult) {
if (cmdResult instanceof MIInfo) {
- verifyConnectionLost(((MIInfo)cmdResult).getMIOutput());
+ verifyConnectionLost(((MIInfo) cmdResult).getMIOutput());
} else {
assert false;
}
@@ -189,96 +187,97 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
public void commandRemoved(ICommandToken token) {
}
}
-
- private ICommandControlDMContext fControlDmc;
- private IGDBBackend fMIBackend;
-
- private IEventProcessor fMIEventProcessor;
- private IEventProcessor fCLICommandProcessor;
- private IEventProcessor fControlEventProcessor;
- private IEventProcessor fMIAsyncErrorProcessor;
- private Process fBackendProcess;
+ private ICommandControlDMContext fControlDmc;
- private GdbCommandTimeoutManager fCommandTimeoutManager;
+ private IGDBBackend fMIBackend;
- private ICommandTimeoutListener fTimeoutListener = new TimeoutListener();
+ private IEventProcessor fMIEventProcessor;
+ private IEventProcessor fCLICommandProcessor;
+ private IEventProcessor fControlEventProcessor;
+ private IEventProcessor fMIAsyncErrorProcessor;
+ private Process fBackendProcess;
- /**
- * GDBControl is only used for GDB earlier that 7.0. Although -list-features
- * is available in 6.8, it does not report anything we care about, so
- * return empty list.
- */
+ private GdbCommandTimeoutManager fCommandTimeoutManager;
+
+ private ICommandTimeoutListener fTimeoutListener = new TimeoutListener();
+
+ /**
+ * GDBControl is only used for GDB earlier that 7.0. Although -list-features
+ * is available in 6.8, it does not report anything we care about, so
+ * return empty list.
+ */
private final List<String> fFeatures = new ArrayList<String>();
private Sequence fInitializationSequence;
-
+
/**
* Indicator to distinguish whether this service is initialized.
- * <code>fInitializationSequence</code> can not be used for this
+ * <code>fInitializationSequence</code> can not be used for this
* purpose because there is a period of time when the service is already
- * initializing but the initialization sequence has not created yet.
+ * initializing but the initialization sequence has not created yet.
*/
private boolean fInitialized = false;
- private boolean fTerminated;
+ private boolean fTerminated;
- /**
- * @since 3.0
- */
- public GDBControl(DsfSession session, ILaunchConfiguration config, CommandFactory factory) {
- this(session, false, config, factory);
- }
+ /**
+ * @since 3.0
+ */
+ public GDBControl(DsfSession session, ILaunchConfiguration config, CommandFactory factory) {
+ this(session, false, config, factory);
+ }
- /**
+ /**
* @since 4.1
*/
- protected GDBControl(DsfSession session, boolean useThreadAndFrameOptions, ILaunchConfiguration config, CommandFactory factory) {
- super(session, useThreadAndFrameOptions, factory);
- }
-
- @Override
- protected BundleContext getBundleContext() {
- return GdbPlugin.getBundleContext();
- }
-
- @Override
- public void initialize(final RequestMonitor requestMonitor) {
- super.initialize( new ImmediateRequestMonitor(requestMonitor) {
- @Override
- protected void handleSuccess() {
- doInitialize(requestMonitor);
- }
- });
- }
-
- private void doInitialize(final RequestMonitor requestMonitor) {
-
- fMIBackend = getServicesTracker().getService(IGDBBackend.class);
-
- // getId, called to create this context, uses the MIBackend service,
- // which is why we must wait until we have MIBackend, before we can create the below context.
- fControlDmc = createComandControlContext();
-
- getExecutor().execute(getStartupSequence(requestMonitor));
- }
-
- @Override
- public void shutdown(final RequestMonitor requestMonitor) {
- getExecutor().execute(getShutdownSequence(new RequestMonitor(getExecutor(), requestMonitor) {
-
- @Override
- protected void handleCompleted() {
+ protected GDBControl(DsfSession session, boolean useThreadAndFrameOptions, ILaunchConfiguration config,
+ CommandFactory factory) {
+ super(session, useThreadAndFrameOptions, factory);
+ }
+
+ @Override
+ protected BundleContext getBundleContext() {
+ return GdbPlugin.getBundleContext();
+ }
+
+ @Override
+ public void initialize(final RequestMonitor requestMonitor) {
+ super.initialize(new ImmediateRequestMonitor(requestMonitor) {
+ @Override
+ protected void handleSuccess() {
+ doInitialize(requestMonitor);
+ }
+ });
+ }
+
+ private void doInitialize(final RequestMonitor requestMonitor) {
+
+ fMIBackend = getServicesTracker().getService(IGDBBackend.class);
+
+ // getId, called to create this context, uses the MIBackend service,
+ // which is why we must wait until we have MIBackend, before we can create the below context.
+ fControlDmc = createComandControlContext();
+
+ getExecutor().execute(getStartupSequence(requestMonitor));
+ }
+
+ @Override
+ public void shutdown(final RequestMonitor requestMonitor) {
+ getExecutor().execute(getShutdownSequence(new RequestMonitor(getExecutor(), requestMonitor) {
+
+ @Override
+ protected void handleCompleted() {
GDBControl.super.shutdown(requestMonitor);
- }
- }));
- }
+ }
+ }));
+ }
@Override
- public String getId() {
- return fMIBackend.getId();
- }
-
+ public String getId() {
+ return fMIBackend.getId();
+ }
+
/**
* Create the commandControl context.
* This method can be overridden to provide a different context.
@@ -287,99 +286,95 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
protected ICommandControlDMContext createComandControlContext() {
return new GDBControlDMContext(getSession().getId(), getId());
}
-
+
@Deprecated
- @Override
- public MIControlDMContext getControlDMContext() {
+ @Override
+ public MIControlDMContext getControlDMContext() {
assert fControlDmc instanceof MIControlDMContext;
if (fControlDmc instanceof MIControlDMContext) {
- return (MIControlDMContext)fControlDmc;
+ return (MIControlDMContext) fControlDmc;
}
return null;
- }
-
+ }
+
@Override
- public ICommandControlDMContext getContext() {
- return fControlDmc;
- }
-
+ public ICommandControlDMContext getContext() {
+ return fControlDmc;
+ }
+
@Override
- public void terminate(final RequestMonitor rm) {
- if (fTerminated) {
- rm.done();
- return;
- }
- fTerminated = true;
-
- // If the initialization sequence is still running mark it as cancelled,
- // to avoid reporting errors to the user, since we are terminating anyway.
- if (fInitializationSequence != null) {
- fInitializationSequence.getRequestMonitor().cancel();
- }
-
- // To fix bug 234467:
- // Interrupt GDB in case the inferior is running.
- // That way, the inferior will also be killed when we exit GDB.
- //
+ public void terminate(final RequestMonitor rm) {
+ if (fTerminated) {
+ rm.done();
+ return;
+ }
+ fTerminated = true;
+
+ // If the initialization sequence is still running mark it as cancelled,
+ // to avoid reporting errors to the user, since we are terminating anyway.
+ if (fInitializationSequence != null) {
+ fInitializationSequence.getRequestMonitor().cancel();
+ }
+
+ // To fix bug 234467:
+ // Interrupt GDB in case the inferior is running.
+ // That way, the inferior will also be killed when we exit GDB.
+ //
IMIRunControl runControl = getServicesTracker().getService(IMIRunControl.class);
if (runControl != null && !runControl.isTargetAcceptingCommands()) {
- fMIBackend.interrupt();
- }
-
- // Schedule a runnable to be executed 2 seconds from now.
- // If we don't get a response to the quit command, this
- // runnable will kill the task.
- final Future<?> forceQuitTask = getExecutor().schedule(
- new DsfRunnable() {
- @Override
- public void run() {
- fMIBackend.destroy();
- rm.done();
- }
-
- @Override
- protected boolean isExecutionRequired() {
- return false;
- }
- },
- getGDBExitWaitTime(), TimeUnit.SECONDS);
-
- queueCommand(
- getCommandFactory().createMIGDBExit(getContext()),
- new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
- @Override
- public void handleCompleted() {
- if (isSuccess()) {
- // Cancel the time out runnable (if it hasn't run yet).
- if (forceQuitTask.cancel(false)) {
- rm.done();
- }
- }
- // else: the forceQuitTask has or will handle it.
- // It is good to wait for the forceQuitTask to trigger
- // to leave enough time for the interrupt() to complete.
- }
- }
- );
- }
+ fMIBackend.interrupt();
+ }
+
+ // Schedule a runnable to be executed 2 seconds from now.
+ // If we don't get a response to the quit command, this
+ // runnable will kill the task.
+ final Future<?> forceQuitTask = getExecutor().schedule(new DsfRunnable() {
+ @Override
+ public void run() {
+ fMIBackend.destroy();
+ rm.done();
+ }
+
+ @Override
+ protected boolean isExecutionRequired() {
+ return false;
+ }
+ }, getGDBExitWaitTime(), TimeUnit.SECONDS);
+
+ queueCommand(getCommandFactory().createMIGDBExit(getContext()),
+ new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
+ @Override
+ public void handleCompleted() {
+ if (isSuccess()) {
+ // Cancel the time out runnable (if it hasn't run yet).
+ if (forceQuitTask.cancel(false)) {
+ rm.done();
+ }
+ }
+ // else: the forceQuitTask has or will handle it.
+ // It is good to wait for the forceQuitTask to trigger
+ // to leave enough time for the interrupt() to complete.
+ }
+ });
+ }
/**
* @deprecated Replaced by {@link #getGDBBackendProcess()}
*/
@Deprecated
@Override
- public AbstractCLIProcess getCLIProcess() {
+ public AbstractCLIProcess getCLIProcess() {
if (fBackendProcess instanceof AbstractCLIProcess) {
- return (AbstractCLIProcess)fBackendProcess;
+ return (AbstractCLIProcess) fBackendProcess;
}
return null;
- }
-
+ }
+
/** @since 5.2 */
@Override
- public Process getGDBBackendProcess() {
+ public Process getGDBBackendProcess() {
return fBackendProcess;
- }
+ }
/**
* @since 2.0
@@ -388,7 +383,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
public void setTracingStream(OutputStream tracingStream) {
setMITracingStream(tracingStream);
}
-
+
/** @since 3.0 */
@Override
public void setEnvironment(Properties props, boolean clear, final RequestMonitor rm) {
@@ -398,38 +393,38 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
// First clear the environment if requested.
if (clear) {
count++;
- queueCommand(
- getCommandFactory().createCLIUnsetEnv(getContext()),
- new DataRequestMonitor<MIInfo>(getExecutor(), countingRm));
+ queueCommand(getCommandFactory().createCLIUnsetEnv(getContext()),
+ new DataRequestMonitor<MIInfo>(getExecutor(), countingRm));
}
-
+
// Now set the new variables
- for (Entry<Object,Object> property : props.entrySet()) {
+ for (Entry<Object, Object> property : props.entrySet()) {
count++;
- String name = (String)property.getKey();
- String value = (String)property.getValue();
- queueCommand(
- getCommandFactory().createMIGDBSetEnv(getContext(), name, value),
- new DataRequestMonitor<MIInfo>(getExecutor(), countingRm));
+ String name = (String) property.getKey();
+ String value = (String) property.getValue();
+ queueCommand(getCommandFactory().createMIGDBSetEnv(getContext(), name, value),
+ new DataRequestMonitor<MIInfo>(getExecutor(), countingRm));
}
countingRm.setDoneCount(count);
}
-
+
/**
* @since 4.0
*/
@Override
public void completeInitialization(final RequestMonitor rm) {
// We take the attributes from the launchConfiguration
- ILaunch launch = (ILaunch)getSession().getModelAdapter(ILaunch.class);
- Map<String, Object> attributes = null;
+ ILaunch launch = (ILaunch) getSession().getModelAdapter(ILaunch.class);
+ Map<String, Object> attributes = null;
try {
attributes = launch.getLaunchConfiguration().getAttributes();
- } catch (CoreException e) {}
+ } catch (CoreException e) {
+ }
// We need a RequestMonitorWithProgress, if we don't have one, we create one.
- IProgressMonitor monitor = (rm instanceof RequestMonitorWithProgress) ?
- ((RequestMonitorWithProgress)rm).getProgressMonitor() : new NullProgressMonitor();
+ IProgressMonitor monitor = (rm instanceof RequestMonitorWithProgress)
+ ? ((RequestMonitorWithProgress) rm).getProgressMonitor()
+ : new NullProgressMonitor();
RequestMonitorWithProgress progressRm = new RequestMonitorWithProgress(getExecutor(), monitor) {
@Override
@@ -442,235 +437,244 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
} else {
rm.cancel();
}
- rm.done();
+ rm.done();
}
};
fInitializationSequence = getCompleteInitializationSequence(attributes, progressRm);
ImmediateExecutor.getInstance().execute(fInitializationSequence);
}
-
+
/**
* Return the sequence that is to be used to complete the initialization of GDB.
- *
+ *
* @param rm A RequestMonitorWithProgress that will indicate when the sequence is completed, but that
* also contains an IProgressMonitor to be able to cancel the launch. A NullProgressMonitor
* can be used if cancellation is not required.
- *
+ *
* @since 4.0
*/
- protected Sequence getCompleteInitializationSequence(Map<String, Object> attributes, RequestMonitorWithProgress rm) {
+ protected Sequence getCompleteInitializationSequence(Map<String, Object> attributes,
+ RequestMonitorWithProgress rm) {
return new FinalLaunchSequence(getSession(), attributes, rm);
}
-
- @DsfServiceEventHandler
- public void eventDispatched(ICommandControlShutdownDMEvent e) {
- // Handle our "GDB Exited" event and stop processing commands.
- stopCommandProcessing();
-
- // Before GDB 7.0, we have to send the containerExited event ourselves
- IGDBProcesses procService = getServicesTracker().getService(IGDBProcesses.class);
- if (procService != null) {
- IContainerDMContext processContainerDmc = procService.createContainerContextFromGroupId(getContext(), MIProcesses.UNIQUE_GROUP_ID);
- getSession().dispatchEvent(
- new ContainerExitedDMEvent(processContainerDmc), getProperties());
- }
- }
-
- @DsfServiceEventHandler
- public void eventDispatched(BackendStateChangedEvent e) {
- if (e.getState() == IMIBackend.State.TERMINATED && e.getBackendId().equals(fMIBackend.getId())) {
- // Handle "GDB Exited" event, just relay to following event.
- getSession().dispatchEvent(new GDBControlShutdownDMEvent(getContext()), getProperties());
- }
- }
-
- public static class InitializationShutdownStep extends Sequence.Step {
- public enum Direction { INITIALIZING, SHUTTING_DOWN }
-
- private Direction fDirection;
- public InitializationShutdownStep(Direction direction) { fDirection = direction; }
-
- @Override
- final public void execute(RequestMonitor requestMonitor) {
- if (fDirection == Direction.INITIALIZING) {
- initialize(requestMonitor);
- } else {
- shutdown(requestMonitor);
- }
- }
-
- @Override
- final public void rollBack(RequestMonitor requestMonitor) {
- if (fDirection == Direction.INITIALIZING) {
- shutdown(requestMonitor);
- } else {
- super.rollBack(requestMonitor);
- }
- }
-
- protected void initialize(RequestMonitor requestMonitor) {
- requestMonitor.done();
- }
-
- protected void shutdown(RequestMonitor requestMonitor) {
- requestMonitor.done();
- }
- }
-
- protected class CommandMonitoringStep extends InitializationShutdownStep {
- CommandMonitoringStep(Direction direction) { super(direction); }
-
- @Override
- protected void initialize(final RequestMonitor requestMonitor) {
- doCommandMonitoringStep(requestMonitor);
- }
-
- @Override
- protected void shutdown(RequestMonitor requestMonitor) {
- undoCommandMonitoringStep(requestMonitor);
- }
- }
-
- /** @since 5.1 */
- protected void doCommandMonitoringStep(final RequestMonitor requestMonitor) {
- InputStream errorStream = null;
- if (fMIBackend instanceof IMIBackend2) {
- errorStream = ((IMIBackend2)fMIBackend).getMIErrorStream();
- }
- startCommandProcessing(fMIBackend.getMIInputStream(), fMIBackend.getMIOutputStream(), errorStream);
- requestMonitor.done();
- }
-
- /** @since 5.1 */
- protected void undoCommandMonitoringStep(RequestMonitor requestMonitor) {
- stopCommandProcessing();
- requestMonitor.done();
- }
-
- protected class CommandProcessorsStep extends InitializationShutdownStep {
- CommandProcessorsStep(Direction direction) { super(direction); }
-
- @Override
- public void initialize(final RequestMonitor requestMonitor) {
- doCommandProcessorsStep(requestMonitor);
- }
-
- @Override
- protected void shutdown(RequestMonitor requestMonitor) {
- undoCommandProcessorsStep(requestMonitor);
- }
- }
-
- /** @since 5.1 */
- protected void doCommandProcessorsStep(final RequestMonitor requestMonitor) {
- try {
- fBackendProcess = createBackendProcess();
- }
- catch(IOException e) {
- requestMonitor.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.REQUEST_FAILED, "Failed to create CLI Process", e)); //$NON-NLS-1$
- requestMonitor.done();
- return;
- }
-
- fCLICommandProcessor = createCLIEventProcessor(GDBControl.this, getContext());
- fMIEventProcessor = createMIRunControlEventProcessor(GDBControl.this, getContext());
- fControlEventProcessor = createControlEventProcessor();
- fMIAsyncErrorProcessor = createMIAsyncErrorProcessor(GDBControl.this);
-
- requestMonitor.done();
- }
-
- /** @since 5.1 */
- protected void undoCommandProcessorsStep(RequestMonitor requestMonitor) {
+
+ @DsfServiceEventHandler
+ public void eventDispatched(ICommandControlShutdownDMEvent e) {
+ // Handle our "GDB Exited" event and stop processing commands.
+ stopCommandProcessing();
+
+ // Before GDB 7.0, we have to send the containerExited event ourselves
+ IGDBProcesses procService = getServicesTracker().getService(IGDBProcesses.class);
+ if (procService != null) {
+ IContainerDMContext processContainerDmc = procService.createContainerContextFromGroupId(getContext(),
+ MIProcesses.UNIQUE_GROUP_ID);
+ getSession().dispatchEvent(new ContainerExitedDMEvent(processContainerDmc), getProperties());
+ }
+ }
+
+ @DsfServiceEventHandler
+ public void eventDispatched(BackendStateChangedEvent e) {
+ if (e.getState() == IMIBackend.State.TERMINATED && e.getBackendId().equals(fMIBackend.getId())) {
+ // Handle "GDB Exited" event, just relay to following event.
+ getSession().dispatchEvent(new GDBControlShutdownDMEvent(getContext()), getProperties());
+ }
+ }
+
+ public static class InitializationShutdownStep extends Sequence.Step {
+ public enum Direction {
+ INITIALIZING, SHUTTING_DOWN
+ }
+
+ private Direction fDirection;
+
+ public InitializationShutdownStep(Direction direction) {
+ fDirection = direction;
+ }
+
+ @Override
+ final public void execute(RequestMonitor requestMonitor) {
+ if (fDirection == Direction.INITIALIZING) {
+ initialize(requestMonitor);
+ } else {
+ shutdown(requestMonitor);
+ }
+ }
+
+ @Override
+ final public void rollBack(RequestMonitor requestMonitor) {
+ if (fDirection == Direction.INITIALIZING) {
+ shutdown(requestMonitor);
+ } else {
+ super.rollBack(requestMonitor);
+ }
+ }
+
+ protected void initialize(RequestMonitor requestMonitor) {
+ requestMonitor.done();
+ }
+
+ protected void shutdown(RequestMonitor requestMonitor) {
+ requestMonitor.done();
+ }
+ }
+
+ protected class CommandMonitoringStep extends InitializationShutdownStep {
+ CommandMonitoringStep(Direction direction) {
+ super(direction);
+ }
+
+ @Override
+ protected void initialize(final RequestMonitor requestMonitor) {
+ doCommandMonitoringStep(requestMonitor);
+ }
+
+ @Override
+ protected void shutdown(RequestMonitor requestMonitor) {
+ undoCommandMonitoringStep(requestMonitor);
+ }
+ }
+
+ /** @since 5.1 */
+ protected void doCommandMonitoringStep(final RequestMonitor requestMonitor) {
+ InputStream errorStream = null;
+ if (fMIBackend instanceof IMIBackend2) {
+ errorStream = ((IMIBackend2) fMIBackend).getMIErrorStream();
+ }
+ startCommandProcessing(fMIBackend.getMIInputStream(), fMIBackend.getMIOutputStream(), errorStream);
+ requestMonitor.done();
+ }
+
+ /** @since 5.1 */
+ protected void undoCommandMonitoringStep(RequestMonitor requestMonitor) {
+ stopCommandProcessing();
+ requestMonitor.done();
+ }
+
+ protected class CommandProcessorsStep extends InitializationShutdownStep {
+ CommandProcessorsStep(Direction direction) {
+ super(direction);
+ }
+
+ @Override
+ public void initialize(final RequestMonitor requestMonitor) {
+ doCommandProcessorsStep(requestMonitor);
+ }
+
+ @Override
+ protected void shutdown(RequestMonitor requestMonitor) {
+ undoCommandProcessorsStep(requestMonitor);
+ }
+ }
+
+ /** @since 5.1 */
+ protected void doCommandProcessorsStep(final RequestMonitor requestMonitor) {
+ try {
+ fBackendProcess = createBackendProcess();
+ } catch (IOException e) {
+ requestMonitor.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.REQUEST_FAILED,
+ "Failed to create CLI Process", e)); //$NON-NLS-1$
+ requestMonitor.done();
+ return;
+ }
+
+ fCLICommandProcessor = createCLIEventProcessor(GDBControl.this, getContext());
+ fMIEventProcessor = createMIRunControlEventProcessor(GDBControl.this, getContext());
+ fControlEventProcessor = createControlEventProcessor();
+ fMIAsyncErrorProcessor = createMIAsyncErrorProcessor(GDBControl.this);
+
+ requestMonitor.done();
+ }
+
+ /** @since 5.1 */
+ protected void undoCommandProcessorsStep(RequestMonitor requestMonitor) {
fControlEventProcessor.dispose();
- fCLICommandProcessor.dispose();
- fMIEventProcessor.dispose();
- fMIAsyncErrorProcessor.dispose();
- if (fBackendProcess instanceof AbstractCLIProcess) {
- ((AbstractCLIProcess)fBackendProcess).dispose();
- }
+ fCLICommandProcessor.dispose();
+ fMIEventProcessor.dispose();
+ fMIAsyncErrorProcessor.dispose();
+ if (fBackendProcess instanceof AbstractCLIProcess) {
+ ((AbstractCLIProcess) fBackendProcess).dispose();
+ }
- requestMonitor.done();
+ requestMonitor.done();
}
- /**
+ /**
* @since 4.1
*/
- protected class CommandTimeoutStep extends InitializationShutdownStep {
- CommandTimeoutStep( Direction direction ) {
- super( direction );
+ protected class CommandTimeoutStep extends InitializationShutdownStep {
+ CommandTimeoutStep(Direction direction) {
+ super(direction);
}
@Override
- public void initialize( final RequestMonitor requestMonitor ) {
+ public void initialize(final RequestMonitor requestMonitor) {
doCommandTimeoutStep(requestMonitor);
}
@Override
- protected void shutdown( RequestMonitor requestMonitor ) {
+ protected void shutdown(RequestMonitor requestMonitor) {
undoCommandTimeoutStep(requestMonitor);
}
}
- /** @since 5.1 */
- protected void doCommandTimeoutStep(final RequestMonitor requestMonitor) {
- fCommandTimeoutManager = createCommandTimeoutManager( GDBControl.this );
- if (fCommandTimeoutManager != null) {
- fCommandTimeoutManager.addCommandTimeoutListener(fTimeoutListener);
- }
- requestMonitor.done();
- }
-
- /** @since 5.1 */
- protected void undoCommandTimeoutStep(RequestMonitor requestMonitor) {
- if ( fCommandTimeoutManager != null ) {
- fCommandTimeoutManager.removeCommandTimeoutListener(fTimeoutListener);
- fCommandTimeoutManager.dispose();
- }
- requestMonitor.done();
- }
-
- protected class RegisterStep extends InitializationShutdownStep {
- RegisterStep(Direction direction) { super(direction); }
- @Override
- public void initialize(final RequestMonitor requestMonitor) {
- doRegisterStep(requestMonitor);
- }
-
- @Override
- protected void shutdown(RequestMonitor requestMonitor) {
- undoRegisterStep(requestMonitor);
- }
- }
-
- /** @since 5.1 */
- protected void doRegisterStep(final RequestMonitor requestMonitor) {
+ /** @since 5.1 */
+ protected void doCommandTimeoutStep(final RequestMonitor requestMonitor) {
+ fCommandTimeoutManager = createCommandTimeoutManager(GDBControl.this);
+ if (fCommandTimeoutManager != null) {
+ fCommandTimeoutManager.addCommandTimeoutListener(fTimeoutListener);
+ }
+ requestMonitor.done();
+ }
+
+ /** @since 5.1 */
+ protected void undoCommandTimeoutStep(RequestMonitor requestMonitor) {
+ if (fCommandTimeoutManager != null) {
+ fCommandTimeoutManager.removeCommandTimeoutListener(fTimeoutListener);
+ fCommandTimeoutManager.dispose();
+ }
+ requestMonitor.done();
+ }
+
+ protected class RegisterStep extends InitializationShutdownStep {
+ RegisterStep(Direction direction) {
+ super(direction);
+ }
+
+ @Override
+ public void initialize(final RequestMonitor requestMonitor) {
+ doRegisterStep(requestMonitor);
+ }
+
+ @Override
+ protected void shutdown(RequestMonitor requestMonitor) {
+ undoRegisterStep(requestMonitor);
+ }
+ }
+
+ /** @since 5.1 */
+ protected void doRegisterStep(final RequestMonitor requestMonitor) {
getSession().addServiceEventListener(GDBControl.this, null);
- register(
- new String[]{ ICommandControl.class.getName(),
- ICommandControlService.class.getName(),
- IMICommandControl.class.getName(),
- AbstractMIControl.class.getName(),
- IGDBControl.class.getName() },
- new Hashtable<String,String>());
- getSession().dispatchEvent(new GDBControlInitializedDMEvent(getContext()), getProperties());
- requestMonitor.done();
- }
-
- /** @since 5.1 */
- protected void undoRegisterStep(RequestMonitor requestMonitor) {
- unregister();
- getSession().removeServiceEventListener(GDBControl.this);
- requestMonitor.done();
- }
+ register(new String[] { ICommandControl.class.getName(), ICommandControlService.class.getName(),
+ IMICommandControl.class.getName(), AbstractMIControl.class.getName(), IGDBControl.class.getName() },
+ new Hashtable<String, String>());
+ getSession().dispatchEvent(new GDBControlInitializedDMEvent(getContext()), getProperties());
+ requestMonitor.done();
+ }
+
+ /** @since 5.1 */
+ protected void undoRegisterStep(RequestMonitor requestMonitor) {
+ unregister();
+ getSession().removeServiceEventListener(GDBControl.this);
+ requestMonitor.done();
+ }
/** @since 4.0 */
@Override
public List<String> getFeatures() {
return fFeatures;
}
-
+
/**
* @since 4.0
*/
@@ -678,7 +682,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
public void enablePrettyPrintingForMIVariableObjects(RequestMonitor rm) {
rm.done();
}
-
+
/**
* @since 4.0
*/
@@ -691,44 +695,50 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
* @since 4.1
*/
protected Sequence getStartupSequence(final RequestMonitor requestMonitor) {
- final Sequence.Step[] initializeSteps = new Sequence.Step[] {
- new CommandMonitoringStep(InitializationShutdownStep.Direction.INITIALIZING),
- new CommandProcessorsStep(InitializationShutdownStep.Direction.INITIALIZING),
- new CommandTimeoutStep(InitializationShutdownStep.Direction.INITIALIZING),
- new RegisterStep(InitializationShutdownStep.Direction.INITIALIZING),
- };
+ final Sequence.Step[] initializeSteps = new Sequence.Step[] {
+ new CommandMonitoringStep(InitializationShutdownStep.Direction.INITIALIZING),
+ new CommandProcessorsStep(InitializationShutdownStep.Direction.INITIALIZING),
+ new CommandTimeoutStep(InitializationShutdownStep.Direction.INITIALIZING),
+ new RegisterStep(InitializationShutdownStep.Direction.INITIALIZING), };
- return new Sequence(getExecutor(), requestMonitor) {
- @Override public Step[] getSteps() { return initializeSteps; }
- };
+ return new Sequence(getExecutor(), requestMonitor) {
+ @Override
+ public Step[] getSteps() {
+ return initializeSteps;
+ }
+ };
}
/**
* @since 4.1
*/
protected Sequence getShutdownSequence(RequestMonitor requestMonitor) {
- final Sequence.Step[] shutdownSteps = new Sequence.Step[] {
- new RegisterStep(InitializationShutdownStep.Direction.SHUTTING_DOWN),
- new CommandTimeoutStep(InitializationShutdownStep.Direction.SHUTTING_DOWN),
- new CommandProcessorsStep(InitializationShutdownStep.Direction.SHUTTING_DOWN),
- new CommandMonitoringStep(InitializationShutdownStep.Direction.SHUTTING_DOWN),
- };
- return new Sequence(getExecutor(), requestMonitor) {
- @Override public Step[] getSteps() { return shutdownSteps; }
- };
+ final Sequence.Step[] shutdownSteps = new Sequence.Step[] {
+ new RegisterStep(InitializationShutdownStep.Direction.SHUTTING_DOWN),
+ new CommandTimeoutStep(InitializationShutdownStep.Direction.SHUTTING_DOWN),
+ new CommandProcessorsStep(InitializationShutdownStep.Direction.SHUTTING_DOWN),
+ new CommandMonitoringStep(InitializationShutdownStep.Direction.SHUTTING_DOWN), };
+ return new Sequence(getExecutor(), requestMonitor) {
+ @Override
+ public Step[] getSteps() {
+ return shutdownSteps;
+ }
+ };
}
/**
* @since 4.1
*/
- protected IEventProcessor createCLIEventProcessor(ICommandControlService connection, ICommandControlDMContext controlDmc) {
+ protected IEventProcessor createCLIEventProcessor(ICommandControlService connection,
+ ICommandControlDMContext controlDmc) {
return new CLIEventProcessor(connection, controlDmc);
}
/**
* @since 4.1
*/
- protected IEventProcessor createMIRunControlEventProcessor(AbstractMIControl connection, ICommandControlDMContext controlDmc) {
+ protected IEventProcessor createMIRunControlEventProcessor(AbstractMIControl connection,
+ ICommandControlDMContext controlDmc) {
return new MIRunControlEventProcessor(connection, controlDmc);
}
@@ -746,16 +756,16 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
/** @since 5.2 */
protected Process createBackendProcess() throws IOException {
- if (fMIBackend.isFullGdbConsoleSupported()) {
- // If the full GDB console is supported, which uses the GDB process itself,
- // we return a GDBBackendProcess that does not take care of I/O
- return new GDBBackendProcessWithoutIO(this, fMIBackend);
- }
- // If the full GDB console is not supported according to the backend service,
- // then we create a special GDBBackendProcess that handles the CLI
+ if (fMIBackend.isFullGdbConsoleSupported()) {
+ // If the full GDB console is supported, which uses the GDB process itself,
+ // we return a GDBBackendProcess that does not take care of I/O
+ return new GDBBackendProcessWithoutIO(this, fMIBackend);
+ }
+ // If the full GDB console is not supported according to the backend service,
+ // then we create a special GDBBackendProcess that handles the CLI
return new GDBBackendCLIProcess(this, fMIBackend);
}
-
+
/**
* @since 4.1
*/
@@ -763,7 +773,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
fFeatures.clear();
fFeatures.addAll(features);
}
-
+
/**
* @since 4.1
*/
@@ -783,33 +793,28 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
commandText = commandText.substring(0, commandText.length() - 1);
final String errorMessage = String.format("Command '%s' is timed out", commandText); //$NON-NLS-1$
commandFailed(token, STATUS_CODE_COMMAND_TIMED_OUT, errorMessage);
-
- // If the timeout occurs while the launch sequence is running
+
+ // If the timeout occurs while the launch sequence is running
// the error will be reported by the launcher's error reporting mechanism.
// We need to show the error message only when the session is initialized.
if (isInitialized()) {
// The session is terminated if a command is timed out.
terminate(new RequestMonitor(getExecutor(), null) {
-
+
@Override
protected void handleErrorOrWarning() {
GdbPlugin.getDefault().getLog().log(getStatus());
super.handleErrorOrWarning();
};
- } );
-
- IStatus status = new Status(
- IStatus.ERROR,
- GdbPlugin.PLUGIN_ID,
- IGdbDebugConstants.STATUS_HANDLER_CODE,
- String.format( Messages.GDBControl_Session_is_terminated, errorMessage ),
- null);
+ });
+
+ IStatus status = new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IGdbDebugConstants.STATUS_HANDLER_CODE,
+ String.format(Messages.GDBControl_Session_is_terminated, errorMessage), null);
IStatusHandler statusHandler = DebugPlugin.getDefault().getStatusHandler(status);
if (statusHandler != null) {
try {
statusHandler.handleStatus(status, null);
- }
- catch(CoreException e) {
+ } catch (CoreException e) {
GdbPlugin.getDefault().getLog().log(e.getStatus());
}
}
@@ -818,21 +823,21 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
/**
* Parse output from GDB to determine if the connection to the remote was lost.
- *
+ *
* @param output The output received from GDB that must be parsed
* to determine if the connection to the remote was lost.
- *
+ *
* @return True if the connection was lost, false otherwise.
* @since 4.3
*/
protected boolean verifyConnectionLost(MIOutput output) {
boolean connectionLost = false;
String reason = null;
-
+
// Check if any command has a result that indicates a lost connection.
// This can happen as a normal command result, or as an out-of-band event.
- // The out-of-band case can happen when GDB sends another response to
- // a previous command. This case can happen, for example, in all-stop
+ // The out-of-band case can happen when GDB sends another response to
+ // a previous command. This case can happen, for example, in all-stop
// when sending an -exec-continue and then killing gdbserver while connected
// to a process; in that case a second result to -exec-continue will be sent
// and will indicate the remote connection is closed.
@@ -846,7 +851,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
if (var.equals("msg")) { //$NON-NLS-1$
MIValue value = result.getMIValue();
if (value instanceof MIConst) {
- String str = ((MIConst)value).getCString();
+ String str = ((MIConst) value).getCString();
if (str != null && str.startsWith("Remote connection closed")) { //$NON-NLS-1$
connectionLost = true;
reason = str;
@@ -891,17 +896,17 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
}
if (connectionLost) {
- connectionLost(reason);
- return true;
- }
-
- return false;
+ connectionLost(reason);
+ return true;
+ }
+
+ return false;
}
-
+
/**
* Handle the loss of the connection to the remote.
* The default implementation terminates the debug session.
- *
+ *
* @param reason A string indicating as much as possible why the connection was lost. Can be null.
* @since 4.3
*/
@@ -914,7 +919,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
};
});
}
-
+
/**
* @since 4.1
*/
@@ -924,7 +929,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
/**
* Returns the time (in seconds) the debugger will wait for "gdb-exit" to complete.
- *
+ *
* @since 4.2
*/
protected int getGDBExitWaitTime() {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControlDMContext.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControlDMContext.java
index eacddfe0ae6..3d2fe309e1d 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControlDMContext.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControlDMContext.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* Onur Akdemir (TUBITAK BILGEM-ITI) - Multi-process debugging (Bug 335324)
@@ -23,15 +23,13 @@ import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl.ITraceTargetDMContext;
import org.eclipse.cdt.dsf.mi.service.command.MIControlDMContext;
/**
- *
+ *
*/
-public class GDBControlDMContext extends MIControlDMContext
- implements ISymbolDMContext, ISourceLookupDMContext,
- ISignalsDMContext, ITraceTargetDMContext, IHardwareTargetDMContext
-{
+public class GDBControlDMContext extends MIControlDMContext implements ISymbolDMContext, ISourceLookupDMContext,
+ ISignalsDMContext, ITraceTargetDMContext, IHardwareTargetDMContext {
- public GDBControlDMContext(String sessionId, String commandControlId) {
- super(sessionId, commandControlId);
- }
+ public GDBControlDMContext(String sessionId, String commandControlId) {
+ super(sessionId, commandControlId);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_0.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_0.java
index f7dbcf7373f..c79731e7a72 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_0.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_0.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* Ericsson - Modified for additional features in DSF Reference implementation
@@ -40,134 +40,137 @@ import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.debug.core.ILaunchConfiguration;
/**
- * GDB Debugger control implementation. This implementation extends the
- * base MI control implementation to provide the GDB-specific debugger
+ * GDB Debugger control implementation. This implementation extends the
+ * base MI control implementation to provide the GDB-specific debugger
* features. This includes:<br>
* - CLI console support,<br>
* - inferior process status tracking.<br>
*/
public class GDBControl_7_0 extends GDBControl {
- /**
- * @since 3.0
- */
- public GDBControl_7_0(DsfSession session, ILaunchConfiguration config, CommandFactory factory) {
- super(session, true, config, factory);
- }
+ /**
+ * @since 3.0
+ */
+ public GDBControl_7_0(DsfSession session, ILaunchConfiguration config, CommandFactory factory) {
+ super(session, true, config, factory);
+ }
@Override
protected Sequence getStartupSequence(RequestMonitor requestMonitor) {
- final Sequence.Step[] initializeSteps = new Sequence.Step[] {
- new CommandMonitoringStep(GDBControl.InitializationShutdownStep.Direction.INITIALIZING),
- new CommandProcessorsStep(GDBControl.InitializationShutdownStep.Direction.INITIALIZING),
- new CommandTimeoutStep(GDBControl.InitializationShutdownStep.Direction.INITIALIZING),
- new ListFeaturesStep(GDBControl.InitializationShutdownStep.Direction.INITIALIZING),
- new RegisterStep(GDBControl.InitializationShutdownStep.Direction.INITIALIZING),
- };
-
- return new Sequence(getExecutor(), requestMonitor) {
- @Override public Step[] getSteps() { return initializeSteps; }
- };
+ final Sequence.Step[] initializeSteps = new Sequence.Step[] {
+ new CommandMonitoringStep(GDBControl.InitializationShutdownStep.Direction.INITIALIZING),
+ new CommandProcessorsStep(GDBControl.InitializationShutdownStep.Direction.INITIALIZING),
+ new CommandTimeoutStep(GDBControl.InitializationShutdownStep.Direction.INITIALIZING),
+ new ListFeaturesStep(GDBControl.InitializationShutdownStep.Direction.INITIALIZING),
+ new RegisterStep(GDBControl.InitializationShutdownStep.Direction.INITIALIZING), };
+
+ return new Sequence(getExecutor(), requestMonitor) {
+ @Override
+ public Step[] getSteps() {
+ return initializeSteps;
+ }
+ };
}
@Override
protected Sequence getShutdownSequence(RequestMonitor requestMonitor) {
- final Sequence.Step[] shutdownSteps = new Sequence.Step[] {
- new RegisterStep(GDBControl.InitializationShutdownStep.Direction.SHUTTING_DOWN),
- new ListFeaturesStep(GDBControl.InitializationShutdownStep.Direction.SHUTTING_DOWN),
- new CommandTimeoutStep(GDBControl.InitializationShutdownStep.Direction.SHUTTING_DOWN),
- new CommandProcessorsStep(GDBControl.InitializationShutdownStep.Direction.SHUTTING_DOWN),
- new CommandMonitoringStep(GDBControl.InitializationShutdownStep.Direction.SHUTTING_DOWN),
- };
- return new Sequence(getExecutor(), requestMonitor) {
- @Override public Step[] getSteps() { return shutdownSteps; }
- };
+ final Sequence.Step[] shutdownSteps = new Sequence.Step[] {
+ new RegisterStep(GDBControl.InitializationShutdownStep.Direction.SHUTTING_DOWN),
+ new ListFeaturesStep(GDBControl.InitializationShutdownStep.Direction.SHUTTING_DOWN),
+ new CommandTimeoutStep(GDBControl.InitializationShutdownStep.Direction.SHUTTING_DOWN),
+ new CommandProcessorsStep(GDBControl.InitializationShutdownStep.Direction.SHUTTING_DOWN),
+ new CommandMonitoringStep(GDBControl.InitializationShutdownStep.Direction.SHUTTING_DOWN), };
+ return new Sequence(getExecutor(), requestMonitor) {
+ @Override
+ public Step[] getSteps() {
+ return shutdownSteps;
+ }
+ };
}
@Override
- protected IEventProcessor createCLIEventProcessor(ICommandControlService connection, ICommandControlDMContext controlDmc) {
+ protected IEventProcessor createCLIEventProcessor(ICommandControlService connection,
+ ICommandControlDMContext controlDmc) {
return new CLIEventProcessor_7_0(connection, controlDmc);
}
@Override
- protected IEventProcessor createMIRunControlEventProcessor(AbstractMIControl connection, ICommandControlDMContext controlDmc) {
+ protected IEventProcessor createMIRunControlEventProcessor(AbstractMIControl connection,
+ ICommandControlDMContext controlDmc) {
return new MIRunControlEventProcessor_7_0(connection, controlDmc);
}
-
- /** @since 5.1 */
- protected void doListFeatures(final RequestMonitor requestMonitor) {
- queueCommand(
- getCommandFactory().createMIListFeatures(getContext()),
- new DataRequestMonitor<MIListFeaturesInfo>(getExecutor(), requestMonitor) {
- @Override
- public void handleSuccess() {
- setFeatures(getData().getFeatures());
- super.handleSuccess();
- }
- });
- }
-
- /** @since 5.1 */
- protected void undoListFeatures(RequestMonitor requestMonitor) {
- requestMonitor.done();
- }
-
+
+ /** @since 5.1 */
+ protected void doListFeatures(final RequestMonitor requestMonitor) {
+ queueCommand(getCommandFactory().createMIListFeatures(getContext()),
+ new DataRequestMonitor<MIListFeaturesInfo>(getExecutor(), requestMonitor) {
+ @Override
+ public void handleSuccess() {
+ setFeatures(getData().getFeatures());
+ super.handleSuccess();
+ }
+ });
+ }
+
+ /** @since 5.1 */
+ protected void undoListFeatures(RequestMonitor requestMonitor) {
+ requestMonitor.done();
+ }
+
@Override
- protected Sequence getCompleteInitializationSequence(Map<String, Object> attributes, RequestMonitorWithProgress rm) {
+ protected Sequence getCompleteInitializationSequence(Map<String, Object> attributes,
+ RequestMonitorWithProgress rm) {
return new FinalLaunchSequence_7_0(getSession(), attributes, rm);
}
-
- @Override
- @DsfServiceEventHandler
- public void eventDispatched(ICommandControlShutdownDMEvent e) {
- // Handle our "GDB Exited" event and stop processing commands.
- stopCommandProcessing();
- }
-
- /** @since 3.0 */
- @DsfServiceEventHandler
- public void eventDispatched(ITraceRecordSelectedChangedDMEvent e) {
- }
-
-
- /** @since 4.0 */
- protected class ListFeaturesStep extends InitializationShutdownStep {
-
- ListFeaturesStep(Direction direction) {
+
+ @Override
+ @DsfServiceEventHandler
+ public void eventDispatched(ICommandControlShutdownDMEvent e) {
+ // Handle our "GDB Exited" event and stop processing commands.
+ stopCommandProcessing();
+ }
+
+ /** @since 3.0 */
+ @DsfServiceEventHandler
+ public void eventDispatched(ITraceRecordSelectedChangedDMEvent e) {
+ }
+
+ /** @since 4.0 */
+ protected class ListFeaturesStep extends InitializationShutdownStep {
+
+ ListFeaturesStep(Direction direction) {
super(direction);
- }
+ }
- @Override
- protected void initialize(final RequestMonitor requestMonitor) {
- doListFeatures(requestMonitor);
- }
+ @Override
+ protected void initialize(final RequestMonitor requestMonitor) {
+ doListFeatures(requestMonitor);
+ }
- @Override
- protected void shutdown(RequestMonitor requestMonitor) {
- undoListFeatures(requestMonitor);
- }
- }
+ @Override
+ protected void shutdown(RequestMonitor requestMonitor) {
+ undoListFeatures(requestMonitor);
+ }
+ }
- /**
+ /**
* @since 4.0
*/
@Override
public void enablePrettyPrintingForMIVariableObjects(RequestMonitor rm) {
- queueCommand(
- getCommandFactory().createMIEnablePrettyPrinting(getContext()),
+ queueCommand(getCommandFactory().createMIEnablePrettyPrinting(getContext()),
new DataRequestMonitor<MIInfo>(getExecutor(), rm));
}
-
+
/**
* @since 4.0
*/
@Override
public void setPrintPythonErrors(boolean enabled, RequestMonitor rm) {
-
- String subCommand = "set python print-stack " + (enabled ? "on" : "off"); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
-
- queueCommand(
- getCommandFactory().createCLIMaintenance(getContext(), subCommand),
+
+ String subCommand = "set python print-stack " + (enabled ? "on" : "off"); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
+
+ queueCommand(getCommandFactory().createCLIMaintenance(getContext(), subCommand),
new DataRequestMonitor<MIInfo>(getExecutor(), rm));
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_12.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_12.java
index 0f78c7b6fb3..594f03c161a 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_12.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_12.java
@@ -27,17 +27,19 @@ import org.eclipse.debug.core.ILaunchConfiguration;
* @since 5.2
*/
public class GDBControl_7_12 extends GDBControl_7_7 {
- public GDBControl_7_12(DsfSession session, ILaunchConfiguration config, CommandFactory factory) {
- super(session, config, factory);
- }
+ public GDBControl_7_12(DsfSession session, ILaunchConfiguration config, CommandFactory factory) {
+ super(session, config, factory);
+ }
- @Override
- protected Sequence getCompleteInitializationSequence(Map<String, Object> attributes, RequestMonitorWithProgress rm) {
+ @Override
+ protected Sequence getCompleteInitializationSequence(Map<String, Object> attributes,
+ RequestMonitorWithProgress rm) {
return new FinalLaunchSequence_7_12(getSession(), attributes, rm);
}
-
+
@Override
- protected IEventProcessor createMIRunControlEventProcessor(AbstractMIControl connection, ICommandControlDMContext controlDmc) {
+ protected IEventProcessor createMIRunControlEventProcessor(AbstractMIControl connection,
+ ICommandControlDMContext controlDmc) {
return new MIRunControlEventProcessor_7_12(connection, controlDmc);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_2.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_2.java
index 33b19fadba4..ea8fd5d18b8 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_2.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_2.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
@@ -27,13 +27,14 @@ import org.eclipse.debug.core.ILaunchConfiguration;
* @since 4.0
*/
public class GDBControl_7_2 extends GDBControl_7_0 implements IGDBControl {
- public GDBControl_7_2(DsfSession session, ILaunchConfiguration config, CommandFactory factory) {
- super(session, config, factory);
- setUseThreadGroupOptions(true);
- }
-
- @Override
- protected Sequence getCompleteInitializationSequence(Map<String, Object> attributes, RequestMonitorWithProgress rm) {
+ public GDBControl_7_2(DsfSession session, ILaunchConfiguration config, CommandFactory factory) {
+ super(session, config, factory);
+ setUseThreadGroupOptions(true);
+ }
+
+ @Override
+ protected Sequence getCompleteInitializationSequence(Map<String, Object> attributes,
+ RequestMonitorWithProgress rm) {
return new FinalLaunchSequence_7_2(getSession(), attributes, rm);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_4.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_4.java
index 00c8997958b..2f61fd4799d 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_4.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_4.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Marc Khouzam (Ericsson) - initial API and implementation
* Marc Khouzam (Ericsson) - Update breakpoint handling for GDB >= 7.4 (Bug 389945)
@@ -25,14 +25,14 @@ import org.eclipse.debug.core.ILaunchConfiguration;
/**
* With GDB 7.4, the command 'maintenance set python print-stack' is not supported.
* The new command "set python print-stack none|full|message" has replaced it.
- *
+ *
* With GDB 7.4, breakpoints are handled globally for all of GDB, so our
* IBreakpointsTargetDMContext becomes the GDBControlContext.
- *
+ *
* @since 4.1
*/
public class GDBControl_7_4 extends GDBControl_7_2 implements IGDBControl {
-
+
/**
* A command control context that is also a IBreakpointsTargetDMContext
*/
@@ -41,25 +41,24 @@ public class GDBControl_7_4 extends GDBControl_7_2 implements IGDBControl {
super(sessionId, commandControlId);
}
}
-
- public GDBControl_7_4(DsfSession session, ILaunchConfiguration config, CommandFactory factory) {
- super(session, config, factory);
- }
- /** @since 4.4 */
- @Override
- protected ICommandControlDMContext createComandControlContext() {
+ public GDBControl_7_4(DsfSession session, ILaunchConfiguration config, CommandFactory factory) {
+ super(session, config, factory);
+ }
+
+ /** @since 4.4 */
+ @Override
+ protected ICommandControlDMContext createComandControlContext() {
return new GDBControlDMContext_7_4(getSession().getId(), getId());
- }
-
+ }
+
@Override
public void setPrintPythonErrors(boolean enabled, RequestMonitor rm) {
// With GDB 7.4, the command 'maintenance set python print-stack' has been replaced by
// the new command "set python print-stack none|full|message".
// Bug 367788
String errorOption = enabled ? "full" : "none"; //$NON-NLS-1$ //$NON-NLS-2$
- queueCommand(
- getCommandFactory().createMIGDBSetPythonPrintStack(getContext(), errorOption),
- new DataRequestMonitor<MIInfo>(getExecutor(), rm));
+ queueCommand(getCommandFactory().createMIGDBSetPythonPrintStack(getContext(), errorOption),
+ new DataRequestMonitor<MIInfo>(getExecutor(), rm));
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_7.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_7.java
index bef45bd344d..df1bf948629 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_7.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_7.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Marc Khouzam (Ericsson) - initial API and implementation
*******************************************************************************/
@@ -30,17 +30,19 @@ import org.eclipse.debug.core.ILaunchConfiguration;
* @since 4.4
*/
public class GDBControl_7_7 extends GDBControl_7_4 {
- public GDBControl_7_7(DsfSession session, ILaunchConfiguration config, CommandFactory factory) {
- super(session, config, factory);
- }
-
+ public GDBControl_7_7(DsfSession session, ILaunchConfiguration config, CommandFactory factory) {
+ super(session, config, factory);
+ }
+
@Override
- protected IEventProcessor createCLIEventProcessor(ICommandControlService connection, ICommandControlDMContext controlDmc) {
+ protected IEventProcessor createCLIEventProcessor(ICommandControlService connection,
+ ICommandControlDMContext controlDmc) {
return new CLIEventProcessor_7_7(connection, controlDmc);
}
- @Override
- protected Sequence getCompleteInitializationSequence(Map<String, Object> attributes, RequestMonitorWithProgress rm) {
+ @Override
+ protected Sequence getCompleteInitializationSequence(Map<String, Object> attributes,
+ RequestMonitorWithProgress rm) {
return new FinalLaunchSequence_7_7(getSession(), attributes, rm);
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GdbCommandTimeoutManager.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GdbCommandTimeoutManager.java
index a58d3d26950..7e38a27d6be 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GdbCommandTimeoutManager.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GdbCommandTimeoutManager.java
@@ -39,34 +39,35 @@ import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChange
import org.eclipse.core.runtime.preferences.InstanceScope;
/**
- * The command timeout manager registers itself as a command listener and monitors
- * the command execution time. The goal of this implementation is to gracefully
- * handle disruptions in the communication between Eclipse and GDB.
- *
- * The algorithm used by this class is based on the assumption that the command
- * execution in GDB is sequential even though DSF can send up to 3 commands at
+ * The command timeout manager registers itself as a command listener and monitors
+ * the command execution time. The goal of this implementation is to gracefully
+ * handle disruptions in the communication between Eclipse and GDB.
+ *
+ * The algorithm used by this class is based on the assumption that the command
+ * execution in GDB is sequential even though DSF can send up to 3 commands at
* a time to GDB (see {@link AbstractMIControl}).
- *
+ *
* @since 4.1
*/
public class GdbCommandTimeoutManager implements ICommandListener, IPreferenceChangeListener {
public interface ICommandTimeoutListener {
-
- void commandTimedOut( ICommandToken token );
+
+ void commandTimedOut(ICommandToken token);
}
-
+
/**
* @deprecated The DEBUG flag is replaced with the GdbDebugOptions.DEBUG_COMMAND_TIMEOUTS
*/
@Deprecated
- public final static boolean DEBUG = Boolean.parseBoolean( Platform.getDebugOption( "org.eclipse.cdt.dsf.gdb/debug/timeouts" ) ); //$NON-NLS-1$
-
+ public final static boolean DEBUG = Boolean
+ .parseBoolean(Platform.getDebugOption("org.eclipse.cdt.dsf.gdb/debug/timeouts")); //$NON-NLS-1$
+
private class QueueEntry {
private long fTimestamp;
private ICommandToken fCommandToken;
-
- private QueueEntry( long timestamp, ICommandToken commandToken ) {
+
+ private QueueEntry(long timestamp, ICommandToken commandToken) {
super();
fTimestamp = timestamp;
fCommandToken = commandToken;
@@ -76,19 +77,16 @@ public class GdbCommandTimeoutManager implements ICommandListener, IPreferenceCh
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
- public boolean equals( Object obj ) {
- if ( obj instanceof QueueEntry ) {
- return fCommandToken.equals( ((QueueEntry)obj).fCommandToken );
+ public boolean equals(Object obj) {
+ if (obj instanceof QueueEntry) {
+ return fCommandToken.equals(((QueueEntry) obj).fCommandToken);
}
return false;
}
}
private enum TimerThreadState {
- INITIALIZING,
- RUNNING,
- HALTED,
- SHUTDOWN
+ INITIALIZING, RUNNING, HALTED, SHUTDOWN
}
private class TimerThread extends Thread {
@@ -97,11 +95,11 @@ public class GdbCommandTimeoutManager implements ICommandListener, IPreferenceCh
private int fWaitTimeout = IGdbDebugPreferenceConstants.COMMAND_TIMEOUT_VALUE_DEFAULT;
private TimerThreadState fState = TimerThreadState.INITIALIZING;
- TimerThread( BlockingQueue<QueueEntry> queue, int timeout ) {
+ TimerThread(BlockingQueue<QueueEntry> queue, int timeout) {
super();
- setName( "GDB Command Timer Thread" ); //$NON-NLS-1$
+ setName("GDB Command Timer Thread"); //$NON-NLS-1$
fQueue = queue;
- setWaitTimout( timeout );
+ setWaitTimout(timeout);
}
/* (non-Javadoc)
@@ -109,17 +107,15 @@ public class GdbCommandTimeoutManager implements ICommandListener, IPreferenceCh
*/
@Override
public void run() {
- setTimerThreadState( ( getWaitTimeout() > 0 ) ?
- TimerThreadState.RUNNING : TimerThreadState.HALTED );
+ setTimerThreadState((getWaitTimeout() > 0) ? TimerThreadState.RUNNING : TimerThreadState.HALTED);
doRun();
}
private void doRun() {
- while ( getTimerThreadState() != TimerThreadState.SHUTDOWN ) {
- if ( getTimerThreadState() == TimerThreadState.HALTED ) {
+ while (getTimerThreadState() != TimerThreadState.SHUTDOWN) {
+ if (getTimerThreadState() == TimerThreadState.HALTED) {
halted();
- }
- else {
+ } else {
running();
}
}
@@ -128,95 +124,93 @@ public class GdbCommandTimeoutManager implements ICommandListener, IPreferenceCh
private void halted() {
fQueue.clear();
try {
- synchronized( TimerThread.this ) {
+ synchronized (TimerThread.this) {
wait();
}
- }
- catch( InterruptedException e ) {
+ } catch (InterruptedException e) {
}
}
private void running() {
try {
- while( getTimerThreadState() == TimerThreadState.RUNNING ) {
+ while (getTimerThreadState() == TimerThreadState.RUNNING) {
// Use the minimum of all timeout values > 0 as the wait timeout.
long timeout = getWaitTimeout();
QueueEntry entry = fQueue.peek();
- if ( entry != null ) {
- // Calculate the time elapsed since the execution of this command started
+ if (entry != null) {
+ // Calculate the time elapsed since the execution of this command started
// and compare it with the command's timeout value.
- // If the elapsed time is greater or equal than the timeout value the command
- // is marked as timed out. Otherwise, schedule the next check when the timeout
+ // If the elapsed time is greater or equal than the timeout value the command
+ // is marked as timed out. Otherwise, schedule the next check when the timeout
// expires.
- long commandTimeout = getTimeoutForCommand( entry.fCommandToken.getCommand() );
-
- if ( GdbDebugOptions.DEBUG_COMMAND_TIMEOUTS ) {
+ long commandTimeout = getTimeoutForCommand(entry.fCommandToken.getCommand());
+
+ if (GdbDebugOptions.DEBUG_COMMAND_TIMEOUTS) {
String commandText = entry.fCommandToken.getCommand().toString();
- if ( commandText.endsWith( "\n" ) ) //$NON-NLS-1$
- commandText = commandText.substring( 0, commandText.length() - 1 );
+ if (commandText.endsWith("\n")) //$NON-NLS-1$
+ commandText = commandText.substring(0, commandText.length() - 1);
- printDebugMessage( String.format( "Processing command '%s', command timeout is %d", //$NON-NLS-1$
- commandText, Long.valueOf( commandTimeout ) ) );
+ printDebugMessage(String.format("Processing command '%s', command timeout is %d", //$NON-NLS-1$
+ commandText, Long.valueOf(commandTimeout)));
}
long currentTime = System.currentTimeMillis();
long elapsedTime = currentTime - entry.fTimestamp;
- if ( commandTimeout <= elapsedTime ) {
- processTimedOutCommand( entry.fCommandToken );
- fQueue.remove( entry );
- // Reset the timestamp of the next command in the queue because
- // regardless how long the command has been in the queue GDB will
- // start executing it only when the execution of the previous command
- // is completed.
+ if (commandTimeout <= elapsedTime) {
+ processTimedOutCommand(entry.fCommandToken);
+ fQueue.remove(entry);
+ // Reset the timestamp of the next command in the queue because
+ // regardless how long the command has been in the queue GDB will
+ // start executing it only when the execution of the previous command
+ // is completed.
QueueEntry nextEntry = fQueue.peek();
- if ( nextEntry != null ) {
- setTimeStamp( currentTime, nextEntry );
+ if (nextEntry != null) {
+ setTimeStamp(currentTime, nextEntry);
}
- }
- else {
- // Adjust the wait timeout because the time remaining for
- // the current command to expire may be less than the current wait timeout.
- timeout = Math.min( timeout, commandTimeout - elapsedTime );
+ } else {
+ // Adjust the wait timeout because the time remaining for
+ // the current command to expire may be less than the current wait timeout.
+ timeout = Math.min(timeout, commandTimeout - elapsedTime);
- if ( GdbDebugOptions.DEBUG_COMMAND_TIMEOUTS ) {
+ if (GdbDebugOptions.DEBUG_COMMAND_TIMEOUTS) {
String commandText = entry.fCommandToken.getCommand().toString();
- if ( commandText.endsWith( "\n" ) ) //$NON-NLS-1$
- commandText = commandText.substring( 0, commandText.length() - 1 );
-
- printDebugMessage( String.format( "Setting timeout %d for command '%s'", Long.valueOf( timeout ), commandText ) ); //$NON-NLS-1$
+ if (commandText.endsWith("\n")) //$NON-NLS-1$
+ commandText = commandText.substring(0, commandText.length() - 1);
+
+ printDebugMessage(String.format("Setting timeout %d for command '%s'", //$NON-NLS-1$
+ Long.valueOf(timeout), commandText));
}
}
}
- synchronized( TimerThread.this ) {
- wait( timeout );
+ synchronized (TimerThread.this) {
+ wait(timeout);
}
}
- }
- catch( InterruptedException e ) {
+ } catch (InterruptedException e) {
}
}
private void shutdown() {
- setTimerThreadState( TimerThreadState.SHUTDOWN );
+ setTimerThreadState(TimerThreadState.SHUTDOWN);
}
-
- private synchronized void setWaitTimout( int waitTimeout ) {
+
+ private synchronized void setWaitTimout(int waitTimeout) {
fWaitTimeout = waitTimeout;
- if ( GdbDebugOptions.DEBUG_COMMAND_TIMEOUTS )
- printDebugMessage( String.format( "Wait timeout is set to %d", Integer.valueOf( fWaitTimeout ) ) ); //$NON-NLS-1$
+ if (GdbDebugOptions.DEBUG_COMMAND_TIMEOUTS)
+ printDebugMessage(String.format("Wait timeout is set to %d", Integer.valueOf(fWaitTimeout))); //$NON-NLS-1$
}
-
+
private synchronized int getWaitTimeout() {
return fWaitTimeout;
}
-
- private synchronized void setTimerThreadState( TimerThreadState state ) {
+
+ private synchronized void setTimerThreadState(TimerThreadState state) {
fState = state;
interrupt();
}
-
+
private synchronized TimerThreadState getTimerThreadState() {
return fState;
}
@@ -232,46 +226,39 @@ public class GdbCommandTimeoutManager implements ICommandListener, IPreferenceCh
private CustomTimeoutsMap fCustomTimeouts = new CustomTimeoutsMap();
private ListenerList fListeners;
-
- public GdbCommandTimeoutManager( ICommandControl commandControl ) {
+
+ public GdbCommandTimeoutManager(ICommandControl commandControl) {
fCommandControl = commandControl;
fListeners = new ListenerList();
}
public void initialize() {
- IEclipsePreferences node = InstanceScope.INSTANCE.getNode( GdbPlugin.PLUGIN_ID );
-
- fTimeoutEnabled = Platform.getPreferencesService().getBoolean(
- GdbPlugin.PLUGIN_ID,
- IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT,
- false,
- null );
-
- fTimeout = Platform.getPreferencesService().getInt(
- GdbPlugin.PLUGIN_ID,
- IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT_VALUE,
- IGdbDebugPreferenceConstants.COMMAND_TIMEOUT_VALUE_DEFAULT,
- null );
-
- fCustomTimeouts.initializeFromMemento( Platform.getPreferencesService().getString(
- GdbPlugin.PLUGIN_ID,
- IGdbDebugPreferenceConstants.PREF_COMMAND_CUSTOM_TIMEOUTS,
- "", //$NON-NLS-1$
- null ) );
-
- node.addPreferenceChangeListener( this );
-
- fCommandControl.addCommandListener( this );
-
- fTimerThread = new TimerThread( fCommandQueue, calculateWaitTimeout() );
+ IEclipsePreferences node = InstanceScope.INSTANCE.getNode(GdbPlugin.PLUGIN_ID);
+
+ fTimeoutEnabled = Platform.getPreferencesService().getBoolean(GdbPlugin.PLUGIN_ID,
+ IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT, false, null);
+
+ fTimeout = Platform.getPreferencesService().getInt(GdbPlugin.PLUGIN_ID,
+ IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT_VALUE,
+ IGdbDebugPreferenceConstants.COMMAND_TIMEOUT_VALUE_DEFAULT, null);
+
+ fCustomTimeouts.initializeFromMemento(Platform.getPreferencesService().getString(GdbPlugin.PLUGIN_ID,
+ IGdbDebugPreferenceConstants.PREF_COMMAND_CUSTOM_TIMEOUTS, "", //$NON-NLS-1$
+ null));
+
+ node.addPreferenceChangeListener(this);
+
+ fCommandControl.addCommandListener(this);
+
+ fTimerThread = new TimerThread(fCommandQueue, calculateWaitTimeout());
fTimerThread.start();
}
public void dispose() {
fTimerThread.shutdown();
fListeners.clear();
- InstanceScope.INSTANCE.getNode( GdbPlugin.PLUGIN_ID ).removePreferenceChangeListener( this );
- fCommandControl.removeCommandListener( this );
+ InstanceScope.INSTANCE.getNode(GdbPlugin.PLUGIN_ID).removePreferenceChangeListener(this);
+ fCommandControl.removeCommandListener(this);
fCommandQueue.clear();
fCustomTimeouts.clear();
}
@@ -280,30 +267,30 @@ public class GdbCommandTimeoutManager implements ICommandListener, IPreferenceCh
* @see org.eclipse.cdt.dsf.debug.service.command.ICommandListener#commandQueued(org.eclipse.cdt.dsf.debug.service.command.ICommandToken)
*/
@Override
- public void commandQueued( ICommandToken token ) {
+ public void commandQueued(ICommandToken token) {
}
/* (non-Javadoc)
* @see org.eclipse.cdt.dsf.debug.service.command.ICommandListener#commandSent(org.eclipse.cdt.dsf.debug.service.command.ICommandToken)
*/
@Override
- public void commandSent( ICommandToken token ) {
- if ( !isTimeoutEnabled() )
+ public void commandSent(ICommandToken token) {
+ if (!isTimeoutEnabled())
return;
- int commandTimeout = getTimeoutForCommand( token.getCommand() );
- if ( GdbDebugOptions.DEBUG_COMMAND_TIMEOUTS ) {
+ int commandTimeout = getTimeoutForCommand(token.getCommand());
+ if (GdbDebugOptions.DEBUG_COMMAND_TIMEOUTS) {
String commandText = token.getCommand().toString();
- if ( commandText.endsWith( "\n" ) ) //$NON-NLS-1$
- commandText = commandText.substring( 0, commandText.length() - 1 );
- printDebugMessage( String.format( "Command '%s' sent, timeout = %d", commandText, Integer.valueOf( commandTimeout ) ) ); //$NON-NLS-1$
+ if (commandText.endsWith("\n")) //$NON-NLS-1$
+ commandText = commandText.substring(0, commandText.length() - 1);
+ printDebugMessage(
+ String.format("Command '%s' sent, timeout = %d", commandText, Integer.valueOf(commandTimeout))); //$NON-NLS-1$
}
- if ( commandTimeout == 0 )
- // Skip commands with no timeout
+ if (commandTimeout == 0)
+ // Skip commands with no timeout
return;
try {
- fCommandQueue.put( new QueueEntry( System.currentTimeMillis(), token ) );
- }
- catch( InterruptedException e ) {
+ fCommandQueue.put(new QueueEntry(System.currentTimeMillis(), token));
+ } catch (InterruptedException e) {
// ignore
}
}
@@ -312,30 +299,30 @@ public class GdbCommandTimeoutManager implements ICommandListener, IPreferenceCh
* @see org.eclipse.cdt.dsf.debug.service.command.ICommandListener#commandRemoved(org.eclipse.cdt.dsf.debug.service.command.ICommandToken)
*/
@Override
- public void commandRemoved( ICommandToken token ) {
+ public void commandRemoved(ICommandToken token) {
}
/* (non-Javadoc)
* @see org.eclipse.cdt.dsf.debug.service.command.ICommandListener#commandDone(org.eclipse.cdt.dsf.debug.service.command.ICommandToken, org.eclipse.cdt.dsf.debug.service.command.ICommandResult)
*/
@Override
- public void commandDone( ICommandToken token, ICommandResult result ) {
- if ( !isTimeoutEnabled() )
+ public void commandDone(ICommandToken token, ICommandResult result) {
+ if (!isTimeoutEnabled())
return;
- fCommandQueue.remove( new QueueEntry( 0, token ) );
- if ( GdbDebugOptions.DEBUG_COMMAND_TIMEOUTS ) {
+ fCommandQueue.remove(new QueueEntry(0, token));
+ if (GdbDebugOptions.DEBUG_COMMAND_TIMEOUTS) {
String commandText = token.getCommand().toString();
- if ( commandText.endsWith( "\n" ) ) //$NON-NLS-1$
- commandText = commandText.substring( 0, commandText.length() - 1 );
- printDebugMessage( String.format( "Command '%s' is done", commandText ) ); //$NON-NLS-1$
+ if (commandText.endsWith("\n")) //$NON-NLS-1$
+ commandText = commandText.substring(0, commandText.length() - 1);
+ printDebugMessage(String.format("Command '%s' is done", commandText)); //$NON-NLS-1$
}
- // Reset the timestamp of the next command in the queue because
- // regardless how long it has been in the queue GDB will start
- // executing it only when the execution of the previous command
+ // Reset the timestamp of the next command in the queue because
+ // regardless how long it has been in the queue GDB will start
+ // executing it only when the execution of the previous command
// is completed.
QueueEntry nextEntry = fCommandQueue.peek();
- if ( nextEntry != null ) {
- setTimeStamp( System.currentTimeMillis(), nextEntry );
+ if (nextEntry != null) {
+ setTimeStamp(System.currentTimeMillis(), nextEntry);
}
}
@@ -343,116 +330,113 @@ public class GdbCommandTimeoutManager implements ICommandListener, IPreferenceCh
* @see org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener#preferenceChange(org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent)
*/
@Override
- public void preferenceChange( PreferenceChangeEvent event ) {
+ public void preferenceChange(PreferenceChangeEvent event) {
String property = event.getKey();
- if ( IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT.equals( property ) ) {
+ if (IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT.equals(property)) {
// The new value is null when the timeout support is disabled.
- if ( event.getNewValue() == null || !event.getNewValue().equals( event.getOldValue() ) ) {
- fTimeoutEnabled = ( event.getNewValue() != null ) ?
- Boolean.parseBoolean( event.getNewValue().toString() ) : Boolean.FALSE;
+ if (event.getNewValue() == null || !event.getNewValue().equals(event.getOldValue())) {
+ fTimeoutEnabled = (event.getNewValue() != null) ? Boolean.parseBoolean(event.getNewValue().toString())
+ : Boolean.FALSE;
updateWaitTimeout();
- fTimerThread.setTimerThreadState( ( fTimerThread.getWaitTimeout() > 0 ) ?
- TimerThreadState.RUNNING : TimerThreadState.HALTED );
+ fTimerThread.setTimerThreadState(
+ (fTimerThread.getWaitTimeout() > 0) ? TimerThreadState.RUNNING : TimerThreadState.HALTED);
}
- }
- else if ( IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT_VALUE.equals( property ) ) {
- if ( event.getNewValue() == null || !event.getNewValue().equals( event.getOldValue() ) ) {
+ } else if (IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT_VALUE.equals(property)) {
+ if (event.getNewValue() == null || !event.getNewValue().equals(event.getOldValue())) {
try {
- fTimeout = ( event.getNewValue() != null ) ?
- Integer.parseInt( event.getNewValue().toString() ) :
- IGdbDebugPreferenceConstants.COMMAND_TIMEOUT_VALUE_DEFAULT;
+ fTimeout = (event.getNewValue() != null) ? Integer.parseInt(event.getNewValue().toString())
+ : IGdbDebugPreferenceConstants.COMMAND_TIMEOUT_VALUE_DEFAULT;
updateWaitTimeout();
- fTimerThread.setTimerThreadState( ( fTimerThread.getWaitTimeout() > 0 ) ?
- TimerThreadState.RUNNING : TimerThreadState.HALTED );
- }
- catch( NumberFormatException e ) {
- GdbPlugin.getDefault().getLog().log( new Status( IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Invalid timeout value" ) ); //$NON-NLS-1$
+ fTimerThread.setTimerThreadState(
+ (fTimerThread.getWaitTimeout() > 0) ? TimerThreadState.RUNNING : TimerThreadState.HALTED);
+ } catch (NumberFormatException e) {
+ GdbPlugin.getDefault().getLog()
+ .log(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Invalid timeout value")); //$NON-NLS-1$
}
}
- }
- else if ( IGdbDebugPreferenceConstants.PREF_COMMAND_CUSTOM_TIMEOUTS.equals( property ) ) {
- if ( event.getNewValue() instanceof String ) {
- fCustomTimeouts.initializeFromMemento( (String)event.getNewValue() );
- }
- else if ( event.getNewValue() == null ) {
+ } else if (IGdbDebugPreferenceConstants.PREF_COMMAND_CUSTOM_TIMEOUTS.equals(property)) {
+ if (event.getNewValue() instanceof String) {
+ fCustomTimeouts.initializeFromMemento((String) event.getNewValue());
+ } else if (event.getNewValue() == null) {
fCustomTimeouts.clear();
}
updateWaitTimeout();
- fTimerThread.setTimerThreadState( ( fTimerThread.getWaitTimeout() > 0 ) ?
- TimerThreadState.RUNNING : TimerThreadState.HALTED );
+ fTimerThread.setTimerThreadState(
+ (fTimerThread.getWaitTimeout() > 0) ? TimerThreadState.RUNNING : TimerThreadState.HALTED);
}
}
- protected int getTimeoutForCommand( ICommand<? extends ICommandResult> command ) {
- if ( !(command instanceof MICommand<?>) )
+ protected int getTimeoutForCommand(ICommand<? extends ICommandResult> command) {
+ if (!(command instanceof MICommand<?>))
return 0;
- @SuppressWarnings( "unchecked" )
- Integer timeout = fCustomTimeouts.get( ((MICommand<? extends MIInfo>)command).getOperation() );
- return ( timeout != null ) ? timeout.intValue() : fTimeout;
+ @SuppressWarnings("unchecked")
+ Integer timeout = fCustomTimeouts.get(((MICommand<? extends MIInfo>) command).getOperation());
+ return (timeout != null) ? timeout.intValue() : fTimeout;
}
- protected void processTimedOutCommand( ICommandToken token ) {
- if ( GdbDebugOptions.DEBUG_COMMAND_TIMEOUTS ) {
+ protected void processTimedOutCommand(ICommandToken token) {
+ if (GdbDebugOptions.DEBUG_COMMAND_TIMEOUTS) {
String commandText = token.getCommand().toString();
- if ( commandText.endsWith( "\n" ) ) //$NON-NLS-1$
- commandText = commandText.substring( 0, commandText.length() - 1 );
- printDebugMessage( String.format( "Command '%s' is timed out", commandText ) ); //$NON-NLS-1$
+ if (commandText.endsWith("\n")) //$NON-NLS-1$
+ commandText = commandText.substring(0, commandText.length() - 1);
+ printDebugMessage(String.format("Command '%s' is timed out", commandText)); //$NON-NLS-1$
}
- for ( Object l : fListeners.getListeners() ) {
- ((ICommandTimeoutListener)l).commandTimedOut( token );
+ for (Object l : fListeners.getListeners()) {
+ ((ICommandTimeoutListener) l).commandTimedOut(token);
}
}
- public void addCommandTimeoutListener( ICommandTimeoutListener listener ) {
- fListeners.add( listener );
+ public void addCommandTimeoutListener(ICommandTimeoutListener listener) {
+ fListeners.add(listener);
}
- public void removeCommandTimeoutListener( ICommandTimeoutListener listener ) {
- fListeners.remove( listener );
+ public void removeCommandTimeoutListener(ICommandTimeoutListener listener) {
+ fListeners.remove(listener);
}
-
+
private void updateWaitTimeout() {
- fTimerThread.setWaitTimout( calculateWaitTimeout() );
+ fTimerThread.setWaitTimout(calculateWaitTimeout());
}
private boolean isTimeoutEnabled() {
return fTimeoutEnabled;
}
- private void printDebugMessage( String message ) {
- if(GdbDebugOptions.DEBUG_COMMAND_TIMEOUTS) {
- GdbDebugOptions.trace(String.format( "%s %s %s\n", GdbPlugin.getDebugTime(), TIMEOUT_TRACE_IDENTIFIER, message)); //$NON-NLS-1$
+ private void printDebugMessage(String message) {
+ if (GdbDebugOptions.DEBUG_COMMAND_TIMEOUTS) {
+ GdbDebugOptions
+ .trace(String.format("%s %s %s\n", GdbPlugin.getDebugTime(), TIMEOUT_TRACE_IDENTIFIER, message)); //$NON-NLS-1$
}
-
+
}
private int calculateWaitTimeout() {
int waitTimeout = 0;
- if ( isTimeoutEnabled() ) {
+ if (isTimeoutEnabled()) {
waitTimeout = fTimeout;
int minCustomTimeout = Integer.MAX_VALUE;
- for ( Integer t : fCustomTimeouts.values() ) {
- if ( t.intValue() > 0 ) {
- minCustomTimeout = Math.min( minCustomTimeout, t.intValue() );
+ for (Integer t : fCustomTimeouts.values()) {
+ if (t.intValue() > 0) {
+ minCustomTimeout = Math.min(minCustomTimeout, t.intValue());
}
}
- if ( minCustomTimeout > 0 ) {
- waitTimeout = ( waitTimeout == 0 ) ?
- minCustomTimeout : Math.min( waitTimeout, minCustomTimeout );
+ if (minCustomTimeout > 0) {
+ waitTimeout = (waitTimeout == 0) ? minCustomTimeout : Math.min(waitTimeout, minCustomTimeout);
}
}
return waitTimeout;
}
- private void setTimeStamp( long currentTime, QueueEntry nextEntry ) {
- if ( nextEntry != null ) {
+ private void setTimeStamp(long currentTime, QueueEntry nextEntry) {
+ if (nextEntry != null) {
nextEntry.fTimestamp = currentTime;
-
- if ( GdbDebugOptions.DEBUG_COMMAND_TIMEOUTS ) {
+
+ if (GdbDebugOptions.DEBUG_COMMAND_TIMEOUTS) {
String commandText = nextEntry.fCommandToken.getCommand().toString();
- if ( commandText.endsWith( "\n" ) ) //$NON-NLS-1$
- commandText = commandText.substring( 0, commandText.length() - 1 );
- printDebugMessage( String.format( "Setting the timestamp for command '%s' to %d", commandText, Long.valueOf( currentTime ) ) ); //$NON-NLS-1$
+ if (commandText.endsWith("\n")) //$NON-NLS-1$
+ commandText = commandText.substring(0, commandText.length() - 1);
+ printDebugMessage(String.format("Setting the timestamp for command '%s' to %d", commandText, //$NON-NLS-1$
+ Long.valueOf(currentTime)));
}
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/IGDBBackendProcessWithoutIO.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/IGDBBackendProcessWithoutIO.java
index 477b388c36c..a86194201b5 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/IGDBBackendProcessWithoutIO.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/IGDBBackendProcessWithoutIO.java
@@ -13,12 +13,12 @@ package org.eclipse.cdt.dsf.gdb.service.command;
/**
* Interface used by a process representing the GDB process but for which there
* is no IO.
- *
+ *
* When using the full GDB console, this marker can be used for the class that
* will represent the GDB process in the launch since the IO should not be
* handled by the launch and the console it normally created, but is handled by
* the full GDB console itself.
- *
+ *
* @since 5.2
*/
public interface IGDBBackendProcessWithoutIO {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/IGDBControl.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/IGDBControl.java
index 88c04ca4133..b13e31dd6fe 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/IGDBControl.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/IGDBControl.java
@@ -7,10 +7,10 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
- * Vladimir Prus (CodeSourcery) - Support for -data-read-memory-bytes (bug 322658)
+ * Vladimir Prus (CodeSourcery) - Support for -data-read-memory-bytes (bug 322658)
* Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121)
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.service.command;
@@ -33,13 +33,13 @@ public interface IGDBControl extends IMICommandControl {
* only one that is used to represent it.
* To get the real GDB process use
* {@link IGDBBackend#getProcess()}.
- *
+ *
* @since 5.2
*/
default Process getGDBBackendProcess() {
return getCLIProcess();
};
-
+
/**
* @deprecated The return value of this method was too
* restrictive. It has been replaced with
@@ -55,69 +55,69 @@ public interface IGDBControl extends IMICommandControl {
/**
* Request to terminate GDB.
- *
+ *
* @param rm The requestMonitor indicating that GDB has been terminated.
*/
void terminate(RequestMonitor rm);
-
+
/**
* This method should be called once and only once, during the launch,
* to complete the initialization. It will perform the final steps
* to configure GDB for the type of debugging session chosen by the
* user.
- *
- * @param rm The requestMonitor indicating that the final steps if
+ *
+ * @param rm The requestMonitor indicating that the final steps if
* initialization are completed.
- *
+ *
* @since 4.0
*/
void completeInitialization(RequestMonitor rm);
-
+
/**
* @since 2.0
*/
void setTracingStream(OutputStream tracingStream);
-
- /**
+
+ /**
* Sets any user-defined environment variables for the inferior.
- *
+ *
* If the 'clear' flag is true, all existing environment variables
- * will be removed and replaced with the new specified ones.
+ * will be removed and replaced with the new specified ones.
* If 'clear' is false, the new variables are added to the existing
* environment.
- *
- * @since 3.0
+ *
+ * @since 3.0
*/
void setEnvironment(Properties props, boolean clear, RequestMonitor requestMonitor);
-
+
/**
* Returns a list of all the target-independent MI features
* supported by the GDB that is being used. Consult the GDB MI documentation
* for the MI -list-features command for the possible names of features.
- *
- * The return value is never null but may be an empty list.
- *
+ *
+ * The return value is never null but may be an empty list.
+ *
* @since 4.0
*/
List<String> getFeatures();
-
+
/**
* Enable the pretty printers also for MI variable objects. This basically
* sends -enable-pretty-printing.
- *
+ *
* @param rm
- *
+ *
* @since 4.0
*/
void enablePrettyPrintingForMIVariableObjects(RequestMonitor rm);
/**
* Turns the printing of python errors on or off.
- *
+ *
* @param enabled
* If <code>true</code>, printing errors is turned on.
* @param rm
- *
+ *
* @since 4.0
*/
void setPrintPythonErrors(boolean enabled, RequestMonitor rm);
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBBackend_HEAD.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBBackend_HEAD.java
index 929ebe007b7..56c15f7b1d7 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBBackend_HEAD.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBBackend_HEAD.java
@@ -18,26 +18,26 @@ import org.eclipse.debug.core.ILaunchConfiguration;
/**
* Top-level class in the version hierarchy of implementations of {@link IMIBackend}.
- * <br>
+ * <br>
* Extenders should subclass this class for their special needs, which will allow
* them to always extend the most recent version of the service.
* For example, if GDB<Service>_7_9 is added, this GDB<Service>_HEAD class
* will be changed to extend it instead of the previous version, therefore
* automatically allowing extenders to be extending the new class.
- *
+ *
* NOTE: Older versions of GDB that were already using an extending class,
* will automatically start using the new service version, which may
* not be desirable. Extenders should update how they extend
* GdbDebugServicesFactory to properly choose the version of the
* service that should be used for older GDBs.
- *
+ *
* On the contrary, not using GDB<Service>_HEAD requires the
* extender to update how they extend GdbDebugServicesFactory
* whenever a new GDB<Service> version is added.
- *
+ *
* Extenders that prefer to focus on the latest GDB version are
* encouraged to extend GDB<Service>_HEAD.
- *
+ *
* @since 4.8
*/
public class GDBBackend_HEAD extends GDBBackend_7_12 {
@@ -45,9 +45,11 @@ public class GDBBackend_HEAD extends GDBBackend_7_12 {
super(session, lc);
validateGdbVersion(session);
}
-
- protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_12_VERSION; }
-
+
+ protected String getMinGDBVersionSupported() {
+ return GdbDebugServicesFactory.GDB_7_12_VERSION;
+ }
+
protected void validateGdbVersion(DsfSession session) {
GdbDebugServicesFactory.validateGdbVersion(session, getMinGDBVersionSupported(), this);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBBreakpointsManager_HEAD.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBBreakpointsManager_HEAD.java
index b4d28c24d80..c55dc189bc0 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBBreakpointsManager_HEAD.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBBreakpointsManager_HEAD.java
@@ -17,37 +17,39 @@ import org.eclipse.cdt.dsf.service.DsfSession;
/**
* Top-level class in the version hierarchy of implementations of {@link MIBreakpointsManager}.
- * <br>
+ * <br>
* Extenders should subclass this class for their special needs, which will allow
* them to always extend the most recent version of the service.
* For example, if GDB<Service>_7_9 is added, this GDB<Service>_HEAD class
* will be changed to extend it instead of the previous version, therefore
* automatically allowing extenders to be extending the new class.
- *
+ *
* NOTE: Older versions of GDB that were already using an extending class,
* will automatically start using the new service version, which may
* not be desirable. Extenders should update how they extend
* GdbDebugServicesFactory to properly choose the version of the
* service that should be used for older GDBs.
- *
+ *
* On the contrary, not using GDB<Service>_HEAD requires the
* extender to update how they extend GdbDebugServicesFactory
* whenever a new GDB<Service> version is added.
- *
+ *
* Extenders that prefer to focus on the latest GDB version are
* encouraged to extend GDB<Service>_HEAD.
- *
+ *
* @since 4.8
*/
public class GDBBreakpointsManager_HEAD extends GDBBreakpointsManager_7_2 {
public GDBBreakpointsManager_HEAD(DsfSession session, String debugModelId) {
super(session, debugModelId);
-
+
validateGdbVersion(session);
}
-
- protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_2_VERSION; }
-
+
+ protected String getMinGDBVersionSupported() {
+ return GdbDebugServicesFactory.GDB_7_2_VERSION;
+ }
+
protected void validateGdbVersion(DsfSession session) {
GdbDebugServicesFactory.validateGdbVersion(session, getMinGDBVersionSupported(), this);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBBreakpointsSynchronizer_HEAD.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBBreakpointsSynchronizer_HEAD.java
index db683ec6a14..1fce701d52f 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBBreakpointsSynchronizer_HEAD.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBBreakpointsSynchronizer_HEAD.java
@@ -16,37 +16,39 @@ import org.eclipse.cdt.dsf.service.DsfSession;
/**
* Top-level class in the version hierarchy of implementations of {@link MIBreakpointsSynchronizer}.
- * <br>
+ * <br>
* Extenders should subclass this class for their special needs, which will allow
* them to always extend the most recent version of the service.
* For example, if GDB<Service>_7_9 is added, this GDB<Service>_HEAD class
* will be changed to extend it instead of the previous version, therefore
* automatically allowing extenders to be extending the new class.
- *
+ *
* NOTE: Older versions of GDB that were already using an extending class,
* will automatically start using the new service version, which may
* not be desirable. Extenders should update how they extend
* GdbDebugServicesFactory to properly choose the version of the
* service that should be used for older GDBs.
- *
+ *
* On the contrary, not using GDB<Service>_HEAD requires the
* extender to update how they extend GdbDebugServicesFactory
* whenever a new GDB<Service> version is added.
- *
+ *
* Extenders that prefer to focus on the latest GDB version are
* encouraged to extend GDB<Service>_HEAD.
- *
+ *
* @since 4.8
*/
public class GDBBreakpointsSynchronizer_HEAD extends MIBreakpointsSynchronizer {
public GDBBreakpointsSynchronizer_HEAD(DsfSession session) {
super(session);
-
+
validateGdbVersion(session);
}
-
- protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_1_VERSION; }
-
+
+ protected String getMinGDBVersionSupported() {
+ return GdbDebugServicesFactory.GDB_7_1_VERSION;
+ }
+
protected void validateGdbVersion(DsfSession session) {
GdbDebugServicesFactory.validateGdbVersion(session, getMinGDBVersionSupported(), this);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBBreakpoints_HEAD.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBBreakpoints_HEAD.java
index a6289e134b0..aa404f13ab7 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBBreakpoints_HEAD.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBBreakpoints_HEAD.java
@@ -17,37 +17,39 @@ import org.eclipse.cdt.dsf.service.DsfSession;
/**
* Top-level class in the version hierarchy of implementations of {@link IBreakpoints}.
- * <br>
+ * <br>
* Extenders should subclass this class for their special needs, which will allow
* them to always extend the most recent version of the service.
* For example, if GDB<Service>_7_9 is added, this GDB<Service>_HEAD class
* will be changed to extend it instead of the previous version, therefore
* automatically allowing extenders to be extending the new class.
- *
+ *
* NOTE: Older versions of GDB that were already using an extending class,
* will automatically start using the new service version, which may
* not be desirable. Extenders should update how they extend
* GdbDebugServicesFactory to properly choose the version of the
* service that should be used for older GDBs.
- *
+ *
* On the contrary, not using GDB<Service>_HEAD requires the
* extender to update how they extend GdbDebugServicesFactory
* whenever a new GDB<Service> version is added.
- *
+ *
* Extenders that prefer to focus on the latest GDB version are
* encouraged to extend GDB<Service>_HEAD.
- *
+ *
* @since 4.8
*/
public class GDBBreakpoints_HEAD extends GDBBreakpoints_7_7 {
public GDBBreakpoints_HEAD(DsfSession session) {
super(session);
-
+
validateGdbVersion(session);
}
-
- protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_7_VERSION; }
-
+
+ protected String getMinGDBVersionSupported() {
+ return GdbDebugServicesFactory.GDB_7_7_VERSION;
+ }
+
protected void validateGdbVersion(DsfSession session) {
GdbDebugServicesFactory.validateGdbVersion(session, getMinGDBVersionSupported(), this);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBControl_HEAD.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBControl_HEAD.java
index f9d7ab5539a..067b59d37de 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBControl_HEAD.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBControl_HEAD.java
@@ -19,37 +19,39 @@ import org.eclipse.debug.core.ILaunchConfiguration;
/**
* Top-level class in the version hierarchy of implementations of {@link ICommandControlService}.
- * <br>
+ * <br>
* Extenders should subclass this class for their special needs, which will allow
* them to always extend the most recent version of the service.
* For example, if GDB<Service>_7_9 is added, this GDB<Service>_HEAD class
* will be changed to extend it instead of the previous version, therefore
* automatically allowing extenders to be extending the new class.
- *
+ *
* NOTE: Older versions of GDB that were already using an extending class,
* will automatically start using the new service version, which may
* not be desirable. Extenders should update how they extend
* GdbDebugServicesFactory to properly choose the version of the
* service that should be used for older GDBs.
- *
+ *
* On the contrary, not using GDB<Service>_HEAD requires the
* extender to update how they extend GdbDebugServicesFactory
* whenever a new GDB<Service> version is added.
- *
+ *
* Extenders that prefer to focus on the latest GDB version are
* encouraged to extend GDB<Service>_HEAD.
- *
+ *
* @since 4.8
*/
public class GDBControl_HEAD extends GDBControl_7_12 {
public GDBControl_HEAD(DsfSession session, ILaunchConfiguration lc, CommandFactory factory) {
super(session, lc, factory);
-
+
validateGdbVersion(session);
}
-
- protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_12_VERSION; }
-
+
+ protected String getMinGDBVersionSupported() {
+ return GdbDebugServicesFactory.GDB_7_12_VERSION;
+ }
+
protected void validateGdbVersion(DsfSession session) {
GdbDebugServicesFactory.validateGdbVersion(session, getMinGDBVersionSupported(), this);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBDisassembly_HEAD.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBDisassembly_HEAD.java
index c744843eae6..8378442d87b 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBDisassembly_HEAD.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBDisassembly_HEAD.java
@@ -17,37 +17,39 @@ import org.eclipse.cdt.dsf.service.DsfSession;
/**
* Top-level class in the version hierarchy of implementations of {@link IDisassembly}.
- * <br>
+ * <br>
* Extenders should subclass this class for their special needs, which will allow
* them to always extend the most recent version of the service.
* For example, if GDB<Service>_7_9 is added, this GDB<Service>_HEAD class
* will be changed to extend it instead of the previous version, therefore
* automatically allowing extenders to be extending the new class.
- *
+ *
* NOTE: Older versions of GDB that were already using an extending class,
* will automatically start using the new service version, which may
* not be desirable. Extenders should update how they extend
* GdbDebugServicesFactory to properly choose the version of the
* service that should be used for older GDBs.
- *
+ *
* On the contrary, not using GDB<Service>_HEAD requires the
* extender to update how they extend GdbDebugServicesFactory
* whenever a new GDB<Service> version is added.
- *
+ *
* Extenders that prefer to focus on the latest GDB version are
* encouraged to extend GDB<Service>_HEAD.
- *
+ *
* @since 4.8
*/
public class GDBDisassembly_HEAD extends GDBDisassembly_7_3 {
public GDBDisassembly_HEAD(DsfSession session) {
super(session);
-
+
validateGdbVersion(session);
}
-
- protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_3_VERSION; }
-
+
+ protected String getMinGDBVersionSupported() {
+ return GdbDebugServicesFactory.GDB_7_3_VERSION;
+ }
+
protected void validateGdbVersion(DsfSession session) {
GdbDebugServicesFactory.validateGdbVersion(session, getMinGDBVersionSupported(), this);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBExpressions_HEAD.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBExpressions_HEAD.java
index 4337a74603d..87670515da5 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBExpressions_HEAD.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBExpressions_HEAD.java
@@ -17,37 +17,39 @@ import org.eclipse.cdt.dsf.service.DsfSession;
/**
* Top-level class in the version hierarchy of implementations of {@link IExpressions}.
- * <br>
+ * <br>
* Extenders should subclass this class for their special needs, which will allow
* them to always extend the most recent version of the service.
* For example, if GDB<Service>_7_9 is added, this GDB<Service>_HEAD class
* will be changed to extend it instead of the previous version, therefore
* automatically allowing extenders to be extending the new class.
- *
+ *
* NOTE: Older versions of GDB that were already using an extending class,
* will automatically start using the new service version, which may
* not be desirable. Extenders should update how they extend
* GdbDebugServicesFactory to properly choose the version of the
* service that should be used for older GDBs.
- *
+ *
* On the contrary, not using GDB<Service>_HEAD requires the
* extender to update how they extend GdbDebugServicesFactory
* whenever a new GDB<Service> version is added.
- *
+ *
* Extenders that prefer to focus on the latest GDB version are
* encouraged to extend GDB<Service>_HEAD.
- *
+ *
* @since 4.8
*/
public class GDBExpressions_HEAD extends MIExpressions {
public GDBExpressions_HEAD(DsfSession session) {
super(session);
-
+
validateGdbVersion(session);
}
-
- protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_1_VERSION; }
-
+
+ protected String getMinGDBVersionSupported() {
+ return GdbDebugServicesFactory.GDB_7_1_VERSION;
+ }
+
protected void validateGdbVersion(DsfSession session) {
GdbDebugServicesFactory.validateGdbVersion(session, getMinGDBVersionSupported(), this);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBHardwareAndOS_HEAD.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBHardwareAndOS_HEAD.java
index 7be9739ca0e..5de999521ff 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBHardwareAndOS_HEAD.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBHardwareAndOS_HEAD.java
@@ -17,37 +17,39 @@ import org.eclipse.cdt.dsf.service.DsfSession;
/**
* Top-level class in the version hierarchy of implementations of {@link IGDBHardwareAndOS}.
- * <br>
+ * <br>
* Extenders should subclass this class for their special needs, which will allow
* them to always extend the most recent version of the service.
* For example, if GDB<Service>_7_9 is added, this GDB<Service>_HEAD class
* will be changed to extend it instead of the previous version, therefore
* automatically allowing extenders to be extending the new class.
- *
+ *
* NOTE: Older versions of GDB that were already using an extending class,
* will automatically start using the new service version, which may
* not be desirable. Extenders should update how they extend
* GdbDebugServicesFactory to properly choose the version of the
* service that should be used for older GDBs.
- *
+ *
* On the contrary, not using GDB<Service>_HEAD requires the
* extender to update how they extend GdbDebugServicesFactory
* whenever a new GDB<Service> version is added.
- *
+ *
* Extenders that prefer to focus on the latest GDB version are
* encouraged to extend GDB<Service>_HEAD.
- *
+ *
* @since 4.8
*/
public class GDBHardwareAndOS_HEAD extends GDBHardwareAndOS_7_10 {
public GDBHardwareAndOS_HEAD(DsfSession session) {
super(session);
-
+
validateGdbVersion(session);
}
-
- protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_10_VERSION; }
-
+
+ protected String getMinGDBVersionSupported() {
+ return GdbDebugServicesFactory.GDB_7_10_VERSION;
+ }
+
protected void validateGdbVersion(DsfSession session) {
GdbDebugServicesFactory.validateGdbVersion(session, getMinGDBVersionSupported(), this);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBMemory_HEAD.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBMemory_HEAD.java
index a0b5dc94b57..b0b40fc09b5 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBMemory_HEAD.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBMemory_HEAD.java
@@ -17,36 +17,38 @@ import org.eclipse.cdt.dsf.service.DsfSession;
/**
* Top-level class in the version hierarchy of implementations of {@link IMemory}.
- * <br>
+ * <br>
* Extenders should subclass this class for their special needs, which will allow
* them to always extend the most recent version of the service.
* For example, if GDB<Service>_7_9 is added, this GDB<Service>_HEAD class
* will be changed to extend it instead of the previous version, therefore
* automatically allowing extenders to be extending the new class.
- *
+ *
* NOTE: Older versions of GDB that were already using an extending class,
* will automatically start using the new service version, which may
* not be desirable. Extenders should update how they extend
* GdbDebugServicesFactory to properly choose the version of the
* service that should be used for older GDBs.
- *
+ *
* On the contrary, not using GDB<Service>_HEAD requires the
* extender to update how they extend GdbDebugServicesFactory
* whenever a new GDB<Service> version is added.
- *
+ *
* Extenders that prefer to focus on the latest GDB version are
* encouraged to extend GDB<Service>_HEAD.
- *
+ *
* @since 4.8
*/
public class GDBMemory_HEAD extends GDBMemory_7_6 {
public GDBMemory_HEAD(DsfSession session) {
super(session);
-
+
validateGdbVersion(session);
}
-
- protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_6_VERSION; }
+
+ protected String getMinGDBVersionSupported() {
+ return GdbDebugServicesFactory.GDB_7_6_VERSION;
+ }
protected void validateGdbVersion(DsfSession session) {
GdbDebugServicesFactory.validateGdbVersion(session, getMinGDBVersionSupported(), this);
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBModules_HEAD.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBModules_HEAD.java
index d5b6295cda6..6d503a37970 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBModules_HEAD.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBModules_HEAD.java
@@ -17,37 +17,39 @@ import org.eclipse.cdt.dsf.service.DsfSession;
/**
* Top-level class in the version hierarchy of implementations of {@link IModules}.
- * <br>
+ * <br>
* Extenders should subclass this class for their special needs, which will allow
* them to always extend the most recent version of the service.
* For example, if GDB<Service>_7_9 is added, this GDB<Service>_HEAD class
* will be changed to extend it instead of the previous version, therefore
* automatically allowing extenders to be extending the new class.
- *
+ *
* NOTE: Older versions of GDB that were already using an extending class,
* will automatically start using the new service version, which may
* not be desirable. Extenders should update how they extend
* GdbDebugServicesFactory to properly choose the version of the
* service that should be used for older GDBs.
- *
+ *
* On the contrary, not using GDB<Service>_HEAD requires the
* extender to update how they extend GdbDebugServicesFactory
* whenever a new GDB<Service> version is added.
- *
+ *
* Extenders that prefer to focus on the latest GDB version are
* encouraged to extend GDB<Service>_HEAD.
- *
+ *
* @since 4.8
*/
public class GDBModules_HEAD extends MIModules {
public GDBModules_HEAD(DsfSession session) {
super(session);
-
+
validateGdbVersion(session);
}
-
- protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_1_VERSION; }
-
+
+ protected String getMinGDBVersionSupported() {
+ return GdbDebugServicesFactory.GDB_7_1_VERSION;
+ }
+
protected void validateGdbVersion(DsfSession session) {
GdbDebugServicesFactory.validateGdbVersion(session, getMinGDBVersionSupported(), this);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBProcesses_HEAD.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBProcesses_HEAD.java
index bd8ce3617cd..1cd083514fd 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBProcesses_HEAD.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBProcesses_HEAD.java
@@ -17,37 +17,39 @@ import org.eclipse.cdt.dsf.service.DsfSession;
/**
* Top-level class in the version hierarchy of implementations of {@link IProcesses}.
- * <br>
+ * <br>
* Extenders should subclass this class for their special needs, which will allow
* them to always extend the most recent version of the service.
* For example, if GDB<Service>_7_9 is added, this GDB<Service>_HEAD class
* will be changed to extend it instead of the previous version, therefore
* automatically allowing extenders to be extending the new class.
- *
+ *
* NOTE: Older versions of GDB that were already using an extending class,
* will automatically start using the new service version, which may
* not be desirable. Extenders should update how they extend
* GdbDebugServicesFactory to properly choose the version of the
* service that should be used for older GDBs.
- *
+ *
* On the contrary, not using GDB<Service>_HEAD requires the
* extender to update how they extend GdbDebugServicesFactory
* whenever a new GDB<Service> version is added.
- *
+ *
* Extenders that prefer to focus on the latest GDB version are
* encouraged to extend GDB<Service>_HEAD.
- *
+ *
* @since 4.8
*/
public class GDBProcesses_HEAD extends GDBProcesses_7_12 {
public GDBProcesses_HEAD(DsfSession session) {
super(session);
-
+
validateGdbVersion(session);
}
-
- protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_12_VERSION; }
-
+
+ protected String getMinGDBVersionSupported() {
+ return GdbDebugServicesFactory.GDB_7_12_VERSION;
+ }
+
protected void validateGdbVersion(DsfSession session) {
GdbDebugServicesFactory.validateGdbVersion(session, getMinGDBVersionSupported(), this);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBRegisters_HEAD.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBRegisters_HEAD.java
index b756d482902..e879f014b22 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBRegisters_HEAD.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBRegisters_HEAD.java
@@ -17,37 +17,39 @@ import org.eclipse.cdt.dsf.service.DsfSession;
/**
* Top-level class in the version hierarchy of implementations of {@link IRegisters}.
- * <br>
+ * <br>
* Extenders should subclass this class for their special needs, which will allow
* them to always extend the most recent version of the service.
* For example, if GDB<Service>_7_9 is added, this GDB<Service>_HEAD class
* will be changed to extend it instead of the previous version, therefore
* automatically allowing extenders to be extending the new class.
- *
+ *
* NOTE: Older versions of GDB that were already using an extending class,
* will automatically start using the new service version, which may
* not be desirable. Extenders should update how they extend
* GdbDebugServicesFactory to properly choose the version of the
* service that should be used for older GDBs.
- *
+ *
* On the contrary, not using GDB<Service>_HEAD requires the
* extender to update how they extend GdbDebugServicesFactory
* whenever a new GDB<Service> version is added.
- *
+ *
* Extenders that prefer to focus on the latest GDB version are
* encouraged to extend GDB<Service>_HEAD.
- *
+ *
* @since 4.8
*/
public class GDBRegisters_HEAD extends GDBRegisters {
public GDBRegisters_HEAD(DsfSession session) {
super(session);
-
+
validateGdbVersion(session);
}
-
- protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_1_VERSION; }
-
+
+ protected String getMinGDBVersionSupported() {
+ return GdbDebugServicesFactory.GDB_7_1_VERSION;
+ }
+
protected void validateGdbVersion(DsfSession session) {
GdbDebugServicesFactory.validateGdbVersion(session, getMinGDBVersionSupported(), this);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBRunControl_HEAD.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBRunControl_HEAD.java
index 6028e16e016..dee4bdc86b9 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBRunControl_HEAD.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBRunControl_HEAD.java
@@ -18,37 +18,39 @@ import org.eclipse.cdt.dsf.service.DsfSession;
/**
* Top-level class in the version hierarchy of implementations of {@link IRunControl}
* in All-Stop.
- * <br>
+ * <br>
* Extenders should subclass this class for their special needs, which will allow
* them to always extend the most recent version of the service.
* For example, if GDB<Service>_7_9 is added, this GDB<Service>_HEAD class
* will be changed to extend it instead of the previous version, therefore
* automatically allowing extenders to be extending the new class.
- *
+ *
* NOTE: Older versions of GDB that were already using an extending class,
* will automatically start using the new service version, which may
* not be desirable. Extenders should update how they extend
* GdbDebugServicesFactory to properly choose the version of the
* service that should be used for older GDBs.
- *
+ *
* On the contrary, not using GDB<Service>_HEAD requires the
* extender to update how they extend GdbDebugServicesFactory
* whenever a new GDB<Service> version is added.
- *
+ *
* Extenders that prefer to focus on the latest GDB version are
* encouraged to extend GDB<Service>_HEAD.
- *
+ *
* @since 4.8
*/
public class GDBRunControl_HEAD extends GDBRunControl_7_12 {
public GDBRunControl_HEAD(DsfSession session) {
super(session);
-
+
validateGdbVersion(session);
}
-
- protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_12_VERSION; }
-
+
+ protected String getMinGDBVersionSupported() {
+ return GdbDebugServicesFactory.GDB_7_12_VERSION;
+ }
+
protected void validateGdbVersion(DsfSession session) {
GdbDebugServicesFactory.validateGdbVersion(session, getMinGDBVersionSupported(), this);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBRunControl_NS_HEAD.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBRunControl_NS_HEAD.java
index 3017627de2c..ee16d670012 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBRunControl_NS_HEAD.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBRunControl_NS_HEAD.java
@@ -18,37 +18,39 @@ import org.eclipse.cdt.dsf.service.DsfSession;
/**
* Top-level class in the version hierarchy of implementations of {@link IRunControl}
* in Non-Stop.
- * <br>
+ * <br>
* Extenders should subclass this class for their special needs, which will allow
* them to always extend the most recent version of the service.
* For example, if GDB<Service>_7_9 is added, this GDB<Service>_HEAD class
* will be changed to extend it instead of the previous version, therefore
* automatically allowing extenders to be extending the new class.
- *
+ *
* NOTE: Older versions of GDB that were already using an extending class,
* will automatically start using the new service version, which may
* not be desirable. Extenders should update how they extend
* GdbDebugServicesFactory to properly choose the version of the
* service that should be used for older GDBs.
- *
+ *
* On the contrary, not using GDB<Service>_HEAD requires the
* extender to update how they extend GdbDebugServicesFactory
* whenever a new GDB<Service> version is added.
- *
+ *
* Extenders that prefer to focus on the latest GDB version are
* encouraged to extend GDB<Service>_HEAD.
- *
+ *
* @since 4.8
*/
public class GDBRunControl_NS_HEAD extends GDBRunControl_7_2_NS {
public GDBRunControl_NS_HEAD(DsfSession session) {
super(session);
-
+
validateGdbVersion(session);
}
-
- protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_2_VERSION; }
-
+
+ protected String getMinGDBVersionSupported() {
+ return GdbDebugServicesFactory.GDB_7_2_VERSION;
+ }
+
protected void validateGdbVersion(DsfSession session) {
GdbDebugServicesFactory.validateGdbVersion(session, getMinGDBVersionSupported(), this);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBSourceLookup_HEAD.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBSourceLookup_HEAD.java
index b156e4f56b0..0814efde385 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBSourceLookup_HEAD.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBSourceLookup_HEAD.java
@@ -17,37 +17,39 @@ import org.eclipse.cdt.dsf.service.DsfSession;
/**
* Top-level class in the version hierarchy of implementations of {@link ISourceLookup}.
- * <br>
+ * <br>
* Extenders should subclass this class for their special needs, which will allow
* them to always extend the most recent version of the service.
* For example, if GDB<Service>_7_9 is added, this GDB<Service>_HEAD class
* will be changed to extend it instead of the previous version, therefore
* automatically allowing extenders to be extending the new class.
- *
+ *
* NOTE: Older versions of GDB that were already using an extending class,
* will automatically start using the new service version, which may
* not be desirable. Extenders should update how they extend
* GdbDebugServicesFactory to properly choose the version of the
* service that should be used for older GDBs.
- *
+ *
* On the contrary, not using GDB<Service>_HEAD requires the
* extender to update how they extend GdbDebugServicesFactory
* whenever a new GDB<Service> version is added.
- *
+ *
* Extenders that prefer to focus on the latest GDB version are
* encouraged to extend GDB<Service>_HEAD.
- *
+ *
* @since 4.8
*/
public class GDBSourceLookup_HEAD extends GDBSourceLookup {
public GDBSourceLookup_HEAD(DsfSession session) {
super(session);
-
+
validateGdbVersion(session);
}
-
- protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_1_VERSION; }
-
+
+ protected String getMinGDBVersionSupported() {
+ return GdbDebugServicesFactory.GDB_7_1_VERSION;
+ }
+
protected void validateGdbVersion(DsfSession session) {
GdbDebugServicesFactory.validateGdbVersion(session, getMinGDBVersionSupported(), this);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBStack_HEAD.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBStack_HEAD.java
index 8cbd0233d95..666f9a4790d 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBStack_HEAD.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBStack_HEAD.java
@@ -17,37 +17,39 @@ import org.eclipse.cdt.dsf.service.DsfSession;
/**
* Top-level class in the version hierarchy of implementations of {@link IStack}.
- * <br>
+ * <br>
* Extenders should subclass this class for their special needs, which will allow
* them to always extend the most recent version of the service.
* For example, if GDB<Service>_7_9 is added, this GDB<Service>_HEAD class
* will be changed to extend it instead of the previous version, therefore
* automatically allowing extenders to be extending the new class.
- *
+ *
* NOTE: Older versions of GDB that were already using an extending class,
* will automatically start using the new service version, which may
* not be desirable. Extenders should update how they extend
* GdbDebugServicesFactory to properly choose the version of the
* service that should be used for older GDBs.
- *
+ *
* On the contrary, not using GDB<Service>_HEAD requires the
* extender to update how they extend GdbDebugServicesFactory
* whenever a new GDB<Service> version is added.
- *
+ *
* Extenders that prefer to focus on the latest GDB version are
* encouraged to extend GDB<Service>_HEAD.
- *
+ *
* @since 4.8
*/
public class GDBStack_HEAD extends MIStack {
public GDBStack_HEAD(DsfSession session) {
super(session);
-
+
validateGdbVersion(session);
}
-
- protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_1_VERSION; }
-
+
+ protected String getMinGDBVersionSupported() {
+ return GdbDebugServicesFactory.GDB_7_1_VERSION;
+ }
+
protected void validateGdbVersion(DsfSession session) {
GdbDebugServicesFactory.validateGdbVersion(session, getMinGDBVersionSupported(), this);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBTraceControl_HEAD.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBTraceControl_HEAD.java
index 65b8fc3bf3c..0032d6e1ddb 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBTraceControl_HEAD.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/extensions/GDBTraceControl_HEAD.java
@@ -18,37 +18,39 @@ import org.eclipse.debug.core.ILaunchConfiguration;
/**
* Top-level class in the version hierarchy of implementations of {@link IGDBTraceControl}.
- * <br>
+ * <br>
* Extenders should subclass this class for their special needs, which will allow
* them to always extend the most recent version of the service.
* For example, if GDB<Service>_7_9 is added, this GDB<Service>_HEAD class
* will be changed to extend it instead of the previous version, therefore
* automatically allowing extenders to be extending the new class.
- *
+ *
* NOTE: Older versions of GDB that were already using an extending class,
* will automatically start using the new service version, which may
* not be desirable. Extenders should update how they extend
* GdbDebugServicesFactory to properly choose the version of the
* service that should be used for older GDBs.
- *
+ *
* On the contrary, not using GDB<Service>_HEAD requires the
* extender to update how they extend GdbDebugServicesFactory
* whenever a new GDB<Service> version is added.
- *
+ *
* Extenders that prefer to focus on the latest GDB version are
* encouraged to extend GDB<Service>_HEAD.
- *
+ *
* @since 4.8
*/
public class GDBTraceControl_HEAD extends GDBTraceControl_7_4 {
public GDBTraceControl_HEAD(DsfSession session, ILaunchConfiguration lc) {
super(session, lc);
-
+
validateGdbVersion(session);
}
-
- protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_4_VERSION; }
-
+
+ protected String getMinGDBVersionSupported() {
+ return GdbDebugServicesFactory.GDB_7_4_VERSION;
+ }
+
protected void validateGdbVersion(DsfSession session) {
GdbDebugServicesFactory.validateGdbVersion(session, getMinGDBVersionSupported(), this);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/CSourceLookup.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/CSourceLookup.java
index 41fdc0f4b76..169e5de5e14 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/CSourceLookup.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/CSourceLookup.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -52,33 +52,31 @@ import org.osgi.framework.BundleContext;
* ISourceLookup service implementation based on the CDT CSourceLookupDirector.
*/
public class CSourceLookup extends AbstractDsfService implements ISourceLookup {
- private Map<ISourceLookupDMContext, CSourceLookupDirector> fDirectors =
- new HashMap<ISourceLookupDMContext, CSourceLookupDirector>();
-
- ICommandControl fConnection;
- private CommandFactory fCommandFactory;
-
- public CSourceLookup(DsfSession session) {
- super(session);
- }
-
- @Override
- protected BundleContext getBundleContext() {
- return GdbPlugin.getBundleContext();
- }
-
- public void setSourceLookupDirector(ISourceLookupDMContext ctx, CSourceLookupDirector director) {
- fDirectors.put(ctx, director);
- }
-
- public void setSourceLookupPath(ISourceLookupDMContext ctx, ISourceContainer[] containers, RequestMonitor rm) {
- List<String> pathList = getSourceLookupPath(containers);
- String[] paths = pathList.toArray(new String[pathList.size()]);
-
- fConnection.queueCommand(
- fCommandFactory.createMIEnvironmentDirectory(ctx, paths, false),
- new DataRequestMonitor<MIInfo>(getExecutor(), rm));
- }
+ private Map<ISourceLookupDMContext, CSourceLookupDirector> fDirectors = new HashMap<ISourceLookupDMContext, CSourceLookupDirector>();
+
+ ICommandControl fConnection;
+ private CommandFactory fCommandFactory;
+
+ public CSourceLookup(DsfSession session) {
+ super(session);
+ }
+
+ @Override
+ protected BundleContext getBundleContext() {
+ return GdbPlugin.getBundleContext();
+ }
+
+ public void setSourceLookupDirector(ISourceLookupDMContext ctx, CSourceLookupDirector director) {
+ fDirectors.put(ctx, director);
+ }
+
+ public void setSourceLookupPath(ISourceLookupDMContext ctx, ISourceContainer[] containers, RequestMonitor rm) {
+ List<String> pathList = getSourceLookupPath(containers);
+ String[] paths = pathList.toArray(new String[pathList.size()]);
+
+ fConnection.queueCommand(fCommandFactory.createMIEnvironmentDirectory(ctx, paths, false),
+ new DataRequestMonitor<MIInfo>(getExecutor(), rm));
+ }
private List<String> getSourceLookupPath(ISourceContainer[] containers) {
ArrayList<String> list = new ArrayList<String>(containers.length);
@@ -117,100 +115,106 @@ public class CSourceLookup extends AbstractDsfService implements ISourceLookup {
}
if (container.isComposite()) {
try {
- list.addAll(getSourceLookupPath(container.getSourceContainers()));
+ list.addAll(getSourceLookupPath(container.getSourceContainers()));
} catch (CoreException e) {
}
}
}
-
+
return list;
}
- @Override
- public void initialize(final RequestMonitor requestMonitor) {
- super.initialize(
- new ImmediateRequestMonitor(requestMonitor) {
- @Override
- protected void handleSuccess() {
- doInitialize(requestMonitor);
- }
- });
- }
-
- private void doInitialize(final RequestMonitor requestMonitor) {
- fConnection = getServicesTracker().getService(ICommandControl.class);
- fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
- // Register this service
- register(new String[] { CSourceLookup.class.getName(), ISourceLookup.class.getName() }, new Hashtable<String, String>());
- requestMonitor.done();
- }
-
- @Override
- public void shutdown(final RequestMonitor requestMonitor) {
- unregister();
- super.shutdown(requestMonitor);
- }
+ @Override
+ public void initialize(final RequestMonitor requestMonitor) {
+ super.initialize(new ImmediateRequestMonitor(requestMonitor) {
+ @Override
+ protected void handleSuccess() {
+ doInitialize(requestMonitor);
+ }
+ });
+ }
+
+ private void doInitialize(final RequestMonitor requestMonitor) {
+ fConnection = getServicesTracker().getService(ICommandControl.class);
+ fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
+ // Register this service
+ register(new String[] { CSourceLookup.class.getName(), ISourceLookup.class.getName() },
+ new Hashtable<String, String>());
+ requestMonitor.done();
+ }
+
+ @Override
+ public void shutdown(final RequestMonitor requestMonitor) {
+ unregister();
+ super.shutdown(requestMonitor);
+ }
@Override
- public void getDebuggerPath(ISourceLookupDMContext sourceLookupCtx, Object source, final DataRequestMonitor<String> rm) {
- if (!(source instanceof String)) {
- // In future if needed other elements such as URIs could be supported.
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "Only string source element is supported", null)); //$NON-NLS-1$);
- rm.done();
- return;
- }
- final String sourceString = (String) source;
-
- if (!fDirectors.containsKey(sourceLookupCtx) ){
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_HANDLE, "No source director configured for given context", null)); //$NON-NLS-1$);
- rm.done();
- return;
- }
- final CSourceLookupDirector director = fDirectors.get(sourceLookupCtx);
-
- new Job("Lookup Debugger Path") { //$NON-NLS-1$
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- IPath debuggerPath = director.getCompilationPath(sourceString);
- if (debuggerPath != null) {
- rm.setData(debuggerPath.toString());
- } else {
- rm.setData(sourceString);
- }
- rm.done();
- return Status.OK_STATUS;
- }
- }.schedule();
- }
+ public void getDebuggerPath(ISourceLookupDMContext sourceLookupCtx, Object source,
+ final DataRequestMonitor<String> rm) {
+ if (!(source instanceof String)) {
+ // In future if needed other elements such as URIs could be supported.
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED,
+ "Only string source element is supported", null)); //$NON-NLS-1$);
+ rm.done();
+ return;
+ }
+ final String sourceString = (String) source;
+
+ if (!fDirectors.containsKey(sourceLookupCtx)) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_HANDLE,
+ "No source director configured for given context", null)); //$NON-NLS-1$);
+ rm.done();
+ return;
+ }
+ final CSourceLookupDirector director = fDirectors.get(sourceLookupCtx);
+
+ new Job("Lookup Debugger Path") { //$NON-NLS-1$
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ IPath debuggerPath = director.getCompilationPath(sourceString);
+ if (debuggerPath != null) {
+ rm.setData(debuggerPath.toString());
+ } else {
+ rm.setData(sourceString);
+ }
+ rm.done();
+ return Status.OK_STATUS;
+ }
+ }.schedule();
+ }
@Override
- public void getSource(ISourceLookupDMContext sourceLookupCtx, final String debuggerPath, final DataRequestMonitor<Object> rm) {
- if (!fDirectors.containsKey(sourceLookupCtx)) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
- IDsfStatusConstants.INVALID_HANDLE, "No source director configured for given context", null)); //$NON-NLS-1$);
- rm.done();
- return;
- }
- final CSourceLookupDirector director = fDirectors.get(sourceLookupCtx);
-
- new Job("Lookup Source") { //$NON-NLS-1$
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- Object[] sources;
- try {
- sources = director.findSourceElements(debuggerPath);
- if (sources == null || sources.length == 0) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.REQUEST_FAILED, "No sources found", null)); //$NON-NLS-1$);
- } else {
- rm.setData(sources[0]);
- }
- } catch (CoreException e) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.REQUEST_FAILED, "Source lookup failed", e)); //$NON-NLS-1$);
- } finally {
- rm.done();
- }
- return Status.OK_STATUS;
- }
- }.schedule();
- }
+ public void getSource(ISourceLookupDMContext sourceLookupCtx, final String debuggerPath,
+ final DataRequestMonitor<Object> rm) {
+ if (!fDirectors.containsKey(sourceLookupCtx)) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_HANDLE,
+ "No source director configured for given context", null)); //$NON-NLS-1$);
+ rm.done();
+ return;
+ }
+ final CSourceLookupDirector director = fDirectors.get(sourceLookupCtx);
+
+ new Job("Lookup Source") { //$NON-NLS-1$
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ Object[] sources;
+ try {
+ sources = director.findSourceElements(debuggerPath);
+ if (sources == null || sources.length == 0) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.REQUEST_FAILED,
+ "No sources found", null)); //$NON-NLS-1$);
+ } else {
+ rm.setData(sources[0]);
+ }
+ } catch (CoreException e) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.REQUEST_FAILED,
+ "Source lookup failed", e)); //$NON-NLS-1$);
+ } finally {
+ rm.done();
+ }
+ return Status.OK_STATUS;
+ }
+ }.schedule();
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIBackend.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIBackend.java
index c795fb926d3..69fb2dd21ef 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIBackend.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIBackend.java
@@ -7,10 +7,10 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
- * Nokia - create and use backend service.
+ * Nokia - create and use backend service.
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service;
@@ -26,69 +26,71 @@ import org.eclipse.cdt.dsf.service.IDsfService;
*/
public interface IMIBackend extends IDsfService {
- public enum State { NOT_INITIALIZED, STARTED, TERMINATED };
+ public enum State {
+ NOT_INITIALIZED, STARTED, TERMINATED
+ };
/**
* Event indicating that the back end process has started or terminated.
*/
- @Immutable
- public static class BackendStateChangedEvent {
- final private String fSessionId;
- final private String fBackendId;
- final private State fState;
-
- public BackendStateChangedEvent(String sessionId, String backendId, State state) {
- fSessionId = sessionId;
- fBackendId = backendId;
- fState = state;
- }
-
- public String getSessionId() {
- return fSessionId;
- }
-
- public String getBackendId() {
- return fBackendId;
- }
-
- public State getState() {
- return fState;
- }
- }
+ @Immutable
+ public static class BackendStateChangedEvent {
+ final private String fSessionId;
+ final private String fBackendId;
+ final private State fState;
+
+ public BackendStateChangedEvent(String sessionId, String backendId, State state) {
+ fSessionId = sessionId;
+ fBackendId = backendId;
+ fState = state;
+ }
+
+ public String getSessionId() {
+ return fSessionId;
+ }
+
+ public String getBackendId() {
+ return fBackendId;
+ }
+
+ public State getState() {
+ return fState;
+ }
+ }
- /**
- * Returns the identifier of this backend service. It can be used
- * to distinguish between multiple instances of this service in a
- * single session.
- */
- public String getId();
-
- /**
- * Requests that the backend be immediately terminated.
- */
- public void destroy();
+ /**
+ * Returns the identifier of this backend service. It can be used
+ * to distinguish between multiple instances of this service in a
+ * single session.
+ */
+ public String getId();
+
+ /**
+ * Requests that the backend be immediately terminated.
+ */
+ public void destroy();
- /**
- * Returns the current state of the backend.
- * @return
- */
- public State getState();
+ /**
+ * Returns the current state of the backend.
+ * @return
+ */
+ public State getState();
- /**
- * Returns the exit code of the backend. Returns <code>-1</code> if
- * the backend exit code is not available.
- * @return
- */
- public int getExitCode();
+ /**
+ * Returns the exit code of the backend. Returns <code>-1</code> if
+ * the backend exit code is not available.
+ * @return
+ */
+ public int getExitCode();
- /**
- * Returns the backend command stream.
- */
- public InputStream getMIInputStream();
+ /**
+ * Returns the backend command stream.
+ */
+ public InputStream getMIInputStream();
- /**
- * Returns the backend result and event stream.
- * @return
- */
- public OutputStream getMIOutputStream();
+ /**
+ * Returns the backend result and event stream.
+ * @return
+ */
+ public OutputStream getMIOutputStream();
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIBackend2.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIBackend2.java
index ab02c738d8b..c4d02354e84 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIBackend2.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIBackend2.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Marc Khouzam (Ericsson) - initial API and implementation
*******************************************************************************/
@@ -23,8 +23,8 @@ import java.io.InputStream;
public interface IMIBackend2 extends IMIBackend {
- /**
- * Returns the backend error stream.
- */
- public InputStream getMIErrorStream();
+ /**
+ * Returns the backend error stream.
+ */
+ public InputStream getMIErrorStream();
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIBreakpointPathAdjuster.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIBreakpointPathAdjuster.java
index bac704d1767..3b0cdbda8a8 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIBreakpointPathAdjuster.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIBreakpointPathAdjuster.java
@@ -15,9 +15,9 @@
package org.eclipse.cdt.dsf.mi.service;
/**
- * Adjustment of the debugger path is required for earlier versions of GDB to
+ * Adjustment of the debugger path is required for earlier versions of GDB to
* provide a workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=232415.
- *
+ *
* @since 4.2
*/
public interface IMIBreakpointPathAdjuster {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMICommandControl.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMICommandControl.java
index 2a96015aa3f..f9569edbb9e 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMICommandControl.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMICommandControl.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
@@ -20,13 +20,11 @@ import org.eclipse.cdt.dsf.mi.service.command.CommandFactory;
* This interface provides a method for accessing the command factory.
* @since 3.0
*/
-public interface IMICommandControl extends ICommandControlService
-{
+public interface IMICommandControl extends ICommandControlService {
/**
* Returns a command factory that creates different<code>ICommand</code>
* to be sent to the backend. This factory can easily be overridden
* to specialize certain commands.
*/
- public CommandFactory getCommandFactory();
+ public CommandFactory getCommandFactory();
}
-
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIContainerDMContext.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIContainerDMContext.java
index 8f2dc73c629..53197af0df4 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIContainerDMContext.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIContainerDMContext.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
@@ -17,14 +17,13 @@ import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
/**
* An container context object. In the GDB/MI protocol, thread groups
- * are used as containers of threads, and are represented by a string
+ * are used as containers of threads, and are represented by a string
* identifier. These thread groups are the basis for this context.
* @since 1.1
*/
-public interface IMIContainerDMContext extends IContainerDMContext
-{
- /**
- * Returns the GDB/MI thread group identifier of this context.
- */
- public String getGroupId();
+public interface IMIContainerDMContext extends IContainerDMContext {
+ /**
+ * Returns the GDB/MI thread group identifier of this context.
+ */
+ public String getGroupId();
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIExecutionDMContext.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIExecutionDMContext.java
index 267ee21aada..8d96fdfa3d6 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIExecutionDMContext.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIExecutionDMContext.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -16,16 +16,15 @@ package org.eclipse.cdt.dsf.mi.service;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
/**
- * An execution context object. In the GDB/MI protocol, threads are represented
- * by an integer identifier, which is the basis for this context. The parent of this
- * context should always be a container context.
+ * An execution context object. In the GDB/MI protocol, threads are represented
+ * by an integer identifier, which is the basis for this context. The parent of this
+ * context should always be a container context.
*/
-public interface IMIExecutionDMContext extends IExecutionDMContext
-{
- /**
- * Returns the GDB/MI thread identifier of this context.
- * @return
- * @since 5.0
- */
- public String getThreadId();
+public interface IMIExecutionDMContext extends IExecutionDMContext {
+ /**
+ * Returns the GDB/MI thread identifier of this context.
+ * @return
+ * @since 5.0
+ */
+ public String getThreadId();
} \ No newline at end of file
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIExpressions.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIExpressions.java
index 8298a515c84..30847273843 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIExpressions.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIExpressions.java
@@ -25,14 +25,14 @@ import org.eclipse.cdt.dsf.debug.service.IExpressions3;
* (e.g. linked list that become cycle), and gdb never returns. But also in the
* normal case of uninitialized collections, you easily end up with millions of
* useless elements, damaging the responsiveness of the workbench.
- *
+ *
* In order to avoid those problems, this extension lets the client specify a
* maximum number of children that it is interested in.
- *
+ *
* If you have an instance implementing {@link IExpressions}, you should always
* check whether it implements this extension, and if so, use the methods of the
* extension.
- *
+ *
* @since 4.0
*/
public interface IMIExpressions extends IExpressions3 {
@@ -45,11 +45,11 @@ public interface IMIExpressions extends IExpressions3 {
* whether an expression has children or not.
*/
public static final int CHILD_COUNT_LIMIT_UNSPECIFIED = -1;
-
+
/**
* This method indicates whether the given expression can safely be asked
* for all its sub-expressions.
- *
+ *
* If this method returns <code>false</code>, this has the following impact:
* <ul>
* <li>you should not call
@@ -57,23 +57,22 @@ public interface IMIExpressions extends IExpressions3 {
* but
* {@link IMIExpressions#getSubExpressionCount(IExpressionDMContext, int, DataRequestMonitor)}
* instead.</li>
- *
+ *
* <li>you should not call
* {@link IExpressions#getSubExpressions(IExpressionDMContext, DataRequestMonitor)},
* but
* {@link IExpressions#getSubExpressions(IExpressionDMContext, int, int, DataRequestMonitor)}
* </li>
* </ul>
- *
+ *
* @param exprCtx
* The data model context representing an expression.
- *
+ *
* @param rm
* Data Request monitor containing <code>true</code> if this expression can
* safely fetch all its sub-expressions. <code>false</false> otherwise.
*/
- public void safeToAskForAllSubExpressions(IExpressionDMContext exprCtx,
- DataRequestMonitor<Boolean> rm);
+ public void safeToAskForAllSubExpressions(IExpressionDMContext exprCtx, DataRequestMonitor<Boolean> rm);
/**
* This method is the same as
@@ -85,20 +84,19 @@ public interface IMIExpressions extends IExpressions3 {
* However, if {@link #safeToAskForAllSubExpressions(org.eclipse.cdt.dsf.debug.service.IExpressions.IExpressionDMContext, DataRequestMonitor)}
* returns false, the original method must not be called, and this method must instead be used.
* Otherwise, the gdb response time may be very slow, or it even may hang.
- *
+ *
* @param exprCtx
* The data model context representing an expression.
- *
+ *
* @param maxNumberOfChildren
* The implementation needs not check whether there are more than
* this number of children. However, if the implementation has
* already knowledge of more children than this, or can obtain
* them equally efficient, it might also return a higher count.
- *
+ *
* @param rm
* Request completion monitor containing the number of
* sub-expressions of the specified expression
*/
- void getSubExpressionCount(IExpressionDMContext exprCtx,
- int maxNumberOfChildren, DataRequestMonitor<Integer> rm);
+ void getSubExpressionCount(IExpressionDMContext exprCtx, int maxNumberOfChildren, DataRequestMonitor<Integer> rm);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIProcessDMContext.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIProcessDMContext.java
index e0222d9a580..cca3c806f4e 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIProcessDMContext.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIProcessDMContext.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ercisson - initial API and implementation
*******************************************************************************/
@@ -16,14 +16,14 @@ package org.eclipse.cdt.dsf.mi.service;
import org.eclipse.cdt.dsf.debug.service.IProcesses.IProcessDMContext;
/**
- * A process context object. In the GDB/MI protocol, processes are represented
+ * A process context object. In the GDB/MI protocol, processes are represented
* by an string identifier, which is the basis for this context.
* @since 1.1
*/
-public interface IMIProcessDMContext extends IProcessDMContext {
- /**
- * Returns the GDB/MI process identifier of this context.
- * @return
- */
- public String getProcId();
+public interface IMIProcessDMContext extends IProcessDMContext {
+ /**
+ * Returns the GDB/MI process identifier of this context.
+ * @return
+ */
+ public String getProcId();
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIProcesses.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIProcesses.java
index 2e7226821f9..0bb8f080e9e 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIProcesses.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIProcesses.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
@@ -21,62 +21,58 @@ import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommand
* This interface provides a method for creating execution contexts.
* @since 1.1
*/
-public interface IMIProcesses extends IProcesses
-{
+public interface IMIProcesses extends IProcesses {
/**
* Create a thread context.
- *
+ *
* @param processDmc The parent process context
* @param threadId The OS Id of the thread
*/
- IThreadDMContext createThreadContext(IProcessDMContext processDmc, String threadId);
+ IThreadDMContext createThreadContext(IProcessDMContext processDmc, String threadId);
/**
* Create a process context.
- *
+ *
* @param pid The OS Id of the process
*/
- IProcessDMContext createProcessContext(ICommandControlDMContext controlDmc, String pid);
-
- /**
- * Create an execution context.
- *
- * @param containerDmc The parent process debugging context
- * @param threadDmc The parent thread context
- * @param threadId The thread id of the thread
- */
- IMIExecutionDMContext createExecutionContext(IContainerDMContext containerDmc,
- IThreadDMContext threadDmc,
- String threadId);
+ IProcessDMContext createProcessContext(ICommandControlDMContext controlDmc, String pid);
- /**
- * Create a container context.
- *
- * @param processDmc The parent process context of this context
- * @param groupId The thread group id of the process
- */
- IMIContainerDMContext createContainerContext(IProcessDMContext processDmc,
- String groupId);
+ /**
+ * Create an execution context.
+ *
+ * @param containerDmc The parent process debugging context
+ * @param threadDmc The parent thread context
+ * @param threadId The thread id of the thread
+ */
+ IMIExecutionDMContext createExecutionContext(IContainerDMContext containerDmc, IThreadDMContext threadDmc,
+ String threadId);
- /**
- * Create a container context based on a threadId. This implies knowledge
- * of which threads belong to which container. This method can only be used
- * if the threadId has been already created.
- *
- * @param controlDmc The parent command control context of this context
- * @param threadId The thread id belonging to the container we want to create
- */
- IMIContainerDMContext createContainerContextFromThreadId(ICommandControlDMContext controlDmc, String threadId);
+ /**
+ * Create a container context.
+ *
+ * @param processDmc The parent process context of this context
+ * @param groupId The thread group id of the process
+ */
+ IMIContainerDMContext createContainerContext(IProcessDMContext processDmc, String groupId);
- /**
- * Create a container context based on a groupId. This implies knowledge
- * of which pid is represented by the groupId. This method can only be used
- * if the groupId has been already created.
- *
- * @param controlDmc The parent command control context of this context
- * @param groupId The thread-group id of the container we want to create
- * @since 4.0
- */
- IMIContainerDMContext createContainerContextFromGroupId(ICommandControlDMContext controlDmc, String groupId);
-}
+ /**
+ * Create a container context based on a threadId. This implies knowledge
+ * of which threads belong to which container. This method can only be used
+ * if the threadId has been already created.
+ *
+ * @param controlDmc The parent command control context of this context
+ * @param threadId The thread id belonging to the container we want to create
+ */
+ IMIContainerDMContext createContainerContextFromThreadId(ICommandControlDMContext controlDmc, String threadId);
+ /**
+ * Create a container context based on a groupId. This implies knowledge
+ * of which pid is represented by the groupId. This method can only be used
+ * if the groupId has been already created.
+ *
+ * @param controlDmc The parent command control context of this context
+ * @param groupId The thread-group id of the container we want to create
+ * @since 4.0
+ */
+ IMIContainerDMContext createContainerContextFromGroupId(ICommandControlDMContext controlDmc, String groupId);
+}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIRunControl.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIRunControl.java
index 137edc29b86..d63f4a741a5 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIRunControl.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIRunControl.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
@@ -21,27 +21,26 @@ import org.eclipse.cdt.dsf.debug.service.IRunControl2;
/**
* This interface provides methods for RunControl that are not
* part of the standard DSF IRunControl
- *
+ *
* @since 2.0
*/
-public interface IMIRunControl extends IRunControl2
-{
+public interface IMIRunControl extends IRunControl2 {
/**
* Returns true if the target currently accepting commands.
*
* @since 4.0
*/
public boolean isTargetAcceptingCommands();
-
+
/**
* Request that the specified steps be executed by first ensuring the target is available
* to receive commands. Once the specified steps are executed, the target should be
* returned to its original availability.
- *
+ *
* This is of value for breakpoints commands; e.g., breakpoints need to be inserted
* even when the target is running, so this call would suspend the target, insert the
* breakpoint, and resume the target again.
- *
+ *
* @since 3.0
*/
public void executeWithTargetAvailable(IDMContext ctx, Sequence.Step[] stepsToExecute, RequestMonitor rm);
@@ -49,24 +48,26 @@ public interface IMIRunControl extends IRunControl2
/**
* Generic interface for different possible Run modes such as Non-Stop or All-Stop.
* Using this interface allows to extend the list of RunModes.
- *
- * @since 4.0
+ *
+ * @since 4.0
*/
- public interface IRunMode {};
-
- /**
+ public interface IRunMode {
+ };
+
+ /**
* The run-modes supported by GDB.
- *
+ *
* @since 4.0
*/
- public enum MIRunMode implements IRunMode { ALL_STOP, NON_STOP };
-
+ public enum MIRunMode implements IRunMode {
+ ALL_STOP, NON_STOP
+ };
+
/**
* Returns the RunMode that is currently being used by this RunControl service.
* @returns The current RunMode used by this service.
- *
+ *
* @since 4.0
*/
public IRunMode getRunMode();
}
-
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointDMData.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointDMData.java
index d0d7f95f4ab..a00c3cd5685 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointDMData.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointDMData.java
@@ -25,18 +25,18 @@ import org.eclipse.cdt.utils.Addr64;
public class MIBreakpointDMData implements IBreakpointDMData {
- /**
- * MI-specific breakpoint attributes markers.
- */
+ /**
+ * MI-specific breakpoint attributes markers.
+ */
public static final String DSFMIBREAKPOINT = "org.eclipse.cdt.dsf.debug.breakpoint.mi"; //$NON-NLS-1$
- public static final String NUMBER = DSFMIBREAKPOINT + ".number"; //$NON-NLS-1$
- public static final String TYPE = DSFMIBREAKPOINT + ".type"; //$NON-NLS-1$
- public static final String THREAD_ID = DSFMIBREAKPOINT + ".threadId"; //$NON-NLS-1$
- public static final String FULL_NAME = DSFMIBREAKPOINT + ".fullName"; //$NON-NLS-1$
- public static final String HITS = DSFMIBREAKPOINT + ".hits"; //$NON-NLS-1$
+ public static final String NUMBER = DSFMIBREAKPOINT + ".number"; //$NON-NLS-1$
+ public static final String TYPE = DSFMIBREAKPOINT + ".type"; //$NON-NLS-1$
+ public static final String THREAD_ID = DSFMIBREAKPOINT + ".threadId"; //$NON-NLS-1$
+ public static final String FULL_NAME = DSFMIBREAKPOINT + ".fullName"; //$NON-NLS-1$
+ public static final String HITS = DSFMIBREAKPOINT + ".hits"; //$NON-NLS-1$
public static final String IS_TEMPORARY = DSFMIBREAKPOINT + ".isTemporary"; //$NON-NLS-1$
- public static final String IS_HARDWARE = DSFMIBREAKPOINT + ".isHardware"; //$NON-NLS-1$
- public static final String LOCATION = DSFMIBREAKPOINT + ".location"; //$NON-NLS-1$
+ public static final String IS_HARDWARE = DSFMIBREAKPOINT + ".isHardware"; //$NON-NLS-1$
+ public static final String LOCATION = DSFMIBREAKPOINT + ".location"; //$NON-NLS-1$
// Back-end breakpoint object
private final MIBreakpoint fBreakpoint;
@@ -44,7 +44,7 @@ public class MIBreakpointDMData implements IBreakpointDMData {
/**
* Breakpoint types
- *
+ *
* @deprecated This enum is not extensible, so has been deprecated to allow extenders to have their own breakpoint
* types. Within CDT there was no access to this enum outside of this class. The replacement is to use {@link MIBreakpointDMData#getBreakpointType()}
*/
@@ -63,7 +63,7 @@ public class MIBreakpointDMData implements IBreakpointDMData {
/**
* Copy constructor
- *
+ *
* @param other
* @deprecated Call {@link #copy()} on other instead to allow subclasses to be copied properly.
*/
@@ -76,7 +76,7 @@ public class MIBreakpointDMData implements IBreakpointDMData {
/**
* Perform a copy.
- *
+ *
* @return the copy
* @since 5.3
*/
@@ -86,7 +86,7 @@ public class MIBreakpointDMData implements IBreakpointDMData {
/**
* Create a MIBreakpointDMData from a breakpoint and a potentially populated properties map.
- *
+ *
* @param dsfMIBreakpoint
* MI Breakpoint to represent
* @param properties
@@ -98,116 +98,117 @@ public class MIBreakpointDMData implements IBreakpointDMData {
if (properties != null) {
fProperties = properties;
} else {
- fProperties = new HashMap<String,Object>();
+ fProperties = new HashMap<String, Object>();
if (dsfMIBreakpoint.isTracepoint()) {
// Generic breakpoint attributes
fProperties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT);
- fProperties.put(MIBreakpoints.FILE_NAME, dsfMIBreakpoint.getFile());
- fProperties.put(MIBreakpoints.LINE_NUMBER, dsfMIBreakpoint.getLine());
- fProperties.put(MIBreakpoints.FUNCTION, dsfMIBreakpoint.getFunction());
- fProperties.put(MIBreakpoints.ADDRESS, dsfMIBreakpoint.getAddress());
- fProperties.put(MIBreakpoints.CONDITION, dsfMIBreakpoint.getCondition());
- fProperties.put(MIBreakpoints.PASS_COUNT, dsfMIBreakpoint.getPassCount());
- fProperties.put(MIBreakpoints.IS_ENABLED, Boolean.valueOf(dsfMIBreakpoint.isEnabled()));
- fProperties.put(MIBreakpoints.COMMANDS, dsfMIBreakpoint.getCommands());
-
+ fProperties.put(MIBreakpoints.FILE_NAME, dsfMIBreakpoint.getFile());
+ fProperties.put(MIBreakpoints.LINE_NUMBER, dsfMIBreakpoint.getLine());
+ fProperties.put(MIBreakpoints.FUNCTION, dsfMIBreakpoint.getFunction());
+ fProperties.put(MIBreakpoints.ADDRESS, dsfMIBreakpoint.getAddress());
+ fProperties.put(MIBreakpoints.CONDITION, dsfMIBreakpoint.getCondition());
+ fProperties.put(MIBreakpoints.PASS_COUNT, dsfMIBreakpoint.getPassCount());
+ fProperties.put(MIBreakpoints.IS_ENABLED, Boolean.valueOf(dsfMIBreakpoint.isEnabled()));
+ fProperties.put(MIBreakpoints.COMMANDS, dsfMIBreakpoint.getCommands());
+
// MI-specific breakpoint attributes
- fProperties.put(NUMBER, dsfMIBreakpoint.getNumber());
- fProperties.put(TYPE, dsfMIBreakpoint.getType());
- fProperties.put(THREAD_ID, dsfMIBreakpoint.getThreadId());
- fProperties.put(FULL_NAME, dsfMIBreakpoint.getFullName());
- fProperties.put(HITS, dsfMIBreakpoint.getTimes());
+ fProperties.put(NUMBER, dsfMIBreakpoint.getNumber());
+ fProperties.put(TYPE, dsfMIBreakpoint.getType());
+ fProperties.put(THREAD_ID, dsfMIBreakpoint.getThreadId());
+ fProperties.put(FULL_NAME, dsfMIBreakpoint.getFullName());
+ fProperties.put(HITS, dsfMIBreakpoint.getTimes());
fProperties.put(IS_TEMPORARY, Boolean.valueOf(dsfMIBreakpoint.isTemporary()));
- fProperties.put(IS_HARDWARE, Boolean.valueOf(dsfMIBreakpoint.isHardware()));
- fProperties.put(LOCATION, formatLocation());
-
+ fProperties.put(IS_HARDWARE, Boolean.valueOf(dsfMIBreakpoint.isHardware()));
+ fProperties.put(LOCATION, formatLocation());
+
} else if (dsfMIBreakpoint.isDynamicPrintf()) {
// Generic breakpoint attributes
fProperties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.DYNAMICPRINTF);
- fProperties.put(MIBreakpoints.FILE_NAME, dsfMIBreakpoint.getFile());
- fProperties.put(MIBreakpoints.LINE_NUMBER, dsfMIBreakpoint.getLine());
- fProperties.put(MIBreakpoints.FUNCTION, dsfMIBreakpoint.getFunction());
- fProperties.put(MIBreakpoints.ADDRESS, dsfMIBreakpoint.getAddress());
- fProperties.put(MIBreakpoints.CONDITION, dsfMIBreakpoint.getCondition());
- fProperties.put(MIBreakpoints.PRINTF_STRING, dsfMIBreakpoint.getPrintfString());
- fProperties.put(MIBreakpoints.IS_ENABLED, Boolean.valueOf(dsfMIBreakpoint.isEnabled()));
- fProperties.put(MIBreakpoints.COMMANDS, dsfMIBreakpoint.getCommands());
-
+ fProperties.put(MIBreakpoints.FILE_NAME, dsfMIBreakpoint.getFile());
+ fProperties.put(MIBreakpoints.LINE_NUMBER, dsfMIBreakpoint.getLine());
+ fProperties.put(MIBreakpoints.FUNCTION, dsfMIBreakpoint.getFunction());
+ fProperties.put(MIBreakpoints.ADDRESS, dsfMIBreakpoint.getAddress());
+ fProperties.put(MIBreakpoints.CONDITION, dsfMIBreakpoint.getCondition());
+ fProperties.put(MIBreakpoints.PRINTF_STRING, dsfMIBreakpoint.getPrintfString());
+ fProperties.put(MIBreakpoints.IS_ENABLED, Boolean.valueOf(dsfMIBreakpoint.isEnabled()));
+ fProperties.put(MIBreakpoints.COMMANDS, dsfMIBreakpoint.getCommands());
+
// MI-specific breakpoint attributes
- fProperties.put(NUMBER, dsfMIBreakpoint.getNumber());
- fProperties.put(TYPE, dsfMIBreakpoint.getType());
- fProperties.put(THREAD_ID, dsfMIBreakpoint.getThreadId());
- fProperties.put(FULL_NAME, dsfMIBreakpoint.getFullName());
- fProperties.put(HITS, dsfMIBreakpoint.getTimes());
+ fProperties.put(NUMBER, dsfMIBreakpoint.getNumber());
+ fProperties.put(TYPE, dsfMIBreakpoint.getType());
+ fProperties.put(THREAD_ID, dsfMIBreakpoint.getThreadId());
+ fProperties.put(FULL_NAME, dsfMIBreakpoint.getFullName());
+ fProperties.put(HITS, dsfMIBreakpoint.getTimes());
fProperties.put(IS_TEMPORARY, Boolean.valueOf(dsfMIBreakpoint.isTemporary()));
- fProperties.put(IS_HARDWARE, Boolean.valueOf(dsfMIBreakpoint.isHardware()));
- fProperties.put(LOCATION, formatLocation());
-
+ fProperties.put(IS_HARDWARE, Boolean.valueOf(dsfMIBreakpoint.isHardware()));
+ fProperties.put(LOCATION, formatLocation());
+
} else if (dsfMIBreakpoint.isWatchpoint()) {
// Generic breakpoint attributes
fProperties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.WATCHPOINT);
fProperties.put(MIBreakpoints.EXPRESSION, dsfMIBreakpoint.getExpression());
- fProperties.put(MIBreakpoints.READ, dsfMIBreakpoint.isAccessWatchpoint() || dsfMIBreakpoint.isReadWatchpoint());
- fProperties.put(MIBreakpoints.WRITE, dsfMIBreakpoint.isAccessWatchpoint() || dsfMIBreakpoint.isWriteWatchpoint());
-
+ fProperties.put(MIBreakpoints.READ,
+ dsfMIBreakpoint.isAccessWatchpoint() || dsfMIBreakpoint.isReadWatchpoint());
+ fProperties.put(MIBreakpoints.WRITE,
+ dsfMIBreakpoint.isAccessWatchpoint() || dsfMIBreakpoint.isWriteWatchpoint());
+
// MI-specific breakpoint attributes
- fProperties.put(NUMBER, dsfMIBreakpoint.getNumber());
-
+ fProperties.put(NUMBER, dsfMIBreakpoint.getNumber());
+
} else if (dsfMIBreakpoint.isCatchpoint()) {
// Because gdb doesn't support catchpoints in mi, we end up using
// CLI to set the catchpoint. The sort of MIBreakpoint we create
// at that time is minimal as the only information we get back from
- // gdb is the breakpoint number and type of the catchpoint we just
+ // gdb is the breakpoint number and type of the catchpoint we just
// set. See MIBreakpoint(String)
//
// The only type of MIBreakpoint that will be of this CATCHPOINT type
- // is the instance we create from the response of the CLI command we
- // use to set the catchpoint. If we later query gdb for the breakpoint
- // list, we'll unfortunately end up creating an MIBreakpoint of type
+ // is the instance we create from the response of the CLI command we
+ // use to set the catchpoint. If we later query gdb for the breakpoint
+ // list, we'll unfortunately end up creating an MIBreakpoint of type
// BREAKPOINT. Maybe one day gdb will treats catchpoints like first
// class citizens and this messy situation will go away.
-
+
fProperties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.CATCHPOINT);
fProperties.put(MIBreakpoints.CATCHPOINT_TYPE, dsfMIBreakpoint.getCatchpointType());
- fProperties.put(NUMBER, dsfMIBreakpoint.getNumber());
-
+ fProperties.put(NUMBER, dsfMIBreakpoint.getNumber());
+
} else {
// For all other breakpoint types, use MIBreakpoints.BREAKPOINT.
-
+
// Note that this may in fact be a catchpoint. See comment above in
// isCatchpoint case
-
+
// Generic breakpoint attributes
fProperties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.BREAKPOINT);
- fProperties.put(MIBreakpoints.FILE_NAME, dsfMIBreakpoint.getFile());
- fProperties.put(MIBreakpoints.LINE_NUMBER, dsfMIBreakpoint.getLine());
- fProperties.put(MIBreakpoints.FUNCTION, dsfMIBreakpoint.getFunction());
- fProperties.put(MIBreakpoints.ADDRESS, dsfMIBreakpoint.getAddress());
- fProperties.put(MIBreakpoints.CONDITION, dsfMIBreakpoint.getCondition());
- fProperties.put(MIBreakpoints.IGNORE_COUNT, dsfMIBreakpoint.getIgnoreCount());
- fProperties.put(MIBreakpoints.IS_ENABLED, Boolean.valueOf(dsfMIBreakpoint.isEnabled()));
- fProperties.put(MIBreakpoints.COMMANDS, dsfMIBreakpoint.getCommands());
-
+ fProperties.put(MIBreakpoints.FILE_NAME, dsfMIBreakpoint.getFile());
+ fProperties.put(MIBreakpoints.LINE_NUMBER, dsfMIBreakpoint.getLine());
+ fProperties.put(MIBreakpoints.FUNCTION, dsfMIBreakpoint.getFunction());
+ fProperties.put(MIBreakpoints.ADDRESS, dsfMIBreakpoint.getAddress());
+ fProperties.put(MIBreakpoints.CONDITION, dsfMIBreakpoint.getCondition());
+ fProperties.put(MIBreakpoints.IGNORE_COUNT, dsfMIBreakpoint.getIgnoreCount());
+ fProperties.put(MIBreakpoints.IS_ENABLED, Boolean.valueOf(dsfMIBreakpoint.isEnabled()));
+ fProperties.put(MIBreakpoints.COMMANDS, dsfMIBreakpoint.getCommands());
+
// MI-specific breakpoint attributes
- fProperties.put(NUMBER, dsfMIBreakpoint.getNumber());
- fProperties.put(TYPE, dsfMIBreakpoint.getType());
- fProperties.put(THREAD_ID, dsfMIBreakpoint.getThreadId());
- fProperties.put(FULL_NAME, dsfMIBreakpoint.getFullName());
- fProperties.put(HITS, dsfMIBreakpoint.getTimes());
+ fProperties.put(NUMBER, dsfMIBreakpoint.getNumber());
+ fProperties.put(TYPE, dsfMIBreakpoint.getType());
+ fProperties.put(THREAD_ID, dsfMIBreakpoint.getThreadId());
+ fProperties.put(FULL_NAME, dsfMIBreakpoint.getFullName());
+ fProperties.put(HITS, dsfMIBreakpoint.getTimes());
fProperties.put(IS_TEMPORARY, Boolean.valueOf(dsfMIBreakpoint.isTemporary()));
- fProperties.put(IS_HARDWARE, Boolean.valueOf(dsfMIBreakpoint.isHardware()));
- fProperties.put(LOCATION, formatLocation());
-
+ fProperties.put(IS_HARDWARE, Boolean.valueOf(dsfMIBreakpoint.isHardware()));
+ fProperties.put(LOCATION, formatLocation());
+
}
}
}
-
/**
* Constructs a DsfMIBreakpoint from a back-end object. Create the object by calling
* {@link MIBreakpoints#createMIBreakpointDMData(MIBreakpoint)} to ensure correct version is called.
- *
+ *
* @param dsfMIBreakpoint
* back-end breakpoint
* @deprecated Call {@link MIBreakpoints#createMIBreakpointDMData(MIBreakpoint)} instead
@@ -219,7 +220,7 @@ public class MIBreakpointDMData implements IBreakpointDMData {
/**
* Obtain the properties map. Method only intended to be called by sub-classes.
- *
+ *
* @return properties map
* @since 5.3
*/
@@ -229,18 +230,18 @@ public class MIBreakpointDMData implements IBreakpointDMData {
/**
* Obtain the MI Breakpoint. Method only intended to be called by sub-classes.
- *
+ *
* @return breakpoint
* @since 5.3
*/
protected MIBreakpoint getBreakpoint() {
return fBreakpoint;
}
-
+
/**
* Formats the LOCATION synthetic property from the existing fields
- *
- * @return The location string
+ *
+ * @return The location string
*/
private String formatLocation() {
@@ -248,15 +249,15 @@ public class MIBreakpointDMData implements IBreakpointDMData {
String location = fBreakpoint.getAddress();
// Get the relevant parameters
- String fileName = fBreakpoint.getFile();
+ String fileName = fBreakpoint.getFile();
Integer lineNumber = fBreakpoint.getLine();
- String function = fBreakpoint.getFunction();
+ String function = fBreakpoint.getFunction();
if (!fileName.isEmpty()) {
if (lineNumber != -1) {
location = fileName + ":" + lineNumber; //$NON-NLS-1$
} else {
- location = fileName + ":" + function; //$NON-NLS-1$
+ location = fileName + ":" + function; //$NON-NLS-1$
}
}
@@ -265,7 +266,7 @@ public class MIBreakpointDMData implements IBreakpointDMData {
/**
* Checks for equality
- *
+ *
* @param other
* @return
*/
@@ -275,16 +276,18 @@ public class MIBreakpointDMData implements IBreakpointDMData {
@Override
public boolean equals(Object other) {
- if (this == other) return true;
- if (!(other instanceof MIBreakpointDMData)) return false;
- return equals((MIBreakpointDMData)other);
+ if (this == other)
+ return true;
+ if (!(other instanceof MIBreakpointDMData))
+ return false;
+ return equals((MIBreakpointDMData) other);
}
-
+
@Override
public int hashCode() {
return fProperties.hashCode();
}
-
+
///////////////////////////////////////////////////////////////////////////
// IBreakpointDMData
///////////////////////////////////////////////////////////////////////////
@@ -344,21 +347,21 @@ public class MIBreakpointDMData implements IBreakpointDMData {
///////////////////////////////////////////////////////////////////////////
// MIBreakpointDMData
///////////////////////////////////////////////////////////////////////////
-
+
/**
* @since 3.0
*/
public int getPassCount() {
return fBreakpoint.getPassCount();
}
-
+
/**
* @since 4.4
*/
public String getPrintfString() {
return fBreakpoint.getPrintfString();
}
-
+
/**
* @since 3.0
*/
@@ -384,7 +387,7 @@ public class MIBreakpointDMData implements IBreakpointDMData {
public void setGroupIds(String[] groups) {
fBreakpoint.setGroupIds(groups);
}
-
+
public boolean isTemporary() {
return fBreakpoint.isTemporary();
}
@@ -423,7 +426,7 @@ public class MIBreakpointDMData implements IBreakpointDMData {
fBreakpoint.setEnabled(isEnabled);
fProperties.put(MIBreakpoints.IS_ENABLED, isEnabled);
}
-
+
/**
* @since 3.0
*/
@@ -439,7 +442,7 @@ public class MIBreakpointDMData implements IBreakpointDMData {
fBreakpoint.setCommands(commands);
fProperties.put(MIBreakpoints.COMMANDS, commands);
}
-
+
public boolean isReadWatchpoint() {
return fBreakpoint.isReadWatchpoint();
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpoints.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpoints.java
index d14fb6dacd0..ee834d1a4c9 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpoints.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpoints.java
@@ -66,72 +66,71 @@ import org.osgi.framework.BundleContext;
* Initial breakpoint service implementation.
* Implements the IBreakpoints interface.
*/
-public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, IBreakpointsExtension, IMIBreakpointPathAdjuster
-{
- /**
- * Breakpoint attributes markers used in the map parameters of insert/updateBreakpoint().
- * All are optional with the possible exception of TYPE. It is the responsibility of the
- * service to ensure that the set of attributes provided is sufficient to create/update
- * a valid breakpoint on the back-end.
- */
- public static final String PREFIX = "org.eclipse.cdt.dsf.debug.breakpoint"; //$NON-NLS-1$
-
- // General markers
- public static final String BREAKPOINT_TYPE = PREFIX + ".type"; //$NON-NLS-1$
- public static final String BREAKPOINT = "breakpoint"; //$NON-NLS-1$
- public static final String WATCHPOINT = "watchpoint"; //$NON-NLS-1$
- public static final String CATCHPOINT = "catchpoint"; //$NON-NLS-1$
- /** @since 3.0 */
- public static final String TRACEPOINT = "tracepoint"; //$NON-NLS-1$
- /** @since 4.4 */
- public static final String DYNAMICPRINTF = "dynamicPrintf"; //$NON-NLS-1$
-
- // Basic set of breakpoint attribute markers
- public static final String FILE_NAME = PREFIX + ".fileName"; //$NON-NLS-1$
- public static final String LINE_NUMBER = PREFIX + ".lineNumber"; //$NON-NLS-1$
- public static final String FUNCTION = PREFIX + ".function"; //$NON-NLS-1$
- public static final String ADDRESS = PREFIX + ".address"; //$NON-NLS-1$
- public static final String CONDITION = PREFIX + ".condition"; //$NON-NLS-1$
- public static final String IGNORE_COUNT = PREFIX + ".ignoreCount"; //$NON-NLS-1$
- /** @since 3.0 */
- public static final String PASS_COUNT = PREFIX + ".passCount"; //$NON-NLS-1$
- public static final String IS_ENABLED = PREFIX + ".isEnabled"; //$NON-NLS-1$
- /** @since 3.0 */
- public static final String COMMANDS = PREFIX + ".commands"; //$NON-NLS-1$
-
- // Basic set of watchpoint attribute markers
- public static final String EXPRESSION = PREFIX + ".expression"; //$NON-NLS-1$
- public static final String READ = PREFIX + ".read"; //$NON-NLS-1$
- public static final String WRITE = PREFIX + ".write"; //$NON-NLS-1$
- /** @since 5.3 */
- public static final String RANGE = PREFIX + ".range"; //$NON-NLS-1$
- /** @since 5.3 */
- public static final String MEMSPACE = PREFIX + ".memoryspace"; //$NON-NLS-1$
-
-
- // Catchpoint properties
-
- // DynamicPrintf properties
- /** @since 4.4 */
- public static final String PRINTF_STRING = PREFIX + ".printf_string"; //$NON-NLS-1$
-
+public class MIBreakpoints extends AbstractDsfService
+ implements IBreakpoints, IBreakpointsExtension, IMIBreakpointPathAdjuster {
+ /**
+ * Breakpoint attributes markers used in the map parameters of insert/updateBreakpoint().
+ * All are optional with the possible exception of TYPE. It is the responsibility of the
+ * service to ensure that the set of attributes provided is sufficient to create/update
+ * a valid breakpoint on the back-end.
+ */
+ public static final String PREFIX = "org.eclipse.cdt.dsf.debug.breakpoint"; //$NON-NLS-1$
+
+ // General markers
+ public static final String BREAKPOINT_TYPE = PREFIX + ".type"; //$NON-NLS-1$
+ public static final String BREAKPOINT = "breakpoint"; //$NON-NLS-1$
+ public static final String WATCHPOINT = "watchpoint"; //$NON-NLS-1$
+ public static final String CATCHPOINT = "catchpoint"; //$NON-NLS-1$
+ /** @since 3.0 */
+ public static final String TRACEPOINT = "tracepoint"; //$NON-NLS-1$
+ /** @since 4.4 */
+ public static final String DYNAMICPRINTF = "dynamicPrintf"; //$NON-NLS-1$
+
+ // Basic set of breakpoint attribute markers
+ public static final String FILE_NAME = PREFIX + ".fileName"; //$NON-NLS-1$
+ public static final String LINE_NUMBER = PREFIX + ".lineNumber"; //$NON-NLS-1$
+ public static final String FUNCTION = PREFIX + ".function"; //$NON-NLS-1$
+ public static final String ADDRESS = PREFIX + ".address"; //$NON-NLS-1$
+ public static final String CONDITION = PREFIX + ".condition"; //$NON-NLS-1$
+ public static final String IGNORE_COUNT = PREFIX + ".ignoreCount"; //$NON-NLS-1$
+ /** @since 3.0 */
+ public static final String PASS_COUNT = PREFIX + ".passCount"; //$NON-NLS-1$
+ public static final String IS_ENABLED = PREFIX + ".isEnabled"; //$NON-NLS-1$
+ /** @since 3.0 */
+ public static final String COMMANDS = PREFIX + ".commands"; //$NON-NLS-1$
+
+ // Basic set of watchpoint attribute markers
+ public static final String EXPRESSION = PREFIX + ".expression"; //$NON-NLS-1$
+ public static final String READ = PREFIX + ".read"; //$NON-NLS-1$
+ public static final String WRITE = PREFIX + ".write"; //$NON-NLS-1$
+ /** @since 5.3 */
+ public static final String RANGE = PREFIX + ".range"; //$NON-NLS-1$
+ /** @since 5.3 */
+ public static final String MEMSPACE = PREFIX + ".memoryspace"; //$NON-NLS-1$
+
+ // Catchpoint properties
+
+ // DynamicPrintf properties
+ /** @since 4.4 */
+ public static final String PRINTF_STRING = PREFIX + ".printf_string"; //$NON-NLS-1$
+
/**
* Property that indicates the kind of catchpoint (.e.g, fork call, C++
* exception throw). Value is the gdb keyword associated with that type, as
* listed in 'help catch'.
- *
+ *
* @since 3.0
*/
- public static final String CATCHPOINT_TYPE = PREFIX + ".catchpoint_type"; //$NON-NLS-1$
+ public static final String CATCHPOINT_TYPE = PREFIX + ".catchpoint_type"; //$NON-NLS-1$
/**
* Property that holds arguments for the catchpoint. Value is an array of
* Strings. Never null, but may be empty collection, as most catchpoints are
* argument-less.
- *
+ *
* @since 3.0
*/
- public static final String CATCHPOINT_ARGS = PREFIX + ".catchpoint_args"; //$NON-NLS-1$
+ public static final String CATCHPOINT_ARGS = PREFIX + ".catchpoint_args"; //$NON-NLS-1$
// Services
private ICommandControl fConnection;
@@ -147,21 +146,21 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
* @since 3.0
*/
private Map<IExecutionDMContext, IBreakpointDMContext[]> fBreakpointHitMap = new HashMap<>();
-
+
/**
* Returns a map of existing breakpoints for the specified context
- *
+ *
* @since 3.0
*/
protected Map<String, MIBreakpointDMData> getBreakpointMap(IBreakpointsTargetDMContext ctx) {
return fBreakpoints.get(ctx);
}
-
+
/**
* Create an empty breakpoint map and store it with the specific context.
- *
+ *
* @return The newly created empty map.
- *
+ *
* @since 3.0
*/
protected Map<String, MIBreakpointDMData> createNewBreakpointMap(IBreakpointsTargetDMContext ctx) {
@@ -172,7 +171,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
/**
* Create a new effective breakpoint data object
- *
+ *
* @param breakpoint
* backend breakpoint to create DSF object from
* @return breakpoint data object
@@ -187,7 +186,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
/**
* Create a new MI breakpoint
- *
+ *
* @param tuple
* from backend communication
* @return breakpoint
@@ -202,63 +201,64 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
/** @since 3.0 */
public static final String NULL_STRING = ""; //$NON-NLS-1$
/** @since 3.0 */
- public static final String UNKNOWN_EXECUTION_CONTEXT = "Unknown execution context"; //$NON-NLS-1$
+ public static final String UNKNOWN_EXECUTION_CONTEXT = "Unknown execution context"; //$NON-NLS-1$
/** @since 3.0 */
- public static final String UNKNOWN_BREAKPOINT_CONTEXT = "Unknown breakpoint context"; //$NON-NLS-1$
+ public static final String UNKNOWN_BREAKPOINT_CONTEXT = "Unknown breakpoint context"; //$NON-NLS-1$
/** @since 3.0 */
- public static final String UNKNOWN_BREAKPOINT_TYPE = "Unknown breakpoint type"; //$NON-NLS-1$
+ public static final String UNKNOWN_BREAKPOINT_TYPE = "Unknown breakpoint type"; //$NON-NLS-1$
/** @since 3.0 */
- public static final String UNKNOWN_BREAKPOINT = "Unknown breakpoint"; //$NON-NLS-1$
+ public static final String UNKNOWN_BREAKPOINT = "Unknown breakpoint"; //$NON-NLS-1$
/** @since 3.0 */
public static final String BREAKPOINT_INSERTION_FAILURE = "Breakpoint insertion failure"; //$NON-NLS-1$
/** @since 3.0 */
public static final String WATCHPOINT_INSERTION_FAILURE = "Watchpoint insertion failure"; //$NON-NLS-1$
/** @since 3.0 */
- public static final String INVALID_CONDITION = "Invalid condition"; //$NON-NLS-1$
+ public static final String INVALID_CONDITION = "Invalid condition"; //$NON-NLS-1$
/** @since 3.0 */
public static final String TRACEPOINT_INSERTION_FAILURE = "Tracepoint insertion failure"; //$NON-NLS-1$
/** @since 4.4 */
public static final String DYNAMIC_PRINTF_INSERTION_FAILURE = "Dynamic printf insertion failure"; //$NON-NLS-1$
/** @since 3.0 */
- public static final String INVALID_BREAKPOINT_TYPE = "Invalid breakpoint type"; //$NON-NLS-1$
+ public static final String INVALID_BREAKPOINT_TYPE = "Invalid breakpoint type"; //$NON-NLS-1$
/** @since 3.0 */
public static final String CATCHPOINT_INSERTION_FAILURE = "Catchpoint insertion failure"; //$NON-NLS-1$
-
///////////////////////////////////////////////////////////////////////////
// Breakpoint Events
///////////////////////////////////////////////////////////////////////////
-
- public class BreakpointsChangedEvent extends AbstractDMEvent<IBreakpointsTargetDMContext> implements IBreakpointsChangedEvent {
- private IBreakpointDMContext[] fEventBreakpoints;
-
+
+ public class BreakpointsChangedEvent extends AbstractDMEvent<IBreakpointsTargetDMContext>
+ implements IBreakpointsChangedEvent {
+ private IBreakpointDMContext[] fEventBreakpoints;
+
public BreakpointsChangedEvent(IBreakpointDMContext bp) {
super(DMContexts.getAncestorOfType(bp, IBreakpointsTargetDMContext.class));
fEventBreakpoints = new IBreakpointDMContext[] { bp };
}
+
@Override
public IBreakpointDMContext[] getBreakpoints() {
return fEventBreakpoints;
}
- }
-
- public class BreakpointAddedEvent extends BreakpointsChangedEvent implements IBreakpointsAddedEvent {
- public BreakpointAddedEvent(IBreakpointDMContext context) {
- super(context);
+ }
+
+ public class BreakpointAddedEvent extends BreakpointsChangedEvent implements IBreakpointsAddedEvent {
+ public BreakpointAddedEvent(IBreakpointDMContext context) {
+ super(context);
}
- }
+ }
- public class BreakpointUpdatedEvent extends BreakpointsChangedEvent implements IBreakpointsUpdatedEvent {
- public BreakpointUpdatedEvent(IBreakpointDMContext context) {
- super(context);
- }
- }
+ public class BreakpointUpdatedEvent extends BreakpointsChangedEvent implements IBreakpointsUpdatedEvent {
+ public BreakpointUpdatedEvent(IBreakpointDMContext context) {
+ super(context);
+ }
+ }
- public class BreakpointRemovedEvent extends BreakpointsChangedEvent implements IBreakpointsRemovedEvent {
- public BreakpointRemovedEvent(IBreakpointDMContext context) {
- super(context);
- }
- }
+ public class BreakpointRemovedEvent extends BreakpointsChangedEvent implements IBreakpointsRemovedEvent {
+ public BreakpointRemovedEvent(IBreakpointDMContext context) {
+ super(context);
+ }
+ }
///////////////////////////////////////////////////////////////////////////
// IBreakpointDMContext
@@ -266,78 +266,78 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
// be used to get the actual DsfMIBreakpoint.
///////////////////////////////////////////////////////////////////////////
@Immutable
- public static final class MIBreakpointDMContext extends AbstractDMContext implements IBreakpointDMContext {
-
- // The breakpoint reference
- private final String fReference;
-
- /**
- * @param service the Breakpoint service
- * @param parents the parent contexts
- * @param reference the DsfMIBreakpoint reference
- *
- * @since 5.0
- */
- public MIBreakpointDMContext(MIBreakpoints service, IDMContext[] parents, String reference) {
- this(service.getSession().getId(), parents, reference);
- }
-
- /**
- * @param sessionId session ID
- * @param parents the parent contexts
- * @param reference the DsfMIBreakpoint reference
- *
- * @since 5.0
- */
- public MIBreakpointDMContext(String sessionId, IDMContext[] parents, String reference) {
- super(sessionId, parents);
- fReference = reference;
- }
-
- /**
- * @returns a reference to the breakpoint
- * @see org.eclipse.cdt.dsf.debug.service.IBreakpoints.IDsfBreakpointDMContext#getReference()
+ public static final class MIBreakpointDMContext extends AbstractDMContext implements IBreakpointDMContext {
+
+ // The breakpoint reference
+ private final String fReference;
+
+ /**
+ * @param service the Breakpoint service
+ * @param parents the parent contexts
+ * @param reference the DsfMIBreakpoint reference
+ *
+ * @since 5.0
+ */
+ public MIBreakpointDMContext(MIBreakpoints service, IDMContext[] parents, String reference) {
+ this(service.getSession().getId(), parents, reference);
+ }
+
+ /**
+ * @param sessionId session ID
+ * @param parents the parent contexts
+ * @param reference the DsfMIBreakpoint reference
+ *
* @since 5.0
*/
- public String getReference() {
- return fReference;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.dsf.datamodel.AbstractDMContext#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof MIBreakpointDMContext)) {
- return false;
- }
- return baseEquals(obj) && (fReference.equals(((MIBreakpointDMContext)obj).fReference));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.dsf.datamodel.AbstractDMContext#hashCode()
- */
- @Override
- public int hashCode() {
- return baseHashCode() + fReference.hashCode();
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return baseToString() + ".reference(" + fReference + ")"; //$NON-NLS-1$//$NON-NLS-2$*/
- }
- }
-
- ///////////////////////////////////////////////////////////////////////////
+ public MIBreakpointDMContext(String sessionId, IDMContext[] parents, String reference) {
+ super(sessionId, parents);
+ fReference = reference;
+ }
+
+ /**
+ * @returns a reference to the breakpoint
+ * @see org.eclipse.cdt.dsf.debug.service.IBreakpoints.IDsfBreakpointDMContext#getReference()
+ * @since 5.0
+ */
+ public String getReference() {
+ return fReference;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.dsf.datamodel.AbstractDMContext#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof MIBreakpointDMContext)) {
+ return false;
+ }
+ return baseEquals(obj) && (fReference.equals(((MIBreakpointDMContext) obj).fReference));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.dsf.datamodel.AbstractDMContext#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ return baseHashCode() + fReference.hashCode();
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return baseToString() + ".reference(" + fReference + ")"; //$NON-NLS-1$//$NON-NLS-2$*/
+ }
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
// AbstractDsfService
///////////////////////////////////////////////////////////////////////////
-
+
/**
* The service constructor
- *
+ *
* @param session The debugging session
*/
public MIBreakpoints(DsfSession session) {
@@ -362,18 +362,18 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
*/
private void doInitialize(final RequestMonitor rm) {
- // Get the services references
+ // Get the services references
fConnection = getServicesTracker().getService(ICommandControl.class);
fRunControl = getServicesTracker().getService(IMIRunControl.class);
fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
- // Register for the useful events
+ // Register for the useful events
getSession().addServiceEventListener(this, null);
// Register this service
- register(new String[] { IBreakpoints.class.getName(), IBreakpointsExtension.class.getName(), MIBreakpoints.class.getName() },
- new Hashtable<String, String>());
+ register(new String[] { IBreakpoints.class.getName(), IBreakpointsExtension.class.getName(),
+ MIBreakpoints.class.getName() }, new Hashtable<String, String>());
rm.done();
}
@@ -397,36 +397,37 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
}
///////////////////////////////////////////////////////////////////////////
- // IServiceEventListener
- ///////////////////////////////////////////////////////////////////////////
-
- /**
- * This method is left for API compatibility only.
- * @nooverride This method is not intended to be re-implemented or extended by clients.
- * @noreference This method is not intended to be referenced by clients.
- */
+ // IServiceEventListener
+ ///////////////////////////////////////////////////////////////////////////
+
+ /**
+ * This method is left for API compatibility only.
+ * @nooverride This method is not intended to be re-implemented or extended by clients.
+ * @noreference This method is not intended to be referenced by clients.
+ */
@DsfServiceEventHandler
public void eventDispatched(MIWatchpointScopeEvent e) {
- // When a watchpoint goes out of scope, it is automatically removed from
- // the back-end. To keep our internal state synchronized, we have to
- // remove it from our breakpoints map.
- IBreakpointsTargetDMContext bpContext = DMContexts.getAncestorOfType(e.getDMContext(), IBreakpointsTargetDMContext.class);
- if (bpContext != null) {
- Map<String, MIBreakpointDMData> contextBps = getBreakpointMap(bpContext);
- if (contextBps != null) {
- contextBps.remove(e.getNumber());
- }
- }
+ // When a watchpoint goes out of scope, it is automatically removed from
+ // the back-end. To keep our internal state synchronized, we have to
+ // remove it from our breakpoints map.
+ IBreakpointsTargetDMContext bpContext = DMContexts.getAncestorOfType(e.getDMContext(),
+ IBreakpointsTargetDMContext.class);
+ if (bpContext != null) {
+ Map<String, MIBreakpointDMData> contextBps = getBreakpointMap(bpContext);
+ if (contextBps != null) {
+ contextBps.remove(e.getNumber());
+ }
+ }
}
- /**
- * @since 1.1
- * @nooverride This method is not intended to be re-implemented or extended by clients.
- * @noreference This method is not intended to be referenced by clients.
- */
- @DsfServiceEventHandler
- public void eventDispatched(ICommandControlShutdownDMEvent e) {
- }
+ /**
+ * @since 1.1
+ * @nooverride This method is not intended to be re-implemented or extended by clients.
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ @DsfServiceEventHandler
+ public void eventDispatched(ICommandControlShutdownDMEvent e) {
+ }
///////////////////////////////////////////////////////////////////////////
// IBreakpoints interface
@@ -440,12 +441,13 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
* @see org.eclipse.cdt.dsf.debug.service.IBreakpoints#getBreakpoints(org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext, org.eclipse.cdt.dsf.concurrent.DataRequestMonitor)
*/
@Override
- public void getBreakpoints(final IBreakpointsTargetDMContext context, final DataRequestMonitor<IBreakpointDMContext[]> drm)
- {
+ public void getBreakpoints(final IBreakpointsTargetDMContext context,
+ final DataRequestMonitor<IBreakpointDMContext[]> drm) {
// Validate the context
if (context == null) {
- drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_EXECUTION_CONTEXT, null));
- drm.done();
+ drm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_EXECUTION_CONTEXT, null));
+ drm.done();
return;
}
@@ -454,30 +456,31 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
// In that case, return an empty list.
final Map<String, MIBreakpointDMData> breakpointContext = getBreakpointMap(context);
if (breakpointContext == null) {
- drm.setData(new IBreakpointDMContext[0]);
- drm.done();
+ drm.setData(new IBreakpointDMContext[0]);
+ drm.done();
return;
}
// Execute the command
fConnection.queueCommand(fCommandFactory.createMIBreakList(context),
- new DataRequestMonitor<MIBreakListInfo>(getExecutor(), drm) {
- @Override
- protected void handleSuccess() {
- // Refresh the breakpoints map and format the result
- breakpointContext.clear();
- MIBreakpoint[] breakpoints = getData().getMIBreakpoints();
- IBreakpointDMContext[] result = new IBreakpointDMContext[breakpoints.length];
- for (int i = 0; i < breakpoints.length; i++) {
- MIBreakpointDMData breakpoint = createMIBreakpointDMData(breakpoints[i]);
- String reference = breakpoint.getReference();
- result[i] = new MIBreakpointDMContext(MIBreakpoints.this, new IDMContext[] { context }, reference);
- breakpointContext.put(reference, breakpoint);
+ new DataRequestMonitor<MIBreakListInfo>(getExecutor(), drm) {
+ @Override
+ protected void handleSuccess() {
+ // Refresh the breakpoints map and format the result
+ breakpointContext.clear();
+ MIBreakpoint[] breakpoints = getData().getMIBreakpoints();
+ IBreakpointDMContext[] result = new IBreakpointDMContext[breakpoints.length];
+ for (int i = 0; i < breakpoints.length; i++) {
+ MIBreakpointDMData breakpoint = createMIBreakpointDMData(breakpoints[i]);
+ String reference = breakpoint.getReference();
+ result[i] = new MIBreakpointDMContext(MIBreakpoints.this, new IDMContext[] { context },
+ reference);
+ breakpointContext.put(reference, breakpoint);
+ }
+ drm.setData(result);
+ drm.done();
}
- drm.setData(result);
- drm.done();
- }
- });
+ });
}
//-------------------------------------------------------------------------
@@ -488,12 +491,12 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
* @see org.eclipse.cdt.dsf.debug.service.IBreakpoints#getBreakpointDMData(org.eclipse.cdt.dsf.debug.service.IBreakpoints.IDsfBreakpointDMContext, org.eclipse.cdt.dsf.concurrent.DataRequestMonitor)
*/
@Override
- public void getBreakpointDMData(IBreakpointDMContext dmc, DataRequestMonitor<IBreakpointDMData> drm)
- {
+ public void getBreakpointDMData(IBreakpointDMContext dmc, DataRequestMonitor<IBreakpointDMData> drm) {
// Validate the breakpoint context
if (dmc == null) {
- drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
- drm.done();
+ drm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
+ drm.done();
return;
}
@@ -501,26 +504,28 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
MIBreakpointDMContext breakpoint;
if (dmc instanceof MIBreakpointDMContext) {
breakpoint = (MIBreakpointDMContext) dmc;
- }
- else {
- drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_TYPE, null));
- drm.done();
+ } else {
+ drm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_TYPE, null));
+ drm.done();
return;
}
// Validate the target context
- IBreakpointsTargetDMContext context = DMContexts.getAncestorOfType(breakpoint, IBreakpointsTargetDMContext.class);
+ IBreakpointsTargetDMContext context = DMContexts.getAncestorOfType(breakpoint,
+ IBreakpointsTargetDMContext.class);
if (context == null) {
- drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_EXECUTION_CONTEXT, null));
- drm.done();
+ drm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_EXECUTION_CONTEXT, null));
+ drm.done();
return;
}
// Select the breakpoints context map
Map<String, MIBreakpointDMData> contextBreakpoints = getBreakpointMap(context);
if (contextBreakpoints == null) {
- drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT, null));
- drm.done();
+ drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT, null));
+ drm.done();
return;
}
@@ -539,12 +544,14 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
* @see org.eclipse.cdt.dsf.debug.service.IBreakpoints#insertBreakpoint(org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext, java.util.Map, org.eclipse.cdt.dsf.concurrent.DataRequestMonitor)
*/
@Override
- public void insertBreakpoint(IBreakpointsTargetDMContext context, Map<String, Object> attributes, DataRequestMonitor<IBreakpointDMContext> drm) {
-
+ public void insertBreakpoint(IBreakpointsTargetDMContext context, Map<String, Object> attributes,
+ DataRequestMonitor<IBreakpointDMContext> drm) {
+
// Validate the context
if (context == null) {
- drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_EXECUTION_CONTEXT, null));
- drm.done();
+ drm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_EXECUTION_CONTEXT, null));
+ drm.done();
return;
}
@@ -557,55 +564,52 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
// Validate the breakpoint type
String type = (String) attributes.get(BREAKPOINT_TYPE);
if (type == null) {
- drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_TYPE, null));
- drm.done();
- return;
+ drm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_TYPE, null));
+ drm.done();
+ return;
}
// And go...
if (type.equals(BREAKPOINT)) {
addBreakpoint(context, attributes, drm);
- }
- else if (type.equals(WATCHPOINT)) {
+ } else if (type.equals(WATCHPOINT)) {
addWatchpoint(context, attributes, drm);
- }
- else if (type.equals(MIBreakpoints.TRACEPOINT)) {
+ } else if (type.equals(MIBreakpoints.TRACEPOINT)) {
addTracepoint(context, attributes, drm);
- }
- else if (type.equals(MIBreakpoints.CATCHPOINT)) {
+ } else if (type.equals(MIBreakpoints.CATCHPOINT)) {
addCatchpoint(context, attributes, drm);
- }
- else if (type.equals(MIBreakpoints.DYNAMICPRINTF)) {
+ } else if (type.equals(MIBreakpoints.DYNAMICPRINTF)) {
addDynamicPrintf(context, attributes, drm);
- }
- else {
- drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_TYPE, null));
- drm.done();
+ } else {
+ drm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_TYPE, null));
+ drm.done();
}
}
/**
- * @since 3.0
- */
+ * @since 3.0
+ */
@Override
public void getExecutionContextBreakpoints(IExecutionDMContext ctx, DataRequestMonitor<IBreakpointDMContext[]> rm) {
- IBreakpointDMContext[] bps = fBreakpointHitMap.get(ctx);
- if (bps == null && ctx instanceof IContainerDMContext) {
- List<IBreakpointDMContext> bpsList = new ArrayList<IBreakpointDMContext>(1);
- for (Map.Entry<IExecutionDMContext, IBreakpointDMContext[]> entry : fBreakpointHitMap.entrySet()) {
-
- if (DMContexts.isAncestorOf(entry.getKey(), ctx)) {
- for (IBreakpointDMContext bp : entry.getValue()) {
- bpsList.add(bp);
- }
- }
- }
- bps = bpsList.toArray(new IBreakpointDMContext[bpsList.size()]);
- }
- rm.setData(bps != null ? bps : new IBreakpointDMContext[0]);
- rm.done();
+ IBreakpointDMContext[] bps = fBreakpointHitMap.get(ctx);
+ if (bps == null && ctx instanceof IContainerDMContext) {
+ List<IBreakpointDMContext> bpsList = new ArrayList<IBreakpointDMContext>(1);
+ for (Map.Entry<IExecutionDMContext, IBreakpointDMContext[]> entry : fBreakpointHitMap.entrySet()) {
+
+ if (DMContexts.isAncestorOf(entry.getKey(), ctx)) {
+ for (IBreakpointDMContext bp : entry.getValue()) {
+ bpsList.add(bp);
+ }
+ }
+ }
+ bps = bpsList.toArray(new IBreakpointDMContext[bpsList.size()]);
+ }
+ rm.setData(bps != null ? bps : new IBreakpointDMContext[0]);
+ rm.done();
}
-
+
/**
* @param map
* @param key
@@ -619,7 +623,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
/**
* Creates a gdb location string for a breakpoint/watchpoint/tracepoint
* given its set of properties.
- *
+ *
* @param attributes
* @return
* @since 3.0
@@ -627,16 +631,16 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
protected String formatLocation(Map<String, Object> attributes) {
// Unlikely default location
- String location = (String) getProperty(attributes, ADDRESS, NULL_STRING);
+ String location = (String) getProperty(attributes, ADDRESS, NULL_STRING);
// Get the relevant parameters
- String fileName = (String) getProperty(attributes, FILE_NAME, NULL_STRING);
+ String fileName = (String) getProperty(attributes, FILE_NAME, NULL_STRING);
Integer lineNumber = (Integer) getProperty(attributes, LINE_NUMBER, -1);
- String function = (String) getProperty(attributes, FUNCTION, NULL_STRING);
+ String function = (String) getProperty(attributes, FUNCTION, NULL_STRING);
// Fix for Bug264721
if (fileName.contains(" ")) { //$NON-NLS-1$
- fileName = "\"" + fileName + "\""; //$NON-NLS-1$//$NON-NLS-2$
+ fileName = "\"" + fileName + "\""; //$NON-NLS-1$//$NON-NLS-2$
}
// GDB seems inconsistent about allowing parentheses so we must remove them.
@@ -652,7 +656,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
if (!function.equals(NULL_STRING)) {
location = fileName + ":" + function; //$NON-NLS-1$
} else {
- location = fileName + ":" + lineNumber; //$NON-NLS-1$
+ location = fileName + ":" + lineNumber; //$NON-NLS-1$
}
} else if (!function.equals(NULL_STRING)) {
// function location without source
@@ -670,84 +674,93 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
/**
* Add a breakpoint of type BREAKPOINT
- *
+ *
* @param context
* @param breakpoint
* @param finalRm
- *
- * @since 3.0
+ *
+ * @since 3.0
*/
- protected void addBreakpoint(final IBreakpointsTargetDMContext context, final Map<String, Object> attributes, final DataRequestMonitor<IBreakpointDMContext> finalRm)
- {
+ protected void addBreakpoint(final IBreakpointsTargetDMContext context, final Map<String, Object> attributes,
+ final DataRequestMonitor<IBreakpointDMContext> finalRm) {
// Select the context breakpoints map
final Map<String, MIBreakpointDMData> contextBreakpoints = getBreakpointMap(context);
if (contextBreakpoints == null) {
- finalRm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
- finalRm.done();
+ finalRm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
+ finalRm.done();
return;
}
// Extract the relevant parameters (providing default values to avoid potential NPEs)
final String location = formatLocation(attributes);
if (location.equals(NULL_STRING)) {
- finalRm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
- finalRm.done();
+ finalRm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
+ finalRm.done();
return;
}
- final Boolean isTemporary = (Boolean) getProperty(attributes, MIBreakpointDMData.IS_TEMPORARY, false);
- final Boolean isHardware = (Boolean) getProperty(attributes, MIBreakpointDMData.IS_HARDWARE, false);
- final String condition = (String) getProperty(attributes, CONDITION, NULL_STRING);
- final Integer ignoreCount = (Integer) getProperty(attributes, IGNORE_COUNT, 0 );
- final String threadId = (String) getProperty(attributes, MIBreakpointDMData.THREAD_ID, "0"); //$NON-NLS-1$
-
- final Step insertBreakpointStep = new Step() {
- @Override
- public void execute(final RequestMonitor rm) {
- fConnection.queueCommand(
- fCommandFactory.createMIBreakInsert(context, isTemporary, isHardware, condition, ignoreCount, location, threadId),
- new DataRequestMonitor<MIBreakInsertInfo>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
-
- // With MI, an invalid location won't generate an error
- if (getData().getMIBreakpoints().length == 0) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, BREAKPOINT_INSERTION_FAILURE, null));
- rm.done();
- return;
- }
-
- // Create a breakpoint object and store it in the map
- final MIBreakpointDMData newBreakpoint = createMIBreakpointDMData(getData().getMIBreakpoints()[0]);
- String reference = newBreakpoint.getNumber();
- if (reference.isEmpty()) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, BREAKPOINT_INSERTION_FAILURE, null));
- rm.done();
- return;
- }
- contextBreakpoints.put(reference, newBreakpoint);
-
- // Format the return value
- MIBreakpointDMContext dmc = new MIBreakpointDMContext(MIBreakpoints.this, new IDMContext[] { context }, reference);
- finalRm.setData(dmc);
-
- // Flag the event
- getSession().dispatchEvent(new BreakpointAddedEvent(dmc), getProperties());
-
- // By default the breakpoint is enabled at creation
- // If it wasn't supposed to be, then disable it right away
- Map<String,Object> delta = new HashMap<String,Object>();
- delta.put(IS_ENABLED, getProperty(attributes, IS_ENABLED, true));
- modifyBreakpoint(dmc, delta, rm, false);
- }
+ final Boolean isTemporary = (Boolean) getProperty(attributes, MIBreakpointDMData.IS_TEMPORARY, false);
+ final Boolean isHardware = (Boolean) getProperty(attributes, MIBreakpointDMData.IS_HARDWARE, false);
+ final String condition = (String) getProperty(attributes, CONDITION, NULL_STRING);
+ final Integer ignoreCount = (Integer) getProperty(attributes, IGNORE_COUNT, 0);
+ final String threadId = (String) getProperty(attributes, MIBreakpointDMData.THREAD_ID, "0"); //$NON-NLS-1$
- @Override
- protected void handleError() {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, BREAKPOINT_INSERTION_FAILURE, getStatus().getException()));
- rm.done();
- }
- });
- }
+ final Step insertBreakpointStep = new Step() {
+ @Override
+ public void execute(final RequestMonitor rm) {
+ fConnection
+ .queueCommand(
+ fCommandFactory.createMIBreakInsert(context, isTemporary, isHardware, condition,
+ ignoreCount, location, threadId),
+ new DataRequestMonitor<MIBreakInsertInfo>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+
+ // With MI, an invalid location won't generate an error
+ if (getData().getMIBreakpoints().length == 0) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED,
+ BREAKPOINT_INSERTION_FAILURE, null));
+ rm.done();
+ return;
+ }
+
+ // Create a breakpoint object and store it in the map
+ final MIBreakpointDMData newBreakpoint = createMIBreakpointDMData(
+ getData().getMIBreakpoints()[0]);
+ String reference = newBreakpoint.getNumber();
+ if (reference.isEmpty()) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED,
+ BREAKPOINT_INSERTION_FAILURE, null));
+ rm.done();
+ return;
+ }
+ contextBreakpoints.put(reference, newBreakpoint);
+
+ // Format the return value
+ MIBreakpointDMContext dmc = new MIBreakpointDMContext(MIBreakpoints.this,
+ new IDMContext[] { context }, reference);
+ finalRm.setData(dmc);
+
+ // Flag the event
+ getSession().dispatchEvent(new BreakpointAddedEvent(dmc), getProperties());
+
+ // By default the breakpoint is enabled at creation
+ // If it wasn't supposed to be, then disable it right away
+ Map<String, Object> delta = new HashMap<String, Object>();
+ delta.put(IS_ENABLED, getProperty(attributes, IS_ENABLED, true));
+ modifyBreakpoint(dmc, delta, rm, false);
+ }
+
+ @Override
+ protected void handleError() {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED,
+ BREAKPOINT_INSERTION_FAILURE, getStatus().getException()));
+ rm.done();
+ }
+ });
+ }
};
fRunControl.executeWithTargetAvailable(context, new Step[] { insertBreakpointStep }, finalRm);
@@ -755,99 +768,106 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
/**
* Add a tracepoint. Currently not supported in this version, but only in our GDB 7.0 version.
- *
+ *
* @param context
* @param attributes
* @param drm
- *
+ *
* @since 3.0
*/
- protected void addTracepoint(final IBreakpointsTargetDMContext context, final Map<String, Object> attributes, final DataRequestMonitor<IBreakpointDMContext> drm) {
- // Not supported
- drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_TYPE, null));
+ protected void addTracepoint(final IBreakpointsTargetDMContext context, final Map<String, Object> attributes,
+ final DataRequestMonitor<IBreakpointDMContext> drm) {
+ // Not supported
+ drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_TYPE, null));
drm.done();
}
/**
* Add a breakpoint of type WATCHPOINT
- *
+ *
* @param context
* @param watchpoint
* @param drm
* @since 3.0
*/
- protected void addWatchpoint(final IBreakpointsTargetDMContext context, final Map<String, Object> attributes, final DataRequestMonitor<IBreakpointDMContext> drm)
- {
+ protected void addWatchpoint(final IBreakpointsTargetDMContext context, final Map<String, Object> attributes,
+ final DataRequestMonitor<IBreakpointDMContext> drm) {
// Pick the context breakpoints map
final Map<String, MIBreakpointDMData> contextBreakpoints = getBreakpointMap(context);
if (contextBreakpoints == null) {
- drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
- drm.done();
+ drm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
+ drm.done();
return;
}
// Extract the relevant parameters (providing default values to avoid potential NPEs)
- String expression = (String) getProperty(attributes, EXPRESSION, NULL_STRING);
- boolean isRead = (Boolean) getProperty(attributes, READ, false);
- boolean isWrite = (Boolean) getProperty(attributes, WRITE, false);
+ String expression = (String) getProperty(attributes, EXPRESSION, NULL_STRING);
+ boolean isRead = (Boolean) getProperty(attributes, READ, false);
+ boolean isWrite = (Boolean) getProperty(attributes, WRITE, false);
expression = adjustWatchPointExpression(attributes, expression);
// The DataRequestMonitor for the add request
- DataRequestMonitor<MIBreakInsertInfo> addWatchpointDRM =
- new DataRequestMonitor<MIBreakInsertInfo>(getExecutor(), drm) {
- @Override
- protected void handleSuccess() {
-
- // With MI, an invalid location won't generate an error
- if (getData().getMIBreakpoints().length == 0) {
- drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, WATCHPOINT_INSERTION_FAILURE, null));
- drm.done();
- return;
- }
-
- // Create a breakpoint object and store it in the map
- final MIBreakpointDMData newBreakpoint = createMIBreakpointDMData(getData().getMIBreakpoints()[0]);
- String reference = newBreakpoint.getNumber();
- if (reference.isEmpty()) {
- drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, WATCHPOINT_INSERTION_FAILURE, null));
- drm.done();
- return;
- }
- contextBreakpoints.put(reference, newBreakpoint);
-
- // Format the return value
- IBreakpointDMContext dmc = new MIBreakpointDMContext(MIBreakpoints.this, new IDMContext[] { context }, reference);
- drm.setData(dmc);
-
- // Flag the event
- getSession().dispatchEvent(new BreakpointAddedEvent(dmc), getProperties());
-
- // Condition, ignore count and state can not be specified at watchpoint creation time.
- // Therefore, we have to update the watchpoint if any of these is present
- Map<String,Object> delta = new HashMap<String,Object>();
- delta.put(CONDITION, getProperty(attributes, CONDITION, NULL_STRING));
- delta.put(IGNORE_COUNT, getProperty(attributes, IGNORE_COUNT, 0 ));
- delta.put(IS_ENABLED, getProperty(attributes, IS_ENABLED, true));
- modifyBreakpoint(dmc, delta, drm, false);
+ DataRequestMonitor<MIBreakInsertInfo> addWatchpointDRM = new DataRequestMonitor<MIBreakInsertInfo>(
+ getExecutor(), drm) {
+ @Override
+ protected void handleSuccess() {
+
+ // With MI, an invalid location won't generate an error
+ if (getData().getMIBreakpoints().length == 0) {
+ drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED,
+ WATCHPOINT_INSERTION_FAILURE, null));
+ drm.done();
+ return;
}
- @Override
- protected void handleError() {
- drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, WATCHPOINT_INSERTION_FAILURE, getStatus().getException()));
- drm.done();
+ // Create a breakpoint object and store it in the map
+ final MIBreakpointDMData newBreakpoint = createMIBreakpointDMData(getData().getMIBreakpoints()[0]);
+ String reference = newBreakpoint.getNumber();
+ if (reference.isEmpty()) {
+ drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED,
+ WATCHPOINT_INSERTION_FAILURE, null));
+ drm.done();
+ return;
}
- };
+ contextBreakpoints.put(reference, newBreakpoint);
+
+ // Format the return value
+ IBreakpointDMContext dmc = new MIBreakpointDMContext(MIBreakpoints.this, new IDMContext[] { context },
+ reference);
+ drm.setData(dmc);
+
+ // Flag the event
+ getSession().dispatchEvent(new BreakpointAddedEvent(dmc), getProperties());
+
+ // Condition, ignore count and state can not be specified at watchpoint creation time.
+ // Therefore, we have to update the watchpoint if any of these is present
+ Map<String, Object> delta = new HashMap<String, Object>();
+ delta.put(CONDITION, getProperty(attributes, CONDITION, NULL_STRING));
+ delta.put(IGNORE_COUNT, getProperty(attributes, IGNORE_COUNT, 0));
+ delta.put(IS_ENABLED, getProperty(attributes, IS_ENABLED, true));
+ modifyBreakpoint(dmc, delta, drm, false);
+ }
+
+ @Override
+ protected void handleError() {
+ drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED,
+ WATCHPOINT_INSERTION_FAILURE, getStatus().getException()));
+ drm.done();
+ }
+ };
- // Execute the command
- fConnection.queueCommand(fCommandFactory.createMIBreakWatch(context, isRead, isWrite, expression), addWatchpointDRM);
+ // Execute the command
+ fConnection.queueCommand(fCommandFactory.createMIBreakWatch(context, isRead, isWrite, expression),
+ addWatchpointDRM);
}
/**
* Adjust the expression to a format suitable for the debugger back end e.g. adding memory space, range,
* etc..
- *
+ *
* @since 5.3
*/
protected String adjustWatchPointExpression(final Map<String, Object> attributes, String origExpression) {
@@ -862,29 +882,31 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
/**
* @since 3.0
*/
- protected void addCatchpoint(final IBreakpointsTargetDMContext context, final Map<String, Object> attributes, final DataRequestMonitor<IBreakpointDMContext> finalRm) {
+ protected void addCatchpoint(final IBreakpointsTargetDMContext context, final Map<String, Object> attributes,
+ final DataRequestMonitor<IBreakpointDMContext> finalRm) {
// Select the context breakpoints map
final Map<String, MIBreakpointDMData> contextBreakpoints = getBreakpointMap(context);
if (contextBreakpoints == null) {
- finalRm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
- finalRm.done();
+ finalRm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
+ finalRm.done();
return;
}
// Though CDT allows setting a temporary catchpoint, CDT never makes use of it
- assert !(Boolean)getProperty(attributes, MIBreakpointDMData.IS_TEMPORARY, false);
+ assert !(Boolean) getProperty(attributes, MIBreakpointDMData.IS_TEMPORARY, false);
// GDB has no support for hardware catchpoints
- assert !(Boolean)getProperty(attributes, MIBreakpointDMData.IS_HARDWARE, false);
+ assert !(Boolean) getProperty(attributes, MIBreakpointDMData.IS_HARDWARE, false);
final String event = (String) getProperty(attributes, CATCHPOINT_TYPE, NULL_STRING);
final String[] args = (String[]) getProperty(attributes, CATCHPOINT_ARGS, null);
- final Step insertBreakpointStep = new Step() {
- @Override
- public void execute(final RequestMonitor rm) {
- fConnection.queueCommand(
- fCommandFactory.createCLICatch(context, event, args == null ? new String[0] : args),
+ final Step insertBreakpointStep = new Step() {
+ @Override
+ public void execute(final RequestMonitor rm) {
+ fConnection.queueCommand(
+ fCommandFactory.createCLICatch(context, event, args == null ? new String[0] : args),
new DataRequestMonitor<CLICatchInfo>(getExecutor(), rm) {
@Override
protected void handleSuccess() {
@@ -892,7 +914,8 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
// Sanity check
MIBreakpoint miBkpt = getData().getMIBreakpoint();
if (miBkpt == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, CATCHPOINT_INSERTION_FAILURE, null));
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED,
+ CATCHPOINT_INSERTION_FAILURE, null));
rm.done();
return;
}
@@ -901,35 +924,38 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
final MIBreakpointDMData newBreakpoint = createMIBreakpointDMData(miBkpt);
String reference = newBreakpoint.getNumber();
if (reference.isEmpty()) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, CATCHPOINT_INSERTION_FAILURE, null));
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED,
+ CATCHPOINT_INSERTION_FAILURE, null));
rm.done();
return;
}
contextBreakpoints.put(reference, newBreakpoint);
// Format the return value
- MIBreakpointDMContext dmc = new MIBreakpointDMContext(MIBreakpoints.this, new IDMContext[] { context }, reference);
+ MIBreakpointDMContext dmc = new MIBreakpointDMContext(MIBreakpoints.this,
+ new IDMContext[] { context }, reference);
finalRm.setData(dmc);
// Flag the event
getSession().dispatchEvent(new BreakpointAddedEvent(dmc), getProperties());
- // Condition, ignore count and state cannot be specified at creation time.
- // Therefore, we have to update the catchpoint if any of these is present
- Map<String,Object> delta = new HashMap<String,Object>();
- delta.put(CONDITION, getProperty(attributes, CONDITION, NULL_STRING));
- delta.put(IGNORE_COUNT, getProperty(attributes, IGNORE_COUNT, 0 ));
- delta.put(IS_ENABLED, getProperty(attributes, IS_ENABLED, true));
- modifyBreakpoint(dmc, delta, rm, false);
+ // Condition, ignore count and state cannot be specified at creation time.
+ // Therefore, we have to update the catchpoint if any of these is present
+ Map<String, Object> delta = new HashMap<String, Object>();
+ delta.put(CONDITION, getProperty(attributes, CONDITION, NULL_STRING));
+ delta.put(IGNORE_COUNT, getProperty(attributes, IGNORE_COUNT, 0));
+ delta.put(IS_ENABLED, getProperty(attributes, IS_ENABLED, true));
+ modifyBreakpoint(dmc, delta, rm, false);
}
@Override
protected void handleError() {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, CATCHPOINT_INSERTION_FAILURE, getStatus().getException()));
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED,
+ CATCHPOINT_INSERTION_FAILURE, getStatus().getException()));
rm.done();
}
});
- }
+ }
};
fRunControl.executeWithTargetAvailable(context, new Step[] { insertBreakpointStep }, finalRm);
@@ -937,7 +963,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
/**
* Add a DynamicPrintf. Currently not supported in this version, but only in the GDB 7.7 version.
- *
+ *
* @since 4.4
*/
protected void addDynamicPrintf(final IBreakpointsTargetDMContext context, final Map<String, Object> attributes,
@@ -960,7 +986,8 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
// Validate the breakpoint context
if (dmc == null) {
- finalRm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
+ finalRm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
finalRm.done();
return;
}
@@ -969,23 +996,25 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
MIBreakpointDMContext breakpointCtx;
if (dmc instanceof MIBreakpointDMContext) {
breakpointCtx = (MIBreakpointDMContext) dmc;
- }
- else {
- finalRm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_TYPE, null));
- finalRm.done();
+ } else {
+ finalRm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_TYPE, null));
+ finalRm.done();
return;
}
-
+
// Validate the target context
- final IBreakpointsTargetDMContext context = DMContexts.getAncestorOfType(dmc, IBreakpointsTargetDMContext.class);
+ final IBreakpointsTargetDMContext context = DMContexts.getAncestorOfType(dmc,
+ IBreakpointsTargetDMContext.class);
if (context == null) {
- finalRm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_EXECUTION_CONTEXT, null));
+ finalRm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_EXECUTION_CONTEXT, null));
finalRm.done();
return;
}
// Pick the context breakpoints map
- final Map<String,MIBreakpointDMData> contextBreakpoints = getBreakpointMap(context);
+ final Map<String, MIBreakpointDMData> contextBreakpoints = getBreakpointMap(context);
if (contextBreakpoints == null) {
finalRm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT, null));
finalRm.done();
@@ -1021,12 +1050,12 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
* @see org.eclipse.cdt.dsf.debug.service.IBreakpoints#updateBreakpoint(org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointDMContext, java.util.Map, org.eclipse.cdt.dsf.concurrent.RequestMonitor)
*/
@Override
- public void updateBreakpoint(IBreakpointDMContext dmc, Map<String, Object> properties, RequestMonitor rm)
- {
+ public void updateBreakpoint(IBreakpointDMContext dmc, Map<String, Object> properties, RequestMonitor rm) {
// Validate the breakpoint context
if (dmc == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
- rm.done();
+ rm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
+ rm.done();
return;
}
@@ -1034,26 +1063,26 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
MIBreakpointDMContext breakpointCtx;
if (dmc instanceof MIBreakpointDMContext) {
breakpointCtx = (MIBreakpointDMContext) dmc;
- }
- else {
+ } else {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_TYPE, null));
rm.done();
return;
}
// Validate the context
- IBreakpointsTargetDMContext context = DMContexts.getAncestorOfType(dmc, IBreakpointsTargetDMContext.class);
+ IBreakpointsTargetDMContext context = DMContexts.getAncestorOfType(dmc, IBreakpointsTargetDMContext.class);
if (context == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_EXECUTION_CONTEXT, null));
- rm.done();
+ rm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_EXECUTION_CONTEXT, null));
+ rm.done();
return;
}
// Pick the context breakpoints map
final Map<String, MIBreakpointDMData> contextBreakpoints = getBreakpointMap(context);
if (contextBreakpoints == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT, null));
- rm.done();
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT, null));
+ rm.done();
return;
}
@@ -1061,12 +1090,12 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
final String reference = breakpointCtx.getReference();
MIBreakpointDMData breakpoint = contextBreakpoints.get(reference);
if (breakpoint == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT, null));
- rm.done();
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT, null));
+ rm.done();
return;
}
- modifyBreakpoint(dmc, properties, rm, true);
+ modifyBreakpoint(dmc, properties, rm, true);
}
/**
@@ -1074,35 +1103,35 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
* @param properties
* @param rm
* @param generateUpdateEvent
- *
+ *
* @since 3.0
*/
- protected void modifyBreakpoint(final IBreakpointDMContext dmc, Map<String, Object> attributes, final RequestMonitor rm, final boolean generateUpdateEvent)
- {
+ protected void modifyBreakpoint(final IBreakpointDMContext dmc, Map<String, Object> attributes,
+ final RequestMonitor rm, final boolean generateUpdateEvent) {
// Use a working copy of the attributes since we are going to tamper happily with them
Map<String, Object> properties = new HashMap<String, Object>(attributes);
-
+
// Retrieve the breakpoint parameters
// At this point, we know their are OK so there is no need to re-validate
MIBreakpointDMContext breakpointCtx = (MIBreakpointDMContext) dmc;
- IBreakpointsTargetDMContext context = DMContexts.getAncestorOfType(dmc, IBreakpointsTargetDMContext.class);
+ IBreakpointsTargetDMContext context = DMContexts.getAncestorOfType(dmc, IBreakpointsTargetDMContext.class);
final Map<String, MIBreakpointDMData> contextBreakpoints = getBreakpointMap(context);
final String reference = breakpointCtx.getReference();
MIBreakpointDMData breakpoint = contextBreakpoints.get(reference);
// Track the number of change requests
int numberOfChanges = 0;
- final CountingRequestMonitor countingRm = new CountingRequestMonitor(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- if (generateUpdateEvent) {
- getSession().dispatchEvent(new BreakpointUpdatedEvent(dmc), getProperties());
- }
- rm.done();
- }
- };
-
- // Determine if the breakpoint condition changed
+ final CountingRequestMonitor countingRm = new CountingRequestMonitor(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ if (generateUpdateEvent) {
+ getSession().dispatchEvent(new BreakpointUpdatedEvent(dmc), getProperties());
+ }
+ rm.done();
+ }
+ };
+
+ // Determine if the breakpoint condition changed
String conditionAttribute = CONDITION;
if (properties.containsKey(conditionAttribute)) {
String oldValue = breakpoint.getCondition();
@@ -1110,14 +1139,14 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
if (newValue == null) {
newValue = NULL_STRING;
}
- if (!oldValue.equals(newValue)) {
- changeCondition(context, reference, newValue, countingRm);
- numberOfChanges++;
- }
+ if (!oldValue.equals(newValue)) {
+ changeCondition(context, reference, newValue, countingRm);
+ numberOfChanges++;
+ }
properties.remove(conditionAttribute);
}
- // Determine if the breakpoint ignore count changed
+ // Determine if the breakpoint ignore count changed
String ignoreCountAttribute = IGNORE_COUNT;
if (properties.containsKey(ignoreCountAttribute)) {
Integer oldValue = breakpoint.getIgnoreCount();
@@ -1125,14 +1154,14 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
if (newValue == null) {
newValue = 0;
}
- if (!oldValue.equals(newValue)) {
- changeIgnoreCount(context, reference, newValue, countingRm);
- numberOfChanges++;
- }
+ if (!oldValue.equals(newValue)) {
+ changeIgnoreCount(context, reference, newValue, countingRm);
+ numberOfChanges++;
+ }
properties.remove(ignoreCountAttribute);
}
- // Determine if the breakpoint state changed
+ // Determine if the breakpoint state changed
String enableAttribute = IS_ENABLED;
if (properties.containsKey(enableAttribute)) {
Boolean oldValue = breakpoint.isEnabled();
@@ -1140,113 +1169,114 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
if (newValue == null) {
newValue = false;
}
- if (!oldValue.equals(newValue)) {
- numberOfChanges++;
+ if (!oldValue.equals(newValue)) {
+ numberOfChanges++;
if (newValue) {
enableBreakpoint(context, reference, countingRm);
} else {
disableBreakpoint(context, reference, countingRm);
}
- }
+ }
properties.remove(enableAttribute);
}
// Set the number of completions required
- countingRm.setDoneCount(numberOfChanges);
+ countingRm.setDoneCount(numberOfChanges);
}
/**
* Update the breakpoint condition
- *
+ *
* @param context
* @param dmc
* @param condition
* @param finalRm
- *
+ *
* @since 5.0
*/
- protected void changeCondition(final IBreakpointsTargetDMContext context,
- final String reference, final String condition, final RequestMonitor finalRm)
- {
+ protected void changeCondition(final IBreakpointsTargetDMContext context, final String reference,
+ final String condition, final RequestMonitor finalRm) {
// Pick the context breakpoints map
final Map<String, MIBreakpointDMData> contextBreakpoints = getBreakpointMap(context);
if (contextBreakpoints == null) {
- finalRm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
- finalRm.done();
+ finalRm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
+ finalRm.done();
return;
}
- final Step changeConditionStep = new Step() {
- @Override
- public void execute(final RequestMonitor rm) {
- // Queue the command
- fConnection.queueCommand(
- fCommandFactory.createMIBreakCondition(context, reference, condition),
- new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- MIBreakpointDMData breakpoint = contextBreakpoints.get(reference);
- if (breakpoint == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT, null));
- rm.done();
- return;
- }
- breakpoint.setCondition(condition);
- rm.done();
- }
-
- // In case of error (new condition could not be installed for whatever reason),
- // GDB "offers" different behaviours depending on its version: it can either keep
- // the original condition (the right thing to do) or keep the invalid condition.
- // Our sole option is to remove the condition in case of error and rely on the
- // upper layer to re-install the right condition.
- @Override
- protected void handleError() {
- MIBreakpointDMData breakpoint = contextBreakpoints.get(reference);
- if (breakpoint == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT, null));
- rm.done();
- return;
- }
- // Remove invalid condition from the back-end breakpoint
- breakpoint.setCondition(NULL_STRING);
- fConnection.queueCommand(
- fCommandFactory.createMIBreakCondition(context, reference, NULL_STRING),
- new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
- @Override
- // The report the initial problem
- protected void handleCompleted() {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, INVALID_CONDITION, null));
- rm.done();
- }
- });
- }
- });
- }
- };
-
- fRunControl.executeWithTargetAvailable(context, new Step[] { changeConditionStep }, finalRm);
- }
+ final Step changeConditionStep = new Step() {
+ @Override
+ public void execute(final RequestMonitor rm) {
+ // Queue the command
+ fConnection.queueCommand(fCommandFactory.createMIBreakCondition(context, reference, condition),
+ new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ MIBreakpointDMData breakpoint = contextBreakpoints.get(reference);
+ if (breakpoint == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED,
+ UNKNOWN_BREAKPOINT, null));
+ rm.done();
+ return;
+ }
+ breakpoint.setCondition(condition);
+ rm.done();
+ }
+
+ // In case of error (new condition could not be installed for whatever reason),
+ // GDB "offers" different behaviours depending on its version: it can either keep
+ // the original condition (the right thing to do) or keep the invalid condition.
+ // Our sole option is to remove the condition in case of error and rely on the
+ // upper layer to re-install the right condition.
+ @Override
+ protected void handleError() {
+ MIBreakpointDMData breakpoint = contextBreakpoints.get(reference);
+ if (breakpoint == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED,
+ UNKNOWN_BREAKPOINT, null));
+ rm.done();
+ return;
+ }
+ // Remove invalid condition from the back-end breakpoint
+ breakpoint.setCondition(NULL_STRING);
+ fConnection.queueCommand(
+ fCommandFactory.createMIBreakCondition(context, reference, NULL_STRING),
+ new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
+ @Override
+ // The report the initial problem
+ protected void handleCompleted() {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
+ REQUEST_FAILED, INVALID_CONDITION, null));
+ rm.done();
+ }
+ });
+ }
+ });
+ }
+ };
+ fRunControl.executeWithTargetAvailable(context, new Step[] { changeConditionStep }, finalRm);
+ }
/**
* Update the breakpoint ignoreCount
- *
+ *
* @param context
* @param reference
* @param ignoreCount
* @param finalRm
- *
+ *
* @since 5.0
*/
- protected void changeIgnoreCount(final IBreakpointsTargetDMContext context,
- final String reference, final int ignoreCount, final RequestMonitor finalRm)
- {
+ protected void changeIgnoreCount(final IBreakpointsTargetDMContext context, final String reference,
+ final int ignoreCount, final RequestMonitor finalRm) {
// Pick the context breakpoints map
final Map<String, MIBreakpointDMData> contextBreakpoints = getBreakpointMap(context);
if (contextBreakpoints == null) {
- finalRm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
- finalRm.done();
+ finalRm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
+ finalRm.done();
return;
}
@@ -1254,14 +1284,14 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
@Override
public void execute(final RequestMonitor rm) {
// Queue the command
- fConnection.queueCommand(
- fCommandFactory.createMIBreakAfter(context, reference, ignoreCount),
+ fConnection.queueCommand(fCommandFactory.createMIBreakAfter(context, reference, ignoreCount),
new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
@Override
protected void handleSuccess() {
MIBreakpointDMData breakpoint = contextBreakpoints.get(reference);
if (breakpoint == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT, null));
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED,
+ UNKNOWN_BREAKPOINT, null));
rm.done();
return;
}
@@ -1277,91 +1307,91 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
/**
* Enable the breakpoint
- *
+ *
* @param context
* @param reference
* @param finalRm
- *
+ *
* @since 5.0
*/
- protected void enableBreakpoint(final IBreakpointsTargetDMContext context,
- final String reference, final RequestMonitor finalRm)
- {
+ protected void enableBreakpoint(final IBreakpointsTargetDMContext context, final String reference,
+ final RequestMonitor finalRm) {
// Pick the context breakpoints map
final Map<String, MIBreakpointDMData> contextBreakpoints = getBreakpointMap(context);
if (contextBreakpoints == null) {
- finalRm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
- finalRm.done();
+ finalRm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
+ finalRm.done();
return;
}
- final Step enableBreakpointStep = new Step() {
- @Override
- public void execute(final RequestMonitor rm) {
- // Queue the command
- fConnection.queueCommand(
- fCommandFactory.createMIBreakEnable(context, new String[] { reference }),
- new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- MIBreakpointDMData breakpoint = contextBreakpoints.get(reference);
- if (breakpoint == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT, null));
- rm.done();
- return;
- }
- breakpoint.setEnabled(true);
- rm.done();
- }
- });
- }
- };
-
+ final Step enableBreakpointStep = new Step() {
+ @Override
+ public void execute(final RequestMonitor rm) {
+ // Queue the command
+ fConnection.queueCommand(fCommandFactory.createMIBreakEnable(context, new String[] { reference }),
+ new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ MIBreakpointDMData breakpoint = contextBreakpoints.get(reference);
+ if (breakpoint == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED,
+ UNKNOWN_BREAKPOINT, null));
+ rm.done();
+ return;
+ }
+ breakpoint.setEnabled(true);
+ rm.done();
+ }
+ });
+ }
+ };
+
fRunControl.executeWithTargetAvailable(context, new Step[] { enableBreakpointStep }, finalRm);
}
/**
* Disable the breakpoint
- *
+ *
* @param context
* @param dmc
* @param finalRm
- *
+ *
* @since 5.0
*/
- protected void disableBreakpoint(final IBreakpointsTargetDMContext context,
- final String reference, final RequestMonitor finalRm)
- {
+ protected void disableBreakpoint(final IBreakpointsTargetDMContext context, final String reference,
+ final RequestMonitor finalRm) {
// Pick the context breakpoints map
final Map<String, MIBreakpointDMData> contextBreakpoints = getBreakpointMap(context);
if (contextBreakpoints == null) {
- finalRm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
- finalRm.done();
+ finalRm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
+ finalRm.done();
return;
}
- final Step disableBreakpointStep = new Step() {
- @Override
- public void execute(final RequestMonitor rm) {
- // Queue the command
- fConnection.queueCommand(
- fCommandFactory.createMIBreakDisable(context, new String[] { reference }),
- new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- MIBreakpointDMData breakpoint = contextBreakpoints.get(reference);
- if (breakpoint == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT, null));
- rm.done();
- return;
- }
- breakpoint.setEnabled(false);
- rm.done();
- }
- });
- }
- };
-
+ final Step disableBreakpointStep = new Step() {
+ @Override
+ public void execute(final RequestMonitor rm) {
+ // Queue the command
+ fConnection.queueCommand(fCommandFactory.createMIBreakDisable(context, new String[] { reference }),
+ new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ MIBreakpointDMData breakpoint = contextBreakpoints.get(reference);
+ if (breakpoint == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED,
+ UNKNOWN_BREAKPOINT, null));
+ rm.done();
+ return;
+ }
+ breakpoint.setEnabled(false);
+ rm.done();
+ }
+ });
+ }
+ };
+
fRunControl.executeWithTargetAvailable(context, new Step[] { disableBreakpointStep }, finalRm);
}
@@ -1369,89 +1399,90 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
* This method deletes the target breakpoint with the given reference number.
* @since 5.0
*/
- protected void deleteBreakpointFromTarget(final IBreakpointsTargetDMContext context, final String reference, RequestMonitor finalRm) {
- final Step deleteBreakpointStep = new Step() {
- @Override
- public void execute(final RequestMonitor rm) {
- // Queue the command
- fConnection.queueCommand(
- fCommandFactory.createMIBreakDelete(context, new String[] { reference }),
- new DataRequestMonitor<MIInfo>(getExecutor(), rm));
- }
- };
-
+ protected void deleteBreakpointFromTarget(final IBreakpointsTargetDMContext context, final String reference,
+ RequestMonitor finalRm) {
+ final Step deleteBreakpointStep = new Step() {
+ @Override
+ public void execute(final RequestMonitor rm) {
+ // Queue the command
+ fConnection.queueCommand(fCommandFactory.createMIBreakDelete(context, new String[] { reference }),
+ new DataRequestMonitor<MIInfo>(getExecutor(), rm));
+ }
+ };
+
fRunControl.executeWithTargetAvailable(context, new Step[] { deleteBreakpointStep }, finalRm);
}
- /**
- * @nooverride This method is not intended to be re-implemented or extended by clients.
- * @noreference This method is not intended to be referenced by clients.
- */
- @DsfServiceEventHandler
- public void eventDispatched(IBreakpointHitDMEvent e) {
- if (e instanceof IContainerSuspendedDMEvent) {
- IExecutionDMContext[] triggeringContexts = ((IContainerSuspendedDMEvent)e).getTriggeringContexts();
- if (triggeringContexts != null) {
- for (IExecutionDMContext ctx : triggeringContexts) {
- fBreakpointHitMap.put(ctx, e.getBreakpoints());
- }
- } else {
- fBreakpointHitMap.put(e.getDMContext(), e.getBreakpoints());
- }
- } else {
- fBreakpointHitMap.put(e.getDMContext(), e.getBreakpoints());
- }
- }
-
- /**
- * @nooverride This method is not intended to be re-implemented or extended by clients.
- * @noreference This method is not intended to be referenced by clients.
- */
- @DsfServiceEventHandler
- public void eventDispatched(IResumedDMEvent e) {
- if (e instanceof IContainerResumedDMEvent) {
- clearBreakpointHitForContainer((IContainerDMContext)e.getDMContext());
- } else {
- fBreakpointHitMap.remove(e.getDMContext());
- }
- }
-
- /**
- * Event handler when a thread is destroyed
- * @nooverride This method is not intended to be re-implemented or extended by clients.
- * @noreference This method is not intended to be referenced by clients.
- */
- @DsfServiceEventHandler
- public void eventDispatched(IExitedDMEvent e) {
- if (e.getDMContext() instanceof IContainerDMContext) {
- clearBreakpointHitForContainer((IContainerDMContext)e.getDMContext());
- } else {
- fBreakpointHitMap.remove(e.getDMContext());
- }
- }
-
- private void clearBreakpointHitForContainer(IContainerDMContext container) {
- for (Iterator<Map.Entry<IExecutionDMContext, IBreakpointDMContext[]>> itr = fBreakpointHitMap.entrySet().iterator(); itr.hasNext();) {
- if (DMContexts.isAncestorOf(itr.next().getKey(), container)) {
- itr.remove();
- }
- }
- fBreakpointHitMap.remove(container);
- }
-
- /**
- * Returns a breakpoint target context for given breakpoint number.
+ /**
+ * @nooverride This method is not intended to be re-implemented or extended by clients.
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ @DsfServiceEventHandler
+ public void eventDispatched(IBreakpointHitDMEvent e) {
+ if (e instanceof IContainerSuspendedDMEvent) {
+ IExecutionDMContext[] triggeringContexts = ((IContainerSuspendedDMEvent) e).getTriggeringContexts();
+ if (triggeringContexts != null) {
+ for (IExecutionDMContext ctx : triggeringContexts) {
+ fBreakpointHitMap.put(ctx, e.getBreakpoints());
+ }
+ } else {
+ fBreakpointHitMap.put(e.getDMContext(), e.getBreakpoints());
+ }
+ } else {
+ fBreakpointHitMap.put(e.getDMContext(), e.getBreakpoints());
+ }
+ }
+
+ /**
+ * @nooverride This method is not intended to be re-implemented or extended by clients.
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ @DsfServiceEventHandler
+ public void eventDispatched(IResumedDMEvent e) {
+ if (e instanceof IContainerResumedDMEvent) {
+ clearBreakpointHitForContainer((IContainerDMContext) e.getDMContext());
+ } else {
+ fBreakpointHitMap.remove(e.getDMContext());
+ }
+ }
+
+ /**
+ * Event handler when a thread is destroyed
+ * @nooverride This method is not intended to be re-implemented or extended by clients.
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ @DsfServiceEventHandler
+ public void eventDispatched(IExitedDMEvent e) {
+ if (e.getDMContext() instanceof IContainerDMContext) {
+ clearBreakpointHitForContainer((IContainerDMContext) e.getDMContext());
+ } else {
+ fBreakpointHitMap.remove(e.getDMContext());
+ }
+ }
+
+ private void clearBreakpointHitForContainer(IContainerDMContext container) {
+ for (Iterator<Map.Entry<IExecutionDMContext, IBreakpointDMContext[]>> itr = fBreakpointHitMap.entrySet()
+ .iterator(); itr.hasNext();) {
+ if (DMContexts.isAncestorOf(itr.next().getKey(), container)) {
+ itr.remove();
+ }
+ }
+ fBreakpointHitMap.remove(container);
+ }
+
+ /**
+ * Returns a breakpoint target context for given breakpoint number.
* @since 5.0
*/
- protected IBreakpointsTargetDMContext getBreakpointTargetContext(String reference) {
- for (IBreakpointsTargetDMContext context : fBreakpoints.keySet()) {
- Map<String, MIBreakpointDMData> map = fBreakpoints.get(context);
- if (map != null && map.keySet().contains(reference)) {
- return context;
- }
- }
- return null;
- }
+ protected IBreakpointsTargetDMContext getBreakpointTargetContext(String reference) {
+ for (IBreakpointsTargetDMContext context : fBreakpoints.keySet()) {
+ Map<String, MIBreakpointDMData> map = fBreakpoints.get(context);
+ if (map != null && map.keySet().contains(reference)) {
+ return context;
+ }
+ }
+ return null;
+ }
/**
* See https://bugs.eclipse.org/bugs/show_bug.cgi?id=232415
@@ -1461,14 +1492,14 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
*/
@Override
public String adjustDebuggerPath(String originalPath) {
- String result = originalPath;
- // Make it MinGW-specific
- if (Platform.getOS().startsWith("win")) { //$NON-NLS-1$
- if (!originalPath.startsWith("/")) { //$NON-NLS-1$
- originalPath = originalPath.replace('\\', '/');
- result = originalPath.substring(originalPath.lastIndexOf('/') + 1);
- }
- }
- return result;
+ String result = originalPath;
+ // Make it MinGW-specific
+ if (Platform.getOS().startsWith("win")) { //$NON-NLS-1$
+ if (!originalPath.startsWith("/")) { //$NON-NLS-1$
+ originalPath = originalPath.replace('\\', '/');
+ result = originalPath.substring(originalPath.lastIndexOf('/') + 1);
+ }
+ }
+ return result;
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java
index 0dfdfc9216a..2e613488674 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java
@@ -117,56 +117,56 @@ import com.ibm.icu.text.MessageFormat;
/**
* Breakpoint service interface. The breakpoint service tracks CDT breakpoint
* objects, and based on those, it manages breakpoints in the debugger back end.
- *
+ *
* It relies on MIBreakpoints for the actual back-end interface.
*/
-public class MIBreakpointsManager extends AbstractDsfService implements IBreakpointManagerListener, IBreakpointListener
-{
- /**
- * A listener is notified by {@link MIBreakpointsManager} when
- * the breakpoints tracking starts or stops.
- * @since 4.2
- */
- public interface IMIBreakpointsTrackingListener {
-
- public void breakpointTrackingStarted(IBreakpointsTargetDMContext bpTargetDMC);
-
- public void breakpointTrackingStopped(IBreakpointsTargetDMContext bpTargetDMC);
+public class MIBreakpointsManager extends AbstractDsfService
+ implements IBreakpointManagerListener, IBreakpointListener {
+ /**
+ * A listener is notified by {@link MIBreakpointsManager} when
+ * the breakpoints tracking starts or stops.
+ * @since 4.2
+ */
+ public interface IMIBreakpointsTrackingListener {
+
+ public void breakpointTrackingStarted(IBreakpointsTargetDMContext bpTargetDMC);
+
+ public void breakpointTrackingStopped(IBreakpointsTargetDMContext bpTargetDMC);
}
// Note: Find a way to import this (careful of circular dependencies)
- public static final String GDB_DEBUG_MODEL_ID = "org.eclipse.cdt.dsf.gdb"; //$NON-NLS-1$
-
- // Extra breakpoint attributes
- private static final String ATTR_DEBUGGER_PATH = GdbPlugin.PLUGIN_ID + ".debuggerPath"; //$NON-NLS-1$
- private static final String ATTR_THREAD_FILTER = GdbPlugin.PLUGIN_ID + ".threadFilter"; //$NON-NLS-1$
- private static final String ATTR_THREAD_ID = GdbPlugin.PLUGIN_ID + ".threadID"; //$NON-NLS-1$
-
- // Services
- private ICommandControlService fConnection;
- private ISourceLookup fSourceLookup;
- private IProcesses fProcesses;
- private IBreakpoints fBreakpoints;
- private IBreakpointManager fBreakpointManager; // Platform breakpoint manager (not this!)
- private BreakpointActionManager fBreakpointActionManager;
-
- ///////////////////////////////////////////////////////////////////////////
- // Breakpoints tracking
- ///////////////////////////////////////////////////////////////////////////
-
- private String fDebugModelId;
-
- // Holds the set of platform breakpoints with their corresponding back-end
- // breakpoint attributes, per context (i.e. each platform breakpoint is
- // replicated for each execution context).
- // - Context entry added/removed on start/stopTrackingBreakpoints()
- // - Augmented on breakpointAdded()
- // - Modified on breakpointChanged()
- // - Diminished on breakpointRemoved()
- private Map<IBreakpointsTargetDMContext, Map<ICBreakpoint, Map<String, Object>>> fPlatformToAttributesMaps = new HashMap<>();
+ public static final String GDB_DEBUG_MODEL_ID = "org.eclipse.cdt.dsf.gdb"; //$NON-NLS-1$
+
+ // Extra breakpoint attributes
+ private static final String ATTR_DEBUGGER_PATH = GdbPlugin.PLUGIN_ID + ".debuggerPath"; //$NON-NLS-1$
+ private static final String ATTR_THREAD_FILTER = GdbPlugin.PLUGIN_ID + ".threadFilter"; //$NON-NLS-1$
+ private static final String ATTR_THREAD_ID = GdbPlugin.PLUGIN_ID + ".threadID"; //$NON-NLS-1$
+
+ // Services
+ private ICommandControlService fConnection;
+ private ISourceLookup fSourceLookup;
+ private IProcesses fProcesses;
+ private IBreakpoints fBreakpoints;
+ private IBreakpointManager fBreakpointManager; // Platform breakpoint manager (not this!)
+ private BreakpointActionManager fBreakpointActionManager;
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Breakpoints tracking
+ ///////////////////////////////////////////////////////////////////////////
+
+ private String fDebugModelId;
+
+ // Holds the set of platform breakpoints with their corresponding back-end
+ // breakpoint attributes, per context (i.e. each platform breakpoint is
+ // replicated for each execution context).
+ // - Context entry added/removed on start/stopTrackingBreakpoints()
+ // - Augmented on breakpointAdded()
+ // - Modified on breakpointChanged()
+ // - Diminished on breakpointRemoved()
+ private Map<IBreakpointsTargetDMContext, Map<ICBreakpoint, Map<String, Object>>> fPlatformToAttributesMaps = new HashMap<>();
/**
- * Returns the structure that maps each breakpoint target to a map of platform breakpoints
+ * Returns the structure that maps each breakpoint target to a map of platform breakpoints
* and their corresponding back-end attributes.
* @since 4.7
*/
@@ -174,225 +174,224 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
return fPlatformToAttributesMaps;
}
- // Holds the set of target breakpoints, per execution context, and their
- // mapping to the corresponding platform breakpoint. In a given execution
- // context there can only be one platform breakpoint per target breakpoint.
- // Acts as a mapping from target (low-level) BP to the corresponding platform
- // (high-level) BP.
- // Updated when:
- // - We start/stop tracking an execution context
- // - A platform breakpoint is added/removed
- // - A thread filter is applied/removed
- private Map<IBreakpointsTargetDMContext, Map<IBreakpointDMContext, ICBreakpoint>> fBPToPlatformMaps = new HashMap<>();
-
- /**
- * Returns the structure that maps each breakpoint target to a map of back-end breakpoints
+ // Holds the set of target breakpoints, per execution context, and their
+ // mapping to the corresponding platform breakpoint. In a given execution
+ // context there can only be one platform breakpoint per target breakpoint.
+ // Acts as a mapping from target (low-level) BP to the corresponding platform
+ // (high-level) BP.
+ // Updated when:
+ // - We start/stop tracking an execution context
+ // - A platform breakpoint is added/removed
+ // - A thread filter is applied/removed
+ private Map<IBreakpointsTargetDMContext, Map<IBreakpointDMContext, ICBreakpoint>> fBPToPlatformMaps = new HashMap<>();
+
+ /**
+ * Returns the structure that maps each breakpoint target to a map of back-end breakpoints
* and their corresponding platform breakpoint.
* @since 4.7
*/
- protected Map<IBreakpointsTargetDMContext, Map<IBreakpointDMContext, ICBreakpoint>> getBPToPlatformMaps() {
- return fBPToPlatformMaps;
- }
-
- // Holds the mapping from platform breakpoint to the corresponding target
- // breakpoint(s), per context. There can be multiple back-end BPs for a
- // single platform BP in the case of [1] multiple target contexts, and/or
- // [2] thread filtering.
- // Updated when:
- // - We start/stop tracking an execution context
- // - A platform breakpoint is added/removed
- // - A thread filter is applied/removed
- private Map<IBreakpointsTargetDMContext, Map<ICBreakpoint, Vector<IBreakpointDMContext>>> fPlatformToBPsMaps = new HashMap<>();
-
- /**
- * Returns the structure that maps each breakpoint target to a map of platform breakpoints
+ protected Map<IBreakpointsTargetDMContext, Map<IBreakpointDMContext, ICBreakpoint>> getBPToPlatformMaps() {
+ return fBPToPlatformMaps;
+ }
+
+ // Holds the mapping from platform breakpoint to the corresponding target
+ // breakpoint(s), per context. There can be multiple back-end BPs for a
+ // single platform BP in the case of [1] multiple target contexts, and/or
+ // [2] thread filtering.
+ // Updated when:
+ // - We start/stop tracking an execution context
+ // - A platform breakpoint is added/removed
+ // - A thread filter is applied/removed
+ private Map<IBreakpointsTargetDMContext, Map<ICBreakpoint, Vector<IBreakpointDMContext>>> fPlatformToBPsMaps = new HashMap<>();
+
+ /**
+ * Returns the structure that maps each breakpoint target to a map of platform breakpoints
* and their corresponding vector of back-end breakpoints.
* @since 4.7
*/
- protected Map<IBreakpointsTargetDMContext, Map<ICBreakpoint, Vector<IBreakpointDMContext>>> getPlatformToBPsMaps() {
- return fPlatformToBPsMaps;
- }
-
- // Holds the mapping from platform breakpoint to the corresponding target
- // breakpoint threads, per context.
- // Updated when:
- // - We start/stop tracking an execution context
- // - A platform breakpoint is added/removed
- // - A thread filter is applied/removed
- private Map<IBreakpointsTargetDMContext, Map<ICBreakpoint, Set<String>>> fPlatformToBPThreadsMaps = new HashMap<>();
-
- /**
- * Returns the structure that maps each breakpoint target to a map of platform breakpoints
+ protected Map<IBreakpointsTargetDMContext, Map<ICBreakpoint, Vector<IBreakpointDMContext>>> getPlatformToBPsMaps() {
+ return fPlatformToBPsMaps;
+ }
+
+ // Holds the mapping from platform breakpoint to the corresponding target
+ // breakpoint threads, per context.
+ // Updated when:
+ // - We start/stop tracking an execution context
+ // - A platform breakpoint is added/removed
+ // - A thread filter is applied/removed
+ private Map<IBreakpointsTargetDMContext, Map<ICBreakpoint, Set<String>>> fPlatformToBPThreadsMaps = new HashMap<>();
+
+ /**
+ * Returns the structure that maps each breakpoint target to a map of platform breakpoints
* and their corresponding back-end breakpoint thread ids.
* @since 4.7
*/
- protected Map<IBreakpointsTargetDMContext, Map<ICBreakpoint, Set<String>>> getPlatformToBPThreadsMaps() {
- return fPlatformToBPThreadsMaps;
- }
-
- // Due to the very asynchronous nature of DSF, a new breakpoint request can
- // pop up at any time before an ongoing one is completed. The following set
- // is used to store requests until the ongoing operation completes.
- private Set<IBreakpoint> fPendingRequests = new HashSet<>();
- private Set<IBreakpoint> fPendingBreakpoints = new HashSet<>();
-
- private Map<ICBreakpoint, IMarker> fBreakpointMarkerProblems = new HashMap<>();
-
- private ListenerList fTrackingListeners = new ListenerList();
-
- ///////////////////////////////////////////////////////////////////////////
- // String constants
- ///////////////////////////////////////////////////////////////////////////
-
- private static final String NULL_STRING = ""; //$NON-NLS-1$
-
- static final String CONTEXT_ALREADY_INITIALIZED = "Context already initialized"; //$NON-NLS-1$
- static final String INVALID_CONTEXT_TYPE = "Invalid context type"; //$NON-NLS-1$
- static final String INVALID_CONTEXT = "Invalid context"; //$NON-NLS-1$
-
- static final String UNABLE_TO_READ_BREAKPOINT = "Unable to read initial breakpoint attributes"; //$NON-NLS-1$
- static final String BREAKPOINT_NOT_INSTALLED = "Breakpoints not installed for given context"; //$NON-NLS-1$
- static final String BREAKPOINT_ALREADY_INSTALLED = "Breakpoint already installed"; //$NON-NLS-1$
- static final String BREAKPOINT_ALREADY_REMOVED = "Breakpoint already removed"; //$NON-NLS-1$
-
- static final String INVALID_BREAKPOINT = "Invalid breakpoint"; //$NON-NLS-1$
- static final String UNKNOWN_BREAKPOINT = "Unknown breakpoint"; //$NON-NLS-1$
- static final String INVALID_PARAMETER = "Invalid breakpoint parameter(s)"; //$NON-NLS-1$
-
- static final String NO_DEBUGGER_PATH = "No debugger path for breakpoint"; //$NON-NLS-1$
- static final String NO_MARKER_FOR_BREAKPOINT = "No marker associated with breakpoint"; //$NON-NLS-1$
-
- ///////////////////////////////////////////////////////////////////////////
- // AbstractDsfService
- ///////////////////////////////////////////////////////////////////////////
-
- /**
- * The service constructor.
- * Performs basic instantiation (method initialize() performs the real
- * service initialization asynchronously).
- *
- * @param session the debugging session
- * @param debugModelId the debugging model
- */
- public MIBreakpointsManager(DsfSession session, String debugModelId) {
- super(session);
- fDebugModelId = debugModelId;
- }
-
- //-------------------------------------------------------------------------
- // initialize
- //-------------------------------------------------------------------------
- // - Collect references for the services we interact with
- // - Register to interesting events
- // - Obtain the list of platform breakpoints
- // - Register the service for interested parties
- //-------------------------------------------------------------------------
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.dsf.service.AbstractDsfService#initialize(org.eclipse.cdt.dsf.concurrent.RequestMonitor)
- */
- @Override
- public void initialize(final RequestMonitor rm) {
- super.initialize(
- new ImmediateRequestMonitor(rm) {
- @Override
- protected void handleSuccess() {
- doInitialize(rm);
- }});
- }
-
- /**
- * @param rm
- */
- private void doInitialize(RequestMonitor rm) {
-
- // Get the required services references from central repository
- fConnection = getServicesTracker().getService(ICommandControlService.class);
- fSourceLookup = getServicesTracker().getService(ISourceLookup.class);
- fBreakpoints = getServicesTracker().getService(IBreakpoints.class);
- fProcesses = getServicesTracker().getService(IProcesses.class);
- fBreakpointManager = DebugPlugin.getDefault().getBreakpointManager();
- fBreakpointActionManager = CDebugCorePlugin.getDefault().getBreakpointActionManager();
-
- // Register to the useful events
- getSession().addServiceEventListener(this, null);
- fBreakpointManager.addBreakpointListener(this);
- fBreakpointManager.addBreakpointManagerListener(this);
-
- // And register this service
- register(new String[] { MIBreakpointsManager.class.getName() },
- new Hashtable<String, String>());
- rm.done();
- }
-
- //-------------------------------------------------------------------------
- // shutdown
- //-------------------------------------------------------------------------
- // - Un-register the service
- // - Stop listening to events
- // - Remove the breakpoints installed by this service
- //
- // Since we are shutting down, there is no overwhelming need
- // to keep the maps coherent...
- //-------------------------------------------------------------------------
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.dsf.service.AbstractDsfService#shutdown(org.eclipse.cdt.dsf.concurrent.RequestMonitor)
- */
- @Override
- public void shutdown(final RequestMonitor rm) {
-
- // Stop accepting requests and events
- unregister();
- getSession().removeServiceEventListener(this);
- fBreakpointManager.removeBreakpointListener(this);
- fBreakpointManager.removeBreakpointManagerListener(this);
- fTrackingListeners.clear();
-
- // Cleanup the breakpoints that are still installed by the service.
- // Use a counting monitor which will call mom to complete the shutdown
- // after the breakpoints are un-installed (successfully or not).
- CountingRequestMonitor countingRm = new CountingRequestMonitor(getExecutor(), rm) {
- @Override
- protected void handleCompleted() {
- MIBreakpointsManager.super.shutdown(rm);
- }
- };
-
- List<IBreakpointsTargetDMContext> targetBPKeys = new ArrayList<>(fBPToPlatformMaps.size());
- targetBPKeys.addAll(0, fBPToPlatformMaps.keySet());
- for (IBreakpointsTargetDMContext dmc : targetBPKeys) {
- stopTrackingBreakpoints(dmc, countingRm);
- }
- countingRm.setDoneCount(targetBPKeys.size());
- }
-
- //-------------------------------------------------------------------------
- // getBundleContext
- //-------------------------------------------------------------------------
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.dsf.service.AbstractDsfService#getBundleContext()
- */
- @Override
- protected BundleContext getBundleContext() {
- return GdbPlugin.getBundleContext();
- }
-
- ///////////////////////////////////////////////////////////////////////////
- // IBreakpointsManager
- ///////////////////////////////////////////////////////////////////////////
-
- /**
- * Wrapper around startTrackingBreakpoints() which accepts a containerDmc and sets
- * each breakpoints filter to include that container. This method should be called
- * instead of startTrackingBreakpoints()
- *
- * @param containerDmc The container to be added in the bp filter. This container
- * must have the proper IBreakpointsTargetDMContext in its hierarchy.
- *
+ protected Map<IBreakpointsTargetDMContext, Map<ICBreakpoint, Set<String>>> getPlatformToBPThreadsMaps() {
+ return fPlatformToBPThreadsMaps;
+ }
+
+ // Due to the very asynchronous nature of DSF, a new breakpoint request can
+ // pop up at any time before an ongoing one is completed. The following set
+ // is used to store requests until the ongoing operation completes.
+ private Set<IBreakpoint> fPendingRequests = new HashSet<>();
+ private Set<IBreakpoint> fPendingBreakpoints = new HashSet<>();
+
+ private Map<ICBreakpoint, IMarker> fBreakpointMarkerProblems = new HashMap<>();
+
+ private ListenerList fTrackingListeners = new ListenerList();
+
+ ///////////////////////////////////////////////////////////////////////////
+ // String constants
+ ///////////////////////////////////////////////////////////////////////////
+
+ private static final String NULL_STRING = ""; //$NON-NLS-1$
+
+ static final String CONTEXT_ALREADY_INITIALIZED = "Context already initialized"; //$NON-NLS-1$
+ static final String INVALID_CONTEXT_TYPE = "Invalid context type"; //$NON-NLS-1$
+ static final String INVALID_CONTEXT = "Invalid context"; //$NON-NLS-1$
+
+ static final String UNABLE_TO_READ_BREAKPOINT = "Unable to read initial breakpoint attributes"; //$NON-NLS-1$
+ static final String BREAKPOINT_NOT_INSTALLED = "Breakpoints not installed for given context"; //$NON-NLS-1$
+ static final String BREAKPOINT_ALREADY_INSTALLED = "Breakpoint already installed"; //$NON-NLS-1$
+ static final String BREAKPOINT_ALREADY_REMOVED = "Breakpoint already removed"; //$NON-NLS-1$
+
+ static final String INVALID_BREAKPOINT = "Invalid breakpoint"; //$NON-NLS-1$
+ static final String UNKNOWN_BREAKPOINT = "Unknown breakpoint"; //$NON-NLS-1$
+ static final String INVALID_PARAMETER = "Invalid breakpoint parameter(s)"; //$NON-NLS-1$
+
+ static final String NO_DEBUGGER_PATH = "No debugger path for breakpoint"; //$NON-NLS-1$
+ static final String NO_MARKER_FOR_BREAKPOINT = "No marker associated with breakpoint"; //$NON-NLS-1$
+
+ ///////////////////////////////////////////////////////////////////////////
+ // AbstractDsfService
+ ///////////////////////////////////////////////////////////////////////////
+
+ /**
+ * The service constructor.
+ * Performs basic instantiation (method initialize() performs the real
+ * service initialization asynchronously).
+ *
+ * @param session the debugging session
+ * @param debugModelId the debugging model
+ */
+ public MIBreakpointsManager(DsfSession session, String debugModelId) {
+ super(session);
+ fDebugModelId = debugModelId;
+ }
+
+ //-------------------------------------------------------------------------
+ // initialize
+ //-------------------------------------------------------------------------
+ // - Collect references for the services we interact with
+ // - Register to interesting events
+ // - Obtain the list of platform breakpoints
+ // - Register the service for interested parties
+ //-------------------------------------------------------------------------
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.dsf.service.AbstractDsfService#initialize(org.eclipse.cdt.dsf.concurrent.RequestMonitor)
+ */
+ @Override
+ public void initialize(final RequestMonitor rm) {
+ super.initialize(new ImmediateRequestMonitor(rm) {
+ @Override
+ protected void handleSuccess() {
+ doInitialize(rm);
+ }
+ });
+ }
+
+ /**
+ * @param rm
+ */
+ private void doInitialize(RequestMonitor rm) {
+
+ // Get the required services references from central repository
+ fConnection = getServicesTracker().getService(ICommandControlService.class);
+ fSourceLookup = getServicesTracker().getService(ISourceLookup.class);
+ fBreakpoints = getServicesTracker().getService(IBreakpoints.class);
+ fProcesses = getServicesTracker().getService(IProcesses.class);
+ fBreakpointManager = DebugPlugin.getDefault().getBreakpointManager();
+ fBreakpointActionManager = CDebugCorePlugin.getDefault().getBreakpointActionManager();
+
+ // Register to the useful events
+ getSession().addServiceEventListener(this, null);
+ fBreakpointManager.addBreakpointListener(this);
+ fBreakpointManager.addBreakpointManagerListener(this);
+
+ // And register this service
+ register(new String[] { MIBreakpointsManager.class.getName() }, new Hashtable<String, String>());
+ rm.done();
+ }
+
+ //-------------------------------------------------------------------------
+ // shutdown
+ //-------------------------------------------------------------------------
+ // - Un-register the service
+ // - Stop listening to events
+ // - Remove the breakpoints installed by this service
+ //
+ // Since we are shutting down, there is no overwhelming need
+ // to keep the maps coherent...
+ //-------------------------------------------------------------------------
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.dsf.service.AbstractDsfService#shutdown(org.eclipse.cdt.dsf.concurrent.RequestMonitor)
+ */
+ @Override
+ public void shutdown(final RequestMonitor rm) {
+
+ // Stop accepting requests and events
+ unregister();
+ getSession().removeServiceEventListener(this);
+ fBreakpointManager.removeBreakpointListener(this);
+ fBreakpointManager.removeBreakpointManagerListener(this);
+ fTrackingListeners.clear();
+
+ // Cleanup the breakpoints that are still installed by the service.
+ // Use a counting monitor which will call mom to complete the shutdown
+ // after the breakpoints are un-installed (successfully or not).
+ CountingRequestMonitor countingRm = new CountingRequestMonitor(getExecutor(), rm) {
+ @Override
+ protected void handleCompleted() {
+ MIBreakpointsManager.super.shutdown(rm);
+ }
+ };
+
+ List<IBreakpointsTargetDMContext> targetBPKeys = new ArrayList<>(fBPToPlatformMaps.size());
+ targetBPKeys.addAll(0, fBPToPlatformMaps.keySet());
+ for (IBreakpointsTargetDMContext dmc : targetBPKeys) {
+ stopTrackingBreakpoints(dmc, countingRm);
+ }
+ countingRm.setDoneCount(targetBPKeys.size());
+ }
+
+ //-------------------------------------------------------------------------
+ // getBundleContext
+ //-------------------------------------------------------------------------
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.dsf.service.AbstractDsfService#getBundleContext()
+ */
+ @Override
+ protected BundleContext getBundleContext() {
+ return GdbPlugin.getBundleContext();
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // IBreakpointsManager
+ ///////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Wrapper around startTrackingBreakpoints() which accepts a containerDmc and sets
+ * each breakpoints filter to include that container. This method should be called
+ * instead of startTrackingBreakpoints()
+ *
+ * @param containerDmc The container to be added in the bp filter. This container
+ * must have the proper IBreakpointsTargetDMContext in its hierarchy.
+ *
* @since 4.6
- */
+ */
public void startTrackingBpForProcess(final IContainerDMContext containerDmc, final RequestMonitor rm) {
final IBreakpointsTargetDMContext targetBpDmc = DMContexts.getAncestorOfType(containerDmc,
IBreakpointsTargetDMContext.class);
@@ -405,917 +404,913 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
}
startTrackingBreakpoints(targetBpDmc, rm);
}
-
- //-------------------------------------------------------------------------
- // startTrackingBreakpoints
- //-------------------------------------------------------------------------
- // - Augment the maps with the new execution context
- // - Install the platform breakpoints on the selected target
- //-------------------------------------------------------------------------
-
- /**
- * Install and begin tracking breakpoints for given context. The service
- * will keep installing new breakpoints that appear in the IDE for this
- * context until {@link #uninstallBreakpoints(IDMContext)} is called for that
- * context.
- * @param dmc Context to start tracking breakpoints for.
- * @param rm Completion callback.
- */
- public void startTrackingBreakpoints(final IBreakpointsTargetDMContext dmc, final RequestMonitor rm) {
-
- // Validate the execution context
- if (dmc == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, INVALID_CONTEXT, null));
- rm.done();
- return;
- }
-
- Map<ICBreakpoint,Map<String, Object>> platformBPs = fPlatformToAttributesMaps.get(dmc);
- Map<ICBreakpoint, Vector<IBreakpointDMContext>> breakpointIDs = fPlatformToBPsMaps.get(dmc);
- Map<IBreakpointDMContext, ICBreakpoint> targetIDs = fBPToPlatformMaps.get(dmc);
- Map<ICBreakpoint, Set<String>> threadIDs = fPlatformToBPThreadsMaps.get(dmc);
- if ((platformBPs != null) || (breakpointIDs != null) || (targetIDs != null) || (threadIDs != null)) {
- // If the maps already contains this context we can simply ignore this request.
- // This happens when we start or attach to another process with GDB >= 7.4
- assert platformBPs != null && breakpointIDs != null && targetIDs != null && threadIDs != null;
- rm.done();
- return;
- }
-
- // Create entries in the breakpoint tables for the new context. These entries should only
- // be removed when this service stops tracking breakpoints for the given context.
- fPlatformToAttributesMaps.put(dmc, new HashMap<ICBreakpoint, Map<String, Object>>());
- fPlatformToBPsMaps.put(dmc, new HashMap<ICBreakpoint, Vector<IBreakpointDMContext>>());
- fBPToPlatformMaps.put(dmc, new HashMap<IBreakpointDMContext, ICBreakpoint>());
- fPlatformToBPThreadsMaps.put(dmc, new HashMap<ICBreakpoint, Set<String>>());
-
- // Install the platform breakpoints (stored in fPlatformBPs) on the target.
- new Job("DSF BreakpointsManager: Install initial breakpoints on target") { //$NON-NLS-1$
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- // Submit the runnable to plant the breakpoints on dispatch thread.
- getExecutor().submit(new Runnable() {
- @Override
- public void run() {
- installInitialBreakpoints(dmc, new RequestMonitor(ImmediateExecutor.getInstance(), rm) {
- @Override
- protected void handleSuccess() {
- // Notify breakpoints tracking listeners that the tracking is started.
- for (Object o : fTrackingListeners.getListeners()) {
- ((IMIBreakpointsTrackingListener)o).breakpointTrackingStarted(dmc);
- }
- rm.done();
- };
- });
- }
- });
-
- return Status.OK_STATUS;
- }
- }.schedule();
- }
-
- /**
- * Installs the breakpoints that existed prior to the activation of this
- * execution context.
- *
- * @param dmc
- * @param initialPlatformBPs
- * @param rm
- */
- private void installInitialBreakpoints(final IBreakpointsTargetDMContext dmc, final RequestMonitor rm)
- {
- // Retrieve the set of platform breakpoints for this context
- final Map<ICBreakpoint,Map<String, Object>> platformBPs = fPlatformToAttributesMaps.get(dmc);
- if (platformBPs == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, INVALID_CONTEXT, null));
- rm.done();
- return;
- }
-
- // Read current breakpoints from platform and copy their augmented
- // attributes into the local reference map
- try {
- IBreakpoint[] breakpoints = fBreakpointManager.getBreakpoints(fDebugModelId);
- for (IBreakpoint breakpoint : breakpoints) {
- if (supportsBreakpoint(breakpoint)) {
- boolean filtered = isBreakpointEntirelyFiltered(dmc, (ICBreakpoint) breakpoint);
- if (!filtered) {
- Map<String, Object> attributes = breakpoint.getMarker().getAttributes();
- attributes.put(ATTR_DEBUGGER_PATH, NULL_STRING);
- attributes.put(ATTR_THREAD_FILTER, extractThreads(dmc, (ICBreakpoint) breakpoint));
- attributes.put(ATTR_THREAD_ID, NULL_STRING);
- platformBPs.put((ICBreakpoint) breakpoint, attributes);
- }
- }
- }
- } catch (CoreException e) {
- IStatus status = new Status(
- IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNABLE_TO_READ_BREAKPOINT, e);
- rm.setStatus(status);
- rm.done();
- }
-
- // Install the individual breakpoints on the dispatcher thread
- // Requires a counting monitor to know when we are done
- final CountingRequestMonitor countingRm = new CountingRequestMonitor(getExecutor(), rm);
- countingRm.setDoneCount(platformBPs.size());
-
- for (final ICBreakpoint breakpoint : platformBPs.keySet()) {
- final Map<String, Object> attributes = platformBPs.get(breakpoint);
- // Upon determining the debuggerPath, the breakpoint is installed
- determineDebuggerPath(dmc, attributes, new RequestMonitor(getExecutor(), countingRm) {
- @Override
- protected void handleSuccess() {
- // Must install breakpoints right away, even if disabled, so that
- // we can find out if they apply to this target (Bug 389070)
- installBreakpoint(dmc, breakpoint, attributes, countingRm);
- }
- });
- }
- }
-
- //-------------------------------------------------------------------------
- // stopTrackingBreakpoints
- //-------------------------------------------------------------------------
- // - Remove the target breakpoints for the given execution context
- // - Update the maps
- //-------------------------------------------------------------------------
-
- /**
- * Uninstall and stop tracking breakpoints for the given context.
- * @param dmc Context to start tracking breakpoints for.
- * @param rm Completion callback.
- */
- public void stopTrackingBreakpoints(final IBreakpointsTargetDMContext dmc, final RequestMonitor rm) {
-
- // Validate the context
- if (dmc == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, INVALID_CONTEXT, null));
- rm.done();
- return;
- }
-
- // Retrieve the set of platform breakpoints for this context
- final Map<ICBreakpoint,Map<String, Object>> platformBPs = fPlatformToAttributesMaps.get(dmc);
- if (platformBPs == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, INVALID_CONTEXT, null));
- rm.done();
- return;
- }
-
- // Un-install the individual breakpoints on the dispatcher thread
- // (requires a counting monitor to know when we are done).
- // On completion (success or failure), update the maps.
- final CountingRequestMonitor countingRm = new CountingRequestMonitor(getExecutor(), rm) {
- @Override
- protected void handleCompleted() {
- fPlatformToAttributesMaps.remove(dmc);
- fPlatformToBPsMaps.remove(dmc);
- fBPToPlatformMaps.remove(dmc);
- fPlatformToBPThreadsMaps.remove(dmc);
- // Notify breakpoints tracking listeners that the tracking is stopped.
- for (Object o : fTrackingListeners.getListeners()) {
- ((IMIBreakpointsTrackingListener)o).breakpointTrackingStopped(dmc);
- }
- rm.done();
- }
- };
- countingRm.setDoneCount(platformBPs.size());
-
- for (final ICBreakpoint breakpoint : platformBPs.keySet()) {
- uninstallBreakpoint(dmc, breakpoint,
- new RequestMonitor(getExecutor(), countingRm) {
- @Override
- protected void handleCompleted() {
- countingRm.done();
- }
- });
- }
- }
+
+ //-------------------------------------------------------------------------
+ // startTrackingBreakpoints
+ //-------------------------------------------------------------------------
+ // - Augment the maps with the new execution context
+ // - Install the platform breakpoints on the selected target
+ //-------------------------------------------------------------------------
+
+ /**
+ * Install and begin tracking breakpoints for given context. The service
+ * will keep installing new breakpoints that appear in the IDE for this
+ * context until {@link #uninstallBreakpoints(IDMContext)} is called for that
+ * context.
+ * @param dmc Context to start tracking breakpoints for.
+ * @param rm Completion callback.
+ */
+ public void startTrackingBreakpoints(final IBreakpointsTargetDMContext dmc, final RequestMonitor rm) {
+
+ // Validate the execution context
+ if (dmc == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, INVALID_CONTEXT, null));
+ rm.done();
+ return;
+ }
+
+ Map<ICBreakpoint, Map<String, Object>> platformBPs = fPlatformToAttributesMaps.get(dmc);
+ Map<ICBreakpoint, Vector<IBreakpointDMContext>> breakpointIDs = fPlatformToBPsMaps.get(dmc);
+ Map<IBreakpointDMContext, ICBreakpoint> targetIDs = fBPToPlatformMaps.get(dmc);
+ Map<ICBreakpoint, Set<String>> threadIDs = fPlatformToBPThreadsMaps.get(dmc);
+ if ((platformBPs != null) || (breakpointIDs != null) || (targetIDs != null) || (threadIDs != null)) {
+ // If the maps already contains this context we can simply ignore this request.
+ // This happens when we start or attach to another process with GDB >= 7.4
+ assert platformBPs != null && breakpointIDs != null && targetIDs != null && threadIDs != null;
+ rm.done();
+ return;
+ }
+
+ // Create entries in the breakpoint tables for the new context. These entries should only
+ // be removed when this service stops tracking breakpoints for the given context.
+ fPlatformToAttributesMaps.put(dmc, new HashMap<ICBreakpoint, Map<String, Object>>());
+ fPlatformToBPsMaps.put(dmc, new HashMap<ICBreakpoint, Vector<IBreakpointDMContext>>());
+ fBPToPlatformMaps.put(dmc, new HashMap<IBreakpointDMContext, ICBreakpoint>());
+ fPlatformToBPThreadsMaps.put(dmc, new HashMap<ICBreakpoint, Set<String>>());
+
+ // Install the platform breakpoints (stored in fPlatformBPs) on the target.
+ new Job("DSF BreakpointsManager: Install initial breakpoints on target") { //$NON-NLS-1$
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ // Submit the runnable to plant the breakpoints on dispatch thread.
+ getExecutor().submit(new Runnable() {
+ @Override
+ public void run() {
+ installInitialBreakpoints(dmc, new RequestMonitor(ImmediateExecutor.getInstance(), rm) {
+ @Override
+ protected void handleSuccess() {
+ // Notify breakpoints tracking listeners that the tracking is started.
+ for (Object o : fTrackingListeners.getListeners()) {
+ ((IMIBreakpointsTrackingListener) o).breakpointTrackingStarted(dmc);
+ }
+ rm.done();
+ };
+ });
+ }
+ });
+
+ return Status.OK_STATUS;
+ }
+ }.schedule();
+ }
+
+ /**
+ * Installs the breakpoints that existed prior to the activation of this
+ * execution context.
+ *
+ * @param dmc
+ * @param initialPlatformBPs
+ * @param rm
+ */
+ private void installInitialBreakpoints(final IBreakpointsTargetDMContext dmc, final RequestMonitor rm) {
+ // Retrieve the set of platform breakpoints for this context
+ final Map<ICBreakpoint, Map<String, Object>> platformBPs = fPlatformToAttributesMaps.get(dmc);
+ if (platformBPs == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, INVALID_CONTEXT, null));
+ rm.done();
+ return;
+ }
+
+ // Read current breakpoints from platform and copy their augmented
+ // attributes into the local reference map
+ try {
+ IBreakpoint[] breakpoints = fBreakpointManager.getBreakpoints(fDebugModelId);
+ for (IBreakpoint breakpoint : breakpoints) {
+ if (supportsBreakpoint(breakpoint)) {
+ boolean filtered = isBreakpointEntirelyFiltered(dmc, (ICBreakpoint) breakpoint);
+ if (!filtered) {
+ Map<String, Object> attributes = breakpoint.getMarker().getAttributes();
+ attributes.put(ATTR_DEBUGGER_PATH, NULL_STRING);
+ attributes.put(ATTR_THREAD_FILTER, extractThreads(dmc, (ICBreakpoint) breakpoint));
+ attributes.put(ATTR_THREAD_ID, NULL_STRING);
+ platformBPs.put((ICBreakpoint) breakpoint, attributes);
+ }
+ }
+ }
+ } catch (CoreException e) {
+ IStatus status = new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNABLE_TO_READ_BREAKPOINT,
+ e);
+ rm.setStatus(status);
+ rm.done();
+ }
+
+ // Install the individual breakpoints on the dispatcher thread
+ // Requires a counting monitor to know when we are done
+ final CountingRequestMonitor countingRm = new CountingRequestMonitor(getExecutor(), rm);
+ countingRm.setDoneCount(platformBPs.size());
+
+ for (final ICBreakpoint breakpoint : platformBPs.keySet()) {
+ final Map<String, Object> attributes = platformBPs.get(breakpoint);
+ // Upon determining the debuggerPath, the breakpoint is installed
+ determineDebuggerPath(dmc, attributes, new RequestMonitor(getExecutor(), countingRm) {
+ @Override
+ protected void handleSuccess() {
+ // Must install breakpoints right away, even if disabled, so that
+ // we can find out if they apply to this target (Bug 389070)
+ installBreakpoint(dmc, breakpoint, attributes, countingRm);
+ }
+ });
+ }
+ }
+
+ //-------------------------------------------------------------------------
+ // stopTrackingBreakpoints
+ //-------------------------------------------------------------------------
+ // - Remove the target breakpoints for the given execution context
+ // - Update the maps
+ //-------------------------------------------------------------------------
+
+ /**
+ * Uninstall and stop tracking breakpoints for the given context.
+ * @param dmc Context to start tracking breakpoints for.
+ * @param rm Completion callback.
+ */
+ public void stopTrackingBreakpoints(final IBreakpointsTargetDMContext dmc, final RequestMonitor rm) {
+
+ // Validate the context
+ if (dmc == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, INVALID_CONTEXT, null));
+ rm.done();
+ return;
+ }
+
+ // Retrieve the set of platform breakpoints for this context
+ final Map<ICBreakpoint, Map<String, Object>> platformBPs = fPlatformToAttributesMaps.get(dmc);
+ if (platformBPs == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, INVALID_CONTEXT, null));
+ rm.done();
+ return;
+ }
+
+ // Un-install the individual breakpoints on the dispatcher thread
+ // (requires a counting monitor to know when we are done).
+ // On completion (success or failure), update the maps.
+ final CountingRequestMonitor countingRm = new CountingRequestMonitor(getExecutor(), rm) {
+ @Override
+ protected void handleCompleted() {
+ fPlatformToAttributesMaps.remove(dmc);
+ fPlatformToBPsMaps.remove(dmc);
+ fBPToPlatformMaps.remove(dmc);
+ fPlatformToBPThreadsMaps.remove(dmc);
+ // Notify breakpoints tracking listeners that the tracking is stopped.
+ for (Object o : fTrackingListeners.getListeners()) {
+ ((IMIBreakpointsTrackingListener) o).breakpointTrackingStopped(dmc);
+ }
+ rm.done();
+ }
+ };
+ countingRm.setDoneCount(platformBPs.size());
+
+ for (final ICBreakpoint breakpoint : platformBPs.keySet()) {
+ uninstallBreakpoint(dmc, breakpoint, new RequestMonitor(getExecutor(), countingRm) {
+ @Override
+ protected void handleCompleted() {
+ countingRm.done();
+ }
+ });
+ }
+ }
/**
* Return the collection of tracked target breakpoint contexts. Use this method
* instead of implying the installed collection from the various maps contained
* in the manager.
- *
+ *
* @since 5.5
*/
protected Collection<IBreakpointsTargetDMContext> getTrackedBreakpointTargetContexts() {
return fPlatformToAttributesMaps.keySet();
}
- ///////////////////////////////////////////////////////////////////////////
- // Back-end interface functions
- ///////////////////////////////////////////////////////////////////////////
-
- //-------------------------------------------------------------------------
- // installBreakpoint
- //-------------------------------------------------------------------------
-
- /**
- * Install a platform breakpoint on the back-end. For a given context, a
- * platform breakpoint can resolve into multiple back-end breakpoints when
- * threads are taken into account or if multiple breakpoints are created
- * on the target using the console.
- *
- * @param dmc
- * @param breakpoint
- * @param attributes
- * @param rm
- */
- private void installBreakpoint(IBreakpointsTargetDMContext dmc, final ICBreakpoint breakpoint,
- final Map<String, Object> attributes, final RequestMonitor rm)
- {
- // Retrieve the breakpoint maps
- final Map<ICBreakpoint,Map<String,Object>> platformBPs = fPlatformToAttributesMaps.get(dmc);
- assert platformBPs != null;
-
- final Map<ICBreakpoint, Vector<IBreakpointDMContext>> breakpointIDs = fPlatformToBPsMaps.get(dmc);
- assert breakpointIDs != null;
-
- final Map<IBreakpointDMContext, ICBreakpoint> targetBPs = fBPToPlatformMaps.get(dmc);
- assert targetBPs != null;
-
- final Map<ICBreakpoint, Set<String>> threadsIDs = fPlatformToBPThreadsMaps.get(dmc);
- assert threadsIDs != null;
-
- // Ensure the breakpoint has a valid debugger source path
- if (breakpoint instanceof ICLineBreakpoint
- && !(breakpoint instanceof ICAddressBreakpoint)
- && !(breakpoint instanceof ICFunctionBreakpoint)) {
- String debuggerPath = (String) attributes.get(ATTR_DEBUGGER_PATH);
- if (debuggerPath == null || debuggerPath.equals(NULL_STRING)) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, NO_DEBUGGER_PATH, null));
- rm.done();
- return;
- }
- }
-
- // A back-end breakpoint needs to be installed for each specified thread
- final Set<String> threads = getThreads(attributes);
-
- // Update the breakpoint state when all back-end breakpoints have been installed
- final CountingRequestMonitor installRM = new CountingRequestMonitor(getExecutor(), rm) {
- @Override
- protected void handleCompleted() {
- // Store the platform breakpoint
- platformBPs.put(breakpoint, attributes);
- rm.done();
- }
- };
- installRM.setDoneCount(threads.size());
-
- // Install the back-end breakpoint(s)
- for (final String thread : threads) {
- DataRequestMonitor<IBreakpointDMContext> drm =
- new DataRequestMonitor<IBreakpointDMContext>(getExecutor(), installRM) {
- @Override
- protected void handleSuccess() {
- // Add the new back-end breakpoint to the map
- Vector<IBreakpointDMContext> list = breakpointIDs.get(breakpoint);
- if (list == null) {
- list = new Vector<>();
- }
-
- IBreakpointDMContext targetBP = getData();
- list.add(targetBP);
- breakpointIDs.put(breakpoint, list);
-
- // Add the reverse mapping
- targetBPs.put(targetBP, breakpoint);
-
- // And update the corresponding thread list
- Set<String> thrds = threadsIDs.get(breakpoint);
- if (thrds == null) {
- thrds = new HashSet<>();
- }
-
- thrds.add(thread);
- threadsIDs.put(breakpoint, thrds);
-
- // Reset the thread (is it necessary?)
- attributes.put(ATTR_THREAD_ID, NULL_STRING);
-
- // Remove breakpoint problem marker (if any)
- removeBreakpointProblemMarker(breakpoint);
-
- // Check for a pending breakpoint before showing that it was properly installed
- fBreakpoints.getBreakpointDMData(targetBP, new DataRequestMonitor<IBreakpointDMData>(getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- boolean pending = false;
- if (isSuccess()) {
- IBreakpointDMData data = getData();
- if (data instanceof MIBreakpointDMData) {
- pending = ((MIBreakpointDMData)data).isPending();
- }
- }
- // Finally, update the platform breakpoint to show it was installed, unless we have a pending breakpoint
- if (!pending) {
- try {
- breakpoint.incrementInstallCount();
- } catch (CoreException e) {
- }
- }
- installRM.done();
- }
- });
- }
-
- @Override
- protected void handleError() {
- String detailedMessage;
- if (getStatus().getException() != null &&
- getStatus().getException().getMessage() != null) {
- detailedMessage = getStatus().getException().getMessage();
- } else {
- detailedMessage = getStatus().getMessage();
- }
- String description = (detailedMessage == null) ?
- Messages.Breakpoint_attribute_problem :
- MessageFormat.format(Messages.Breakpoint_attribute_detailed_problem, new Object[] { detailedMessage});
-
- addBreakpointProblemMarker(breakpoint, description, IMarker.SEVERITY_WARNING);
- installRM.done();
- }
- };
-
- // Convert the breakpoint attributes for the back-end
- attributes.put(ATTR_THREAD_ID, thread);
- Map<String,Object> targetAttributes = convertToTargetBreakpoint(breakpoint, attributes);
- // Must install breakpoint right away, even if disabled, so that
- // we can find out if it applies to this target (Bug 389070)
- fBreakpoints.insertBreakpoint(dmc, targetAttributes, drm);
- }
- }
-
- private void addBreakpointProblemMarker(final ICBreakpoint breakpoint, final String description, final int severity) {
-
- new Job("Add Breakpoint Problem Marker") { //$NON-NLS-1$
- @Override
- protected IStatus run(IProgressMonitor monitor) {
-
- if (breakpoint instanceof ICLineBreakpoint) {
- // If we have already have a problem marker on this breakpoint
- // we should remove it first.
- IMarker marker = fBreakpointMarkerProblems.remove(breakpoint);
- if (marker != null) {
- try {
- marker.delete();
- } catch (CoreException e) {
- }
- }
-
- ICLineBreakpoint lineBreakpoint = (ICLineBreakpoint) breakpoint;
- try {
- // Locate the workspace resource via the breakpoint marker
- IMarker breakpointMarker = lineBreakpoint.getMarker();
- IResource resource = breakpointMarker.getResource();
-
- // Add a problem marker to the resource
- IMarker problemMarker = resource.createMarker(BreakpointProblems.BREAKPOINT_PROBLEM_MARKER_ID);
- int lineNumber = lineBreakpoint.getLineNumber();
- String sourceHandle = lineBreakpoint.getSourceHandle();
- problemMarker.setAttribute(IMarker.LOCATION, String.valueOf(lineNumber));
- problemMarker.setAttribute(IMarker.MESSAGE, description);
- problemMarker.setAttribute(IMarker.SEVERITY, severity);
- problemMarker.setAttribute(IMarker.LINE_NUMBER, lineNumber);
- if (sourceHandle != null) {
- problemMarker.setAttribute(ICModelMarker.C_MODEL_MARKER_EXTERNAL_LOCATION, sourceHandle);
- }
-
- // And save the baby
- fBreakpointMarkerProblems.put(breakpoint, problemMarker);
- } catch (CoreException e) {
- }
- }
- return Status.OK_STATUS;
- }
- }.schedule();
- }
-
- private void removeBreakpointProblemMarker(final ICBreakpoint breakpoint) {
-
- new Job("Remove Breakpoint Problem Marker") { //$NON-NLS-1$
- @Override
- protected IStatus run(IProgressMonitor monitor) {
-
- IMarker marker = fBreakpointMarkerProblems.remove(breakpoint);
- if (marker != null) {
- try {
- marker.delete();
- } catch (CoreException e) {
- }
- }
-
- return Status.OK_STATUS;
- }
- }.schedule();
- }
-
- //-------------------------------------------------------------------------
- // uninstallBreakpoint
- //-------------------------------------------------------------------------
-
- /**
- * Un-install an individual breakpoint on the back-end. For one platform
- * breakpoint in a given execution context, there could be multiple
- * corresponding back-end breakpoints (one per thread).
- *
- * @param dmc
- * @param breakpoint
- * @param rm
- *
- * @since 4.2
- */
- public void uninstallBreakpoint(final IBreakpointsTargetDMContext dmc, final ICBreakpoint breakpoint, RequestMonitor rm) {
- // Remove all relevant target filters
- // Note that this call is important if a breakpoint is removed directly
- // from the gdb console, or else we will try to re-install it (bug 433044)
- removeAllTargetFilters(dmc, breakpoint);
-
- // Remove breakpoint problem marker (if any)
- removeBreakpointProblemMarker(breakpoint);
-
- doUninstallBreakpoint(dmc, breakpoint, new ImmediateRequestMonitor(rm) {
- @Override
- protected void handleSuccess() {
- Map<ICBreakpoint,Map<String,Object>> platformBPs = fPlatformToAttributesMaps.get(dmc);
- // Note: Protect against NPE. It looks like we just checked the "platformBPs" is not null,
- // in doUninstallBreakpoint(), but there is a race condition that can make it null
- // in the meantime, if the debug session is destroyed. See bug 511727
- if (platformBPs != null) {
- platformBPs.remove(breakpoint);
- }
- super.handleSuccess();
- }
- });
- }
-
- /*
- * Un-install the target breakpoints associated with the given platform breakpoint.
- * The information related to the platform breakpoints is not cleared from the session.
- * This allows the target breakpoints to be re-installed when an attribute of the platform
- * breakpoint is changed.
- */
- private void doUninstallBreakpoint(final IBreakpointsTargetDMContext dmc, final ICBreakpoint breakpoint, final RequestMonitor rm) {
- // Retrieve the breakpoint maps
- final Map<ICBreakpoint,Map<String,Object>> platformBPs = fPlatformToAttributesMaps.get(dmc);
- assert platformBPs != null;
-
- final Map<ICBreakpoint, Vector<IBreakpointDMContext>> breakpointIDs = fPlatformToBPsMaps.get(dmc);
- assert breakpointIDs != null;
-
- final Map<IBreakpointDMContext, ICBreakpoint> targetBPs = fBPToPlatformMaps.get(dmc);
- assert targetBPs != null;
-
- final Map<ICBreakpoint, Set<String>> threadsIDs = fPlatformToBPThreadsMaps.get(dmc);
- assert threadsIDs != null;
-
- // Minimal validation
- if (!platformBPs.containsKey(breakpoint) || !breakpointIDs.containsKey(breakpoint) || !targetBPs.containsValue(breakpoint)) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, BREAKPOINT_ALREADY_REMOVED, null));
- rm.done();
- return;
- }
-
- // Remove completion monitor
- // Upon completion, update the mappings
- final CountingRequestMonitor removeRM = new CountingRequestMonitor(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- // Update the mappings
- threadsIDs.remove(breakpoint);
- fPendingRequests.remove(breakpoint);
+ ///////////////////////////////////////////////////////////////////////////
+ // Back-end interface functions
+ ///////////////////////////////////////////////////////////////////////////
+
+ //-------------------------------------------------------------------------
+ // installBreakpoint
+ //-------------------------------------------------------------------------
+
+ /**
+ * Install a platform breakpoint on the back-end. For a given context, a
+ * platform breakpoint can resolve into multiple back-end breakpoints when
+ * threads are taken into account or if multiple breakpoints are created
+ * on the target using the console.
+ *
+ * @param dmc
+ * @param breakpoint
+ * @param attributes
+ * @param rm
+ */
+ private void installBreakpoint(IBreakpointsTargetDMContext dmc, final ICBreakpoint breakpoint,
+ final Map<String, Object> attributes, final RequestMonitor rm) {
+ // Retrieve the breakpoint maps
+ final Map<ICBreakpoint, Map<String, Object>> platformBPs = fPlatformToAttributesMaps.get(dmc);
+ assert platformBPs != null;
+
+ final Map<ICBreakpoint, Vector<IBreakpointDMContext>> breakpointIDs = fPlatformToBPsMaps.get(dmc);
+ assert breakpointIDs != null;
+
+ final Map<IBreakpointDMContext, ICBreakpoint> targetBPs = fBPToPlatformMaps.get(dmc);
+ assert targetBPs != null;
+
+ final Map<ICBreakpoint, Set<String>> threadsIDs = fPlatformToBPThreadsMaps.get(dmc);
+ assert threadsIDs != null;
+
+ // Ensure the breakpoint has a valid debugger source path
+ if (breakpoint instanceof ICLineBreakpoint && !(breakpoint instanceof ICAddressBreakpoint)
+ && !(breakpoint instanceof ICFunctionBreakpoint)) {
+ String debuggerPath = (String) attributes.get(ATTR_DEBUGGER_PATH);
+ if (debuggerPath == null || debuggerPath.equals(NULL_STRING)) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, NO_DEBUGGER_PATH, null));
+ rm.done();
+ return;
+ }
+ }
+
+ // A back-end breakpoint needs to be installed for each specified thread
+ final Set<String> threads = getThreads(attributes);
+
+ // Update the breakpoint state when all back-end breakpoints have been installed
+ final CountingRequestMonitor installRM = new CountingRequestMonitor(getExecutor(), rm) {
+ @Override
+ protected void handleCompleted() {
+ // Store the platform breakpoint
+ platformBPs.put(breakpoint, attributes);
rm.done();
- }
- };
-
- // Remove the back-end breakpoints
- // Remove the entry from the breakpointIDs map right away to indicate that we have already
- // taken care of this breakpoint. This avoids race conditions with the shutdown
- // which would also try to decrement the install count (bug 344635)
- Vector<IBreakpointDMContext> list = breakpointIDs.remove(breakpoint);
- int count = 0;
- if (list != null) {
- for (final IBreakpointDMContext bp : list) {
- targetBPs.remove(bp);
- decrementInstallCount(bp, breakpoint, new RequestMonitor(getExecutor(), removeRM) {
- @Override
- protected void handleCompleted() {
- fBreakpoints.removeBreakpoint(bp, removeRM);
- }
- });
- }
- count = list.size();
- list.clear(); // probably not necessary
- }
- removeRM.setDoneCount(count);
- }
-
-
- private void decrementInstallCount(IBreakpointDMContext targetDmc, final ICBreakpoint breakpoint, final RequestMonitor rm) {
- fBreakpoints.getBreakpointDMData(targetDmc, new DataRequestMonitor<IBreakpointDMData>(getExecutor(), rm) {
- @Override
- protected void handleCompleted() {
- boolean pending = false;
- if (isSuccess()) {
- IBreakpointDMData data = getData();
- if (data instanceof MIBreakpointDMData) {
- pending = ((MIBreakpointDMData)data).isPending();
- }
- }
- // Finally, update the platform breakpoint to show it was un-installed.
- // But we don't do this for pending breakpoints since they were
- // not marked as installed.
- if (!pending) {
- try {
- breakpoint.decrementInstallCount();
- } catch (CoreException e) {
- }
- }
- rm.done();
- }
- });
- }
- //-------------------------------------------------------------------------
- // modifyBreakpoint
- //-------------------------------------------------------------------------
-
- /**
- * Modify a platform breakpoint which can translate to quite a few updates
- * on the target...
- *
- * @param dmc
- * @param breakpoint
- * @param attributes
- * @param oldValues
- * @param rm
- */
- private void modifyBreakpoint(final IBreakpointsTargetDMContext dmc, final ICBreakpoint breakpoint,
- final Map<String,Object> attributes, final IMarkerDelta oldValues, final RequestMonitor rm)
- {
- // Retrieve the breakpoint maps
- final Map<ICBreakpoint,Map<String,Object>> platformBPs = fPlatformToAttributesMaps.get(dmc);
- assert platformBPs != null;
-
- final Map<ICBreakpoint, Vector<IBreakpointDMContext>> breakpointIDs = fPlatformToBPsMaps.get(dmc);
- assert breakpointIDs != null;
-
- final Map<IBreakpointDMContext, ICBreakpoint> targetBPs = fBPToPlatformMaps.get(dmc);
- assert targetBPs != null;
-
- final Map<ICBreakpoint, Set<String>> threadsIDs = fPlatformToBPThreadsMaps.get(dmc);
- assert threadsIDs != null;
-
- boolean filtered = isBreakpointEntirelyFiltered(dmc, breakpoint);
-
- if (filtered && !platformBPs.containsKey(breakpoint)) {
- rm.done();
- return;
- }
-
- // Check if the breakpoint is installed:
- // the installation might have failed; in this case, we try to install it again because
- // some attribute might have changed which will make the install succeed.
- if (!breakpointIDs.containsKey(breakpoint) && !targetBPs.containsValue(breakpoint)) {
- if (!filtered) {
- // Do not try to re-install the breakpoint if the change event is the result of changes
- // in the breakpoint's install count.
- // Excluding ATTR_DEBUGGER_PATH from the comparison because it has been set just before
- // "modifyBreakpoint()" was called.
- // (Bugzilla 534309) Guard against NULL oldValues, which is legitimate, in which case use an empty Map.
- String[] diff = compareAttributes(oldValues == null ? Collections.emptyMap() : oldValues.getAttributes(),
- attributes,new String[] { ATTR_DEBUGGER_PATH });
- if (diff.length != 1 || !diff[0].equals(ICBreakpoint.INSTALL_COUNT)) {
- attributes.put(ATTR_DEBUGGER_PATH, NULL_STRING);
- attributes.put(ATTR_THREAD_FILTER, extractThreads(dmc, breakpoint));
- attributes.put(ATTR_THREAD_ID, NULL_STRING);
- determineDebuggerPath(dmc, attributes, new RequestMonitor(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- installBreakpoint(dmc, breakpoint, attributes, rm);
- }
- });
- }
- else {
- rm.done();
- }
- }
- else {
- rm.done();
- }
- return;
- }
-
- if (filtered) {
- uninstallBreakpoint(dmc, breakpoint, rm );
- return;
- }
-
- // Get the original breakpoint attributes
- final Map<String,Object> originalAttributes = platformBPs.get(breakpoint);
- if (originalAttributes == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, INVALID_BREAKPOINT, null));
- rm.done();
- return;
- }
-
- // Determine the attributes delta
- final Map<String,Object> oldAttributes = new HashMap<>(originalAttributes);
- oldAttributes.put(ATTR_THREAD_FILTER, threadsIDs.get(breakpoint));
-
- final Set<String> newThreads = extractThreads(dmc, breakpoint);
- Map<String,Object> newAttributes = new HashMap<>(attributes);
- newAttributes.put(ATTR_THREAD_FILTER, newThreads);
-
- final Map<String,Object> attributesDelta = determineAttributesDelta(oldAttributes, newAttributes);
-
- // Get the list of back-end breakpoints
- final Vector<IBreakpointDMContext> oldTargetBPs = new Vector<>(breakpointIDs.get(breakpoint));
- if (oldTargetBPs.isEmpty()) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, INVALID_BREAKPOINT, null));
- rm.done();
- return;
- }
-
- // We're all set for the breakpoint update.
- //
- // The path for a simple update is straightforward:
- // - For each back-end BP corresponding to a platform BP
- // - Send an update command to the back-end
- // - If the operation succeeded, update the data structures
- // - If the operation failed, try to roll-back
- //
- // In cases where the the back-end breakpoint cannot be
- // simply updated (e.g. thread filter modification), the old
- // breakpoint has to be removed and new one(s) inserted.
- //
- // The path for such an update is:
- // - Install the updated breakpoint
- // - In the operation succeeded
- // - Remove the old breakpoint(s)
- // - Perform any pending update
-
- // Update completion monitor
- final CountingRequestMonitor updateRM = new CountingRequestMonitor(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- // Success: simply store the new attributes
- platformBPs.put(breakpoint, attributes);
- rm.done();
- }
-
- @Override
- protected void handleError() {
- // Store the error message to use in the problem marker
- final String errorMessage = getStatus().getException() != null ?
- getStatus().getException().getLocalizedMessage() : getStatus().getMessage();
- // Try to uninstall the target breakpoints and add the problem marker
- // with the error message to the platform breakpoint.
- doUninstallBreakpoint(
- dmc,
- breakpoint,
- new ImmediateRequestMonitor(rm) {
+ }
+ };
+ installRM.setDoneCount(threads.size());
+
+ // Install the back-end breakpoint(s)
+ for (final String thread : threads) {
+ DataRequestMonitor<IBreakpointDMContext> drm = new DataRequestMonitor<IBreakpointDMContext>(getExecutor(),
+ installRM) {
+ @Override
+ protected void handleSuccess() {
+ // Add the new back-end breakpoint to the map
+ Vector<IBreakpointDMContext> list = breakpointIDs.get(breakpoint);
+ if (list == null) {
+ list = new Vector<>();
+ }
+
+ IBreakpointDMContext targetBP = getData();
+ list.add(targetBP);
+ breakpointIDs.put(breakpoint, list);
+
+ // Add the reverse mapping
+ targetBPs.put(targetBP, breakpoint);
+
+ // And update the corresponding thread list
+ Set<String> thrds = threadsIDs.get(breakpoint);
+ if (thrds == null) {
+ thrds = new HashSet<>();
+ }
+
+ thrds.add(thread);
+ threadsIDs.put(breakpoint, thrds);
+
+ // Reset the thread (is it necessary?)
+ attributes.put(ATTR_THREAD_ID, NULL_STRING);
+
+ // Remove breakpoint problem marker (if any)
+ removeBreakpointProblemMarker(breakpoint);
+
+ // Check for a pending breakpoint before showing that it was properly installed
+ fBreakpoints.getBreakpointDMData(targetBP,
+ new DataRequestMonitor<IBreakpointDMData>(getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ boolean pending = false;
+ if (isSuccess()) {
+ IBreakpointDMData data = getData();
+ if (data instanceof MIBreakpointDMData) {
+ pending = ((MIBreakpointDMData) data).isPending();
+ }
+ }
+ // Finally, update the platform breakpoint to show it was installed, unless we have a pending breakpoint
+ if (!pending) {
+ try {
+ breakpoint.incrementInstallCount();
+ } catch (CoreException e) {
+ }
+ }
+ installRM.done();
+ }
+ });
+ }
+
+ @Override
+ protected void handleError() {
+ String detailedMessage;
+ if (getStatus().getException() != null && getStatus().getException().getMessage() != null) {
+ detailedMessage = getStatus().getException().getMessage();
+ } else {
+ detailedMessage = getStatus().getMessage();
+ }
+ String description = (detailedMessage == null) ? Messages.Breakpoint_attribute_problem
+ : MessageFormat.format(Messages.Breakpoint_attribute_detailed_problem,
+ new Object[] { detailedMessage });
+
+ addBreakpointProblemMarker(breakpoint, description, IMarker.SEVERITY_WARNING);
+ installRM.done();
+ }
+ };
+
+ // Convert the breakpoint attributes for the back-end
+ attributes.put(ATTR_THREAD_ID, thread);
+ Map<String, Object> targetAttributes = convertToTargetBreakpoint(breakpoint, attributes);
+ // Must install breakpoint right away, even if disabled, so that
+ // we can find out if it applies to this target (Bug 389070)
+ fBreakpoints.insertBreakpoint(dmc, targetAttributes, drm);
+ }
+ }
+
+ private void addBreakpointProblemMarker(final ICBreakpoint breakpoint, final String description,
+ final int severity) {
+
+ new Job("Add Breakpoint Problem Marker") { //$NON-NLS-1$
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+
+ if (breakpoint instanceof ICLineBreakpoint) {
+ // If we have already have a problem marker on this breakpoint
+ // we should remove it first.
+ IMarker marker = fBreakpointMarkerProblems.remove(breakpoint);
+ if (marker != null) {
+ try {
+ marker.delete();
+ } catch (CoreException e) {
+ }
+ }
+
+ ICLineBreakpoint lineBreakpoint = (ICLineBreakpoint) breakpoint;
+ try {
+ // Locate the workspace resource via the breakpoint marker
+ IMarker breakpointMarker = lineBreakpoint.getMarker();
+ IResource resource = breakpointMarker.getResource();
+
+ // Add a problem marker to the resource
+ IMarker problemMarker = resource.createMarker(BreakpointProblems.BREAKPOINT_PROBLEM_MARKER_ID);
+ int lineNumber = lineBreakpoint.getLineNumber();
+ String sourceHandle = lineBreakpoint.getSourceHandle();
+ problemMarker.setAttribute(IMarker.LOCATION, String.valueOf(lineNumber));
+ problemMarker.setAttribute(IMarker.MESSAGE, description);
+ problemMarker.setAttribute(IMarker.SEVERITY, severity);
+ problemMarker.setAttribute(IMarker.LINE_NUMBER, lineNumber);
+ if (sourceHandle != null) {
+ problemMarker.setAttribute(ICModelMarker.C_MODEL_MARKER_EXTERNAL_LOCATION, sourceHandle);
+ }
+
+ // And save the baby
+ fBreakpointMarkerProblems.put(breakpoint, problemMarker);
+ } catch (CoreException e) {
+ }
+ }
+ return Status.OK_STATUS;
+ }
+ }.schedule();
+ }
+
+ private void removeBreakpointProblemMarker(final ICBreakpoint breakpoint) {
+
+ new Job("Remove Breakpoint Problem Marker") { //$NON-NLS-1$
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+
+ IMarker marker = fBreakpointMarkerProblems.remove(breakpoint);
+ if (marker != null) {
+ try {
+ marker.delete();
+ } catch (CoreException e) {
+ }
+ }
+
+ return Status.OK_STATUS;
+ }
+ }.schedule();
+ }
+
+ //-------------------------------------------------------------------------
+ // uninstallBreakpoint
+ //-------------------------------------------------------------------------
+
+ /**
+ * Un-install an individual breakpoint on the back-end. For one platform
+ * breakpoint in a given execution context, there could be multiple
+ * corresponding back-end breakpoints (one per thread).
+ *
+ * @param dmc
+ * @param breakpoint
+ * @param rm
+ *
+ * @since 4.2
+ */
+ public void uninstallBreakpoint(final IBreakpointsTargetDMContext dmc, final ICBreakpoint breakpoint,
+ RequestMonitor rm) {
+ // Remove all relevant target filters
+ // Note that this call is important if a breakpoint is removed directly
+ // from the gdb console, or else we will try to re-install it (bug 433044)
+ removeAllTargetFilters(dmc, breakpoint);
+
+ // Remove breakpoint problem marker (if any)
+ removeBreakpointProblemMarker(breakpoint);
+
+ doUninstallBreakpoint(dmc, breakpoint, new ImmediateRequestMonitor(rm) {
+ @Override
+ protected void handleSuccess() {
+ Map<ICBreakpoint, Map<String, Object>> platformBPs = fPlatformToAttributesMaps.get(dmc);
+ // Note: Protect against NPE. It looks like we just checked the "platformBPs" is not null,
+ // in doUninstallBreakpoint(), but there is a race condition that can make it null
+ // in the meantime, if the debug session is destroyed. See bug 511727
+ if (platformBPs != null) {
+ platformBPs.remove(breakpoint);
+ }
+ super.handleSuccess();
+ }
+ });
+ }
+
+ /*
+ * Un-install the target breakpoints associated with the given platform breakpoint.
+ * The information related to the platform breakpoints is not cleared from the session.
+ * This allows the target breakpoints to be re-installed when an attribute of the platform
+ * breakpoint is changed.
+ */
+ private void doUninstallBreakpoint(final IBreakpointsTargetDMContext dmc, final ICBreakpoint breakpoint,
+ final RequestMonitor rm) {
+ // Retrieve the breakpoint maps
+ final Map<ICBreakpoint, Map<String, Object>> platformBPs = fPlatformToAttributesMaps.get(dmc);
+ assert platformBPs != null;
+
+ final Map<ICBreakpoint, Vector<IBreakpointDMContext>> breakpointIDs = fPlatformToBPsMaps.get(dmc);
+ assert breakpointIDs != null;
+
+ final Map<IBreakpointDMContext, ICBreakpoint> targetBPs = fBPToPlatformMaps.get(dmc);
+ assert targetBPs != null;
+
+ final Map<ICBreakpoint, Set<String>> threadsIDs = fPlatformToBPThreadsMaps.get(dmc);
+ assert threadsIDs != null;
+
+ // Minimal validation
+ if (!platformBPs.containsKey(breakpoint) || !breakpointIDs.containsKey(breakpoint)
+ || !targetBPs.containsValue(breakpoint)) {
+ rm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, BREAKPOINT_ALREADY_REMOVED, null));
+ rm.done();
+ return;
+ }
+
+ // Remove completion monitor
+ // Upon completion, update the mappings
+ final CountingRequestMonitor removeRM = new CountingRequestMonitor(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ // Update the mappings
+ threadsIDs.remove(breakpoint);
+ fPendingRequests.remove(breakpoint);
+ rm.done();
+ }
+ };
+
+ // Remove the back-end breakpoints
+ // Remove the entry from the breakpointIDs map right away to indicate that we have already
+ // taken care of this breakpoint. This avoids race conditions with the shutdown
+ // which would also try to decrement the install count (bug 344635)
+ Vector<IBreakpointDMContext> list = breakpointIDs.remove(breakpoint);
+ int count = 0;
+ if (list != null) {
+ for (final IBreakpointDMContext bp : list) {
+ targetBPs.remove(bp);
+ decrementInstallCount(bp, breakpoint, new RequestMonitor(getExecutor(), removeRM) {
+ @Override
+ protected void handleCompleted() {
+ fBreakpoints.removeBreakpoint(bp, removeRM);
+ }
+ });
+ }
+ count = list.size();
+ list.clear(); // probably not necessary
+ }
+ removeRM.setDoneCount(count);
+ }
+
+ private void decrementInstallCount(IBreakpointDMContext targetDmc, final ICBreakpoint breakpoint,
+ final RequestMonitor rm) {
+ fBreakpoints.getBreakpointDMData(targetDmc, new DataRequestMonitor<IBreakpointDMData>(getExecutor(), rm) {
+ @Override
+ protected void handleCompleted() {
+ boolean pending = false;
+ if (isSuccess()) {
+ IBreakpointDMData data = getData();
+ if (data instanceof MIBreakpointDMData) {
+ pending = ((MIBreakpointDMData) data).isPending();
+ }
+ }
+ // Finally, update the platform breakpoint to show it was un-installed.
+ // But we don't do this for pending breakpoints since they were
+ // not marked as installed.
+ if (!pending) {
+ try {
+ breakpoint.decrementInstallCount();
+ } catch (CoreException e) {
+ }
+ }
+ rm.done();
+ }
+ });
+ }
+ //-------------------------------------------------------------------------
+ // modifyBreakpoint
+ //-------------------------------------------------------------------------
+
+ /**
+ * Modify a platform breakpoint which can translate to quite a few updates
+ * on the target...
+ *
+ * @param dmc
+ * @param breakpoint
+ * @param attributes
+ * @param oldValues
+ * @param rm
+ */
+ private void modifyBreakpoint(final IBreakpointsTargetDMContext dmc, final ICBreakpoint breakpoint,
+ final Map<String, Object> attributes, final IMarkerDelta oldValues, final RequestMonitor rm) {
+ // Retrieve the breakpoint maps
+ final Map<ICBreakpoint, Map<String, Object>> platformBPs = fPlatformToAttributesMaps.get(dmc);
+ assert platformBPs != null;
+
+ final Map<ICBreakpoint, Vector<IBreakpointDMContext>> breakpointIDs = fPlatformToBPsMaps.get(dmc);
+ assert breakpointIDs != null;
+
+ final Map<IBreakpointDMContext, ICBreakpoint> targetBPs = fBPToPlatformMaps.get(dmc);
+ assert targetBPs != null;
+
+ final Map<ICBreakpoint, Set<String>> threadsIDs = fPlatformToBPThreadsMaps.get(dmc);
+ assert threadsIDs != null;
+
+ boolean filtered = isBreakpointEntirelyFiltered(dmc, breakpoint);
+
+ if (filtered && !platformBPs.containsKey(breakpoint)) {
+ rm.done();
+ return;
+ }
+
+ // Check if the breakpoint is installed:
+ // the installation might have failed; in this case, we try to install it again because
+ // some attribute might have changed which will make the install succeed.
+ if (!breakpointIDs.containsKey(breakpoint) && !targetBPs.containsValue(breakpoint)) {
+ if (!filtered) {
+ // Do not try to re-install the breakpoint if the change event is the result of changes
+ // in the breakpoint's install count.
+ // Excluding ATTR_DEBUGGER_PATH from the comparison because it has been set just before
+ // "modifyBreakpoint()" was called.
+ // (Bugzilla 534309) Guard against NULL oldValues, which is legitimate, in which case use an empty Map.
+ String[] diff = compareAttributes(
+ oldValues == null ? Collections.emptyMap() : oldValues.getAttributes(), attributes,
+ new String[] { ATTR_DEBUGGER_PATH });
+ if (diff.length != 1 || !diff[0].equals(ICBreakpoint.INSTALL_COUNT)) {
+ attributes.put(ATTR_DEBUGGER_PATH, NULL_STRING);
+ attributes.put(ATTR_THREAD_FILTER, extractThreads(dmc, breakpoint));
+ attributes.put(ATTR_THREAD_ID, NULL_STRING);
+ determineDebuggerPath(dmc, attributes, new RequestMonitor(getExecutor(), rm) {
@Override
protected void handleSuccess() {
- addBreakpointProblemMarker(breakpoint, errorMessage, IMarker.SEVERITY_WARNING);
- rm.done();
+ installBreakpoint(dmc, breakpoint, attributes, rm);
+ }
+ });
+ } else {
+ rm.done();
+ }
+ } else {
+ rm.done();
+ }
+ return;
+ }
+
+ if (filtered) {
+ uninstallBreakpoint(dmc, breakpoint, rm);
+ return;
+ }
+
+ // Get the original breakpoint attributes
+ final Map<String, Object> originalAttributes = platformBPs.get(breakpoint);
+ if (originalAttributes == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, INVALID_BREAKPOINT, null));
+ rm.done();
+ return;
+ }
+
+ // Determine the attributes delta
+ final Map<String, Object> oldAttributes = new HashMap<>(originalAttributes);
+ oldAttributes.put(ATTR_THREAD_FILTER, threadsIDs.get(breakpoint));
+
+ final Set<String> newThreads = extractThreads(dmc, breakpoint);
+ Map<String, Object> newAttributes = new HashMap<>(attributes);
+ newAttributes.put(ATTR_THREAD_FILTER, newThreads);
+
+ final Map<String, Object> attributesDelta = determineAttributesDelta(oldAttributes, newAttributes);
+
+ // Get the list of back-end breakpoints
+ final Vector<IBreakpointDMContext> oldTargetBPs = new Vector<>(breakpointIDs.get(breakpoint));
+ if (oldTargetBPs.isEmpty()) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, INVALID_BREAKPOINT, null));
+ rm.done();
+ return;
+ }
+
+ // We're all set for the breakpoint update.
+ //
+ // The path for a simple update is straightforward:
+ // - For each back-end BP corresponding to a platform BP
+ // - Send an update command to the back-end
+ // - If the operation succeeded, update the data structures
+ // - If the operation failed, try to roll-back
+ //
+ // In cases where the the back-end breakpoint cannot be
+ // simply updated (e.g. thread filter modification), the old
+ // breakpoint has to be removed and new one(s) inserted.
+ //
+ // The path for such an update is:
+ // - Install the updated breakpoint
+ // - In the operation succeeded
+ // - Remove the old breakpoint(s)
+ // - Perform any pending update
+
+ // Update completion monitor
+ final CountingRequestMonitor updateRM = new CountingRequestMonitor(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ // Success: simply store the new attributes
+ platformBPs.put(breakpoint, attributes);
+ rm.done();
+ }
+
+ @Override
+ protected void handleError() {
+ // Store the error message to use in the problem marker
+ final String errorMessage = getStatus().getException() != null
+ ? getStatus().getException().getLocalizedMessage()
+ : getStatus().getMessage();
+ // Try to uninstall the target breakpoints and add the problem marker
+ // with the error message to the platform breakpoint.
+ doUninstallBreakpoint(dmc, breakpoint, new ImmediateRequestMonitor(rm) {
+ @Override
+ protected void handleSuccess() {
+ addBreakpointProblemMarker(breakpoint, errorMessage, IMarker.SEVERITY_WARNING);
+ rm.done();
+ }
+
+ @Override
+ protected void handleError() {
+ // Reset the breakpoint attributes. This will trigger a
+ // breakpoint change event and the correct delta will be
+ // computed, resulting in a correctly restored breakpoint
+ // at the back-end.
+ rollbackAttributes(breakpoint, oldValues);
+ platformBPs.put(breakpoint, attributes);
+
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, INVALID_PARAMETER,
+ getStatus().getException()));
+ rm.done();
+ };
+ });
+ }
+ };
+
+ // Everything OK: remove the old back-end breakpoints
+ final Vector<IBreakpointDMContext> newTargetBPs = new Vector<>();
+ final CountingRequestMonitor removeRM = new CountingRequestMonitor(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ // All right! Save the new list and perform the final update
+ Map<ICBreakpoint, Vector<IBreakpointDMContext>> breakpointIDs = fPlatformToBPsMaps.get(dmc);
+ if (breakpointIDs == null) {
+ rm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, INVALID_BREAKPOINT, null));
+ rm.done();
+ return;
+ }
+ breakpointIDs.put(breakpoint, newTargetBPs);
+ for (IBreakpointDMContext ref : newTargetBPs) {
+ fBreakpoints.updateBreakpoint(ref, attributesDelta, updateRM);
+ }
+ updateRM.setDoneCount(newTargetBPs.size());
+ }
+ };
+
+ // New back-end breakpoints insertion monitor
+ // Holds the list of new back-end breakpoint contexts of the platform breakpoint
+ final DataRequestMonitor<Vector<IBreakpointDMContext>> insertRM = new DataRequestMonitor<Vector<IBreakpointDMContext>>(
+ getExecutor(), null) {
+
+ @Override
+ // In theory, we could have had a partial success and the original threads
+ // list would be invalid. We think it is highly unlikely so we assume that
+ // either everything went fine or else everything failed.
+ protected void handleSuccess() {
+ // Get the list of new back-end breakpoints contexts
+ newTargetBPs.addAll(getData());
+ for (IBreakpointDMContext newRef : newTargetBPs) {
+ targetBPs.put(newRef, breakpoint);
+ }
+ threadsIDs.put(breakpoint, newThreads);
+ for (final IBreakpointDMContext ref : oldTargetBPs) {
+ targetBPs.remove(ref);
+ decrementInstallCount(ref, breakpoint, // A tad early but it should work...
+ new RequestMonitor(getExecutor(), removeRM) {
+ @Override
+ protected void handleCompleted() {
+ fBreakpoints.removeBreakpoint(ref, removeRM);
+ }
+ });
+ }
+ removeRM.setDoneCount(oldTargetBPs.size());
+ }
+
+ @Override
+ protected void handleError() {
+ // Store the error message to use in the problem marker
+ final String errorMessage = getStatus().getException() != null
+ ? getStatus().getException().getLocalizedMessage()
+ : getStatus().getMessage();
+ doUninstallBreakpoint(dmc, breakpoint, new ImmediateRequestMonitor(updateRM) {
+ @Override
+ protected void handleSuccess() {
+ addBreakpointProblemMarker(breakpoint, errorMessage, IMarker.SEVERITY_WARNING);
+ updateRM.setDoneCount(0);
+ };
+ });
+ }
+ };
+
+ // If the changes in the breakpoint attributes justify it, install a
+ // new set of back-end breakpoint(s) and then update them
+ if (needsResinstallation(attributesDelta)) {
+ reinstallBreakpoint(dmc, breakpoint, attributes, newThreads, insertRM);
+ } else {
+ // Update the back-end breakpoint(s) state
+ for (IBreakpointDMContext ref : oldTargetBPs) {
+ fBreakpoints.updateBreakpoint(ref, attributesDelta, updateRM);
+ }
+ updateRM.setDoneCount(oldTargetBPs.size());
+ }
+ }
+
+ /**
+ * Re-install the back-end breakpoints
+ *
+ * @param context the target context
+ * @param breakpoint the platform breakpoint
+ * @param attributes breakpoint augmented attributes
+ * @param threads list of threads where breakpoint is to be installed
+ * @param drm will contain the list of successfully installed back-end breakpoints
+ */
+ private void reinstallBreakpoint(final IBreakpointsTargetDMContext context, final ICBreakpoint breakpoint,
+ final Map<String, Object> attributes, Set<String> threads,
+ final DataRequestMonitor<Vector<IBreakpointDMContext>> drm) {
+ // Our new list of back-end breakpoints. Built as we go.
+ final Vector<IBreakpointDMContext> breakpointList = new Vector<>();
+
+ // Counting monitor for the new back-end breakpoints to install
+ // Once we're done, return the new list of back-end breakpoints contexts
+ final CountingRequestMonitor installRM = new CountingRequestMonitor(getExecutor(), drm) {
+ @Override
+ protected void handleSuccess() {
+ // Report whatever we have managed to install
+ // It is very likely installation either succeeded or failed for all
+ drm.setData(breakpointList);
+ drm.done();
+ }
+ };
+ installRM.setDoneCount(threads.size());
+
+ // And install the new back-end breakpoints
+ for (String thread : threads) {
+ // Convert the breakpoint attributes for the back-end
+ // Refresh the set of attributes at each iteration just in case...
+ Map<String, Object> attrs = convertToTargetBreakpoint(breakpoint, attributes);
+ // Tracepoints and dynamic printf are not affected by "skip-all"
+ if (!(breakpoint instanceof ICTracepoint) && !(breakpoint instanceof ICDynamicPrintf)
+ && !fBreakpointManager.isEnabled()) {
+ attrs.put(MIBreakpoints.IS_ENABLED, false);
+ }
+
+ attrs.put(MIBreakpointDMData.THREAD_ID, thread);
+
+ // Then install the spiked breakpoint
+ fBreakpoints.insertBreakpoint(context, attrs,
+ new DataRequestMonitor<IBreakpointDMContext>(getExecutor(), installRM) {
+ @Override
+ protected void handleSuccess() {
+ // Add the new back-end breakpoint context to the list
+ breakpointList.add(getData());
+
+ // Check for a pending breakpoint before showing that it was properly installed
+ fBreakpoints.getBreakpointDMData(getData(),
+ new DataRequestMonitor<IBreakpointDMData>(getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ boolean pending = false;
+ if (isSuccess()) {
+ IBreakpointDMData data = getData();
+ if (data instanceof MIBreakpointDMData) {
+ pending = ((MIBreakpointDMData) data).isPending();
+ }
+ }
+ // Finally, update the platform breakpoint to show it was installed, unless we have a pending breakpoint
+ if (!pending) {
+ try {
+ breakpoint.incrementInstallCount();
+ } catch (CoreException e) {
+ }
+ }
+ installRM.done();
+ }
+ });
}
@Override
protected void handleError() {
- // Reset the breakpoint attributes. This will trigger a
- // breakpoint change event and the correct delta will be
- // computed, resulting in a correctly restored breakpoint
- // at the back-end.
- rollbackAttributes(breakpoint, oldValues);
- platformBPs.put(breakpoint, attributes);
-
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, INVALID_PARAMETER, getStatus().getException()));
- rm.done();
- };
- }
- );
- }
- };
-
- // Everything OK: remove the old back-end breakpoints
- final Vector<IBreakpointDMContext> newTargetBPs = new Vector<>();
- final CountingRequestMonitor removeRM = new CountingRequestMonitor(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- // All right! Save the new list and perform the final update
- Map<ICBreakpoint, Vector<IBreakpointDMContext>> breakpointIDs = fPlatformToBPsMaps.get(dmc);
- if (breakpointIDs == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, INVALID_BREAKPOINT, null));
- rm.done();
- return;
- }
- breakpointIDs.put(breakpoint, newTargetBPs);
- for (IBreakpointDMContext ref : newTargetBPs) {
- fBreakpoints.updateBreakpoint(ref, attributesDelta, updateRM);
- }
- updateRM.setDoneCount(newTargetBPs.size());
- }};
-
- // New back-end breakpoints insertion monitor
- // Holds the list of new back-end breakpoint contexts of the platform breakpoint
- final DataRequestMonitor<Vector<IBreakpointDMContext>> insertRM =
- new DataRequestMonitor<Vector<IBreakpointDMContext>>(getExecutor(), null) {
-
- @Override
- // In theory, we could have had a partial success and the original threads
- // list would be invalid. We think it is highly unlikely so we assume that
- // either everything went fine or else everything failed.
- protected void handleSuccess() {
- // Get the list of new back-end breakpoints contexts
- newTargetBPs.addAll(getData());
- for (IBreakpointDMContext newRef : newTargetBPs) {
- targetBPs.put(newRef, breakpoint);
- }
- threadsIDs.put(breakpoint, newThreads);
- for (final IBreakpointDMContext ref : oldTargetBPs) {
- targetBPs.remove(ref);
- decrementInstallCount(ref, breakpoint, // A tad early but it should work...
- new RequestMonitor(getExecutor(), removeRM) {
- @Override
- protected void handleCompleted() {
- fBreakpoints.removeBreakpoint(ref, removeRM);
- }
- });
- }
- removeRM.setDoneCount(oldTargetBPs.size());
- }
-
- @Override
- protected void handleError() {
- // Store the error message to use in the problem marker
- final String errorMessage = getStatus().getException() != null ?
- getStatus().getException().getLocalizedMessage() : getStatus().getMessage();
- doUninstallBreakpoint(
- dmc,
- breakpoint,
- new ImmediateRequestMonitor(updateRM) {
- @Override
- protected void handleSuccess() {
- addBreakpointProblemMarker(breakpoint, errorMessage, IMarker.SEVERITY_WARNING);
- updateRM.setDoneCount(0);
- };
+ String detailedMessage;
+ if (getStatus().getException() != null && getStatus().getException().getMessage() != null) {
+ detailedMessage = getStatus().getException().getMessage();
+ } else {
+ detailedMessage = getStatus().getMessage();
+ }
+ String description = (detailedMessage == null) ? Messages.Breakpoint_attribute_problem
+ : MessageFormat.format(Messages.Breakpoint_attribute_detailed_problem,
+ new Object[] { detailedMessage });
+ // Add the new back-end breakpoint context to the list
+ installRM.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED,
+ description, getStatus().getException()));
+ installRM.done();
}
- );
- }
- };
-
- // If the changes in the breakpoint attributes justify it, install a
- // new set of back-end breakpoint(s) and then update them
- if (needsResinstallation(attributesDelta)) {
- reinstallBreakpoint(dmc, breakpoint, attributes, newThreads, insertRM);
- }
- else {
- // Update the back-end breakpoint(s) state
- for (IBreakpointDMContext ref : oldTargetBPs) {
- fBreakpoints.updateBreakpoint(ref, attributesDelta, updateRM);
- }
- updateRM.setDoneCount(oldTargetBPs.size());
- }
- }
-
- /**
- * Re-install the back-end breakpoints
- *
- * @param context the target context
- * @param breakpoint the platform breakpoint
- * @param attributes breakpoint augmented attributes
- * @param threads list of threads where breakpoint is to be installed
- * @param drm will contain the list of successfully installed back-end breakpoints
- */
- private void reinstallBreakpoint(final IBreakpointsTargetDMContext context, final ICBreakpoint breakpoint,
- final Map<String,Object> attributes, Set<String> threads, final DataRequestMonitor<Vector<IBreakpointDMContext>> drm)
- {
- // Our new list of back-end breakpoints. Built as we go.
- final Vector<IBreakpointDMContext> breakpointList = new Vector<>();
-
- // Counting monitor for the new back-end breakpoints to install
- // Once we're done, return the new list of back-end breakpoints contexts
- final CountingRequestMonitor installRM = new CountingRequestMonitor(getExecutor(), drm) {
- @Override
- protected void handleSuccess() {
- // Report whatever we have managed to install
- // It is very likely installation either succeeded or failed for all
- drm.setData(breakpointList);
- drm.done();
- }
- };
- installRM.setDoneCount(threads.size());
-
- // And install the new back-end breakpoints
- for (String thread : threads) {
- // Convert the breakpoint attributes for the back-end
- // Refresh the set of attributes at each iteration just in case...
- Map<String,Object> attrs = convertToTargetBreakpoint(breakpoint, attributes);
- // Tracepoints and dynamic printf are not affected by "skip-all"
- if (!(breakpoint instanceof ICTracepoint) && !(breakpoint instanceof ICDynamicPrintf)
- && !fBreakpointManager.isEnabled()) {
- attrs.put(MIBreakpoints.IS_ENABLED, false);
- }
-
- attrs.put(MIBreakpointDMData.THREAD_ID, thread);
-
- // Then install the spiked breakpoint
- fBreakpoints.insertBreakpoint(context, attrs,
- new DataRequestMonitor<IBreakpointDMContext>(getExecutor(), installRM) {
- @Override
- protected void handleSuccess() {
- // Add the new back-end breakpoint context to the list
- breakpointList.add(getData());
-
- // Check for a pending breakpoint before showing that it was properly installed
- fBreakpoints.getBreakpointDMData(getData(), new DataRequestMonitor<IBreakpointDMData>(getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- boolean pending = false;
- if (isSuccess()) {
- IBreakpointDMData data = getData();
- if (data instanceof MIBreakpointDMData) {
- pending = ((MIBreakpointDMData)data).isPending();
- }
- }
- // Finally, update the platform breakpoint to show it was installed, unless we have a pending breakpoint
- if (!pending) {
- try {
- breakpoint.incrementInstallCount();
- } catch (CoreException e) {
- }
- }
- installRM.done();
- }
- });
- }
-
- @Override
- protected void handleError() {
- String detailedMessage;
- if (getStatus().getException() != null &&
- getStatus().getException().getMessage() != null) {
- detailedMessage = getStatus().getException().getMessage();
- } else {
- detailedMessage = getStatus().getMessage();
- }
- String description = (detailedMessage == null) ?
- Messages.Breakpoint_attribute_problem :
- MessageFormat.format(Messages.Breakpoint_attribute_detailed_problem, new Object[] { detailedMessage});
- // Add the new back-end breakpoint context to the list
- installRM.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, description, getStatus().getException()));
- installRM.done();
- }
- });
- }
- }
-
- ///////////////////////////////////////////////////////////////////////////
- // IBreakpointManagerListener implementation
- ///////////////////////////////////////////////////////////////////////////
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.IBreakpointManagerListener#breakpointManagerEnablementChanged(boolean)
- */
+ });
+ }
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // IBreakpointManagerListener implementation
+ ///////////////////////////////////////////////////////////////////////////
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.core.IBreakpointManagerListener#breakpointManagerEnablementChanged(boolean)
+ */
@Override
- public void breakpointManagerEnablementChanged(boolean enabled) {
-
- // Only modify enabled breakpoints
- for (IBreakpointsTargetDMContext context : fPlatformToBPsMaps.keySet()) {
- for (ICBreakpoint breakpoint : fPlatformToBPsMaps.get(context).keySet()) {
- try {
- // Note that Tracepoints and dynamic printf are not affected by "skip-all"
- if (!(breakpoint instanceof ICTracepoint) && !(breakpoint instanceof ICDynamicPrintf)
- && breakpoint.isEnabled()) {
- for (IBreakpointDMContext ref : fPlatformToBPsMaps.get(context).get(breakpoint)) {
- Map<String,Object> delta = new HashMap<>();
- delta.put(MIBreakpoints.IS_ENABLED, enabled);
- fBreakpoints.updateBreakpoint(ref, delta, new RequestMonitor(getExecutor(), null));
- }
- }
- } catch (CoreException e) {
- }
- }
- }
- }
-
- ///////////////////////////////////////////////////////////////////////////
- // IBreakpointListener implementation
- ///////////////////////////////////////////////////////////////////////////
-
- @ThreadSafe
+ public void breakpointManagerEnablementChanged(boolean enabled) {
+
+ // Only modify enabled breakpoints
+ for (IBreakpointsTargetDMContext context : fPlatformToBPsMaps.keySet()) {
+ for (ICBreakpoint breakpoint : fPlatformToBPsMaps.get(context).keySet()) {
+ try {
+ // Note that Tracepoints and dynamic printf are not affected by "skip-all"
+ if (!(breakpoint instanceof ICTracepoint) && !(breakpoint instanceof ICDynamicPrintf)
+ && breakpoint.isEnabled()) {
+ for (IBreakpointDMContext ref : fPlatformToBPsMaps.get(context).get(breakpoint)) {
+ Map<String, Object> delta = new HashMap<>();
+ delta.put(MIBreakpoints.IS_ENABLED, enabled);
+ fBreakpoints.updateBreakpoint(ref, delta, new RequestMonitor(getExecutor(), null));
+ }
+ }
+ } catch (CoreException e) {
+ }
+ }
+ }
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // IBreakpointListener implementation
+ ///////////////////////////////////////////////////////////////////////////
+
+ @ThreadSafe
@Override
- public void breakpointAdded(final IBreakpoint breakpoint) {
- breakpointAdded(breakpoint, null, new RequestMonitor(getExecutor(), null));
- }
+ public void breakpointAdded(final IBreakpoint breakpoint) {
+ breakpointAdded(breakpoint, null, new RequestMonitor(getExecutor(), null));
+ }
/**
* Extension of {@link #breakpointAdded(IBreakpoint)}
- *
+ *
* @param miBpt
* the MIBreakpoint that initiated the breakpointAdded, or null
* @since 5.3
@@ -1332,7 +1327,7 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
/**
* Extension of {@link #breakpointAdded(IBreakpoint)} that can be monitored for
* completeness with a {@link RequestMonitor}.
- *
+ *
* @param breakpoint
* the added breakpoint
* @param miBpt
@@ -1342,361 +1337,368 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
*/
@ThreadSafe
public void breakpointAdded(final IBreakpoint breakpoint, MIBreakpoint miBpt, RequestMonitor rm) {
- if (supportsBreakpoint(breakpoint)) {
- try {
- // Retrieve the breakpoint attributes
- final Map<String, Object> attrs = breakpoint.getMarker().getAttributes();
-
- getExecutor().execute(new DsfRunnable() {
- @Override
- public void run() {
- // For a new breakpoint, the first thing we do is set the target filter to all existing processes.
- // We will need this when it is time to install the breakpoint.
- // We fetch the processes from our IProcess service to be generic (bug 431986)
- fProcesses.getProcessesBeingDebugged(fConnection.getContext(), new DataRequestMonitor<IDMContext[]>(getExecutor(), rm) {
- @Override
- protected void handleCompleted() {
- if (isSuccess()) {
- try {
- IDsfBreakpointExtension filterExtension = getFilterExtension((ICBreakpoint)breakpoint);
- for (IDMContext dmc : getData()) {
- IContainerDMContext containerDmc = DMContexts.getAncestorOfType(dmc, IContainerDMContext.class);
- assert containerDmc != null;
- if (filterExtension.getThreadFilters(containerDmc) == null) {
- // Do this only if there wasn't already an entry, or else we would
- // erase the content of that previous entry.
- // There can be an entry already when a thread-specific breakpoint is created
- // from the MIBreakpointsSynchronizer (through the gdb console). In that case the
- // platform bp gets created, and the targetFilter gets set by MIBreakpointsSynchronizer
- // before the call to breakpointAdded() is made and we get to here.
- // Bug 433329
- filterExtension.setTargetFilter(containerDmc);
- }
+ if (supportsBreakpoint(breakpoint)) {
+ try {
+ // Retrieve the breakpoint attributes
+ final Map<String, Object> attrs = breakpoint.getMarker().getAttributes();
+
+ getExecutor().execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ // For a new breakpoint, the first thing we do is set the target filter to all existing processes.
+ // We will need this when it is time to install the breakpoint.
+ // We fetch the processes from our IProcess service to be generic (bug 431986)
+ fProcesses.getProcessesBeingDebugged(fConnection.getContext(),
+ new DataRequestMonitor<IDMContext[]>(getExecutor(), rm) {
+ @Override
+ protected void handleCompleted() {
+ if (isSuccess()) {
+ try {
+ IDsfBreakpointExtension filterExtension = getFilterExtension(
+ (ICBreakpoint) breakpoint);
+ for (IDMContext dmc : getData()) {
+ IContainerDMContext containerDmc = DMContexts.getAncestorOfType(dmc,
+ IContainerDMContext.class);
+ assert containerDmc != null;
+ if (filterExtension.getThreadFilters(containerDmc) == null) {
+ // Do this only if there wasn't already an entry, or else we would
+ // erase the content of that previous entry.
+ // There can be an entry already when a thread-specific breakpoint is created
+ // from the MIBreakpointsSynchronizer (through the gdb console). In that case the
+ // platform bp gets created, and the targetFilter gets set by MIBreakpointsSynchronizer
+ // before the call to breakpointAdded() is made and we get to here.
+ // Bug 433329
+ filterExtension.setTargetFilter(containerDmc);
+ }
+ }
+ } catch (CoreException e1) {
+ // Error setting target filter, just skip altogether
+ }
+ }
+
+ // Now we can install the bp for all target contexts
+ final CountingRequestMonitor countingRm = new CountingRequestMonitor(
+ getExecutor(), rm) {
+ @Override
+ protected void handleCompleted() {
+ // Log any error when creating the breakpoint
+ if (getStatus().getSeverity() == IStatus.ERROR) {
+ GdbPlugin.getDefault().getLog().log(getStatus());
+ }
+ rm.done();
+ }
+ };
+ countingRm.setDoneCount(getTrackedBreakpointTargetContexts().size());
+
+ for (final IBreakpointsTargetDMContext dmc : getTrackedBreakpointTargetContexts()) {
+ boolean filtered = isBreakpointEntirelyFiltered(dmc,
+ (ICBreakpoint) breakpoint);
+ if (!filtered) {
+ determineDebuggerPath(dmc, attrs,
+ new RequestMonitor(getExecutor(), countingRm) {
+ @Override
+ protected void handleSuccess() {
+ installBreakpoint(dmc, (ICBreakpoint) breakpoint, attrs,
+ countingRm);
+ }
+ });
+ } else {
+ countingRm.done();
+ }
}
- } catch (CoreException e1) {
- // Error setting target filter, just skip altogether
}
- }
-
- // Now we can install the bp for all target contexts
- final CountingRequestMonitor countingRm = new CountingRequestMonitor(getExecutor(), rm) {
- @Override
- protected void handleCompleted() {
- // Log any error when creating the breakpoint
- if (getStatus().getSeverity() == IStatus.ERROR) {
- GdbPlugin.getDefault().getLog().log(getStatus());
- }
- rm.done();
- }
- };
- countingRm.setDoneCount(getTrackedBreakpointTargetContexts().size());
-
- for (final IBreakpointsTargetDMContext dmc : getTrackedBreakpointTargetContexts()) {
- boolean filtered = isBreakpointEntirelyFiltered(dmc, (ICBreakpoint)breakpoint);
- if (!filtered) {
- determineDebuggerPath(dmc, attrs,
- new RequestMonitor(getExecutor(), countingRm) {
- @Override
- protected void handleSuccess() {
- installBreakpoint(dmc, (ICBreakpoint) breakpoint,
- attrs, countingRm);
- }
- });
- } else {
- countingRm.done();
- }
- }
- }
- });
- }
- });
-
- // Normal return case, rm handling passed to runnable
- return;
- } catch (CoreException e) {
- } catch (RejectedExecutionException e) {
- }
- }
-
- // error/abnormal return case
- rm.done();
- }
-
- /**
- * @param bp
- * @return
- * @throws CoreException
- * @since 4.7
- */
- protected IDsfBreakpointExtension getFilterExtension(ICBreakpoint bp) throws CoreException {
- return (IDsfBreakpointExtension) bp.getExtension(GDB_DEBUG_MODEL_ID, ICBreakpointExtension.class);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.IBreakpointListener#breakpointChanged(org.eclipse.debug.core.model.IBreakpoint, org.eclipse.core.resources.IMarkerDelta)
- */
+ });
+ }
+ });
+
+ // Normal return case, rm handling passed to runnable
+ return;
+ } catch (CoreException e) {
+ } catch (RejectedExecutionException e) {
+ }
+ }
+
+ // error/abnormal return case
+ rm.done();
+ }
+
+ /**
+ * @param bp
+ * @return
+ * @throws CoreException
+ * @since 4.7
+ */
+ protected IDsfBreakpointExtension getFilterExtension(ICBreakpoint bp) throws CoreException {
+ return (IDsfBreakpointExtension) bp.getExtension(GDB_DEBUG_MODEL_ID, ICBreakpointExtension.class);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.core.IBreakpointListener#breakpointChanged(org.eclipse.debug.core.model.IBreakpoint, org.eclipse.core.resources.IMarkerDelta)
+ */
@Override
- public void breakpointChanged(final IBreakpoint breakpoint, final IMarkerDelta delta) {
-
- if (supportsBreakpoint(breakpoint)) {
-
- try {
- // Retrieve the breakpoint attributes
- final Map<String, Object> attrs = breakpoint.getMarker().getAttributes();
- // Tracepoints and dynamic printf are not affected by "skip-all"
- if (!(breakpoint instanceof ICTracepoint) && !(breakpoint instanceof ICDynamicPrintf)
- && !fBreakpointManager.isEnabled()) {
- attrs.put(ICBreakpoint.ENABLED, false);
- }
-
- // Modify the breakpoint in all the target contexts
- getExecutor().execute( new DsfRunnable() {
- @Override
- public void run() {
-
- // If the breakpoint is currently being updated, queue the request and exit
- if (fPendingRequests.contains(breakpoint)) {
- fPendingBreakpoints.add(breakpoint);
- return;
- }
-
- // Keep track of the updates
- final CountingRequestMonitor countingRm = new CountingRequestMonitor(getExecutor(), null) {
- @Override
- protected void handleCompleted() {
-
- if (!isSuccess() &&
- getStatus().getSeverity() == IStatus.ERROR) {
- GdbPlugin.getDefault().getLog().log(getStatus());
- }
-
- // Indicate that the pending request has completed
- fPendingRequests.remove(breakpoint);
-
- // Process the next pending update for this breakpoint
- if (fPendingBreakpoints.contains(breakpoint)) {
- fPendingBreakpoints.remove(breakpoint);
- breakpointChanged(breakpoint, delta);
- }
- }
- };
- countingRm.setDoneCount(getTrackedBreakpointTargetContexts().size());
-
- // Mark the breakpoint as being updated and go
- fPendingRequests.add(breakpoint);
-
- // Modify the breakpoint in all the execution contexts
- for (final IBreakpointsTargetDMContext dmc : getTrackedBreakpointTargetContexts()) {
- determineDebuggerPath(dmc, attrs,
- new RequestMonitor(getExecutor(), countingRm) {
- @Override
- protected void handleSuccess() {
- modifyBreakpoint(dmc, (ICBreakpoint) breakpoint, attrs, delta, countingRm);
- }
- });
- }
- }
- });
-
- } catch (CoreException e) {
- } catch (RejectedExecutionException e) {
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.IBreakpointListener#breakpointRemoved(org.eclipse.debug.core.model.IBreakpoint, org.eclipse.core.resources.IMarkerDelta)
- */
+ public void breakpointChanged(final IBreakpoint breakpoint, final IMarkerDelta delta) {
+
+ if (supportsBreakpoint(breakpoint)) {
+
+ try {
+ // Retrieve the breakpoint attributes
+ final Map<String, Object> attrs = breakpoint.getMarker().getAttributes();
+ // Tracepoints and dynamic printf are not affected by "skip-all"
+ if (!(breakpoint instanceof ICTracepoint) && !(breakpoint instanceof ICDynamicPrintf)
+ && !fBreakpointManager.isEnabled()) {
+ attrs.put(ICBreakpoint.ENABLED, false);
+ }
+
+ // Modify the breakpoint in all the target contexts
+ getExecutor().execute(new DsfRunnable() {
+ @Override
+ public void run() {
+
+ // If the breakpoint is currently being updated, queue the request and exit
+ if (fPendingRequests.contains(breakpoint)) {
+ fPendingBreakpoints.add(breakpoint);
+ return;
+ }
+
+ // Keep track of the updates
+ final CountingRequestMonitor countingRm = new CountingRequestMonitor(getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+
+ if (!isSuccess() && getStatus().getSeverity() == IStatus.ERROR) {
+ GdbPlugin.getDefault().getLog().log(getStatus());
+ }
+
+ // Indicate that the pending request has completed
+ fPendingRequests.remove(breakpoint);
+
+ // Process the next pending update for this breakpoint
+ if (fPendingBreakpoints.contains(breakpoint)) {
+ fPendingBreakpoints.remove(breakpoint);
+ breakpointChanged(breakpoint, delta);
+ }
+ }
+ };
+ countingRm.setDoneCount(getTrackedBreakpointTargetContexts().size());
+
+ // Mark the breakpoint as being updated and go
+ fPendingRequests.add(breakpoint);
+
+ // Modify the breakpoint in all the execution contexts
+ for (final IBreakpointsTargetDMContext dmc : getTrackedBreakpointTargetContexts()) {
+ determineDebuggerPath(dmc, attrs, new RequestMonitor(getExecutor(), countingRm) {
+ @Override
+ protected void handleSuccess() {
+ modifyBreakpoint(dmc, (ICBreakpoint) breakpoint, attrs, delta, countingRm);
+ }
+ });
+ }
+ }
+ });
+
+ } catch (CoreException e) {
+ } catch (RejectedExecutionException e) {
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.core.IBreakpointListener#breakpointRemoved(org.eclipse.debug.core.model.IBreakpoint, org.eclipse.core.resources.IMarkerDelta)
+ */
@Override
- public void breakpointRemoved(final IBreakpoint breakpoint, IMarkerDelta delta) {
-
- if (supportsBreakpoint(breakpoint)) {
- try {
- getExecutor().execute(new DsfRunnable() {
- @Override
- public void run() {
- CountingRequestMonitor countingRm = new CountingRequestMonitor(getExecutor(), null) {
- @Override
- protected void handleError() {
- if (getStatus().getSeverity() == IStatus.ERROR) {
- GdbPlugin.getDefault().getLog().log(getStatus());
- }
- }
- };
- countingRm.setDoneCount(getTrackedBreakpointTargetContexts().size());
-
- // Remove the breakpoint in all the execution contexts
- for (IBreakpointsTargetDMContext dmc : getTrackedBreakpointTargetContexts()) {
- if (fPlatformToAttributesMaps.get(dmc).containsKey(breakpoint)) {
- uninstallBreakpoint(dmc, (ICBreakpoint) breakpoint, countingRm);
- }
- }
- }
- });
- } catch (RejectedExecutionException e) {
- }
- }
- }
-
- ///////////////////////////////////////////////////////////////////////////
- // IServiceEventListener
- ///////////////////////////////////////////////////////////////////////////
-
- //-------------------------------------------------------------------------
- // Breakpoints
- //-------------------------------------------------------------------------
-
- @DsfServiceEventHandler
- public void eventDispatched(BreakpointAddedEvent e) {
- // Nothing to do - already handled by breakpointAdded()
- }
-
- @DsfServiceEventHandler
- public void eventDispatched(BreakpointUpdatedEvent e) {
- // Nothing to do - already handled by breakpointChanged()
- }
-
- @DsfServiceEventHandler
- public void eventDispatched(BreakpointRemovedEvent e) {
- // Nothing to do - already handled by breakpointRemoved()
- }
-
- /*
- * When a watchpoint goes out of scope, it is automatically removed from
- * the back-end. To keep our internal state synchronized, we have to
- * remove it from our breakpoints maps.
- * Unfortunately, GDB doesn't generate the correct event...
- */
- @DsfServiceEventHandler
- public void eventDispatched(MIWatchpointScopeEvent e) {
- }
-
- //-------------------------------------------------------------------------
- // Breakpoint actions
- //-------------------------------------------------------------------------
+ public void breakpointRemoved(final IBreakpoint breakpoint, IMarkerDelta delta) {
+
+ if (supportsBreakpoint(breakpoint)) {
+ try {
+ getExecutor().execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ CountingRequestMonitor countingRm = new CountingRequestMonitor(getExecutor(), null) {
+ @Override
+ protected void handleError() {
+ if (getStatus().getSeverity() == IStatus.ERROR) {
+ GdbPlugin.getDefault().getLog().log(getStatus());
+ }
+ }
+ };
+ countingRm.setDoneCount(getTrackedBreakpointTargetContexts().size());
+
+ // Remove the breakpoint in all the execution contexts
+ for (IBreakpointsTargetDMContext dmc : getTrackedBreakpointTargetContexts()) {
+ if (fPlatformToAttributesMaps.get(dmc).containsKey(breakpoint)) {
+ uninstallBreakpoint(dmc, (ICBreakpoint) breakpoint, countingRm);
+ }
+ }
+ }
+ });
+ } catch (RejectedExecutionException e) {
+ }
+ }
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // IServiceEventListener
+ ///////////////////////////////////////////////////////////////////////////
+
+ //-------------------------------------------------------------------------
+ // Breakpoints
+ //-------------------------------------------------------------------------
+
+ @DsfServiceEventHandler
+ public void eventDispatched(BreakpointAddedEvent e) {
+ // Nothing to do - already handled by breakpointAdded()
+ }
+
+ @DsfServiceEventHandler
+ public void eventDispatched(BreakpointUpdatedEvent e) {
+ // Nothing to do - already handled by breakpointChanged()
+ }
+
+ @DsfServiceEventHandler
+ public void eventDispatched(BreakpointRemovedEvent e) {
+ // Nothing to do - already handled by breakpointRemoved()
+ }
+
+ /*
+ * When a watchpoint goes out of scope, it is automatically removed from
+ * the back-end. To keep our internal state synchronized, we have to
+ * remove it from our breakpoints maps.
+ * Unfortunately, GDB doesn't generate the correct event...
+ */
+ @DsfServiceEventHandler
+ public void eventDispatched(MIWatchpointScopeEvent e) {
+ }
+
+ //-------------------------------------------------------------------------
+ // Breakpoint actions
+ //-------------------------------------------------------------------------
/** @since 4.2 */
- @DsfServiceEventHandler
- public void eventDispatched(ISuspendedDMEvent e) {
+ @DsfServiceEventHandler
+ public void eventDispatched(ISuspendedDMEvent e) {
assert e instanceof IMIDMEvent;
if (e instanceof IMIDMEvent) {
- Object miEvent = ((IMIDMEvent)e).getMIEvent();
+ Object miEvent = ((IMIDMEvent) e).getMIEvent();
if (miEvent instanceof MIBreakpointHitEvent) {
// This covers catchpoints, too
- MIBreakpointHitEvent evt = (MIBreakpointHitEvent)miEvent;
+ MIBreakpointHitEvent evt = (MIBreakpointHitEvent) miEvent;
performBreakpointAction(evt.getDMContext(), evt.getNumber());
return;
}
if (miEvent instanceof MIWatchpointTriggerEvent) {
- MIWatchpointTriggerEvent evt = (MIWatchpointTriggerEvent)miEvent;
+ MIWatchpointTriggerEvent evt = (MIWatchpointTriggerEvent) miEvent;
performBreakpointAction(evt.getDMContext(), evt.getNumber());
return;
}
}
}
-
+
/**
* @deprecated Replaced by the generic {@link #eventDispatched(ISuspendedDMEvent)}
*/
@Deprecated
@DsfServiceEventHandler
- public void eventDispatched(SuspendedEvent e) {
+ public void eventDispatched(SuspendedEvent e) {
+ }
+
+ private void performBreakpointAction(final IDMContext context, String number) {
+ // Identify the platform breakpoint
+ final ICBreakpoint breakpoint = findPlatformBreakpoint(number);
+
+ if (breakpoint != null) {
+ // Perform the actions asynchronously (otherwise we can have a deadlock...)
+ new Job("Breakpoint action") { //$NON-NLS-1$
+ {
+ setSystem(true);
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ fBreakpointActionManager.executeActions(breakpoint,
+ new BreakpointActionAdapter(getExecutor(), getServicesTracker(), context));
+ return Status.OK_STATUS;
+ };
+ }.schedule();
+ }
+ }
+
+ // Helper function to locate the platform breakpoint corresponding
+ // to the target breakpoint/watchpoint that was just hit
+
+ // FIXME: (Bug228703) Need a way to identify the correct context where the BP was hit
+ private ICBreakpoint findPlatformBreakpoint(String targetBreakpointID) {
+ Set<IBreakpointsTargetDMContext> targets = fBPToPlatformMaps.keySet();
+ for (IBreakpointsTargetDMContext target : targets) {
+ Map<IBreakpointDMContext, ICBreakpoint> bps = fBPToPlatformMaps.get(target);
+ Set<IBreakpointDMContext> contexts = bps.keySet();
+ for (IBreakpointDMContext context : contexts) {
+ if (context instanceof MIBreakpointDMContext) {
+ MIBreakpointDMContext ctx = (MIBreakpointDMContext) context;
+ if (ctx.getReference().equals(targetBreakpointID)) {
+ return bps.get(context);
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns a platform breakpoint corresponding to a given target breakpoint.
+ *
+ * @since 3.0
+ */
+ public IBreakpoint findPlatformBreakpoint(IBreakpointDMContext bpContext) {
+ if (bpContext instanceof MIBreakpointDMContext) {
+ IBreakpointsTargetDMContext targetCtx = DMContexts.getAncestorOfType(bpContext,
+ IBreakpointsTargetDMContext.class);
+ if (targetCtx != null) {
+ Map<IBreakpointDMContext, ICBreakpoint> bps = fBPToPlatformMaps.get(targetCtx);
+ if (bps != null) {
+ return bps.get(bpContext);
+ }
+ }
+ }
+ return null;
+ }
+
+ //-------------------------------------------------------------------------
+ // Process/thread start/exit
+ //-------------------------------------------------------------------------
+ /**
+ * @noreference This method is not intended to be referenced by clients.
+ * @since 4.4
+ */
+ @DsfServiceEventHandler
+ public void eventDispatched(IStartedDMEvent e) {
}
- private void performBreakpointAction(final IDMContext context, String number) {
- // Identify the platform breakpoint
- final ICBreakpoint breakpoint = findPlatformBreakpoint(number);
-
- if (breakpoint != null ) {
- // Perform the actions asynchronously (otherwise we can have a deadlock...)
- new Job("Breakpoint action") { //$NON-NLS-1$
- { setSystem(true); }
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- fBreakpointActionManager.executeActions(breakpoint, new BreakpointActionAdapter(getExecutor(), getServicesTracker(), context));
- return Status.OK_STATUS;
- };
- }.schedule();
- }
- }
-
- // Helper function to locate the platform breakpoint corresponding
- // to the target breakpoint/watchpoint that was just hit
-
- // FIXME: (Bug228703) Need a way to identify the correct context where the BP was hit
- private ICBreakpoint findPlatformBreakpoint(String targetBreakpointID) {
- Set<IBreakpointsTargetDMContext> targets = fBPToPlatformMaps.keySet();
- for (IBreakpointsTargetDMContext target : targets) {
- Map<IBreakpointDMContext, ICBreakpoint> bps = fBPToPlatformMaps.get(target);
- Set<IBreakpointDMContext> contexts = bps.keySet();
- for (IBreakpointDMContext context : contexts) {
- if (context instanceof MIBreakpointDMContext) {
- MIBreakpointDMContext ctx = (MIBreakpointDMContext) context;
- if (ctx.getReference().equals(targetBreakpointID)) {
- return bps.get(context);
- }
- }
- }
- }
- return null;
- }
-
- /**
- * Returns a platform breakpoint corresponding to a given target breakpoint.
- *
- * @since 3.0
- */
- public IBreakpoint findPlatformBreakpoint(IBreakpointDMContext bpContext) {
- if (bpContext instanceof MIBreakpointDMContext) {
- IBreakpointsTargetDMContext targetCtx = DMContexts.getAncestorOfType(bpContext, IBreakpointsTargetDMContext.class);
- if (targetCtx != null) {
- Map<IBreakpointDMContext, ICBreakpoint> bps = fBPToPlatformMaps.get(targetCtx);
- if (bps != null) {
- return bps.get(bpContext);
- }
- }
- }
- return null;
- }
-
- //-------------------------------------------------------------------------
- // Process/thread start/exit
- //-------------------------------------------------------------------------
- /**
- * @noreference This method is not intended to be referenced by clients.
- * @since 4.4
- */
- @DsfServiceEventHandler
- public void eventDispatched(IStartedDMEvent e) {
- }
-
-
- private void setTargetFilter(ICBreakpoint breakpoint, IContainerDMContext containerDmc) {
- try {
- IDsfBreakpointExtension filterExt = getFilterExtension(breakpoint);
- if (filterExt.getThreadFilters(containerDmc) == null) {
- // Do this only if there wasn't already an entry, or else we would
- // erase the content of that previous entry.
- // This could theoretically happen if the targetFilter is set by
- // someone else, before this method is called.
- // Bug 433329
- filterExt.setTargetFilter(containerDmc);
- }
-
- } catch (CoreException e) {
- }
- }
-
- /**
- * @noreference This method is not intended to be referenced by clients.
- * @since 4.4
- */
- @DsfServiceEventHandler
- public void eventDispatched(IExitedDMEvent e) {
+ private void setTargetFilter(ICBreakpoint breakpoint, IContainerDMContext containerDmc) {
+ try {
+ IDsfBreakpointExtension filterExt = getFilterExtension(breakpoint);
+ if (filterExt.getThreadFilters(containerDmc) == null) {
+ // Do this only if there wasn't already an entry, or else we would
+ // erase the content of that previous entry.
+ // This could theoretically happen if the targetFilter is set by
+ // someone else, before this method is called.
+ // Bug 433329
+ filterExt.setTargetFilter(containerDmc);
+ }
+
+ } catch (CoreException e) {
+ }
+ }
+
+ /**
+ * @noreference This method is not intended to be referenced by clients.
+ * @since 4.4
+ */
+ @DsfServiceEventHandler
+ public void eventDispatched(IExitedDMEvent e) {
// original code moved to API removeTargetFilter (Bug 456959)
- }
+ }
/**
* Remove process from the thread filtering of all breakpoints
@@ -1712,427 +1714,428 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
}
}
}
-
- private void removeTargetFilter(ICBreakpoint breakpoint, IContainerDMContext containerDmc) {
- try {
- IDsfBreakpointExtension filterExt = getFilterExtension(breakpoint);
- filterExt.removeTargetFilter(containerDmc);
- } catch (CoreException e) {
- }
- }
-
- private void removeAllTargetFilters(IBreakpointsTargetDMContext bpTargetDmc, ICBreakpoint breakpoint) {
- try {
- IDsfBreakpointExtension filterExt = getFilterExtension(breakpoint);
- IContainerDMContext[] targets = filterExt.getTargetFilters();
- for (IContainerDMContext target : targets) {
- if (bpTargetDmc.equals(target) || DMContexts.isAncestorOf(target, bpTargetDmc)) {
- filterExt.removeTargetFilter(target);
- }
- }
- } catch (CoreException e) {
- }
- }
-
- //-------------------------------------------------------------------------
- // Session exit
- //-------------------------------------------------------------------------
-
- /**
- * @since 1.1
- * @nooverride This method is not intended to be re-implemented or extended by clients.
- * @noreference This method is not intended to be referenced by clients.
- */
- @DsfServiceEventHandler
- public void eventDispatched(ICommandControlShutdownDMEvent e) {
- terminated();
- }
-
- private void terminated() {
- // Reset the breakpoint install count
- for (IBreakpointsTargetDMContext ctx : fPlatformToAttributesMaps.keySet()) {
- Map<ICBreakpoint, Map<String, Object>> breakpoints = fPlatformToAttributesMaps.get(ctx);
- clearBreakpointStatus(breakpoints.keySet().toArray(new ICBreakpoint[breakpoints.size()]), ctx);
- }
- // This will prevent Shutdown() from trying to remove bps from a
- // backend that has already shutdown
- fPlatformToAttributesMaps.clear();
- }
-
- /**
- * @param bps
- */
- private void clearBreakpointStatus(final ICBreakpoint[] bps, final IBreakpointsTargetDMContext ctx)
- {
- IWorkspaceRunnable wr = new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) throws CoreException {
- // For every platform breakpoint that has at least one target breakpoint installed
- // we must decrement the install count, for every target breakpoint.
- // Note that we cannot simply call resetInstallCount() because another
- // launch may be using the same platform breakpoint.
- Map<ICBreakpoint, Vector<IBreakpointDMContext>> breakpoints = fPlatformToBPsMaps.get(ctx);
- for (ICBreakpoint breakpoint : breakpoints.keySet()) {
- Vector<IBreakpointDMContext> targetBps = breakpoints.get(breakpoint);
- for (IBreakpointDMContext targetBp : targetBps) {
- decrementInstallCount(targetBp, breakpoint, new RequestMonitor(getExecutor(), null));
- }
- }
- }
- };
-
- // Create the scheduling rule to clear all bp planted.
- ISchedulingRule rule = null;
- List<ISchedulingRule> markerRules = new ArrayList<>();
- for (ICBreakpoint bp : bps) {
- IMarker marker = bp.getMarker();
- if (marker != null) {
- ISchedulingRule markerRule =
- ResourcesPlugin.getWorkspace().getRuleFactory().markerRule(
- marker.getResource());
- if (markerRule == null) {
- markerRules = null;
- break;
- } else {
- markerRules.add(markerRule);
- }
- }
- }
- if (markerRules != null) {
- rule = MultiRule.combine(markerRules.toArray(new ISchedulingRule[markerRules.size()]));
- }
-
- try {
- // Will run the workspace runnable on the current thread, which
- // is the DSF executor.
- ResourcesPlugin.getWorkspace().run(wr, rule, 0, null);
- } catch (CoreException e) {
- GdbPlugin.getDefault().getLog().log(e.getStatus());
- }
-
- new Job("Clear Breakpoints Status") { //$NON-NLS-1$
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- // Clear any problem markers
- for (IMarker marker : fBreakpointMarkerProblems.values()) {
- if (marker != null) {
- try {
+
+ private void removeTargetFilter(ICBreakpoint breakpoint, IContainerDMContext containerDmc) {
+ try {
+ IDsfBreakpointExtension filterExt = getFilterExtension(breakpoint);
+ filterExt.removeTargetFilter(containerDmc);
+ } catch (CoreException e) {
+ }
+ }
+
+ private void removeAllTargetFilters(IBreakpointsTargetDMContext bpTargetDmc, ICBreakpoint breakpoint) {
+ try {
+ IDsfBreakpointExtension filterExt = getFilterExtension(breakpoint);
+ IContainerDMContext[] targets = filterExt.getTargetFilters();
+ for (IContainerDMContext target : targets) {
+ if (bpTargetDmc.equals(target) || DMContexts.isAncestorOf(target, bpTargetDmc)) {
+ filterExt.removeTargetFilter(target);
+ }
+ }
+ } catch (CoreException e) {
+ }
+ }
+
+ //-------------------------------------------------------------------------
+ // Session exit
+ //-------------------------------------------------------------------------
+
+ /**
+ * @since 1.1
+ * @nooverride This method is not intended to be re-implemented or extended by clients.
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ @DsfServiceEventHandler
+ public void eventDispatched(ICommandControlShutdownDMEvent e) {
+ terminated();
+ }
+
+ private void terminated() {
+ // Reset the breakpoint install count
+ for (IBreakpointsTargetDMContext ctx : fPlatformToAttributesMaps.keySet()) {
+ Map<ICBreakpoint, Map<String, Object>> breakpoints = fPlatformToAttributesMaps.get(ctx);
+ clearBreakpointStatus(breakpoints.keySet().toArray(new ICBreakpoint[breakpoints.size()]), ctx);
+ }
+ // This will prevent Shutdown() from trying to remove bps from a
+ // backend that has already shutdown
+ fPlatformToAttributesMaps.clear();
+ }
+
+ /**
+ * @param bps
+ */
+ private void clearBreakpointStatus(final ICBreakpoint[] bps, final IBreakpointsTargetDMContext ctx) {
+ IWorkspaceRunnable wr = new IWorkspaceRunnable() {
+ @Override
+ public void run(IProgressMonitor monitor) throws CoreException {
+ // For every platform breakpoint that has at least one target breakpoint installed
+ // we must decrement the install count, for every target breakpoint.
+ // Note that we cannot simply call resetInstallCount() because another
+ // launch may be using the same platform breakpoint.
+ Map<ICBreakpoint, Vector<IBreakpointDMContext>> breakpoints = fPlatformToBPsMaps.get(ctx);
+ for (ICBreakpoint breakpoint : breakpoints.keySet()) {
+ Vector<IBreakpointDMContext> targetBps = breakpoints.get(breakpoint);
+ for (IBreakpointDMContext targetBp : targetBps) {
+ decrementInstallCount(targetBp, breakpoint, new RequestMonitor(getExecutor(), null));
+ }
+ }
+ }
+ };
+
+ // Create the scheduling rule to clear all bp planted.
+ ISchedulingRule rule = null;
+ List<ISchedulingRule> markerRules = new ArrayList<>();
+ for (ICBreakpoint bp : bps) {
+ IMarker marker = bp.getMarker();
+ if (marker != null) {
+ ISchedulingRule markerRule = ResourcesPlugin.getWorkspace().getRuleFactory()
+ .markerRule(marker.getResource());
+ if (markerRule == null) {
+ markerRules = null;
+ break;
+ } else {
+ markerRules.add(markerRule);
+ }
+ }
+ }
+ if (markerRules != null) {
+ rule = MultiRule.combine(markerRules.toArray(new ISchedulingRule[markerRules.size()]));
+ }
+
+ try {
+ // Will run the workspace runnable on the current thread, which
+ // is the DSF executor.
+ ResourcesPlugin.getWorkspace().run(wr, rule, 0, null);
+ } catch (CoreException e) {
+ GdbPlugin.getDefault().getLog().log(e.getStatus());
+ }
+
+ new Job("Clear Breakpoints Status") { //$NON-NLS-1$
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ // Clear any problem markers
+ for (IMarker marker : fBreakpointMarkerProblems.values()) {
+ if (marker != null) {
+ try {
marker.delete();
} catch (CoreException e) {
}
- }
- }
- fBreakpointMarkerProblems.clear();
-
- return Status.OK_STATUS;
- }
- }.schedule();
- }
-
- ///////////////////////////////////////////////////////////////////////////
- // Support functions
- ///////////////////////////////////////////////////////////////////////////
+ }
+ }
+ fBreakpointMarkerProblems.clear();
+
+ return Status.OK_STATUS;
+ }
+ }.schedule();
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Support functions
+ ///////////////////////////////////////////////////////////////////////////
/**
* Indicates if the platform breakpoint object [bp] is one we can deal with.
* For now, it boils down to whether it's a CDT Breakpoint (an
* ICBreakpoint). DSF can supports other (custom) types of breakpoints, but
* DSF-GDB is tied to ICBreakpoint.
- *
+ *
* @param bp the platform breakpoint
* @return true if we support it; false otherwise
* @since 4.7
*/
- protected boolean supportsBreakpoint(IBreakpoint bp) {
- if (bp instanceof ICBreakpoint && bp.getModelIdentifier().equals(fDebugModelId)) {
- IMarker marker = bp.getMarker();
- if (marker != null) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * determineDebuggerPath
- *
- * Adds the path to the source file to the set of attributes
- * (for the debugger).
- *
- * @param dmc
- * @param attributes
- * @param rm
- */
- private void determineDebuggerPath(IBreakpointsTargetDMContext dmc,
- final Map<String, Object> attributes, final RequestMonitor rm)
- {
- String hostPath = (String) attributes.get(ICBreakpoint.SOURCE_HANDLE);
-
- if (hostPath != null) {
-
- ISourceLookupDMContext srcDmc = DMContexts.getAncestorOfType(dmc, ISourceLookupDMContext.class);
- if (srcDmc != null) {
- fSourceLookup.getDebuggerPath(srcDmc, hostPath,
- new DataRequestMonitor<String>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- attributes.put(ATTR_DEBUGGER_PATH, adjustDebuggerPath(getData()));
- rm.done();
- }
- });
- } else {
- // Source lookup not available for given context, use the host
- // path for the debugger path.
- attributes.put(ATTR_DEBUGGER_PATH, adjustDebuggerPath(hostPath));
- rm.done();
- }
- } else {
- // Some types of breakpoints do not require a path
- // (e.g. watchpoints)
- rm.done();
- }
- }
+ protected boolean supportsBreakpoint(IBreakpoint bp) {
+ if (bp instanceof ICBreakpoint && bp.getModelIdentifier().equals(fDebugModelId)) {
+ IMarker marker = bp.getMarker();
+ if (marker != null) {
+ return true;
+ }
+ }
+ return false;
+ }
/**
- * For some platforms (MinGW) the debugger path needs to be adjusted to work
- * with earlier GDB versions.
+ * determineDebuggerPath
+ *
+ * Adds the path to the source file to the set of attributes
+ * (for the debugger).
+ *
+ * @param dmc
+ * @param attributes
+ * @param rm
+ */
+ private void determineDebuggerPath(IBreakpointsTargetDMContext dmc, final Map<String, Object> attributes,
+ final RequestMonitor rm) {
+ String hostPath = (String) attributes.get(ICBreakpoint.SOURCE_HANDLE);
+
+ if (hostPath != null) {
+
+ ISourceLookupDMContext srcDmc = DMContexts.getAncestorOfType(dmc, ISourceLookupDMContext.class);
+ if (srcDmc != null) {
+ fSourceLookup.getDebuggerPath(srcDmc, hostPath, new DataRequestMonitor<String>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ attributes.put(ATTR_DEBUGGER_PATH, adjustDebuggerPath(getData()));
+ rm.done();
+ }
+ });
+ } else {
+ // Source lookup not available for given context, use the host
+ // path for the debugger path.
+ attributes.put(ATTR_DEBUGGER_PATH, adjustDebuggerPath(hostPath));
+ rm.done();
+ }
+ } else {
+ // Some types of breakpoints do not require a path
+ // (e.g. watchpoints)
+ rm.done();
+ }
+ }
+
+ /**
+ * For some platforms (MinGW) the debugger path needs to be adjusted to work
+ * with earlier GDB versions.
* See https://bugs.eclipse.org/bugs/show_bug.cgi?id=232415
- *
+ *
* @param path
* the absolute path to the source file
* @return the adjusted path provided by the breakpoints service.
*/
- String adjustDebuggerPath(String path) {
- return (fBreakpoints instanceof IMIBreakpointPathAdjuster) ?
- ((IMIBreakpointPathAdjuster)fBreakpoints).adjustDebuggerPath(path) : path;
- }
-
- /**
- * Determine the set of modified attributes.
- * Elementary set operations in full action :-)
- *
- * @param oldAttributes
- * @param newAttributes
- * @return
- */
- private Map<String, Object> determineAttributesDelta(Map<String, Object> oldAttributes, Map<String, Object> newAttributes) {
-
- Map<String, Object> delta = new HashMap<>();
-
- Set<String> oldKeySet = oldAttributes.keySet();
- Set<String> newKeySet = newAttributes.keySet();
-
- Set<String> commonKeys = new HashSet<>(newKeySet); commonKeys.retainAll(oldKeySet);
- Set<String> addedKeys = new HashSet<>(newKeySet); addedKeys.removeAll(oldKeySet);
- Set<String> removedKeys = new HashSet<>(oldKeySet); removedKeys.removeAll(newKeySet);
-
- // Add the modified attributes
- for (String key : commonKeys) {
- if (!(oldAttributes.get(key).equals(newAttributes.get(key)))) {
- delta.put(key, newAttributes.get(key));
- }
- }
-
- // Add the new attributes
- for (String key : addedKeys) {
- delta.put(key, newAttributes.get(key));
- }
-
- // Remove the deleted attributes
- for (String key : removedKeys) {
- delta.put(key, null);
- }
-
- return convertToPlatformAttributes(delta);
- }
-
- /**
- * Converts ICBreakpoint attributes to IBreakpoints attributes.
- *
- * @param cdtAttributes
- * @return
- * @since 5.3
- */
- protected Map<String, Object> convertToPlatformAttributes(Map<String, Object> cdtAttributes) {
-
- Map<String,Object> result = new HashMap<String,Object>();
-
- // IBreakpoint attributes
- if (cdtAttributes.containsKey(ATTR_DEBUGGER_PATH)) {
- result.put(MIBreakpoints.FILE_NAME, cdtAttributes.get(ATTR_DEBUGGER_PATH));
- }
-
- if (cdtAttributes.containsKey(IMarker.LINE_NUMBER)) {
- result.put(MIBreakpoints.LINE_NUMBER, cdtAttributes.get(IMarker.LINE_NUMBER));
- }
-
- if (cdtAttributes.containsKey(BreakpointActionManager.BREAKPOINT_ACTION_ATTRIBUTE)) {
- result.put(MIBreakpoints.COMMANDS, cdtAttributes.get(BreakpointActionManager.BREAKPOINT_ACTION_ATTRIBUTE));
- }
-
- // ICLineBreakpoint attributes
- if (cdtAttributes.containsKey(ICLineBreakpoint.FUNCTION)) {
- result.put(MIBreakpoints.FUNCTION, cdtAttributes.get(ICLineBreakpoint.FUNCTION));
- }
-
- if (cdtAttributes.containsKey(ICLineBreakpoint.ADDRESS)) {
- result.put(MIBreakpoints.ADDRESS, cdtAttributes.get(ICLineBreakpoint.ADDRESS));
- }
-
- // ICBreakpoint attributes
- if (cdtAttributes.containsKey(ICBreakpoint.CONDITION)) {
- result.put(MIBreakpoints.CONDITION, cdtAttributes.get(ICBreakpoint.CONDITION));
- }
-
- if (cdtAttributes.containsKey(ICBreakpoint.IGNORE_COUNT)) {
- result.put(MIBreakpoints.IGNORE_COUNT, cdtAttributes.get(ICBreakpoint.IGNORE_COUNT));
- }
-
- if (cdtAttributes.containsKey(ICTracepoint.PASS_COUNT)) {
- result.put(MIBreakpoints.PASS_COUNT, cdtAttributes.get(ICTracepoint.PASS_COUNT));
- }
-
- if (cdtAttributes.containsKey(ICBreakpoint.ENABLED)) {
- result.put(MIBreakpoints.IS_ENABLED, cdtAttributes.get(ICBreakpoint.ENABLED));
- }
-
- if (cdtAttributes.containsKey(ICBreakpointType.TYPE)) {
- result.put(MIBreakpoints.BREAKPOINT_TYPE, cdtAttributes.get(ICBreakpointType.TYPE));
- }
-
- // ICWatchpoint attributes
- if (cdtAttributes.containsKey(ICWatchpoint.EXPRESSION)) {
- result.put(MIBreakpoints.EXPRESSION, cdtAttributes.get(ICWatchpoint.EXPRESSION));
- }
-
- if (cdtAttributes.containsKey(ICWatchpoint.READ)) {
- result.put(MIBreakpoints.READ, cdtAttributes.get(ICWatchpoint.READ));
- }
-
- if (cdtAttributes.containsKey(ICWatchpoint.WRITE)) {
- result.put(MIBreakpoints.WRITE, cdtAttributes.get(ICWatchpoint.WRITE));
- }
-
- // Threads
- if (cdtAttributes.containsKey(ATTR_THREAD_FILTER)) {
- result.put(ATTR_THREAD_FILTER, cdtAttributes.get(ATTR_THREAD_FILTER));
- }
-
- // For IDynamicPrintf
- if (cdtAttributes.containsKey(ICDynamicPrintf.PRINTF_STRING)) {
- result.put(MIBreakpoints.PRINTF_STRING, cdtAttributes.get(ICDynamicPrintf.PRINTF_STRING));
- }
-
- return result;
- }
-
- /**
- * Figure out the corresponding number of back-end breakpoints
- * Even though the thread IDs are usually integers, they are
- * stored as strings in CBreakpoints.
- *
- * @param attributes
- * @return
- */
- @SuppressWarnings("unchecked")
- private Set<String> getThreads(Map<String, Object> attributes) {
- Set<String> threads = (Set<String>) attributes.get(ATTR_THREAD_FILTER);
- if (threads == null) {
- threads = new HashSet<>();
- threads.add("0"); // Thread 0 means all threads //$NON-NLS-1$
- }
- return threads;
- }
-
- /**
- * Get the list of threads from the breakpoint's thread filtering mechanism
- *
- * @param breakpoint
- * @return
- */
- private Set<String> extractThreads(IBreakpointsTargetDMContext bpTargetDmc, ICBreakpoint breakpoint) {
- Set<String> results = new HashSet<>();
-
- if (supportsThreads(breakpoint)) {
- List<IExecutionDMContext[]> threads = new ArrayList<>(1);
-
- try {
- // Retrieve all existing targets.
- // Note that these targets can be from different debugging sessions since
- // they are associated with the platform breakpoint.
- IDsfBreakpointExtension filterExtension = getFilterExtension(breakpoint);
- IContainerDMContext[] procTargets = filterExtension.getTargetFilters();
-
- // Extract the thread IDs
- for (IContainerDMContext procDmc : procTargets) {
- // Look for a target/process that belongs to our session
- if (procDmc.equals(bpTargetDmc) || DMContexts.isAncestorOf(procDmc, bpTargetDmc)) {
- IExecutionDMContext[] threadFilters = filterExtension.getThreadFilters(procDmc);
- if (threadFilters == null) {
- // The breakpoint applies to the entire process.
- // For GDB < 7.4, we set the thread to 0 to indicate that the breakpoint
- // is global for this process.
- // For GDB >= 7.4, things are more complicated. There will be one bp for all
- // processes, so by setting the thread to 0, the breakpoint will apply
- // to all threads of all processes. We don't have a choice as there is no
- // way to tell GDB to apply to all threads (including any new ones that will
- // be created) for a single process.
- // So, in this case, if the bp applies to all threads of one process, it will
- // automatically apply to all threads of all processes
- results.add("0"); //$NON-NLS-1$
- return results;
- } else {
- threads.add(threadFilters);
- }
- }
- }
- } catch (CoreException e) {
- // Error with the thread filtering. Default to all threads.
- results.add("0"); //$NON-NLS-1$
- return results;
- }
-
- // If there are no threads to filter on, it means the bp applies to the entire process.
- if (threads.isEmpty()) {
- results.add("0"); //$NON-NLS-1$
- return results;
- }
-
- for (IExecutionDMContext[] targetThreads : threads) {
- if (targetThreads != null) {
- for (IExecutionDMContext thread : targetThreads) {
- if (thread instanceof IMIExecutionDMContext) {
- results.add(((IMIExecutionDMContext)thread).getThreadId());
- } else {
- // If any of the threads is not an IMIExecutionDMContext,
- // we don't support thread filters at all.
- results.clear();
- results.add("0"); //$NON-NLS-1$
- return results;
- }
- }
- } else {
- // Should not happen
- assert false;
- }
- }
- } else {
- results.add("0"); //$NON-NLS-1$
- }
-
- return results;
- }
-
- ///////////////////////////////////////////////////////////////////////////
- // Non-generic (MI-specific) functions
- ///////////////////////////////////////////////////////////////////////////
+ String adjustDebuggerPath(String path) {
+ return (fBreakpoints instanceof IMIBreakpointPathAdjuster)
+ ? ((IMIBreakpointPathAdjuster) fBreakpoints).adjustDebuggerPath(path)
+ : path;
+ }
+
+ /**
+ * Determine the set of modified attributes.
+ * Elementary set operations in full action :-)
+ *
+ * @param oldAttributes
+ * @param newAttributes
+ * @return
+ */
+ private Map<String, Object> determineAttributesDelta(Map<String, Object> oldAttributes,
+ Map<String, Object> newAttributes) {
+
+ Map<String, Object> delta = new HashMap<>();
+
+ Set<String> oldKeySet = oldAttributes.keySet();
+ Set<String> newKeySet = newAttributes.keySet();
+
+ Set<String> commonKeys = new HashSet<>(newKeySet);
+ commonKeys.retainAll(oldKeySet);
+ Set<String> addedKeys = new HashSet<>(newKeySet);
+ addedKeys.removeAll(oldKeySet);
+ Set<String> removedKeys = new HashSet<>(oldKeySet);
+ removedKeys.removeAll(newKeySet);
+
+ // Add the modified attributes
+ for (String key : commonKeys) {
+ if (!(oldAttributes.get(key).equals(newAttributes.get(key)))) {
+ delta.put(key, newAttributes.get(key));
+ }
+ }
+
+ // Add the new attributes
+ for (String key : addedKeys) {
+ delta.put(key, newAttributes.get(key));
+ }
+
+ // Remove the deleted attributes
+ for (String key : removedKeys) {
+ delta.put(key, null);
+ }
+
+ return convertToPlatformAttributes(delta);
+ }
+
+ /**
+ * Converts ICBreakpoint attributes to IBreakpoints attributes.
+ *
+ * @param cdtAttributes
+ * @return
+ * @since 5.3
+ */
+ protected Map<String, Object> convertToPlatformAttributes(Map<String, Object> cdtAttributes) {
+
+ Map<String, Object> result = new HashMap<String, Object>();
+
+ // IBreakpoint attributes
+ if (cdtAttributes.containsKey(ATTR_DEBUGGER_PATH)) {
+ result.put(MIBreakpoints.FILE_NAME, cdtAttributes.get(ATTR_DEBUGGER_PATH));
+ }
+
+ if (cdtAttributes.containsKey(IMarker.LINE_NUMBER)) {
+ result.put(MIBreakpoints.LINE_NUMBER, cdtAttributes.get(IMarker.LINE_NUMBER));
+ }
+
+ if (cdtAttributes.containsKey(BreakpointActionManager.BREAKPOINT_ACTION_ATTRIBUTE)) {
+ result.put(MIBreakpoints.COMMANDS, cdtAttributes.get(BreakpointActionManager.BREAKPOINT_ACTION_ATTRIBUTE));
+ }
+
+ // ICLineBreakpoint attributes
+ if (cdtAttributes.containsKey(ICLineBreakpoint.FUNCTION)) {
+ result.put(MIBreakpoints.FUNCTION, cdtAttributes.get(ICLineBreakpoint.FUNCTION));
+ }
+
+ if (cdtAttributes.containsKey(ICLineBreakpoint.ADDRESS)) {
+ result.put(MIBreakpoints.ADDRESS, cdtAttributes.get(ICLineBreakpoint.ADDRESS));
+ }
+
+ // ICBreakpoint attributes
+ if (cdtAttributes.containsKey(ICBreakpoint.CONDITION)) {
+ result.put(MIBreakpoints.CONDITION, cdtAttributes.get(ICBreakpoint.CONDITION));
+ }
+
+ if (cdtAttributes.containsKey(ICBreakpoint.IGNORE_COUNT)) {
+ result.put(MIBreakpoints.IGNORE_COUNT, cdtAttributes.get(ICBreakpoint.IGNORE_COUNT));
+ }
+
+ if (cdtAttributes.containsKey(ICTracepoint.PASS_COUNT)) {
+ result.put(MIBreakpoints.PASS_COUNT, cdtAttributes.get(ICTracepoint.PASS_COUNT));
+ }
+
+ if (cdtAttributes.containsKey(ICBreakpoint.ENABLED)) {
+ result.put(MIBreakpoints.IS_ENABLED, cdtAttributes.get(ICBreakpoint.ENABLED));
+ }
+
+ if (cdtAttributes.containsKey(ICBreakpointType.TYPE)) {
+ result.put(MIBreakpoints.BREAKPOINT_TYPE, cdtAttributes.get(ICBreakpointType.TYPE));
+ }
+
+ // ICWatchpoint attributes
+ if (cdtAttributes.containsKey(ICWatchpoint.EXPRESSION)) {
+ result.put(MIBreakpoints.EXPRESSION, cdtAttributes.get(ICWatchpoint.EXPRESSION));
+ }
+
+ if (cdtAttributes.containsKey(ICWatchpoint.READ)) {
+ result.put(MIBreakpoints.READ, cdtAttributes.get(ICWatchpoint.READ));
+ }
+
+ if (cdtAttributes.containsKey(ICWatchpoint.WRITE)) {
+ result.put(MIBreakpoints.WRITE, cdtAttributes.get(ICWatchpoint.WRITE));
+ }
+
+ // Threads
+ if (cdtAttributes.containsKey(ATTR_THREAD_FILTER)) {
+ result.put(ATTR_THREAD_FILTER, cdtAttributes.get(ATTR_THREAD_FILTER));
+ }
+
+ // For IDynamicPrintf
+ if (cdtAttributes.containsKey(ICDynamicPrintf.PRINTF_STRING)) {
+ result.put(MIBreakpoints.PRINTF_STRING, cdtAttributes.get(ICDynamicPrintf.PRINTF_STRING));
+ }
+
+ return result;
+ }
+
+ /**
+ * Figure out the corresponding number of back-end breakpoints
+ * Even though the thread IDs are usually integers, they are
+ * stored as strings in CBreakpoints.
+ *
+ * @param attributes
+ * @return
+ */
+ @SuppressWarnings("unchecked")
+ private Set<String> getThreads(Map<String, Object> attributes) {
+ Set<String> threads = (Set<String>) attributes.get(ATTR_THREAD_FILTER);
+ if (threads == null) {
+ threads = new HashSet<>();
+ threads.add("0"); // Thread 0 means all threads //$NON-NLS-1$
+ }
+ return threads;
+ }
+
+ /**
+ * Get the list of threads from the breakpoint's thread filtering mechanism
+ *
+ * @param breakpoint
+ * @return
+ */
+ private Set<String> extractThreads(IBreakpointsTargetDMContext bpTargetDmc, ICBreakpoint breakpoint) {
+ Set<String> results = new HashSet<>();
+
+ if (supportsThreads(breakpoint)) {
+ List<IExecutionDMContext[]> threads = new ArrayList<>(1);
+
+ try {
+ // Retrieve all existing targets.
+ // Note that these targets can be from different debugging sessions since
+ // they are associated with the platform breakpoint.
+ IDsfBreakpointExtension filterExtension = getFilterExtension(breakpoint);
+ IContainerDMContext[] procTargets = filterExtension.getTargetFilters();
+
+ // Extract the thread IDs
+ for (IContainerDMContext procDmc : procTargets) {
+ // Look for a target/process that belongs to our session
+ if (procDmc.equals(bpTargetDmc) || DMContexts.isAncestorOf(procDmc, bpTargetDmc)) {
+ IExecutionDMContext[] threadFilters = filterExtension.getThreadFilters(procDmc);
+ if (threadFilters == null) {
+ // The breakpoint applies to the entire process.
+ // For GDB < 7.4, we set the thread to 0 to indicate that the breakpoint
+ // is global for this process.
+ // For GDB >= 7.4, things are more complicated. There will be one bp for all
+ // processes, so by setting the thread to 0, the breakpoint will apply
+ // to all threads of all processes. We don't have a choice as there is no
+ // way to tell GDB to apply to all threads (including any new ones that will
+ // be created) for a single process.
+ // So, in this case, if the bp applies to all threads of one process, it will
+ // automatically apply to all threads of all processes
+ results.add("0"); //$NON-NLS-1$
+ return results;
+ } else {
+ threads.add(threadFilters);
+ }
+ }
+ }
+ } catch (CoreException e) {
+ // Error with the thread filtering. Default to all threads.
+ results.add("0"); //$NON-NLS-1$
+ return results;
+ }
+
+ // If there are no threads to filter on, it means the bp applies to the entire process.
+ if (threads.isEmpty()) {
+ results.add("0"); //$NON-NLS-1$
+ return results;
+ }
+
+ for (IExecutionDMContext[] targetThreads : threads) {
+ if (targetThreads != null) {
+ for (IExecutionDMContext thread : targetThreads) {
+ if (thread instanceof IMIExecutionDMContext) {
+ results.add(((IMIExecutionDMContext) thread).getThreadId());
+ } else {
+ // If any of the threads is not an IMIExecutionDMContext,
+ // we don't support thread filters at all.
+ results.clear();
+ results.add("0"); //$NON-NLS-1$
+ return results;
+ }
+ }
+ } else {
+ // Should not happen
+ assert false;
+ }
+ }
+ } else {
+ results.add("0"); //$NON-NLS-1$
+ }
+
+ return results;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Non-generic (MI-specific) functions
+ ///////////////////////////////////////////////////////////////////////////
/**
* Create a collection of DSF-GDB specific breakpoint properties given a
* platform/CDT breakpoint object and its properties. Basically, this
* determines the set of MI-specific properties to be used in installing the
* given breakpoint.
- *
+ *
* @param breakpoint
* the platform breakpoint object; was created by CDT
* @param attributes
@@ -2142,173 +2145,170 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
* to specify additional/modified properties.
* @return a property bag containing the corresponding DSF-GDB properties
*/
- protected Map<String,Object> convertToTargetBreakpoint(ICBreakpoint breakpoint, Map<String,Object> attributes) {
-
- Map<String, Object> properties = new HashMap<>();
-
- if (breakpoint instanceof ICWatchpoint) {
- properties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.WATCHPOINT);
- properties.put(MIBreakpoints.EXPRESSION, attributes.get(ICWatchpoint.EXPRESSION));
- properties.put(MIBreakpoints.READ, attributes.get(ICWatchpoint.READ));
- properties.put(MIBreakpoints.WRITE, attributes.get(ICWatchpoint.WRITE));
- properties.put(MIBreakpoints.RANGE, attributes.get(ICWatchpoint2.RANGE));
- properties.put(MIBreakpoints.MEMSPACE, attributes.get(ICWatchpoint2.MEMORYSPACE));
- }
- else if (breakpoint instanceof ICLineBreakpoint) {
- properties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.BREAKPOINT);
- properties.put(MIBreakpoints.FILE_NAME, attributes.get(ATTR_DEBUGGER_PATH));
- properties.put(MIBreakpoints.LINE_NUMBER, attributes.get(IMarker.LINE_NUMBER));
- properties.put(MIBreakpoints.FUNCTION, attributes.get(ICLineBreakpoint.FUNCTION));
- properties.put(MIBreakpoints.ADDRESS, attributes.get(ICLineBreakpoint.ADDRESS));
- properties.put(MIBreakpoints.COMMANDS, attributes.get(BreakpointActionManager.BREAKPOINT_ACTION_ATTRIBUTE));
-
- if (breakpoint instanceof ICTracepoint) {
- // A tracepoint is a LineBreakpoint, but needs its own type
- properties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT);
- properties.put(MIBreakpoints.PASS_COUNT, attributes.get(ICTracepoint.PASS_COUNT));
- } else if (breakpoint instanceof ICDynamicPrintf) {
- // A DynamicPrintf is a LineBreakpoint, but needs its own type
- properties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.DYNAMICPRINTF);
- properties.put(MIBreakpoints.PRINTF_STRING, attributes.get(ICDynamicPrintf.PRINTF_STRING));
- }
- }
- else if (breakpoint instanceof ICEventBreakpoint) {
- properties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.CATCHPOINT);
- properties.put(MIBreakpoints.CATCHPOINT_TYPE, GdbCatchpoints.eventToGdbCatchpointKeyword((String)attributes.get(ICEventBreakpoint.EVENT_TYPE_ID)));
-
- String arg = (String)attributes.get(ICEventBreakpoint.EVENT_ARG);
- String[] args;
- if ((arg != null) && (arg.length() != 0)) {
- args = new String[1];
- args[0] = arg;
- }
- else {
- args = new String[0];
- }
- properties.put(MIBreakpoints.CATCHPOINT_ARGS, args);
- }
- else {
- assert false : "platform breakpoint is of an unexpected type: " + breakpoint.getClass().getName(); //$NON-NLS-1$
- }
-
- // Common fields
- properties.put(MIBreakpoints.CONDITION, attributes.get(ICBreakpoint.CONDITION));
- properties.put(MIBreakpoints.IGNORE_COUNT, attributes.get(ICBreakpoint.IGNORE_COUNT));
- properties.put(MIBreakpoints.IS_ENABLED, attributes.get(ICBreakpoint.ENABLED));
- properties.put(MIBreakpointDMData.THREAD_ID, attributes.get(ATTR_THREAD_ID));
-
- // checks for the breakpoint type, and adds the hardware/temporary flags
- Object breakpointType = attributes.get(ICBreakpointType.TYPE);
- if (breakpointType instanceof Integer) {
- boolean isHardware = ((Integer) breakpointType & ICBreakpointType.HARDWARE) == ICBreakpointType.HARDWARE;
- boolean isTemporary = ((Integer) breakpointType & ICBreakpointType.TEMPORARY) == ICBreakpointType.TEMPORARY;
- properties.put(MIBreakpointDMData.IS_HARDWARE, isHardware);
- properties.put(MIBreakpointDMData.IS_TEMPORARY, isTemporary);
- }
-
- // Adjust for "skip-all"
- // Tracepoints and dynamic printf are not affected by "skip-all"
- if (!(breakpoint instanceof ICTracepoint) && !(breakpoint instanceof ICDynamicPrintf)
- && !fBreakpointManager.isEnabled()) {
- properties.put(MIBreakpoints.IS_ENABLED, false);
- }
-
- return properties;
- }
-
- /**
- * Determine if the modified attributes necessitate
- * a breakpoint removal/re-installation
- *
- * @param delta
- * @return
- */
- protected boolean needsResinstallation(Map<String,Object> delta) {
-
- // Check if there is any modified attribute
- if (delta == null) {
- return false;
- }
-
- // Check the "critical" attributes
- if (delta.containsKey(ATTR_DEBUGGER_PATH) // File name
- || delta.containsKey(MIBreakpoints.LINE_NUMBER) // Line number
- || delta.containsKey(MIBreakpoints.BREAKPOINT_TYPE) // breakpoint type
- || delta.containsKey(MIBreakpoints.FUNCTION) // Function name
- || delta.containsKey(MIBreakpoints.ADDRESS) // Absolute address
- || delta.containsKey(ATTR_THREAD_FILTER) // Thread ID
- || delta.containsKey(MIBreakpoints.EXPRESSION) // Watchpoint expression
- || delta.containsKey(MIBreakpoints.READ) // Watchpoint type
- || delta.containsKey(MIBreakpoints.WRITE) // Watchpoint type
- || delta.containsKey(MIBreakpoints.PRINTF_STRING)) {// Dprintf string
- return true;
- }
-
- return false;
- }
-
- /**
- * @param breakpoint
- * @param oldValues
- */
- protected void rollbackAttributes(ICBreakpoint breakpoint, IMarkerDelta oldValues) {
-
- try {
- String newCondition = breakpoint.getCondition();
- if (newCondition == null) {
- newCondition = NULL_STRING;
- }
- String oldCondition = (oldValues != null) ? oldValues.getAttribute(ICBreakpoint.CONDITION, NULL_STRING) : NULL_STRING;
- if (!oldCondition.equals(newCondition)) {
- breakpoint.setCondition(oldCondition);
- }
- else {
- breakpoint.setCondition(NULL_STRING);
- }
- } catch (CoreException e) {
- }
- }
-
- /**
- * Indicates if the back-end supports multiple threads for
- * this type of breakpoint
- *
- * @param breakpoint
- */
- protected boolean supportsThreads(ICBreakpoint breakpoint) {
-
- return !(breakpoint instanceof ICWatchpoint);
- }
-
- /**
- * Returns whether the breakpoint is filtered for the given target.
- */
- private boolean isBreakpointEntirelyFiltered(IBreakpointsTargetDMContext bpTargetDmc, ICBreakpoint breakpoint) {
- try {
- IContainerDMContext[] procTargets = getFilterExtension(breakpoint).getTargetFilters();
- for (IContainerDMContext procDmc : procTargets) {
- if (procDmc.equals(bpTargetDmc) || DMContexts.isAncestorOf(procDmc, bpTargetDmc)) {
- return false;
- }
- }
- } catch (CoreException e) {
- }
- return true;
- }
-
- /**
+ protected Map<String, Object> convertToTargetBreakpoint(ICBreakpoint breakpoint, Map<String, Object> attributes) {
+
+ Map<String, Object> properties = new HashMap<>();
+
+ if (breakpoint instanceof ICWatchpoint) {
+ properties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.WATCHPOINT);
+ properties.put(MIBreakpoints.EXPRESSION, attributes.get(ICWatchpoint.EXPRESSION));
+ properties.put(MIBreakpoints.READ, attributes.get(ICWatchpoint.READ));
+ properties.put(MIBreakpoints.WRITE, attributes.get(ICWatchpoint.WRITE));
+ properties.put(MIBreakpoints.RANGE, attributes.get(ICWatchpoint2.RANGE));
+ properties.put(MIBreakpoints.MEMSPACE, attributes.get(ICWatchpoint2.MEMORYSPACE));
+ } else if (breakpoint instanceof ICLineBreakpoint) {
+ properties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.BREAKPOINT);
+ properties.put(MIBreakpoints.FILE_NAME, attributes.get(ATTR_DEBUGGER_PATH));
+ properties.put(MIBreakpoints.LINE_NUMBER, attributes.get(IMarker.LINE_NUMBER));
+ properties.put(MIBreakpoints.FUNCTION, attributes.get(ICLineBreakpoint.FUNCTION));
+ properties.put(MIBreakpoints.ADDRESS, attributes.get(ICLineBreakpoint.ADDRESS));
+ properties.put(MIBreakpoints.COMMANDS, attributes.get(BreakpointActionManager.BREAKPOINT_ACTION_ATTRIBUTE));
+
+ if (breakpoint instanceof ICTracepoint) {
+ // A tracepoint is a LineBreakpoint, but needs its own type
+ properties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT);
+ properties.put(MIBreakpoints.PASS_COUNT, attributes.get(ICTracepoint.PASS_COUNT));
+ } else if (breakpoint instanceof ICDynamicPrintf) {
+ // A DynamicPrintf is a LineBreakpoint, but needs its own type
+ properties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.DYNAMICPRINTF);
+ properties.put(MIBreakpoints.PRINTF_STRING, attributes.get(ICDynamicPrintf.PRINTF_STRING));
+ }
+ } else if (breakpoint instanceof ICEventBreakpoint) {
+ properties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.CATCHPOINT);
+ properties.put(MIBreakpoints.CATCHPOINT_TYPE, GdbCatchpoints
+ .eventToGdbCatchpointKeyword((String) attributes.get(ICEventBreakpoint.EVENT_TYPE_ID)));
+
+ String arg = (String) attributes.get(ICEventBreakpoint.EVENT_ARG);
+ String[] args;
+ if ((arg != null) && (arg.length() != 0)) {
+ args = new String[1];
+ args[0] = arg;
+ } else {
+ args = new String[0];
+ }
+ properties.put(MIBreakpoints.CATCHPOINT_ARGS, args);
+ } else {
+ assert false : "platform breakpoint is of an unexpected type: " + breakpoint.getClass().getName(); //$NON-NLS-1$
+ }
+
+ // Common fields
+ properties.put(MIBreakpoints.CONDITION, attributes.get(ICBreakpoint.CONDITION));
+ properties.put(MIBreakpoints.IGNORE_COUNT, attributes.get(ICBreakpoint.IGNORE_COUNT));
+ properties.put(MIBreakpoints.IS_ENABLED, attributes.get(ICBreakpoint.ENABLED));
+ properties.put(MIBreakpointDMData.THREAD_ID, attributes.get(ATTR_THREAD_ID));
+
+ // checks for the breakpoint type, and adds the hardware/temporary flags
+ Object breakpointType = attributes.get(ICBreakpointType.TYPE);
+ if (breakpointType instanceof Integer) {
+ boolean isHardware = ((Integer) breakpointType & ICBreakpointType.HARDWARE) == ICBreakpointType.HARDWARE;
+ boolean isTemporary = ((Integer) breakpointType & ICBreakpointType.TEMPORARY) == ICBreakpointType.TEMPORARY;
+ properties.put(MIBreakpointDMData.IS_HARDWARE, isHardware);
+ properties.put(MIBreakpointDMData.IS_TEMPORARY, isTemporary);
+ }
+
+ // Adjust for "skip-all"
+ // Tracepoints and dynamic printf are not affected by "skip-all"
+ if (!(breakpoint instanceof ICTracepoint) && !(breakpoint instanceof ICDynamicPrintf)
+ && !fBreakpointManager.isEnabled()) {
+ properties.put(MIBreakpoints.IS_ENABLED, false);
+ }
+
+ return properties;
+ }
+
+ /**
+ * Determine if the modified attributes necessitate
+ * a breakpoint removal/re-installation
+ *
+ * @param delta
+ * @return
+ */
+ protected boolean needsResinstallation(Map<String, Object> delta) {
+
+ // Check if there is any modified attribute
+ if (delta == null) {
+ return false;
+ }
+
+ // Check the "critical" attributes
+ if (delta.containsKey(ATTR_DEBUGGER_PATH) // File name
+ || delta.containsKey(MIBreakpoints.LINE_NUMBER) // Line number
+ || delta.containsKey(MIBreakpoints.BREAKPOINT_TYPE) // breakpoint type
+ || delta.containsKey(MIBreakpoints.FUNCTION) // Function name
+ || delta.containsKey(MIBreakpoints.ADDRESS) // Absolute address
+ || delta.containsKey(ATTR_THREAD_FILTER) // Thread ID
+ || delta.containsKey(MIBreakpoints.EXPRESSION) // Watchpoint expression
+ || delta.containsKey(MIBreakpoints.READ) // Watchpoint type
+ || delta.containsKey(MIBreakpoints.WRITE) // Watchpoint type
+ || delta.containsKey(MIBreakpoints.PRINTF_STRING)) {// Dprintf string
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @param breakpoint
+ * @param oldValues
+ */
+ protected void rollbackAttributes(ICBreakpoint breakpoint, IMarkerDelta oldValues) {
+
+ try {
+ String newCondition = breakpoint.getCondition();
+ if (newCondition == null) {
+ newCondition = NULL_STRING;
+ }
+ String oldCondition = (oldValues != null) ? oldValues.getAttribute(ICBreakpoint.CONDITION, NULL_STRING)
+ : NULL_STRING;
+ if (!oldCondition.equals(newCondition)) {
+ breakpoint.setCondition(oldCondition);
+ } else {
+ breakpoint.setCondition(NULL_STRING);
+ }
+ } catch (CoreException e) {
+ }
+ }
+
+ /**
+ * Indicates if the back-end supports multiple threads for
+ * this type of breakpoint
+ *
+ * @param breakpoint
+ */
+ protected boolean supportsThreads(ICBreakpoint breakpoint) {
+
+ return !(breakpoint instanceof ICWatchpoint);
+ }
+
+ /**
+ * Returns whether the breakpoint is filtered for the given target.
+ */
+ private boolean isBreakpointEntirelyFiltered(IBreakpointsTargetDMContext bpTargetDmc, ICBreakpoint breakpoint) {
+ try {
+ IContainerDMContext[] procTargets = getFilterExtension(breakpoint).getTargetFilters();
+ for (IContainerDMContext procDmc : procTargets) {
+ if (procDmc.equals(bpTargetDmc) || DMContexts.isAncestorOf(procDmc, bpTargetDmc)) {
+ return false;
+ }
+ }
+ } catch (CoreException e) {
+ }
+ return true;
+ }
+
+ /**
* @since 4.2
*/
- public void addBreakpointsTrackingListener(IMIBreakpointsTrackingListener listener) {
- fTrackingListeners.add(listener);
- }
+ public void addBreakpointsTrackingListener(IMIBreakpointsTrackingListener listener) {
+ fTrackingListeners.add(listener);
+ }
- /**
+ /**
* @since 4.2
*/
- public void removeBreakpointsTrackingListener(IMIBreakpointsTrackingListener listener) {
- fTrackingListeners.remove(listener);
- }
+ public void removeBreakpointsTrackingListener(IMIBreakpointsTrackingListener listener) {
+ fTrackingListeners.remove(listener);
+ }
private String[] compareAttributes(Map<String, Object> oldAttr, Map<String, Object> newAttr, String[] exclude) {
List<String> list = new ArrayList<String>();
@@ -2321,8 +2321,7 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
Object oldValue = oldAttr.get(n);
if (oldValue != null && !oldValue.equals(newAttr.get(n))) {
list.add(n);
- }
- else if (oldValue == null) {
+ } else if (oldValue == null) {
if (newAttr.get(n) != null) {
list.add(n);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsSynchronizer.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsSynchronizer.java
index 470be403e84..9a5d7e7269e 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsSynchronizer.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsSynchronizer.java
@@ -109,21 +109,22 @@ import org.osgi.framework.BundleContext;
* single-threaded. To resolve this problem, there is some code
* {@link #queueEvent(BreakpointEvent)} that ensures each event is fully
* processed before the next event starts processing.
- *
+ *
* @since 4.2
*/
-public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMIBreakpointsTrackingListener, ICachingService {
+public class MIBreakpointsSynchronizer extends AbstractDsfService
+ implements IMIBreakpointsTrackingListener, ICachingService {
// Catchpoint expressions
- private static final String CE_EXCEPTION_CATCH = "exception catch"; //$NON-NLS-1$
- private static final String CE_EXCEPTION_THROW = "exception throw"; //$NON-NLS-1$
-
- // GDB tracepoint commands
- private static final String TC_COLLECT = "collect "; //$NON-NLS-1$
- private static final String TC_TEVAL = "teval "; //$NON-NLS-1$
- private static final String TC_WHILE_STEPPING = "while-stepping "; //$NON-NLS-1$
- private static final String TC_END = "end"; //$NON-NLS-1$
-
+ private static final String CE_EXCEPTION_CATCH = "exception catch"; //$NON-NLS-1$
+ private static final String CE_EXCEPTION_THROW = "exception throw"; //$NON-NLS-1$
+
+ // GDB tracepoint commands
+ private static final String TC_COLLECT = "collect "; //$NON-NLS-1$
+ private static final String TC_TEVAL = "teval "; //$NON-NLS-1$
+ private static final String TC_WHILE_STEPPING = "while-stepping "; //$NON-NLS-1$
+ private static final String TC_END = "end"; //$NON-NLS-1$
+
private IMICommandControl fConnection;
private MIBreakpoints fBreakpointsService;
private MIBreakpointsManager fBreakpointsManager;
@@ -135,16 +136,16 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
/**
* Collection of breakpoints created from the GDB console or outside of Eclipse.
- *
+ *
* Map of breakpoint contexts to Map of breakpoint number (String) to MIBreakpoint
*/
private Map<IBreakpointsTargetDMContext, Map<String, MIBreakpoint>> fCreatedTargetBreakpoints;
/**
* Collection of breakpoints deleted from the GDB console or outside of Eclipse
- */
+ */
private Map<IBreakpointsTargetDMContext, Set<String>> fDeletedTargetBreakpoints;
-
+
/**
* Collection of pending breakpoint modifications
*/
@@ -152,23 +153,25 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
/**
* Class to store an event that needs to be performed by the synchronizer
- *
+ *
* @see MIBreakpointsSynchronizer class documentation for design comments
*/
private static class BreakpointEvent {
MIBreakpoint created;
MIBreakpoint modified;
String deleted;
+
static class BreakpointEventSynchronize {
IBreakpointsTargetDMContext dmc;
MIBreakListInfo list;
}
+
BreakpointEventSynchronize synchronize;
}
/**
* List of events that are queued, waiting to be processed.
- *
+ *
* @see MIBreakpointsSynchronizer class documentation for design comments
*/
private Deque<BreakpointEvent> fBreakpointEvents = new LinkedList<>();
@@ -176,7 +179,7 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
/**
* True if the delayed events processing task is idle. If idle, a new event
* should trigger restarting the processing.
- *
+ *
* @see MIBreakpointsSynchronizer class documentation for design comments
*/
private boolean fEventsIdle = true;
@@ -191,7 +194,7 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
@Override
protected BundleContext getBundleContext() {
- return GdbPlugin.getBundleContext();
+ return GdbPlugin.getBundleContext();
}
@Override
@@ -217,10 +220,7 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
getSession().addServiceEventListener(this, null);
// Register this service
- register(new String[] {
- MIBreakpointsSynchronizer.class.getName()
- },
- new Hashtable<String, String>());
+ register(new String[] { MIBreakpointsSynchronizer.class.getName() }, new Hashtable<String, String>());
rm.done();
}
@@ -237,13 +237,13 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
if (bm != null) {
bm.removeBreakpointsTrackingListener(this);
}
- unregister();
- super.shutdown( rm );
+ unregister();
+ super.shutdown(rm);
}
/**
* Obtain the collection of MI breakpoints created
- *
+ *
* @return collection of target breakpoints
* @since 5.3
*/
@@ -279,7 +279,7 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
/**
* Queue (and potentially start processing) breakpoint events from GDB.
- *
+ *
* @param event
* from GDB that needs to be processed once the synchronizer is idle
* and has completed the previous event.
@@ -290,7 +290,7 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
runNextEvent();
}
}
-
+
private void runNextEvent() {
fEventsIdle = false;
BreakpointEvent event = fBreakpointEvents.poll();
@@ -324,7 +324,7 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
* The effect of flushing the cache of the synchronizer is to recollect all
* breakpoint info from GDB and update the IBreakpoints and MIBreakpointManager
* services too.
- *
+ *
* Note that an optimization in the number of calls to synchronize can be done, see
* synchronize's removeBpsForAllDmcs parameter.
*/
@@ -350,7 +350,7 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
* events from the backend. When this entry in the queue is processed, it
* converts itself to a series of new events that represent the difference
* between the state in the breakpoint manager and GDB.
- *
+ *
* @param bpContext
* context to issue MI Break List on
* @param removeBpsForAllDmcs
@@ -397,7 +397,7 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
BreakpointEvent event = new BreakpointEvent();
event.modified = miBpt;
fBreakpointEvents.addFirst(event);
- } else {
+ } else {
BreakpointEvent event = new BreakpointEvent();
event.created = miBpt;
fBreakpointEvents.addFirst(event);
@@ -406,13 +406,13 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
for (Entry<IBreakpointsTargetDMContext, String> entry : numbersKnownToManager.entrySet()) {
IBreakpointsTargetDMContext dmc = entry.getKey();
String number = entry.getValue();
- if (number != null && !number.isEmpty() && (breakpointsContext == null || breakpointsContext.equals(dmc))) {
+ if (number != null && !number.isEmpty() && (breakpointsContext == null || breakpointsContext.equals(dmc))) {
BreakpointEvent event = new BreakpointEvent();
event.deleted = number;
fBreakpointEvents.addFirst(event);
}
}
-
+
rm.done();
}
@@ -447,7 +447,7 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
}
contextBreakpoints.put(miBpt.getNumber(), fBreakpointsService.createMIBreakpointDMData(miBpt));
- // Store the created target breakpoint to prevent setting it again on the target
+ // Store the created target breakpoint to prevent setting it again on the target
// when addBreakpoint() is called.
Map<String, MIBreakpoint> targetMap = fCreatedTargetBreakpoints.get(bpTargetDMC);
if (targetMap == null) {
@@ -457,76 +457,71 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
targetMap.put(miBpt.getNumber(), miBpt);
// Convert the debug info file path into the file path in the local file system
- String debuggerPath = getFileName(miBpt);
- getSource(
- bpTargetDMC,
- debuggerPath,
- new DataRequestMonitor<String>(getExecutor(), rm) {
- @Override
- @ConfinedToDsfExecutor( "fExecutor" )
- protected void handleSuccess() {
- String fileName = getData();
- if (fileName == null) {
- fileName = getFileName(miBpt);
- }
- // Try to find matching platform breakpoint
- ICBreakpoint plBpt = getPlatformBreakpoint(miBpt, fileName);
- String threadId = miBpt.getThreadId();
- boolean isThreadSpecific = threadId != null && !threadId.isEmpty() && !"0".equals(threadId); //$NON-NLS-1$
- try {
- if (plBpt == null) {
- // If matching platform breakpoint doesn't exist create a new one
- plBpt = createPlatformBreakpoint(fileName, miBpt);
- // If the target breakpoint is thread specific, update thread filters
+ String debuggerPath = getFileName(miBpt);
+ getSource(bpTargetDMC, debuggerPath, new DataRequestMonitor<String>(getExecutor(), rm) {
+ @Override
+ @ConfinedToDsfExecutor("fExecutor")
+ protected void handleSuccess() {
+ String fileName = getData();
+ if (fileName == null) {
+ fileName = getFileName(miBpt);
+ }
+ // Try to find matching platform breakpoint
+ ICBreakpoint plBpt = getPlatformBreakpoint(miBpt, fileName);
+ String threadId = miBpt.getThreadId();
+ boolean isThreadSpecific = threadId != null && !threadId.isEmpty() && !"0".equals(threadId); //$NON-NLS-1$
+ try {
+ if (plBpt == null) {
+ // If matching platform breakpoint doesn't exist create a new one
+ plBpt = createPlatformBreakpoint(fileName, miBpt);
+ // If the target breakpoint is thread specific, update thread filters
+ if (isThreadSpecific) {
+ setThreadSpecificBreakpoint(plBpt, miBpt);
+ }
+ doTargetBreakpointCreatedSync(miBpt, bpTargetDMC, plBpt);
+ delayDone(100, rm);
+ return;
+ } else {
+ // The corresponding platform breakpoint already exists.
+ // If the breakpoint tracking has already started we need
+ // to notify MIBreakpointsManager which will increment its
+ // install count.
+ // Otherwise the breakpoint will be processed as an initial
+ // breakpoint when the breakpoint tracking starts.
+ if (isBreakpointTargetTracked(bpTargetDMC)) {
+ // If the target breakpoint is thread specific, update thread filters
if (isThreadSpecific) {
setThreadSpecificBreakpoint(plBpt, miBpt);
}
- doTargetBreakpointCreatedSync(miBpt, bpTargetDMC, plBpt);
- delayDone(100, rm);
- return;
- }
- else {
- // The corresponding platform breakpoint already exists.
- // If the breakpoint tracking has already started we need
- // to notify MIBreakpointsManager which will increment its
- // install count.
- // Otherwise the breakpoint will be processed as an initial
- // breakpoint when the breakpoint tracking starts.
- if (isBreakpointTargetTracked(bpTargetDMC)) {
- // If the target breakpoint is thread specific, update thread filters
- if (isThreadSpecific) {
- setThreadSpecificBreakpoint(plBpt, miBpt);
+
+ ICBreakpoint plBpt2 = plBpt;
+ bm.breakpointAdded(plBpt2, miBpt, new RequestMonitor(getExecutor(), rm) {
+ @Override
+ protected void handleCompleted() {
+ doTargetBreakpointCreatedSync(miBpt, bpTargetDMC, plBpt2);
+ rm.done();
}
-
- ICBreakpoint plBpt2 = plBpt;
- bm.breakpointAdded(plBpt2, miBpt, new RequestMonitor(getExecutor(), rm) {
- @Override
- protected void handleCompleted() {
- doTargetBreakpointCreatedSync(miBpt, bpTargetDMC, plBpt2);
- rm.done();
- }
- });
- return;
- } else {
- doTargetBreakpointCreatedSync(miBpt, bpTargetDMC, plBpt);
- rm.done();
- return;
- }
- }
- }
- catch(CoreException e) {
- GdbPlugin.log(getStatus());
+ });
+ return;
+ } else {
+ doTargetBreakpointCreatedSync(miBpt, bpTargetDMC, plBpt);
+ rm.done();
+ return;
+ }
}
- rm.done();
- return;
- }
+ } catch (CoreException e) {
+ GdbPlugin.log(getStatus());
+ }
+ rm.done();
+ return;
+ }
- });
+ });
}
- private void doTargetBreakpointCreatedSync(final MIBreakpoint miBpt,
- final IBreakpointsTargetDMContext bpTargetDMC, ICBreakpoint plBpt) {
- // Make sure the platform breakpoint's parameters are synchronized
+ private void doTargetBreakpointCreatedSync(final MIBreakpoint miBpt, final IBreakpointsTargetDMContext bpTargetDMC,
+ ICBreakpoint plBpt) {
+ // Make sure the platform breakpoint's parameters are synchronized
// with the target breakpoint.
Map<String, MIBreakpoint> map = fPendingModifications.get(bpTargetDMC);
if (map != null) {
@@ -534,8 +529,7 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
if (mod != null) {
targetBreakpointModified(bpTargetDMC, plBpt, mod);
}
- }
- else {
+ } else {
targetBreakpointModified(bpTargetDMC, plBpt, miBpt);
}
};
@@ -547,7 +541,7 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
* the platform operations, but that is not available. Use this method to delay
* calling .done() until at least delayExecutorCycles cycles of the executor
* have run.
- *
+ *
* @param delayExecutorCycles
* @param rm
*/
@@ -579,81 +573,80 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
return;
}
final IBreakpointsTargetDMContext bpTargetDMC = breakpointsService.getBreakpointTargetContext(id);
- if (bpTargetDMC != null){
- final MIBreakpointDMContext bpDMC =
- new MIBreakpointDMContext(breakpointsService, new IDMContext[] { bpTargetDMC }, id);
- breakpointsService.getBreakpointDMData(
- bpDMC,
- new DataRequestMonitor<IBreakpointDMData>(getExecutor(), rm) {
- @Override
- @ConfinedToDsfExecutor( "fExecutor" )
- protected void handleSuccess() {
- if (!(getData() instanceof MIBreakpointDMData)) {
- rm.done();
- return;
- }
- MIBreakpointDMData data = (MIBreakpointDMData)getData();
- if (MIBreakpoints.CATCHPOINT.equals(data.getBreakpointType())) {
- rm.done();
- return;
+ if (bpTargetDMC != null) {
+ final MIBreakpointDMContext bpDMC = new MIBreakpointDMContext(breakpointsService,
+ new IDMContext[] { bpTargetDMC }, id);
+ breakpointsService.getBreakpointDMData(bpDMC, new DataRequestMonitor<IBreakpointDMData>(getExecutor(), rm) {
+ @Override
+ @ConfinedToDsfExecutor("fExecutor")
+ protected void handleSuccess() {
+ if (!(getData() instanceof MIBreakpointDMData)) {
+ rm.done();
+ return;
+ }
+ MIBreakpointDMData data = (MIBreakpointDMData) getData();
+ if (MIBreakpoints.CATCHPOINT.equals(data.getBreakpointType())) {
+ rm.done();
+ return;
+ }
+
+ IBreakpoint plBpt = bm.findPlatformBreakpoint(bpDMC);
+ if (plBpt instanceof ICBreakpoint) {
+ Set<String> set = fDeletedTargetBreakpoints.get(bpTargetDMC);
+ if (set == null) {
+ set = new HashSet<String>();
+ fDeletedTargetBreakpoints.put(bpTargetDMC, set);
}
-
- IBreakpoint plBpt = bm.findPlatformBreakpoint(bpDMC);
- if (plBpt instanceof ICBreakpoint) {
- Set<String> set = fDeletedTargetBreakpoints.get(bpTargetDMC);
- if (set == null) {
- set = new HashSet<String>();
- fDeletedTargetBreakpoints.put(bpTargetDMC, set);
- }
- set.add(id);
-
- try {
- String threadId = data.getThreadId();
- if (!threadId.equals("0")) { //$NON-NLS-1$
- IDsfBreakpointExtension bpExtension = fBreakpointsManager.getFilterExtension((ICBreakpoint)plBpt);
-
- IMIProcesses processes = getServicesTracker().getService(IMIProcesses.class);
- if (processes == null) {
- rm.done();
- return;
- }
+ set.add(id);
- IContainerDMContext contDMC = processes.createContainerContextFromThreadId(getCommandControl().getContext(), data.getThreadId());
- if (contDMC == null) {
- rm.done();
- return;
- }
+ try {
+ String threadId = data.getThreadId();
+ if (!threadId.equals("0")) { //$NON-NLS-1$
+ IDsfBreakpointExtension bpExtension = fBreakpointsManager
+ .getFilterExtension((ICBreakpoint) plBpt);
- IExecutionDMContext[] execDMCs = bpExtension.getThreadFilters(contDMC);
- List<IExecutionDMContext> list = new ArrayList<IExecutionDMContext>(execDMCs.length);
- for (IExecutionDMContext c : execDMCs) {
- if (c instanceof IMIExecutionDMContext
- && !((IMIExecutionDMContext)c).getThreadId().equals(threadId)) {
- list.add(c);
- }
- }
- if (!list.isEmpty()) {
- bpExtension.setThreadFilters(list.toArray(new IExecutionDMContext[list.size()]));
- rm.done();
- return;
- }
- else {
- bm.uninstallBreakpoint(bpTargetDMC, (ICBreakpoint)plBpt, new RequestMonitor(getExecutor(), rm));
- return;
+ IMIProcesses processes = getServicesTracker().getService(IMIProcesses.class);
+ if (processes == null) {
+ rm.done();
+ return;
+ }
+
+ IContainerDMContext contDMC = processes.createContainerContextFromThreadId(
+ getCommandControl().getContext(), data.getThreadId());
+ if (contDMC == null) {
+ rm.done();
+ return;
+ }
+
+ IExecutionDMContext[] execDMCs = bpExtension.getThreadFilters(contDMC);
+ List<IExecutionDMContext> list = new ArrayList<IExecutionDMContext>(execDMCs.length);
+ for (IExecutionDMContext c : execDMCs) {
+ if (c instanceof IMIExecutionDMContext
+ && !((IMIExecutionDMContext) c).getThreadId().equals(threadId)) {
+ list.add(c);
}
}
- else {
- bm.uninstallBreakpoint(bpTargetDMC, (ICBreakpoint)plBpt, new RequestMonitor(getExecutor(), rm));
+ if (!list.isEmpty()) {
+ bpExtension.setThreadFilters(list.toArray(new IExecutionDMContext[list.size()]));
+ rm.done();
+ return;
+ } else {
+ bm.uninstallBreakpoint(bpTargetDMC, (ICBreakpoint) plBpt,
+ new RequestMonitor(getExecutor(), rm));
return;
}
+ } else {
+ bm.uninstallBreakpoint(bpTargetDMC, (ICBreakpoint) plBpt,
+ new RequestMonitor(getExecutor(), rm));
+ return;
}
- catch(CoreException e) {
- GdbPlugin.log(e.getStatus());
- }
+ } catch (CoreException e) {
+ GdbPlugin.log(e.getStatus());
}
- rm.done();
}
- });
+ rm.done();
+ }
+ });
} else {
rm.done();
@@ -665,7 +658,7 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
event.modified = miBpt;
queueEvent(event);
}
-
+
/**
* Find the platform breakpoint, returning it, if it exists via the DRM. If the
* drm's data is null, it has not been found.
@@ -676,12 +669,12 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
if (breakpointsService != null && bm != null) {
final IBreakpointsTargetDMContext bpTargetDMC = getBreakpointsTargetContext(miBpt);
if (bpTargetDMC == null) {
- drm.done((IBreakpoint)null);
+ drm.done((IBreakpoint) null);
return;
}
final Map<String, MIBreakpointDMData> contextBreakpoints = breakpointsService.getBreakpointMap(bpTargetDMC);
if (contextBreakpoints == null) {
- drm.done((IBreakpoint)null);
+ drm.done((IBreakpoint) null);
return;
}
IBreakpoint b = bm.findPlatformBreakpoint(
@@ -715,7 +708,7 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
rm.done();
return;
}
-
+
findPlatformBreakpoint(miBpt, new DataRequestMonitor<IBreakpoint>(getExecutor(), rm) {
@Override
protected void handleSuccess() {
@@ -745,9 +738,7 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
});
}
- private void targetBreakpointModified(
- IBreakpointsTargetDMContext bpTargetDMC,
- ICBreakpoint plBpt,
+ private void targetBreakpointModified(IBreakpointsTargetDMContext bpTargetDMC, ICBreakpoint plBpt,
MIBreakpoint miBpt) {
Map<String, MIBreakpointDMData> contextBreakpoints = getBreakpointsService().getBreakpointMap(bpTargetDMC);
MIBreakpointDMData oldData = contextBreakpoints.get(miBpt.getNumber());
@@ -767,13 +758,14 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
}
}
if (plBpt instanceof ICTracepoint && miBpt.isTracepoint()) {
- ICTracepoint plTpt = (ICTracepoint)plBpt;
+ ICTracepoint plTpt = (ICTracepoint) plBpt;
if (plTpt.getPassCount() != miBpt.getPassCount()) {
// GDB (up to 7.5) doesn't emit notification when the pass count is modified.
plTpt.setPassCount(miBpt.getPassCount());
}
- if (!miBpt.getCommands().equals(plBpt.getMarker().getAttribute(BreakpointActionManager.BREAKPOINT_ACTION_ATTRIBUTE))) {
+ if (!miBpt.getCommands()
+ .equals(plBpt.getMarker().getAttribute(BreakpointActionManager.BREAKPOINT_ACTION_ATTRIBUTE))) {
StringBuilder sb = new StringBuilder();
boolean first = true;
String[] commands = miBpt.getCommands().split(TracepointActionManager.TRACEPOINT_ACTION_DELIMITER);
@@ -785,13 +777,12 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
}
sb.append(action.getName());
}
- // Target breakpoints and platform breakpoints use the same format
- // to store trace commands. This format is different than the format
+ // Target breakpoints and platform breakpoints use the same format
+ // to store trace commands. This format is different than the format
// used by GDB. We need to switch to the platform format to avoid unnecessary
// modifications of target breakpoints.
miBpt.setCommands(sb.toString());
- plBpt.getMarker().setAttribute(
- BreakpointActionManager.BREAKPOINT_ACTION_ATTRIBUTE, sb.toString());
+ plBpt.getMarker().setAttribute(BreakpointActionManager.BREAKPOINT_ACTION_ATTRIBUTE, sb.toString());
}
} else if (plBpt instanceof ICDynamicPrintf && miBpt.isDynamicPrintf()) {
// Cannot synchronize the string as there is a bug in GDB 7.7 that corrupts it.
@@ -809,16 +800,13 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
// plDPrintf.setPrintfString(miBpt.getPrintfString());
// }
}
- }
- catch(CoreException e) {
+ } catch (CoreException e) {
contextBreakpoints.put(miBpt.getNumber(), oldData);
GdbPlugin.log(e.getStatus());
}
}
- private void setThreadSpecificBreakpoint(
- final ICBreakpoint plBpt,
- MIBreakpoint miBpt) {
+ private void setThreadSpecificBreakpoint(final ICBreakpoint plBpt, MIBreakpoint miBpt) {
try {
IMIProcesses processes = getServicesTracker().getService(IMIProcesses.class);
@@ -826,12 +814,12 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
return;
}
String threadId = miBpt.getThreadId();
- IContainerDMContext contDMC = processes.createContainerContextFromThreadId(getCommandControl().getContext(), threadId);
+ IContainerDMContext contDMC = processes.createContainerContextFromThreadId(getCommandControl().getContext(),
+ threadId);
if (contDMC == null) {
return;
}
- IProcessDMContext procDmc =
- DMContexts.getAncestorOfType(contDMC, IProcessDMContext.class);
+ IProcessDMContext procDmc = DMContexts.getAncestorOfType(contDMC, IProcessDMContext.class);
if (procDmc == null) {
return;
}
@@ -842,25 +830,22 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
execDMCs = new IExecutionDMContext[0];
}
for (IExecutionDMContext execDMC : execDMCs) {
- String ctxThreadId = ((IMIExecutionDMContext)execDMC).getThreadId();
- if (execDMC instanceof IMIExecutionDMContext && ctxThreadId.equals(threadId)) {
- // The platform breakpoint is already restricted to the given thread.
- return;
- }
+ String ctxThreadId = ((IMIExecutionDMContext) execDMC).getThreadId();
+ if (execDMC instanceof IMIExecutionDMContext && ctxThreadId.equals(threadId)) {
+ // The platform breakpoint is already restricted to the given thread.
+ return;
+ }
}
IExecutionDMContext[] newExecDMCs = new IExecutionDMContext[execDMCs.length + 1];
System.arraycopy(execDMCs, 0, newExecDMCs, 0, execDMCs.length);
- newExecDMCs[execDMCs.length] = processes.createExecutionContext(
- contDMC,
- processes.createThreadContext(procDmc, threadId),
- threadId);
+ newExecDMCs[execDMCs.length] = processes.createExecutionContext(contDMC,
+ processes.createThreadContext(procDmc, threadId), threadId);
bpExtension.setThreadFilters(newExecDMCs);
- }
- catch(CoreException e) {
+ } catch (CoreException e) {
GdbPlugin.log(e);
}
}
-
+
private ICBreakpoint getPlatformBreakpoint(MIBreakpoint miBpt, String fileName) {
for (IBreakpoint b : DebugPlugin.getDefault().getBreakpointManager().getBreakpoints()) {
if (b instanceof ICBreakpoint) {
@@ -875,10 +860,10 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
/**
* Return true if the target breakpoint is the same as the platform breakpoint.
- *
+ *
* Whether breakpoints are considered the same depends on their type and their key attributes, with each type
* defining its own key attributes.
- *
+ *
* @param platformBreakpoint
* @param targetBreakpoint
* @param fileName
@@ -890,27 +875,22 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
*/
protected boolean isPlatformBreakpoint(ICBreakpoint platformBreakpoint, MIBreakpoint targetBreakpoint,
String fileName) {
- if (platformBreakpoint instanceof ICTracepoint
- && targetBreakpoint.isTracepoint()
- && isPlatformTracepoint((ICTracepoint)platformBreakpoint, targetBreakpoint, fileName)) {
+ if (platformBreakpoint instanceof ICTracepoint && targetBreakpoint.isTracepoint()
+ && isPlatformTracepoint((ICTracepoint) platformBreakpoint, targetBreakpoint, fileName)) {
return true;
}
- if (platformBreakpoint instanceof ICDynamicPrintf
- && targetBreakpoint.isDynamicPrintf()
- && isPlatformDynamicPrintf((ICDynamicPrintf)platformBreakpoint, targetBreakpoint, fileName)) {
+ if (platformBreakpoint instanceof ICDynamicPrintf && targetBreakpoint.isDynamicPrintf()
+ && isPlatformDynamicPrintf((ICDynamicPrintf) platformBreakpoint, targetBreakpoint, fileName)) {
return true;
}
- if (platformBreakpoint instanceof ICWatchpoint
- && targetBreakpoint.isWatchpoint()
- && isPlatformWatchpoint((ICWatchpoint)platformBreakpoint, targetBreakpoint)) {
+ if (platformBreakpoint instanceof ICWatchpoint && targetBreakpoint.isWatchpoint()
+ && isPlatformWatchpoint((ICWatchpoint) platformBreakpoint, targetBreakpoint)) {
return true;
}
- if (platformBreakpoint instanceof ICLineBreakpoint
- && !targetBreakpoint.isWatchpoint()
- && !isCatchpoint(targetBreakpoint)
- && !targetBreakpoint.isTracepoint()
+ if (platformBreakpoint instanceof ICLineBreakpoint && !targetBreakpoint.isWatchpoint()
+ && !isCatchpoint(targetBreakpoint) && !targetBreakpoint.isTracepoint()
&& !targetBreakpoint.isDynamicPrintf()
- && isPlatformLineBreakpoint((ICLineBreakpoint)platformBreakpoint, targetBreakpoint, fileName)) {
+ && isPlatformLineBreakpoint((ICLineBreakpoint) platformBreakpoint, targetBreakpoint, fileName)) {
return true;
}
return false;
@@ -926,10 +906,10 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
* Create the platform breakpoint, but don't register it with breakpoint manager. This method is called when the
* synchronizer needs to create a new platform breakpoint for a new breakpoint created by the user in the CLI
* interface (in response to =breakpoint-created event).
- *
+ *
* If further fine tuning on the created breakpoint is needed, consider overriding
* {@link #targetBreakpointCreated(MIBreakpoint)} or even replacing the entire breakpoint synchronizer.
- *
+ *
* @param fileName
* the name of the file that breakpoint was inserted into, as determined by source lookup
* @param miBpt
@@ -941,14 +921,11 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
protected ICBreakpoint createPlatformBreakpoint0(String fileName, MIBreakpoint miBpt) throws CoreException {
if (miBpt.isWatchpoint()) {
return createPlatformWatchpoint(fileName, miBpt);
- }
- else if (miBpt.isTracepoint()) {
+ } else if (miBpt.isTracepoint()) {
return createPlatformTracepoint(fileName, miBpt);
- }
- else if (miBpt.isDynamicPrintf()) {
+ } else if (miBpt.isDynamicPrintf()) {
return createPlatformDynamicPrintf(fileName, miBpt);
- }
- else {
+ } else {
return createPlatformLocationBreakpoint(fileName, miBpt);
}
}
@@ -956,11 +933,9 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
private ICBreakpoint createPlatformLocationBreakpoint(String fileName, MIBreakpoint miBpt) throws CoreException {
if (isAddressBreakpoint(miBpt)) {
return createPlatformAddressBreakpoint(fileName, miBpt);
- }
- else if (isFunctionBreakpoint(miBpt)) {
+ } else if (isFunctionBreakpoint(miBpt)) {
return createPlatformFunctionBreakpoint(fileName, miBpt);
- }
- else {
+ } else {
return createPlatformLineBreakpoint(fileName, miBpt);
}
}
@@ -977,20 +952,12 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
}
try {
- return CDIDebugModel.createAddressBreakpoint(
- null,
- null,
- resource,
- type,
- getPlatformAddress(miBpt.getAddress()),
- miBpt.isEnabled(),
- miBpt.getIgnoreCount(),
- miBpt.getCondition(),
- false);
- }
- catch(NumberFormatException e) {
- throw new CoreException(new Status(IStatus.ERROR, GdbPlugin.getUniqueIdentifier(),
- String.format("Invalid breakpoint address: %s", miBpt.getAddress()))); //$NON-NLS-1$
+ return CDIDebugModel.createAddressBreakpoint(null, null, resource, type,
+ getPlatformAddress(miBpt.getAddress()), miBpt.isEnabled(), miBpt.getIgnoreCount(),
+ miBpt.getCondition(), false);
+ } catch (NumberFormatException e) {
+ throw new CoreException(new Status(IStatus.ERROR, GdbPlugin.getUniqueIdentifier(),
+ String.format("Invalid breakpoint address: %s", miBpt.getAddress()))); //$NON-NLS-1$
}
}
@@ -1004,24 +971,14 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
if (miBpt.isHardware()) {
type |= ICBreakpointType.HARDWARE;
}
-
- return CDIDebugModel.createFunctionTracepoint(
- fileName,
- resource,
- type,
- getFunctionName(miBpt),
- -1,
- -1,
- getLineNumber(miBpt),
- miBpt.isEnabled(),
- miBpt.getIgnoreCount(),
- miBpt.getCondition(),
- false);
+
+ return CDIDebugModel.createFunctionTracepoint(fileName, resource, type, getFunctionName(miBpt), -1, -1,
+ getLineNumber(miBpt), miBpt.isEnabled(), miBpt.getIgnoreCount(), miBpt.getCondition(), false);
}
private ICBreakpoint createPlatformLineTracepoint(String fileName, MIBreakpoint miBpt) throws CoreException {
IResource resource = getResource(fileName);
-
+
int type = 0;
if (miBpt.isTemporary()) {
type |= ICBreakpointType.TEMPORARY;
@@ -1029,26 +986,17 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
if (miBpt.isHardware()) {
type |= ICBreakpointType.HARDWARE;
}
-
- return CDIDebugModel.createLineTracepoint(
- fileName,
- resource,
- type,
- getLineNumber(miBpt),
- miBpt.isEnabled(),
- miBpt.getIgnoreCount(),
- miBpt.getCondition(),
- false);
+
+ return CDIDebugModel.createLineTracepoint(fileName, resource, type, getLineNumber(miBpt), miBpt.isEnabled(),
+ miBpt.getIgnoreCount(), miBpt.getCondition(), false);
}
private ICBreakpoint createPlatformTracepoint(String fileName, MIBreakpoint miBpt) throws CoreException {
if (isAddressBreakpoint(miBpt)) {
return createPlatformAddressTracepoint(fileName, miBpt);
- }
- else if (isFunctionBreakpoint(miBpt)) {
+ } else if (isFunctionBreakpoint(miBpt)) {
return createPlatformFunctionTracepoint(fileName, miBpt);
- }
- else {
+ } else {
return createPlatformLineTracepoint(fileName, miBpt);
}
}
@@ -1065,20 +1013,11 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
}
try {
- return CDIDebugModel.createAddressTracepoint(
- null,
- null,
- resource,
- type,
- getLineNumber(miBpt),
- getPlatformAddress(miBpt.getAddress()),
- miBpt.isEnabled(),
- miBpt.getIgnoreCount(),
- miBpt.getCondition(),
- false);
- }
- catch(NumberFormatException e) {
- throw new CoreException(new Status(IStatus.ERROR, GdbPlugin.getUniqueIdentifier(),
+ return CDIDebugModel.createAddressTracepoint(null, null, resource, type, getLineNumber(miBpt),
+ getPlatformAddress(miBpt.getAddress()), miBpt.isEnabled(), miBpt.getIgnoreCount(),
+ miBpt.getCondition(), false);
+ } catch (NumberFormatException e) {
+ throw new CoreException(new Status(IStatus.ERROR, GdbPlugin.getUniqueIdentifier(),
String.format("Invalid breakpoint address: %s", miBpt.getAddress()))); //$NON-NLS-1$
}
}
@@ -1115,19 +1054,9 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
if (miBpt.isHardware()) {
type |= ICBreakpointType.HARDWARE;
}
-
- return CDIDebugModel.createFunctionBreakpoint(
- resolvedFileName,
- resource,
- type,
- getFunctionName(miBpt),
- -1,
- -1,
- getLineNumber(miBpt),
- miBpt.isEnabled(),
- miBpt.getIgnoreCount(),
- miBpt.getCondition(),
- false);
+
+ return CDIDebugModel.createFunctionBreakpoint(resolvedFileName, resource, type, getFunctionName(miBpt), -1, -1,
+ getLineNumber(miBpt), miBpt.isEnabled(), miBpt.getIgnoreCount(), miBpt.getCondition(), false);
}
/**
@@ -1135,7 +1064,7 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
* then create the breakpoint with that file, otherwise the function breakpoint
* should be inserted in the same way as if it was done with the UI "Add
* Function Breakpoint (C/C++)".
- *
+ *
* @param miBpt
* an MI Breakpoint that is a function breakpoint
* @return true if the user specified file and function, false if just a
@@ -1157,16 +1086,9 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
if (miBpt.isHardware()) {
type |= ICBreakpointType.HARDWARE;
}
-
- return CDIDebugModel.createLineBreakpoint(
- fileName,
- resource,
- type,
- getLineNumber(miBpt),
- miBpt.isEnabled(),
- miBpt.getIgnoreCount(),
- miBpt.getCondition(),
- false);
+
+ return CDIDebugModel.createLineBreakpoint(fileName, resource, type, getLineNumber(miBpt), miBpt.isEnabled(),
+ miBpt.getIgnoreCount(), miBpt.getCondition(), false);
}
private ICBreakpoint createPlatformDynamicPrintf(String fileName, MIBreakpoint miBpt) throws CoreException {
@@ -1176,9 +1098,9 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
// TODO This is currently causing problems because we think a normal dprintf is a function one
// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=400628#c16 which says:
// "synchronization of function dprintf does not work"
-// else if (isFunctionBreakpoint(miBpt)) {
-// return createPlatformFunctionDynamicPrintf(fileName, miBpt);
-// }
+ // else if (isFunctionBreakpoint(miBpt)) {
+ // return createPlatformFunctionDynamicPrintf(fileName, miBpt);
+ // }
else {
return createPlatformLineDynamicPrintf(fileName, miBpt);
}
@@ -1196,21 +1118,11 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
}
try {
- return CDIDebugModel.createAddressDynamicPrintf(
- null,
- null,
- resource,
- type,
- getLineNumber(miBpt),
- getPlatformAddress(miBpt.getAddress()),
- miBpt.isEnabled(),
- miBpt.getIgnoreCount(),
- miBpt.getCondition(),
- miBpt.getPrintfString(),
- false);
- }
- catch(NumberFormatException e) {
- throw new CoreException(new Status(IStatus.ERROR, GdbPlugin.getUniqueIdentifier(),
+ return CDIDebugModel.createAddressDynamicPrintf(null, null, resource, type, getLineNumber(miBpt),
+ getPlatformAddress(miBpt.getAddress()), miBpt.isEnabled(), miBpt.getIgnoreCount(),
+ miBpt.getCondition(), miBpt.getPrintfString(), false);
+ } catch (NumberFormatException e) {
+ throw new CoreException(new Status(IStatus.ERROR, GdbPlugin.getUniqueIdentifier(),
String.format("Invalid breakpoint address: %s", miBpt.getAddress()))); //$NON-NLS-1$
}
}
@@ -1227,25 +1139,15 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
if (miBpt.isHardware()) {
type |= ICBreakpointType.HARDWARE;
}
-
- return CDIDebugModel.createFunctionDynamicPrintf(
- fileName,
- resource,
- type,
- getFunctionName(miBpt),
- -1,
- -1,
- getLineNumber(miBpt),
- miBpt.isEnabled(),
- miBpt.getIgnoreCount(),
- miBpt.getCondition(),
- miBpt.getPrintfString(),
- false);
+
+ return CDIDebugModel.createFunctionDynamicPrintf(fileName, resource, type, getFunctionName(miBpt), -1, -1,
+ getLineNumber(miBpt), miBpt.isEnabled(), miBpt.getIgnoreCount(), miBpt.getCondition(),
+ miBpt.getPrintfString(), false);
}
private ICBreakpoint createPlatformLineDynamicPrintf(String fileName, MIBreakpoint miBpt) throws CoreException {
IResource resource = getResource(fileName);
-
+
int type = 0;
if (miBpt.isTemporary()) {
type |= ICBreakpointType.TEMPORARY;
@@ -1253,22 +1155,14 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
if (miBpt.isHardware()) {
type |= ICBreakpointType.HARDWARE;
}
-
- return CDIDebugModel.createLineDynamicPrintf(
- fileName,
- resource,
- type,
- getLineNumber(miBpt),
- miBpt.isEnabled(),
- miBpt.getIgnoreCount(),
- miBpt.getCondition(),
- miBpt.getPrintfString(),
- false);
+
+ return CDIDebugModel.createLineDynamicPrintf(fileName, resource, type, getLineNumber(miBpt), miBpt.isEnabled(),
+ miBpt.getIgnoreCount(), miBpt.getCondition(), miBpt.getPrintfString(), false);
}
private ICBreakpoint createPlatformWatchpoint(String fileName, MIBreakpoint miBpt) throws CoreException {
IResource resource = getResource(fileName);
-
+
int type = 0;
if (miBpt.isTemporary()) {
type |= ICBreakpointType.TEMPORARY;
@@ -1277,17 +1171,10 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
type |= ICBreakpointType.HARDWARE;
}
- return CDIDebugModel.createWatchpoint(
- fileName,
- resource,
- type,
+ return CDIDebugModel.createWatchpoint(fileName, resource, type,
miBpt.isAccessWatchpoint() || miBpt.isWriteWatchpoint(),
- miBpt.isAccessWatchpoint() || miBpt.isReadWatchpoint(),
- miBpt.getExpression(),
- miBpt.isEnabled(),
- miBpt.getIgnoreCount(),
- miBpt.getCondition(),
- false);
+ miBpt.isAccessWatchpoint() || miBpt.isReadWatchpoint(), miBpt.getExpression(), miBpt.isEnabled(),
+ miBpt.getIgnoreCount(), miBpt.getCondition(), false);
}
/**
@@ -1305,124 +1192,83 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
// For GDB < 7.4, each process is its own breakpointTargetDMC so we need to find a the proper process
// based on the threadId. For GDB >= 7.4, this does not matter as we'll always end up with the global bpTargetDMC
String threadId = (miBpt != null) ? miBpt.getThreadId() : null;
- IContainerDMContext contContext = processes.createContainerContextFromThreadId(getCommandControl().getContext(), threadId);
+ IContainerDMContext contContext = processes.createContainerContextFromThreadId(getCommandControl().getContext(),
+ threadId);
return DMContexts.getAncestorOfType(contContext, IBreakpointsTargetDMContext.class);
}
- public void getTargetBreakpoint(
- IBreakpointsTargetDMContext context,
- Map<String, Object> attributes,
+ public void getTargetBreakpoint(IBreakpointsTargetDMContext context, Map<String, Object> attributes,
DataRequestMonitor<MIBreakpoint> rm) {
Collection<MIBreakpoint> targetBreakpoints = getCreatedTargetBreakpoints(context);
if (targetBreakpoints == null) {
rm.done();
return;
}
- String type = (String)attributes.get(MIBreakpoints.BREAKPOINT_TYPE);
+ String type = (String) attributes.get(MIBreakpoints.BREAKPOINT_TYPE);
if (MIBreakpoints.BREAKPOINT.equals(type)) {
- rm.done(getTargetLineBreakpoint(
- targetBreakpoints,
- (String)attributes.get(MIBreakpoints.FILE_NAME),
- (Integer)attributes.get(MIBreakpoints.LINE_NUMBER),
- (String)attributes.get(MIBreakpoints.FUNCTION),
- (String)attributes.get(MIBreakpoints.ADDRESS),
- (Boolean)attributes.get(MIBreakpointDMData.IS_HARDWARE),
- (Boolean)attributes.get(MIBreakpointDMData.IS_TEMPORARY)));
- }
- else if (MIBreakpoints.TRACEPOINT.equals(type)) {
- rm.done(getTargetTracepoint(
- targetBreakpoints,
- (String)attributes.get(MIBreakpoints.FILE_NAME),
- (Integer)attributes.get(MIBreakpoints.LINE_NUMBER),
- (String)attributes.get(MIBreakpoints.FUNCTION),
- (String)attributes.get(MIBreakpoints.ADDRESS),
- (Boolean)attributes.get(MIBreakpointDMData.IS_HARDWARE),
- (Boolean)attributes.get(MIBreakpointDMData.IS_TEMPORARY)));
- }
- else if (MIBreakpoints.DYNAMICPRINTF.equals(type)) {
- rm.done(getTargetDPrintf(
- targetBreakpoints,
- (String)attributes.get(MIBreakpoints.FILE_NAME),
- (Integer)attributes.get(MIBreakpoints.LINE_NUMBER),
- (String)attributes.get(MIBreakpoints.FUNCTION),
- (String)attributes.get(MIBreakpoints.ADDRESS),
- (Boolean)attributes.get(MIBreakpointDMData.IS_HARDWARE),
- (Boolean)attributes.get(MIBreakpointDMData.IS_TEMPORARY)));
- }
- else if (MIBreakpoints.WATCHPOINT.equals(type)) {
- rm.done(getTargetWatchpoint(
- targetBreakpoints,
- (String)attributes.get(MIBreakpoints.EXPRESSION),
- (Boolean)attributes.get(MIBreakpoints.READ),
- (Boolean)attributes.get(MIBreakpoints.WRITE),
- (Boolean)attributes.get(MIBreakpointDMData.IS_HARDWARE),
- (Boolean)attributes.get(MIBreakpointDMData.IS_TEMPORARY)));
+ rm.done(getTargetLineBreakpoint(targetBreakpoints, (String) attributes.get(MIBreakpoints.FILE_NAME),
+ (Integer) attributes.get(MIBreakpoints.LINE_NUMBER),
+ (String) attributes.get(MIBreakpoints.FUNCTION), (String) attributes.get(MIBreakpoints.ADDRESS),
+ (Boolean) attributes.get(MIBreakpointDMData.IS_HARDWARE),
+ (Boolean) attributes.get(MIBreakpointDMData.IS_TEMPORARY)));
+ } else if (MIBreakpoints.TRACEPOINT.equals(type)) {
+ rm.done(getTargetTracepoint(targetBreakpoints, (String) attributes.get(MIBreakpoints.FILE_NAME),
+ (Integer) attributes.get(MIBreakpoints.LINE_NUMBER),
+ (String) attributes.get(MIBreakpoints.FUNCTION), (String) attributes.get(MIBreakpoints.ADDRESS),
+ (Boolean) attributes.get(MIBreakpointDMData.IS_HARDWARE),
+ (Boolean) attributes.get(MIBreakpointDMData.IS_TEMPORARY)));
+ } else if (MIBreakpoints.DYNAMICPRINTF.equals(type)) {
+ rm.done(getTargetDPrintf(targetBreakpoints, (String) attributes.get(MIBreakpoints.FILE_NAME),
+ (Integer) attributes.get(MIBreakpoints.LINE_NUMBER),
+ (String) attributes.get(MIBreakpoints.FUNCTION), (String) attributes.get(MIBreakpoints.ADDRESS),
+ (Boolean) attributes.get(MIBreakpointDMData.IS_HARDWARE),
+ (Boolean) attributes.get(MIBreakpointDMData.IS_TEMPORARY)));
+ } else if (MIBreakpoints.WATCHPOINT.equals(type)) {
+ rm.done(getTargetWatchpoint(targetBreakpoints, (String) attributes.get(MIBreakpoints.EXPRESSION),
+ (Boolean) attributes.get(MIBreakpoints.READ), (Boolean) attributes.get(MIBreakpoints.WRITE),
+ (Boolean) attributes.get(MIBreakpointDMData.IS_HARDWARE),
+ (Boolean) attributes.get(MIBreakpointDMData.IS_TEMPORARY)));
} else {
rm.done();
}
}
-
- private MIBreakpoint getTargetLineBreakpoint(
- Collection<MIBreakpoint> targetBreakpoints,
- String fileName,
- Integer lineNumber,
- String function,
- String address,
- Boolean isHardware,
- Boolean isTemporary) {
+
+ private MIBreakpoint getTargetLineBreakpoint(Collection<MIBreakpoint> targetBreakpoints, String fileName,
+ Integer lineNumber, String function, String address, Boolean isHardware, Boolean isTemporary) {
for (MIBreakpoint miBpt : targetBreakpoints) {
- if (!miBpt.isWatchpoint() && !isCatchpoint(miBpt) && !miBpt.isTracepoint() && !miBpt.isDynamicPrintf()
- && compareBreakpointAttributes(
- miBpt, fileName, lineNumber, function, address, isHardware, isTemporary)) {
+ if (!miBpt.isWatchpoint() && !isCatchpoint(miBpt) && !miBpt.isTracepoint() && !miBpt.isDynamicPrintf()
+ && compareBreakpointAttributes(miBpt, fileName, lineNumber, function, address, isHardware,
+ isTemporary)) {
return miBpt;
}
}
return null;
}
-
- private MIBreakpoint getTargetTracepoint(
- Collection<MIBreakpoint> targetBreakpoints,
- String fileName,
- Integer lineNumber,
- String function,
- String address,
- Boolean isHardware,
- Boolean isTemporary) {
+
+ private MIBreakpoint getTargetTracepoint(Collection<MIBreakpoint> targetBreakpoints, String fileName,
+ Integer lineNumber, String function, String address, Boolean isHardware, Boolean isTemporary) {
for (MIBreakpoint miBpt : targetBreakpoints) {
- if (miBpt.isTracepoint()
- && compareBreakpointAttributes(
- miBpt, fileName, lineNumber, function, address, isHardware, isTemporary)) {
+ if (miBpt.isTracepoint() && compareBreakpointAttributes(miBpt, fileName, lineNumber, function, address,
+ isHardware, isTemporary)) {
return miBpt;
}
}
return null;
}
- private MIBreakpoint getTargetDPrintf(
- Collection<MIBreakpoint> targetBreakpoints,
- String fileName,
- Integer lineNumber,
- String function,
- String address,
- Boolean isHardware,
- Boolean isTemporary) {
+ private MIBreakpoint getTargetDPrintf(Collection<MIBreakpoint> targetBreakpoints, String fileName,
+ Integer lineNumber, String function, String address, Boolean isHardware, Boolean isTemporary) {
for (MIBreakpoint miBpt : targetBreakpoints) {
- if (miBpt.isDynamicPrintf()
- && compareBreakpointAttributes(
- miBpt, fileName, lineNumber, function, address, isHardware, isTemporary)) {
- return miBpt;
+ if (miBpt.isDynamicPrintf() && compareBreakpointAttributes(miBpt, fileName, lineNumber, function, address,
+ isHardware, isTemporary)) {
+ return miBpt;
}
}
return null;
}
-
- private MIBreakpoint getTargetWatchpoint(
- Collection<MIBreakpoint> targetBreakpoints,
- String expression,
- boolean readAccess,
- boolean writeAccess,
- Boolean isHardware,
- Boolean isTemporary) {
+
+ private MIBreakpoint getTargetWatchpoint(Collection<MIBreakpoint> targetBreakpoints, String expression,
+ boolean readAccess, boolean writeAccess, Boolean isHardware, Boolean isTemporary) {
for (MIBreakpoint miBpt : targetBreakpoints) {
if (!miBpt.isWatchpoint()) {
continue;
@@ -1447,29 +1293,19 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
return null;
}
- private boolean compareBreakpointAttributes(
- MIBreakpoint miBpt,
- String fileName,
- Integer lineNumber,
- String function,
- String address,
- Boolean isHardware,
- Boolean isTemporary) {
+ private boolean compareBreakpointAttributes(MIBreakpoint miBpt, String fileName, Integer lineNumber,
+ String function, String address, Boolean isHardware, Boolean isTemporary) {
return compareBreakpointLocationAttributes(miBpt, fileName, lineNumber, function, address)
&& compareBreakpointTypeAttributes(miBpt, isHardware, isTemporary);
}
- private boolean compareBreakpointLocationAttributes(
- MIBreakpoint miBpt,
- String fileName,
- Integer lineNumber,
- String function,
- String address) {
+ private boolean compareBreakpointLocationAttributes(MIBreakpoint miBpt, String fileName, Integer lineNumber,
+ String function, String address) {
if (isFunctionBreakpoint(miBpt) && (function == null || !function.equals(getFunctionName(miBpt)))) {
return false;
}
- if (isAddressBreakpoint(miBpt)
- && (address == null || !address.equals(getPlatformAddress(miBpt.getAddress()).toHexAddressString()))) {
+ if (isAddressBreakpoint(miBpt)
+ && (address == null || !address.equals(getPlatformAddress(miBpt.getAddress()).toHexAddressString()))) {
return false;
}
if (isLineBreakpoint(miBpt)) {
@@ -1485,12 +1321,12 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
}
private boolean compareBreakpointTypeAttributes(MIBreakpoint miBpt, Boolean isHardware, Boolean isTemporary) {
- if ((isHardware == null && miBpt.isHardware())
- || (isHardware != null && isHardware.booleanValue() != miBpt.isHardware())) {
+ if ((isHardware == null && miBpt.isHardware())
+ || (isHardware != null && isHardware.booleanValue() != miBpt.isHardware())) {
return false;
}
- if ((isTemporary == null && miBpt.isTemporary())
- || (isTemporary != null && isTemporary.booleanValue() != miBpt.isTemporary())) {
+ if ((isTemporary == null && miBpt.isTemporary())
+ || (isTemporary != null && isTemporary.booleanValue() != miBpt.isTemporary())) {
return false;
}
return true;
@@ -1503,30 +1339,29 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
}
}
- private boolean isPlatformLineBreakpoint(ICLineBreakpoint plBpt, MIBreakpoint miBpt, String fileName) {
- if (plBpt instanceof ICAddressBreakpoint) {
- return isAddressBreakpoint(miBpt) ?
- isPlatformAddressBreakpoint((ICAddressBreakpoint)plBpt, miBpt) : false;
- }
- if (plBpt instanceof ICFunctionBreakpoint) {
- return isFunctionBreakpoint(miBpt) ?
- isPlatformFunctionBreakpoint((ICFunctionBreakpoint)plBpt, miBpt, fileName) : false;
- }
- try {
- if (fileName == null || plBpt.getSourceHandle() == null
- || !new File(fileName).equals(new File(plBpt.getSourceHandle()))) {
- return false;
- }
+ private boolean isPlatformLineBreakpoint(ICLineBreakpoint plBpt, MIBreakpoint miBpt, String fileName) {
+ if (plBpt instanceof ICAddressBreakpoint) {
+ return isAddressBreakpoint(miBpt) ? isPlatformAddressBreakpoint((ICAddressBreakpoint) plBpt, miBpt) : false;
+ }
+ if (plBpt instanceof ICFunctionBreakpoint) {
+ return isFunctionBreakpoint(miBpt)
+ ? isPlatformFunctionBreakpoint((ICFunctionBreakpoint) plBpt, miBpt, fileName)
+ : false;
+ }
+ try {
+ if (fileName == null || plBpt.getSourceHandle() == null
+ || !new File(fileName).equals(new File(plBpt.getSourceHandle()))) {
+ return false;
+ }
if (plBpt.getLineNumber() != getLineNumber(miBpt)) {
return false;
}
return true;
- }
- catch(CoreException e) {
+ } catch (CoreException e) {
GdbPlugin.log(e.getStatus());
}
- return false;
- }
+ return false;
+ }
private boolean isPlatformFunctionBreakpoint(ICFunctionBreakpoint plBpt, MIBreakpoint miBpt, String fileName) {
try {
@@ -1544,441 +1379,420 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
}
}
return true;
- }
- catch(CoreException e) {
+ } catch (CoreException e) {
GdbPlugin.log(e.getStatus());
}
return false;
}
- private boolean isPlatformAddressBreakpoint(ICAddressBreakpoint plBpt, MIBreakpoint miBpt) {
+ private boolean isPlatformAddressBreakpoint(ICAddressBreakpoint plBpt, MIBreakpoint miBpt) {
try {
- return (plBpt.getAddress() != null
+ return (plBpt.getAddress() != null
&& plBpt.getAddress().equals(getPlatformAddress(miBpt.getAddress()).toHexAddressString()));
- }
- catch(CoreException e) {
+ } catch (CoreException e) {
GdbPlugin.log(e.getStatus());
}
return false;
- }
+ }
- private boolean isPlatformWatchpoint(ICWatchpoint plBpt, MIBreakpoint miBpt) {
- try {
- if (plBpt.getExpression() != null && plBpt.getExpression().equals(miBpt.getExpression()) ) {
+ private boolean isPlatformWatchpoint(ICWatchpoint plBpt, MIBreakpoint miBpt) {
+ try {
+ if (plBpt.getExpression() != null && plBpt.getExpression().equals(miBpt.getExpression())) {
if (miBpt.isAccessWatchpoint()) {
return plBpt.isWriteType() && plBpt.isReadType();
- }
- else if (miBpt.isReadWatchpoint()) {
+ } else if (miBpt.isReadWatchpoint()) {
return !plBpt.isWriteType() && plBpt.isReadType();
- }
- else if (miBpt.isWriteWatchpoint()) {
+ } else if (miBpt.isWriteWatchpoint()) {
return plBpt.isWriteType() && !plBpt.isReadType();
}
}
- }
- catch(CoreException e) {
+ } catch (CoreException e) {
GdbPlugin.log(e.getStatus());
}
- return false;
- }
-
- private boolean isPlatformTracepoint(ICTracepoint plBpt, MIBreakpoint miBpt, String fileName) {
- return isPlatformLineBreakpoint(plBpt, miBpt, fileName);
- }
-
- private boolean isPlatformDynamicPrintf(ICDynamicPrintf plBpt, MIBreakpoint miBpt, String fileName) {
- return isPlatformLineBreakpoint(plBpt, miBpt, fileName);
- }
-
- /** @since 5.0 */
- public boolean isTargetBreakpointDeleted(IBreakpointsTargetDMContext context, String bpId, boolean remove) {
- Set<String> set = fDeletedTargetBreakpoints.get(context);
- if (set != null) {
- return (remove) ? set.remove(bpId) : set.contains(bpId);
- }
- return false;
- }
-
- /**
- * Returns the list of tracepoint actions generated from the given command string.
- * If the corresponding action for a command doesn't exist in TracepointActionManager
- * the new action is created and added.
- *
- * @param commands list of gdb tracepoint commands separated by TracepointActionManager.TRACEPOINT_ACTION_DELIMITER
- */
- private ITracepointAction[] getActionsFromCommands(String[] commands) {
- List<ITracepointAction> list = new ArrayList<ITracepointAction>();
- TracepointActionManager tam = TracepointActionManager.getInstance();
- WhileSteppingAction whileStepping = null;
- List<ITracepointAction> subActions = null;
- for (String command : commands) {
- // Check if an action for this command exists
- boolean found = false;
- for (ITracepointAction action :tam.getActions()) {
- if (command.equals(action.getSummary())) {
- if (whileStepping == null || subActions == null) {
- list.add(action);
- } else {
- subActions.add(action);
- }
- found = true;
- break;
- }
- }
- if (!found) {
- // Create a new action if an action for this command doesn't exists
- ITracepointAction action = null;
- if (command.startsWith(TC_COLLECT)) {
- action = createCollectAction(command.substring(TC_COLLECT.length()));
- } else if (command.startsWith(TC_TEVAL)) {
- action = createEvaluateAction(command.substring(TC_TEVAL.length()));
- } else if (command.startsWith(TC_WHILE_STEPPING)) {
- whileStepping = createWhileSteppingAction(command.substring(TC_WHILE_STEPPING.length()));
- if (whileStepping != null) {
- subActions = new ArrayList<ITracepointAction>();
- }
- }
- else if (command.equals(TC_END)) {
- if (whileStepping == null || subActions == null) {
- continue;
- }
- StringBuilder sb = new StringBuilder();
- boolean first = true;
- for (ITracepointAction a : subActions) {
- if (first) {
- first = false;
- } else {
- sb.append(',');
- }
- sb.append(a.getName());
- }
- whileStepping.setSubActionsNames(sb.toString());
- whileStepping.setSubActionsContent(sb.toString());
- action = whileStepping;
- // Search for existing action for this 'while-stepping' command
- for (ITracepointAction a :tam.getActions()) {
- if (whileStepping.getSummary().equals(a.getSummary())) {
- action = a;
- found = true;
- break;
- }
- }
- whileStepping = null;
- subActions.clear();
- subActions = null;
- }
- if (action != null) {
- if (!found) {
- TracepointActionManager.getInstance().addAction(action);
- }
- if (whileStepping == null || subActions == null) {
- list.add(action);
- }
- else {
- subActions.add(action);
- }
- }
- }
- TracepointActionManager.getInstance().saveActionData();
- }
- return list.toArray(new ITracepointAction[list.size()]);
- }
-
- private CollectAction createCollectAction(String collectStr) {
- CollectAction action = new CollectAction();
- action.setName(TracepointActionManager.getInstance().makeUniqueActionName(action.getDefaultName()));
- action.setCollectString(collectStr);
- return action;
- }
-
- private EvaluateAction createEvaluateAction(String evalStr) {
- EvaluateAction action = new EvaluateAction();
- action.setName(TracepointActionManager.getInstance().makeUniqueActionName(action.getDefaultName()));
- action.setEvalString(evalStr);
- return action;
- }
-
- private WhileSteppingAction createWhileSteppingAction(String str) {
- WhileSteppingAction action = new WhileSteppingAction();
- action.setName(TracepointActionManager.getInstance().makeUniqueActionName(action.getDefaultName()));
- try {
- action.setStepCount(Integer.parseInt(str.trim()));
+ return false;
+ }
+
+ private boolean isPlatformTracepoint(ICTracepoint plBpt, MIBreakpoint miBpt, String fileName) {
+ return isPlatformLineBreakpoint(plBpt, miBpt, fileName);
+ }
+
+ private boolean isPlatformDynamicPrintf(ICDynamicPrintf plBpt, MIBreakpoint miBpt, String fileName) {
+ return isPlatformLineBreakpoint(plBpt, miBpt, fileName);
+ }
+
+ /** @since 5.0 */
+ public boolean isTargetBreakpointDeleted(IBreakpointsTargetDMContext context, String bpId, boolean remove) {
+ Set<String> set = fDeletedTargetBreakpoints.get(context);
+ if (set != null) {
+ return (remove) ? set.remove(bpId) : set.contains(bpId);
+ }
+ return false;
+ }
+
+ /**
+ * Returns the list of tracepoint actions generated from the given command string.
+ * If the corresponding action for a command doesn't exist in TracepointActionManager
+ * the new action is created and added.
+ *
+ * @param commands list of gdb tracepoint commands separated by TracepointActionManager.TRACEPOINT_ACTION_DELIMITER
+ */
+ private ITracepointAction[] getActionsFromCommands(String[] commands) {
+ List<ITracepointAction> list = new ArrayList<ITracepointAction>();
+ TracepointActionManager tam = TracepointActionManager.getInstance();
+ WhileSteppingAction whileStepping = null;
+ List<ITracepointAction> subActions = null;
+ for (String command : commands) {
+ // Check if an action for this command exists
+ boolean found = false;
+ for (ITracepointAction action : tam.getActions()) {
+ if (command.equals(action.getSummary())) {
+ if (whileStepping == null || subActions == null) {
+ list.add(action);
+ } else {
+ subActions.add(action);
+ }
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ // Create a new action if an action for this command doesn't exists
+ ITracepointAction action = null;
+ if (command.startsWith(TC_COLLECT)) {
+ action = createCollectAction(command.substring(TC_COLLECT.length()));
+ } else if (command.startsWith(TC_TEVAL)) {
+ action = createEvaluateAction(command.substring(TC_TEVAL.length()));
+ } else if (command.startsWith(TC_WHILE_STEPPING)) {
+ whileStepping = createWhileSteppingAction(command.substring(TC_WHILE_STEPPING.length()));
+ if (whileStepping != null) {
+ subActions = new ArrayList<ITracepointAction>();
+ }
+ } else if (command.equals(TC_END)) {
+ if (whileStepping == null || subActions == null) {
+ continue;
+ }
+ StringBuilder sb = new StringBuilder();
+ boolean first = true;
+ for (ITracepointAction a : subActions) {
+ if (first) {
+ first = false;
+ } else {
+ sb.append(',');
+ }
+ sb.append(a.getName());
+ }
+ whileStepping.setSubActionsNames(sb.toString());
+ whileStepping.setSubActionsContent(sb.toString());
+ action = whileStepping;
+ // Search for existing action for this 'while-stepping' command
+ for (ITracepointAction a : tam.getActions()) {
+ if (whileStepping.getSummary().equals(a.getSummary())) {
+ action = a;
+ found = true;
+ break;
+ }
+ }
+ whileStepping = null;
+ subActions.clear();
+ subActions = null;
+ }
+ if (action != null) {
+ if (!found) {
+ TracepointActionManager.getInstance().addAction(action);
+ }
+ if (whileStepping == null || subActions == null) {
+ list.add(action);
+ } else {
+ subActions.add(action);
+ }
+ }
+ }
+ TracepointActionManager.getInstance().saveActionData();
}
- catch(NumberFormatException e) {
+ return list.toArray(new ITracepointAction[list.size()]);
+ }
+
+ private CollectAction createCollectAction(String collectStr) {
+ CollectAction action = new CollectAction();
+ action.setName(TracepointActionManager.getInstance().makeUniqueActionName(action.getDefaultName()));
+ action.setCollectString(collectStr);
+ return action;
+ }
+
+ private EvaluateAction createEvaluateAction(String evalStr) {
+ EvaluateAction action = new EvaluateAction();
+ action.setName(TracepointActionManager.getInstance().makeUniqueActionName(action.getDefaultName()));
+ action.setEvalString(evalStr);
+ return action;
+ }
+
+ private WhileSteppingAction createWhileSteppingAction(String str) {
+ WhileSteppingAction action = new WhileSteppingAction();
+ action.setName(TracepointActionManager.getInstance().makeUniqueActionName(action.getDefaultName()));
+ try {
+ action.setStepCount(Integer.parseInt(str.trim()));
+ } catch (NumberFormatException e) {
return null;
}
- return action;
- }
+ return action;
+ }
+
+ protected void getSource(IBreakpointsTargetDMContext bpTargetDMC, final String debuggerPath,
+ final DataRequestMonitor<String> rm) {
- protected void getSource(
- IBreakpointsTargetDMContext bpTargetDMC,
- final String debuggerPath,
- final DataRequestMonitor<String> rm) {
-
ISourceLookup sourceLookup = getServicesTracker().getService(ISourceLookup.class);
- if (sourceLookup == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Source lookup service is not available")); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- ISourceLookupDMContext srcDmc = DMContexts.getAncestorOfType(bpTargetDMC, ISourceLookupDMContext.class);
- if (srcDmc == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "No source lookup context")); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- if (debuggerPath == null || debuggerPath.isEmpty()) {
- rm.done();
- return;
- }
-
- sourceLookup.getSource(
- srcDmc,
- debuggerPath,
- new DataRequestMonitor<Object>(getExecutor(), rm) {
- @Override
- @ConfinedToDsfExecutor("fExecutor")
- protected void handleCompleted() {
- String fileName = null;
- if (isSuccess()) {
- if (getData() instanceof IFile) {
- fileName = ((IFile)getData()).getLocation().toOSString();
- }
- else if (getData() instanceof File) {
- fileName = ((File)getData()).getAbsolutePath();
- }
- else if (getData() instanceof ITranslationUnit) {
- IPath location = ((ITranslationUnit)getData()).getLocation();
- if (location != null) {
- fileName = location.toOSString();
- }
- }
- else if (getData() instanceof LocalFileStorage) {
- fileName = ((LocalFileStorage)getData()).getFile().getAbsolutePath();
- }
- }
- rm.setData((fileName != null && !fileName.isEmpty()) ? fileName : debuggerPath);
- rm.done();
- }
- });
- }
-
- /**
- * Return true if target breakpoint is a function breakpoint
- * @param miBpt target breakpoint
- * @return true if this is a function breakpoint
- * @since 5.3
- */
- protected boolean isFunctionBreakpoint(MIBreakpoint miBpt) {
- String origFunction = getFunctionFromOriginalLocation(miBpt.getOriginalLocation());
- if (miBpt.getFunction().isEmpty()) {
- return !origFunction.isEmpty();
- }
- String function = miBpt.getFunction();
- // For C++ the function name for "break x" is reported as "x()".
- // To compare it to the name retrieved from the original location
- // we need to remove "()".
- int index = function.indexOf('(');
- if (index > 0 && origFunction.indexOf('(') == -1) {
- return function.substring(0, index).equals(origFunction);
- }
- return function.equals(origFunction);
- }
-
- /**
- * Return true if target breakpoint is an address breakpoint
- * @param miBpt target breakpoint
- * @return true if this is an address breakpoint
- * @since 5.3
- */
- protected boolean isAddressBreakpoint(MIBreakpoint miBpt) {
- return miBpt.getOriginalLocation().startsWith("*"); //$NON-NLS-1$
- }
-
- /**
- * Return true if target breakpoint is a line breakpoint
- * @param miBpt target breakpoint
- * @return true if this is a line breakpoint
- * @since 5.3
- */
- protected boolean isLineBreakpoint(MIBreakpoint miBpt) {
- return !isFunctionBreakpoint(miBpt) && !isAddressBreakpoint(miBpt);
- }
-
- private IAddress getPlatformAddress(String miAddress) {
+ if (sourceLookup == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Source lookup service is not available")); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ ISourceLookupDMContext srcDmc = DMContexts.getAncestorOfType(bpTargetDMC, ISourceLookupDMContext.class);
+ if (srcDmc == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "No source lookup context")); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ if (debuggerPath == null || debuggerPath.isEmpty()) {
+ rm.done();
+ return;
+ }
+
+ sourceLookup.getSource(srcDmc, debuggerPath, new DataRequestMonitor<Object>(getExecutor(), rm) {
+ @Override
+ @ConfinedToDsfExecutor("fExecutor")
+ protected void handleCompleted() {
+ String fileName = null;
+ if (isSuccess()) {
+ if (getData() instanceof IFile) {
+ fileName = ((IFile) getData()).getLocation().toOSString();
+ } else if (getData() instanceof File) {
+ fileName = ((File) getData()).getAbsolutePath();
+ } else if (getData() instanceof ITranslationUnit) {
+ IPath location = ((ITranslationUnit) getData()).getLocation();
+ if (location != null) {
+ fileName = location.toOSString();
+ }
+ } else if (getData() instanceof LocalFileStorage) {
+ fileName = ((LocalFileStorage) getData()).getFile().getAbsolutePath();
+ }
+ }
+ rm.setData((fileName != null && !fileName.isEmpty()) ? fileName : debuggerPath);
+ rm.done();
+ }
+ });
+ }
+
+ /**
+ * Return true if target breakpoint is a function breakpoint
+ * @param miBpt target breakpoint
+ * @return true if this is a function breakpoint
+ * @since 5.3
+ */
+ protected boolean isFunctionBreakpoint(MIBreakpoint miBpt) {
+ String origFunction = getFunctionFromOriginalLocation(miBpt.getOriginalLocation());
+ if (miBpt.getFunction().isEmpty()) {
+ return !origFunction.isEmpty();
+ }
+ String function = miBpt.getFunction();
+ // For C++ the function name for "break x" is reported as "x()".
+ // To compare it to the name retrieved from the original location
+ // we need to remove "()".
+ int index = function.indexOf('(');
+ if (index > 0 && origFunction.indexOf('(') == -1) {
+ return function.substring(0, index).equals(origFunction);
+ }
+ return function.equals(origFunction);
+ }
+
+ /**
+ * Return true if target breakpoint is an address breakpoint
+ * @param miBpt target breakpoint
+ * @return true if this is an address breakpoint
+ * @since 5.3
+ */
+ protected boolean isAddressBreakpoint(MIBreakpoint miBpt) {
+ return miBpt.getOriginalLocation().startsWith("*"); //$NON-NLS-1$
+ }
+
+ /**
+ * Return true if target breakpoint is a line breakpoint
+ * @param miBpt target breakpoint
+ * @return true if this is a line breakpoint
+ * @since 5.3
+ */
+ protected boolean isLineBreakpoint(MIBreakpoint miBpt) {
+ return !isFunctionBreakpoint(miBpt) && !isAddressBreakpoint(miBpt);
+ }
+
+ private IAddress getPlatformAddress(String miAddress) {
int radix = 10;
if (miAddress.startsWith("0x")) { //$NON-NLS-1$
radix = 16;
miAddress = miAddress.substring(2);
}
return new Addr64(new BigInteger(miAddress, radix));
- }
-
- private boolean isBreakpointTargetTracked(IBreakpointsTargetDMContext btTargetDMC) {
- return fTrackedTargets.contains(btTargetDMC);
- }
-
- /**
- * Obtain the file name of the target breakpoint.
- *
- * @param miBpt target breakpoint
- * @return file name
- * @since 5.3
- */
- protected String getFileName(MIBreakpoint miBpt) {
- String fileName = (miBpt.getFullName() != null && !miBpt.getFullName().isEmpty()) ?
- miBpt.getFullName() : miBpt.getFile();
- if (fileName != null && !fileName.isEmpty()) {
- return fileName;
- }
- // When a breakpoint is set from the console on an invalid file both
- // 'file' and 'fullname' attributes are not available, we need to parse
- // the 'original-location' attribute to retrieve the file name.
- String origLocation = miBpt.getOriginalLocation();
- if (origLocation.isEmpty()) {
- // Shouldn't happen
- GdbPlugin.log(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Invalid 'original-location' attribute")); //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- if (origLocation.startsWith("*")) { //$NON-NLS-1$
- // Address breakpoint
- return ""; //$NON-NLS-1$
- }
+ }
+
+ private boolean isBreakpointTargetTracked(IBreakpointsTargetDMContext btTargetDMC) {
+ return fTrackedTargets.contains(btTargetDMC);
+ }
+
+ /**
+ * Obtain the file name of the target breakpoint.
+ *
+ * @param miBpt target breakpoint
+ * @return file name
+ * @since 5.3
+ */
+ protected String getFileName(MIBreakpoint miBpt) {
+ String fileName = (miBpt.getFullName() != null && !miBpt.getFullName().isEmpty()) ? miBpt.getFullName()
+ : miBpt.getFile();
+ if (fileName != null && !fileName.isEmpty()) {
+ return fileName;
+ }
+ // When a breakpoint is set from the console on an invalid file both
+ // 'file' and 'fullname' attributes are not available, we need to parse
+ // the 'original-location' attribute to retrieve the file name.
+ String origLocation = miBpt.getOriginalLocation();
+ if (origLocation.isEmpty()) {
+ // Shouldn't happen
+ GdbPlugin.log(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Invalid 'original-location' attribute")); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+ if (origLocation.startsWith("*")) { //$NON-NLS-1$
+ // Address breakpoint
+ return ""; //$NON-NLS-1$
+ }
int index = origLocation.lastIndexOf(':');
return (index > 0) ? origLocation.substring(0, index) : ""; //$NON-NLS-1$
- }
-
- /**
- * Obtain the line number of the target breakpoint.
- *
- * @param miBpt target breakpoint
- * @return line number
- * @since 5.3
- */
- protected int getLineNumber(MIBreakpoint miBpt) {
- int lineNumber = miBpt.getLine();
- if (lineNumber != -1) {
- return lineNumber;
- }
- // When a breakpoint is set from the console on an invalid file
- // the 'line' attributes is not available, we need to parse
- // the 'original-location' attribute to retrieve the line number.
- String origLocation = miBpt.getOriginalLocation();
- if (origLocation.isEmpty()) {
- // Shouldn't happen
- GdbPlugin.log(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Invalid 'original-location' attribute")); //$NON-NLS-1$
- return -1;
- }
- if (origLocation.startsWith("*")) { //$NON-NLS-1$
- // Address breakpoint
- return -1;
- }
+ }
+
+ /**
+ * Obtain the line number of the target breakpoint.
+ *
+ * @param miBpt target breakpoint
+ * @return line number
+ * @since 5.3
+ */
+ protected int getLineNumber(MIBreakpoint miBpt) {
+ int lineNumber = miBpt.getLine();
+ if (lineNumber != -1) {
+ return lineNumber;
+ }
+ // When a breakpoint is set from the console on an invalid file
+ // the 'line' attributes is not available, we need to parse
+ // the 'original-location' attribute to retrieve the line number.
+ String origLocation = miBpt.getOriginalLocation();
+ if (origLocation.isEmpty()) {
+ // Shouldn't happen
+ GdbPlugin.log(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Invalid 'original-location' attribute")); //$NON-NLS-1$
+ return -1;
+ }
+ if (origLocation.startsWith("*")) { //$NON-NLS-1$
+ // Address breakpoint
+ return -1;
+ }
int index = origLocation.lastIndexOf(':');
if (index > 0 && origLocation.length() > index + 1) {
try {
return Integer.valueOf(origLocation.substring(index + 1, origLocation.length())).intValue();
- }
- catch(NumberFormatException e) {
+ } catch (NumberFormatException e) {
// not a line breakpoint
}
}
return -1;
- }
-
- /**
- * Obtain the function name of the target breakpoint.
- *
- * @param miBpt target breakpoint
- * @return function name
- * @since 5.3
- */
- protected String getFunctionName(MIBreakpoint miBpt) {
+ }
+
+ /**
+ * Obtain the function name of the target breakpoint.
+ *
+ * @param miBpt target breakpoint
+ * @return function name
+ * @since 5.3
+ */
+ protected String getFunctionName(MIBreakpoint miBpt) {
if (miBpt.getFunction() != null && !miBpt.getFunction().isEmpty())
- return miBpt.getFunction();
- // When a function breakpoint is set from the console, the symbol associated with
- // the function may not be known to GDB. In this case the 'function' attribute is
- // not available, we need to parse the 'original-location' attribute to retrieve
- // the function name.
- return getFunctionFromOriginalLocation(miBpt.getOriginalLocation());
- }
-
- private IResource getResource(String fileName) {
+ return miBpt.getFunction();
+ // When a function breakpoint is set from the console, the symbol associated with
+ // the function may not be known to GDB. In this case the 'function' attribute is
+ // not available, we need to parse the 'original-location' attribute to retrieve
+ // the function name.
+ return getFunctionFromOriginalLocation(miBpt.getOriginalLocation());
+ }
+
+ private IResource getResource(String fileName) {
IResource resource = null;
if (fileName == null || fileName.isEmpty()) {
resource = ResourcesPlugin.getWorkspace().getRoot();
} else {
- IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocationURI(
- new File(fileName).toURI());
+ IFile[] files = ResourcesPlugin.getWorkspace().getRoot()
+ .findFilesForLocationURI(new File(fileName).toURI());
if (files.length > 0) {
resource = files[0];
- }
- else {
+ } else {
resource = ResourcesPlugin.getWorkspace().getRoot();
}
}
return resource;
- }
+ }
@DsfServiceEventHandler
- public void eventDispatched(IExitedDMEvent e) {
- if (e.getDMContext() instanceof IBreakpointsTargetDMContext) {
- // Remove breakpoint entries when a breakpoint target is removed.
- // This will happen for GDB < 7.4 where the container is the breakpoint target.
- // For GDB >= 7.4, GDB is the breakpoint target and will not be removed.
- IBreakpointsTargetDMContext bpTargetDMContext = (IBreakpointsTargetDMContext)e.getDMContext();
- Map<String, MIBreakpoint> createdBreakpoints = fCreatedTargetBreakpoints.remove(bpTargetDMContext);
- if (createdBreakpoints != null) {
- createdBreakpoints.clear();
- }
- Map<String, MIBreakpoint> modifications = fPendingModifications.remove(bpTargetDMContext);
- if (modifications != null) {
- modifications.clear();
- }
- Set<String> deletedBreakpoints = fDeletedTargetBreakpoints.remove(bpTargetDMContext);
- if (deletedBreakpoints != null) {
- deletedBreakpoints.clear();
- }
- }
- }
+ public void eventDispatched(IExitedDMEvent e) {
+ if (e.getDMContext() instanceof IBreakpointsTargetDMContext) {
+ // Remove breakpoint entries when a breakpoint target is removed.
+ // This will happen for GDB < 7.4 where the container is the breakpoint target.
+ // For GDB >= 7.4, GDB is the breakpoint target and will not be removed.
+ IBreakpointsTargetDMContext bpTargetDMContext = (IBreakpointsTargetDMContext) e.getDMContext();
+ Map<String, MIBreakpoint> createdBreakpoints = fCreatedTargetBreakpoints.remove(bpTargetDMContext);
+ if (createdBreakpoints != null) {
+ createdBreakpoints.clear();
+ }
+ Map<String, MIBreakpoint> modifications = fPendingModifications.remove(bpTargetDMContext);
+ if (modifications != null) {
+ modifications.clear();
+ }
+ Set<String> deletedBreakpoints = fDeletedTargetBreakpoints.remove(bpTargetDMContext);
+ if (deletedBreakpoints != null) {
+ deletedBreakpoints.clear();
+ }
+ }
+ }
private String getFunctionFromOriginalLocation(String origLocation) {
- if (origLocation.isEmpty()) {
- // Shouldn't happen
- GdbPlugin.log(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Invalid 'original-location' attribute")); //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- if (origLocation.startsWith("*")) { //$NON-NLS-1$
- // Address breakpoint
- return ""; //$NON-NLS-1$
- }
+ if (origLocation.isEmpty()) {
+ // Shouldn't happen
+ GdbPlugin.log(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Invalid 'original-location' attribute")); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+ if (origLocation.startsWith("*")) { //$NON-NLS-1$
+ // Address breakpoint
+ return ""; //$NON-NLS-1$
+ }
int index = origLocation.lastIndexOf(':');
String function = (index >= 0) ? origLocation.substring(index + 1) : origLocation;
- try {
- //TODO This does not work for dprintf since the output of the orginal location can look like this:
- //original-location="/home/lmckhou/runtime-TestDSF/Producer/src/Producer.cpp:100,\\"Hit line %d of /home/lmckhou/runtime-TestDSF/Producer/src/Producer.cpp\\\\n\\",100"
+ try {
+ //TODO This does not work for dprintf since the output of the orginal location can look like this:
+ //original-location="/home/lmckhou/runtime-TestDSF/Producer/src/Producer.cpp:100,\\"Hit line %d of /home/lmckhou/runtime-TestDSF/Producer/src/Producer.cpp\\\\n\\",100"
Integer.valueOf(function);
// Line breakpoint
- return ""; //$NON-NLS-1$
- }
- catch(NumberFormatException e) {
+ return ""; //$NON-NLS-1$
+ } catch (NumberFormatException e) {
// possible function breakpoint
}
- return function;
+ return function;
}
protected boolean isCatchpoint(MIBreakpoint miBpt) {
- // Since we are using the CLI 'catch' command to set catchpoints GDB will emit
+ // Since we are using the CLI 'catch' command to set catchpoints GDB will emit
// the 'breakpoint-created' notification even if the catchpoint is set from UI.
- // In case of 'catch' and 'throw' events the value of the 'type' attribute in
+ // In case of 'catch' and 'throw' events the value of the 'type' attribute in
// the breakpoint notification's data is 'breakpoint' instead of 'catchpoint'.
- // In this cases to identify the correct type we need to check the content of
+ // In this cases to identify the correct type we need to check the content of
// the 'what' attribute.
- return (miBpt.isCatchpoint() ||
- (!miBpt.isWatchpoint() &&
- (CE_EXCEPTION_CATCH.equals(miBpt.getExpression()) ||
- CE_EXCEPTION_THROW.equals(miBpt.getExpression()))));
+ return (miBpt.isCatchpoint() || (!miBpt.isWatchpoint() && (CE_EXCEPTION_CATCH.equals(miBpt.getExpression())
+ || CE_EXCEPTION_THROW.equals(miBpt.getExpression()))));
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIDisassembly.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIDisassembly.java
index c164efee49d..519ad24d0bc 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIDisassembly.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIDisassembly.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
@@ -36,229 +36,215 @@ import org.osgi.framework.BundleContext;
public class MIDisassembly extends AbstractDsfService implements IDisassembly {
- // Services
- ICommandControl fConnection;
+ // Services
+ ICommandControl fConnection;
private CommandFactory fCommandFactory;
- ///////////////////////////////////////////////////////////////////////////
- // AbstractDsfService
- ///////////////////////////////////////////////////////////////////////////
-
- /**
- * The service constructor
- *
- * @param session The debugging session
- */
- public MIDisassembly(DsfSession session) {
- super(session);
- }
-
- /**
- * @see org.eclipse.cdt.dsf.service.AbstractDsfService#initialize(org.eclipse.cdt.dsf.concurrent.RequestMonitor)
- */
- @Override
- public void initialize(final RequestMonitor rm) {
- super.initialize(new ImmediateRequestMonitor(rm) {
- @Override
- protected void handleSuccess() {
- doInitialize(rm);
- }
- });
- }
-
- private void doInitialize(final RequestMonitor rm) {
- fConnection = getServicesTracker().getService(ICommandControl.class);
+ ///////////////////////////////////////////////////////////////////////////
+ // AbstractDsfService
+ ///////////////////////////////////////////////////////////////////////////
+
+ /**
+ * The service constructor
+ *
+ * @param session The debugging session
+ */
+ public MIDisassembly(DsfSession session) {
+ super(session);
+ }
+
+ /**
+ * @see org.eclipse.cdt.dsf.service.AbstractDsfService#initialize(org.eclipse.cdt.dsf.concurrent.RequestMonitor)
+ */
+ @Override
+ public void initialize(final RequestMonitor rm) {
+ super.initialize(new ImmediateRequestMonitor(rm) {
+ @Override
+ protected void handleSuccess() {
+ doInitialize(rm);
+ }
+ });
+ }
+
+ private void doInitialize(final RequestMonitor rm) {
+ fConnection = getServicesTracker().getService(ICommandControl.class);
fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
- register(new String[] { IDisassembly.class.getName(), MIDisassembly.class.getName() },
- new Hashtable<String, String>());
- rm.done();
- }
+ register(new String[] { IDisassembly.class.getName(), MIDisassembly.class.getName() },
+ new Hashtable<String, String>());
+ rm.done();
+ }
- /**
- * @see org.eclipse.cdt.dsf.service.AbstractDsfService#shutdown(org.eclipse.cdt.dsf.concurrent.RequestMonitor)
- */
- @Override
- public void shutdown(RequestMonitor rm) {
- unregister();
+ /**
+ * @see org.eclipse.cdt.dsf.service.AbstractDsfService#shutdown(org.eclipse.cdt.dsf.concurrent.RequestMonitor)
+ */
+ @Override
+ public void shutdown(RequestMonitor rm) {
+ unregister();
super.shutdown(rm);
- }
-
- /**
- * @see org.eclipse.cdt.dsf.service.AbstractDsfService#getBundleContext()
- */
- @Override
- protected BundleContext getBundleContext() {
- return GdbPlugin.getBundleContext();
- }
-
- ///////////////////////////////////////////////////////////////////////////
- // IDisassembly
- ///////////////////////////////////////////////////////////////////////////
-
- /**
- * @see org.eclipse.cdt.dsf.debug.service.IDisassembly#getInstructions(org.eclipse.cdt.dsf.debug.service.IDisassembly.IDisassemblyDMContext, java.math.BigInteger, java.math.BigInteger, org.eclipse.cdt.dsf.concurrent.DataRequestMonitor)
- */
- @Override
- public void getInstructions(IDisassemblyDMContext context,
- BigInteger startAddress, BigInteger endAddress,
- DataRequestMonitor<IInstruction[]> drm)
- {
- getInstructions(context, startAddress, endAddress, MIDataDisassemble.DATA_DISASSEMBLE_MODE_DISASSEMBLY, drm);
- }
-
- /**
- * Helper method to allow getting disassembly instructions not in mixed mode.
- * @since 4.4
- */
- protected void getInstructions(IDisassemblyDMContext context,
- BigInteger startAddress, BigInteger endAddress, int mode,
- final DataRequestMonitor<IInstruction[]> drm)
- {
- // Checking what we don't support instead of what we do support allows
- // others to extend the 'mode' field with new values.
- assert mode != MIDataDisassemble.DATA_DISASSEMBLE_MODE_MIXED ||
- mode != MIDataDisassemble.DATA_DISASSEMBLE_MODE_MIXED_OPCODES;
-
- if (context == null) {
- drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Unknown context type", null)); //$NON-NLS-1$
- drm.done();
- return;
- }
-
- String start = (startAddress != null) ? startAddress.toString() : "$pc"; //$NON-NLS-1$
- String end = (endAddress != null) ? endAddress.toString() : start + " + 100"; //$NON-NLS-1$
- fConnection.queueCommand(fCommandFactory.createMIDataDisassemble(context, start, end, mode),
- new DataRequestMonitor<MIDataDisassembleInfo>(getExecutor(), drm) {
- @Override
- protected void handleSuccess() {
- IInstruction[] result = getData().getMIAssemblyCode();
- drm.setData(result);
- drm.done();
- }
- });
- }
+ }
- /**
- * @see org.eclipse.cdt.dsf.debug.service.IDisassembly#getInstructions(org.eclipse.cdt.dsf.debug.service.IDisassembly.IDisassemblyDMContext, java.lang.String, int, int, org.eclipse.cdt.dsf.concurrent.DataRequestMonitor)
- */
+ /**
+ * @see org.eclipse.cdt.dsf.service.AbstractDsfService#getBundleContext()
+ */
@Override
- public void getInstructions(IDisassemblyDMContext context, String filename,
- int linenum, int lines, DataRequestMonitor<IInstruction[]> drm)
- {
- getInstructions(context, filename, linenum, lines, MIDataDisassemble.DATA_DISASSEMBLE_MODE_DISASSEMBLY, drm);
- }
-
- /**
- * Helper method to allow getting disassembly instructions not in mixed mode.
- * @since 4.4
- */
- protected void getInstructions(IDisassemblyDMContext context, String filename,
- int linenum, int lines, int mode, final DataRequestMonitor<IInstruction[]> drm)
- {
- // Checking what we don't support instead of what we do support allows
- // others to extend the 'mode' field with new values.
- assert mode != MIDataDisassemble.DATA_DISASSEMBLE_MODE_MIXED ||
- mode != MIDataDisassemble.DATA_DISASSEMBLE_MODE_MIXED_OPCODES;
+ protected BundleContext getBundleContext() {
+ return GdbPlugin.getBundleContext();
+ }
- if (context == null) {
- drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Unknown context type", null)); //$NON-NLS-1$
- drm.done();
- return;
- }
+ ///////////////////////////////////////////////////////////////////////////
+ // IDisassembly
+ ///////////////////////////////////////////////////////////////////////////
- fConnection.queueCommand(fCommandFactory.createMIDataDisassemble(context, filename, linenum, lines, mode),
- new DataRequestMonitor<MIDataDisassembleInfo>(getExecutor(), drm) {
- @Override
- protected void handleSuccess() {
- IInstruction[] result = getData().getMIAssemblyCode();
- drm.setData(result);
- drm.done();
- }
- });
- }
-
- /**
- * @see org.eclipse.cdt.dsf.debug.service.IDisassembly#getMixedInstructions(org.eclipse.cdt.dsf.debug.service.IDisassembly.IDisassemblyDMContext, java.math.BigInteger, java.math.BigInteger, org.eclipse.cdt.dsf.concurrent.DataRequestMonitor)
- */
+ /**
+ * @see org.eclipse.cdt.dsf.debug.service.IDisassembly#getInstructions(org.eclipse.cdt.dsf.debug.service.IDisassembly.IDisassemblyDMContext, java.math.BigInteger, java.math.BigInteger, org.eclipse.cdt.dsf.concurrent.DataRequestMonitor)
+ */
+ @Override
+ public void getInstructions(IDisassemblyDMContext context, BigInteger startAddress, BigInteger endAddress,
+ DataRequestMonitor<IInstruction[]> drm) {
+ getInstructions(context, startAddress, endAddress, MIDataDisassemble.DATA_DISASSEMBLE_MODE_DISASSEMBLY, drm);
+ }
+
+ /**
+ * Helper method to allow getting disassembly instructions not in mixed mode.
+ * @since 4.4
+ */
+ protected void getInstructions(IDisassemblyDMContext context, BigInteger startAddress, BigInteger endAddress,
+ int mode, final DataRequestMonitor<IInstruction[]> drm) {
+ // Checking what we don't support instead of what we do support allows
+ // others to extend the 'mode' field with new values.
+ assert mode != MIDataDisassemble.DATA_DISASSEMBLE_MODE_MIXED
+ || mode != MIDataDisassemble.DATA_DISASSEMBLE_MODE_MIXED_OPCODES;
+
+ if (context == null) {
+ drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Unknown context type", null)); //$NON-NLS-1$
+ drm.done();
+ return;
+ }
+
+ String start = (startAddress != null) ? startAddress.toString() : "$pc"; //$NON-NLS-1$
+ String end = (endAddress != null) ? endAddress.toString() : start + " + 100"; //$NON-NLS-1$
+ fConnection.queueCommand(fCommandFactory.createMIDataDisassemble(context, start, end, mode),
+ new DataRequestMonitor<MIDataDisassembleInfo>(getExecutor(), drm) {
+ @Override
+ protected void handleSuccess() {
+ IInstruction[] result = getData().getMIAssemblyCode();
+ drm.setData(result);
+ drm.done();
+ }
+ });
+ }
+
+ /**
+ * @see org.eclipse.cdt.dsf.debug.service.IDisassembly#getInstructions(org.eclipse.cdt.dsf.debug.service.IDisassembly.IDisassemblyDMContext, java.lang.String, int, int, org.eclipse.cdt.dsf.concurrent.DataRequestMonitor)
+ */
@Override
- public void getMixedInstructions(IDisassemblyDMContext context,
- BigInteger startAddress, BigInteger endAddress,
- final DataRequestMonitor<IMixedInstruction[]> drm)
- {
+ public void getInstructions(IDisassemblyDMContext context, String filename, int linenum, int lines,
+ DataRequestMonitor<IInstruction[]> drm) {
+ getInstructions(context, filename, linenum, lines, MIDataDisassemble.DATA_DISASSEMBLE_MODE_DISASSEMBLY, drm);
+ }
+
+ /**
+ * Helper method to allow getting disassembly instructions not in mixed mode.
+ * @since 4.4
+ */
+ protected void getInstructions(IDisassemblyDMContext context, String filename, int linenum, int lines, int mode,
+ final DataRequestMonitor<IInstruction[]> drm) {
+ // Checking what we don't support instead of what we do support allows
+ // others to extend the 'mode' field with new values.
+ assert mode != MIDataDisassemble.DATA_DISASSEMBLE_MODE_MIXED
+ || mode != MIDataDisassemble.DATA_DISASSEMBLE_MODE_MIXED_OPCODES;
+
+ if (context == null) {
+ drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Unknown context type", null)); //$NON-NLS-1$
+ drm.done();
+ return;
+ }
+
+ fConnection.queueCommand(fCommandFactory.createMIDataDisassemble(context, filename, linenum, lines, mode),
+ new DataRequestMonitor<MIDataDisassembleInfo>(getExecutor(), drm) {
+ @Override
+ protected void handleSuccess() {
+ IInstruction[] result = getData().getMIAssemblyCode();
+ drm.setData(result);
+ drm.done();
+ }
+ });
+ }
+
+ /**
+ * @see org.eclipse.cdt.dsf.debug.service.IDisassembly#getMixedInstructions(org.eclipse.cdt.dsf.debug.service.IDisassembly.IDisassemblyDMContext, java.math.BigInteger, java.math.BigInteger, org.eclipse.cdt.dsf.concurrent.DataRequestMonitor)
+ */
+ @Override
+ public void getMixedInstructions(IDisassemblyDMContext context, BigInteger startAddress, BigInteger endAddress,
+ final DataRequestMonitor<IMixedInstruction[]> drm) {
getMixedInstructions(context, startAddress, endAddress, MIDataDisassemble.DATA_DISASSEMBLE_MODE_MIXED, drm);
- }
-
- /**
- * Helper method to allow getting disassembly instructions in mixed mode.
- * @since 4.4
- */
- protected void getMixedInstructions(IDisassemblyDMContext context,
- BigInteger startAddress, BigInteger endAddress, int mode,
- final DataRequestMonitor<IMixedInstruction[]> drm)
- {
- // Checking what we don't support instead of what we do support allows
- // others to extend the 'mode' field with new values.
- assert mode != MIDataDisassemble.DATA_DISASSEMBLE_MODE_DISASSEMBLY ||
- mode != MIDataDisassemble.DATA_DISASSEMBLE_MODE_DISASSEMBLY_OPCODES;
-
- if (context == null) {
- drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Unknown context type", null)); //$NON-NLS-1$
- drm.done();
- return;
- }
-
- String start = (startAddress != null) ? startAddress.toString() : "$pc"; //$NON-NLS-1$
- String end = (endAddress != null) ? endAddress.toString() : start + " + 100"; //$NON-NLS-1$
- fConnection.queueCommand(fCommandFactory.createMIDataDisassemble(context, start, end, mode),
- new DataRequestMonitor<MIDataDisassembleInfo>(getExecutor(), drm) {
- @Override
- protected void handleSuccess() {
- IMixedInstruction[] result = getData().getMIMixedCode();
- drm.setData(result);
- drm.done();
- }
- });
- }
-
- /**
- * @see org.eclipse.cdt.dsf.debug.service.IDisassembly#getMixedInstructions(org.eclipse.cdt.dsf.debug.service.IDisassembly.IDisassemblyDMContext, java.lang.String, int, int, org.eclipse.cdt.dsf.concurrent.DataRequestMonitor)
- */
+ }
+
+ /**
+ * Helper method to allow getting disassembly instructions in mixed mode.
+ * @since 4.4
+ */
+ protected void getMixedInstructions(IDisassemblyDMContext context, BigInteger startAddress, BigInteger endAddress,
+ int mode, final DataRequestMonitor<IMixedInstruction[]> drm) {
+ // Checking what we don't support instead of what we do support allows
+ // others to extend the 'mode' field with new values.
+ assert mode != MIDataDisassemble.DATA_DISASSEMBLE_MODE_DISASSEMBLY
+ || mode != MIDataDisassemble.DATA_DISASSEMBLE_MODE_DISASSEMBLY_OPCODES;
+
+ if (context == null) {
+ drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Unknown context type", null)); //$NON-NLS-1$
+ drm.done();
+ return;
+ }
+
+ String start = (startAddress != null) ? startAddress.toString() : "$pc"; //$NON-NLS-1$
+ String end = (endAddress != null) ? endAddress.toString() : start + " + 100"; //$NON-NLS-1$
+ fConnection.queueCommand(fCommandFactory.createMIDataDisassemble(context, start, end, mode),
+ new DataRequestMonitor<MIDataDisassembleInfo>(getExecutor(), drm) {
+ @Override
+ protected void handleSuccess() {
+ IMixedInstruction[] result = getData().getMIMixedCode();
+ drm.setData(result);
+ drm.done();
+ }
+ });
+ }
+
+ /**
+ * @see org.eclipse.cdt.dsf.debug.service.IDisassembly#getMixedInstructions(org.eclipse.cdt.dsf.debug.service.IDisassembly.IDisassemblyDMContext, java.lang.String, int, int, org.eclipse.cdt.dsf.concurrent.DataRequestMonitor)
+ */
@Override
- public void getMixedInstructions(IDisassemblyDMContext context,
- String filename, int linenum, int lines,
- final DataRequestMonitor<IMixedInstruction[]> drm)
- {
+ public void getMixedInstructions(IDisassemblyDMContext context, String filename, int linenum, int lines,
+ final DataRequestMonitor<IMixedInstruction[]> drm) {
getMixedInstructions(context, filename, linenum, lines, MIDataDisassemble.DATA_DISASSEMBLE_MODE_MIXED, drm);
- }
-
- /**
- * Helper method to allow getting disassembly instructions in mixed mode.
- * @since 4.4
- */
- protected void getMixedInstructions(IDisassemblyDMContext context,
- String filename, int linenum, int lines, int mode,
- final DataRequestMonitor<IMixedInstruction[]> drm)
- {
- // Checking what we don't support instead of what we do support allows
- // others to extend the 'mode' field with new values.
- assert mode != MIDataDisassemble.DATA_DISASSEMBLE_MODE_DISASSEMBLY ||
- mode != MIDataDisassemble.DATA_DISASSEMBLE_MODE_DISASSEMBLY_OPCODES;
-
- if (context == null) {
- drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Unknown context type", null)); //$NON-NLS-1$
- drm.done();
- return;
- }
-
- fConnection.queueCommand(fCommandFactory.createMIDataDisassemble(context, filename, linenum, lines, mode),
- new DataRequestMonitor<MIDataDisassembleInfo>(getExecutor(), drm) {
- @Override
- protected void handleSuccess() {
- IMixedInstruction[] result = getData().getMIMixedCode();
- drm.setData(result);
- drm.done();
- }
- });
- }
+ }
+
+ /**
+ * Helper method to allow getting disassembly instructions in mixed mode.
+ * @since 4.4
+ */
+ protected void getMixedInstructions(IDisassemblyDMContext context, String filename, int linenum, int lines,
+ int mode, final DataRequestMonitor<IMixedInstruction[]> drm) {
+ // Checking what we don't support instead of what we do support allows
+ // others to extend the 'mode' field with new values.
+ assert mode != MIDataDisassemble.DATA_DISASSEMBLE_MODE_DISASSEMBLY
+ || mode != MIDataDisassemble.DATA_DISASSEMBLE_MODE_DISASSEMBLY_OPCODES;
+
+ if (context == null) {
+ drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Unknown context type", null)); //$NON-NLS-1$
+ drm.done();
+ return;
+ }
+
+ fConnection.queueCommand(fCommandFactory.createMIDataDisassemble(context, filename, linenum, lines, mode),
+ new DataRequestMonitor<MIDataDisassembleInfo>(getExecutor(), drm) {
+ @Override
+ protected void handleSuccess() {
+ IMixedInstruction[] result = getData().getMIMixedCode();
+ drm.setData(result);
+ drm.done();
+ }
+ });
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIExpressions.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIExpressions.java
index fc97552e529..1a636b2ae70 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIExpressions.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIExpressions.java
@@ -7,11 +7,11 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
- * Ericsson - Modified for handling of multiple execution contexts
- * Axel Mueller - Bug 306555 - Add support for cast to type / view as array (IExpressions2)
+ * Ericsson - Modified for handling of multiple execution contexts
+ * Axel Mueller - Bug 306555 - Add support for cast to type / view as array (IExpressions2)
* Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121)
* Marc Khouzam (Ericsson) - Added support for expression aliases for return values of functions (bug 341731)
* Abeer Bagul (Tensilica) - Extra partition created for arrays of length 20000 or greater (Bug 443687)
@@ -87,53 +87,49 @@ import org.osgi.framework.BundleContext;
/**
* This class implements a debugger expression evaluator as a DSF service. The
* primary interface that clients of this class should use is IExpressions.
- *
+ *
* This class used to be name ExpressionService in the 1.1 release.
- *
+ *
* @since 2.0
*/
public class MIExpressions extends AbstractDsfService implements IMIExpressions, ICachingService {
private static final int PARTITION_LENGTH = 100;
- /**
- * A format that gives more details about an expression and supports pretty-printing
- * provided by the backend.
- *
- * @since 3.0
- */
- public static final String DETAILS_FORMAT = "Details"; //$NON-NLS-1$
-
- /* The order given here is the order that will be used by DSF in the Details Pane */
- private static final String[] FORMATS_SUPPORTED = new String[] {
- DETAILS_FORMAT,
- IFormattedValues.NATURAL_FORMAT,
- IFormattedValues.DECIMAL_FORMAT,
- IFormattedValues.HEX_FORMAT,
- IFormattedValues.BINARY_FORMAT,
+ /**
+ * A format that gives more details about an expression and supports pretty-printing
+ * provided by the backend.
+ *
+ * @since 3.0
+ */
+ public static final String DETAILS_FORMAT = "Details"; //$NON-NLS-1$
+
+ /* The order given here is the order that will be used by DSF in the Details Pane */
+ private static final String[] FORMATS_SUPPORTED = new String[] { DETAILS_FORMAT, IFormattedValues.NATURAL_FORMAT,
+ IFormattedValues.DECIMAL_FORMAT, IFormattedValues.HEX_FORMAT, IFormattedValues.BINARY_FORMAT,
IFormattedValues.OCTAL_FORMAT };
-
+
/**
* This class represents the two expressions that characterize an Expression Context.
*/
public static class ExpressionInfo {
- private final String fullExpression;
- private final String relativeExpression;
- private boolean isDynamic = false;
- private ExpressionInfo parent;
- private int indexInParent = -1;
+ private final String fullExpression;
+ private final String relativeExpression;
+ private boolean isDynamic = false;
+ private ExpressionInfo parent;
+ private int indexInParent = -1;
private int childCountLimit = IMIExpressions.CHILD_COUNT_LIMIT_UNSPECIFIED;
- public ExpressionInfo(String full, String relative) {
- fullExpression = full;
- relativeExpression = relative;
- }
+ public ExpressionInfo(String full, String relative) {
+ fullExpression = full;
+ relativeExpression = relative;
+ }
- /**
- * @since 4.0
- */
- public ExpressionInfo(String full, String relative, boolean isDynamic,
- ExpressionInfo parent, int indexInParent) {
+ /**
+ * @since 4.0
+ */
+ public ExpressionInfo(String full, String relative, boolean isDynamic, ExpressionInfo parent,
+ int indexInParent) {
fullExpression = full;
relativeExpression = relative;
this.isDynamic = isDynamic;
@@ -141,36 +137,41 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
this.indexInParent = indexInParent;
}
- public String getFullExpr() { return fullExpression; }
- public String getRelExpr() { return relativeExpression; }
-
- @Override
- public boolean equals(Object other) {
- if (other instanceof ExpressionInfo) {
- if (fullExpression == null ? ((ExpressionInfo) other).fullExpression == null :
- fullExpression.equals(((ExpressionInfo) other).fullExpression)) {
- if (relativeExpression == null ? ((ExpressionInfo) other).relativeExpression == null :
- relativeExpression.equals(((ExpressionInfo) other).relativeExpression)) {
- // The other members don't play any role for equality.
- return true;
- }
- }
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return (fullExpression == null ? 0 : fullExpression.hashCode()) ^
- (relativeExpression == null ? 0 : relativeExpression.hashCode());
- // The other members don't play any role for equality.
- }
-
- @Override
- public String toString() {
- return "[" + fullExpression +", " + relativeExpression + ", isDynamic=" + isDynamic + "]"; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$
- }
-
+ public String getFullExpr() {
+ return fullExpression;
+ }
+
+ public String getRelExpr() {
+ return relativeExpression;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other instanceof ExpressionInfo) {
+ if (fullExpression == null ? ((ExpressionInfo) other).fullExpression == null
+ : fullExpression.equals(((ExpressionInfo) other).fullExpression)) {
+ if (relativeExpression == null ? ((ExpressionInfo) other).relativeExpression == null
+ : relativeExpression.equals(((ExpressionInfo) other).relativeExpression)) {
+ // The other members don't play any role for equality.
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return (fullExpression == null ? 0 : fullExpression.hashCode())
+ ^ (relativeExpression == null ? 0 : relativeExpression.hashCode());
+ // The other members don't play any role for equality.
+ }
+
+ @Override
+ public String toString() {
+ return "[" + fullExpression + ", " + relativeExpression + ", isDynamic=" + isDynamic + "]"; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$
+ }
+
/**
* @return The parent expression info, if existing.
* @since 4.0
@@ -187,7 +188,7 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
public int getIndexInParentExpression() {
return indexInParent;
}
-
+
/**
* @return Whether the corresponding variable object is dynamic,
* i.e. it's value and children are provided by a pretty printer.
@@ -196,7 +197,7 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
public boolean isDynamic() {
return isDynamic;
}
-
+
/**
* @return Whether the expression info has any ancestor that is dynamic.
* @since 4.0
@@ -207,7 +208,7 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
return true;
}
}
-
+
return false;
}
@@ -220,7 +221,7 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
public void setDynamic(boolean isDynamic) {
this.isDynamic = isDynamic;
}
-
+
/**
* @param parent The new parent expression info.
* @since 4.0
@@ -228,7 +229,7 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
public void setParent(ExpressionInfo parent) {
this.parent = parent;
}
-
+
/**
* @param index The index in the children array of the parent.
* @since 4.0
@@ -253,7 +254,7 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
public void setChildCountLimit(int newLimit) {
this.childCountLimit = newLimit;
}
-
+
/**
* @return if this expression is part of the memory space or not.
* If it not part of the memory space, it won't have an address.
@@ -264,160 +265,160 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
// are not part of memory. We care about the top-most parent
// as it is the only one that can be a register or convenience var.
if (getParent() == null) {
- if (getRelExpr().startsWith("$")) { //$NON-NLS-1$
+ if (getRelExpr().startsWith("$")) { //$NON-NLS-1$
return false;
}
return true;
}
-
+
return getParent().inMemory();
}
}
-
- /**
- * This class represents an expression.
- * @noextend This class is not intended to be subclassed by clients.
- * @since 4.3
- */
- public static class MIExpressionDMC extends AbstractDMContext implements IExpressionDMContext {
- /**
- * This field holds an expression to be evaluated.
- */
- private ExpressionInfo exprInfo;
-
- /**
- * ExpressionDMC Constructor for expression to be evaluated in context of
- * a stack frame.
- *
- * @param sessionId
- * The session ID in which this context is created.
- * @param expression
- * The expression to be described by this ExpressionDMC
- * @param relExpr
- * The relative expression if this expression was created as a child
- * @param frameCtx
- * The parent stack frame context for this ExpressionDMC.
- */
- public MIExpressionDMC(String sessionId, String expression, String relExpr, IFrameDMContext frameCtx) {
- this(sessionId, expression, relExpr, (IDMContext)frameCtx);
- }
-
- /**
- * ExpressionDMC Constructor for expression to be evaluated in context of
- * an thread.
- *
- * @param sessionId
- * The session ID in which this context is created.
- * @param expression
- * The expression to be described by this ExpressionDMC
- * @param relExpr
- * The relative expression if this expression was created as a child
- * @param execCtx
- * The parent thread context for this ExpressionDMC.
- */
- public MIExpressionDMC(String sessionId, String expression, String relExpr, IMIExecutionDMContext execCtx) {
- this(sessionId, expression, relExpr, (IDMContext)execCtx);
- }
-
- /**
- * ExpressionDMC Constructor for expression to be evaluated in context of
- * a memory space.
- *
- * @param sessionId
- * The session ID in which this context is created.
- * @param expression
- * The expression to be described by this ExpressionDMC
- * @param relExpr
- * The relative expression if this expression was created as a child
- * @param memoryCtx
- * The parent memory space context for this ExpressionDMC.
- */
- public MIExpressionDMC(String sessionId, String expression, String relExpr, IMemoryDMContext memoryCtx) {
- this(sessionId, expression, relExpr, (IDMContext)memoryCtx);
- }
-
- private MIExpressionDMC(String sessionId, String expr, String relExpr, IDMContext parent) {
- this(sessionId, new ExpressionInfo(expr, relExpr), parent);
- }
+
+ /**
+ * This class represents an expression.
+ * @noextend This class is not intended to be subclassed by clients.
+ * @since 4.3
+ */
+ public static class MIExpressionDMC extends AbstractDMContext implements IExpressionDMContext {
+ /**
+ * This field holds an expression to be evaluated.
+ */
+ private ExpressionInfo exprInfo;
+
+ /**
+ * ExpressionDMC Constructor for expression to be evaluated in context of
+ * a stack frame.
+ *
+ * @param sessionId
+ * The session ID in which this context is created.
+ * @param expression
+ * The expression to be described by this ExpressionDMC
+ * @param relExpr
+ * The relative expression if this expression was created as a child
+ * @param frameCtx
+ * The parent stack frame context for this ExpressionDMC.
+ */
+ public MIExpressionDMC(String sessionId, String expression, String relExpr, IFrameDMContext frameCtx) {
+ this(sessionId, expression, relExpr, (IDMContext) frameCtx);
+ }
+
+ /**
+ * ExpressionDMC Constructor for expression to be evaluated in context of
+ * an thread.
+ *
+ * @param sessionId
+ * The session ID in which this context is created.
+ * @param expression
+ * The expression to be described by this ExpressionDMC
+ * @param relExpr
+ * The relative expression if this expression was created as a child
+ * @param execCtx
+ * The parent thread context for this ExpressionDMC.
+ */
+ public MIExpressionDMC(String sessionId, String expression, String relExpr, IMIExecutionDMContext execCtx) {
+ this(sessionId, expression, relExpr, (IDMContext) execCtx);
+ }
+
+ /**
+ * ExpressionDMC Constructor for expression to be evaluated in context of
+ * a memory space.
+ *
+ * @param sessionId
+ * The session ID in which this context is created.
+ * @param expression
+ * The expression to be described by this ExpressionDMC
+ * @param relExpr
+ * The relative expression if this expression was created as a child
+ * @param memoryCtx
+ * The parent memory space context for this ExpressionDMC.
+ */
+ public MIExpressionDMC(String sessionId, String expression, String relExpr, IMemoryDMContext memoryCtx) {
+ this(sessionId, expression, relExpr, (IDMContext) memoryCtx);
+ }
+
+ private MIExpressionDMC(String sessionId, String expr, String relExpr, IDMContext parent) {
+ this(sessionId, new ExpressionInfo(expr, relExpr), parent);
+ }
/**
* ExpressionDMC Constructor for expression to be evaluated in context
* of a stack frame.
- *
+ *
* @param sessionId
* The session ID in which this context is created.
* @param info
* The expression info that this expression is to use.
* @param frameCtx
* The parent stack frame context for this ExpressionDMC.
- *
+ *
* @since 4.0
*/
- public MIExpressionDMC(String sessionId, ExpressionInfo info, IFrameDMContext frameCtx) {
- this(sessionId, info, (IDMContext)frameCtx);
- }
+ public MIExpressionDMC(String sessionId, ExpressionInfo info, IFrameDMContext frameCtx) {
+ this(sessionId, info, (IDMContext) frameCtx);
+ }
- /**
+ /**
* @since 4.3
*/
- public MIExpressionDMC(String sessionId, ExpressionInfo info, IDMContext parent) {
- super(sessionId, new IDMContext[] { parent });
- exprInfo = info;
- }
-
- /**
- * @return True if the two objects are equal, false otherwise.
- */
- @Override
- public boolean equals(Object other) {
- return super.baseEquals(other) && exprInfo.equals(((MIExpressionDMC)other).exprInfo);
- }
-
- /**
- *
- * @return The hash code of this ExpressionDMC object.
- */
- @Override
- public int hashCode() {
- return super.baseHashCode() + exprInfo.hashCode();
- }
-
- /**
- *
- * @return A string representation of this ExpressionDMC (including the
- * expression to which it is bound).
- */
- @Override
- public String toString() {
- return baseToString() + ".expr" + exprInfo.toString(); //$NON-NLS-1$
- }
-
- /**
- * @return The full expression string represented by this ExpressionDMC
- */
- @Override
- public String getExpression() {
- return exprInfo.getFullExpr();
- }
-
- /**
- * @return The relative expression string represented by this ExpressionDMC
- */
- public String getRelativeExpression() {
- return exprInfo.getRelExpr();
- }
-
- /**
- * @return Get the expression info for this context.
- * @since 4.0
- */
- public ExpressionInfo getExpressionInfo() {
- return exprInfo;
- }
+ public MIExpressionDMC(String sessionId, ExpressionInfo info, IDMContext parent) {
+ super(sessionId, new IDMContext[] { parent });
+ exprInfo = info;
+ }
+
+ /**
+ * @return True if the two objects are equal, false otherwise.
+ */
+ @Override
+ public boolean equals(Object other) {
+ return super.baseEquals(other) && exprInfo.equals(((MIExpressionDMC) other).exprInfo);
+ }
+
+ /**
+ *
+ * @return The hash code of this ExpressionDMC object.
+ */
+ @Override
+ public int hashCode() {
+ return super.baseHashCode() + exprInfo.hashCode();
+ }
+
+ /**
+ *
+ * @return A string representation of this ExpressionDMC (including the
+ * expression to which it is bound).
+ */
+ @Override
+ public String toString() {
+ return baseToString() + ".expr" + exprInfo.toString(); //$NON-NLS-1$
+ }
+
+ /**
+ * @return The full expression string represented by this ExpressionDMC
+ */
+ @Override
+ public String getExpression() {
+ return exprInfo.getFullExpr();
+ }
+
+ /**
+ * @return The relative expression string represented by this ExpressionDMC
+ */
+ public String getRelativeExpression() {
+ return exprInfo.getRelExpr();
+ }
+
+ /**
+ * @return Get the expression info for this context.
+ * @since 4.0
+ */
+ public ExpressionInfo getExpressionInfo() {
+ return exprInfo;
+ }
/**
* @param info
- *
+ *
* @since 4.0
*/
public void setExpressionInfo(ExpressionInfo info) {
@@ -426,120 +427,112 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
this.exprInfo = info;
}
- }
-
- protected static class InvalidContextExpressionDMC extends AbstractDMContext
- implements IExpressionDMContext
- {
- private final String expression;
-
- public InvalidContextExpressionDMC(String sessionId, String expr, IDMContext parent) {
- super(sessionId, new IDMContext[] { parent });
- expression = expr;
- }
-
- @Override
- public boolean equals(Object other) {
- return super.baseEquals(other) &&
- (expression == null ? ((InvalidContextExpressionDMC) other).getExpression() == null : expression.equals(((InvalidContextExpressionDMC) other).getExpression()));
- }
-
- @Override
- public int hashCode() {
- return expression == null ? super.baseHashCode() : super.baseHashCode() ^ expression.hashCode();
- }
-
- @Override
- public String toString() {
- return baseToString() + ".invalid_expr[" + expression + "]"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- @Override
- public String getExpression() {
- return expression;
- }
- }
-
- /**
+ }
+
+ protected static class InvalidContextExpressionDMC extends AbstractDMContext implements IExpressionDMContext {
+ private final String expression;
+
+ public InvalidContextExpressionDMC(String sessionId, String expr, IDMContext parent) {
+ super(sessionId, new IDMContext[] { parent });
+ expression = expr;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ return super.baseEquals(other)
+ && (expression == null ? ((InvalidContextExpressionDMC) other).getExpression() == null
+ : expression.equals(((InvalidContextExpressionDMC) other).getExpression()));
+ }
+
+ @Override
+ public int hashCode() {
+ return expression == null ? super.baseHashCode() : super.baseHashCode() ^ expression.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return baseToString() + ".invalid_expr[" + expression + "]"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ @Override
+ public String getExpression() {
+ return expression;
+ }
+ }
+
+ /**
* @since 4.1
*/
- protected static class IndexedPartitionDMC extends MIExpressionDMC implements IIndexedPartitionDMContext {
+ protected static class IndexedPartitionDMC extends MIExpressionDMC implements IIndexedPartitionDMContext {
- final private MIExpressionDMC fParentExpression;
+ final private MIExpressionDMC fParentExpression;
private final int fIndex;
- private final int fLength;
-
- /**
- * @deprecated This method does not keep track of casted expressions.
- * It has been replaced by the constructor that takes an MIExpressionDMC
- * as a parameter.
- */
- @Deprecated
- public IndexedPartitionDMC(
- String sessionId,
- ExpressionInfo parentInfo,
- IFrameDMContext frameCtx,
- int index,
+ private final int fLength;
+
+ /**
+ * @deprecated This method does not keep track of casted expressions.
+ * It has been replaced by the constructor that takes an MIExpressionDMC
+ * as a parameter.
+ */
+ @Deprecated
+ public IndexedPartitionDMC(String sessionId, ExpressionInfo parentInfo, IFrameDMContext frameCtx, int index,
int length) {
- this(new MIExpressionDMC(sessionId, parentInfo, frameCtx), frameCtx, index, length);
+ this(new MIExpressionDMC(sessionId, parentInfo, frameCtx), frameCtx, index, length);
}
- /**
+ /**
* @since 4.2
*/
- public IndexedPartitionDMC(
- MIExpressionDMC parentExpr,
- int index,
- int length) {
- this(parentExpr, getParentDmc(parentExpr), index, length);
- }
- /**
- * @param parentExpr The expression of the array. This can be a casted expression.
- * This is not the parent that will be used in the context hierarchy, as we chose
- * not to stack up partitions.
- * @param parentDmc The frame or thread context that will be used as a parent in the context hierarchy.
- */
- private IndexedPartitionDMC(
- MIExpressionDMC parentExpr,
- IDMContext parentDmc,
- int index,
- int length) {
- super(parentExpr.getSessionId(), createExpressionInfo(parentExpr.getExpressionInfo(), index, length), parentDmc);
+ public IndexedPartitionDMC(MIExpressionDMC parentExpr, int index, int length) {
+ this(parentExpr, getParentDmc(parentExpr), index, length);
+ }
+
+ /**
+ * @param parentExpr The expression of the array. This can be a casted expression.
+ * This is not the parent that will be used in the context hierarchy, as we chose
+ * not to stack up partitions.
+ * @param parentDmc The frame or thread context that will be used as a parent in the context hierarchy.
+ */
+ private IndexedPartitionDMC(MIExpressionDMC parentExpr, IDMContext parentDmc, int index, int length) {
+ super(parentExpr.getSessionId(), createExpressionInfo(parentExpr.getExpressionInfo(), index, length),
+ parentDmc);
fIndex = index;
fLength = length;
fParentExpression = parentExpr;
}
- /**
- * Find the frame context that will be the parent of this partition in the context hierarchy.
- * Not to be confused with the original parent array that contains the partition. That parent
- * can be obtained using getParentExpressionContext()
- */
- private static IDMContext getParentDmc(MIExpressionDMC parentExpr) {
- IFrameDMContext frameDmc = DMContexts.getAncestorOfType(parentExpr, IFrameDMContext.class);
- if (frameDmc != null) {
- return frameDmc;
- }
-
- IMIExecutionDMContext execCtx = DMContexts.getAncestorOfType(parentExpr, IMIExecutionDMContext.class);
- if (execCtx != null) {
- // If we have a thread context but not a frame context, we give the user
- // the expression as per the top-most frame of the specified thread.
- // To do this, we create our own frame context.
- DsfServicesTracker tracker = new DsfServicesTracker(GdbPlugin.getBundleContext(), parentExpr.getSessionId());
- MIStack stackService = tracker.getService(MIStack.class);
- tracker.dispose();
-
- if (stackService != null) {
- return stackService.createFrameDMContext(execCtx, 0);
- }
- }
-
- return parentExpr;
- }
- public ExpressionInfo getParentInfo() {
- return fParentExpression.getExpressionInfo();
- }
+ /**
+ * Find the frame context that will be the parent of this partition in the context hierarchy.
+ * Not to be confused with the original parent array that contains the partition. That parent
+ * can be obtained using getParentExpressionContext()
+ */
+ private static IDMContext getParentDmc(MIExpressionDMC parentExpr) {
+ IFrameDMContext frameDmc = DMContexts.getAncestorOfType(parentExpr, IFrameDMContext.class);
+ if (frameDmc != null) {
+ return frameDmc;
+ }
+
+ IMIExecutionDMContext execCtx = DMContexts.getAncestorOfType(parentExpr, IMIExecutionDMContext.class);
+ if (execCtx != null) {
+ // If we have a thread context but not a frame context, we give the user
+ // the expression as per the top-most frame of the specified thread.
+ // To do this, we create our own frame context.
+ DsfServicesTracker tracker = new DsfServicesTracker(GdbPlugin.getBundleContext(),
+ parentExpr.getSessionId());
+ MIStack stackService = tracker.getService(MIStack.class);
+ tracker.dispose();
+
+ if (stackService != null) {
+ return stackService.createFrameDMContext(execCtx, 0);
+ }
+ }
+
+ return parentExpr;
+ }
+
+ public ExpressionInfo getParentInfo() {
+ return fParentExpression.getExpressionInfo();
+ }
/* (non-Javadoc)
* @see org.eclipse.cdt.dsf.debug.service.IExpressions4.IIndexedPartitionDMContext#getParentExpression()
@@ -557,7 +550,7 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
public MIExpressionDMC getParentExpressionContext() {
return fParentExpression;
}
-
+
@Override
public int getIndex() {
return fIndex;
@@ -568,59 +561,56 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
return fLength;
}
- @Override
- public boolean equals(Object other) {
- return super.baseEquals(other) &&
- ((IndexedPartitionDMC) other).getParentExpressionContext().equals(getParentExpressionContext()) &&
- ((IndexedPartitionDMC) other).getIndex() == getIndex() &&
- ((IndexedPartitionDMC) other).getLength() == getLength();
- }
-
- @Override
- public int hashCode() {
- return super.baseHashCode() + 17*getIndex() + 31*getLength();
- }
-
- @Override
- public String toString() {
- return String.format( "%s.expr[%s][%d-%d]", baseToString(), getParentExpression(), getIndex(), getIndex() + getLength() - 1); //$NON-NLS-1$
- }
-
- private static ExpressionInfo createExpressionInfo(ExpressionInfo parentInfo, int index, int length) {
- String expression = String.format(
- "*((%s)+%d)@%d", //$NON-NLS-1$
- parentInfo.getFullExpr(),
- Integer.valueOf(index),
- Integer.valueOf(length));
- return new ExpressionInfo(expression, expression);
- }
- }
-
-
+ @Override
+ public boolean equals(Object other) {
+ return super.baseEquals(other)
+ && ((IndexedPartitionDMC) other).getParentExpressionContext().equals(getParentExpressionContext())
+ && ((IndexedPartitionDMC) other).getIndex() == getIndex()
+ && ((IndexedPartitionDMC) other).getLength() == getLength();
+ }
+
+ @Override
+ public int hashCode() {
+ return super.baseHashCode() + 17 * getIndex() + 31 * getLength();
+ }
+
+ @Override
+ public String toString() {
+ return String.format("%s.expr[%s][%d-%d]", baseToString(), getParentExpression(), getIndex(), //$NON-NLS-1$
+ getIndex() + getLength() - 1);
+ }
+
+ private static ExpressionInfo createExpressionInfo(ExpressionInfo parentInfo, int index, int length) {
+ String expression = String.format("*((%s)+%d)@%d", //$NON-NLS-1$
+ parentInfo.getFullExpr(), Integer.valueOf(index), Integer.valueOf(length));
+ return new ExpressionInfo(expression, expression);
+ }
+ }
+
/**
* Contains the address of an expression as well as the size of its type.
*/
- protected static class ExpressionDMAddress implements IExpressionDMAddress {
- IAddress fAddr;
- int fSize;
- String fMemSpace = ""; //$NON-NLS-1$
-
- public ExpressionDMAddress(IAddress addr, int size) {
- fAddr = addr;
- fSize = size;
- }
-
- public ExpressionDMAddress(String addrStr, int size) {
- fSize = size;
- // We must count the "0x" and that
- // is why we compare with 10 characters
- // instead of 8
- if (addrStr.length() <= 10) {
- fAddr = new Addr32(addrStr);
- } else {
- fAddr = new Addr64(addrStr);
- }
- }
+ protected static class ExpressionDMAddress implements IExpressionDMAddress {
+ IAddress fAddr;
+ int fSize;
+ String fMemSpace = ""; //$NON-NLS-1$
+
+ public ExpressionDMAddress(IAddress addr, int size) {
+ fAddr = addr;
+ fSize = size;
+ }
+
+ public ExpressionDMAddress(String addrStr, int size) {
+ fSize = size;
+ // We must count the "0x" and that
+ // is why we compare with 10 characters
+ // instead of 8
+ if (addrStr.length() <= 10) {
+ fAddr = new Addr32(addrStr);
+ } else {
+ fAddr = new Addr64(addrStr);
+ }
+ }
/**
* @since 5.0
@@ -630,10 +620,15 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
fMemSpace = memSpace;
}
- @Override
- public IAddress getAddress() { return fAddr; }
- @Override
- public int getSize() { return fSize; }
+ @Override
+ public IAddress getAddress() {
+ return fAddr;
+ }
+
+ @Override
+ public int getSize() {
+ return fSize;
+ }
/**
* @since 5.0
@@ -642,13 +637,15 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
public String getMemorySpaceID() {
return fMemSpace;
}
-
+
@Override
public boolean equals(Object other) {
if (other instanceof ExpressionDMAddress) {
ExpressionDMAddress otherAddr = (ExpressionDMAddress) other;
- boolean sameAddr = fAddr == null ? otherAddr.getAddress() == null : fAddr.equals(otherAddr.getAddress());
- boolean sameMemSpace = fMemSpace == null ? otherAddr.getMemorySpaceID() == null : fMemSpace.equals(otherAddr.getMemorySpaceID());
+ boolean sameAddr = fAddr == null ? otherAddr.getAddress() == null
+ : fAddr.equals(otherAddr.getAddress());
+ boolean sameMemSpace = fMemSpace == null ? otherAddr.getMemorySpaceID() == null
+ : fMemSpace.equals(otherAddr.getMemorySpaceID());
return (fSize == otherAddr.getSize()) && sameAddr && sameMemSpace;
}
return false;
@@ -656,38 +653,38 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
@Override
public int hashCode() {
- return (fAddr == null ? 0 :fAddr.hashCode()) + fSize;
+ return (fAddr == null ? 0 : fAddr.hashCode()) + fSize;
}
@Override
public String toString() {
return (fAddr == null ? "null" : "(" + fAddr.toHexAddressString()) + ", " + fSize + ")"; //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
}
- }
-
- /**
- * If an expressions doesn't have an address, or it cannot be determined,
- * use this class.
- * @since 4.0
- */
- protected class InvalidDMAddress implements IExpressionDMLocation {
+ }
+
+ /**
+ * If an expressions doesn't have an address, or it cannot be determined,
+ * use this class.
+ * @since 4.0
+ */
+ protected class InvalidDMAddress implements IExpressionDMLocation {
- @Override
+ @Override
public IAddress getAddress() {
return IExpressions.IExpressionDMLocation.INVALID_ADDRESS;
}
- @Override
+ @Override
public int getSize() {
return 0;
}
- @Override
+ @Override
public String getLocation() {
return ""; //$NON-NLS-1$
}
- }
-
+ }
+
/**
* This class represents the static data referenced by an instance of ExpressionDMC,
* such as its type and number of children; it does not contain the value or format
@@ -699,7 +696,7 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
// which refers to the full name, including parent structure.
private final String relativeExpression;
private final String exprType;
-
+
/**
* A hint at the number of children.
* In the case of C++ complex structures, this number will not be the
@@ -709,7 +706,7 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
* has children at all.
*/
private final int numChildrenHint;
-
+
private final boolean editable;
private final BasicType fBasicType;
@@ -717,42 +714,42 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
* ExpressionDMData constructor.
*/
public ExpressionDMData(String expr, String type, int num, boolean edit) {
- this (expr, type, num, edit, null);
+ this(expr, type, num, edit, null);
}
/**
- * ExpressionDMData constructor.
+ * ExpressionDMData constructor.
* @since 3.0
- */
- public ExpressionDMData(String expr, String type, int num, boolean edit, BasicType basicType) {
- relativeExpression = expr;
- exprType = type;
- numChildrenHint = num;
- editable = edit;
- fBasicType = basicType;
- }
-
- @Override
+ */
+ public ExpressionDMData(String expr, String type, int num, boolean edit, BasicType basicType) {
+ relativeExpression = expr;
+ exprType = type;
+ numChildrenHint = num;
+ editable = edit;
+ fBasicType = basicType;
+ }
+
+ @Override
public BasicType getBasicType() {
- return fBasicType;
+ return fBasicType;
}
-
- @Override
+
+ @Override
public String getEncoding() {
return null;
}
- @Override
+ @Override
public Map<String, Integer> getEnumerations() {
return new HashMap<String, Integer>();
}
- @Override
+ @Override
public String getName() {
return relativeExpression;
}
- @Override
+ @Override
public IRegisterDMContext getRegister() {
return null;
}
@@ -778,48 +775,49 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
* actual number of children. This is because GDB considers
* 'private/protected/public' as an actual level of children, but
* we do not.
- *
+ *
* This method can be used reliably to know if the expression
* does have children or not. However, for this particular use,
* the new {@link IExpressionDMDataExtension#hasChildren()} method should be used instead.
- *
+ *
* To get the correct number of children of an expression, a call
* to {@link IExpressions#getSubExpressionCount} should be used.
- *
+ *
* @deprecated
*/
@Deprecated
public int getNumChildren() {
- return numChildrenHint;
+ return numChildrenHint;
}
-
+
public boolean isEditable() {
return editable;
}
/**
- * @since 4.0
- */
+ * @since 4.0
+ */
@Override
public boolean hasChildren() {
- return numChildrenHint > 0;
+ return numChildrenHint > 0;
}
@Override
public boolean equals(Object other) {
if (other instanceof ExpressionDMData) {
ExpressionDMData otherData = (ExpressionDMData) other;
- return (numChildrenHint == otherData.numChildrenHint) &&
- (getTypeName() == null ? otherData.getTypeName() == null : getTypeName().equals(otherData.getTypeName())) &&
- (getName() == null ? otherData.getName() == null : getName().equals(otherData.getName()));
+ return (numChildrenHint == otherData.numChildrenHint)
+ && (getTypeName() == null ? otherData.getTypeName() == null
+ : getTypeName().equals(otherData.getTypeName()))
+ && (getName() == null ? otherData.getName() == null : getName().equals(otherData.getName()));
}
return false;
}
@Override
public int hashCode() {
- return relativeExpression == null ? 0 : relativeExpression.hashCode() +
- exprType == null ? 0 : exprType.hashCode() + numChildrenHint;
+ return relativeExpression == null ? 0
+ : relativeExpression.hashCode() + exprType == null ? 0 : exprType.hashCode() + numChildrenHint;
}
@Override
@@ -830,36 +828,36 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
/**
* Event generated every time an expression is changed by the ExpressionService.
- *
+ *
* A client wishing to receive such events has to register as a service
* event listener and implement the corresponding eventDispatched method.
- *
+ *
* E.g.:
*
* getSession().addServiceEventListener(listenerObject, null);
- *
+ *
* @DsfServiceEventHandler
* public void eventDispatched(ExpressionChangedEvent e) {
* IExpressionDMContext context = e.getDMContext();
* // do something...
* }
*/
- protected static class ExpressionChangedEvent extends AbstractDMEvent<IExpressionDMContext>
- implements IExpressionChangedDMEvent {
-
- public ExpressionChangedEvent(IExpressionDMContext context) {
- super(context);
- }
- }
-
- /**
- * Keeps track of aliases for return values of methods.
- */
+ protected static class ExpressionChangedEvent extends AbstractDMEvent<IExpressionDMContext>
+ implements IExpressionChangedDMEvent {
+
+ public ExpressionChangedEvent(IExpressionDMContext context) {
+ super(context);
+ }
+ }
+
+ /**
+ * Keeps track of aliases for return values of methods.
+ */
private class ReturnValueAliasing {
/**
- * Map of expression to alias. The expression is the name of the convenience variable
+ * Map of expression to alias. The expression is the name of the convenience variable
* storing the return value, e.g., $1 -> "foo() returned"
- * This map allows to quickly find the alias to be used for return value variables.
+ * This map allows to quickly find the alias to be used for return value variables.
*/
private Map<String, String> fExpressionAliasesMap = new HashMap<String, String>();
/**
@@ -875,92 +873,89 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
* before it returned out of the method.
*/
private Map<IMIExecutionDMContext, String> fThreadToTopMethodName = new HashMap<IMIExecutionDMContext, String>();
-
+
/**
* Create an alias for expr with respect to threadDmc.
* The alias is created based on where threadDmc was previously stopped.
*/
- public void createAlias(IMIExecutionDMContext threadDmc, String expr) {
- String alias = expr;
- String methodName = fThreadToTopMethodName.get(threadDmc);
- if (methodName != null) {
- alias = String.format(Messages.MIExpressions_ReturnValueAlias,
- methodName + "()"); //$NON-NLS-1$
- }
-
- fExpressionAliasesMap.put(expr, alias);
-
- List<String> aliasedExprList = fThreadToAliasedExpressionsMap.get(threadDmc);
- if (aliasedExprList == null) {
- aliasedExprList = new ArrayList<String>();
- fThreadToAliasedExpressionsMap.put(threadDmc, aliasedExprList);
- }
- aliasedExprList.add(expr);
- }
-
- /**
- * Clear all information related to a particular thread of execution.
- */
- public void clearThread(IMIExecutionDMContext threadDmc) {
- fThreadToTopMethodName.remove(threadDmc);
- clearAliases(threadDmc);
- }
-
- /**
- * Clear all aliased expressions related to a particular thread of execution.
- * It is good to keep the aliases around as long as the thread is alive;
- * even if we won't show the return value automatically, the user
- * could add the expression in the expression view, and the alias
- * would then be used.
- */
- public void clearAliases(IMIExecutionDMContext threadDmc) {
- List<String> aliasedExprList = fThreadToAliasedExpressionsMap.remove(threadDmc);
- if (aliasedExprList != null) {
- for (String expr : aliasedExprList) {
- fExpressionAliasesMap.remove(expr);
- }
- }
- }
-
- /**
- * Update the method name of the last location where threadDmc was stopped.
- */
- public void updateStoppedLocation(IMIExecutionDMContext threadDmc, String methodName) {
- fThreadToTopMethodName.put(threadDmc, methodName);
- }
-
- /**
- * @return The alias for 'expr' if there is one. null if there
- * is no alias for that expression.
- */
- public String getAlias(String expr) {
- String alias = fExpressionAliasesMap.get(expr);
- if (alias == null) {
- // Check if the expression contains the string that must be aliased.
- // E.g., $1[0], *$2
- // If it does, just replace that string within the expression to
- // create the full alias
- for (Entry<String, String> entry : fExpressionAliasesMap.entrySet()) {
- int index = expr.indexOf(entry.getKey());
- if (index != -1) {
- // Found the string! Now replace it with our alias.
- // We put it between () to make things clearer to the user.
- // Note that there can only be one string contained
- // in the expression, so once we found it, we are done.
- alias = expr.substring(0, index) +
- "(" + entry.getValue() + ")" + //$NON-NLS-1$ //$NON-NLS-2$
- expr.substring(index + entry.getKey().length());
- break;
- }
- }
- }
- return alias;
- }
+ public void createAlias(IMIExecutionDMContext threadDmc, String expr) {
+ String alias = expr;
+ String methodName = fThreadToTopMethodName.get(threadDmc);
+ if (methodName != null) {
+ alias = String.format(Messages.MIExpressions_ReturnValueAlias, methodName + "()"); //$NON-NLS-1$
+ }
+
+ fExpressionAliasesMap.put(expr, alias);
+
+ List<String> aliasedExprList = fThreadToAliasedExpressionsMap.get(threadDmc);
+ if (aliasedExprList == null) {
+ aliasedExprList = new ArrayList<String>();
+ fThreadToAliasedExpressionsMap.put(threadDmc, aliasedExprList);
+ }
+ aliasedExprList.add(expr);
+ }
+
+ /**
+ * Clear all information related to a particular thread of execution.
+ */
+ public void clearThread(IMIExecutionDMContext threadDmc) {
+ fThreadToTopMethodName.remove(threadDmc);
+ clearAliases(threadDmc);
+ }
+
+ /**
+ * Clear all aliased expressions related to a particular thread of execution.
+ * It is good to keep the aliases around as long as the thread is alive;
+ * even if we won't show the return value automatically, the user
+ * could add the expression in the expression view, and the alias
+ * would then be used.
+ */
+ public void clearAliases(IMIExecutionDMContext threadDmc) {
+ List<String> aliasedExprList = fThreadToAliasedExpressionsMap.remove(threadDmc);
+ if (aliasedExprList != null) {
+ for (String expr : aliasedExprList) {
+ fExpressionAliasesMap.remove(expr);
+ }
+ }
+ }
+
+ /**
+ * Update the method name of the last location where threadDmc was stopped.
+ */
+ public void updateStoppedLocation(IMIExecutionDMContext threadDmc, String methodName) {
+ fThreadToTopMethodName.put(threadDmc, methodName);
+ }
+
+ /**
+ * @return The alias for 'expr' if there is one. null if there
+ * is no alias for that expression.
+ */
+ public String getAlias(String expr) {
+ String alias = fExpressionAliasesMap.get(expr);
+ if (alias == null) {
+ // Check if the expression contains the string that must be aliased.
+ // E.g., $1[0], *$2
+ // If it does, just replace that string within the expression to
+ // create the full alias
+ for (Entry<String, String> entry : fExpressionAliasesMap.entrySet()) {
+ int index = expr.indexOf(entry.getKey());
+ if (index != -1) {
+ // Found the string! Now replace it with our alias.
+ // We put it between () to make things clearer to the user.
+ // Note that there can only be one string contained
+ // in the expression, so once we found it, we are done.
+ alias = expr.substring(0, index) + "(" + entry.getValue() + ")" + //$NON-NLS-1$ //$NON-NLS-2$
+ expr.substring(index + entry.getKey().length());
+ break;
+ }
+ }
+ }
+ return alias;
+ }
}
-
+
/** Structure to keep track of aliases for method return values. */
private ReturnValueAliasing fReturnValueAliases = new ReturnValueAliasing();
-
/**
* @since 4.3
@@ -970,20 +965,20 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
private CommandFactory fCommandFactory;
private MIVariableManager varManager;
- /**
+ /**
* Indicates that we are currently visualizing trace data.
* In this case, some errors should not be reported.
*/
private boolean fTraceVisualization;
private IMemorySpaces fMemorySpaceService;
-
+
public MIExpressions(DsfSession session) {
super(session);
}
/**
* This method initializes this service.
- *
+ *
* @param requestMonitor
* The request monitor indicating the operation is finished
*/
@@ -996,11 +991,11 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
}
});
}
-
+
/**
* 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.
@@ -1008,51 +1003,48 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
private void doInitialize(RequestMonitor requestMonitor) {
// Register to receive service events for this session.
- getSession().addServiceEventListener(this, null);
-
+ getSession().addServiceEventListener(this, null);
+
// Register this service, but only if we don't already have an
- // IExpression service present. This allows another expression
- // service to be used, while delegating calls to this service.
- if (getServicesTracker().getService(IExpressions.class) == null) {
- register(new String[] { IExpressions.class.getName(),
- IExpressions2.class.getName(),
- IExpressions3.class.getName(),
- IMIExpressions.class.getName(),
- MIExpressions.class.getName() },
- new Hashtable<String, String>());
- }
-
+ // IExpression service present. This allows another expression
+ // service to be used, while delegating calls to this service.
+ if (getServicesTracker().getService(IExpressions.class) == null) {
+ register(new String[] { IExpressions.class.getName(), IExpressions2.class.getName(),
+ IExpressions3.class.getName(), IMIExpressions.class.getName(), MIExpressions.class.getName() },
+ new Hashtable<String, String>());
+ }
+
// Create the expressionService-specific CommandControl which is our
- // variable object manager.
- // It will deal with the meta-commands, before sending real MI commands
- // to the back-end, through the MICommandControl service
+ // variable object manager.
+ // It will deal with the meta-commands, before sending real MI commands
+ // to the back-end, through the MICommandControl service
// It must be created after the ExpressionService is registered
// since it will need to find it.
- varManager = createMIVariableManager();
+ varManager = createMIVariableManager();
+
+ // Create the meta command cache which will use the variable manager
+ // to actually send MI commands to the back-end
+ fExpressionCache = new CommandCache(getSession(), varManager);
+ ICommandControlService commandControl = getServicesTracker().getService(ICommandControlService.class);
+ fExpressionCache.setContextAvailable(commandControl.getContext(), true);
- // Create the meta command cache which will use the variable manager
- // to actually send MI commands to the back-end
- fExpressionCache = new CommandCache(getSession(), varManager);
- ICommandControlService commandControl = getServicesTracker().getService(ICommandControlService.class);
- fExpressionCache.setContextAvailable(commandControl.getContext(), true);
-
- fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
+ fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
- fMemorySpaceService = getServicesTracker().getService(IMemorySpaces.class);
+ fMemorySpaceService = getServicesTracker().getService(IMemorySpaces.class);
requestMonitor.done();
}
/**
* Creates the MI variable manager to be used by this expression service.
- * Overriding classes may override to provide a custom services tracker.
- *
+ * Overriding classes may override to provide a custom services tracker.
+ *
* @since 3.0
*/
protected MIVariableManager createMIVariableManager() {
- return new MIVariableManager(getSession(), getServicesTracker());
+ return new MIVariableManager(getSession(), getServicesTracker());
}
-
+
/**
* This method shuts down this service. It unregisters the service, stops
* receiving service events, and calls the superclass shutdown() method to
@@ -1065,7 +1057,7 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
getSession().removeServiceEventListener(this);
super.shutdown(requestMonitor);
}
-
+
/**
* @return The bundle context of the plug-in to which this service belongs.
*/
@@ -1073,7 +1065,7 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
protected BundleContext getBundleContext() {
return GdbPlugin.getBundleContext();
}
-
+
/**
* Create an expression context with the same full and relative expression
*/
@@ -1088,121 +1080,116 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
public IExpressionDMContext createExpression(IDMContext ctx, String expression, String relExpr) {
return createExpression(ctx, new ExpressionInfo(expression, relExpr));
}
-
+
/**
* Create an expression context from a given expression info.
* @since 4.0
*/
private IExpressionDMContext createExpression(IDMContext ctx, ExpressionInfo info) {
String expression = info.getFullExpr();
- IFrameDMContext frameDmc = DMContexts.getAncestorOfType(ctx, IFrameDMContext.class);
- if (frameDmc != null) {
- return new MIExpressionDMC(getSession().getId(), info, frameDmc);
- }
-
- IMIExecutionDMContext execCtx = DMContexts.getAncestorOfType(ctx, IMIExecutionDMContext.class);
- if (execCtx != null) {
- // If we have a thread context but not a frame context, we give the user
- // the expression as per the top-most frame of the specified thread.
- // To do this, we create our own frame context.
- MIStack stackService = getServicesTracker().getService(MIStack.class);
- if (stackService != null) {
- frameDmc = stackService.createFrameDMContext(execCtx, 0);
- return new MIExpressionDMC(getSession().getId(), info, frameDmc);
- }
-
- return new InvalidContextExpressionDMC(getSession().getId(), expression, execCtx);
- }
-
- IMemoryDMContext memoryCtx = DMContexts.getAncestorOfType(ctx, IMemoryDMContext.class);
- if (memoryCtx != null) {
- return new MIExpressionDMC(getSession().getId(), info, memoryCtx);
- }
-
- // Don't care about the relative expression at this point
- return new InvalidContextExpressionDMC(getSession().getId(), expression, ctx);
+ IFrameDMContext frameDmc = DMContexts.getAncestorOfType(ctx, IFrameDMContext.class);
+ if (frameDmc != null) {
+ return new MIExpressionDMC(getSession().getId(), info, frameDmc);
+ }
+
+ IMIExecutionDMContext execCtx = DMContexts.getAncestorOfType(ctx, IMIExecutionDMContext.class);
+ if (execCtx != null) {
+ // If we have a thread context but not a frame context, we give the user
+ // the expression as per the top-most frame of the specified thread.
+ // To do this, we create our own frame context.
+ MIStack stackService = getServicesTracker().getService(MIStack.class);
+ if (stackService != null) {
+ frameDmc = stackService.createFrameDMContext(execCtx, 0);
+ return new MIExpressionDMC(getSession().getId(), info, frameDmc);
+ }
+
+ return new InvalidContextExpressionDMC(getSession().getId(), expression, execCtx);
+ }
+
+ IMemoryDMContext memoryCtx = DMContexts.getAncestorOfType(ctx, IMemoryDMContext.class);
+ if (memoryCtx != null) {
+ return new MIExpressionDMC(getSession().getId(), info, memoryCtx);
+ }
+
+ // Don't care about the relative expression at this point
+ return new InvalidContextExpressionDMC(getSession().getId(), expression, ctx);
}
/**
* @see IFormattedValues.getFormattedValueContext(IFormattedDataDMContext, String)
- *
+ *
* @param dmc
* The context describing the data for which we want to create
* a Formatted context.
* @param formatId
* The format that will be used to create the Formatted context
- *
+ *
* @return A FormattedValueDMContext that can be used to obtain the value
- * of an expression in a specific format.
+ * of an expression in a specific format.
*/
@Override
- public FormattedValueDMContext getFormattedValueContext(
- IFormattedDataDMContext dmc, String formatId) {
+ public FormattedValueDMContext getFormattedValueContext(IFormattedDataDMContext dmc, String formatId) {
return new FormattedValueDMContext(this, dmc, formatId);
}
/**
* @see IFormattedValues.getAvailableFormats(IFormattedDataDMContext, DataRequestMonitor)
- *
+ *
* @param dmc
* The context describing the data for which we want to know
* which formats are available.
* @param rm
- * The data request monitor for this asynchronous operation.
- *
+ * The data request monitor for this asynchronous operation.
+ *
*/
@Override
- public void getAvailableFormats(IFormattedDataDMContext dmc,
- final DataRequestMonitor<String[]> rm) {
+ public void getAvailableFormats(IFormattedDataDMContext dmc, final DataRequestMonitor<String[]> rm) {
rm.setData(FORMATS_SUPPORTED);
rm.done();
}
/**
- * Obtains the static data of an expression represented
+ * Obtains the static data of an expression represented
* by an ExpressionDMC object (<tt>dmc</tt>).
- *
+ *
* @param dmc
* The ExpressionDMC for the expression to be evaluated.
* @param rm
* The data request monitor that will contain the requested data
*/
@Override
- public void getExpressionData(
- final IExpressionDMContext dmc,
- final DataRequestMonitor<IExpressionDMData> rm)
- {
- if (dmc instanceof MIExpressionDMC) {
- fExpressionCache.execute(
- new ExprMetaGetVar(dmc),
- new DataRequestMonitor<ExprMetaGetVarInfo>(getExecutor(), rm) {
-
- @Override
- protected void handleSuccess() {
- IExpressionDMData.BasicType basicType = getBasicType(getData());
-
- String relativeExpr = getData().getExpr();
- String alias = fReturnValueAliases.getAlias(relativeExpr);
- if (alias != null) {
- relativeExpr = alias;
- }
- rm.setData(new ExpressionDMData(
- relativeExpr, getData().getType(), getData().getNumChildren(),
- getData().getEditable(), basicType));
- rm.done();
- }
- });
- } else if (dmc instanceof InvalidContextExpressionDMC) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid context for evaluating expressions.", null)); //$NON-NLS-1$
- rm.done();
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid expression context.", null)); //$NON-NLS-1$
- rm.done();
- }
+ public void getExpressionData(final IExpressionDMContext dmc, final DataRequestMonitor<IExpressionDMData> rm) {
+ if (dmc instanceof MIExpressionDMC) {
+ fExpressionCache.execute(new ExprMetaGetVar(dmc),
+ new DataRequestMonitor<ExprMetaGetVarInfo>(getExecutor(), rm) {
+
+ @Override
+ protected void handleSuccess() {
+ IExpressionDMData.BasicType basicType = getBasicType(getData());
+
+ String relativeExpr = getData().getExpr();
+ String alias = fReturnValueAliases.getAlias(relativeExpr);
+ if (alias != null) {
+ relativeExpr = alias;
+ }
+ rm.setData(new ExpressionDMData(relativeExpr, getData().getType(),
+ getData().getNumChildren(), getData().getEditable(), basicType));
+ rm.done();
+ }
+ });
+ } else if (dmc instanceof InvalidContextExpressionDMC) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE,
+ "Invalid context for evaluating expressions.", null)); //$NON-NLS-1$
+ rm.done();
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid expression context.", //$NON-NLS-1$
+ null));
+ rm.done();
+ }
}
-
+
/**
* @since 4.7
*/
@@ -1212,208 +1199,202 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
GDBType gdbType = varInfo.getGDBType();
if (gdbType != null) {
- switch (gdbType.getType()) {
- case GDBType.ARRAY:
- basicType = IExpressionDMData.BasicType.array;
- break;
- case GDBType.FUNCTION:
- basicType = IExpressionDMData.BasicType.function;
- break;
- case GDBType.POINTER:
- case GDBType.REFERENCE:
- basicType = IExpressionDMData.BasicType.pointer;
- break;
- case GDBType.GENERIC:
- default:
- // The interesting question is not hasChildren,
- // but canHaveChildren. E.g. an empty
- // collection still is a composite.
- if (varInfo.hasChildren() || varInfo.getCollectionHint()) {
- basicType = IExpressionDMData.BasicType.composite;
- } else {
- basicType = IExpressionDMData.BasicType.basic;
- }
- break;
- }
+ switch (gdbType.getType()) {
+ case GDBType.ARRAY:
+ basicType = IExpressionDMData.BasicType.array;
+ break;
+ case GDBType.FUNCTION:
+ basicType = IExpressionDMData.BasicType.function;
+ break;
+ case GDBType.POINTER:
+ case GDBType.REFERENCE:
+ basicType = IExpressionDMData.BasicType.pointer;
+ break;
+ case GDBType.GENERIC:
+ default:
+ // The interesting question is not hasChildren,
+ // but canHaveChildren. E.g. an empty
+ // collection still is a composite.
+ if (varInfo.hasChildren() || varInfo.getCollectionHint()) {
+ basicType = IExpressionDMData.BasicType.composite;
+ } else {
+ basicType = IExpressionDMData.BasicType.basic;
+ }
+ break;
+ }
}
return basicType;
}
/**
- * Obtains the address of an expression and the size of its type.
- *
+ * Obtains the address of an expression and the size of its type.
+ *
* @param dmc
* The ExpressionDMC for the expression.
* @param rm
* The data request monitor that will contain the requested data
*/
@Override
- public void getExpressionAddressData(
- final IExpressionDMContext dmc,
- final DataRequestMonitor<IExpressionDMAddress> rm) {
-
- if (dmc instanceof MIExpressionDMC) {
- MIExpressionDMC miDMC = (MIExpressionDMC) dmc;
- if (miDMC.getExpressionInfo().hasDynamicAncestor() ||
- !miDMC.getExpressionInfo().inMemory()) {
- // For children of dynamic varobjs, there is no full expression that gdb
- // could evaluate in order to provide address and size.
- // Also, if an expression is not in memory, such as a register
- // or a GDB convenience variable, there is no address to return
+ public void getExpressionAddressData(final IExpressionDMContext dmc,
+ final DataRequestMonitor<IExpressionDMAddress> rm) {
+
+ if (dmc instanceof MIExpressionDMC) {
+ MIExpressionDMC miDMC = (MIExpressionDMC) dmc;
+ if (miDMC.getExpressionInfo().hasDynamicAncestor() || !miDMC.getExpressionInfo().inMemory()) {
+ // For children of dynamic varobjs, there is no full expression that gdb
+ // could evaluate in order to provide address and size.
+ // Also, if an expression is not in memory, such as a register
+ // or a GDB convenience variable, there is no address to return
rm.setData(new InvalidDMAddress());
rm.done();
return;
- }
- }
-
- // First create an address expression and a size expression
- // to be used in back-end calls
- final IExpressionDMContext addressDmc =
- createExpression( dmc, "&(" + dmc.getExpression() + ")" );//$NON-NLS-1$//$NON-NLS-2$
- final IExpressionDMContext sizeDmc =
- createExpression( dmc, "sizeof(" + dmc.getExpression() + ")" ); //$NON-NLS-1$//$NON-NLS-2$
-
- if (addressDmc instanceof InvalidContextExpressionDMC || sizeDmc instanceof InvalidContextExpressionDMC) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid context for evaluating expressions.", null)); //$NON-NLS-1$
- rm.done();
- } else {
- fExpressionCache.execute(
- fCommandFactory.createMIDataEvaluateExpression(addressDmc),
- new DataRequestMonitor<MIDataEvaluateExpressionInfo>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- String tmpAddrStr = getData().getValue();
-
- DecodeResult memSpaceParsed = null;
- if (fMemorySpaceService != null) {
- try {
- memSpaceParsed = fMemorySpaceService
- .decodeAddress(tmpAddrStr);
- } catch (CoreException e1) {
- // No memory space id found
+ }
+ }
+
+ // First create an address expression and a size expression
+ // to be used in back-end calls
+ final IExpressionDMContext addressDmc = createExpression(dmc, "&(" + dmc.getExpression() + ")");//$NON-NLS-1$//$NON-NLS-2$
+ final IExpressionDMContext sizeDmc = createExpression(dmc, "sizeof(" + dmc.getExpression() + ")"); //$NON-NLS-1$//$NON-NLS-2$
+
+ if (addressDmc instanceof InvalidContextExpressionDMC || sizeDmc instanceof InvalidContextExpressionDMC) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE,
+ "Invalid context for evaluating expressions.", null)); //$NON-NLS-1$
+ rm.done();
+ } else {
+ fExpressionCache.execute(fCommandFactory.createMIDataEvaluateExpression(addressDmc),
+ new DataRequestMonitor<MIDataEvaluateExpressionInfo>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ String tmpAddrStr = getData().getValue();
+
+ DecodeResult memSpaceParsed = null;
+ if (fMemorySpaceService != null) {
+ try {
+ memSpaceParsed = fMemorySpaceService.decodeAddress(tmpAddrStr);
+ } catch (CoreException e1) {
+ // No memory space id found
+ }
}
- }
- String tMemSpace = ""; //$NON-NLS-1$
- if (memSpaceParsed != null) {
- tmpAddrStr = memSpaceParsed.getExpression();
- tMemSpace = memSpaceParsed.getMemorySpaceId();
- }
+ String tMemSpace = ""; //$NON-NLS-1$
+ if (memSpaceParsed != null) {
+ tmpAddrStr = memSpaceParsed.getExpression();
+ tMemSpace = memSpaceParsed.getMemorySpaceId();
+ }
- final String memSpaceId = tMemSpace;
-
- // Deal with addresses of contents of a char* which is in
- // the form of "0x12345678 \"This is a string\""
- int split = tmpAddrStr.indexOf(' ');
- if (split != -1) tmpAddrStr = tmpAddrStr.substring(0, split);
- final String addrStr = tmpAddrStr;
-
- fExpressionCache.execute(
- fCommandFactory.createMIDataEvaluateExpression(sizeDmc),
- new DataRequestMonitor<MIDataEvaluateExpressionInfo>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- try {
- int size = Integer.parseInt(getData().getValue());
- rm.setData(new ExpressionDMAddress(addrStr, size, memSpaceId));
- } catch (NumberFormatException e) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE,
- "Unexpected size format from backend: " + getData().getValue(), null)); //$NON-NLS-1$
- }
- rm.done();
- }
- });
- }
- });
- }
+ final String memSpaceId = tMemSpace;
+
+ // Deal with addresses of contents of a char* which is in
+ // the form of "0x12345678 \"This is a string\""
+ int split = tmpAddrStr.indexOf(' ');
+ if (split != -1)
+ tmpAddrStr = tmpAddrStr.substring(0, split);
+ final String addrStr = tmpAddrStr;
+
+ fExpressionCache.execute(fCommandFactory.createMIDataEvaluateExpression(sizeDmc),
+ new DataRequestMonitor<MIDataEvaluateExpressionInfo>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ try {
+ int size = Integer.parseInt(getData().getValue());
+ rm.setData(new ExpressionDMAddress(addrStr, size, memSpaceId));
+ } catch (NumberFormatException e) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
+ INVALID_HANDLE, "Unexpected size format from backend: " //$NON-NLS-1$
+ + getData().getValue(),
+ null));
+ }
+ rm.done();
+ }
+ });
+ }
+ });
+ }
}
/**
* Obtains the value of an expression in a specific format.
- *
+ *
* @param dmc
- * The context for the format of the value requested and
+ * The context for the format of the value requested and
* for the expression to be evaluated. The expression context
* should be a parent of the FormattedValueDMContext.
* @param rm
* The data request monitor that will contain the requested data
*/
@Override
- public void getFormattedExpressionValue(
- final FormattedValueDMContext dmc,
- final DataRequestMonitor<FormattedValueDMData> rm)
- {
+ public void getFormattedExpressionValue(final FormattedValueDMContext dmc,
+ final DataRequestMonitor<FormattedValueDMData> rm) {
// We need to make sure the FormattedValueDMContext also holds an ExpressionContext,
// or else this method cannot do its work.
// Note that we look for MIExpressionDMC and not IExpressionDMC, because
// looking for IExpressionDMC could yield InvalidContextExpressionDMC which is still
// not what we need.
MIExpressionDMC exprDmc = DMContexts.getAncestorOfType(dmc, MIExpressionDMC.class);
- if (exprDmc == null ) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid context for evaluating expressions.", null)); //$NON-NLS-1$
- rm.done();
- } else {
- if (DETAILS_FORMAT.equals(dmc.getFormatID())) {
- if (exprDmc.getExpressionInfo().hasDynamicAncestor()) {
- // -data-evaluate-expression does not work for children of
- // dynamic varobjs, since there is no full expression
- // that gdb could evaluate.
- rm.setData(new FormattedValueDMData(Messages.MIExpressions_NotAvailableBecauseChildOfDynamicVarobj));
+ if (exprDmc == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE,
+ "Invalid context for evaluating expressions.", null)); //$NON-NLS-1$
+ rm.done();
+ } else {
+ if (DETAILS_FORMAT.equals(dmc.getFormatID())) {
+ if (exprDmc.getExpressionInfo().hasDynamicAncestor()) {
+ // -data-evaluate-expression does not work for children of
+ // dynamic varobjs, since there is no full expression
+ // that gdb could evaluate.
+ rm.setData(
+ new FormattedValueDMData(Messages.MIExpressions_NotAvailableBecauseChildOfDynamicVarobj));
rm.done();
- } else {
- // This format is obtained through a different GDB command.
- // It yields more details than the variableObject output.
- // Starting with GDB 7.0, this format automatically supports pretty-printing, as long as
- // GDB has been configured to support it.
- fExpressionCache.execute(
- fCommandFactory.createMIDataEvaluateExpression(exprDmc),
- new DataRequestMonitor<MIDataEvaluateExpressionInfo>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- rm.setData(new FormattedValueDMData(getData().getValue()));
- rm.done();
- }
- @Override
- protected void handleError() {
- if (fTraceVisualization) {
- rm.setData(new FormattedValueDMData("")); //$NON-NLS-1$
- rm.done();
- } else {
- super.handleError();
- }
- }
- });
- }
- } else {
- fExpressionCache.execute(
- new ExprMetaGetValue(dmc),
- new DataRequestMonitor<ExprMetaGetValueInfo>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- rm.setData(new FormattedValueDMData(getData().getValue()));
- rm.done();
- }
- });
- }
- }
+ } else {
+ // This format is obtained through a different GDB command.
+ // It yields more details than the variableObject output.
+ // Starting with GDB 7.0, this format automatically supports pretty-printing, as long as
+ // GDB has been configured to support it.
+ fExpressionCache.execute(fCommandFactory.createMIDataEvaluateExpression(exprDmc),
+ new DataRequestMonitor<MIDataEvaluateExpressionInfo>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ rm.setData(new FormattedValueDMData(getData().getValue()));
+ rm.done();
+ }
+
+ @Override
+ protected void handleError() {
+ if (fTraceVisualization) {
+ rm.setData(new FormattedValueDMData("")); //$NON-NLS-1$
+ rm.done();
+ } else {
+ super.handleError();
+ }
+ }
+ });
+ }
+ } else {
+ fExpressionCache.execute(new ExprMetaGetValue(dmc),
+ new DataRequestMonitor<ExprMetaGetValueInfo>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ rm.setData(new FormattedValueDMData(getData().getValue()));
+ rm.done();
+ }
+ });
+ }
+ }
}
/* Not implemented
- *
+ *
* (non-Javadoc)
* @see org.eclipse.cdt.dsf.debug.service.IExpressions#getBaseExpressions(org.eclipse.cdt.dsf.debug.service.IExpressions.IExpressionDMContext, org.eclipse.cdt.dsf.concurrent.DataRequestMonitor)
*/
@Override
- public void getBaseExpressions(IExpressionDMContext exprContext,
- DataRequestMonitor<IExpressionDMContext[]> rm) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
- NOT_SUPPORTED, "Not supported", null)); //$NON-NLS-1$
+ public void getBaseExpressions(IExpressionDMContext exprContext, DataRequestMonitor<IExpressionDMContext[]> rm) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Not supported", null)); //$NON-NLS-1$
rm.done();
}
/**
* Retrieves the children expressions of the specified expression
- *
+ *
* @param dmc
* The context for the expression for which the children
* should be retrieved.
@@ -1427,159 +1408,152 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
/**
* Retrieves a range of children expressions of the specified expression
- *
+ *
* @param exprCtx
* The context for the expression for which the children
* should be retrieved.
* @param startIndex
* The starting index within the list of all children of the parent
- * expression. Must be a positive integer.
+ * expression. Must be a positive integer.
* @param length
- * The length or number of elements of the range requested.
+ * The length or number of elements of the range requested.
* Must be a positive integer.
* @param rm
* The data request monitor that will contain the requested data
*/
@Override
- public void getSubExpressions(final IExpressionDMContext exprCtx, final int startIndex,
- final int length, final DataRequestMonitor<IExpressionDMContext[]> rm) {
+ public void getSubExpressions(final IExpressionDMContext exprCtx, final int startIndex, final int length,
+ final DataRequestMonitor<IExpressionDMContext[]> rm) {
if (exprCtx instanceof IndexedPartitionDMC) {
- getIndexedPartitionChildren((IndexedPartitionDMC)exprCtx, startIndex, length, rm);
- }
- else if (exprCtx instanceof MIExpressionDMC) {
- getRealSubExpressionCount(
- exprCtx,
- IMIExpressions.CHILD_COUNT_LIMIT_UNSPECIFIED,
- new DataRequestMonitor<Integer>(getExecutor(), rm) {
- /* (non-Javadoc)
- * @see org.eclipse.cdt.dsf.concurrent.RequestMonitor#handleSuccess()
- */
- @Override
- protected void handleSuccess() {
- final int realNumChildren = getData().intValue();
- if (realNumChildren == 0) {
- rm.setData(new IExpressionDMContext[0]);
- rm.done();
- return;
- }
-
- if (realNumChildren <= getArrayPartitionLength()) {
- getRealSubExpressions(exprCtx, startIndex, length, rm);
- }
- else {
- getExpressionData(
- exprCtx,
- new DataRequestMonitor<IExpressionDMData>(ImmediateExecutor.getInstance(), rm) {
+ getIndexedPartitionChildren((IndexedPartitionDMC) exprCtx, startIndex, length, rm);
+ } else if (exprCtx instanceof MIExpressionDMC) {
+ getRealSubExpressionCount(exprCtx, IMIExpressions.CHILD_COUNT_LIMIT_UNSPECIFIED,
+ new DataRequestMonitor<Integer>(getExecutor(), rm) {
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.dsf.concurrent.RequestMonitor#handleSuccess()
+ */
+ @Override
+ protected void handleSuccess() {
+ final int realNumChildren = getData().intValue();
+ if (realNumChildren == 0) {
+ rm.setData(new IExpressionDMContext[0]);
+ rm.done();
+ return;
+ }
- @Override
- protected void handleSuccess() {
- if (IExpressionDMData.BasicType.array.equals(getData().getBasicType())) {
- rm.setData(getTopLevelIndexedPartitions((MIExpressionDMC)exprCtx, realNumChildren, startIndex, length ));
- rm.done();
+ if (realNumChildren <= getArrayPartitionLength()) {
+ getRealSubExpressions(exprCtx, startIndex, length, rm);
+ } else {
+ getExpressionData(exprCtx,
+ new DataRequestMonitor<IExpressionDMData>(ImmediateExecutor.getInstance(), rm) {
+
+ @Override
+ protected void handleSuccess() {
+ if (IExpressionDMData.BasicType.array
+ .equals(getData().getBasicType())) {
+ rm.setData(getTopLevelIndexedPartitions((MIExpressionDMC) exprCtx,
+ realNumChildren, startIndex, length));
+ rm.done();
+ } else {
+ getRealSubExpressions(exprCtx, startIndex, length, rm);
+ }
}
- else {
- getRealSubExpressions(exprCtx, startIndex, length, rm);
- }
- }
- });
+ });
+ }
}
- }
- });
+ });
} else if (exprCtx instanceof InvalidContextExpressionDMC) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid context for evaluating expressions.", null)); //$NON-NLS-1$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE,
+ "Invalid context for evaluating expressions.", null)); //$NON-NLS-1$
rm.done();
} else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid expression context.", null)); //$NON-NLS-1$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid expression context.", //$NON-NLS-1$
+ null));
rm.done();
- }
+ }
}
-
+
/**
* @since 4.0
*/
@Override
- public void safeToAskForAllSubExpressions(IExpressionDMContext dmc,
- final DataRequestMonitor<Boolean> rm) {
- if (dmc instanceof MIExpressionDMC) {
- fExpressionCache.execute(
- new ExprMetaGetVar(dmc),
- new DataRequestMonitor<ExprMetaGetVarInfo>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
+ public void safeToAskForAllSubExpressions(IExpressionDMContext dmc, final DataRequestMonitor<Boolean> rm) {
+ if (dmc instanceof MIExpressionDMC) {
+ fExpressionCache.execute(new ExprMetaGetVar(dmc),
+ new DataRequestMonitor<ExprMetaGetVarInfo>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
boolean safe = getData().isSafeToAskForAllChildren();
-
+
rm.setData(safe);
rm.done();
- }
- });
- } else if (dmc instanceof InvalidContextExpressionDMC) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid context for evaluating expressions.", null)); //$NON-NLS-1$
- rm.done();
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid expression context.", null)); //$NON-NLS-1$
- rm.done();
- }
+ }
+ });
+ } else if (dmc instanceof InvalidContextExpressionDMC) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE,
+ "Invalid context for evaluating expressions.", null)); //$NON-NLS-1$
+ rm.done();
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid expression context.", //$NON-NLS-1$
+ null));
+ rm.done();
+ }
}
/**
* @since 4.0
*/
@Override
- public void getSubExpressionCount(final IExpressionDMContext dmc,
- final int numChildLimit, final DataRequestMonitor<Integer> rm) {
+ public void getSubExpressionCount(final IExpressionDMContext dmc, final int numChildLimit,
+ final DataRequestMonitor<Integer> rm) {
if (dmc instanceof MIExpressionDMC) {
if (dmc instanceof IndexedPartitionDMC) {
- int length = ((IndexedPartitionDMC)dmc).getLength();
+ int length = ((IndexedPartitionDMC) dmc).getLength();
rm.setData(computeNumberOfChildren(length));
rm.done();
- }
- else {
- getRealSubExpressionCount(
- dmc,
- numChildLimit,
- new DataRequestMonitor<Integer>(getExecutor(), rm) {
+ } else {
+ getRealSubExpressionCount(dmc, numChildLimit, new DataRequestMonitor<Integer>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- final int realNum = getData().intValue();
- if (realNum <= getArrayPartitionLength()) {
- rm.setData(Integer.valueOf(realNum));
- rm.done();
- }
- else {
- getExpressionData(
- dmc,
+ @Override
+ protected void handleSuccess() {
+ final int realNum = getData().intValue();
+ if (realNum <= getArrayPartitionLength()) {
+ rm.setData(Integer.valueOf(realNum));
+ rm.done();
+ } else {
+ getExpressionData(dmc,
new DataRequestMonitor<IExpressionDMData>(ImmediateExecutor.getInstance(), rm) {
@Override
protected void handleSuccess() {
if (IExpressionDMData.BasicType.array.equals(getData().getBasicType())) {
rm.setData(computeNumberOfChildren(realNum));
- }
- else {
+ } else {
rm.setData(Integer.valueOf(realNum));
}
rm.done();
}
});
- }
- }
- });
+ }
+ }
+ });
}
} else if (dmc instanceof InvalidContextExpressionDMC) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid context for evaluating expressions.", null)); //$NON-NLS-1$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE,
+ "Invalid context for evaluating expressions.", null)); //$NON-NLS-1$
rm.done();
} else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid expression context.", null)); //$NON-NLS-1$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid expression context.", //$NON-NLS-1$
+ null));
rm.done();
}
}
/**
* Retrieves the count of children expressions of the specified expression
- *
+ *
* @param dmc
* The context for the expression for which the children count
* should be retrieved.
@@ -1587,47 +1561,45 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
* The data request monitor that will contain the requested data
*/
@Override
- public void getSubExpressionCount(IExpressionDMContext dmc,
- final DataRequestMonitor<Integer> rm)
- {
+ public void getSubExpressionCount(IExpressionDMContext dmc, final DataRequestMonitor<Integer> rm) {
getSubExpressionCount(dmc, IMIExpressions.CHILD_COUNT_LIMIT_UNSPECIFIED, rm);
}
-
- /**
- * This method indicates if an expression can be written to.
- *
- * @param dmc The data model context representing an expression.
- *
- * @param rm Data Request monitor containing True if this expression's value can be edited. False otherwise.
- */
+
+ /**
+ * This method indicates if an expression can be written to.
+ *
+ * @param dmc The data model context representing an expression.
+ *
+ * @param rm Data Request monitor containing True if this expression's value can be edited. False otherwise.
+ */
@Override
public void canWriteExpression(IExpressionDMContext dmc, final DataRequestMonitor<Boolean> rm) {
- if (dmc instanceof MIExpressionDMC) {
- fExpressionCache.execute(
- new ExprMetaGetAttributes(dmc),
- new DataRequestMonitor<ExprMetaGetAttributesInfo>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- rm.setData(getData().getEditable());
- rm.done();
- }
- });
- } else if (dmc instanceof InvalidContextExpressionDMC) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid context for evaluating expressions.", null)); //$NON-NLS-1$
- rm.done();
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid expression context.", null)); //$NON-NLS-1$
- rm.done();
- }
+ if (dmc instanceof MIExpressionDMC) {
+ fExpressionCache.execute(new ExprMetaGetAttributes(dmc),
+ new DataRequestMonitor<ExprMetaGetAttributesInfo>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ rm.setData(getData().getEditable());
+ rm.done();
+ }
+ });
+ } else if (dmc instanceof InvalidContextExpressionDMC) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE,
+ "Invalid context for evaluating expressions.", null)); //$NON-NLS-1$
+ rm.done();
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid expression context.", //$NON-NLS-1$
+ null));
+ rm.done();
+ }
}
-
/**
* Changes the value of the specified expression based on the new value and format.
- *
+ *
* @param dmc
- * The context for the expression for which the value
+ * The context for the expression for which the value
* should be changed.
* @param expressionValue
* The new value for the specified expression
@@ -1637,146 +1609,144 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
* The request monitor that will indicate the completion of the operation
*/
@Override
- public void writeExpression(final IExpressionDMContext dmc, String expressionValue,
- String formatId, final RequestMonitor rm) {
+ public void writeExpression(final IExpressionDMContext dmc, String expressionValue, String formatId,
+ final RequestMonitor rm) {
if (dmc instanceof MIExpressionDMC) {
// This command must not be cached, since it changes the state of the back-end.
// We must send it directly to the variable manager
- varManager.writeValue(
- dmc,
- expressionValue,
- formatId,
- new RequestMonitor(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- // A value has changed, we should remove any references to that
- // value in our cache. Since we don't have such granularity,
- // we must clear the entire cache.
- // We cannot use the context to do a more-specific reset, because
- // the same global variable can be set with different contexts
- fExpressionCache.reset();
-
- // Issue event that the expression has changed
- getSession().dispatchEvent(new ExpressionChangedEvent(dmc), getProperties());
-
- rm.done();
- }
- });
+ varManager.writeValue(dmc, expressionValue, formatId, new RequestMonitor(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ // A value has changed, we should remove any references to that
+ // value in our cache. Since we don't have such granularity,
+ // we must clear the entire cache.
+ // We cannot use the context to do a more-specific reset, because
+ // the same global variable can be set with different contexts
+ fExpressionCache.reset();
+
+ // Issue event that the expression has changed
+ getSession().dispatchEvent(new ExpressionChangedEvent(dmc), getProperties());
+
+ rm.done();
+ }
+ });
} else if (dmc instanceof InvalidContextExpressionDMC) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid context for evaluating expressions.", null)); //$NON-NLS-1$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE,
+ "Invalid context for evaluating expressions.", null)); //$NON-NLS-1$
rm.done();
} else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid expression context.", null)); //$NON-NLS-1$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid expression context.", //$NON-NLS-1$
+ null));
rm.done();
}
}
- @DsfServiceEventHandler
- public void eventDispatched(IResumedDMEvent e) {
- fExpressionCache.setContextAvailable(e.getDMContext(), false);
- if (e.getReason() != StateChangeReason.STEP) {
- fExpressionCache.reset();
- }
- }
-
- @DsfServiceEventHandler
- public void eventDispatched(ISuspendedDMEvent e) {
- fExpressionCache.setContextAvailable(e.getDMContext(), true);
- fExpressionCache.reset();
-
- handleReturnValueAliasing(e);
- }
-
- private void handleReturnValueAliasing(ISuspendedDMEvent e) {
- // Process MIStoppedEvent from within the ISuspendedDMEvent
- // to avoid any race conditions where the actual MIStoppedEvent
- // can arrive faster that a preceding IResumedDMEvent
- if (e instanceof IMIDMEvent) {
- Object miEvent = ((IMIDMEvent)e).getMIEvent();
- if (miEvent instanceof MIStoppedEvent) {
- IMIExecutionDMContext stoppedEventThread = null;
- if (e instanceof IContainerSuspendedDMEvent) {
- // All-stop mode
- IExecutionDMContext[] triggerContexts = ((IContainerSuspendedDMEvent)e).getTriggeringContexts();
- if (triggerContexts.length != 0 && triggerContexts[0] instanceof IMIExecutionDMContext) {
- stoppedEventThread = (IMIExecutionDMContext)triggerContexts[0];
- }
- } else {
- // Non-stop mode
- IDMContext dmc = e.getDMContext();
- if (dmc instanceof IMIExecutionDMContext) {
- stoppedEventThread = (IMIExecutionDMContext)dmc;
- }
- }
-
- if (stoppedEventThread != null) {
- if (miEvent instanceof MIFunctionFinishedEvent) {
- // When getting an MIFunctionFinishedEvent we must set
- // a proper alias for the convenience variable
- String resultVar = ((MIFunctionFinishedEvent)miEvent).getGDBResultVar();
- if (resultVar != null && !resultVar.isEmpty()) {
- fReturnValueAliases.createAlias(stoppedEventThread, resultVar);
- }
- }
-
- // Keep track of the latest method the thread is stopped in.
- // Must do this after creating any alias, or else we will overwrite
- // the previous function name, which we need for the alias
- MIFrame frame = ((MIStoppedEvent)miEvent).getFrame();
- if (frame != null) {
- fReturnValueAliases.updateStoppedLocation(stoppedEventThread, frame.getFunction());
- }
- }
- }
- }
- }
-
- @DsfServiceEventHandler
- public void eventDispatched(IMemoryChangedEvent e) {
- fExpressionCache.reset();
- // MIVariableManager separately traps this event
- }
-
- /** @since 3.0 */
- @DsfServiceEventHandler
- public void eventDispatched(ITraceRecordSelectedChangedDMEvent e) {
- if (e.isVisualizationModeEnabled()) {
- fTraceVisualization = true;
- } else {
- fTraceVisualization = false;
- }
- }
-
- /**
- * @nooverride This method is not intended to be re-implemented or extended by clients.
- * @noreference This method is not intended to be referenced by clients.
- */
- @DsfServiceEventHandler
- public void eventDispatched(IExitedDMEvent e) {
- IDMContext ctx = e.getDMContext();
- if (ctx instanceof IMIExecutionDMContext) {
- // When a thread exits, clear the alias structure for that
- // thread to avoid leaks
- fReturnValueAliases.clearThread((IMIExecutionDMContext)ctx);
- }
- }
-
- /**
- * {@inheritDoc}
- * @since 1.1
- */
+ @DsfServiceEventHandler
+ public void eventDispatched(IResumedDMEvent e) {
+ fExpressionCache.setContextAvailable(e.getDMContext(), false);
+ if (e.getReason() != StateChangeReason.STEP) {
+ fExpressionCache.reset();
+ }
+ }
+
+ @DsfServiceEventHandler
+ public void eventDispatched(ISuspendedDMEvent e) {
+ fExpressionCache.setContextAvailable(e.getDMContext(), true);
+ fExpressionCache.reset();
+
+ handleReturnValueAliasing(e);
+ }
+
+ private void handleReturnValueAliasing(ISuspendedDMEvent e) {
+ // Process MIStoppedEvent from within the ISuspendedDMEvent
+ // to avoid any race conditions where the actual MIStoppedEvent
+ // can arrive faster that a preceding IResumedDMEvent
+ if (e instanceof IMIDMEvent) {
+ Object miEvent = ((IMIDMEvent) e).getMIEvent();
+ if (miEvent instanceof MIStoppedEvent) {
+ IMIExecutionDMContext stoppedEventThread = null;
+ if (e instanceof IContainerSuspendedDMEvent) {
+ // All-stop mode
+ IExecutionDMContext[] triggerContexts = ((IContainerSuspendedDMEvent) e).getTriggeringContexts();
+ if (triggerContexts.length != 0 && triggerContexts[0] instanceof IMIExecutionDMContext) {
+ stoppedEventThread = (IMIExecutionDMContext) triggerContexts[0];
+ }
+ } else {
+ // Non-stop mode
+ IDMContext dmc = e.getDMContext();
+ if (dmc instanceof IMIExecutionDMContext) {
+ stoppedEventThread = (IMIExecutionDMContext) dmc;
+ }
+ }
+
+ if (stoppedEventThread != null) {
+ if (miEvent instanceof MIFunctionFinishedEvent) {
+ // When getting an MIFunctionFinishedEvent we must set
+ // a proper alias for the convenience variable
+ String resultVar = ((MIFunctionFinishedEvent) miEvent).getGDBResultVar();
+ if (resultVar != null && !resultVar.isEmpty()) {
+ fReturnValueAliases.createAlias(stoppedEventThread, resultVar);
+ }
+ }
+
+ // Keep track of the latest method the thread is stopped in.
+ // Must do this after creating any alias, or else we will overwrite
+ // the previous function name, which we need for the alias
+ MIFrame frame = ((MIStoppedEvent) miEvent).getFrame();
+ if (frame != null) {
+ fReturnValueAliases.updateStoppedLocation(stoppedEventThread, frame.getFunction());
+ }
+ }
+ }
+ }
+ }
+
+ @DsfServiceEventHandler
+ public void eventDispatched(IMemoryChangedEvent e) {
+ fExpressionCache.reset();
+ // MIVariableManager separately traps this event
+ }
+
+ /** @since 3.0 */
+ @DsfServiceEventHandler
+ public void eventDispatched(ITraceRecordSelectedChangedDMEvent e) {
+ if (e.isVisualizationModeEnabled()) {
+ fTraceVisualization = true;
+ } else {
+ fTraceVisualization = false;
+ }
+ }
+
+ /**
+ * @nooverride This method is not intended to be re-implemented or extended by clients.
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ @DsfServiceEventHandler
+ public void eventDispatched(IExitedDMEvent e) {
+ IDMContext ctx = e.getDMContext();
+ if (ctx instanceof IMIExecutionDMContext) {
+ // When a thread exits, clear the alias structure for that
+ // thread to avoid leaks
+ fReturnValueAliases.clearThread((IMIExecutionDMContext) ctx);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ * @since 1.1
+ */
@Override
- public void flushCache(IDMContext context) {
- fExpressionCache.reset(context);
- // We must also mark all variable objects as out-of-date
- // to refresh them as well
- varManager.markAllOutOfDate();
- }
-
- /**
- * A casted or array-displayed expression.
- * @since 3.0
+ public void flushCache(IDMContext context) {
+ fExpressionCache.reset(context);
+ // We must also mark all variable objects as out-of-date
+ // to refresh them as well
+ varManager.markAllOutOfDate();
+ }
+
+ /**
+ * A casted or array-displayed expression.
+ * @since 3.0
*/
protected class CastedExpressionDMC extends MIExpressionDMC implements ICastedExpressionDMContext {
@@ -1786,7 +1756,7 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
super(getSession().getId(), castExpression, exprDMC.getRelativeExpression(), exprDMC);
fCastInfo = castInfo;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.cdt.dsf.debug.service.IExpressions2.ICastedExpressionDMContext#getCastInfo()
*/
@@ -1794,18 +1764,17 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
public CastInfo getCastInfo() {
return fCastInfo;
}
-
- /**
- * @return True if the two objects are equal, false otherwise.
- */
- @Override
+
+ /**
+ * @return True if the two objects are equal, false otherwise.
+ */
+ @Override
public boolean equals(Object other) {
- return super.equals(other)
- && fCastInfo.equals(((CastedExpressionDMC) other).fCastInfo);
- }
+ return super.equals(other) && fCastInfo.equals(((CastedExpressionDMC) other).fCastInfo);
+ }
}
-
- /* (non-Javadoc)
+
+ /* (non-Javadoc)
* @see org.eclipse.cdt.dsf.debug.service.IExpressions2#createCastedExpression(org.eclipse.cdt.dsf.datamodel.IDMContext, java.lang.String, org.eclipse.cdt.dsf.debug.service.IExpressions2.ICastedExpressionDMContext)
*/
/** @since 3.0 */
@@ -1814,18 +1783,18 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
if (exprDMC instanceof MIExpressionDMC && castInfo != null) {
String castType = castInfo.getTypeString();
String castExpression = exprDMC.getExpression();
- int castingLength = castInfo.getArrayCount();
+ int castingLength = castInfo.getArrayCount();
int castingIndex = castInfo.getArrayStartIndex();
-
- // cast to type
+
+ // cast to type
if (castType != null && !castType.isEmpty()) {
StringBuilder buffer = new StringBuilder();
buffer.append('(').append(castType).append(')');
buffer.append('(').append(castExpression).append(')');
castExpression = buffer.toString();
- }
-
- // cast to array (can be in addition to cast to type)
+ }
+
+ // cast to array (can be in addition to cast to type)
if (castingLength > 0) {
StringBuilder buffer = new StringBuilder();
buffer.append("*("); //$NON-NLS-1$
@@ -1834,13 +1803,13 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
buffer.append('@').append(castingLength);
castExpression = buffer.toString();
}
-
+
// Surround the entire casted expression with parenthesis in case we are
// dealing with an array. Arrays must be parenthesized before they are
// subscripted. Note that we can be casting to an array or displaying
// as an array, so we must do this all the time.
castExpression = String.format("(%s)", castExpression); //$NON-NLS-1$
-
+
return new CastedExpressionDMC((MIExpressionDMC) exprDMC, castExpression, castInfo);
} else {
assert false;
@@ -1848,26 +1817,24 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
}
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.dsf.debug.service.IExpressions3#getExpressionDataExtension(org.eclipse.cdt.dsf.debug.service.IExpressions.IExpressionDMContext, org.eclipse.cdt.dsf.concurrent.DataRequestMonitor)
- */
- /** @since 4.0 */
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.dsf.debug.service.IExpressions3#getExpressionDataExtension(org.eclipse.cdt.dsf.debug.service.IExpressions.IExpressionDMContext, org.eclipse.cdt.dsf.concurrent.DataRequestMonitor)
+ */
+ /** @since 4.0 */
@Override
- public void getExpressionDataExtension(IExpressionDMContext dmc, final DataRequestMonitor<IExpressionDMDataExtension> rm) {
- getExpressionData(dmc, new DataRequestMonitor<IExpressionDMData>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- rm.setData((IExpressionDMDataExtension)getData());
- super.handleSuccess();
- }
- });
- }
-
- private IndexedPartitionDMC[] getTopLevelIndexedPartitions(
- MIExpressionDMC exprCtx,
- int realNumChildren,
- int startIndex,
- int length) {
+ public void getExpressionDataExtension(IExpressionDMContext dmc,
+ final DataRequestMonitor<IExpressionDMDataExtension> rm) {
+ getExpressionData(dmc, new DataRequestMonitor<IExpressionDMData>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ rm.setData((IExpressionDMDataExtension) getData());
+ super.handleSuccess();
+ }
+ });
+ }
+
+ private IndexedPartitionDMC[] getTopLevelIndexedPartitions(MIExpressionDMC exprCtx, int realNumChildren,
+ int startIndex, int length) {
int numChildren = computeNumberOfChildren(realNumChildren);
if (startIndex >= numChildren)
@@ -1879,26 +1846,20 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
int index = 0;
// If the parent array is a casted expression it could have a different
// start index. We want the partition to start at the right index, not always 0
-// if (exprCtx instanceof ICastedExpressionDMContext) {
-// index = ((ICastedExpressionDMContext)exprCtx).getCastInfo().getArrayStartIndex();
-// }
- for(int i = 0; i < children.length; ++i) {
+ // if (exprCtx instanceof ICastedExpressionDMContext) {
+ // index = ((ICastedExpressionDMContext)exprCtx).getCastInfo().getArrayStartIndex();
+ // }
+ for (int i = 0; i < children.length; ++i) {
int partLength = computePartitionLength(realNumChildren, i);
- children[i] = createIndexedPartition(
- exprCtx,
- index,
- partLength);
+ children[i] = createIndexedPartition(exprCtx, index, partLength);
index += partLength;
}
- return Arrays.copyOfRange(children, startIndex1, startIndex1 + length1 );
+ return Arrays.copyOfRange(children, startIndex1, startIndex1 + length1);
}
- private void getIndexedPartitionChildren(
- final IndexedPartitionDMC partDmc,
- final int startIndex,
- final int length,
+ private void getIndexedPartitionChildren(final IndexedPartitionDMC partDmc, final int startIndex, final int length,
final DataRequestMonitor<IExpressionDMContext[]> rm) {
-
+
final int startIndex1 = (startIndex < 0) ? 0 : startIndex;
final int length1 = (length < 0) ? Integer.MAX_VALUE : length;
@@ -1907,9 +1868,10 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
if (partLength > getArrayPartitionLength()) {
// create subpartitions
int numChildren = computeNumberOfChildren(partLength);
-
+
if (startIndex1 >= numChildren) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, "Invalid range for evaluating sub expressions.", null)); //$NON-NLS-1$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED,
+ "Invalid range for evaluating sub expressions.", null)); //$NON-NLS-1$
rm.done();
return;
}
@@ -1921,69 +1883,57 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
index += computePartitionLength(partLength, i);
for (int i = 0; i < children.length; ++i) {
int childPartLength = computePartitionLength(partLength, i + startIndex1);
- children[i] = createIndexedPartition(
- partDmc.getParentExpressionContext(),
- index,
- childPartLength);
+ children[i] = createIndexedPartition(partDmc.getParentExpressionContext(), index, childPartLength);
index += childPartLength;
}
rm.setData(children);
rm.done();
- }
- else {
+ } else {
// this is the last partition level, create "real" children
if (startIndex1 > partLength) {
rm.setData(new IExpressionDMContext[0]);
rm.done();
- }
- else {
- getRealSubExpressions(
- partDmc.getParentExpressionContext(),
- partStartIndex + startIndex1,
- Math.min(length1, partLength - startIndex1),
- rm);
+ } else {
+ getRealSubExpressions(partDmc.getParentExpressionContext(), partStartIndex + startIndex1,
+ Math.min(length1, partLength - startIndex1), rm);
}
}
}
- void getRealSubExpressions(
- final IExpressionDMContext exprCtx,
- int startIndex,
- int length,
+ void getRealSubExpressions(final IExpressionDMContext exprCtx, int startIndex, int length,
final DataRequestMonitor<IExpressionDMContext[]> rm) {
-
- ExprMetaGetChildren getChildren = (startIndex < 0 || length < 0) ?
- new ExprMetaGetChildren(exprCtx) : new ExprMetaGetChildren(exprCtx, startIndex + length);
+
+ ExprMetaGetChildren getChildren = (startIndex < 0 || length < 0) ? new ExprMetaGetChildren(exprCtx)
+ : new ExprMetaGetChildren(exprCtx, startIndex + length);
final int startIndex1 = (startIndex < 0) ? 0 : startIndex;
final int length1 = (length < 0) ? Integer.MAX_VALUE : length;
- fExpressionCache.execute(
- getChildren,
- new DataRequestMonitor<ExprMetaGetChildrenInfo>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- ExpressionInfo[] childrenExpr = getData().getChildrenExpressions();
+ fExpressionCache.execute(getChildren, new DataRequestMonitor<ExprMetaGetChildrenInfo>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ ExpressionInfo[] childrenExpr = getData().getChildrenExpressions();
- if (startIndex1 >= childrenExpr.length) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, "Invalid range for evaluating sub expressions.", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
+ if (startIndex1 >= childrenExpr.length) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED,
+ "Invalid range for evaluating sub expressions.", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
- int numChildren = childrenExpr.length - startIndex1;
- numChildren = Math.min(length1, numChildren);
- IExpressionDMContext[] childrenArray = new IExpressionDMContext[numChildren];
- for (int i=0; i < numChildren; i++) {
- childrenArray[i] = createExpression(exprCtx.getParents()[0], childrenExpr[startIndex1 + i]);
- }
- rm.setData(childrenArray);
- rm.done();
- }
- });
+ int numChildren = childrenExpr.length - startIndex1;
+ numChildren = Math.min(length1, numChildren);
+ IExpressionDMContext[] childrenArray = new IExpressionDMContext[numChildren];
+ for (int i = 0; i < numChildren; i++) {
+ childrenArray[i] = createExpression(exprCtx.getParents()[0], childrenExpr[startIndex1 + i]);
+ }
+ rm.setData(childrenArray);
+ rm.done();
+ }
+ });
}
/**
- * Returns the number of "real" children if it is less or equal to the partition size,
- * otherwise returns the number of partitions.
+ * Returns the number of "real" children if it is less or equal to the partition size,
+ * otherwise returns the number of partitions.
*/
private int computeNumberOfChildren(int realNumberOfChildren) {
int childNum = realNumberOfChildren;
@@ -1993,7 +1943,7 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
childNum /= partLength;
maxPartitionLength *= partLength;
}
- if (childNum*maxPartitionLength < realNumberOfChildren)
+ if (childNum * maxPartitionLength < realNumberOfChildren)
++childNum;
return childNum;
}
@@ -2009,18 +1959,18 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
length *= partLength;
++depth;
}
- int diff = realNumberOfChildren - length*index;
- return ( diff > length ) ? length : diff ;
+ int diff = realNumberOfChildren - length * index;
+ return (diff > length) ? length : diff;
}
private IndexedPartitionDMC createIndexedPartition(MIExpressionDMC parentExpr, int index, int length) {
return new IndexedPartitionDMC(parentExpr, index, length);
}
- private void getRealSubExpressionCount(IExpressionDMContext dmc, int numChildLimit, final DataRequestMonitor<Integer> rm) {
+ private void getRealSubExpressionCount(IExpressionDMContext dmc, int numChildLimit,
+ final DataRequestMonitor<Integer> rm) {
if (dmc instanceof MIExpressionDMC) {
- fExpressionCache.execute(
- new ExprMetaGetChildCount(dmc, numChildLimit),
+ fExpressionCache.execute(new ExprMetaGetChildCount(dmc, numChildLimit),
new DataRequestMonitor<ExprMetaGetChildCountInfo>(getExecutor(), rm) {
@Override
protected void handleSuccess() {
@@ -2029,10 +1979,12 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
}
});
} else if (dmc instanceof InvalidContextExpressionDMC) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid context for evaluating expressions.", null)); //$NON-NLS-1$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE,
+ "Invalid context for evaluating expressions.", null)); //$NON-NLS-1$
rm.done();
} else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid expression context.", null)); //$NON-NLS-1$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid expression context.", //$NON-NLS-1$
+ null));
rm.done();
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIFormat.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIFormat.java
index 5dfc7cebeff..f110daea7f7 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIFormat.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIFormat.java
@@ -21,92 +21,92 @@ import java.math.BigInteger;
* Help class to specify formats.
*/
public final class MIFormat {
- public final static int HEXADECIMAL = 0;
- public final static int OCTAL = 1;
- public final static int BINARY = 2;
- public final static int DECIMAL = 3;
- public final static int RAW = 4;
- public final static int NATURAL = 5;
+ public final static int HEXADECIMAL = 0;
+ public final static int OCTAL = 1;
+ public final static int BINARY = 2;
+ public final static int DECIMAL = 3;
+ public final static int RAW = 4;
+ public final static int NATURAL = 5;
- public final static int FLOAT = 10;
- public final static int ADDRESS = 11;
- public final static int INSTRUCTION = 12;
- public final static int CHAR = 13;
- public final static int STRING = 14;
- public final static int UNSIGNED = 15;
+ public final static int FLOAT = 10;
+ public final static int ADDRESS = 11;
+ public final static int INSTRUCTION = 12;
+ public final static int CHAR = 13;
+ public final static int STRING = 14;
+ public final static int UNSIGNED = 15;
- // no instanciation.
- private MIFormat() {
- }
+ // no instanciation.
+ private MIFormat() {
+ }
- /**
- * We are assuming that GDB will print the address in hex format
- * like:
- * 0xbfffe5f0 "hello"
- * (int *) 0xbfffe2b8
- *
- * @param buffer
- * @return
- */
- public static BigInteger decodeAdress(String buffer) {
- int radix = 10;
- int cursor = 0;
- int offset = 0;
- int len = buffer.length();
+ /**
+ * We are assuming that GDB will print the address in hex format
+ * like:
+ * 0xbfffe5f0 "hello"
+ * (int *) 0xbfffe2b8
+ *
+ * @param buffer
+ * @return
+ */
+ public static BigInteger decodeAdress(String buffer) {
+ int radix = 10;
+ int cursor = 0;
+ int offset = 0;
+ int len = buffer.length();
- if ((offset = buffer.indexOf("0x")) != -1 || //$NON-NLS-1$
- (offset = buffer.indexOf("0X")) != -1) { //$NON-NLS-1$
- radix = 16;
- cursor = offset + 2;
- }
+ if ((offset = buffer.indexOf("0x")) != -1 || //$NON-NLS-1$
+ (offset = buffer.indexOf("0X")) != -1) { //$NON-NLS-1$
+ radix = 16;
+ cursor = offset + 2;
+ }
- while (cursor < len && Character.digit(buffer.charAt(cursor), radix) != -1) {
- cursor++;
- }
+ while (cursor < len && Character.digit(buffer.charAt(cursor), radix) != -1) {
+ cursor++;
+ }
- String s = buffer.substring(offset, cursor);
- return getBigInteger(s);
- }
+ String s = buffer.substring(offset, cursor);
+ return getBigInteger(s);
+ }
- public static BigInteger getBigInteger(String address) {
- int index = 0;
- int radix = 10;
- boolean negative = false;
+ public static BigInteger getBigInteger(String address) {
+ int index = 0;
+ int radix = 10;
+ boolean negative = false;
- // Handle zero length
- address = address.trim();
- if (address.length() == 0) {
- return BigInteger.ZERO;
- }
+ // Handle zero length
+ address = address.trim();
+ if (address.length() == 0) {
+ return BigInteger.ZERO;
+ }
- // Handle minus sign, if present
- if (address.startsWith("-")) { //$NON-NLS-1$
- negative = true;
- index++;
- }
- if (address.startsWith("0x", index) || address.startsWith("0X", index)) { //$NON-NLS-1$ //$NON-NLS-2$
- index += 2;
- radix = 16;
- } else if (address.startsWith("#", index)) { //$NON-NLS-1$
- index ++;
- radix = 16;
- } else if (address.startsWith("0", index) && address.length() > 1 + index) { //$NON-NLS-1$
- index ++;
- radix = 8;
- }
+ // Handle minus sign, if present
+ if (address.startsWith("-")) { //$NON-NLS-1$
+ negative = true;
+ index++;
+ }
+ if (address.startsWith("0x", index) || address.startsWith("0X", index)) { //$NON-NLS-1$ //$NON-NLS-2$
+ index += 2;
+ radix = 16;
+ } else if (address.startsWith("#", index)) { //$NON-NLS-1$
+ index++;
+ radix = 16;
+ } else if (address.startsWith("0", index) && address.length() > 1 + index) { //$NON-NLS-1$
+ index++;
+ radix = 8;
+ }
- if (index > 0) {
- address = address.substring(index);
- }
- if (negative) {
- address = "-" + address; //$NON-NLS-1$
- }
- try {
- return new BigInteger(address, radix);
- } catch (NumberFormatException e) {
- // ...
- // What can we do ???
- }
- return BigInteger.ZERO;
- }
+ if (index > 0) {
+ address = address.substring(index);
+ }
+ if (negative) {
+ address = "-" + address; //$NON-NLS-1$
+ }
+ try {
+ return new BigInteger(address, radix);
+ } catch (NumberFormatException e) {
+ // ...
+ // What can we do ???
+ }
+ return BigInteger.ZERO;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIMemory.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIMemory.java
index e00d21453f9..52f90903777 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIMemory.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIMemory.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* Ericsson AB - expanded from initial stub
@@ -76,75 +76,73 @@ public class MIMemory extends AbstractDsfService implements IMemory, ICachingSer
private static final String READ_MEMORY_BYTES_FEATURE = "data-read-memory-bytes"; //$NON-NLS-1$
//data-read-memory write is deprecated, its description could be ambiguous for e.g. 16 bit addressable systems
private static final String DATA_WRITE_MEMORY_16_NOT_SUPPORTED = "data-write-memory with word-size != 1 not supported"; //$NON-NLS-1$
-
- public class MemoryChangedEvent extends AbstractDMEvent<IMemoryDMContext>
- implements IMemoryChangedEvent
- {
- private IAddress[] fAddresses;
-
- public MemoryChangedEvent(IMemoryDMContext context, IAddress[] addresses) {
- super(context);
- fAddresses = addresses;
- }
-
- @Override
- public IAddress[] getAddresses() {
- return fAddresses;
- }
- }
+
+ public class MemoryChangedEvent extends AbstractDMEvent<IMemoryDMContext> implements IMemoryChangedEvent {
+ private IAddress[] fAddresses;
+
+ public MemoryChangedEvent(IMemoryDMContext context, IAddress[] addresses) {
+ super(context);
+ fAddresses = addresses;
+ }
+
+ @Override
+ public IAddress[] getAddresses() {
+ return fAddresses;
+ }
+ }
// Back-end commands cache
private CommandCache fCommandCache;
private CommandFactory fCommandFactory;
// Map of memory caches
- private Map<IMemoryDMContext, MIMemoryCache> fMemoryCaches;
-
- /** @since 4.2 */
- protected MIMemoryCache getMemoryCache(IMemoryDMContext memoryDMC) {
- MIMemoryCache cache = fMemoryCaches.get(memoryDMC);
- if (cache == null) {
- cache = new MIMemoryCache();
- fMemoryCaches.put(memoryDMC, cache);
- }
- return cache;
- }
-
- // Whether the -data-read-memory-bytes should be used
- // instead of -data-read-memory
- private boolean fDataReadMemoryBytes;
-
+ private Map<IMemoryDMContext, MIMemoryCache> fMemoryCaches;
+
+ /** @since 4.2 */
+ protected MIMemoryCache getMemoryCache(IMemoryDMContext memoryDMC) {
+ MIMemoryCache cache = fMemoryCaches.get(memoryDMC);
+ if (cache == null) {
+ cache = new MIMemoryCache();
+ fMemoryCaches.put(memoryDMC, cache);
+ }
+ return cache;
+ }
+
+ // Whether the -data-read-memory-bytes should be used
+ // instead of -data-read-memory
+ private boolean fDataReadMemoryBytes;
+
/**
- * Constructor
+ * Constructor
*/
public MIMemory(DsfSession session) {
super(session);
- }
+ }
- ///////////////////////////////////////////////////////////////////////////
- // AbstractDsfService overrides
- ///////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////
+ // AbstractDsfService overrides
+ ///////////////////////////////////////////////////////////////////////////
/* (non-Javadoc)
* @see org.eclipse.cdt.dsf.service.AbstractDsfService#initialize(org.eclipse.cdt.dsf.concurrent.RequestMonitor)
*/
@Override
- public void initialize(final RequestMonitor requestMonitor) {
- super.initialize(new ImmediateRequestMonitor(requestMonitor) {
- @Override
- protected void handleSuccess() {
- doInitialize(requestMonitor);
- }
- });
- }
-
- private void doInitialize(final RequestMonitor requestMonitor) {
- IGDBControl commandControl = getServicesTracker().getService(IGDBControl.class);
- BufferedCommandControl bufferedCommandControl = new BufferedCommandControl(commandControl, getExecutor(), 2);
-
- fDataReadMemoryBytes = commandControl.getFeatures().contains(READ_MEMORY_BYTES_FEATURE);
-
- fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
+ public void initialize(final RequestMonitor requestMonitor) {
+ super.initialize(new ImmediateRequestMonitor(requestMonitor) {
+ @Override
+ protected void handleSuccess() {
+ doInitialize(requestMonitor);
+ }
+ });
+ }
+
+ private void doInitialize(final RequestMonitor requestMonitor) {
+ IGDBControl commandControl = getServicesTracker().getService(IGDBControl.class);
+ BufferedCommandControl bufferedCommandControl = new BufferedCommandControl(commandControl, getExecutor(), 2);
+
+ fDataReadMemoryBytes = commandControl.getFeatures().contains(READ_MEMORY_BYTES_FEATURE);
+
+ fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
// This cache stores the result of a command when received; also, this cache
// is manipulated when receiving events. Currently, events are received after
@@ -154,223 +152,231 @@ public class MIMemory extends AbstractDsfService implements IMemory, ICachingSer
// To solve this, we use a bufferedCommandControl that will delay the command
// result by two scheduling of the executor.
// See bug 280461
- fCommandCache = new CommandCache(getSession(), bufferedCommandControl);
- fCommandCache.setContextAvailable(commandControl.getContext(), true);
+ fCommandCache = new CommandCache(getSession(), bufferedCommandControl);
+ fCommandCache.setContextAvailable(commandControl.getContext(), true);
- register(new String[] { MIMemory.class.getName(), IMemory.class.getName() }, new Hashtable<String, String>());
+ register(new String[] { MIMemory.class.getName(), IMemory.class.getName() }, new Hashtable<String, String>());
- fMemoryCaches = new HashMap<IMemoryDMContext, MIMemoryCache>();
+ fMemoryCaches = new HashMap<IMemoryDMContext, MIMemoryCache>();
- getSession().addServiceEventListener(this, null);
+ getSession().addServiceEventListener(this, null);
- requestMonitor.done();
- }
+ requestMonitor.done();
+ }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.dsf.service.AbstractDsfService#shutdown(org.eclipse.cdt.dsf.concurrent.RequestMonitor)
- */
- @Override
- public void shutdown(final RequestMonitor requestMonitor) {
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.dsf.service.AbstractDsfService#shutdown(org.eclipse.cdt.dsf.concurrent.RequestMonitor)
+ */
+ @Override
+ public void shutdown(final RequestMonitor requestMonitor) {
- unregister();
+ unregister();
- getSession().removeServiceEventListener(this);
+ getSession().removeServiceEventListener(this);
- super.shutdown(requestMonitor);
- }
+ super.shutdown(requestMonitor);
+ }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.dsf.service.AbstractDsfService#getBundleContext()
- */
- @Override
- protected BundleContext getBundleContext() {
- return GdbPlugin.getBundleContext();
- }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.dsf.service.AbstractDsfService#getBundleContext()
+ */
+ @Override
+ protected BundleContext getBundleContext() {
+ return GdbPlugin.getBundleContext();
+ }
- ///////////////////////////////////////////////////////////////////////////
- // IMemory
- ///////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////
+ // IMemory
+ ///////////////////////////////////////////////////////////////////////////
- /* (non-Javadoc)
- * @see org.eclipse.cdt.dsf.debug.service.IMemory#getMemory(org.eclipse.cdt.dsf.datamodel.IDMContext, org.eclipse.cdt.core.IAddress, long, int, org.eclipse.cdt.dsf.concurrent.DataRequestMonitor)
- */
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.dsf.debug.service.IMemory#getMemory(org.eclipse.cdt.dsf.datamodel.IDMContext, org.eclipse.cdt.core.IAddress, long, int, org.eclipse.cdt.dsf.concurrent.DataRequestMonitor)
+ */
@Override
- public void getMemory(IMemoryDMContext memoryDMC, IAddress address, long offset,
- int wordSize, int wordCount, DataRequestMonitor<MemoryByte[]> drm)
- {
- if (memoryDMC == null) {
- drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Unknown context type", null)); //$NON-NLS-1$);
- drm.done();
- return;
- }
-
- if (wordSize < 1) {
- drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Word size not supported (< 1)", null)); //$NON-NLS-1$
- drm.done();
- return;
- }
-
- if (wordCount < 0) {
- drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR, "Invalid word count (< 0)", null)); //$NON-NLS-1$
- drm.done();
- return;
- }
-
- getMemoryCache(memoryDMC).getMemory(memoryDMC, address.add(offset), wordSize, wordCount, drm);
+ public void getMemory(IMemoryDMContext memoryDMC, IAddress address, long offset, int wordSize, int wordCount,
+ DataRequestMonitor<MemoryByte[]> drm) {
+ if (memoryDMC == null) {
+ drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Unknown context type", null)); //$NON-NLS-1$);
+ drm.done();
+ return;
+ }
+
+ if (wordSize < 1) {
+ drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Word size not supported (< 1)", //$NON-NLS-1$
+ null));
+ drm.done();
+ return;
+ }
+
+ if (wordCount < 0) {
+ drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR,
+ "Invalid word count (< 0)", null)); //$NON-NLS-1$
+ drm.done();
+ return;
+ }
+
+ getMemoryCache(memoryDMC).getMemory(memoryDMC, address.add(offset), wordSize, wordCount, drm);
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.dsf.debug.service.IMemory#setMemory(org.eclipse.cdt.dsf.datamodel.IDMContext, org.eclipse.cdt.core.IAddress, long, int, byte[], org.eclipse.cdt.dsf.concurrent.RequestMonitor)
- */
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.dsf.debug.service.IMemory#setMemory(org.eclipse.cdt.dsf.datamodel.IDMContext, org.eclipse.cdt.core.IAddress, long, int, byte[], org.eclipse.cdt.dsf.concurrent.RequestMonitor)
+ */
@Override
- public void setMemory(IMemoryDMContext memoryDMC, IAddress address, long offset,
- int wordSize, int wordCount, byte[] buffer, RequestMonitor rm)
- {
- if (memoryDMC == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Unknown context type", null)); //$NON-NLS-1$);
- rm.done();
- return;
- }
-
- if (wordSize < 1) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Word size not supported (< 1)", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- if (wordCount < 0) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR, "Invalid word count (< 0)", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- if (buffer.length < wordCount * wordSize) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR, "Buffer too short", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- getMemoryCache(memoryDMC).setMemory(memoryDMC, address, offset, wordSize, wordCount, buffer, rm);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.dsf.debug.service.IMemory#fillMemory(org.eclipse.cdt.dsf.datamodel.IDMContext, org.eclipse.cdt.core.IAddress, long, int, byte[], org.eclipse.cdt.dsf.concurrent.RequestMonitor)
- */
+ public void setMemory(IMemoryDMContext memoryDMC, IAddress address, long offset, int wordSize, int wordCount,
+ byte[] buffer, RequestMonitor rm) {
+ if (memoryDMC == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Unknown context type", null)); //$NON-NLS-1$);
+ rm.done();
+ return;
+ }
+
+ if (wordSize < 1) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Word size not supported (< 1)", //$NON-NLS-1$
+ null));
+ rm.done();
+ return;
+ }
+
+ if (wordCount < 0) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR,
+ "Invalid word count (< 0)", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ if (buffer.length < wordCount * wordSize) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR,
+ "Buffer too short", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ getMemoryCache(memoryDMC).setMemory(memoryDMC, address, offset, wordSize, wordCount, buffer, rm);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.dsf.debug.service.IMemory#fillMemory(org.eclipse.cdt.dsf.datamodel.IDMContext, org.eclipse.cdt.core.IAddress, long, int, byte[], org.eclipse.cdt.dsf.concurrent.RequestMonitor)
+ */
@Override
- public void fillMemory(IMemoryDMContext memoryDMC, IAddress address, long offset,
- int wordSize, int count, byte[] pattern, RequestMonitor rm)
- {
- if (memoryDMC == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Unknown context type", null)); //$NON-NLS-1$);
- rm.done();
- return;
- }
-
- if (wordSize < 1) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Word size not supported (< 1)", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- if (count < 0) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR, "Invalid repeat count (< 0)", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- if (pattern.length < 1) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR, "Empty pattern", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- // Create an aggregate buffer so we can write in 1 shot
- int length = pattern.length;
- byte[] buffer = new byte[count * length];
- for (int i = 0; i < count; i++) {
- System.arraycopy(pattern, 0, buffer, i * length, length);
- }
-
- int word_count = buffer.length / wordSize;
- if (buffer.length % wordSize != 0) {
- word_count ++;
- }
-
- // All is clear: go for it
- getMemoryCache(memoryDMC).setMemory(memoryDMC, address, offset, wordSize, word_count, buffer, rm);
- }
-
- ///////////////////////////////////////////////////////////////////////
- // Back-end functions
- ///////////////////////////////////////////////////////////////////////
-
- /**
- * @param memoryDMC
- * @param address
- * @param offset
- * @param wordSize
- * @param wordCount in addressable units
- * @param drm
- *
- * @since 1.1
- */
- protected void readMemoryBlock(IDMContext dmc, IAddress address, final long offset,
- final int wordSize, final int wordCount, final DataRequestMonitor<MemoryByte[]> drm)
- {
- if (fDataReadMemoryBytes) {
- fCommandCache.execute(
- fCommandFactory.createMIDataReadMemoryBytes(dmc, address.toString(), offset, wordCount, wordSize),
- new DataRequestMonitor<MIDataReadMemoryBytesInfo>(getExecutor(), drm) {
- @Override
- protected void handleSuccess() {
- // Retrieve the memory block
- drm.setData(getData().getMIMemoryBlock());
- drm.done();
- }
- @Override
- protected void handleFailure() {
- drm.setData(createInvalidBlock(wordSize * wordCount));
- drm.done();
- }
- });
- } else {
- if (wordSize != 1) {
- //The word-size is specified within the resulting command data-read-memory
- //The word-size is defined in bytes although in the MI interface it's not clear if the meaning is
- //octets or system dependent bytes (minimum addressable memory).
- //As this command is deprecated there is no good reason to augment the support for word sizes != 1
- drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, DATA_WRITE_MEMORY_16_NOT_SUPPORTED, null));
- drm.done();
- return;
- }
-
- /* To simplify the parsing of the MI result, we request the output to
- * be on 1 row of [count] columns, no char interpretation.
- */
- int mode = MIFormat.HEXADECIMAL;
- int nbRows = 1;
- int nbCols = wordCount;
- Character asChar = null;
-
- fCommandCache.execute(
- fCommandFactory.createMIDataReadMemory(dmc, offset, address.toString(), mode, wordSize, nbRows, nbCols, asChar),
- new DataRequestMonitor<MIDataReadMemoryInfo>(getExecutor(), drm) {
- @Override
- protected void handleSuccess() {
- // Retrieve the memory block
- drm.setData(getData().getMIMemoryBlock());
- drm.done();
- }
- @Override
- protected void handleFailure() {
- drm.setData(createInvalidBlock(wordSize * wordCount));
- drm.done();
- }
- }
- );
- }
- }
-
+ public void fillMemory(IMemoryDMContext memoryDMC, IAddress address, long offset, int wordSize, int count,
+ byte[] pattern, RequestMonitor rm) {
+ if (memoryDMC == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Unknown context type", null)); //$NON-NLS-1$);
+ rm.done();
+ return;
+ }
+
+ if (wordSize < 1) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Word size not supported (< 1)", //$NON-NLS-1$
+ null));
+ rm.done();
+ return;
+ }
+
+ if (count < 0) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR,
+ "Invalid repeat count (< 0)", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ if (pattern.length < 1) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR,
+ "Empty pattern", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ // Create an aggregate buffer so we can write in 1 shot
+ int length = pattern.length;
+ byte[] buffer = new byte[count * length];
+ for (int i = 0; i < count; i++) {
+ System.arraycopy(pattern, 0, buffer, i * length, length);
+ }
+
+ int word_count = buffer.length / wordSize;
+ if (buffer.length % wordSize != 0) {
+ word_count++;
+ }
+
+ // All is clear: go for it
+ getMemoryCache(memoryDMC).setMemory(memoryDMC, address, offset, wordSize, word_count, buffer, rm);
+ }
+
+ ///////////////////////////////////////////////////////////////////////
+ // Back-end functions
+ ///////////////////////////////////////////////////////////////////////
+
+ /**
+ * @param memoryDMC
+ * @param address
+ * @param offset
+ * @param wordSize
+ * @param wordCount in addressable units
+ * @param drm
+ *
+ * @since 1.1
+ */
+ protected void readMemoryBlock(IDMContext dmc, IAddress address, final long offset, final int wordSize,
+ final int wordCount, final DataRequestMonitor<MemoryByte[]> drm) {
+ if (fDataReadMemoryBytes) {
+ fCommandCache.execute(
+ fCommandFactory.createMIDataReadMemoryBytes(dmc, address.toString(), offset, wordCount, wordSize),
+ new DataRequestMonitor<MIDataReadMemoryBytesInfo>(getExecutor(), drm) {
+ @Override
+ protected void handleSuccess() {
+ // Retrieve the memory block
+ drm.setData(getData().getMIMemoryBlock());
+ drm.done();
+ }
+
+ @Override
+ protected void handleFailure() {
+ drm.setData(createInvalidBlock(wordSize * wordCount));
+ drm.done();
+ }
+ });
+ } else {
+ if (wordSize != 1) {
+ //The word-size is specified within the resulting command data-read-memory
+ //The word-size is defined in bytes although in the MI interface it's not clear if the meaning is
+ //octets or system dependent bytes (minimum addressable memory).
+ //As this command is deprecated there is no good reason to augment the support for word sizes != 1
+ drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED,
+ DATA_WRITE_MEMORY_16_NOT_SUPPORTED, null));
+ drm.done();
+ return;
+ }
+
+ /* To simplify the parsing of the MI result, we request the output to
+ * be on 1 row of [count] columns, no char interpretation.
+ */
+ int mode = MIFormat.HEXADECIMAL;
+ int nbRows = 1;
+ int nbCols = wordCount;
+ Character asChar = null;
+
+ fCommandCache
+ .execute(
+ fCommandFactory.createMIDataReadMemory(dmc, offset, address.toString(), mode, wordSize,
+ nbRows, nbCols, asChar),
+ new DataRequestMonitor<MIDataReadMemoryInfo>(getExecutor(), drm) {
+ @Override
+ protected void handleSuccess() {
+ // Retrieve the memory block
+ drm.setData(getData().getMIMemoryBlock());
+ drm.done();
+ }
+
+ @Override
+ protected void handleFailure() {
+ drm.setData(createInvalidBlock(wordSize * wordCount));
+ drm.done();
+ }
+ });
+ }
+ }
+
private MemoryByte[] createInvalidBlock(int size) {
// Bug234289: If memory read fails, return a block marked as invalid
MemoryByte[] block = new MemoryByte[size];
@@ -380,139 +386,140 @@ public class MIMemory extends AbstractDsfService implements IMemory, ICachingSer
return block;
}
- /**
- * @param memoryDMC
- * @param address
- * @param offset
- * @param wordSize
- * @param wordCount in addressable units
- * @param buffer
- * @param rm
- *
- * @since 1.1
- */
- protected void writeMemoryBlock(final IDMContext dmc, final IAddress address, final long offset,
- final int wordSize, final int wordCount, final byte[] buffer, final RequestMonitor rm)
- {
- if (fDataReadMemoryBytes) {
- // Use -data-write-memory-bytes for performance,
- fCommandCache.execute(
- fCommandFactory.createMIDataWriteMemoryBytes(dmc, address.add(offset).toString(),
- (buffer.length == wordCount*wordSize) ? buffer : Arrays.copyOf(buffer, wordCount*wordSize)),
- new DataRequestMonitor<MIInfo>(getExecutor(), rm)
- );
- } else {
- if (wordSize != 1) {
- //The word-size is specified within the resulting command data-write-memory
- //The word-size is defined in bytes although in the MI interface it's not clear if the meaning is
- //octets or system dependent bytes (minimum addressable memory).
- //As this command is deprecated there is no good reason to augment the support for word sizes != 1
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, DATA_WRITE_MEMORY_16_NOT_SUPPORTED, null));
- rm.done();
- return;
- }
-
- // Each byte is written individually (GDB power...)
- // so we need to keep track of the count
- final CountingRequestMonitor countingRM = new CountingRequestMonitor(getExecutor(), rm);
- countingRM.setDoneCount(wordCount);
-
- // We will format the individual bytes in decimal
- int format = MIFormat.DECIMAL;
- String baseAddress = address.toString();
-
- // Issue an MI request for each byte to write
- for (int i = 0; i < wordCount; i++) {
- String value = Byte.toString(buffer[i]);
- fCommandCache.execute(
- fCommandFactory.createMIDataWriteMemory(dmc, offset + i, baseAddress, format, wordSize, value),
- new DataRequestMonitor<MIDataWriteMemoryInfo>(getExecutor(), countingRM)
- );
- }
- }
- }
-
- //////////////////////////////////////////////////////////////////////////
- // Event handlers
- //////////////////////////////////////////////////////////////////////////
- @DsfServiceEventHandler
+ /**
+ * @param memoryDMC
+ * @param address
+ * @param offset
+ * @param wordSize
+ * @param wordCount in addressable units
+ * @param buffer
+ * @param rm
+ *
+ * @since 1.1
+ */
+ protected void writeMemoryBlock(final IDMContext dmc, final IAddress address, final long offset, final int wordSize,
+ final int wordCount, final byte[] buffer, final RequestMonitor rm) {
+ if (fDataReadMemoryBytes) {
+ // Use -data-write-memory-bytes for performance,
+ fCommandCache.execute(
+ fCommandFactory.createMIDataWriteMemoryBytes(dmc, address.add(offset).toString(),
+ (buffer.length == wordCount * wordSize) ? buffer
+ : Arrays.copyOf(buffer, wordCount * wordSize)),
+ new DataRequestMonitor<MIInfo>(getExecutor(), rm));
+ } else {
+ if (wordSize != 1) {
+ //The word-size is specified within the resulting command data-write-memory
+ //The word-size is defined in bytes although in the MI interface it's not clear if the meaning is
+ //octets or system dependent bytes (minimum addressable memory).
+ //As this command is deprecated there is no good reason to augment the support for word sizes != 1
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED,
+ DATA_WRITE_MEMORY_16_NOT_SUPPORTED, null));
+ rm.done();
+ return;
+ }
+
+ // Each byte is written individually (GDB power...)
+ // so we need to keep track of the count
+ final CountingRequestMonitor countingRM = new CountingRequestMonitor(getExecutor(), rm);
+ countingRM.setDoneCount(wordCount);
+
+ // We will format the individual bytes in decimal
+ int format = MIFormat.DECIMAL;
+ String baseAddress = address.toString();
+
+ // Issue an MI request for each byte to write
+ for (int i = 0; i < wordCount; i++) {
+ String value = Byte.toString(buffer[i]);
+ fCommandCache.execute(
+ fCommandFactory.createMIDataWriteMemory(dmc, offset + i, baseAddress, format, wordSize, value),
+ new DataRequestMonitor<MIDataWriteMemoryInfo>(getExecutor(), countingRM));
+ }
+ }
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Event handlers
+ //////////////////////////////////////////////////////////////////////////
+ @DsfServiceEventHandler
public void eventDispatched(IResumedDMEvent e) {
- if (e instanceof IContainerResumedDMEvent) {
- fCommandCache.setContextAvailable(e.getDMContext(), false);
- }
-
- if (e.getReason() != StateChangeReason.STEP) {
- IMemoryDMContext memoryDMC = DMContexts.getAncestorOfType(e.getDMContext(), IMemoryDMContext.class);
- // It is the memory context we want to clear, not only the context that resumed. The resumed context
- // is probably a thread but that running thread could have changed any memory within the memory
- // context.
- if (memoryDMC != null) {
- fCommandCache.reset(memoryDMC);
-
- memoryCacheReset(memoryDMC);
- }
- }
+ if (e instanceof IContainerResumedDMEvent) {
+ fCommandCache.setContextAvailable(e.getDMContext(), false);
+ }
+
+ if (e.getReason() != StateChangeReason.STEP) {
+ IMemoryDMContext memoryDMC = DMContexts.getAncestorOfType(e.getDMContext(), IMemoryDMContext.class);
+ // It is the memory context we want to clear, not only the context that resumed. The resumed context
+ // is probably a thread but that running thread could have changed any memory within the memory
+ // context.
+ if (memoryDMC != null) {
+ fCommandCache.reset(memoryDMC);
+
+ memoryCacheReset(memoryDMC);
+ }
+ }
}
-
- @DsfServiceEventHandler
+
+ @DsfServiceEventHandler
public void eventDispatched(ISuspendedDMEvent e) {
- if (e instanceof IContainerSuspendedDMEvent) {
- fCommandCache.setContextAvailable(e.getDMContext(), true);
- }
-
- IMemoryDMContext memoryDMC = DMContexts.getAncestorOfType(e.getDMContext(), IMemoryDMContext.class);
- // It is the memory context we want to clear, not only the context that stopped. The stopped context
- // is probably a thread but that thread that ran could have changed any memory within the memory
- // context.
- if (memoryDMC != null) {
- fCommandCache.reset(memoryDMC);
-
- memoryCacheReset(memoryDMC);
- }
+ if (e instanceof IContainerSuspendedDMEvent) {
+ fCommandCache.setContextAvailable(e.getDMContext(), true);
+ }
+
+ IMemoryDMContext memoryDMC = DMContexts.getAncestorOfType(e.getDMContext(), IMemoryDMContext.class);
+ // It is the memory context we want to clear, not only the context that stopped. The stopped context
+ // is probably a thread but that thread that ran could have changed any memory within the memory
+ // context.
+ if (memoryDMC != null) {
+ fCommandCache.reset(memoryDMC);
+
+ memoryCacheReset(memoryDMC);
+ }
}
/**
* @deprecated Replaced by the generic {@link #eventDispatched(IExpressionChangedDMEvent)}
*/
- @Deprecated
+ @Deprecated
public void eventDispatched(ExpressionChangedEvent e) {
- }
+ }
- /**
- * @noreference This method is not intended to be referenced by clients.
- * @since 4.2
- */
- @DsfServiceEventHandler
- public void eventDispatched(IExpressionChangedDMEvent e) {
+ /**
+ * @noreference This method is not intended to be referenced by clients.
+ * @since 4.2
+ */
+ @DsfServiceEventHandler
+ public void eventDispatched(IExpressionChangedDMEvent e) {
- // Get the context and expression service handle
- final IExpressionDMContext context = e.getDMContext();
+ // Get the context and expression service handle
+ final IExpressionDMContext context = e.getDMContext();
IExpressions expressionService = getServicesTracker().getService(IExpressions.class);
// Get the variable information and update the corresponding memory locations
if (expressionService != null) {
expressionService.getExpressionAddressData(context,
- new DataRequestMonitor<IExpressionDMAddress>(getExecutor(), null) {
- @Override
- protected void handleSuccess() {
- // Figure out which memory area was modified
- IExpressionDMAddress expression = getData();
- IAddress expAddress = expression.getAddress();
- if (expAddress != IExpressions.IExpressionDMLocation.INVALID_ADDRESS) {
- final int count = expression.getSize();
- final Addr64 address;
- if (expAddress instanceof Addr64) {
- address = (Addr64) expAddress;
- } else {
- address = new Addr64(expAddress.getValue());
+ new DataRequestMonitor<IExpressionDMAddress>(getExecutor(), null) {
+ @Override
+ protected void handleSuccess() {
+ // Figure out which memory area was modified
+ IExpressionDMAddress expression = getData();
+ IAddress expAddress = expression.getAddress();
+ if (expAddress != IExpressions.IExpressionDMLocation.INVALID_ADDRESS) {
+ final int count = expression.getSize();
+ final Addr64 address;
+ if (expAddress instanceof Addr64) {
+ address = (Addr64) expAddress;
+ } else {
+ address = new Addr64(expAddress.getValue());
+ }
+
+ final IMemoryDMContext memoryDMC = DMContexts.getAncestorOfType(context,
+ IMemoryDMContext.class);
+ getMemoryCache(memoryDMC).refreshMemory(memoryDMC, address, 0,
+ getAddressableSize(memoryDMC), count, true,
+ new RequestMonitor(getExecutor(), null));
}
-
- final IMemoryDMContext memoryDMC = DMContexts.getAncestorOfType(context, IMemoryDMContext.class);
- getMemoryCache(memoryDMC).refreshMemory(memoryDMC, address, 0, getAddressableSize(memoryDMC), count, true,
- new RequestMonitor(getExecutor(), null));
}
- }
- });
+ });
}
}
@@ -523,18 +530,19 @@ public class MIMemory extends AbstractDsfService implements IMemory, ICachingSer
protected int getAddressableSize(IMemoryDMContext context) {
return 1;
}
-
+
///////////////////////////////////////////////////////////////////////////
// SortedLinkedlist
///////////////////////////////////////////////////////////////////////////
// This class is really the equivalent of a C struct (old habits die hard...)
- // For simplicity, everything is public.
- private static class MemoryBlock {
+ // For simplicity, everything is public.
+ private static class MemoryBlock {
public IAddress fAddress;
public long fLengthInAddressableUnits;
public long fLengthInOctets;
public MemoryByte[] fBlock;
+
public MemoryBlock(IAddress address, long lengthInOctets, long lengthInAddressableUnits, MemoryByte[] block) {
// A memory block is expected to be populated with the contents of a defined range of addresses
// therefore the number of octets shall be divisible by the number of addresses
@@ -546,8 +554,8 @@ public class MIMemory extends AbstractDsfService implements IMemory, ICachingSer
}
}
- // Address-ordered data structure to cache the memory blocks.
- // Contiguous blocks are merged if possible.
+ // Address-ordered data structure to cache the memory blocks.
+ // Contiguous blocks are merged if possible.
@SuppressWarnings("serial")
private static class SortedMemoryBlockList extends LinkedList<MemoryBlock> {
@@ -579,7 +587,7 @@ public class MIMemory extends AbstractDsfService implements IMemory, ICachingSer
}
}
- // Put at the end of the list and merge if necessary
+ // Put at the end of the list and merge if necessary
addLast(block);
compact(size() - 1);
return true;
@@ -589,7 +597,7 @@ public class MIMemory extends AbstractDsfService implements IMemory, ICachingSer
// Note: Merge is not performed if resulting block size would exceed MAXINT
private void compact(int index) {
- MemoryBlock newBlock = get(index);
+ MemoryBlock newBlock = get(index);
// Case where the block is to be merged with the previous block
if (index > 0) {
@@ -597,12 +605,15 @@ public class MIMemory extends AbstractDsfService implements IMemory, ICachingSer
IAddress endOfPreviousBlock = prevBlock.fAddress.add(prevBlock.fLengthInAddressableUnits);
if (endOfPreviousBlock.distanceTo(newBlock.fAddress).longValue() == 0) {
long newLengthInOctets = prevBlock.fLengthInOctets + newBlock.fLengthInOctets;
- long newLengthInAddressableUnits = prevBlock.fLengthInAddressableUnits + newBlock.fLengthInAddressableUnits;
+ long newLengthInAddressableUnits = prevBlock.fLengthInAddressableUnits
+ + newBlock.fLengthInAddressableUnits;
if (newLengthInOctets <= Integer.MAX_VALUE) {
- MemoryByte[] block = new MemoryByte[(int) newLengthInOctets] ;
+ MemoryByte[] block = new MemoryByte[(int) newLengthInOctets];
System.arraycopy(prevBlock.fBlock, 0, block, 0, (int) prevBlock.fLengthInOctets);
- System.arraycopy(newBlock.fBlock, 0, block, (int) prevBlock.fLengthInOctets, (int) newBlock.fLengthInOctets);
- newBlock = new MemoryBlock(prevBlock.fAddress, newLengthInOctets, newLengthInAddressableUnits, block);
+ System.arraycopy(newBlock.fBlock, 0, block, (int) prevBlock.fLengthInOctets,
+ (int) newBlock.fLengthInOctets);
+ newBlock = new MemoryBlock(prevBlock.fAddress, newLengthInOctets, newLengthInAddressableUnits,
+ block);
remove(index);
index -= 1;
set(index, newBlock);
@@ -619,9 +630,10 @@ public class MIMemory extends AbstractDsfService implements IMemory, ICachingSer
long newLength = newBlock.fLengthInOctets + nextBlock.fLengthInOctets;
long newAddressesLength = newBlock.fLengthInAddressableUnits + nextBlock.fLengthInAddressableUnits;
if (newLength <= Integer.MAX_VALUE) {
- MemoryByte[] block = new MemoryByte[(int) newLength] ;
+ MemoryByte[] block = new MemoryByte[(int) newLength];
System.arraycopy(newBlock.fBlock, 0, block, 0, (int) newBlock.fLengthInOctets);
- System.arraycopy(nextBlock.fBlock, 0, block, (int) newBlock.fLengthInOctets, (int) nextBlock.fLengthInOctets);
+ System.arraycopy(nextBlock.fBlock, 0, block, (int) newBlock.fLengthInOctets,
+ (int) nextBlock.fLengthInOctets);
newBlock = new MemoryBlock(newBlock.fAddress, newLength, newAddressesLength, block);
set(index, newBlock);
remove(index + 1);
@@ -641,74 +653,74 @@ public class MIMemory extends AbstractDsfService implements IMemory, ICachingSer
private SortedMemoryBlockList fMemoryBlockList;
public MIMemoryCache() {
- // Create the memory block cache
- fMemoryBlockList = new SortedMemoryBlockList();
+ // Create the memory block cache
+ fMemoryBlockList = new SortedMemoryBlockList();
}
public void reset() {
- // Clear the memory cache
- fMemoryBlockList.clear();
+ // Clear the memory cache
+ fMemoryBlockList.clear();
}
- /**
- * This function walks the address-sorted memory block list to identify
- * the 'missing' blocks (i.e. the holes) that need to be fetched on the target.
- *
- * The idea is fairly simple but an illustration could perhaps help.
- * Assume the cache holds a number of cached memory blocks with gaps i.e.
- * there is un-cached memory areas between blocks A, B and C:
- *
- * +---------+ +---------+ +---------+
- * + A + + B + + C +
- * +---------+ +---------+ +---------+
- * : : : : : :
- * [a] : : [b] : : [c] : : [d]
- * : : : : : :
- * [e---+--] : [f--+---------+--] : :
- * [g---+---------+------+---------+------+---------+----]
- * : : : : : :
- * : [h] : : [i----+--] : :
- *
- *
- * We have the following cases to consider.The requested block [a-i] either:
- *
- * [1] Fits entirely before A, in one of the gaps, or after C
- * with no overlap and no contiguousness (e.g. [a], [b], [c] and [d])
- * -> Add the requested block to the list of blocks to fetch
- *
- * [2] Starts before an existing block but overlaps part of it, possibly
- * spilling in the gap following the cached block (e.g. [e], [f] and [g])
- * -> Determine the length of the missing part (< count)
- * -> Add a request to fill the gap before the existing block
- * -> Update the requested block for the next iteration:
- * - Start address to point just after the end of the cached block
- * - Count reduced by cached block length (possibly becoming negative, e.g. [e])
- * At this point, the updated requested block starts just beyond the cached block
- * for the next iteration.
- *
- * [3] Starts at or into an existing block and overlaps part of it ([h] and [i])
- * -> Update the requested block for the next iteration:
- * - Start address to point just after the end of the cached block
- * - Count reduced by length to end of cached block (possibly becoming negative, e.g. [h])
- * At this point, the updated requested block starts just beyond the cached block
- * for the next iteration.
- *
- * We iterate over the cached blocks list until there is no entry left or until
- * the remaining requested block count is <= 0, meaning the result list contains
- * only the sub-blocks needed to fill the gap(s), if any.
- *
- * (As is often the case, it takes much more typing to explain it than to just do it :-)
- *
- * What is missing is a parameter that indicates the minimal block size that is worth fetching.
- * This is target-specific and straight in the realm of the coalescing function...
- *
- * @param reqBlockStart The address of the requested block
- * @param count Its length
- * @return A list of the sub-blocks to fetch in order to fill enough gaps in the memory cache
- * to service the request
- */
- private List<MemoryBlock> getListOfMissingBlocks(IAddress reqBlockStart, int wordCount, int wordSize) {
- int octetCount = wordCount * wordSize;
+ /**
+ * This function walks the address-sorted memory block list to identify
+ * the 'missing' blocks (i.e. the holes) that need to be fetched on the target.
+ *
+ * The idea is fairly simple but an illustration could perhaps help.
+ * Assume the cache holds a number of cached memory blocks with gaps i.e.
+ * there is un-cached memory areas between blocks A, B and C:
+ *
+ * +---------+ +---------+ +---------+
+ * + A + + B + + C +
+ * +---------+ +---------+ +---------+
+ * : : : : : :
+ * [a] : : [b] : : [c] : : [d]
+ * : : : : : :
+ * [e---+--] : [f--+---------+--] : :
+ * [g---+---------+------+---------+------+---------+----]
+ * : : : : : :
+ * : [h] : : [i----+--] : :
+ *
+ *
+ * We have the following cases to consider.The requested block [a-i] either:
+ *
+ * [1] Fits entirely before A, in one of the gaps, or after C
+ * with no overlap and no contiguousness (e.g. [a], [b], [c] and [d])
+ * -> Add the requested block to the list of blocks to fetch
+ *
+ * [2] Starts before an existing block but overlaps part of it, possibly
+ * spilling in the gap following the cached block (e.g. [e], [f] and [g])
+ * -> Determine the length of the missing part (< count)
+ * -> Add a request to fill the gap before the existing block
+ * -> Update the requested block for the next iteration:
+ * - Start address to point just after the end of the cached block
+ * - Count reduced by cached block length (possibly becoming negative, e.g. [e])
+ * At this point, the updated requested block starts just beyond the cached block
+ * for the next iteration.
+ *
+ * [3] Starts at or into an existing block and overlaps part of it ([h] and [i])
+ * -> Update the requested block for the next iteration:
+ * - Start address to point just after the end of the cached block
+ * - Count reduced by length to end of cached block (possibly becoming negative, e.g. [h])
+ * At this point, the updated requested block starts just beyond the cached block
+ * for the next iteration.
+ *
+ * We iterate over the cached blocks list until there is no entry left or until
+ * the remaining requested block count is <= 0, meaning the result list contains
+ * only the sub-blocks needed to fill the gap(s), if any.
+ *
+ * (As is often the case, it takes much more typing to explain it than to just do it :-)
+ *
+ * What is missing is a parameter that indicates the minimal block size that is worth fetching.
+ * This is target-specific and straight in the realm of the coalescing function...
+ *
+ * @param reqBlockStart The address of the requested block
+ * @param count Its length
+ * @return A list of the sub-blocks to fetch in order to fill enough gaps in the memory cache
+ * to service the request
+ */
+ private List<MemoryBlock> getListOfMissingBlocks(IAddress reqBlockStart, int wordCount, int wordSize) {
+ int octetCount = wordCount * wordSize;
LinkedList<MemoryBlock> list = new LinkedList<MemoryBlock>();
ListIterator<MemoryBlock> it = fMemoryBlockList.listIterator();
@@ -717,15 +729,17 @@ public class MIMemory extends AbstractDsfService implements IMemory, ICachingSer
while (it.hasNext() && octetCount > 0) {
MemoryBlock cachedBlock = it.next();
IAddress cachedBlockStart = cachedBlock.fAddress;
- IAddress cachedBlockEnd = cachedBlock.fAddress.add(cachedBlock.fLengthInAddressableUnits);
+ IAddress cachedBlockEnd = cachedBlock.fAddress.add(cachedBlock.fLengthInAddressableUnits);
// Case where we miss a block before the cached block
if (reqBlockStart.distanceTo(cachedBlockStart).longValue() >= 0) {
- int lengthInOctets = (int) Math.min(reqBlockStart.distanceTo(cachedBlockStart).longValue()*wordSize, octetCount);
+ int lengthInOctets = (int) Math
+ .min(reqBlockStart.distanceTo(cachedBlockStart).longValue() * wordSize, octetCount);
// If both blocks start at the same location, no need to create a new cached block
if (lengthInOctets > 0) {
int lengthInAddressableUnits = lengthInOctets / wordSize;
- MemoryBlock newBlock = new MemoryBlock(reqBlockStart, lengthInOctets, lengthInAddressableUnits, new MemoryByte[0]);
+ MemoryBlock newBlock = new MemoryBlock(reqBlockStart, lengthInOctets, lengthInAddressableUnits,
+ new MemoryByte[0]);
list.add(newBlock);
}
// Adjust request block start and length for the next iteration
@@ -735,11 +749,10 @@ public class MIMemory extends AbstractDsfService implements IMemory, ICachingSer
// Case where the requested block starts somewhere in the cached block
else if (cachedBlockStart.distanceTo(reqBlockStart).longValue() > 0
- && reqBlockStart.distanceTo(cachedBlockEnd).longValue() >= 0)
- {
+ && reqBlockStart.distanceTo(cachedBlockEnd).longValue() >= 0) {
// Start of the requested block already in cache
// Adjust request block start and length for the next iteration
- octetCount -= reqBlockStart.distanceTo(cachedBlockEnd).longValue()*wordSize;
+ octetCount -= reqBlockStart.distanceTo(cachedBlockEnd).longValue() * wordSize;
reqBlockStart = cachedBlockEnd;
}
}
@@ -750,39 +763,39 @@ public class MIMemory extends AbstractDsfService implements IMemory, ICachingSer
MemoryBlock newBlock = new MemoryBlock(reqBlockStart, octetCount, addressesLength, new MemoryByte[0]);
list.add(newBlock);
}
-
+
return list;
}
- /**
- * This function walks the address-sorted memory block list to get the
- * cached memory bytes (possibly from multiple contiguous blocks).
- * This function is called *after* the missing blocks have been read from
- * the back end i.e. the requested memory is all cached.
- *
- * Again, this is fairly simple. As we loop over the address-ordered list,
- * There are really only 2 cases:
- *
- * [1] The requested block fits entirely in the cached block ([a] or [b])
- * [2] The requested block starts in a cached block and ends in the
- * following (contiguous) one ([c]) in which case it is treated
- * as 2 contiguous requests ([c'] and [c"])
- *
- * +--------------+--------------+
- * + A + B +
- * +--------------+--------------+
- * : [a----] : [b-----] :
- * : : :
- * : [c-----+------] :
- * : [c'---]+[c"---] :
+ /**
+ * This function walks the address-sorted memory block list to get the
+ * cached memory bytes (possibly from multiple contiguous blocks).
+ * This function is called *after* the missing blocks have been read from
+ * the back end i.e. the requested memory is all cached.
+ *
+ * Again, this is fairly simple. As we loop over the address-ordered list,
+ * There are really only 2 cases:
*
- * @param reqBlockStart The address of the requested block
- * @param count Its length
- * @return The cached memory content
- */
- private MemoryByte[] getMemoryBlockFromCache(IAddress reqBlockStart, int wordCount, int wordSize) {
- int count = wordCount * wordSize;
-
+ * [1] The requested block fits entirely in the cached block ([a] or [b])
+ * [2] The requested block starts in a cached block and ends in the
+ * following (contiguous) one ([c]) in which case it is treated
+ * as 2 contiguous requests ([c'] and [c"])
+ *
+ * +--------------+--------------+
+ * + A + B +
+ * +--------------+--------------+
+ * : [a----] : [b-----] :
+ * : : :
+ * : [c-----+------] :
+ * : [c'---]+[c"---] :
+ *
+ * @param reqBlockStart The address of the requested block
+ * @param count Its length
+ * @return The cached memory content
+ */
+ private MemoryByte[] getMemoryBlockFromCache(IAddress reqBlockStart, int wordCount, int wordSize) {
+ int count = wordCount * wordSize;
+
IAddress reqBlockEnd = reqBlockStart.add(wordCount);
MemoryByte[] resultBlock = new MemoryByte[count];
ListIterator<MemoryBlock> iter = fMemoryBlockList.listIterator();
@@ -790,41 +803,38 @@ public class MIMemory extends AbstractDsfService implements IMemory, ICachingSer
while (iter.hasNext()) {
MemoryBlock cachedBlock = iter.next();
IAddress cachedBlockStart = cachedBlock.fAddress;
- IAddress cachedBlockEnd = cachedBlock.fAddress.add(cachedBlock.fLengthInAddressableUnits);
+ IAddress cachedBlockEnd = cachedBlock.fAddress.add(cachedBlock.fLengthInAddressableUnits);
- // Case where the cached block overlaps completely the requested memory block
+ // Case where the cached block overlaps completely the requested memory block
if (cachedBlockStart.distanceTo(reqBlockStart).longValue() >= 0
- && reqBlockEnd.distanceTo(cachedBlockEnd).longValue() >= 0)
- {
+ && reqBlockEnd.distanceTo(cachedBlockEnd).longValue() >= 0) {
int pos = (int) cachedBlockStart.distanceTo(reqBlockStart).longValue() * wordSize;
System.arraycopy(cachedBlock.fBlock, pos, resultBlock, 0, count);
}
-
- // Case where the beginning of the cached block is within the requested memory block
+
+ // Case where the beginning of the cached block is within the requested memory block
else if (reqBlockStart.distanceTo(cachedBlockStart).longValue() >= 0
- && cachedBlockStart.distanceTo(reqBlockEnd).longValue() > 0)
- {
+ && cachedBlockStart.distanceTo(reqBlockEnd).longValue() > 0) {
int pos = (int) reqBlockStart.distanceTo(cachedBlockStart).longValue() * wordSize;
int length = (int) Math.min(cachedBlock.fLengthInOctets, count - pos);
System.arraycopy(cachedBlock.fBlock, 0, resultBlock, pos, length);
}
-
- // Case where the end of the cached block is within the requested memory block
+
+ // Case where the end of the cached block is within the requested memory block
else if (cachedBlockStart.distanceTo(reqBlockStart).longValue() >= 0
- && reqBlockStart.distanceTo(cachedBlockEnd).longValue() > 0)
- {
+ && reqBlockStart.distanceTo(cachedBlockEnd).longValue() > 0) {
int pos = (int) cachedBlockStart.distanceTo(reqBlockStart).longValue() * wordSize;
int length = (int) Math.min(cachedBlock.fLengthInOctets - pos, count);
System.arraycopy(cachedBlock.fBlock, pos, resultBlock, 0, length);
}
- }
+ }
return resultBlock;
}
/**
- * This function walks the address-sorted memory block list and updates
- * the content with the actual memory just read from the target.
- *
+ * This function walks the address-sorted memory block list and updates
+ * the content with the actual memory just read from the target.
+ *
* @param modBlockStart
* @param wordCount - Number of addressable units
* @param modBlock
@@ -838,211 +848,203 @@ public class MIMemory extends AbstractDsfService implements IMemory, ICachingSer
while (iter.hasNext()) {
MemoryBlock cachedBlock = iter.next();
IAddress cachedBlockStart = cachedBlock.fAddress;
- IAddress cachedBlockEnd = cachedBlock.fAddress.add(cachedBlock.fLengthInAddressableUnits);
-
+ IAddress cachedBlockEnd = cachedBlock.fAddress.add(cachedBlock.fLengthInAddressableUnits);
+
// For now, we only bother to update bytes already cached.
// Note: In a better implementation (v1.1), we would augment
- // the cache with the missing memory blocks since we went
+ // the cache with the missing memory blocks since we went
// through the pains of reading them in the first place.
// (this is left as an exercise to the reader :-)
- // Case where the modified block is completely included in the cached block
+ // Case where the modified block is completely included in the cached block
if (cachedBlockStart.distanceTo(modBlockStart).longValue() >= 0
- && modBlockEnd.distanceTo(cachedBlockEnd).longValue() >= 0)
- {
+ && modBlockEnd.distanceTo(cachedBlockEnd).longValue() >= 0) {
int pos = (int) cachedBlockStart.distanceTo(modBlockStart).longValue() * wordSize;
System.arraycopy(modBlock, 0, cachedBlock.fBlock, pos, count);
}
-
+
// Case where the cached block is completely included in the modified block
else if (modBlockStart.distanceTo(cachedBlockStart).longValue() >= 0
- && cachedBlockEnd.distanceTo(modBlockEnd).longValue() >= 0)
- {
+ && cachedBlockEnd.distanceTo(modBlockEnd).longValue() >= 0) {
int pos = (int) modBlockStart.distanceTo(cachedBlockStart).longValue() * wordSize;
System.arraycopy(modBlock, pos, cachedBlock.fBlock, 0, (int) cachedBlock.fLengthInOctets);
}
- // Case where the beginning of the modified block is within the cached block
+ // Case where the beginning of the modified block is within the cached block
else if (cachedBlockStart.distanceTo(modBlockStart).longValue() >= 0
- && modBlockStart.distanceTo(cachedBlockEnd).longValue() > 0)
- {
+ && modBlockStart.distanceTo(cachedBlockEnd).longValue() > 0) {
int pos = (int) cachedBlockStart.distanceTo(modBlockStart).longValue() * wordSize;
int length = (int) modBlockStart.distanceTo(cachedBlockEnd).longValue() * wordSize;
System.arraycopy(modBlock, 0, cachedBlock.fBlock, pos, length);
}
-
- // Case where the end of the modified block is within the cached block
+
+ // Case where the end of the modified block is within the cached block
else if (cachedBlockStart.distanceTo(modBlockEnd).longValue() > 0
- && modBlockEnd.distanceTo(cachedBlockEnd).longValue() >= 0)
- {
+ && modBlockEnd.distanceTo(cachedBlockEnd).longValue() >= 0) {
int pos = (int) modBlockStart.distanceTo(cachedBlockStart).longValue() * wordSize;
int length = (int) cachedBlockStart.distanceTo(modBlockEnd).longValue() * wordSize;
System.arraycopy(modBlock, pos, cachedBlock.fBlock, 0, length);
}
- }
+ }
return;
}
- /**
+ /**
* @param memoryDMC
- * @param address the memory block address (on the target)
- * @param wordSize the size, in bytes, of an addressable item
- * @param wordCount the number of addressable units to read
- * @param drm the asynchronous data request monitor
- */
- public void getMemory(IMemoryDMContext memoryDMC, final IAddress address, final int wordSize,
- final int wordCount, final DataRequestMonitor<MemoryByte[]> drm)
- {
- // Determine the number of read requests to issue
- List<MemoryBlock> missingBlocks = getListOfMissingBlocks(address, wordCount, wordSize);
- int numberOfRequests = missingBlocks.size();
-
- // A read request will be issued for each block needed
- // so we need to keep track of the count
- final CountingRequestMonitor countingRM =
- new CountingRequestMonitor(getExecutor(), drm) {
- @Override
- protected void handleSuccess() {
- // We received everything so read the result from the memory cache
- drm.setData(getMemoryBlockFromCache(address, wordCount, wordSize));
- drm.done();
- }
- };
- countingRM.setDoneCount(numberOfRequests);
-
- // Issue the read requests
- for (int i = 0; i < numberOfRequests; i++) {
- MemoryBlock block = missingBlocks.get(i);
- final IAddress startAddress = block.fAddress;
- final int length = (int) block.fLengthInAddressableUnits;
- readMemoryBlock(memoryDMC, startAddress, 0, wordSize, length,
- new DataRequestMonitor<MemoryByte[]>(getSession().getExecutor(), drm) {
- @Override
- protected void handleSuccess() {
- MemoryByte[] block = getData();
- int lenghtInaddressableUnits = block.length / wordSize;
- MemoryBlock memoryBlock = new MemoryBlock(startAddress, block.length, lenghtInaddressableUnits, block);
- fMemoryBlockList.add(memoryBlock);
- countingRM.done();
- }
- });
- }
- }
-
- /**
+ * @param address the memory block address (on the target)
+ * @param wordSize the size, in bytes, of an addressable item
+ * @param wordCount the number of addressable units to read
+ * @param drm the asynchronous data request monitor
+ */
+ public void getMemory(IMemoryDMContext memoryDMC, final IAddress address, final int wordSize,
+ final int wordCount, final DataRequestMonitor<MemoryByte[]> drm) {
+ // Determine the number of read requests to issue
+ List<MemoryBlock> missingBlocks = getListOfMissingBlocks(address, wordCount, wordSize);
+ int numberOfRequests = missingBlocks.size();
+
+ // A read request will be issued for each block needed
+ // so we need to keep track of the count
+ final CountingRequestMonitor countingRM = new CountingRequestMonitor(getExecutor(), drm) {
+ @Override
+ protected void handleSuccess() {
+ // We received everything so read the result from the memory cache
+ drm.setData(getMemoryBlockFromCache(address, wordCount, wordSize));
+ drm.done();
+ }
+ };
+ countingRM.setDoneCount(numberOfRequests);
+
+ // Issue the read requests
+ for (int i = 0; i < numberOfRequests; i++) {
+ MemoryBlock block = missingBlocks.get(i);
+ final IAddress startAddress = block.fAddress;
+ final int length = (int) block.fLengthInAddressableUnits;
+ readMemoryBlock(memoryDMC, startAddress, 0, wordSize, length,
+ new DataRequestMonitor<MemoryByte[]>(getSession().getExecutor(), drm) {
+ @Override
+ protected void handleSuccess() {
+ MemoryByte[] block = getData();
+ int lenghtInaddressableUnits = block.length / wordSize;
+ MemoryBlock memoryBlock = new MemoryBlock(startAddress, block.length,
+ lenghtInaddressableUnits, block);
+ fMemoryBlockList.add(memoryBlock);
+ countingRM.done();
+ }
+ });
+ }
+ }
+
+ /**
* @param memoryDMC
- * @param address the memory block address (on the target)
- * @param offset the offset from the start address
- * @param wordSize the size, in bytes, of an addressable item
- * @param wordCount the number of addressable units to write
- * @param buffer the source buffer
- * @param rm the asynchronous request monitor
- */
- public void setMemory(final IMemoryDMContext memoryDMC, final IAddress address,
- final long offset, final int wordSize, final int wordCount, final byte[] buffer,
- final RequestMonitor rm)
- {
- writeMemoryBlock(
- memoryDMC, address, offset, wordSize, wordCount, buffer,
- new RequestMonitor(getSession().getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- // Clear the command cache (otherwise we can't guarantee
- // that the subsequent memory read will be correct)
- fCommandCache.reset();
-
- // Re-read the modified memory block to asynchronously update of the memory cache
- readMemoryBlock(memoryDMC, address, offset, wordSize, wordCount,
- new DataRequestMonitor<MemoryByte[]>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- updateMemoryCache(address.add(offset), wordCount, getData(), wordSize);
+ * @param address the memory block address (on the target)
+ * @param offset the offset from the start address
+ * @param wordSize the size, in bytes, of an addressable item
+ * @param wordCount the number of addressable units to write
+ * @param buffer the source buffer
+ * @param rm the asynchronous request monitor
+ */
+ public void setMemory(final IMemoryDMContext memoryDMC, final IAddress address, final long offset,
+ final int wordSize, final int wordCount, final byte[] buffer, final RequestMonitor rm) {
+ writeMemoryBlock(memoryDMC, address, offset, wordSize, wordCount, buffer,
+ new RequestMonitor(getSession().getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ // Clear the command cache (otherwise we can't guarantee
+ // that the subsequent memory read will be correct)
+ fCommandCache.reset();
+
+ // Re-read the modified memory block to asynchronously update of the memory cache
+ readMemoryBlock(memoryDMC, address, offset, wordSize, wordCount,
+ new DataRequestMonitor<MemoryByte[]>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ updateMemoryCache(address.add(offset), wordCount, getData(), wordSize);
+ // Send the MemoryChangedEvent
+ IAddress[] addresses = new IAddress[wordCount];
+ for (int i = 0; i < wordCount; i++) {
+ addresses[i] = address.add(offset + i);
+ }
+ getSession().dispatchEvent(new MemoryChangedEvent(memoryDMC, addresses),
+ getProperties());
+ rm.done();
+ }
+ });
+ }
+ });
+ }
+
+ /**
+ * @param memoryDMC
+ * @param address
+ * @param offset
+ * @param wordSize
+ * @param wordCount
+ * @param sendMemoryEvent Indicates if a IMemoryChangedEvent should be sent if the memory cache has changed.
+ * @param rm
+ */
+ public void refreshMemory(final IMemoryDMContext memoryDMC, final IAddress address, final long offset,
+ final int wordSize, final int wordCount, final boolean sendMemoryEvent, final RequestMonitor rm) {
+ // Check if we already cache part of this memory area (which means it
+ // is used by a memory service client that will have to be updated)
+ List<MemoryBlock> list = getListOfMissingBlocks(address, wordCount, wordSize);
+ int sizeToRead = 0;
+ for (MemoryBlock block : list) {
+ sizeToRead += block.fLengthInAddressableUnits;
+ }
+
+ // If none of the requested memory is in cache, just get out
+ if (sizeToRead == wordCount) {
+ rm.done();
+ return;
+ }
+
+ // Read the corresponding memory block
+ fCommandCache.reset();
+ readMemoryBlock(memoryDMC, address, offset, wordSize, wordCount,
+ new DataRequestMonitor<MemoryByte[]>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ MemoryByte[] oldBlock = getMemoryBlockFromCache(address, wordCount, wordSize);
+ MemoryByte[] newBlock = getData();
+ boolean blocksDiffer = false;
+ for (int i = 0; i < oldBlock.length; i++) {
+ if (oldBlock[i].getValue() != newBlock[i].getValue()) {
+ blocksDiffer = true;
+ break;
+ }
+ }
+ if (blocksDiffer) {
+ updateMemoryCache(address.add(offset), wordCount, newBlock, wordSize);
+ if (sendMemoryEvent) {
// Send the MemoryChangedEvent
- IAddress[] addresses = new IAddress[wordCount];
+ final IAddress[] addresses = new IAddress[wordCount];
for (int i = 0; i < wordCount; i++) {
addresses[i] = address.add(offset + i);
}
- getSession().dispatchEvent(new MemoryChangedEvent(memoryDMC, addresses), getProperties());
- rm.done();
- }
- });
- }
- });
- }
-
- /**
- * @param memoryDMC
- * @param address
- * @param offset
- * @param wordSize
- * @param wordCount
- * @param sendMemoryEvent Indicates if a IMemoryChangedEvent should be sent if the memory cache has changed.
- * @param rm
- */
- public void refreshMemory(final IMemoryDMContext memoryDMC, final IAddress address,
- final long offset, final int wordSize, final int wordCount, final boolean sendMemoryEvent,
- final RequestMonitor rm)
- {
- // Check if we already cache part of this memory area (which means it
- // is used by a memory service client that will have to be updated)
- List<MemoryBlock> list = getListOfMissingBlocks(address, wordCount, wordSize);
- int sizeToRead = 0;
- for (MemoryBlock block : list) {
- sizeToRead += block.fLengthInAddressableUnits;
- }
-
- // If none of the requested memory is in cache, just get out
- if (sizeToRead == wordCount) {
- rm.done();
- return;
- }
-
- // Read the corresponding memory block
- fCommandCache.reset();
- readMemoryBlock(memoryDMC, address, offset, wordSize, wordCount,
- new DataRequestMonitor<MemoryByte[]>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- MemoryByte[] oldBlock = getMemoryBlockFromCache(address, wordCount, wordSize);
- MemoryByte[] newBlock = getData();
- boolean blocksDiffer = false;
- for (int i = 0; i < oldBlock.length; i++) {
- if (oldBlock[i].getValue() != newBlock[i].getValue()) {
- blocksDiffer = true;
- break;
- }
- }
- if (blocksDiffer) {
- updateMemoryCache(address.add(offset), wordCount, newBlock, wordSize);
- if (sendMemoryEvent) {
- // Send the MemoryChangedEvent
- final IAddress[] addresses = new IAddress[wordCount];
- for (int i = 0; i < wordCount; i++) {
- addresses[i] = address.add(offset + i);
- }
- getSession().dispatchEvent(new MemoryChangedEvent(memoryDMC, addresses), getProperties());
- }
- }
- rm.done();
- }
- });
- }
+ getSession().dispatchEvent(new MemoryChangedEvent(memoryDMC, addresses),
+ getProperties());
+ }
+ }
+ rm.done();
+ }
+ });
+ }
}
- /**
- * {@inheritDoc}
- * @since 1.1
- */
+ /**
+ * {@inheritDoc}
+ * @since 1.1
+ */
@Override
- public void flushCache(IDMContext context) {
- fCommandCache.reset(context);
-
- IMemoryDMContext memoryDMC = DMContexts.getAncestorOfType(context, IMemoryDMContext.class);
-
- if (memoryDMC != null) {
- memoryCacheReset(memoryDMC);
- }
- }
+ public void flushCache(IDMContext context) {
+ fCommandCache.reset(context);
+
+ IMemoryDMContext memoryDMC = DMContexts.getAncestorOfType(context, IMemoryDMContext.class);
+
+ if (memoryDMC != null) {
+ memoryCacheReset(memoryDMC);
+ }
+ }
/**
* Reset the cache for the given memory context or any of its associated
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIModules.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIModules.java
index 5f30c2d0a3f..9b2ebc116e8 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIModules.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIModules.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* Ericsson AB - Modules implementation for GDB
@@ -44,19 +44,18 @@ import org.eclipse.core.runtime.Status;
import org.osgi.framework.BundleContext;
/**
- *
+ *
*/
public class MIModules extends AbstractDsfService implements IModules2, ICachingService {
- private static class SymbolsLoadedEvent extends AbstractDMEvent<ISymbolDMContext>
- implements ISymbolsLoadedDMEvent {
-
+ private static class SymbolsLoadedEvent extends AbstractDMEvent<ISymbolDMContext> implements ISymbolsLoadedDMEvent {
+
private IModuleDMContext[] fModules;
- public SymbolsLoadedEvent(ISymbolDMContext context, IModuleDMContext[] modules) {
- super(context);
- fModules = modules;
- }
+ public SymbolsLoadedEvent(ISymbolDMContext context, IModuleDMContext[] modules) {
+ super(context);
+ fModules = modules;
+ }
@Override
public IModuleDMContext[] getModules() {
@@ -68,223 +67,224 @@ public class MIModules extends AbstractDsfService implements IModules2, ICaching
private CommandCache fModulesLoadCache;
private CommandFactory fCommandFactory;
- public MIModules(DsfSession session) {
- super(session);
- }
-
- @Override
- protected BundleContext getBundleContext() {
- return GdbPlugin.getBundleContext();
- }
-
- @Override
- public void initialize(final RequestMonitor requestMonitor) {
- super.initialize(
- new ImmediateRequestMonitor(requestMonitor) {
- @Override
- protected void handleSuccess() {
- doInitialize(requestMonitor);
- }});
- }
-
- private void doInitialize(RequestMonitor requestMonitor) {
- // Cache for holding Modules data
- ICommandControlService commandControl = getServicesTracker().getService(ICommandControlService.class);
- fModulesCache = new CommandCache(getSession(), commandControl);
- fModulesCache.setContextAvailable(commandControl.getContext(), true);
- fModulesLoadCache = new CommandCache(getSession(), commandControl);
- fModulesLoadCache.setContextAvailable(commandControl.getContext(), true);
-
- fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
-
- /*
- * Make ourselves known so clients can use us.
- */
- register(new String[]{ IModules.class.getName(),
- IModules2.class.getName(),
- MIModules.class.getName() },
- new Hashtable<String,String>());
-
- requestMonitor.done();
- }
-
- @Override
- public void shutdown(RequestMonitor requestMonitor) {
- unregister();
- super.shutdown(requestMonitor);
- }
-
- static class ModuleDMContext extends AbstractDMContext implements IModuleDMContext {
- private final String fFile;
- ModuleDMContext(MIModules service, IDMContext[] parents, String file) {
- super(service, parents);
- fFile = file;
- }
-
- public String getFile() {
- return fFile;
- }
-
- @Override
- public boolean equals(Object obj) {
- return baseEquals(obj) && fFile.equals(((ModuleDMContext)obj).fFile);
- }
-
- @Override
- public int hashCode() {
- return baseHashCode() + fFile.hashCode();
- }
-
- @Override
- public String toString() {
- return baseToString() + ".file[" + fFile + "]"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- static class ModuleDMData implements IModuleDMData {
- private final String fFile;
- private final String fFromAddress;
- private final String fToAddress;
- private final boolean fIsSymbolsRead;
-
- public ModuleDMData(ModuleDMContext dmc) {
- fFile = dmc.fFile;
- fFromAddress = null;
- fToAddress = null;
- fIsSymbolsRead = false;
- }
-
- public ModuleDMData(String fileName, String fromAddress, String toAddress, boolean isSymsRead){
- fFile = fileName;
- fFromAddress = fromAddress;
- fToAddress = toAddress;
- fIsSymbolsRead = isSymsRead;
- }
-
- @Override
- public String getFile() {
- return fFile;
- }
-
- @Override
- public String getName() {
- return fFile;
- }
-
- @Override
- public long getTimeStamp() {
- return 0;
- }
-
- @Override
- public String getBaseAddress() {
- return fFromAddress;
- }
-
- @Override
- public String getToAddress() {
- return fToAddress;
- }
-
- @Override
- public boolean isSymbolsLoaded() {
- return fIsSymbolsRead;
- }
-
- @Override
- public long getSize() {
- long result = 0;
- if(getBaseAddress() == null || getToAddress() == null)
- return result;
+ public MIModules(DsfSession session) {
+ super(session);
+ }
+
+ @Override
+ protected BundleContext getBundleContext() {
+ return GdbPlugin.getBundleContext();
+ }
+
+ @Override
+ public void initialize(final RequestMonitor requestMonitor) {
+ super.initialize(new ImmediateRequestMonitor(requestMonitor) {
+ @Override
+ protected void handleSuccess() {
+ doInitialize(requestMonitor);
+ }
+ });
+ }
+
+ private void doInitialize(RequestMonitor requestMonitor) {
+ // Cache for holding Modules data
+ ICommandControlService commandControl = getServicesTracker().getService(ICommandControlService.class);
+ fModulesCache = new CommandCache(getSession(), commandControl);
+ fModulesCache.setContextAvailable(commandControl.getContext(), true);
+ fModulesLoadCache = new CommandCache(getSession(), commandControl);
+ fModulesLoadCache.setContextAvailable(commandControl.getContext(), true);
+
+ fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
+
+ /*
+ * Make ourselves known so clients can use us.
+ */
+ register(new String[] { IModules.class.getName(), IModules2.class.getName(), MIModules.class.getName() },
+ new Hashtable<String, String>());
+
+ requestMonitor.done();
+ }
+
+ @Override
+ public void shutdown(RequestMonitor requestMonitor) {
+ unregister();
+ super.shutdown(requestMonitor);
+ }
+
+ static class ModuleDMContext extends AbstractDMContext implements IModuleDMContext {
+ private final String fFile;
+
+ ModuleDMContext(MIModules service, IDMContext[] parents, String file) {
+ super(service, parents);
+ fFile = file;
+ }
+
+ public String getFile() {
+ return fFile;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return baseEquals(obj) && fFile.equals(((ModuleDMContext) obj).fFile);
+ }
+
+ @Override
+ public int hashCode() {
+ return baseHashCode() + fFile.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return baseToString() + ".file[" + fFile + "]"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ static class ModuleDMData implements IModuleDMData {
+ private final String fFile;
+ private final String fFromAddress;
+ private final String fToAddress;
+ private final boolean fIsSymbolsRead;
+
+ public ModuleDMData(ModuleDMContext dmc) {
+ fFile = dmc.fFile;
+ fFromAddress = null;
+ fToAddress = null;
+ fIsSymbolsRead = false;
+ }
+
+ public ModuleDMData(String fileName, String fromAddress, String toAddress, boolean isSymsRead) {
+ fFile = fileName;
+ fFromAddress = fromAddress;
+ fToAddress = toAddress;
+ fIsSymbolsRead = isSymsRead;
+ }
+
+ @Override
+ public String getFile() {
+ return fFile;
+ }
+
+ @Override
+ public String getName() {
+ return fFile;
+ }
+
+ @Override
+ public long getTimeStamp() {
+ return 0;
+ }
+
+ @Override
+ public String getBaseAddress() {
+ return fFromAddress;
+ }
+
+ @Override
+ public String getToAddress() {
+ return fToAddress;
+ }
+
+ @Override
+ public boolean isSymbolsLoaded() {
+ return fIsSymbolsRead;
+ }
+
+ @Override
+ public long getSize() {
+ long result = 0;
+ if (getBaseAddress() == null || getToAddress() == null)
+ return result;
BigInteger start = MIFormat.getBigInteger(getBaseAddress());
BigInteger end = MIFormat.getBigInteger(getToAddress());
- if ( end.compareTo( start ) > 0 )
- result = end.subtract( start ).longValue();
- return result;
- }
+ if (end.compareTo(start) > 0)
+ result = end.subtract(start).longValue();
+ return result;
+ }
+
+ }
- }
-
@Override
- public void getModules(final ISymbolDMContext symCtx, final DataRequestMonitor<IModuleDMContext[]> rm) {
- if(symCtx != null){
- fModulesCache.execute(fCommandFactory.createCLIInfoSharedLibrary(symCtx),
- new DataRequestMonitor<CLIInfoSharedLibraryInfo>(getExecutor(), rm) {
+ public void getModules(final ISymbolDMContext symCtx, final DataRequestMonitor<IModuleDMContext[]> rm) {
+ if (symCtx != null) {
+ fModulesCache.execute(fCommandFactory.createCLIInfoSharedLibrary(symCtx),
+ new DataRequestMonitor<CLIInfoSharedLibraryInfo>(getExecutor(), rm) {
@Override
protected void handleSuccess() {
rm.setData(makeModuleContexts(symCtx, getData()));
rm.done();
}
});
- }
- else{
- rm.setData(new IModuleDMContext[] { new ModuleDMContext(this, DMContexts.EMPTY_CONTEXTS_ARRAY, "example module 1"), new ModuleDMContext(this, DMContexts.EMPTY_CONTEXTS_ARRAY, "example module 2") }); //$NON-NLS-1$ //$NON-NLS-2$
- rm.done();
- }
- }
-
- private IModuleDMContext[] makeModuleContexts(IDMContext symCtxt, CLIInfoSharedLibraryInfo info){
-
- DsfMISharedInfo[] sharedInfos = info.getMIShared();
- ModuleDMContext[] modules = new ModuleDMContext[sharedInfos.length];
- int i = 0;
- for(DsfMISharedInfo shared : sharedInfos){
- modules[i++] = new ModuleDMContext(this, new IDMContext[]{symCtxt}, shared.getName());
- }
- return modules;
- }
-
+ } else {
+ rm.setData(new IModuleDMContext[] {
+ new ModuleDMContext(this, DMContexts.EMPTY_CONTEXTS_ARRAY, "example module 1"), //$NON-NLS-1$
+ new ModuleDMContext(this, DMContexts.EMPTY_CONTEXTS_ARRAY, "example module 2") }); //$NON-NLS-1$
+ rm.done();
+ }
+ }
+
+ private IModuleDMContext[] makeModuleContexts(IDMContext symCtxt, CLIInfoSharedLibraryInfo info) {
+
+ DsfMISharedInfo[] sharedInfos = info.getMIShared();
+ ModuleDMContext[] modules = new ModuleDMContext[sharedInfos.length];
+ int i = 0;
+ for (DsfMISharedInfo shared : sharedInfos) {
+ modules[i++] = new ModuleDMContext(this, new IDMContext[] { symCtxt }, shared.getName());
+ }
+ return modules;
+ }
+
@Override
- public void getModuleData(final IModuleDMContext dmc, final DataRequestMonitor<IModuleDMData> rm) {
- assert dmc != null;
- ISymbolDMContext symDmc = DMContexts.getAncestorOfType(dmc, ISymbolDMContext.class);
- if (symDmc != null && dmc instanceof ModuleDMContext) {
- fModulesCache.execute(fCommandFactory.createCLIInfoSharedLibrary(symDmc),
- new DataRequestMonitor<CLIInfoSharedLibraryInfo>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- rm.setData( createSharedLibInfo((ModuleDMContext)dmc, getData()) );
- rm.done();
- }
- });
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Unknown DM Context", null)); //$NON-NLS-1$
- rm.done();
- }
- }
+ public void getModuleData(final IModuleDMContext dmc, final DataRequestMonitor<IModuleDMData> rm) {
+ assert dmc != null;
+ ISymbolDMContext symDmc = DMContexts.getAncestorOfType(dmc, ISymbolDMContext.class);
+ if (symDmc != null && dmc instanceof ModuleDMContext) {
+ fModulesCache.execute(fCommandFactory.createCLIInfoSharedLibrary(symDmc),
+ new DataRequestMonitor<CLIInfoSharedLibraryInfo>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ rm.setData(createSharedLibInfo((ModuleDMContext) dmc, getData()));
+ rm.done();
+ }
+ });
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Unknown DM Context", null)); //$NON-NLS-1$
+ rm.done();
+ }
+ }
/**
* @since 4.6
*/
@Override
public void loadSymbolsForAllModules(final ISymbolDMContext symDmc, final RequestMonitor rm) {
- assert symDmc != null;
+ assert symDmc != null;
if (symDmc != null) {
fModulesLoadCache.execute(fCommandFactory.createCLISharedLibrary(symDmc),
new ImmediateDataRequestMonitor<MIInfo>(rm) {
- @Override
- protected void handleSuccess() {
- getModules(symDmc, new ImmediateDataRequestMonitor<IModuleDMContext[]>() {
@Override
- protected void handleCompleted() {
- if (isSuccess()) {
- getSession().dispatchEvent(new SymbolsLoadedEvent(symDmc, getData()),
- getProperties());
- } else {
- // Some error in getting the list of modules. Send an event anyway without the list
- getSession().dispatchEvent(new SymbolsLoadedEvent(symDmc, new IModuleDMContext[0]),
- getProperties());
- }
- rm.done();
- };
+ protected void handleSuccess() {
+ getModules(symDmc, new ImmediateDataRequestMonitor<IModuleDMContext[]>() {
+ @Override
+ protected void handleCompleted() {
+ if (isSuccess()) {
+ getSession().dispatchEvent(new SymbolsLoadedEvent(symDmc, getData()),
+ getProperties());
+ } else {
+ // Some error in getting the list of modules. Send an event anyway without the list
+ getSession().dispatchEvent(
+ new SymbolsLoadedEvent(symDmc, new IModuleDMContext[0]),
+ getProperties());
+ }
+ rm.done();
+ };
+ });
+ }
});
- }
- });
} else {
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid DM Context", null)); //$NON-NLS-1$
}
}
-
+
/**
* @since 4.6
*/
@@ -292,55 +292,58 @@ public class MIModules extends AbstractDsfService implements IModules2, ICaching
public void loadSymbols(final IModuleDMContext modDmc, final RequestMonitor rm) {
assert modDmc != null;
final ISymbolDMContext symDmc = DMContexts.getAncestorOfType(modDmc, ISymbolDMContext.class);
- if (symDmc != null && modDmc instanceof ModuleDMContext) {
- fModulesLoadCache.execute(fCommandFactory.createCLISharedLibrary(symDmc, ((ModuleDMContext)modDmc).getFile()),
- new ImmediateDataRequestMonitor<MIInfo>(rm) {
- @Override
- protected void handleSuccess() {
- getSession().dispatchEvent(new SymbolsLoadedEvent(symDmc, new IModuleDMContext[] { modDmc }),
- getProperties());
- rm.done();
- }
- });
+ if (symDmc != null && modDmc instanceof ModuleDMContext) {
+ fModulesLoadCache.execute(
+ fCommandFactory.createCLISharedLibrary(symDmc, ((ModuleDMContext) modDmc).getFile()),
+ new ImmediateDataRequestMonitor<MIInfo>(rm) {
+ @Override
+ protected void handleSuccess() {
+ getSession().dispatchEvent(
+ new SymbolsLoadedEvent(symDmc, new IModuleDMContext[] { modDmc }), getProperties());
+ rm.done();
+ }
+ });
} else {
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid DM Context", null)); //$NON-NLS-1$
}
}
+ private IModuleDMData createSharedLibInfo(ModuleDMContext dmc, CLIInfoSharedLibraryInfo info) {
+ for (CLIInfoSharedLibraryInfo.DsfMISharedInfo shared : info.getMIShared()) {
+ if (shared.getName().equals(dmc.fFile)) {
+ return new ModuleDMData(shared.getName(), shared.getFrom(), shared.getTo(), shared.isRead());
+ }
+ }
+ return new ModuleDMData("", "", "", false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ }
- private IModuleDMData createSharedLibInfo(ModuleDMContext dmc, CLIInfoSharedLibraryInfo info){
- for (CLIInfoSharedLibraryInfo.DsfMISharedInfo shared : info.getMIShared()) {
- if(shared.getName().equals(dmc.fFile)){
- return new ModuleDMData(shared.getName(), shared.getFrom(), shared.getTo(), shared.isRead());
- }
- }
- return new ModuleDMData("","", "", false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- }
-
- @Override
- public void calcAddressInfo(ISymbolDMContext symCtx, String file, int line, int col, DataRequestMonitor<AddressRange[]> rm) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Functionality not supported", null)); //$NON-NLS-1$
- rm.done();
- }
+ @Override
+ public void calcAddressInfo(ISymbolDMContext symCtx, String file, int line, int col,
+ DataRequestMonitor<AddressRange[]> rm) {
+ rm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Functionality not supported", null)); //$NON-NLS-1$
+ rm.done();
+ }
@Override
- public void calcLineInfo(ISymbolDMContext symCtx, IAddress address, DataRequestMonitor<LineInfo[]> rm) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Functionality not supported", null)); //$NON-NLS-1$
- rm.done();
- }
-
- /** @since 4.6 */
- @DsfServiceEventHandler
- public void eventDispatched(ISymbolsLoadedDMEvent e) {
- fModulesCache.reset();
- // Do not clear fModulesLoadCache since those commands do not need to be resent.
- }
-
- /**
- * {@inheritDoc}
- * @since 1.1
- */
+ public void calcLineInfo(ISymbolDMContext symCtx, IAddress address, DataRequestMonitor<LineInfo[]> rm) {
+ rm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Functionality not supported", null)); //$NON-NLS-1$
+ rm.done();
+ }
+
+ /** @since 4.6 */
+ @DsfServiceEventHandler
+ public void eventDispatched(ISymbolsLoadedDMEvent e) {
+ fModulesCache.reset();
+ // Do not clear fModulesLoadCache since those commands do not need to be resent.
+ }
+
+ /**
+ * {@inheritDoc}
+ * @since 1.1
+ */
@Override
public void flushCache(IDMContext context) {
fModulesCache.reset();
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIProcesses.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIProcesses.java
index 1eeeee3bd91..7ea6671005b 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIProcesses.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIProcesses.java
@@ -7,10 +7,10 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
- * Marc Khouzam (Ericsson) - Make each thread an IDisassemblyDMContext (bug 352748)
+ * Marc Khouzam (Ericsson) - Make each thread an IDisassemblyDMContext (bug 352748)
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service;
@@ -53,21 +53,20 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.osgi.framework.BundleContext;
-
/**
* @since 1.1
*/
public class MIProcesses extends AbstractDsfService implements IMIProcesses, ICachingService {
-
+
// Below is the context hierarchy that is implemented between the
- // MIProcesses service and the MIRunControl service for the MI
+ // MIProcesses service and the MIRunControl service for the MI
// implementation of DSF:
//
// MIControlDMContext (ICommandControlDMContext)
// |
// MIProcessDMC (IProcess)
// / \
- // / \
+ // / \
// MIContainerDMC MIThreadDMC (IThread)
// (IContainer) /
// \ /
@@ -79,9 +78,8 @@ public class MIProcesses extends AbstractDsfService implements IMIProcesses, ICa
* Context representing a thread in GDB/MI
*/
@Immutable
- private static class MIExecutionDMC extends AbstractDMContext
- implements IMIExecutionDMContext, IDisassemblyDMContext
- {
+ private static class MIExecutionDMC extends AbstractDMContext
+ implements IMIExecutionDMContext, IDisassemblyDMContext {
/**
* String ID that is used to identify the thread in the GDB/MI protocol.
*/
@@ -92,49 +90,53 @@ public class MIProcesses extends AbstractDsfService implements IMIProcesses, ICa
* Instead clients should call {@link IMIProcesses#createExecutionContext()}
* to create instances of this context based on the thread ID.
* <p/>
- *
+ *
* @param sessionId Session that this context belongs to.
* @param containerDmc The container that this context belongs to.
* @param threadDmc The thread context parents of this context.
* @param threadId GDB/MI thread identifier.
*/
- protected MIExecutionDMC(String sessionId, IContainerDMContext containerDmc, IThreadDMContext threadDmc, String threadId) {
- super(sessionId,
- containerDmc == null && threadDmc == null ? new IDMContext[0] :
- containerDmc == null ? new IDMContext[] { threadDmc } :
- threadDmc == null ? new IDMContext[] { containerDmc } :
- new IDMContext[] { containerDmc, threadDmc });
- fThreadId = threadId;
- }
+ protected MIExecutionDMC(String sessionId, IContainerDMContext containerDmc, IThreadDMContext threadDmc,
+ String threadId) {
+ super(sessionId,
+ containerDmc == null && threadDmc == null ? new IDMContext[0]
+ : containerDmc == null ? new IDMContext[] { threadDmc }
+ : threadDmc == null ? new IDMContext[] { containerDmc }
+ : new IDMContext[] { containerDmc, threadDmc });
+ fThreadId = threadId;
+ }
/**
* Returns the GDB/MI thread identifier of this context.
* @return
*/
- @Override
- public String getThreadId(){
+ @Override
+ public String getThreadId() {
return fThreadId;
}
@Override
- public String toString() { return baseToString() + ".thread[" + fThreadId + "]"; } //$NON-NLS-1$ //$NON-NLS-2$
+ public String toString() {
+ return baseToString() + ".thread[" + fThreadId + "]"; //$NON-NLS-1$//$NON-NLS-2$
+ }
@Override
public boolean equals(Object obj) {
- return super.baseEquals(obj) && ((MIExecutionDMC)obj).fThreadId.equals(fThreadId);
+ return super.baseEquals(obj) && ((MIExecutionDMC) obj).fThreadId.equals(fThreadId);
}
@Override
- public int hashCode() { return super.baseHashCode() ^ fThreadId.hashCode(); }
+ public int hashCode() {
+ return super.baseHashCode() ^ fThreadId.hashCode();
+ }
}
/**
- * Context representing a thread group of GDB/MI.
+ * Context representing a thread group of GDB/MI.
*/
- @Immutable
+ @Immutable
protected static class MIContainerDMC extends AbstractDMContext
- implements IMIContainerDMContext, IBreakpointsTargetDMContext, IDisassemblyDMContext
- {
+ implements IMIContainerDMContext, IBreakpointsTargetDMContext, IDisassemblyDMContext {
/**
* String ID that is used to identify the thread group in the GDB/MI protocol.
*/
@@ -144,7 +146,7 @@ public class MIProcesses extends AbstractDsfService implements IMIProcesses, ICa
* Constructor for the context. It should not be called directly by clients.
* Instead clients should call {@link IMIProcesses#createContainerContext
* to create instances of this context based on the group name.
- *
+ *
* @param sessionId Session that this context belongs to.
* @param processDmc The process context that is the parent of this context.
* @param groupId GDB/MI thread group identifier.
@@ -158,111 +160,123 @@ public class MIProcesses extends AbstractDsfService implements IMIProcesses, ICa
* Returns the GDB/MI thread group identifier of this context.
*/
@Override
- public String getGroupId(){ return fId; }
+ public String getGroupId() {
+ return fId;
+ }
@Override
- public String toString() { return baseToString() + ".threadGroup[" + fId + "]"; } //$NON-NLS-1$ //$NON-NLS-2$
+ public String toString() {
+ return baseToString() + ".threadGroup[" + fId + "]"; //$NON-NLS-1$//$NON-NLS-2$
+ }
@Override
public boolean equals(Object obj) {
- return super.baseEquals(obj) &&
- (((MIContainerDMC)obj).fId == null ? fId == null : ((MIContainerDMC)obj).fId.equals(fId));
+ return super.baseEquals(obj)
+ && (((MIContainerDMC) obj).fId == null ? fId == null : ((MIContainerDMC) obj).fId.equals(fId));
}
@Override
- public int hashCode() { return super.baseHashCode() ^ (fId == null ? 0 : fId.hashCode()); }
+ public int hashCode() {
+ return super.baseHashCode() ^ (fId == null ? 0 : fId.hashCode());
+ }
}
/**
- * Context representing a thread.
+ * Context representing a thread.
*/
- @Immutable
- private static class MIThreadDMC extends AbstractDMContext
- implements IThreadDMContext
- {
- /**
- * ID used by GDB to refer to threads.
- * We use the same id as the one used in {@link MIProcesses#MIExecutionDMC}
- */
- private final String fId;
-
- /**
- * Constructor for the context. It should not be called directly by clients.
- * Instead clients should call {@link IMIProcesses#createThreadContext}
- * to create instances of this context based on the thread ID.
- * <p/>
- *
- * @param sessionId Session that this context belongs to.
- * @param processDmc The process that this thread belongs to.
- * @param id thread identifier.
- */
- public MIThreadDMC(String sessionId, IProcessDMContext processDmc, String id) {
+ @Immutable
+ private static class MIThreadDMC extends AbstractDMContext implements IThreadDMContext {
+ /**
+ * ID used by GDB to refer to threads.
+ * We use the same id as the one used in {@link MIProcesses#MIExecutionDMC}
+ */
+ private final String fId;
+
+ /**
+ * Constructor for the context. It should not be called directly by clients.
+ * Instead clients should call {@link IMIProcesses#createThreadContext}
+ * to create instances of this context based on the thread ID.
+ * <p/>
+ *
+ * @param sessionId Session that this context belongs to.
+ * @param processDmc The process that this thread belongs to.
+ * @param id thread identifier.
+ */
+ public MIThreadDMC(String sessionId, IProcessDMContext processDmc, String id) {
super(sessionId, processDmc == null ? new IDMContext[0] : new IDMContext[] { processDmc });
- fId = id;
- }
+ fId = id;
+ }
- /**
- * Returns the thread identifier of this context.
- * @return
- */
- public String getId(){ return fId; }
+ /**
+ * Returns the thread identifier of this context.
+ * @return
+ */
+ public String getId() {
+ return fId;
+ }
- @Override
- public String toString() { return baseToString() + ".OSthread[" + fId + "]"; } //$NON-NLS-1$ //$NON-NLS-2$
+ @Override
+ public String toString() {
+ return baseToString() + ".OSthread[" + fId + "]"; //$NON-NLS-1$//$NON-NLS-2$
+ }
@Override
public boolean equals(Object obj) {
- return super.baseEquals(obj) &&
- (((MIThreadDMC)obj).fId == null ? fId == null : ((MIThreadDMC)obj).fId.equals(fId));
+ return super.baseEquals(obj)
+ && (((MIThreadDMC) obj).fId == null ? fId == null : ((MIThreadDMC) obj).fId.equals(fId));
}
@Override
- public int hashCode() { return super.baseHashCode() ^ (fId == null ? 0 : fId.hashCode()); }
- }
-
- @Immutable
- private static class MIProcessDMC extends AbstractDMContext
- implements IMIProcessDMContext
- {
- /**
- * ID given by the OS.
- * For practicality, we use the same id as the one used in {@link MIProcesses#MIContainerDMC}
- */
- private final String fId;
-
- /**
- * Constructor for the context. It should not be called directly by clients.
- * Instead clients should call {@link IMIProcesses#createProcessContext}
- * to create instances of this context based on the PID.
- * <p/>
- *
- * @param sessionId Session that this context belongs to.
- * @param controlDmc The control context parent of this process.
- * @param id process identifier.
- */
- public MIProcessDMC(String sessionId, ICommandControlDMContext controlDmc, String id) {
+ public int hashCode() {
+ return super.baseHashCode() ^ (fId == null ? 0 : fId.hashCode());
+ }
+ }
+
+ @Immutable
+ private static class MIProcessDMC extends AbstractDMContext implements IMIProcessDMContext {
+ /**
+ * ID given by the OS.
+ * For practicality, we use the same id as the one used in {@link MIProcesses#MIContainerDMC}
+ */
+ private final String fId;
+
+ /**
+ * Constructor for the context. It should not be called directly by clients.
+ * Instead clients should call {@link IMIProcesses#createProcessContext}
+ * to create instances of this context based on the PID.
+ * <p/>
+ *
+ * @param sessionId Session that this context belongs to.
+ * @param controlDmc The control context parent of this process.
+ * @param id process identifier.
+ */
+ public MIProcessDMC(String sessionId, ICommandControlDMContext controlDmc, String id) {
super(sessionId, controlDmc == null ? new IDMContext[0] : new IDMContext[] { controlDmc });
- fId = id;
- }
-
- @Override
- public String getProcId() { return fId; }
+ fId = id;
+ }
+
+ @Override
+ public String getProcId() {
+ return fId;
+ }
- @Override
- public String toString() { return baseToString() + ".proc[" + fId + "]"; } //$NON-NLS-1$ //$NON-NLS-2$
+ @Override
+ public String toString() {
+ return baseToString() + ".proc[" + fId + "]"; //$NON-NLS-1$//$NON-NLS-2$
+ }
@Override
public boolean equals(Object obj) {
// We treat the UNKNOWN_PROCESS_ID as a wildcard. Any processId (except null) will be considered
// equal to the UNKNOWN_PROCESS_ID. This is important because before starting a process, we don't
// have a pid yet, but we still need to create a process context, and we must use UNKNOWN_PROCESS_ID.
- // Bug 336890
+ // Bug 336890
if (!baseEquals(obj)) {
return false;
}
- MIProcessDMC other = (MIProcessDMC)obj;
+ MIProcessDMC other = (MIProcessDMC) obj;
if (fId == null || other.fId == null) {
return fId == null && other.fId == null;
}
@@ -271,69 +285,72 @@ public class MIProcesses extends AbstractDsfService implements IMIProcesses, ICa
if (fId.equals(UNKNOWN_PROCESS_ID) || other.fId.equals(UNKNOWN_PROCESS_ID)) {
return true;
}
-
+
return fId.equals(other.fId);
}
@Override
- public int hashCode() {
+ public int hashCode() {
// We cannot use fId in the hashCode. This is because we support
// the wildCard MIProcesses.UNKNOWN_PROCESS_ID which is equal to any other fId.
// But we also need the hashCode of the wildCard to be the same
// as the one of all other fIds, which is why we need a constant hashCode
// See bug 336890
- return baseHashCode();
- }
- }
-
- /*
- * The data of a corresponding thread or process.
- */
- @Immutable
- protected static class MIThreadDMData implements IThreadDMData {
- final String fName;
- final String fId;
-
- public MIThreadDMData(String name, String id) {
- fName = name;
- fId = id;
- }
-
- @Override
- public String getId() { return fId; }
- @Override
- public String getName() { return fName; }
- @Override
+ return baseHashCode();
+ }
+ }
+
+ /*
+ * The data of a corresponding thread or process.
+ */
+ @Immutable
+ protected static class MIThreadDMData implements IThreadDMData {
+ final String fName;
+ final String fId;
+
+ public MIThreadDMData(String name, String id) {
+ fName = name;
+ fId = id;
+ }
+
+ @Override
+ public String getId() {
+ return fId;
+ }
+
+ @Override
+ public String getName() {
+ return fName;
+ }
+
+ @Override
public boolean isDebuggerAttached() {
return true;
}
- }
-
- /**
- * Event indicating that an execution group (debugged process) has started. This event
- * implements the {@link IStartedMDEvent} from the IRunControl service.
- */
- public static class ContainerStartedDMEvent extends AbstractDMEvent<IExecutionDMContext>
- implements IStartedDMEvent
- {
- public ContainerStartedDMEvent(IContainerDMContext context) {
- super(context);
- }
- }
-
- /**
- * Event indicating that an execution group is no longer being debugged. This event
- * implements the {@link IExitedMDEvent} from the IRunControl service.
- */
- public static class ContainerExitedDMEvent extends AbstractDMEvent<IExecutionDMContext>
- implements IExitedDMEvent
- {
- public ContainerExitedDMEvent(IContainerDMContext context) {
- super(context);
- }
- }
-
- private ICommandControlService fCommandControl;
+ }
+
+ /**
+ * Event indicating that an execution group (debugged process) has started. This event
+ * implements the {@link IStartedMDEvent} from the IRunControl service.
+ */
+ public static class ContainerStartedDMEvent extends AbstractDMEvent<IExecutionDMContext>
+ implements IStartedDMEvent {
+ public ContainerStartedDMEvent(IContainerDMContext context) {
+ super(context);
+ }
+ }
+
+ /**
+ * Event indicating that an execution group is no longer being debugged. This event
+ * implements the {@link IExitedMDEvent} from the IRunControl service.
+ */
+ public static class ContainerExitedDMEvent extends AbstractDMEvent<IExecutionDMContext> implements IExitedDMEvent {
+ public ContainerExitedDMEvent(IContainerDMContext context) {
+ super(context);
+ }
+ }
+
+ private ICommandControlService fCommandControl;
private CommandCache fContainerCommandCache;
private CommandFactory fCommandFactory;
private IGDBBackend fGdbBackend;
@@ -344,48 +361,48 @@ public class MIProcesses extends AbstractDsfService implements IMIProcesses, ICa
/** @since 4.0 */
public static final String UNKNOWN_PROCESS_ID = UNIQUE_GROUP_ID;
- public MIProcesses(DsfSession session) {
- super(session);
- }
-
- /**
- * This method initializes this service.
- *
- * @param requestMonitor
- * The request monitor indicating the operation is finished
- */
- @Override
- public void initialize(final RequestMonitor requestMonitor) {
- super.initialize(new ImmediateRequestMonitor(requestMonitor) {
- @Override
- protected void handleSuccess() {
- doInitialize(requestMonitor);
+ public MIProcesses(DsfSession session) {
+ super(session);
+ }
+
+ /**
+ * This method initializes this service.
+ *
+ * @param requestMonitor
+ * The request monitor indicating the operation is finished
+ */
+ @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 this service.
-// register(new String[] { IProcesses.class.getName(),
-// MIProcesses.class.getName() },
-// new Hashtable<String, String>());
+
+ // // Register this service.
+ // register(new String[] { IProcesses.class.getName(),
+ // MIProcesses.class.getName() },
+ // new Hashtable<String, String>());
fCommandControl = getServicesTracker().getService(ICommandControlService.class);
BufferedCommandControl bufferedCommandControl = new BufferedCommandControl(fCommandControl, getExecutor(), 2);
-
+
fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
-
+
fGdbBackend = getServicesTracker().getService(IGDBBackend.class);
-
+
// This cache stores the result of a command when received; also, this cache
// is manipulated when receiving events. Currently, events are received after
// three scheduling of the executor, while command results after only one. This
@@ -394,9 +411,9 @@ public class MIProcesses extends AbstractDsfService implements IMIProcesses, ICa
// To solve this, we use a bufferedCommandControl that will delay the command
// result by two scheduling of the executor.
// See bug 280461
- fContainerCommandCache = new CommandCache(getSession(), bufferedCommandControl);
- fContainerCommandCache.setContextAvailable(fCommandControl.getContext(), true);
- getSession().addServiceEventListener(this, null);
+ fContainerCommandCache = new CommandCache(getSession(), bufferedCommandControl);
+ fContainerCommandCache.setContextAvailable(fCommandControl.getContext(), true);
+ getSession().addServiceEventListener(this, null);
requestMonitor.done();
}
@@ -405,16 +422,16 @@ public class MIProcesses extends AbstractDsfService implements IMIProcesses, ICa
* This method shuts down this service. It unregisters the service, stops
* receiving service events, and calls the superclass shutdown() method to
* finish the shutdown process.
- *
+ *
* @return void
*/
@Override
public void shutdown(RequestMonitor requestMonitor) {
-// unregister();
- getSession().removeServiceEventListener(this);
+ // unregister();
+ getSession().removeServiceEventListener(this);
super.shutdown(requestMonitor);
}
-
+
/**
* @return The bundle context of the plug-in to which this service belongs.
*/
@@ -422,168 +439,169 @@ public class MIProcesses extends AbstractDsfService implements IMIProcesses, ICa
protected BundleContext getBundleContext() {
return GdbPlugin.getBundleContext();
}
-
- @Override
- public IThreadDMContext createThreadContext(IProcessDMContext processDmc, String threadId) {
- return new MIThreadDMC(getSession().getId(), processDmc, threadId);
- }
@Override
- public IProcessDMContext createProcessContext(ICommandControlDMContext controlDmc, String pid) {
- return new MIProcessDMC(getSession().getId(), controlDmc, pid);
- }
-
+ public IThreadDMContext createThreadContext(IProcessDMContext processDmc, String threadId) {
+ return new MIThreadDMC(getSession().getId(), processDmc, threadId);
+ }
+
@Override
- public IMIExecutionDMContext createExecutionContext(IContainerDMContext containerDmc,
- IThreadDMContext threadDmc,
- String threadId) {
- return new MIExecutionDMC(getSession().getId(), containerDmc, threadDmc, threadId);
- }
+ public IProcessDMContext createProcessContext(ICommandControlDMContext controlDmc, String pid) {
+ return new MIProcessDMC(getSession().getId(), controlDmc, pid);
+ }
@Override
- public IMIContainerDMContext createContainerContext(IProcessDMContext processDmc,
- String groupId) {
- return new MIContainerDMC(getSession().getId(), processDmc, groupId);
- }
+ public IMIExecutionDMContext createExecutionContext(IContainerDMContext containerDmc, IThreadDMContext threadDmc,
+ String threadId) {
+ return new MIExecutionDMC(getSession().getId(), containerDmc, threadDmc, threadId);
+ }
@Override
- public IMIContainerDMContext createContainerContextFromThreadId(ICommandControlDMContext controlDmc, String threadId) {
- return createContainerContextFromGroupId(controlDmc, UNIQUE_GROUP_ID);
- }
-
- /** @since 4.0 */
+ public IMIContainerDMContext createContainerContext(IProcessDMContext processDmc, String groupId) {
+ return new MIContainerDMC(getSession().getId(), processDmc, groupId);
+ }
+
@Override
- public IMIContainerDMContext createContainerContextFromGroupId(ICommandControlDMContext controlDmc, String groupId) {
- IProcessDMContext processDmc = createProcessContext(controlDmc, UNKNOWN_PROCESS_ID);
- return createContainerContext(processDmc, groupId);
- }
+ public IMIContainerDMContext createContainerContextFromThreadId(ICommandControlDMContext controlDmc,
+ String threadId) {
+ return createContainerContextFromGroupId(controlDmc, UNIQUE_GROUP_ID);
+ }
+ /** @since 4.0 */
+ @Override
+ public IMIContainerDMContext createContainerContextFromGroupId(ICommandControlDMContext controlDmc,
+ String groupId) {
+ IProcessDMContext processDmc = createProcessContext(controlDmc, UNKNOWN_PROCESS_ID);
+ return createContainerContext(processDmc, groupId);
+ }
@Override
public void getExecutionData(IThreadDMContext dmc, final DataRequestMonitor<IThreadDMData> rm) {
if (dmc instanceof MIProcessDMC) {
- rm.setData(new MIThreadDMData("", ((MIProcessDMC)dmc).getProcId())); //$NON-NLS-1$
+ rm.setData(new MIThreadDMData("", ((MIProcessDMC) dmc).getProcId())); //$NON-NLS-1$
rm.done();
} else if (dmc instanceof MIThreadDMC) {
- final MIThreadDMC threadDmc = (MIThreadDMC)dmc;
-
+ final MIThreadDMC threadDmc = (MIThreadDMC) dmc;
+
IProcessDMContext procDmc = DMContexts.getAncestorOfType(dmc, IProcessDMContext.class);
- getDebuggingContext(procDmc,
- new DataRequestMonitor<IDMContext>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- if (getData() instanceof IMIContainerDMContext) {
- IMIContainerDMContext contDmc = (IMIContainerDMContext)getData();
- fContainerCommandCache.execute(fCommandFactory.createCLIInfoThreads(contDmc),
- new DataRequestMonitor<CLIInfoThreadsInfo>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- IThreadDMData threadData = null;
- for (CLIInfoThreadsInfo.ThreadInfo thread : getData().getThreadInfo()) {
- if (thread.getId().equals(threadDmc.getId())) {
- threadData = new MIThreadDMData(thread.getName(), thread.getOsId());
- break;
- }
- }
- if (threadData != null) {
- rm.setData(threadData);
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Could not get thread info", null)); //$NON-NLS-1$
- }
- rm.done();
- }
- });
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid DMC type", null)); //$NON-NLS-1$
- rm.done();
- }
- }
+ getDebuggingContext(procDmc, new DataRequestMonitor<IDMContext>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ if (getData() instanceof IMIContainerDMContext) {
+ IMIContainerDMContext contDmc = (IMIContainerDMContext) getData();
+ fContainerCommandCache.execute(fCommandFactory.createCLIInfoThreads(contDmc),
+ new DataRequestMonitor<CLIInfoThreadsInfo>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ IThreadDMData threadData = null;
+ for (CLIInfoThreadsInfo.ThreadInfo thread : getData().getThreadInfo()) {
+ if (thread.getId().equals(threadDmc.getId())) {
+ threadData = new MIThreadDMData(thread.getName(), thread.getOsId());
+ break;
+ }
+ }
+ if (threadData != null) {
+ rm.setData(threadData);
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE,
+ "Could not get thread info", null)); //$NON-NLS-1$
+ }
+ rm.done();
+ }
+ });
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid DMC type", //$NON-NLS-1$
+ null));
+ rm.done();
+ }
+ }
});
}
}
-
+
@Override
- public void getDebuggingContext(IThreadDMContext dmc, DataRequestMonitor<IDMContext> rm) {
- if (dmc instanceof MIProcessDMC) {
- MIProcessDMC procDmc = (MIProcessDMC)dmc;
- rm.setData(createContainerContext(procDmc, procDmc.getProcId()));
- } else if (dmc instanceof MIThreadDMC) {
- MIThreadDMC threadDmc = (MIThreadDMC)dmc;
- IMIProcessDMContext procDmc = DMContexts.getAncestorOfType(dmc, IMIProcessDMContext.class);
- IMIContainerDMContext containerDmc = createContainerContext(procDmc, procDmc.getProcId());
- rm.setData(createExecutionContext(containerDmc, threadDmc, threadDmc.getId()));
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid thread context.", null)); //$NON-NLS-1$
- }
-
- rm.done();
- }
-
+ public void getDebuggingContext(IThreadDMContext dmc, DataRequestMonitor<IDMContext> rm) {
+ if (dmc instanceof MIProcessDMC) {
+ MIProcessDMC procDmc = (MIProcessDMC) dmc;
+ rm.setData(createContainerContext(procDmc, procDmc.getProcId()));
+ } else if (dmc instanceof MIThreadDMC) {
+ MIThreadDMC threadDmc = (MIThreadDMC) dmc;
+ IMIProcessDMContext procDmc = DMContexts.getAncestorOfType(dmc, IMIProcessDMContext.class);
+ IMIContainerDMContext containerDmc = createContainerContext(procDmc, procDmc.getProcId());
+ rm.setData(createExecutionContext(containerDmc, threadDmc, threadDmc.getId()));
+ } else {
+ rm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid thread context.", null)); //$NON-NLS-1$
+ }
+
+ rm.done();
+ }
+
@Override
- public void isDebuggerAttachSupported(IDMContext dmc, DataRequestMonitor<Boolean> rm) {
- rm.setData(false);
- rm.done();
- }
+ public void isDebuggerAttachSupported(IDMContext dmc, DataRequestMonitor<Boolean> rm) {
+ rm.setData(false);
+ rm.done();
+ }
@Override
- public void attachDebuggerToProcess(final IProcessDMContext procCtx, final DataRequestMonitor<IDMContext> rm) {
+ public void attachDebuggerToProcess(final IProcessDMContext procCtx, final DataRequestMonitor<IDMContext> rm) {
if (procCtx instanceof IMIProcessDMContext) {
ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(procCtx, ICommandControlDMContext.class);
fCommandControl.queueCommand(
- fCommandFactory.createCLIAttach(controlDmc, ((IMIProcessDMContext)procCtx).getProcId()),
+ fCommandFactory.createCLIAttach(controlDmc, ((IMIProcessDMContext) procCtx).getProcId()),
new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
@Override
protected void handleSuccess() {
- IMIContainerDMContext containerDmc = createContainerContext(procCtx, MIProcesses.UNIQUE_GROUP_ID);
- getSession().dispatchEvent(new ContainerStartedDMEvent(containerDmc),
- getProperties());
- rm.setData(containerDmc);
+ IMIContainerDMContext containerDmc = createContainerContext(procCtx,
+ MIProcesses.UNIQUE_GROUP_ID);
+ getSession().dispatchEvent(new ContainerStartedDMEvent(containerDmc), getProperties());
+ rm.setData(containerDmc);
rm.done();
}
});
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid process context.", null)); //$NON-NLS-1$
- rm.done();
- }
+ } else {
+ rm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid process context.", null)); //$NON-NLS-1$
+ rm.done();
+ }
}
-
+
@Override
- public void canDetachDebuggerFromProcess(IDMContext dmc, DataRequestMonitor<Boolean> rm) {
- rm.setData(false);
- rm.done();
- }
+ public void canDetachDebuggerFromProcess(IDMContext dmc, DataRequestMonitor<Boolean> rm) {
+ rm.setData(false);
+ rm.done();
+ }
@Override
- public void detachDebuggerFromProcess(final IDMContext dmc, final RequestMonitor rm) {
- ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
+ public void detachDebuggerFromProcess(final IDMContext dmc, final RequestMonitor rm) {
+ ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
- if (controlDmc != null) {
+ if (controlDmc != null) {
IMIRunControl runControl = getServicesTracker().getService(IMIRunControl.class);
if (runControl != null && !runControl.isTargetAcceptingCommands()) {
fGdbBackend.interrupt();
}
- // This service version cannot use -target-detach because it didn't exist
- // in versions of GDB up to and including GDB 6.8
- fCommandControl.queueCommand(
- fCommandFactory.createCLIDetach(controlDmc),
- new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- IContainerDMContext containerDmc = DMContexts.getAncestorOfType(dmc, IContainerDMContext.class);
- if (containerDmc != null) {
- getSession().dispatchEvent(new ContainerExitedDMEvent(containerDmc),
- getProperties());
- }
- rm.done();
- }
- });
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid context.", null)); //$NON-NLS-1$
- rm.done();
- }
+ // This service version cannot use -target-detach because it didn't exist
+ // in versions of GDB up to and including GDB 6.8
+ fCommandControl.queueCommand(fCommandFactory.createCLIDetach(controlDmc),
+ new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ IContainerDMContext containerDmc = DMContexts.getAncestorOfType(dmc,
+ IContainerDMContext.class);
+ if (containerDmc != null) {
+ getSession().dispatchEvent(new ContainerExitedDMEvent(containerDmc), getProperties());
+ }
+ rm.done();
+ }
+ });
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid context.", null)); //$NON-NLS-1$
+ rm.done();
+ }
}
@Override
@@ -595,23 +613,21 @@ public class MIProcesses extends AbstractDsfService implements IMIProcesses, ICa
@Override
public void isDebugNewProcessSupported(IDMContext dmc, DataRequestMonitor<Boolean> rm) {
rm.setData(false);
- rm.done();
+ rm.done();
}
@Override
- public void debugNewProcess(IDMContext dmc, String file,
- Map<String, Object> attributes, DataRequestMonitor<IDMContext> rm) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
- NOT_SUPPORTED, "Not supported", null)); //$NON-NLS-1$
+ public void debugNewProcess(IDMContext dmc, String file, Map<String, Object> attributes,
+ DataRequestMonitor<IDMContext> rm) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Not supported", null)); //$NON-NLS-1$
rm.done();
}
-
+
@Override
public void getProcessesBeingDebugged(IDMContext dmc, final DataRequestMonitor<IDMContext[]> rm) {
final IMIContainerDMContext containerDmc = DMContexts.getAncestorOfType(dmc, IMIContainerDMContext.class);
if (containerDmc != null) {
- fContainerCommandCache.execute(
- fCommandFactory.createMIThreadListIds(containerDmc),
+ fContainerCommandCache.execute(fCommandFactory.createMIThreadListIds(containerDmc),
new DataRequestMonitor<MIThreadListIdsInfo>(getExecutor(), rm) {
@Override
protected void handleSuccess() {
@@ -624,7 +640,7 @@ public class MIProcesses extends AbstractDsfService implements IMIProcesses, ICa
// create the context describing this process ourselves.
ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
IMIContainerDMContext newContainerDmc = createContainerContextFromGroupId(controlDmc, UNIQUE_GROUP_ID);
- rm.setData(new IContainerDMContext[] {newContainerDmc});
+ rm.setData(new IContainerDMContext[] { newContainerDmc });
rm.done();
}
}
@@ -637,108 +653,104 @@ public class MIProcesses extends AbstractDsfService implements IMIProcesses, ICa
// So create thread-id = 0 when no thread is reported.
// This hack is necessary to prevent AbstractMIControl from issuing a thread-select
// because it doesn't work if the application was not compiled with pthread.
- return new IMIExecutionDMContext[]{createExecutionContext(containerDmc,
- createThreadContext(procDmc, FAKE_THREAD_ID),
- FAKE_THREAD_ID)};
+ return new IMIExecutionDMContext[] { createExecutionContext(containerDmc,
+ createThreadContext(procDmc, FAKE_THREAD_ID), FAKE_THREAD_ID) };
} else {
IExecutionDMContext[] executionDmcs = new IMIExecutionDMContext[info.getStrThreadIds().length];
for (int i = 0; i < info.getStrThreadIds().length; i++) {
String threadId = info.getStrThreadIds()[i];
- executionDmcs[i] = createExecutionContext(containerDmc,
- createThreadContext(procDmc, threadId),
- threadId);
+ executionDmcs[i] = createExecutionContext(containerDmc, createThreadContext(procDmc, threadId),
+ threadId);
}
return executionDmcs;
}
}
-
+
@Override
- public void getRunningProcesses(IDMContext dmc, final DataRequestMonitor<IProcessDMContext[]> rm) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
- NOT_SUPPORTED, "Not supported", null)); //$NON-NLS-1$
+ public void getRunningProcesses(IDMContext dmc, final DataRequestMonitor<IProcessDMContext[]> rm) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Not supported", null)); //$NON-NLS-1$
rm.done();
}
@Override
public void isRunNewProcessSupported(IDMContext dmc, DataRequestMonitor<Boolean> rm) {
rm.setData(false);
- rm.done();
+ rm.done();
}
-
+
@Override
- public void runNewProcess(IDMContext dmc, String file,
- Map<String, Object> attributes, DataRequestMonitor<IProcessDMContext> rm) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
- NOT_SUPPORTED, "Not supported", null)); //$NON-NLS-1$
+ public void runNewProcess(IDMContext dmc, String file, Map<String, Object> attributes,
+ DataRequestMonitor<IProcessDMContext> rm) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Not supported", null)); //$NON-NLS-1$
rm.done();
}
@Override
public void terminate(IThreadDMContext thread, RequestMonitor rm) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
- NOT_SUPPORTED, "Not supported", null)); //$NON-NLS-1$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Not supported", null)); //$NON-NLS-1$
rm.done();
}
- /**
- * @nooverride This method is not intended to be re-implemented or extended by clients.
- * @noreference This method is not intended to be referenced by clients.
- */
- @DsfServiceEventHandler
- public void eventDispatched(IResumedDMEvent e) {
- if (e instanceof IContainerResumedDMEvent) {
- // This will happen in all-stop mode
- fContainerCommandCache.setContextAvailable(e.getDMContext(), false);
- } else {
- // This will happen in non-stop mode
- // Keep target available for Container commands
- }
- }
-
-
- /**
- * @nooverride This method is not intended to be re-implemented or extended by clients.
- * @noreference This method is not intended to be referenced by clients.
- */
- @DsfServiceEventHandler
- public void eventDispatched(ISuspendedDMEvent e) {
+ /**
+ * @nooverride This method is not intended to be re-implemented or extended by clients.
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ @DsfServiceEventHandler
+ public void eventDispatched(IResumedDMEvent e) {
+ if (e instanceof IContainerResumedDMEvent) {
+ // This will happen in all-stop mode
+ fContainerCommandCache.setContextAvailable(e.getDMContext(), false);
+ } else {
+ // This will happen in non-stop mode
+ // Keep target available for Container commands
+ }
+ }
+
+ /**
+ * @nooverride This method is not intended to be re-implemented or extended by clients.
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ @DsfServiceEventHandler
+ public void eventDispatched(ISuspendedDMEvent e) {
// This assert may turn out to be overzealous. Refer to
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=280631#c26
- assert e instanceof IContainerSuspendedDMEvent : "Unexpected type of suspended event: " + e.getClass().toString(); //$NON-NLS-1$
-
- fContainerCommandCache.setContextAvailable(e.getDMContext(), true);
-
+ assert e instanceof IContainerSuspendedDMEvent : "Unexpected type of suspended event: " //$NON-NLS-1$
+ + e.getClass().toString();
+
+ fContainerCommandCache.setContextAvailable(e.getDMContext(), true);
+
// If user is debugging a gdb target that doesn't send thread
// creation events, make sure we don't use cached thread
// information. Reset the cache after every suspend. See bugzilla
// 280631
- try {
+ try {
if (fGdbBackend.getUpdateThreadListOnSuspend()) {
fContainerCommandCache.reset(e.getDMContext());
}
- } catch (CoreException exc) {}
- }
-
- /**
- * @nooverride This method is not intended to be re-implemented or extended by clients.
- * @noreference This method is not intended to be referenced by clients.
- */
- @DsfServiceEventHandler
- public void eventDispatched(IStartedDMEvent e) {
- fContainerCommandCache.reset();
- }
-
- /**
- * @nooverride This method is not intended to be re-implemented or extended by clients.
- * @noreference This method is not intended to be referenced by clients.
- */
- @DsfServiceEventHandler
- public void eventDispatched(IExitedDMEvent e) {
- fContainerCommandCache.reset();
- }
+ } catch (CoreException exc) {
+ }
+ }
+
+ /**
+ * @nooverride This method is not intended to be re-implemented or extended by clients.
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ @DsfServiceEventHandler
+ public void eventDispatched(IStartedDMEvent e) {
+ fContainerCommandCache.reset();
+ }
+
+ /**
+ * @nooverride This method is not intended to be re-implemented or extended by clients.
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ @DsfServiceEventHandler
+ public void eventDispatched(IExitedDMEvent e) {
+ fContainerCommandCache.reset();
+ }
@Override
public void flushCache(IDMContext context) {
- fContainerCommandCache.reset(context);
+ fContainerCommandCache.reset(context);
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRegisters.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRegisters.java
index 450c05cd6f3..ea906867ac7 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRegisters.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRegisters.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* Ericsson - Modified for additional features in DSF Reference Implementation
@@ -58,14 +58,14 @@ import org.eclipse.core.runtime.Status;
import org.osgi.framework.BundleContext;
/**
- *
- * <p>
+ *
+ * <p>
* Implementation note:
- * This class implements event handlers for the events that are generated by
+ * This class implements event handlers for the events that are generated by
* this service itself. When the event is dispatched, these handlers will
- * be called first, before any of the clients. These handlers update the
- * service's internal state information to make them consistent with the
- * events being issued. Doing this in the handlers as opposed to when
+ * be called first, before any of the clients. These handlers update the
+ * service's internal state information to make them consistent with the
+ * events being issued. Doing this in the handlers as opposed to when
* the events are generated, guarantees that the state of the service will
* always be consistent with the events.
*/
@@ -83,86 +83,95 @@ public class MIRegisters extends AbstractDsfService implements IRegisters, ICach
* @since 4.6
*/
protected static final String ROOT_GROUP_DESCRIPTION = Messages.MIRegisters_General_Registers_description;
- /*
- * Support class used to construct Register Group DMCs.
- */
-
- public static class MIRegisterGroupDMC extends AbstractDMContext implements IRegisterGroupDMContext {
- private final int fGroupNo;
+ /*
+ * Support class used to construct Register Group DMCs.
+ */
+
+ public static class MIRegisterGroupDMC extends AbstractDMContext implements IRegisterGroupDMContext {
+ private final int fGroupNo;
private final IContainerDMContext parent;
- private String fGroupName;
+ private String fGroupName;
- public MIRegisterGroupDMC(MIRegisters service, IContainerDMContext contDmc, int groupNo, String groupName) {
- super(service.getSession().getId(), new IDMContext[] { contDmc });
+ public MIRegisterGroupDMC(MIRegisters service, IContainerDMContext contDmc, int groupNo, String groupName) {
+ super(service.getSession().getId(), new IDMContext[] { contDmc });
this.parent = contDmc;
- fGroupNo = groupNo;
- fGroupName = groupName;
- }
-
- public int getGroupNo() { return fGroupNo; }
- public String getName() { return fGroupName; }
-
- /**
+ fGroupNo = groupNo;
+ fGroupName = groupName;
+ }
+
+ public int getGroupNo() {
+ return fGroupNo;
+ }
+
+ public String getName() {
+ return fGroupName;
+ }
+
+ /**
* @since 5.3
*/
- public IContainerDMContext getContainerParent() {
+ public IContainerDMContext getContainerParent() {
return parent;
}
-
- /**
+
+ /**
* @since 4.6
*/
public void setName(String groupName) {
fGroupName = groupName;
}
- @Override
- public boolean equals(Object other) {
- return ((super.baseEquals(other)) && (((MIRegisterGroupDMC) other).fGroupNo == fGroupNo) &&
- (((MIRegisterGroupDMC) other).fGroupName.equals(fGroupName)));
- }
-
- @Override
- public int hashCode() { return super.baseHashCode() ^ fGroupNo; }
- @Override
- public String toString() { return baseToString() + ".group[" + fGroupNo + "," + fGroupName + "]"; } //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- /*
- * Support class used to construct Register DMCs.
- */
-
- public static class MIRegisterDMC extends AbstractDMContext implements IRegisterDMContext {
- private int fRegNo;
- private String fRegName;
-
- /**
- * An MIRegiserDMC created with no frame context will not be able to resolve the associated register value.
- * However these instances are useful to provide the register name i.e. needed from the selection of a process,
- * or a running thread where it is not possible to associate registers to frames and therefore values.
- */
- public MIRegisterDMC(MIRegisters service, MIRegisterGroupDMC group, int regNo, String regName) {
- super(service.getSession().getId(),
- new IDMContext[] { group });
- fRegNo = regNo;
- fRegName = regName;
- }
-
- @Deprecated
- public MIRegisterDMC(MIRegisters service, MIRegisterGroupDMC group, IMIExecutionDMContext execDmc, int regNo, String regName) {
- super(service.getSession().getId(),
- new IDMContext[] { execDmc, group });
- fRegNo = regNo;
- fRegName = regName;
- }
+ @Override
+ public boolean equals(Object other) {
+ return ((super.baseEquals(other)) && (((MIRegisterGroupDMC) other).fGroupNo == fGroupNo)
+ && (((MIRegisterGroupDMC) other).fGroupName.equals(fGroupName)));
+ }
+
+ @Override
+ public int hashCode() {
+ return super.baseHashCode() ^ fGroupNo;
+ }
+
+ @Override
+ public String toString() {
+ return baseToString() + ".group[" + fGroupNo + "," + fGroupName + "]"; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
+ }
+ }
+
+ /*
+ * Support class used to construct Register DMCs.
+ */
+
+ public static class MIRegisterDMC extends AbstractDMContext implements IRegisterDMContext {
+ private int fRegNo;
+ private String fRegName;
+
+ /**
+ * An MIRegiserDMC created with no frame context will not be able to resolve the associated register value.
+ * However these instances are useful to provide the register name i.e. needed from the selection of a process,
+ * or a running thread where it is not possible to associate registers to frames and therefore values.
+ */
+ public MIRegisterDMC(MIRegisters service, MIRegisterGroupDMC group, int regNo, String regName) {
+ super(service.getSession().getId(), new IDMContext[] { group });
+ fRegNo = regNo;
+ fRegName = regName;
+ }
+
+ @Deprecated
+ public MIRegisterDMC(MIRegisters service, MIRegisterGroupDMC group, IMIExecutionDMContext execDmc, int regNo,
+ String regName) {
+ super(service.getSession().getId(), new IDMContext[] { execDmc, group });
+ fRegNo = regNo;
+ fRegName = regName;
+ }
/**
* This Register context is associated to two parent contexts. A stack frame context (IFrameDMContext), and a
* register group context (MIRegisterGroupDMC). When the scenario requires to build a register contexts from the
* selection of a thread, then the top frame shall be resolved and be provided in this constructor.
- *
+ *
* The frame context is necessary to resolve the register's data e.g. value
- *
+ *
* @since 4.3
*/
public MIRegisterDMC(MIRegisters service, MIRegisterGroupDMC group, IFrameDMContext frameDmc, int regNo,
@@ -171,44 +180,54 @@ public class MIRegisters extends AbstractDsfService implements IRegisters, ICach
fRegNo = regNo;
fRegName = regName;
}
-
- public int getRegNo() { return fRegNo; }
- public String getName() { return fRegName; }
-
- @Override
- public boolean equals(Object other) {
- return ((super.baseEquals(other)) && (((MIRegisterDMC) other).fRegNo == fRegNo) &&
- (((MIRegisterDMC) other).fRegName.equals(fRegName)));
- }
-
- @Override
- public int hashCode() { return super.baseHashCode() ^ fRegNo; }
- @Override
- public String toString() { return baseToString() + ".register[" + fRegNo + "]"; } //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /*
- * Event class to notify register value is changed
- */
- public static class RegisterChangedDMEvent implements IRegisters.IRegisterChangedDMEvent {
-
- private final IRegisterDMContext fRegisterDmc;
-
- /**
+
+ public int getRegNo() {
+ return fRegNo;
+ }
+
+ public String getName() {
+ return fRegName;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ return ((super.baseEquals(other)) && (((MIRegisterDMC) other).fRegNo == fRegNo)
+ && (((MIRegisterDMC) other).fRegName.equals(fRegName)));
+ }
+
+ @Override
+ public int hashCode() {
+ return super.baseHashCode() ^ fRegNo;
+ }
+
+ @Override
+ public String toString() {
+ return baseToString() + ".register[" + fRegNo + "]"; //$NON-NLS-1$//$NON-NLS-2$
+ }
+ }
+
+ /*
+ * Event class to notify register value is changed
+ */
+ public static class RegisterChangedDMEvent implements IRegisters.IRegisterChangedDMEvent {
+
+ private final IRegisterDMContext fRegisterDmc;
+
+ /**
* @since 4.6
*/
- public RegisterChangedDMEvent(IRegisterDMContext registerDMC) {
- fRegisterDmc = registerDMC;
- }
-
- @Override
+ public RegisterChangedDMEvent(IRegisterDMContext registerDMC) {
+ fRegisterDmc = registerDMC;
+ }
+
+ @Override
public IRegisterDMContext getDMContext() {
return fRegisterDmc;
}
- }
-
- /**
- * Indicates a change in the list of Register groups e.g. after addition and removal
+ }
+
+ /**
+ * Indicates a change in the list of Register groups e.g. after addition and removal
* @since 4.6
*/
public static class GroupsChangedDMEvent implements IRegisters.IGroupsChangedDMEvent {
@@ -225,46 +244,44 @@ public class MIRegisters extends AbstractDsfService implements IRegisters, ICach
}
}
- /*
- * Internal control variables.
- */
-
+ /*
+ * Internal control variables.
+ */
+
private CommandFactory fCommandFactory;
- //One Group per container process
- private final Map<IContainerDMContext, MIRegisterGroupDMC> fContainerToGroupMap = new HashMap<IContainerDMContext, MIRegisterGroupDMC>();
-
- private CommandCache fRegisterNameCache; // Cache for holding the Register Names in the single Group
- private CommandCache fRegisterValueCache; // Cache for holding the Register Values
-
- public MIRegisters(DsfSession session)
- {
- super(session);
- }
-
- @Override
- protected BundleContext getBundleContext()
- {
- return GdbPlugin.getBundleContext();
- }
-
- @Override
- public void initialize(final RequestMonitor requestMonitor) {
- super.initialize(
- new ImmediateRequestMonitor(requestMonitor) {
- @Override
- protected void handleSuccess() {
- doInitialize(requestMonitor);
- }});
- }
-
- private void doInitialize(RequestMonitor requestMonitor) {
- /*
- * Create the lower level register cache.
- */
- ICommandControlService commandControl = getServicesTracker().getService(ICommandControlService.class);
+ //One Group per container process
+ private final Map<IContainerDMContext, MIRegisterGroupDMC> fContainerToGroupMap = new HashMap<IContainerDMContext, MIRegisterGroupDMC>();
+
+ private CommandCache fRegisterNameCache; // Cache for holding the Register Names in the single Group
+ private CommandCache fRegisterValueCache; // Cache for holding the Register Values
+
+ public MIRegisters(DsfSession session) {
+ super(session);
+ }
+
+ @Override
+ protected BundleContext getBundleContext() {
+ return GdbPlugin.getBundleContext();
+ }
+
+ @Override
+ public void initialize(final RequestMonitor requestMonitor) {
+ super.initialize(new ImmediateRequestMonitor(requestMonitor) {
+ @Override
+ protected void handleSuccess() {
+ doInitialize(requestMonitor);
+ }
+ });
+ }
+
+ private void doInitialize(RequestMonitor requestMonitor) {
+ /*
+ * Create the lower level register cache.
+ */
+ ICommandControlService commandControl = getServicesTracker().getService(ICommandControlService.class);
BufferedCommandControl bufferedCommandControl = new BufferedCommandControl(commandControl, getExecutor(), 2);
-
+
fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
// This cache stores the result of a command when received; also, this cache
@@ -275,342 +292,383 @@ public class MIRegisters extends AbstractDsfService implements IRegisters, ICach
// To solve this, we use a bufferedCommandControl that will delay the command
// result by two scheduling of the executor.
// See bug 280461
- fRegisterValueCache = new CommandCache(getSession(), bufferedCommandControl);
- fRegisterValueCache.setContextAvailable(commandControl.getContext(), true);
-
- // This cache is not affected by events so does not need the bufferedCommandControl
- fRegisterNameCache = new CommandCache(getSession(), commandControl);
- fRegisterNameCache.setContextAvailable(commandControl.getContext(), true);
-
- /*
- * Sign up so we see events. We use these events to decide how to manage
- * any local caches we are providing as well as the lower level register
- * cache we create to get/set registers on the target.
- */
- getSession().addServiceEventListener(this, null);
-
- /*
- * Make ourselves known so clients can use us.
- */
- register(new String[]{IRegisters.class.getName(), MIRegisters.class.getName()}, new Hashtable<String,String>());
-
- requestMonitor.done();
- }
-
- @Override
- public void shutdown(RequestMonitor requestMonitor)
- {
- unregister();
- getSession().removeServiceEventListener(this);
- super.shutdown(requestMonitor);
- }
-
- public boolean isValid() { return true; }
-
+ fRegisterValueCache = new CommandCache(getSession(), bufferedCommandControl);
+ fRegisterValueCache.setContextAvailable(commandControl.getContext(), true);
+
+ // This cache is not affected by events so does not need the bufferedCommandControl
+ fRegisterNameCache = new CommandCache(getSession(), commandControl);
+ fRegisterNameCache.setContextAvailable(commandControl.getContext(), true);
+
+ /*
+ * Sign up so we see events. We use these events to decide how to manage
+ * any local caches we are providing as well as the lower level register
+ * cache we create to get/set registers on the target.
+ */
+ getSession().addServiceEventListener(this, null);
+
+ /*
+ * Make ourselves known so clients can use us.
+ */
+ register(new String[] { IRegisters.class.getName(), MIRegisters.class.getName() },
+ new Hashtable<String, String>());
+
+ requestMonitor.done();
+ }
+
@Override
- public void getFormattedExpressionValue(FormattedValueDMContext dmc, DataRequestMonitor<FormattedValueDMData> rm) {
- if (dmc.getParents().length == 1 && dmc.getParents()[0] instanceof MIRegisterDMC) {
- getRegisterDataValue( (MIRegisterDMC) dmc.getParents()[0], dmc.getFormatID(), rm);
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Unknown DMC type", null)); //$NON-NLS-1$
- rm.done();
- }
- }
-
+ public void shutdown(RequestMonitor requestMonitor) {
+ unregister();
+ getSession().removeServiceEventListener(this);
+ super.shutdown(requestMonitor);
+ }
+
+ public boolean isValid() {
+ return true;
+ }
+
@Override
- public void getRegisterGroupData(IRegisterGroupDMContext regGroupDmc, DataRequestMonitor<IRegisterGroupDMData> rm) {
- /**
- * For the GDB GDBMI implementation there is only on group. The GPR and FPU registers are grouped into
- * one set. We are going to hard wire this set as the value of ROOT_GROUP_NAME.
- */
- class RegisterGroupData implements IRegisterGroupDMData {
- @Override
- public String getName() { return ROOT_GROUP_NAME; }
- @Override
- public String getDescription() { return ROOT_GROUP_DESCRIPTION; }
- }
-
- rm.setData( new RegisterGroupData() ) ;
- rm.done();
- }
+ public void getFormattedExpressionValue(FormattedValueDMContext dmc, DataRequestMonitor<FormattedValueDMData> rm) {
+ if (dmc.getParents().length == 1 && dmc.getParents()[0] instanceof MIRegisterDMC) {
+ getRegisterDataValue((MIRegisterDMC) dmc.getParents()[0], dmc.getFormatID(), rm);
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Unknown DMC type", null)); //$NON-NLS-1$
+ rm.done();
+ }
+ }
+
+ @Override
+ public void getRegisterGroupData(IRegisterGroupDMContext regGroupDmc, DataRequestMonitor<IRegisterGroupDMData> rm) {
+ /**
+ * For the GDB GDBMI implementation there is only on group. The GPR and FPU registers are grouped into
+ * one set. We are going to hard wire this set as the value of ROOT_GROUP_NAME.
+ */
+ class RegisterGroupData implements IRegisterGroupDMData {
+ @Override
+ public String getName() {
+ return ROOT_GROUP_NAME;
+ }
+
+ @Override
+ public String getDescription() {
+ return ROOT_GROUP_DESCRIPTION;
+ }
+ }
+
+ rm.setData(new RegisterGroupData());
+ rm.done();
+ }
@Override
- public void getBitFieldData(IBitFieldDMContext dmc, DataRequestMonitor<IBitFieldDMData> rm) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Bit fields not yet supported", null)); //$NON-NLS-1$
- rm.done();
- }
-
- /**
- * For the GDB GDBMI implementation there is only on group. We represent
- * this group as a single list we maintain within this service. So we
- * need to search this list to see if we have a current value.
- */
+ public void getBitFieldData(IBitFieldDMContext dmc, DataRequestMonitor<IBitFieldDMData> rm) {
+ rm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Bit fields not yet supported", null)); //$NON-NLS-1$
+ rm.done();
+ }
+
+ /**
+ * For the GDB GDBMI implementation there is only on group. We represent
+ * this group as a single list we maintain within this service. So we
+ * need to search this list to see if we have a current value.
+ */
@Override
- public void getRegisterData(IRegisterDMContext regDmc , final DataRequestMonitor<IRegisterDMData> rm) {
- if (regDmc instanceof MIRegisterDMC) {
- final MIRegisterDMC miRegDmc = (MIRegisterDMC)regDmc;
- final IFrameDMContext frameDmc = DMContexts.getAncestorOfType(regDmc, IFrameDMContext.class);
- // Create register data with name only e.g. not editable.
- if(frameDmc == null){
- rm.setData(new RegisterData(null, miRegDmc.getName(), BLANK_STRING, false));
- rm.done();
- return;
- }
-
- int[] regnos = {miRegDmc.getRegNo()};
- fRegisterValueCache.execute(
- fCommandFactory.createMIDataListRegisterValues(frameDmc, MIFormat.HEXADECIMAL, regnos),
- new DataRequestMonitor<MIDataListRegisterValuesInfo>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- // Retrieve the register value.
- MIRegisterValue[] regValue = getData().getMIRegisterValues();
-
- // If the list is empty just return empty handed.
- // The only known case this happens is caused by a bug in GDB's Python
- // scripts. See https://sourceware.org/bugzilla/show_bug.cgi?id=19637
- // In this case, we know the register name anyway, we just guess that
- // it is not floating point. The matching code in getRegisterDataValue()
- // displays the error with link to a workaround
- if (regValue.length == 0) {
- rm.setData(new RegisterData(frameDmc, miRegDmc.getName(), BLANK_STRING, false));
- rm.done();
- return;
- }
-
- // the request was for only one register
- assert regValue.length == 1;
-
- // We can determine if the register is floating point because
- // GDB returns this additional information as part of the value.
- MIRegisterValue reg = regValue[0];
- boolean isFloat = false;
-
- if ( reg.getValue().contains("float")) { //$NON-NLS-1$
- isFloat = true;
- }
-
- // Return the new register attributes.
- rm.setData(new RegisterData(frameDmc, miRegDmc.getName(), BLANK_STRING, isFloat));
- rm.done();
- }
- });
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Unknown DMC type", null)); //$NON-NLS-1$
- rm.done();
- }
- }
-
- private void getRegisterDataValue( final MIRegisterDMC regDmc, final String formatId, final DataRequestMonitor<FormattedValueDMData> rm) {
- IFrameDMContext frameDmc = DMContexts.getAncestorOfType(regDmc, IFrameDMContext.class);
- if(frameDmc == null){
- // Set value to blank if frame dmc is not present
- rm.setData( new FormattedValueDMData( BLANK_STRING ) );
- rm.done();
- return;
- }
-
- // Select the format to be shown
- int NumberFormat = MIFormat.HEXADECIMAL;
-
- if ( HEX_FORMAT.equals ( formatId ) ) { NumberFormat = MIFormat.HEXADECIMAL; }
- if ( OCTAL_FORMAT.equals ( formatId ) ) { NumberFormat = MIFormat.OCTAL; }
- if ( NATURAL_FORMAT.equals( formatId ) ) { NumberFormat = MIFormat.NATURAL; }
- if ( BINARY_FORMAT.equals ( formatId ) ) { NumberFormat = MIFormat.BINARY; }
- if ( DECIMAL_FORMAT.equals( formatId ) ) { NumberFormat = MIFormat.DECIMAL; }
-
- int[] regnos = {regDmc.getRegNo()};
- fRegisterValueCache.execute(
- fCommandFactory.createMIDataListRegisterValues(frameDmc, NumberFormat, regnos),
- new DataRequestMonitor<MIDataListRegisterValuesInfo>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- // Retrieve the register value.
- MIRegisterValue[] regValue = getData().getMIRegisterValues();
-
- // If the list is empty just return empty handed.
- // The only known case this happens is caused by a bug in GDB's Python
- // scripts. See https://sourceware.org/bugzilla/show_bug.cgi?id=19637
- // In the display data, we show link to Eclipse Bugzilla entry which has
- // a comment on how to fix this manually.
- if (regValue.length == 0) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
- IDsfStatusConstants.REQUEST_FAILED,
- "Encountered a GDB Error See http://eclip.se/506382#c7 for workarounds", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- MIRegisterValue reg = regValue[0];
-
- // Return the new register value.
- rm.setData( new FormattedValueDMData( reg.getValue() ) );
- rm.done();
- }
- });
- }
-
- /**
+ public void getRegisterData(IRegisterDMContext regDmc, final DataRequestMonitor<IRegisterDMData> rm) {
+ if (regDmc instanceof MIRegisterDMC) {
+ final MIRegisterDMC miRegDmc = (MIRegisterDMC) regDmc;
+ final IFrameDMContext frameDmc = DMContexts.getAncestorOfType(regDmc, IFrameDMContext.class);
+ // Create register data with name only e.g. not editable.
+ if (frameDmc == null) {
+ rm.setData(new RegisterData(null, miRegDmc.getName(), BLANK_STRING, false));
+ rm.done();
+ return;
+ }
+
+ int[] regnos = { miRegDmc.getRegNo() };
+ fRegisterValueCache.execute(
+ fCommandFactory.createMIDataListRegisterValues(frameDmc, MIFormat.HEXADECIMAL, regnos),
+ new DataRequestMonitor<MIDataListRegisterValuesInfo>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ // Retrieve the register value.
+ MIRegisterValue[] regValue = getData().getMIRegisterValues();
+
+ // If the list is empty just return empty handed.
+ // The only known case this happens is caused by a bug in GDB's Python
+ // scripts. See https://sourceware.org/bugzilla/show_bug.cgi?id=19637
+ // In this case, we know the register name anyway, we just guess that
+ // it is not floating point. The matching code in getRegisterDataValue()
+ // displays the error with link to a workaround
+ if (regValue.length == 0) {
+ rm.setData(new RegisterData(frameDmc, miRegDmc.getName(), BLANK_STRING, false));
+ rm.done();
+ return;
+ }
+
+ // the request was for only one register
+ assert regValue.length == 1;
+
+ // We can determine if the register is floating point because
+ // GDB returns this additional information as part of the value.
+ MIRegisterValue reg = regValue[0];
+ boolean isFloat = false;
+
+ if (reg.getValue().contains("float")) { //$NON-NLS-1$
+ isFloat = true;
+ }
+
+ // Return the new register attributes.
+ rm.setData(new RegisterData(frameDmc, miRegDmc.getName(), BLANK_STRING, isFloat));
+ rm.done();
+ }
+ });
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Unknown DMC type", null)); //$NON-NLS-1$
+ rm.done();
+ }
+ }
+
+ private void getRegisterDataValue(final MIRegisterDMC regDmc, final String formatId,
+ final DataRequestMonitor<FormattedValueDMData> rm) {
+ IFrameDMContext frameDmc = DMContexts.getAncestorOfType(regDmc, IFrameDMContext.class);
+ if (frameDmc == null) {
+ // Set value to blank if frame dmc is not present
+ rm.setData(new FormattedValueDMData(BLANK_STRING));
+ rm.done();
+ return;
+ }
+
+ // Select the format to be shown
+ int NumberFormat = MIFormat.HEXADECIMAL;
+
+ if (HEX_FORMAT.equals(formatId)) {
+ NumberFormat = MIFormat.HEXADECIMAL;
+ }
+ if (OCTAL_FORMAT.equals(formatId)) {
+ NumberFormat = MIFormat.OCTAL;
+ }
+ if (NATURAL_FORMAT.equals(formatId)) {
+ NumberFormat = MIFormat.NATURAL;
+ }
+ if (BINARY_FORMAT.equals(formatId)) {
+ NumberFormat = MIFormat.BINARY;
+ }
+ if (DECIMAL_FORMAT.equals(formatId)) {
+ NumberFormat = MIFormat.DECIMAL;
+ }
+
+ int[] regnos = { regDmc.getRegNo() };
+ fRegisterValueCache.execute(fCommandFactory.createMIDataListRegisterValues(frameDmc, NumberFormat, regnos),
+ new DataRequestMonitor<MIDataListRegisterValuesInfo>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ // Retrieve the register value.
+ MIRegisterValue[] regValue = getData().getMIRegisterValues();
+
+ // If the list is empty just return empty handed.
+ // The only known case this happens is caused by a bug in GDB's Python
+ // scripts. See https://sourceware.org/bugzilla/show_bug.cgi?id=19637
+ // In the display data, we show link to Eclipse Bugzilla entry which has
+ // a comment on how to fix this manually.
+ if (regValue.length == 0) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
+ IDsfStatusConstants.REQUEST_FAILED,
+ "Encountered a GDB Error See http://eclip.se/506382#c7 for workarounds", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ MIRegisterValue reg = regValue[0];
+
+ // Return the new register value.
+ rm.setData(new FormattedValueDMData(reg.getValue()));
+ rm.done();
+ }
+ });
+ }
+
+ /**
* @since 4.6
*/
- protected static class RegisterData implements IRegisterDMData {
-
- final private String fRegName;
- final private String fRegDesc;
- final private boolean fIsFloat;
- final private IFrameDMContext fContext;
-
- public RegisterData(IFrameDMContext context, String regName, String regDesc, boolean isFloat ) {
-
- fRegName = regName;
- fRegDesc = regDesc;
- fIsFloat = isFloat;
- fContext = context;
- }
-
- @Override
- public boolean isReadable() { return true; }
- @Override
- public boolean isReadOnce() { return false; }
- @Override
+ protected static class RegisterData implements IRegisterDMData {
+
+ final private String fRegName;
+ final private String fRegDesc;
+ final private boolean fIsFloat;
+ final private IFrameDMContext fContext;
+
+ public RegisterData(IFrameDMContext context, String regName, String regDesc, boolean isFloat) {
+
+ fRegName = regName;
+ fRegDesc = regDesc;
+ fIsFloat = isFloat;
+ fContext = context;
+ }
+
+ @Override
+ public boolean isReadable() {
+ return true;
+ }
+
+ @Override
+ public boolean isReadOnce() {
+ return false;
+ }
+
+ @Override
public boolean isWriteable() {
- //The absence of the frame context is likely the result of a selection not specific to a stack frame
- //e.g. the selection of a running thread, or the selection of a process.
- //So, an instance with no stack frame is not writable
+ //The absence of the frame context is likely the result of a selection not specific to a stack frame
+ //e.g. the selection of a running thread, or the selection of a process.
+ //So, an instance with no stack frame is not writable
return (fContext != null);
}
- @Override
- public boolean isWriteOnce() { return false; }
- @Override
- public boolean hasSideEffects() { return false; }
- @Override
- public boolean isVolatile() { return true; }
-
- @Override
- public boolean isFloat() { return fIsFloat; }
- @Override
- public String getName() { return fRegName; }
- @Override
- public String getDescription() { return fRegDesc; }
- }
-
- // Wraps a list of registers in DMContexts.
- private MIRegisterDMC[] makeRegisterDMCs(MIRegisterGroupDMC groupDmc, String[] regNames) {
- return makeRegisterDMCs(groupDmc, null, regNames);
- }
-
- // Wraps a list of registers in DMContexts.
- private MIRegisterDMC[] makeRegisterDMCs(MIRegisterGroupDMC groupDmc, IFrameDMContext frameDmc, String[] regNames) {
- List<MIRegisterDMC> regDmcList = new ArrayList<MIRegisters.MIRegisterDMC>( regNames.length );
- int regNo = 0;
- for (String regName : regNames) {
- if(regName != null && !regName.isEmpty()) {
- if(frameDmc != null)
- regDmcList.add(new MIRegisterDMC(this, groupDmc, frameDmc, regNo, regName));
- else
- regDmcList.add(new MIRegisterDMC(this, groupDmc, regNo, regName));
- }
- regNo++;
- }
- return regDmcList.toArray(new MIRegisterDMC[regDmcList.size()]);
- }
-
- /*
- * Event handling section. These event handlers control the caching state of the
- * register caches. This service creates several cache objects. Not all of which
- * need to be flushed. These handlers maintain the state of the caches.
- */
-
- /**
- * @nooverride This method is not intended to be re-implemented or extended by clients.
- * @noreference This method is not intended to be referenced by clients.
- */
- @DsfServiceEventHandler
- public void eventDispatched(IRunControl.IResumedDMEvent e) {
- fRegisterValueCache.setContextAvailable(e.getDMContext(), false);
- if (e.getReason() != StateChangeReason.STEP) {
- fRegisterValueCache.reset();
- }
- }
-
- /**
- * @nooverride This method is not intended to be re-implemented or extended by clients.
- * @noreference This method is not intended to be referenced by clients.
- */
- @DsfServiceEventHandler
- public void eventDispatched(
- IRunControl.ISuspendedDMEvent e) {
- fRegisterValueCache.setContextAvailable(e.getDMContext(), true);
- fRegisterValueCache.reset();
- }
-
- /**
- * @nooverride This method is not intended to be re-implemented or extended by clients.
- * @noreference This method is not intended to be referenced by clients.
- */
- @DsfServiceEventHandler
- public void eventDispatched(final IRegisters.IRegisterChangedDMEvent e) {
- fRegisterValueCache.reset();
- }
-
- /**
+
+ @Override
+ public boolean isWriteOnce() {
+ return false;
+ }
+
+ @Override
+ public boolean hasSideEffects() {
+ return false;
+ }
+
+ @Override
+ public boolean isVolatile() {
+ return true;
+ }
+
+ @Override
+ public boolean isFloat() {
+ return fIsFloat;
+ }
+
+ @Override
+ public String getName() {
+ return fRegName;
+ }
+
+ @Override
+ public String getDescription() {
+ return fRegDesc;
+ }
+ }
+
+ // Wraps a list of registers in DMContexts.
+ private MIRegisterDMC[] makeRegisterDMCs(MIRegisterGroupDMC groupDmc, String[] regNames) {
+ return makeRegisterDMCs(groupDmc, null, regNames);
+ }
+
+ // Wraps a list of registers in DMContexts.
+ private MIRegisterDMC[] makeRegisterDMCs(MIRegisterGroupDMC groupDmc, IFrameDMContext frameDmc, String[] regNames) {
+ List<MIRegisterDMC> regDmcList = new ArrayList<MIRegisters.MIRegisterDMC>(regNames.length);
+ int regNo = 0;
+ for (String regName : regNames) {
+ if (regName != null && !regName.isEmpty()) {
+ if (frameDmc != null)
+ regDmcList.add(new MIRegisterDMC(this, groupDmc, frameDmc, regNo, regName));
+ else
+ regDmcList.add(new MIRegisterDMC(this, groupDmc, regNo, regName));
+ }
+ regNo++;
+ }
+ return regDmcList.toArray(new MIRegisterDMC[regDmcList.size()]);
+ }
+
+ /*
+ * Event handling section. These event handlers control the caching state of the
+ * register caches. This service creates several cache objects. Not all of which
+ * need to be flushed. These handlers maintain the state of the caches.
+ */
+
+ /**
+ * @nooverride This method is not intended to be re-implemented or extended by clients.
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ @DsfServiceEventHandler
+ public void eventDispatched(IRunControl.IResumedDMEvent e) {
+ fRegisterValueCache.setContextAvailable(e.getDMContext(), false);
+ if (e.getReason() != StateChangeReason.STEP) {
+ fRegisterValueCache.reset();
+ }
+ }
+
+ /**
+ * @nooverride This method is not intended to be re-implemented or extended by clients.
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ @DsfServiceEventHandler
+ public void eventDispatched(IRunControl.ISuspendedDMEvent e) {
+ fRegisterValueCache.setContextAvailable(e.getDMContext(), true);
+ fRegisterValueCache.reset();
+ }
+
+ /**
+ * @nooverride This method is not intended to be re-implemented or extended by clients.
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ @DsfServiceEventHandler
+ public void eventDispatched(final IRegisters.IRegisterChangedDMEvent e) {
+ fRegisterValueCache.reset();
+ }
+
+ /**
* @since 4.6
*/
- protected void generateRegisterChangedEvent(IRegisterDMContext dmc ) {
- getSession().dispatchEvent(new RegisterChangedDMEvent(dmc), getProperties());
-
- // Fix for Bug 400840
- // When one register is modified, it could affect other registers.
- // To properly reflect that, we send a change for all registers.
- // We cheat by pretending the group has changed, since we know there is
- // only one group.
- // This method can be extended by group managers to propagate the event as needed
- final IRegisterGroupDMContext groupDmc = DMContexts.getAncestorOfType(dmc, IRegisterGroupDMContext.class);
- if (groupDmc != null) {
- IRegistersChangedDMEvent event = new IRegistersChangedDMEvent() {
- @Override
- public IRegisterGroupDMContext getDMContext() {
- return groupDmc;
- }
- };
- getSession().dispatchEvent(event, getProperties());
- }
- }
-
- /*
- * These are the public interfaces for this service.
- *
- * (non-Javadoc)
- * @see org.eclipse.cdt.dsf.debug.service.IRegisters#getRegisterGroups(org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext, org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext, org.eclipse.cdt.dsf.concurrent.DataRequestMonitor)
- */
+ protected void generateRegisterChangedEvent(IRegisterDMContext dmc) {
+ getSession().dispatchEvent(new RegisterChangedDMEvent(dmc), getProperties());
+
+ // Fix for Bug 400840
+ // When one register is modified, it could affect other registers.
+ // To properly reflect that, we send a change for all registers.
+ // We cheat by pretending the group has changed, since we know there is
+ // only one group.
+ // This method can be extended by group managers to propagate the event as needed
+ final IRegisterGroupDMContext groupDmc = DMContexts.getAncestorOfType(dmc, IRegisterGroupDMContext.class);
+ if (groupDmc != null) {
+ IRegistersChangedDMEvent event = new IRegistersChangedDMEvent() {
+ @Override
+ public IRegisterGroupDMContext getDMContext() {
+ return groupDmc;
+ }
+ };
+ getSession().dispatchEvent(event, getProperties());
+ }
+ }
+
+ /*
+ * These are the public interfaces for this service.
+ *
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.dsf.debug.service.IRegisters#getRegisterGroups(org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext, org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext, org.eclipse.cdt.dsf.concurrent.DataRequestMonitor)
+ */
@Override
- public void getRegisterGroups(IDMContext ctx, DataRequestMonitor<IRegisterGroupDMContext[]> rm ) {
- IContainerDMContext contDmc = DMContexts.getAncestorOfType(ctx, IContainerDMContext.class);
- if (contDmc == null) {
- rm.setStatus( new Status( IStatus.ERROR , GdbPlugin.PLUGIN_ID , INVALID_HANDLE , "Container context not found", null ) ) ; //$NON-NLS-1$
- rm.done();
- return;
- }
-
- //Bug 418176
- //Only one group per Process (container) is supported in the implementation of this class
- MIRegisterGroupDMC registerGroup = fContainerToGroupMap.get(contDmc);
-
+ public void getRegisterGroups(IDMContext ctx, DataRequestMonitor<IRegisterGroupDMContext[]> rm) {
+ IContainerDMContext contDmc = DMContexts.getAncestorOfType(ctx, IContainerDMContext.class);
+ if (contDmc == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Container context not found", //$NON-NLS-1$
+ null));
+ rm.done();
+ return;
+ }
+
+ //Bug 418176
+ //Only one group per Process (container) is supported in the implementation of this class
+ MIRegisterGroupDMC registerGroup = fContainerToGroupMap.get(contDmc);
+
if (registerGroup == null) {
registerGroup = new MIRegisterGroupDMC(this, contDmc, 0, ROOT_GROUP_NAME);
fContainerToGroupMap.put(contDmc, registerGroup);
}
-
- MIRegisterGroupDMC[] groupDMCs = new MIRegisterGroupDMC[] { registerGroup };
-
- rm.setData(groupDMCs) ;
- rm.done() ;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.cdt.dsf.debug.service.IRegisters#getRegisters(org.eclipse.cdt.dsf.debug.service.IRegisters.IRegisterGroupDMContext, org.eclipse.cdt.dsf.concurrent.DataRequestMonitor)
- */
+
+ MIRegisterGroupDMC[] groupDMCs = new MIRegisterGroupDMC[] { registerGroup };
+
+ rm.setData(groupDMCs);
+ rm.done();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.dsf.debug.service.IRegisters#getRegisters(org.eclipse.cdt.dsf.debug.service.IRegisters.IRegisterGroupDMContext, org.eclipse.cdt.dsf.concurrent.DataRequestMonitor)
+ */
@Override
public void getRegisters(final IDMContext dmc, final DataRequestMonitor<IRegisterDMContext[]> rm) {
final MIRegisterGroupDMC groupDmc = DMContexts.getAncestorOfType(dmc, MIRegisterGroupDMC.class);
@@ -623,8 +681,8 @@ public class MIRegisters extends AbstractDsfService implements IRegisters, ICach
final IContainerDMContext containerDmc = DMContexts.getAncestorOfType(dmc, IContainerDMContext.class);
if (containerDmc == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE,
- "Container context not found", null)); //$NON-NLS-1$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Container context not found", //$NON-NLS-1$
+ null));
rm.done();
return;
}
@@ -643,11 +701,11 @@ public class MIRegisters extends AbstractDsfService implements IRegisters, ICach
protected void handleSuccess() {
getRegisters(getData(), groupDmc, containerDmc, rm);
}
-
+
@Override
protected void handleFailure() {
//Unable to resolve top frame on current thread.
- //The thread could e.g. be in running state,
+ //The thread could e.g. be in running state,
//we return register instances with no associated execution context
//i.e. unable to resolve its associated value.
getRegisters(null, groupDmc, containerDmc, rm);
@@ -662,12 +720,12 @@ public class MIRegisters extends AbstractDsfService implements IRegisters, ICach
getRegisters(frameDmc, groupDmc, containerDmc, rm);
} else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR,
- "Invalid group = " + groupDmc, null)); //$NON-NLS-1$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid group = " + groupDmc, //$NON-NLS-1$
+ null));
rm.done();
}
}
-
+
private void getRegisters(final IFrameDMContext frameDmc, final MIRegisterGroupDMC groupDmc,
IContainerDMContext containerDmc, final DataRequestMonitor<IRegisterDMContext[]> rm) {
@@ -696,26 +754,26 @@ public class MIRegisters extends AbstractDsfService implements IRegisters, ICach
}
});
}
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.cdt.dsf.debug.service.IRegisters#getBitFields(org.eclipse.cdt.dsf.debug.service.IRegisters.IRegisterDMContext, org.eclipse.cdt.dsf.concurrent.DataRequestMonitor)
- */
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.dsf.debug.service.IRegisters#getBitFields(org.eclipse.cdt.dsf.debug.service.IRegisters.IRegisterDMContext, org.eclipse.cdt.dsf.concurrent.DataRequestMonitor)
+ */
@Override
- public void getBitFields( IDMContext regDmc , DataRequestMonitor<IBitFieldDMContext[]> rm ) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "BitField not supported", null)); //$NON-NLS-1$
- rm.done();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.cdt.dsf.debug.service.IRegisters#writeRegister(org.eclipse.cdt.dsf.debug.service.IRegisters.IRegisterDMContext, java.lang.String, java.lang.String, org.eclipse.cdt.dsf.concurrent.RequestMonitor)
- */
+ public void getBitFields(IDMContext regDmc, DataRequestMonitor<IBitFieldDMContext[]> rm) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "BitField not supported", null)); //$NON-NLS-1$
+ rm.done();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.dsf.debug.service.IRegisters#writeRegister(org.eclipse.cdt.dsf.debug.service.IRegisters.IRegisterDMContext, java.lang.String, java.lang.String, org.eclipse.cdt.dsf.concurrent.RequestMonitor)
+ */
@Override
public void writeRegister(IRegisterDMContext regCtx, final String regValue, final String formatId,
final RequestMonitor rm) {
- assert(regCtx instanceof MIRegisterDMC);
+ assert (regCtx instanceof MIRegisterDMC);
final MIRegisterDMC regDmc = (MIRegisterDMC) regCtx;
final IExpressions exprService = getServicesTracker().getService(IExpressions.class);
@@ -723,125 +781,134 @@ public class MIRegisters extends AbstractDsfService implements IRegisters, ICach
final IExpressionDMContext exprCtxt = exprService.createExpression(regCtx, "$" + regName); //$NON-NLS-1$
final FormattedValueDMContext valueDmc = exprService.getFormattedValueContext(exprCtxt, formatId);
- exprService.getFormattedExpressionValue(valueDmc, new DataRequestMonitor<FormattedValueDMData>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- if (!regValue.equals(getData().getFormattedValue()) || !valueDmc.getFormatID().equals(formatId)) {
- exprService.writeExpression(exprCtxt, regValue, formatId, new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- generateRegisterChangedEvent(regDmc);
+ exprService.getFormattedExpressionValue(valueDmc,
+ new DataRequestMonitor<FormattedValueDMData>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ if (!regValue.equals(getData().getFormattedValue())
+ || !valueDmc.getFormatID().equals(formatId)) {
+ exprService.writeExpression(exprCtxt, regValue, formatId,
+ new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ generateRegisterChangedEvent(regDmc);
+ rm.done();
+ }
+ });
+ } // if
+ else {
rm.done();
}
- });
- }// if
- else {
- rm.done();
- }
- }// handleSuccess
- });
+ }// handleSuccess
+ });
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.cdt.dsf.debug.service.IRegisters#writeBitField(org.eclipse.cdt.dsf.debug.service.IRegisters.IBitFieldDMContext, java.lang.String, java.lang.String, org.eclipse.cdt.dsf.concurrent.RequestMonitor)
- */
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.dsf.debug.service.IRegisters#writeBitField(org.eclipse.cdt.dsf.debug.service.IRegisters.IBitFieldDMContext, java.lang.String, java.lang.String, org.eclipse.cdt.dsf.concurrent.RequestMonitor)
+ */
@Override
- public void writeBitField(IBitFieldDMContext bitFieldCtx, String bitFieldValue, String formatId, RequestMonitor rm) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Writing bit field not supported", null)); //$NON-NLS-1$
- rm.done();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.cdt.dsf.debug.service.IRegisters#writeBitField(org.eclipse.cdt.dsf.debug.service.IRegisters.IBitFieldDMContext, org.eclipse.cdt.dsf.debug.service.IRegisters.IMnemonic, org.eclipse.cdt.dsf.concurrent.RequestMonitor)
- */
+ public void writeBitField(IBitFieldDMContext bitFieldCtx, String bitFieldValue, String formatId,
+ RequestMonitor rm) {
+ rm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Writing bit field not supported", null)); //$NON-NLS-1$
+ rm.done();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.dsf.debug.service.IRegisters#writeBitField(org.eclipse.cdt.dsf.debug.service.IRegisters.IBitFieldDMContext, org.eclipse.cdt.dsf.debug.service.IRegisters.IMnemonic, org.eclipse.cdt.dsf.concurrent.RequestMonitor)
+ */
@Override
- public void writeBitField(IBitFieldDMContext bitFieldCtx, IMnemonic mnemonic, RequestMonitor rm) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Writing bit field not supported", null)); //$NON-NLS-1$
- rm.done();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.cdt.dsf.debug.service.IFormattedValues#getAvailableFormats(org.eclipse.cdt.dsf.debug.service.IFormattedValues.IFormattedDataDMContext, org.eclipse.cdt.dsf.concurrent.DataRequestMonitor)
- */
+ public void writeBitField(IBitFieldDMContext bitFieldCtx, IMnemonic mnemonic, RequestMonitor rm) {
+ rm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Writing bit field not supported", null)); //$NON-NLS-1$
+ rm.done();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.dsf.debug.service.IFormattedValues#getAvailableFormats(org.eclipse.cdt.dsf.debug.service.IFormattedValues.IFormattedDataDMContext, org.eclipse.cdt.dsf.concurrent.DataRequestMonitor)
+ */
@Override
- public void getAvailableFormats(IFormattedDataDMContext dmc, DataRequestMonitor<String[]> rm) {
-
- rm.setData(new String[] { HEX_FORMAT, DECIMAL_FORMAT, OCTAL_FORMAT, BINARY_FORMAT, NATURAL_FORMAT });
- rm.done();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.cdt.dsf.debug.service.IFormattedValues#getFormattedValueContext(org.eclipse.cdt.dsf.debug.service.IFormattedValues.IFormattedDataDMContext, java.lang.String)
- */
+ public void getAvailableFormats(IFormattedDataDMContext dmc, DataRequestMonitor<String[]> rm) {
+
+ rm.setData(new String[] { HEX_FORMAT, DECIMAL_FORMAT, OCTAL_FORMAT, BINARY_FORMAT, NATURAL_FORMAT });
+ rm.done();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.dsf.debug.service.IFormattedValues#getFormattedValueContext(org.eclipse.cdt.dsf.debug.service.IFormattedValues.IFormattedDataDMContext, java.lang.String)
+ */
@Override
- public FormattedValueDMContext getFormattedValueContext(IFormattedDataDMContext dmc, String formatId) {
- if ( dmc instanceof MIRegisterDMC ) {
- MIRegisterDMC regDmc = (MIRegisterDMC) dmc;
- return( new FormattedValueDMContext( this, regDmc, formatId));
- }
- return null;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.cdt.dsf.debug.service.IRegisters#findRegisterGroup(org.eclipse.cdt.dsf.datamodel.IDMContext, java.lang.String, org.eclipse.cdt.dsf.concurrent.DataRequestMonitor)
- */
+ public FormattedValueDMContext getFormattedValueContext(IFormattedDataDMContext dmc, String formatId) {
+ if (dmc instanceof MIRegisterDMC) {
+ MIRegisterDMC regDmc = (MIRegisterDMC) dmc;
+ return (new FormattedValueDMContext(this, regDmc, formatId));
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.dsf.debug.service.IRegisters#findRegisterGroup(org.eclipse.cdt.dsf.datamodel.IDMContext, java.lang.String, org.eclipse.cdt.dsf.concurrent.DataRequestMonitor)
+ */
@Override
- public void findRegisterGroup(IDMContext ctx, String name, DataRequestMonitor<IRegisterGroupDMContext> rm) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Finding a Register Group context not supported", null)); //$NON-NLS-1$
- rm.done();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.cdt.dsf.debug.service.IRegisters#findRegister(org.eclipse.cdt.dsf.datamodel.IDMContext, java.lang.String, org.eclipse.cdt.dsf.concurrent.DataRequestMonitor)
- */
+ public void findRegisterGroup(IDMContext ctx, String name, DataRequestMonitor<IRegisterGroupDMContext> rm) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED,
+ "Finding a Register Group context not supported", null)); //$NON-NLS-1$
+ rm.done();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.dsf.debug.service.IRegisters#findRegister(org.eclipse.cdt.dsf.datamodel.IDMContext, java.lang.String, org.eclipse.cdt.dsf.concurrent.DataRequestMonitor)
+ */
@Override
- public void findRegister(IDMContext ctx, String name, DataRequestMonitor<IRegisterDMContext> rm) {
- getRegisters(ctx, new ImmediateDataRequestMonitor<IRegisterDMContext[]>() {
- @Override
- protected void handleSuccess () {
- IRegisterDMContext[] allRegs = getData();
-
- // in all registers found, look for one with the name we seek
- for (int i = 0; i < allRegs.length; i++) {
- if (allRegs[i] instanceof MIRegisterDMC) {
- if (name.equals(((MIRegisterDMC)allRegs[i]).getName())) {
- // found it
- rm.done(allRegs[i]);
- return;
- }
- }
- }
-
- // register was not found
- rm.done(new Status(IStatus.WARNING, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Unknown register name", null)); //$NON-NLS-1$
- return;
- }
- });
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.cdt.dsf.debug.service.IRegisters#findBitField(org.eclipse.cdt.dsf.datamodel.IDMContext, java.lang.String, org.eclipse.cdt.dsf.concurrent.DataRequestMonitor)
- */
+ public void findRegister(IDMContext ctx, String name, DataRequestMonitor<IRegisterDMContext> rm) {
+ getRegisters(ctx, new ImmediateDataRequestMonitor<IRegisterDMContext[]>() {
+ @Override
+ protected void handleSuccess() {
+ IRegisterDMContext[] allRegs = getData();
+
+ // in all registers found, look for one with the name we seek
+ for (int i = 0; i < allRegs.length; i++) {
+ if (allRegs[i] instanceof MIRegisterDMC) {
+ if (name.equals(((MIRegisterDMC) allRegs[i]).getName())) {
+ // found it
+ rm.done(allRegs[i]);
+ return;
+ }
+ }
+ }
+
+ // register was not found
+ rm.done(new Status(IStatus.WARNING, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Unknown register name", //$NON-NLS-1$
+ null));
+ return;
+ }
+ });
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.dsf.debug.service.IRegisters#findBitField(org.eclipse.cdt.dsf.datamodel.IDMContext, java.lang.String, org.eclipse.cdt.dsf.concurrent.DataRequestMonitor)
+ */
@Override
- public void findBitField(IDMContext ctx, String name, DataRequestMonitor<IBitFieldDMContext> rm) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Finding a Register Group context not supported", null)); //$NON-NLS-1$
- rm.done();
- }
-
- /**
- * {@inheritDoc}
- * @since 1.1
- */
+ public void findBitField(IDMContext ctx, String name, DataRequestMonitor<IBitFieldDMContext> rm) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED,
+ "Finding a Register Group context not supported", null)); //$NON-NLS-1$
+ rm.done();
+ }
+
+ /**
+ * {@inheritDoc}
+ * @since 1.1
+ */
@Override
- public void flushCache(IDMContext context) {
- fRegisterNameCache.reset(context);
- fRegisterValueCache.reset(context);
- }
+ public void flushCache(IDMContext context) {
+ fRegisterNameCache.reset(context);
+ fRegisterValueCache.reset(context);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRunControl.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRunControl.java
index 7898fe8ad73..00b89388e19 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRunControl.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRunControl.java
@@ -7,11 +7,11 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* Ericsson AB - Modified for handling of multiple threads
- * Vladimir Prus (Mentor Graphics) - Add proper stop reason for step return (Bug 362274)
+ * Vladimir Prus (Mentor Graphics) - Add proper stop reason for step return (Bug 362274)
* Indel AG - [369622] fixed moveToLine using MinGW
* Marc Khouzam (Ericsson) - Make each thread an IDisassemblyDMContext (bug 352748)
* Alvaro Sanchez-Leon (Ericsson AB) - Support for Step into selection (bug 244865)
@@ -87,9 +87,8 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugException;
import org.osgi.framework.BundleContext;
-
/**
- *
+ *
* <p>
* Implementation note:
* This class implements event handlers for the events that are generated by
@@ -104,10 +103,9 @@ import org.osgi.framework.BundleContext;
* state.
* @since 3.0
*/
-public class MIRunControl extends AbstractDsfService implements IMIRunControl, ICachingService, IRunControl3
-{
- private static class MIExecutionDMC extends AbstractDMContext implements IMIExecutionDMContext, IDisassemblyDMContext
- {
+public class MIRunControl extends AbstractDsfService implements IMIRunControl, ICachingService, IRunControl3 {
+ private static class MIExecutionDMC extends AbstractDMContext
+ implements IMIExecutionDMContext, IDisassemblyDMContext {
/**
* Integer ID that is used to identify the thread in the GDB/MI protocol.
*/
@@ -120,7 +118,7 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
* <p/>
* Classes extending {@link MIRunControl} may also extend this class to include
* additional information in the context.
- *
+ *
* @param sessionId Session that this context belongs to.
* @param containerDmc The container that this context belongs to.
* @param threadId GDB/MI thread identifier.
@@ -135,57 +133,70 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
* @return
*/
@Override
- public String getThreadId(){
+ public String getThreadId() {
return fThreadId;
}
@Override
- public String toString() { return baseToString() + ".thread[" + fThreadId + "]"; } //$NON-NLS-1$ //$NON-NLS-2$
+ public String toString() {
+ return baseToString() + ".thread[" + fThreadId + "]"; //$NON-NLS-1$//$NON-NLS-2$
+ }
@Override
public boolean equals(Object obj) {
- return super.baseEquals(obj) && ((MIExecutionDMC)obj).fThreadId.equals(fThreadId);
+ return super.baseEquals(obj) && ((MIExecutionDMC) obj).fThreadId.equals(fThreadId);
}
@Override
- public int hashCode() { return super.baseHashCode() + fThreadId.hashCode(); }
+ public int hashCode() {
+ return super.baseHashCode() + fThreadId.hashCode();
+ }
}
@Immutable
private static class ExecutionData implements IExecutionDMData2 {
private final StateChangeReason fReason;
private final String fDetails;
+
ExecutionData(StateChangeReason reason, String details) {
fReason = reason;
fDetails = details;
}
+
@Override
- public StateChangeReason getStateChangeReason() { return fReason; }
+ public StateChangeReason getStateChangeReason() {
+ return fReason;
+ }
+
@Override
- public String getDetails() { return fDetails; }
+ public String getDetails() {
+ return fDetails;
+ }
}
/**
* Base class for events generated by the MI Run Control service. Most events
* generated by the MI Run Control service are directly caused by some MI event.
* Other services may need access to the extended MI data carried in the event.
- *
+ *
* @param <V> DMC that this event refers to
* @param <T> MIInfo object that is the direct cause of this event
* @see MIRunControl
*/
@Immutable
- protected static class RunControlEvent<V extends IDMContext, T extends MIEvent<? extends IDMContext>> extends AbstractDMEvent<V>
- implements IDMEvent<V>, IMIDMEvent
- {
+ protected static class RunControlEvent<V extends IDMContext, T extends MIEvent<? extends IDMContext>>
+ extends AbstractDMEvent<V> implements IDMEvent<V>, IMIDMEvent {
final private T fMIInfo;
+
public RunControlEvent(V dmc, T miInfo) {
super(dmc);
fMIInfo = miInfo;
}
@Override
- public T getMIEvent() { return fMIInfo; }
+ public T getMIEvent() {
+ return fMIInfo;
+ }
}
/**
@@ -193,18 +204,17 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
*/
@Immutable
protected static class SuspendedEvent extends RunControlEvent<IExecutionDMContext, MIStoppedEvent>
- implements ISuspendedDMEvent
- {
+ implements ISuspendedDMEvent {
SuspendedEvent(IExecutionDMContext ctx, MIStoppedEvent miInfo) {
super(ctx, miInfo);
}
@Override
public StateChangeReason getReason() {
- if (getMIEvent() instanceof MICatchpointHitEvent) { // must precede MIBreakpointHitEvent
+ if (getMIEvent() instanceof MICatchpointHitEvent) { // must precede MIBreakpointHitEvent
return StateChangeReason.EVENT_BREAKPOINT;
- } else if (getMIEvent() instanceof MITracepointSelectedEvent) { // must precede MIBreakpointHitEvent
- return StateChangeReason.UNKNOWN; // Don't display anything here, the details will take care of it
+ } else if (getMIEvent() instanceof MITracepointSelectedEvent) { // must precede MIBreakpointHitEvent
+ return StateChangeReason.UNKNOWN; // Don't display anything here, the details will take care of it
} else if (getMIEvent() instanceof MIBreakpointHitEvent) {
return StateChangeReason.BREAKPOINT;
} else if (getMIEvent() instanceof MISteppingRangeEvent) {
@@ -213,34 +223,34 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
return StateChangeReason.STEP;
} else if (getMIEvent() instanceof MISharedLibEvent) {
return StateChangeReason.SHAREDLIB;
- }else if (getMIEvent() instanceof MISignalEvent) {
+ } else if (getMIEvent() instanceof MISignalEvent) {
return StateChangeReason.SIGNAL;
- }else if (getMIEvent() instanceof MIWatchpointTriggerEvent) {
+ } else if (getMIEvent() instanceof MIWatchpointTriggerEvent) {
return StateChangeReason.WATCHPOINT;
- }else if (getMIEvent() instanceof MIErrorEvent) {
+ } else if (getMIEvent() instanceof MIErrorEvent) {
return StateChangeReason.ERROR;
- }else {
+ } else {
return StateChangeReason.USER_REQUEST;
}
}
-
+
/**
* @since 3.0
*/
public String getDetails() {
MIStoppedEvent event = getMIEvent();
- if (event instanceof MICatchpointHitEvent) { // must precede MIBreakpointHitEvent
- return ((MICatchpointHitEvent)event).getReason();
- } else if (event instanceof MITracepointSelectedEvent) { // must precede MIBreakpointHitEvent
- return ((MITracepointSelectedEvent)event).getReason();
+ if (event instanceof MICatchpointHitEvent) { // must precede MIBreakpointHitEvent
+ return ((MICatchpointHitEvent) event).getReason();
+ } else if (event instanceof MITracepointSelectedEvent) { // must precede MIBreakpointHitEvent
+ return ((MITracepointSelectedEvent) event).getReason();
} else if (event instanceof MISharedLibEvent) {
- return ((MISharedLibEvent)event).getLibrary();
+ return ((MISharedLibEvent) event).getLibrary();
} else if (event instanceof MISignalEvent) {
- return ((MISignalEvent)event).getName() + ':' + ((MISignalEvent)event).getMeaning();
+ return ((MISignalEvent) event).getName() + ':' + ((MISignalEvent) event).getMeaning();
} else if (event instanceof MIWatchpointTriggerEvent) {
- return ((MIWatchpointTriggerEvent)event).getExpression();
+ return ((MIWatchpointTriggerEvent) event).getExpression();
} else if (event instanceof MIErrorEvent) {
- return ((MIErrorEvent)event).getMessage();
+ return ((MIErrorEvent) event).getMessage();
}
return null;
@@ -248,37 +258,34 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
}
/**
- * Indicates that the given thread has been suspended on a breakpoint.
+ * Indicates that the given thread has been suspended on a breakpoint.
* @since 3.0
- */
- @Immutable
- protected static class BreakpointHitEvent extends SuspendedEvent
- implements IBreakpointHitDMEvent
- {
- final private IBreakpointDMContext[] fBreakpoints;
-
- BreakpointHitEvent(IExecutionDMContext ctx, MIBreakpointHitEvent miInfo, IBreakpointDMContext bpCtx) {
- super(ctx, miInfo);
-
- fBreakpoints = new IBreakpointDMContext[] { bpCtx };
- }
-
- @Override
- public IBreakpointDMContext[] getBreakpoints() {
- return fBreakpoints;
- }
- }
-
-
+ */
+ @Immutable
+ protected static class BreakpointHitEvent extends SuspendedEvent implements IBreakpointHitDMEvent {
+ final private IBreakpointDMContext[] fBreakpoints;
+
+ BreakpointHitEvent(IExecutionDMContext ctx, MIBreakpointHitEvent miInfo, IBreakpointDMContext bpCtx) {
+ super(ctx, miInfo);
+
+ fBreakpoints = new IBreakpointDMContext[] { bpCtx };
+ }
+
+ @Override
+ public IBreakpointDMContext[] getBreakpoints() {
+ return fBreakpoints;
+ }
+ }
+
@Immutable
- protected static class ContainerSuspendedEvent extends SuspendedEvent
- implements IContainerSuspendedDMEvent
- {
+ protected static class ContainerSuspendedEvent extends SuspendedEvent implements IContainerSuspendedDMEvent {
final IExecutionDMContext[] triggeringDmcs;
- ContainerSuspendedEvent(IContainerDMContext containerDmc, MIStoppedEvent miInfo, IExecutionDMContext triggeringDmc) {
+
+ ContainerSuspendedEvent(IContainerDMContext containerDmc, MIStoppedEvent miInfo,
+ IExecutionDMContext triggeringDmc) {
super(containerDmc, miInfo);
- this.triggeringDmcs = triggeringDmc != null
- ? new IExecutionDMContext[] { triggeringDmc } : new IExecutionDMContext[0];
+ this.triggeringDmcs = triggeringDmc != null ? new IExecutionDMContext[] { triggeringDmc }
+ : new IExecutionDMContext[0];
}
@Override
@@ -287,39 +294,38 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
}
}
- /**
- * Indicates that the given container has been suspended on a breakpoint.
- * @since 3.0
- */
- @Immutable
- protected static class ContainerBreakpointHitEvent extends ContainerSuspendedEvent
- implements IBreakpointHitDMEvent
- {
- final private IBreakpointDMContext[] fBreakpoints;
-
- ContainerBreakpointHitEvent(IContainerDMContext containerDmc, MIBreakpointHitEvent miInfo, IExecutionDMContext triggeringDmc, IBreakpointDMContext bpCtx) {
- super(containerDmc, miInfo, triggeringDmc);
-
- fBreakpoints = new IBreakpointDMContext[] { bpCtx };
- }
-
- @Override
- public IBreakpointDMContext[] getBreakpoints() {
- return fBreakpoints;
- }
- }
+ /**
+ * Indicates that the given container has been suspended on a breakpoint.
+ * @since 3.0
+ */
+ @Immutable
+ protected static class ContainerBreakpointHitEvent extends ContainerSuspendedEvent
+ implements IBreakpointHitDMEvent {
+ final private IBreakpointDMContext[] fBreakpoints;
+
+ ContainerBreakpointHitEvent(IContainerDMContext containerDmc, MIBreakpointHitEvent miInfo,
+ IExecutionDMContext triggeringDmc, IBreakpointDMContext bpCtx) {
+ super(containerDmc, miInfo, triggeringDmc);
+
+ fBreakpoints = new IBreakpointDMContext[] { bpCtx };
+ }
+
+ @Override
+ public IBreakpointDMContext[] getBreakpoints() {
+ return fBreakpoints;
+ }
+ }
@Immutable
protected static class ResumedEvent extends RunControlEvent<IExecutionDMContext, MIRunningEvent>
- implements IResumedDMEvent
- {
+ implements IResumedDMEvent {
ResumedEvent(IExecutionDMContext ctx, MIRunningEvent miInfo) {
super(ctx, miInfo);
}
@Override
public StateChangeReason getReason() {
- switch(getMIEvent().getType()) {
+ switch (getMIEvent().getType()) {
case MIRunningEvent.CONTINUE:
return StateChangeReason.USER_REQUEST;
case MIRunningEvent.NEXT:
@@ -339,15 +345,14 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
}
@Immutable
- protected static class ContainerResumedEvent extends ResumedEvent
- implements IContainerResumedDMEvent
- {
+ protected static class ContainerResumedEvent extends ResumedEvent implements IContainerResumedDMEvent {
final IExecutionDMContext[] triggeringDmcs;
- ContainerResumedEvent(IContainerDMContext containerDmc, MIRunningEvent miInfo, IExecutionDMContext triggeringDmc) {
+ ContainerResumedEvent(IContainerDMContext containerDmc, MIRunningEvent miInfo,
+ IExecutionDMContext triggeringDmc) {
super(containerDmc, miInfo);
- this.triggeringDmcs = triggeringDmc != null
- ? new IExecutionDMContext[] { triggeringDmc } : new IExecutionDMContext[0];
+ this.triggeringDmcs = triggeringDmc != null ? new IExecutionDMContext[] { triggeringDmc }
+ : new IExecutionDMContext[0];
}
@Override
@@ -357,18 +362,16 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
}
@Immutable
- protected static class StartedDMEvent extends RunControlEvent<IExecutionDMContext,MIThreadCreatedEvent>
- implements IStartedDMEvent
- {
+ protected static class StartedDMEvent extends RunControlEvent<IExecutionDMContext, MIThreadCreatedEvent>
+ implements IStartedDMEvent {
StartedDMEvent(IMIExecutionDMContext executionDmc, MIThreadCreatedEvent miInfo) {
super(executionDmc, miInfo);
}
}
@Immutable
- protected static class ExitedDMEvent extends RunControlEvent<IExecutionDMContext,MIThreadExitEvent>
- implements IExitedDMEvent
- {
+ protected static class ExitedDMEvent extends RunControlEvent<IExecutionDMContext, MIThreadExitEvent>
+ implements IExitedDMEvent {
ExitedDMEvent(IMIExecutionDMContext executionDmc, MIThreadExitEvent miInfo) {
super(executionDmc, miInfo);
}
@@ -377,18 +380,17 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
private ICommandControlService fConnection;
private CommandCache fMICommandCache;
private CommandFactory fCommandFactory;
-
- // State flags
+
+ // State flags
private boolean fSuspended = true;
- private boolean fResumePending = false;
+ private boolean fResumePending = false;
private boolean fStepping = false;
private boolean fTerminated = false;
/**
* @since 4.2
*/
protected RunControlEvent<IExecutionDMContext, ?> fLatestEvent = null;
-
-
+
/**
* What caused the state change. E.g., a signal was thrown.
*/
@@ -401,46 +403,46 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
* detail of interest.
*/
private String fStateChangeDetails;
-
+
private IExecutionDMContext fStateChangeTriggeringContext;
- /**
+ /**
* Indicates that the next MIRunning event should be silenced.
* @since 4.3
*/
protected boolean fDisableNextRunningEvent;
- /**
+ /**
* Indicates that the next MISignal (MIStopped) event should be silenced.
* @since 4.3
*/
protected boolean fDisableNextSignalEvent;
- /**
+ /**
* Stores the silenced MIStopped event in case we need to use it
* for a failure.
* @since 4.3
*/
protected MIStoppedEvent fSilencedSignalEvent;
-
+
private static final String FAKE_THREAD_ID = "0"; //$NON-NLS-1$
- public MIRunControl(DsfSession session) {
- super(session);
- }
-
+ public MIRunControl(DsfSession session) {
+ super(session);
+ }
+
@Override
- public void initialize(final RequestMonitor rm) {
- super.initialize(
- new ImmediateRequestMonitor(rm) {
- @Override
- protected void handleSuccess() {
- doInitialize(rm);
- }});
- }
-
- private void doInitialize(final RequestMonitor rm) {
- fConnection = getServicesTracker().getService(ICommandControlService.class);
- BufferedCommandControl bufferedCommandControl = new BufferedCommandControl(fConnection, getExecutor(), 2);
-
- fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
+ public void initialize(final RequestMonitor rm) {
+ super.initialize(new ImmediateRequestMonitor(rm) {
+ @Override
+ protected void handleSuccess() {
+ doInitialize(rm);
+ }
+ });
+ }
+
+ private void doInitialize(final RequestMonitor rm) {
+ fConnection = getServicesTracker().getService(ICommandControlService.class);
+ BufferedCommandControl bufferedCommandControl = new BufferedCommandControl(fConnection, getExecutor(), 2);
+
+ fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
// This cache stores the result of a command when received; also, this cache
// is manipulated when receiving events. Currently, events are received after
// three scheduling of the executor, while command results after only one. This
@@ -449,275 +451,296 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
// To solve this, we use a bufferedCommandControl that will delay the command
// result by two scheduling of the executor.
// See bug 280461
- fMICommandCache = new CommandCache(getSession(), bufferedCommandControl);
- fMICommandCache.setContextAvailable(fConnection.getContext(), true);
- getSession().addServiceEventListener(this, null);
- rm.done();
- }
-
- @Override
- public void shutdown(final RequestMonitor rm) {
- getSession().removeServiceEventListener(this);
- fMICommandCache.reset();
- super.shutdown(rm);
- }
-
- public boolean isValid() { return true; }
-
- /** @since 2.0 */
- protected boolean isResumePending() { return fResumePending; }
- /** @since 2.0 */
- protected void setResumePending(boolean pending) { fResumePending = pending; }
- /** @since 2.0 */
- protected boolean isTerminated() { return fTerminated; }
- /** @since 2.0 */
- protected void setTerminated(boolean terminated) { fTerminated = terminated; }
-
- public CommandCache getCache() { return fMICommandCache; }
- /** @since 2.0 */
- protected ICommandControlService getConnection() { return fConnection; }
-
- /**
- * @since 5.0
- */
- public IMIExecutionDMContext createMIExecutionContext(IContainerDMContext container, String threadId) {
- return new MIExecutionDMC(getSession().getId(), container, threadId);
- }
-
- /**
- * @nooverride This method is not intended to be re-implemented or extended by clients.
- * @noreference This method is not intended to be referenced by clients.
- */
- @DsfServiceEventHandler
- public void eventDispatched(MIRunningEvent e) {
- if (fDisableNextRunningEvent) {
- fDisableNextRunningEvent = false;
- // We don't broadcast this running event
- return;
- }
-
- if (fLatestEvent instanceof IResumedDMEvent) {
+ fMICommandCache = new CommandCache(getSession(), bufferedCommandControl);
+ fMICommandCache.setContextAvailable(fConnection.getContext(), true);
+ getSession().addServiceEventListener(this, null);
+ rm.done();
+ }
+
+ @Override
+ public void shutdown(final RequestMonitor rm) {
+ getSession().removeServiceEventListener(this);
+ fMICommandCache.reset();
+ super.shutdown(rm);
+ }
+
+ public boolean isValid() {
+ return true;
+ }
+
+ /** @since 2.0 */
+ protected boolean isResumePending() {
+ return fResumePending;
+ }
+
+ /** @since 2.0 */
+ protected void setResumePending(boolean pending) {
+ fResumePending = pending;
+ }
+
+ /** @since 2.0 */
+ protected boolean isTerminated() {
+ return fTerminated;
+ }
+
+ /** @since 2.0 */
+ protected void setTerminated(boolean terminated) {
+ fTerminated = terminated;
+ }
+
+ public CommandCache getCache() {
+ return fMICommandCache;
+ }
+
+ /** @since 2.0 */
+ protected ICommandControlService getConnection() {
+ return fConnection;
+ }
+
+ /**
+ * @since 5.0
+ */
+ public IMIExecutionDMContext createMIExecutionContext(IContainerDMContext container, String threadId) {
+ return new MIExecutionDMC(getSession().getId(), container, threadId);
+ }
+
+ /**
+ * @nooverride This method is not intended to be re-implemented or extended by clients.
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ @DsfServiceEventHandler
+ public void eventDispatched(MIRunningEvent e) {
+ if (fDisableNextRunningEvent) {
+ fDisableNextRunningEvent = false;
+ // We don't broadcast this running event
+ return;
+ }
+
+ if (fLatestEvent instanceof IResumedDMEvent) {
// Ignore multiple running events in a row. They will only slow down the UI
// for no added value.
return;
}
- IDMEvent<?> event = null;
- // Find the container context, which is used in multi-threaded debugging.
- IContainerDMContext containerDmc = DMContexts.getAncestorOfType(e.getDMContext(), IContainerDMContext.class);
- if (containerDmc != null) {
- // Set the triggering context only if it's different than the container context.
- IExecutionDMContext triggeringCtx = !e.getDMContext().equals(containerDmc) ? e.getDMContext() : null;
- event = new ContainerResumedEvent(containerDmc, e, triggeringCtx);
- } else {
- event = new ResumedEvent(e.getDMContext(), e);
- }
- getSession().dispatchEvent(event, getProperties());
- }
-
- /**
- * @nooverride This method is not intended to be re-implemented or extended by clients.
- * @noreference This method is not intended to be referenced by clients.
- */
- @DsfServiceEventHandler
- public void eventDispatched(final MIStoppedEvent e) {
- if (fDisableNextSignalEvent && e instanceof MISignalEvent) {
- fDisableNextSignalEvent = false;
- fSilencedSignalEvent = e;
- // We don't broadcast this stopped event
- return;
- }
-
- MIBreakpointDMContext _bp = null;
- if (e instanceof MIBreakpointHitEvent) {
- String bpId = ((MIBreakpointHitEvent)e).getNumber();
- IBreakpointsTargetDMContext bpsTarget = DMContexts.getAncestorOfType(e.getDMContext(), IBreakpointsTargetDMContext.class);
- if (bpsTarget != null && !bpId.isEmpty()) {
- _bp = new MIBreakpointDMContext(getSession().getId(), new IDMContext[] {bpsTarget}, bpId);
- }
- }
- final MIBreakpointDMContext bp = _bp;
-
- IDMEvent<?> event = null;
- // Find the container context, which is used in multi-threaded debugging.
- final IContainerDMContext containerDmc = DMContexts.getAncestorOfType(e.getDMContext(), IContainerDMContext.class);
- if (containerDmc != null) {
- // Set the triggering context only if it's not the container context, since we are looking for a thread.
- IExecutionDMContext triggeringCtx = !e.getDMContext().equals(containerDmc) ? e.getDMContext() : null;
- if (triggeringCtx == null) {
- // Still no thread. Let's ask the backend for one.
- // We need a proper thread id for the debug view to select the right thread
- // Bug 300096 comment #15 and Bug 302597
- getConnection().queueCommand(
- fCommandFactory.createCLIThread(containerDmc),
+ IDMEvent<?> event = null;
+ // Find the container context, which is used in multi-threaded debugging.
+ IContainerDMContext containerDmc = DMContexts.getAncestorOfType(e.getDMContext(), IContainerDMContext.class);
+ if (containerDmc != null) {
+ // Set the triggering context only if it's different than the container context.
+ IExecutionDMContext triggeringCtx = !e.getDMContext().equals(containerDmc) ? e.getDMContext() : null;
+ event = new ContainerResumedEvent(containerDmc, e, triggeringCtx);
+ } else {
+ event = new ResumedEvent(e.getDMContext(), e);
+ }
+ getSession().dispatchEvent(event, getProperties());
+ }
+
+ /**
+ * @nooverride This method is not intended to be re-implemented or extended by clients.
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ @DsfServiceEventHandler
+ public void eventDispatched(final MIStoppedEvent e) {
+ if (fDisableNextSignalEvent && e instanceof MISignalEvent) {
+ fDisableNextSignalEvent = false;
+ fSilencedSignalEvent = e;
+ // We don't broadcast this stopped event
+ return;
+ }
+
+ MIBreakpointDMContext _bp = null;
+ if (e instanceof MIBreakpointHitEvent) {
+ String bpId = ((MIBreakpointHitEvent) e).getNumber();
+ IBreakpointsTargetDMContext bpsTarget = DMContexts.getAncestorOfType(e.getDMContext(),
+ IBreakpointsTargetDMContext.class);
+ if (bpsTarget != null && !bpId.isEmpty()) {
+ _bp = new MIBreakpointDMContext(getSession().getId(), new IDMContext[] { bpsTarget }, bpId);
+ }
+ }
+ final MIBreakpointDMContext bp = _bp;
+
+ IDMEvent<?> event = null;
+ // Find the container context, which is used in multi-threaded debugging.
+ final IContainerDMContext containerDmc = DMContexts.getAncestorOfType(e.getDMContext(),
+ IContainerDMContext.class);
+ if (containerDmc != null) {
+ // Set the triggering context only if it's not the container context, since we are looking for a thread.
+ IExecutionDMContext triggeringCtx = !e.getDMContext().equals(containerDmc) ? e.getDMContext() : null;
+ if (triggeringCtx == null) {
+ // Still no thread. Let's ask the backend for one.
+ // We need a proper thread id for the debug view to select the right thread
+ // Bug 300096 comment #15 and Bug 302597
+ getConnection().queueCommand(fCommandFactory.createCLIThread(containerDmc),
new DataRequestMonitor<CLIThreadInfo>(getExecutor(), null) {
@Override
protected void handleCompleted() {
IExecutionDMContext triggeringCtx2 = null;
if (isSuccess() && getData().getCurrentThread() != null) {
- triggeringCtx2 = createMIExecutionContext(containerDmc, getData().getCurrentThread());
+ triggeringCtx2 = createMIExecutionContext(containerDmc,
+ getData().getCurrentThread());
}
IDMEvent<?> event2 = bp != null
- ? new ContainerBreakpointHitEvent(containerDmc, (MIBreakpointHitEvent)e, triggeringCtx2, bp)
- : new ContainerSuspendedEvent(containerDmc, e, triggeringCtx2);
+ ? new ContainerBreakpointHitEvent(containerDmc, (MIBreakpointHitEvent) e,
+ triggeringCtx2, bp)
+ : new ContainerSuspendedEvent(containerDmc, e, triggeringCtx2);
getSession().dispatchEvent(event2, getProperties());
}
});
return;
- }
- if (bp != null) {
- event = new ContainerBreakpointHitEvent(containerDmc, (MIBreakpointHitEvent)e, triggeringCtx, bp);
- } else {
- event = new ContainerSuspendedEvent(containerDmc, e, triggeringCtx);
- }
- } else {
- if (bp != null) {
- event = new BreakpointHitEvent(e.getDMContext(), (MIBreakpointHitEvent)e, bp);
- } else {
- event = new SuspendedEvent(e.getDMContext(), e);
- }
- }
- getSession().dispatchEvent(event, getProperties());
- }
-
- /**
- * Thread Created event handling
- * When a new thread is created - OOB Event fired ~"[New Thread 1077300144 (LWP 7973)]\n"
- * @nooverride This method is not intended to be re-implemented or extended by clients.
- * @noreference This method is not intended to be referenced by clients.
- */
- @DsfServiceEventHandler
- public void eventDispatched(final MIThreadCreatedEvent e) {
- IContainerDMContext containerDmc = e.getDMContext();
- IMIExecutionDMContext executionCtx = e.getStrId() != null ? createMIExecutionContext(containerDmc, e.getStrId()) : null;
- getSession().dispatchEvent(new StartedDMEvent(executionCtx, e), getProperties());
- }
-
- /**
- * Thread exit event handling
- * When a new thread is destroyed - OOB Event fired "
- * @nooverride This method is not intended to be re-implemented or extended by clients.
- * @noreference This method is not intended to be referenced by clients.
- */
- @DsfServiceEventHandler
- public void eventDispatched(final MIThreadExitEvent e) {
- IContainerDMContext containerDmc = e.getDMContext();
- IMIExecutionDMContext executionCtx = e.getStrId() != null ? createMIExecutionContext(containerDmc, e.getStrId()) : null;
- getSession().dispatchEvent(new ExitedDMEvent(executionCtx, e), getProperties());
- }
-
- /**
- * @nooverride This method is not intended to be re-implemented or extended by clients.
- * @noreference This method is not intended to be referenced by clients.
- */
- @DsfServiceEventHandler
- public void eventDispatched(ContainerResumedEvent e) {
- fSuspended = false;
- fResumePending = false;
- fStateChangeReason = e.getReason();
- fStateChangeDetails = null; // we have no details of interest for a resume
- fMICommandCache.setContextAvailable(e.getDMContext(), false);
- fLatestEvent = e;
-
- //fStateChangeTriggeringContext = e.getTriggeringContext();
- if (e.getReason().equals(StateChangeReason.STEP)) {
- fStepping = true;
- } else {
- fMICommandCache.reset();
- }
- }
-
- /**
- * @nooverride This method is not intended to be re-implemented or extended by clients.
- * @noreference This method is not intended to be referenced by clients.
- */
- @DsfServiceEventHandler
- public void eventDispatched(ContainerSuspendedEvent e) {
- fMICommandCache.setContextAvailable(e.getDMContext(), true);
- fMICommandCache.reset();
- fStateChangeReason = e.getReason();
- fStateChangeDetails = e.getDetails();
- fStateChangeTriggeringContext = e.getTriggeringContexts().length != 0
- ? e.getTriggeringContexts()[0] : null;
- fSuspended = true;
- fStepping = false;
- fLatestEvent = e;
-
- fResumePending = false;
- }
-
- /**
- * @nooverride This method is not intended to be re-implemented or extended by clients.
- * @noreference This method is not intended to be referenced by clients.
- * @since 1.1
- */
- @DsfServiceEventHandler
- public void eventDispatched(ICommandControlShutdownDMEvent e) {
- fTerminated = true;
- }
-
-
- /**
- * Event handler when New thread is created
- * @nooverride This method is not intended to be re-implemented or extended by clients.
- * @noreference This method is not intended to be referenced by clients.
- */
- @DsfServiceEventHandler
- public void eventDispatched(StartedDMEvent e) {
-
- }
-
- /**
- * @nooverride This method is not intended to be re-implemented or extended by clients.
- * @noreference This method is not intended to be referenced by clients.
- */
- @DsfServiceEventHandler
- public void eventDispatched(IExitedDMEvent e) {
- if (e.getDMContext() instanceof IContainerDMContext) {
- // When the process terminates, we should consider it as suspended
- // In fact, we did get a stopped event, but our processing of it
- // needs some cleaning up. Until then, let's trigger of this event
- // Bug 342358
- fMICommandCache.setContextAvailable(e.getDMContext(), true);
- fMICommandCache.reset();
-
- fSuspended = true;
- fStepping = false;
- fResumePending = false;
- } else {
- fMICommandCache.reset(e.getDMContext());
- }
- }
-
- ///////////////////////////////////////////////////////////////////////////
- // AbstractService
- @Override
- protected BundleContext getBundleContext() {
- return GdbPlugin.getBundleContext();
- }
-
- ///////////////////////////////////////////////////////////////////////////
- // IRunControl
+ }
+ if (bp != null) {
+ event = new ContainerBreakpointHitEvent(containerDmc, (MIBreakpointHitEvent) e, triggeringCtx, bp);
+ } else {
+ event = new ContainerSuspendedEvent(containerDmc, e, triggeringCtx);
+ }
+ } else {
+ if (bp != null) {
+ event = new BreakpointHitEvent(e.getDMContext(), (MIBreakpointHitEvent) e, bp);
+ } else {
+ event = new SuspendedEvent(e.getDMContext(), e);
+ }
+ }
+ getSession().dispatchEvent(event, getProperties());
+ }
+
+ /**
+ * Thread Created event handling
+ * When a new thread is created - OOB Event fired ~"[New Thread 1077300144 (LWP 7973)]\n"
+ * @nooverride This method is not intended to be re-implemented or extended by clients.
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ @DsfServiceEventHandler
+ public void eventDispatched(final MIThreadCreatedEvent e) {
+ IContainerDMContext containerDmc = e.getDMContext();
+ IMIExecutionDMContext executionCtx = e.getStrId() != null ? createMIExecutionContext(containerDmc, e.getStrId())
+ : null;
+ getSession().dispatchEvent(new StartedDMEvent(executionCtx, e), getProperties());
+ }
+
+ /**
+ * Thread exit event handling
+ * When a new thread is destroyed - OOB Event fired "
+ * @nooverride This method is not intended to be re-implemented or extended by clients.
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ @DsfServiceEventHandler
+ public void eventDispatched(final MIThreadExitEvent e) {
+ IContainerDMContext containerDmc = e.getDMContext();
+ IMIExecutionDMContext executionCtx = e.getStrId() != null ? createMIExecutionContext(containerDmc, e.getStrId())
+ : null;
+ getSession().dispatchEvent(new ExitedDMEvent(executionCtx, e), getProperties());
+ }
+
+ /**
+ * @nooverride This method is not intended to be re-implemented or extended by clients.
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ @DsfServiceEventHandler
+ public void eventDispatched(ContainerResumedEvent e) {
+ fSuspended = false;
+ fResumePending = false;
+ fStateChangeReason = e.getReason();
+ fStateChangeDetails = null; // we have no details of interest for a resume
+ fMICommandCache.setContextAvailable(e.getDMContext(), false);
+ fLatestEvent = e;
+
+ //fStateChangeTriggeringContext = e.getTriggeringContext();
+ if (e.getReason().equals(StateChangeReason.STEP)) {
+ fStepping = true;
+ } else {
+ fMICommandCache.reset();
+ }
+ }
+
+ /**
+ * @nooverride This method is not intended to be re-implemented or extended by clients.
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ @DsfServiceEventHandler
+ public void eventDispatched(ContainerSuspendedEvent e) {
+ fMICommandCache.setContextAvailable(e.getDMContext(), true);
+ fMICommandCache.reset();
+ fStateChangeReason = e.getReason();
+ fStateChangeDetails = e.getDetails();
+ fStateChangeTriggeringContext = e.getTriggeringContexts().length != 0 ? e.getTriggeringContexts()[0] : null;
+ fSuspended = true;
+ fStepping = false;
+ fLatestEvent = e;
+
+ fResumePending = false;
+ }
+
+ /**
+ * @nooverride This method is not intended to be re-implemented or extended by clients.
+ * @noreference This method is not intended to be referenced by clients.
+ * @since 1.1
+ */
+ @DsfServiceEventHandler
+ public void eventDispatched(ICommandControlShutdownDMEvent e) {
+ fTerminated = true;
+ }
+
+ /**
+ * Event handler when New thread is created
+ * @nooverride This method is not intended to be re-implemented or extended by clients.
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ @DsfServiceEventHandler
+ public void eventDispatched(StartedDMEvent e) {
+
+ }
+
+ /**
+ * @nooverride This method is not intended to be re-implemented or extended by clients.
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ @DsfServiceEventHandler
+ public void eventDispatched(IExitedDMEvent e) {
+ if (e.getDMContext() instanceof IContainerDMContext) {
+ // When the process terminates, we should consider it as suspended
+ // In fact, we did get a stopped event, but our processing of it
+ // needs some cleaning up. Until then, let's trigger of this event
+ // Bug 342358
+ fMICommandCache.setContextAvailable(e.getDMContext(), true);
+ fMICommandCache.reset();
+
+ fSuspended = true;
+ fStepping = false;
+ fResumePending = false;
+ } else {
+ fMICommandCache.reset(e.getDMContext());
+ }
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // AbstractService
+ @Override
+ protected BundleContext getBundleContext() {
+ return GdbPlugin.getBundleContext();
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // IRunControl
@Override
public void canResume(IExecutionDMContext context, DataRequestMonitor<Boolean> rm) {
- rm.setData(doCanResume(context));
- rm.done();
+ rm.setData(doCanResume(context));
+ rm.done();
}
- /** @since 2.0 */
+ /** @since 2.0 */
protected boolean doCanResume(IExecutionDMContext context) {
- return !fTerminated && isSuspended(context) && !fResumePending;
+ return !fTerminated && isSuspended(context) && !fResumePending;
}
@Override
public void canSuspend(IExecutionDMContext context, DataRequestMonitor<Boolean> rm) {
- rm.setData(doCanSuspend(context));
- rm.done();
+ rm.setData(doCanSuspend(context));
+ rm.done();
+ }
+
+ private boolean doCanSuspend(IExecutionDMContext context) {
+ return !fTerminated && !isSuspended(context);
}
-
- private boolean doCanSuspend(IExecutionDMContext context) {
- return !fTerminated && !isSuspended(context);
- }
@Override
public boolean isSuspended(IExecutionDMContext context) {
@@ -726,178 +749,180 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
@Override
public boolean isStepping(IExecutionDMContext context) {
- return !fTerminated && fStepping;
- }
+ return !fTerminated && fStepping;
+ }
@Override
public void resume(final IExecutionDMContext context, final RequestMonitor rm) {
assert context != null;
if (doCanResume(context)) {
- ICommand<MIInfo> cmd = null;
- if(context instanceof IContainerDMContext) {
- cmd = fCommandFactory.createMIExecContinue(context);
- } else {
- IMIExecutionDMContext dmc = DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
- if (dmc == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Given context: " + context + " is not an execution context.", null)); //$NON-NLS-1$ //$NON-NLS-2$
- rm.done();
- return;
- }
- cmd = fCommandFactory.createMIExecContinue(dmc);//, new String[0]);
- }
-
- fResumePending = true;
- // Cygwin GDB will accept commands and execute them after the step
- // which is not what we want, so mark the target as unavailable
- // as soon as we send a resume command.
- fMICommandCache.setContextAvailable(context, false);
-
- fConnection.queueCommand(
- cmd,
- new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
- @Override
- protected void handleFailure() {
- fResumePending = false;
- fMICommandCache.setContextAvailable(context, true);
-
- super.handleFailure();
- }
- }
- );
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Given context: " + context + ", is already running.", null)); //$NON-NLS-1$ //$NON-NLS-2$
- rm.done();
- }
- }
-
+ ICommand<MIInfo> cmd = null;
+ if (context instanceof IContainerDMContext) {
+ cmd = fCommandFactory.createMIExecContinue(context);
+ } else {
+ IMIExecutionDMContext dmc = DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
+ if (dmc == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE,
+ "Given context: " + context + " is not an execution context.", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ rm.done();
+ return;
+ }
+ cmd = fCommandFactory.createMIExecContinue(dmc);//, new String[0]);
+ }
+
+ fResumePending = true;
+ // Cygwin GDB will accept commands and execute them after the step
+ // which is not what we want, so mark the target as unavailable
+ // as soon as we send a resume command.
+ fMICommandCache.setContextAvailable(context, false);
+
+ fConnection.queueCommand(cmd, new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
+ @Override
+ protected void handleFailure() {
+ fResumePending = false;
+ fMICommandCache.setContextAvailable(context, true);
+
+ super.handleFailure();
+ }
+ });
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE,
+ "Given context: " + context + ", is already running.", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ rm.done();
+ }
+ }
+
@Override
- public void suspend(IExecutionDMContext context, final RequestMonitor rm){
+ public void suspend(IExecutionDMContext context, final RequestMonitor rm) {
assert context != null;
if (doCanSuspend(context)) {
ICommand<MIInfo> cmd = null;
- if(context instanceof IContainerDMContext){
+ if (context instanceof IContainerDMContext) {
cmd = fCommandFactory.createMIExecInterrupt(context);
- }
- else {
+ } else {
IMIExecutionDMContext dmc = DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
- if (dmc == null){
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Given context: " + context + " is not an execution context.", null)); //$NON-NLS-1$ //$NON-NLS-2$
- rm.done();
- return;
+ if (dmc == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED,
+ "Given context: " + context + " is not an execution context.", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ rm.done();
+ return;
}
cmd = fCommandFactory.createMIExecInterrupt(dmc);
}
- fConnection.queueCommand(cmd, new DataRequestMonitor<MIInfo>(getExecutor(), rm));
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Given context: " + context + ", is already suspended.", null)); //$NON-NLS-1$ //$NON-NLS-2$
- rm.done();
- }
- }
-
+ fConnection.queueCommand(cmd, new DataRequestMonitor<MIInfo>(getExecutor(), rm));
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED,
+ "Given context: " + context + ", is already suspended.", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ rm.done();
+ }
+ }
+
@Override
- public void canStep(IExecutionDMContext context, StepType stepType, DataRequestMonitor<Boolean> rm) {
- if (context instanceof IContainerDMContext) {
- rm.setData(false);
- rm.done();
- return;
- }
- canResume(context, rm);
- }
-
+ public void canStep(IExecutionDMContext context, StepType stepType, DataRequestMonitor<Boolean> rm) {
+ if (context instanceof IContainerDMContext) {
+ rm.setData(false);
+ rm.done();
+ return;
+ }
+ canResume(context, rm);
+ }
+
@Override
public void step(IExecutionDMContext context, StepType stepType, final RequestMonitor rm) {
step(context, stepType, true, rm);
}
-
- /**
+
+ /**
* @since 4.2
*/
- protected void step(final IExecutionDMContext context, StepType stepType, boolean checkCanResume, final RequestMonitor rm) {
- assert context != null;
-
- IMIExecutionDMContext dmc = DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
- if (dmc == null){
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Given context: " + context + " is not an execution context.", null)); //$NON-NLS-1$ //$NON-NLS-2$
- rm.done();
- return;
+ protected void step(final IExecutionDMContext context, StepType stepType, boolean checkCanResume,
+ final RequestMonitor rm) {
+ assert context != null;
+
+ IMIExecutionDMContext dmc = DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
+ if (dmc == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED,
+ "Given context: " + context + " is not an execution context.", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ rm.done();
+ return;
+ }
+
+ if (checkCanResume && !doCanResume(context)) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Cannot resume context", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ ICommand<MIInfo> cmd = null;
+ switch (stepType) {
+ case STEP_INTO:
+ cmd = fCommandFactory.createMIExecStep(dmc, 1);
+ break;
+ case STEP_OVER:
+ cmd = fCommandFactory.createMIExecNext(dmc);
+ break;
+ case STEP_RETURN:
+ // The -exec-finish command operates on the selected stack frame, but here we always
+ // want it to operate on the top stack frame. So we manually create a top-frame
+ // context to use with the MI command.
+ // We get a local instance of the stack service because the stack service can be shut
+ // down before the run control service is shut down. So it is possible for the
+ // getService() request below to return null.
+ MIStack stackService = getServicesTracker().getService(MIStack.class);
+ if (stackService != null) {
+ IFrameDMContext topFrameDmc = stackService.createFrameDMContext(dmc, 0);
+ cmd = fCommandFactory.createMIExecFinish(topFrameDmc);
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED,
+ "Cannot create context for command, stack service not available.", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+ break;
+ case INSTRUCTION_STEP_INTO:
+ cmd = fCommandFactory.createMIExecStepInstruction(dmc, 1);
+ break;
+ case INSTRUCTION_STEP_OVER:
+ cmd = fCommandFactory.createMIExecNextInstruction(dmc, 1);
+ break;
+ default:
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Given step type not supported", //$NON-NLS-1$
+ null));
+ rm.done();
+ return;
}
-
- if (checkCanResume && !doCanResume(context)) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Cannot resume context", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- ICommand<MIInfo> cmd = null;
- switch(stepType) {
- case STEP_INTO:
- cmd = fCommandFactory.createMIExecStep(dmc, 1);
- break;
- case STEP_OVER:
- cmd = fCommandFactory.createMIExecNext(dmc);
- break;
- case STEP_RETURN:
- // The -exec-finish command operates on the selected stack frame, but here we always
- // want it to operate on the top stack frame. So we manually create a top-frame
- // context to use with the MI command.
- // We get a local instance of the stack service because the stack service can be shut
- // down before the run control service is shut down. So it is possible for the
- // getService() request below to return null.
- MIStack stackService = getServicesTracker().getService(MIStack.class);
- if (stackService != null) {
- IFrameDMContext topFrameDmc = stackService.createFrameDMContext(dmc, 0);
- cmd = fCommandFactory.createMIExecFinish(topFrameDmc);
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Cannot create context for command, stack service not available.", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
- break;
- case INSTRUCTION_STEP_INTO:
- cmd = fCommandFactory.createMIExecStepInstruction(dmc, 1);
- break;
- case INSTRUCTION_STEP_OVER:
- cmd = fCommandFactory.createMIExecNextInstruction(dmc, 1);
- break;
- default:
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Given step type not supported", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- fResumePending = true;
- fStepping = true;
- fMICommandCache.setContextAvailable(context, false);
-
- fConnection.queueCommand(cmd, new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
- @Override
- public void handleFailure() {
- fResumePending = false;
- fStepping = false;
- fMICommandCache.setContextAvailable(context, true);
-
- super.handleFailure();
- }
- });
-
- }
+
+ fResumePending = true;
+ fStepping = true;
+ fMICommandCache.setContextAvailable(context, false);
+
+ fConnection.queueCommand(cmd, new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
+ @Override
+ public void handleFailure() {
+ fResumePending = false;
+ fStepping = false;
+ fMICommandCache.setContextAvailable(context, true);
+
+ super.handleFailure();
+ }
+ });
+
+ }
@Override
- public void getExecutionContexts(final IContainerDMContext containerDmc, final DataRequestMonitor<IExecutionDMContext[]> rm) {
- fMICommandCache.execute(
- fCommandFactory.createMIThreadListIds(containerDmc),
- new DataRequestMonitor<MIThreadListIdsInfo>(
- getExecutor(), rm) {
+ public void getExecutionContexts(final IContainerDMContext containerDmc,
+ final DataRequestMonitor<IExecutionDMContext[]> rm) {
+ fMICommandCache.execute(fCommandFactory.createMIThreadListIds(containerDmc),
+ new DataRequestMonitor<MIThreadListIdsInfo>(getExecutor(), rm) {
@Override
protected void handleSuccess() {
rm.setData(makeExecutionDMCs(containerDmc, getData()));
rm.done();
}
});
- }
-
+ }
private IExecutionDMContext[] makeExecutionDMCs(IContainerDMContext containerCtx, MIThreadListIdsInfo info) {
if (info.getStrThreadIds().length == 0) {
@@ -905,7 +930,7 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
// So create thread-id = 0 when no thread is reported.
// This hack is necessary to prevent AbstractMIControl from issuing a thread-select
// because it doesn't work if the application was not compiled with pthread.
- return new IMIExecutionDMContext[]{createMIExecutionContext(containerCtx, FAKE_THREAD_ID)};
+ return new IMIExecutionDMContext[] { createMIExecutionContext(containerCtx, FAKE_THREAD_ID) };
} else {
IExecutionDMContext[] executionDmcs = new IMIExecutionDMContext[info.getStrThreadIds().length];
for (int i = 0; i < info.getStrThreadIds().length; i++) {
@@ -914,45 +939,48 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
return executionDmcs;
}
}
-
+
@Override
- public void getExecutionData(IExecutionDMContext dmc, DataRequestMonitor<IExecutionDMData> rm){
- if (dmc instanceof IContainerDMContext) {
- rm.setData( new ExecutionData(fStateChangeReason, fStateChangeDetails) );
- } else if (dmc instanceof IMIExecutionDMContext) {
- boolean thisThreadCausedStateChange = dmc.equals(fStateChangeTriggeringContext);
- StateChangeReason reason = thisThreadCausedStateChange ? fStateChangeReason : StateChangeReason.CONTAINER;
- String details = thisThreadCausedStateChange ? fStateChangeDetails : null;
- rm.setData(new ExecutionData(reason, details));
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Given context: " + dmc + " is not an execution context.", null)); //$NON-NLS-1$ //$NON-NLS-2$
- }
- rm.done();
- }
+ public void getExecutionData(IExecutionDMContext dmc, DataRequestMonitor<IExecutionDMData> rm) {
+ if (dmc instanceof IContainerDMContext) {
+ rm.setData(new ExecutionData(fStateChangeReason, fStateChangeDetails));
+ } else if (dmc instanceof IMIExecutionDMContext) {
+ boolean thisThreadCausedStateChange = dmc.equals(fStateChangeTriggeringContext);
+ StateChangeReason reason = thisThreadCausedStateChange ? fStateChangeReason : StateChangeReason.CONTAINER;
+ String details = thisThreadCausedStateChange ? fStateChangeDetails : null;
+ rm.setData(new ExecutionData(reason, details));
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE,
+ "Given context: " + dmc + " is not an execution context.", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ rm.done();
+ }
/** @since 3.0 */
- protected void runToLocation(IExecutionDMContext context, String location, boolean skipBreakpoints, final RequestMonitor rm){
- // skipBreakpoints is not used at the moment. Implement later
-
- assert context != null;
-
- IMIExecutionDMContext dmc = DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
- if (dmc == null){
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Given context: " + context + " is not an execution context.", null)); //$NON-NLS-1$ //$NON-NLS-2$
- rm.done();
- return;
+ protected void runToLocation(IExecutionDMContext context, String location, boolean skipBreakpoints,
+ final RequestMonitor rm) {
+ // skipBreakpoints is not used at the moment. Implement later
+
+ assert context != null;
+
+ IMIExecutionDMContext dmc = DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
+ if (dmc == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED,
+ "Given context: " + context + " is not an execution context.", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ rm.done();
+ return;
}
- if (doCanResume(dmc)) {
- fResumePending = true;
- fMICommandCache.setContextAvailable(dmc, false);
- fConnection.queueCommand(fCommandFactory.createMIExecUntil(dmc, location),
- new DataRequestMonitor<MIInfo>(getExecutor(), rm));
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED,
- "Cannot resume given DMC.", null)); //$NON-NLS-1$
- rm.done();
- }
+ if (doCanResume(dmc)) {
+ fResumePending = true;
+ fMICommandCache.setContextAvailable(dmc, false);
+ fConnection.queueCommand(fCommandFactory.createMIExecUntil(dmc, location),
+ new DataRequestMonitor<MIInfo>(getExecutor(), rm));
+ } else {
+ rm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Cannot resume given DMC.", null)); //$NON-NLS-1$
+ rm.done();
+ }
}
/** @since 3.0 */
@@ -960,8 +988,9 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
assert context != null;
final IMIExecutionDMContext dmc = DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
- if (dmc == null){
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Given context: " + context + " is not an thread execution context.", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ if (dmc == null) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR,
+ "Given context: " + context + " is not an thread execution context.", null)); //$NON-NLS-1$ //$NON-NLS-2$
rm.done();
return;
}
@@ -969,8 +998,7 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
if (doCanResume(dmc)) {
fResumePending = true;
fMICommandCache.setContextAvailable(dmc, false);
- fConnection.queueCommand(
- fCommandFactory.createCLIJump(dmc, location),
+ fConnection.queueCommand(fCommandFactory.createCLIJump(dmc, location),
new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
@Override
protected void handleFailure() {
@@ -981,29 +1009,29 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
}
});
} else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED,
- "Cannot resume given DMC.", null)); //$NON-NLS-1$
- rm.done();
- }
+ rm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Cannot resume given DMC.", null)); //$NON-NLS-1$
+ rm.done();
+ }
}
/* ******************************************************************************
* Section to support operations even when the target is unavailable.
*
* Basically, we must make sure the container is suspended before making
- * certain operations (currently breakpoints). If we don't, we must first
+ * certain operations (currently breakpoints). If we don't, we must first
* suspend the container, then perform the specified operations,
* and finally resume the container.
* See http://bugs.eclipse.org/242943
* and http://bugs.eclipse.org/282273
- *
+ *
* Note that for multi-process, the correct container must be suspended for the
* breakpoint to be inserted on that container. Not a big deal though, since
* a breakpointDmc is mapped to a specific container. Also, since we are in
* all-stop mode here, it does not really matter what we stop, everything will
* stop.
* See http://bugs.eclipse.org/337893
- *
+ *
* ******************************************************************************/
/**
@@ -1014,7 +1042,7 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
public IDMContext ctx;
public Sequence.Step[] steps;
public RequestMonitor rm;
-
+
public TargetAvailableOperationInfo(IDMContext ctx, Step[] steps, RequestMonitor rm) {
super();
this.ctx = ctx;
@@ -1033,7 +1061,7 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
// This allows us to know if we can add more steps to execute or if we missed
// our opportunity
private boolean fCurrentlyExecutingSteps;
-
+
// MultiRequestMonitor that allows us to track all the different steps we are
// executing. Once all steps are executed, we can complete this MultiRM and
// allow the global sequence to continue.
@@ -1048,7 +1076,7 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
private int fNumStepsStillExecuting;
// Queue of executeWithTargetAvailable() operations that need to be processed.
private LinkedList<TargetAvailableOperationInfo> fOperationsPending = new LinkedList<TargetAvailableOperationInfo>();
-
+
/**
* Returns whether the target is available to perform operations
* @since 3.0
@@ -1061,7 +1089,7 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
protected void setTargetAvailable(boolean available) {
fTargetAvailable = available;
}
-
+
/**
* Returns the execution context that needs to be suspended to perform the
* required operation.
@@ -1076,24 +1104,24 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
fExecutionDmc = context;
}
- /**
- * Returns whether there is currently an ExecuteWithTargetAvailable() operation ongoing.
- * @since 4.0
+ /**
+ * Returns whether there is currently an ExecuteWithTargetAvailable() operation ongoing.
+ * @since 4.0
*/
protected boolean isTargetAvailableOperationOngoing() {
return fOngoingOperation;
}
-
+
/** @since 4.0 */
protected void setTargetAvailableOperationOngoing(boolean ongoing) {
fOngoingOperation = ongoing;
}
-
+
/**
* Returns whether we are current in the process of executing the steps
* that were passed to ExecuteWithTargetAvailable().
* When this value is true, we can send more steps to be executed.
- * @since 4.0
+ * @since 4.0
*/
protected boolean isCurrentlyExecutingSteps() {
return fCurrentlyExecutingSteps;
@@ -1106,24 +1134,23 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
/**
* Returns the requestMonitor that will be run once all steps sent to
- * ExecuteWithTargetAvailable() have been executed.
- * @since 4.0
+ * ExecuteWithTargetAvailable() have been executed.
+ * @since 4.0
*/
protected MultiRequestMonitor<RequestMonitor> getExecuteQueuedStepsRM() {
return fExecuteQueuedOpsStepMonitor;
}
-
+
/** @since 4.0 */
protected void setExecuteQueuedStepsRM(MultiRequestMonitor<RequestMonitor> rm) {
fExecuteQueuedOpsStepMonitor = rm;
}
-
/**
* Returns the number of batches of steps sent to ExecuteWithTargetAvailable()
* that are still executing. Once this number reaches zero, we can complete
* the overall ExecuteWithTargetAvailable() operation.
- * @since 4.0
+ * @since 4.0
*/
protected int getNumStepsStillExecuting() {
return fNumStepsStillExecuting;
@@ -1151,7 +1178,7 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
*/
protected void executeSteps(final TargetAvailableOperationInfo info) {
fNumStepsStillExecuting++;
-
+
// This RM propagates any error to the original rm of the actual steps.
// Even in case of errors for these steps, we want to continue the overall sequence
RequestMonitor stepsRm = new ImmediateRequestMonitor() {
@@ -1176,10 +1203,13 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
fExecuteQueuedOpsStepMonitor.add(stepsRm);
getExecutor().execute(new Sequence(getExecutor(), stepsRm) {
- @Override public Step[] getSteps() { return info.steps; }
- });
+ @Override
+ public Step[] getSteps() {
+ return info.steps;
+ }
+ });
}
-
+
/**
* @since 3.0
*/
@@ -1192,37 +1222,34 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
// We always go through our queue, even if we only have a single call to this method
fOperationsPending.add(new TargetAvailableOperationInfo(ctx, steps, rm));
-
+
// Steps that need to be executed to perform the operation
- final Step[] sequenceSteps = new Step[] {
- new IsTargetAvailableStep(ctx),
- new MakeTargetAvailableStep(),
- new ExecuteQueuedOperationsStep(),
- new RestoreTargetStateStep(),
- };
-
+ final Step[] sequenceSteps = new Step[] { new IsTargetAvailableStep(ctx), new MakeTargetAvailableStep(),
+ new ExecuteQueuedOperationsStep(), new RestoreTargetStateStep(), };
+
// Once all the sequence is completed, we need to see if we have received
// another request that we now need to process
RequestMonitor sequenceCompletedRm = new RequestMonitor(getExecutor(), null) {
@Override
protected void handleSuccess() {
- fOngoingOperation = false;
-
- if (!fOperationsPending.isEmpty()) {
- // Darn, more operations came in. Trigger their processing
- // by calling executeWithTargetAvailable() on the last one
- TargetAvailableOperationInfo info = fOperationsPending.removeLast();
- executeWithTargetAvailable(info.ctx, info.steps, info.rm);
- }
- // no other rm.done() needs to be called, they have all been handled already
+ fOngoingOperation = false;
+
+ if (!fOperationsPending.isEmpty()) {
+ // Darn, more operations came in. Trigger their processing
+ // by calling executeWithTargetAvailable() on the last one
+ TargetAvailableOperationInfo info = fOperationsPending.removeLast();
+ executeWithTargetAvailable(info.ctx, info.steps, info.rm);
+ }
+ // no other rm.done() needs to be called, they have all been handled already
}
+
@Override
protected void handleFailure() {
// If the sequence failed, we have to give up on the operation(s).
// If we don't, we risk an infinite loop where we try, over and over
// to perform an operation that keeps on failing.
fOngoingOperation = false;
-
+
// Complete each rm of the cancelled operations
while (!fOperationsPending.isEmpty()) {
RequestMonitor rm = fOperationsPending.poll().rm;
@@ -1233,9 +1260,12 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
super.handleFailure();
}
};
-
+
getExecutor().execute(new Sequence(getExecutor(), sequenceCompletedRm) {
- @Override public Step[] getSteps() { return sequenceSteps; }
+ @Override
+ public Step[] getSteps() {
+ return sequenceSteps;
+ }
});
} else {
// We are currently already executing such an operation
@@ -1249,8 +1279,7 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
}
}
}
-
-
+
/**
* This part of the sequence verifies if the execution context of interest
* is suspended or not.
@@ -1258,11 +1287,11 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
*/
protected class IsTargetAvailableStep extends Sequence.Step {
final IDMContext fCtx;
-
+
public IsTargetAvailableStep(IDMContext ctx) {
fCtx = ctx;
}
-
+
@Override
public void execute(final RequestMonitor rm) {
fExecutionDmc = DMContexts.getAncestorOfType(fCtx, IMIContainerDMContext.class);
@@ -1274,13 +1303,12 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(fCtx, ICommandControlDMContext.class);
IProcesses processControl = getServicesTracker().getService(IProcesses.class);
- processControl.getProcessesBeingDebugged(
- controlDmc,
+ processControl.getProcessesBeingDebugged(controlDmc,
new DataRequestMonitor<IDMContext[]>(getExecutor(), rm) {
@Override
protected void handleSuccess() {
assert getData() != null;
-
+
if (getData().length == 0) {
// Happens at startup, starting with GDB 7.0.
// This means the target is available
@@ -1288,7 +1316,7 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
} else {
// In all-stop, if any process is suspended, then all of them are suspended
// so we only need to check the first process.
- fExecutionDmc = (IExecutionDMContext)(getData()[0]);
+ fExecutionDmc = (IExecutionDMContext) (getData()[0]);
fTargetAvailable = isSuspended(fExecutionDmc);
}
rm.done();
@@ -1304,21 +1332,20 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
*/
protected class MakeTargetAvailableStep extends Sequence.Step {
- /* public constructor required, so upper classes can override executeWithTargetAvailable */
- /** @since 4.5 */
- public MakeTargetAvailableStep() {
- }
+ /* public constructor required, so upper classes can override executeWithTargetAvailable */
+ /** @since 4.5 */
+ public MakeTargetAvailableStep() {
+ }
@Override
public void execute(final RequestMonitor rm) {
if (!isTargetAvailable()) {
assert fDisableNextRunningEvent == false;
assert fDisableNextSignalEvent == false;
-
+
// Don't broadcast the coming stopped signal event
fDisableNextSignalEvent = true;
- suspend(getContextToSuspend(),
- new RequestMonitor(getExecutor(), rm) {
+ suspend(getContextToSuspend(), new RequestMonitor(getExecutor(), rm) {
@Override
protected void handleFailure() {
// We weren't able to suspend, so abort the operation
@@ -1330,10 +1357,11 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
rm.done();
}
}
+
@Override
public void rollBack(RequestMonitor rm) {
- Sequence.Step restoreStep = new RestoreTargetStateStep();
- restoreStep.execute(rm);
+ Sequence.Step restoreStep = new RestoreTargetStateStep();
+ restoreStep.execute(rm);
}
};
@@ -1344,25 +1372,26 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
*/
protected class ExecuteQueuedOperationsStep extends Sequence.Step {
- /* public constructor required, so upper classes can override executeWithTargetAvailable */
- /** @since 4.5 */
- public ExecuteQueuedOperationsStep() {
- }
+ /* public constructor required, so upper classes can override executeWithTargetAvailable */
+ /** @since 4.5 */
+ public ExecuteQueuedOperationsStep() {
+ }
@Override
public void execute(final RequestMonitor rm) {
fCurrentlyExecutingSteps = true;
-
+
// It is important to use an ImmediateExecutor for this RM, to make sure we don't risk getting a new
// call to ExecuteWithTargetAvailable() when we just finished executing the steps.
- fExecuteQueuedOpsStepMonitor = new MultiRequestMonitor<RequestMonitor>(ImmediateExecutor.getInstance(), rm) {
+ fExecuteQueuedOpsStepMonitor = new MultiRequestMonitor<RequestMonitor>(ImmediateExecutor.getInstance(),
+ rm) {
@Override
protected void handleCompleted() {
assert fOperationsPending.size() == 0;
-
+
// We don't handle errors here. Instead, we have already propagated any
// errors to each rm for each set of steps
-
+
fCurrentlyExecutingSteps = false;
// Continue the sequence
rm.done();
@@ -1370,15 +1399,15 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
};
// Tell the RM that we need to confirm when we are done adding sub-rms
fExecuteQueuedOpsStepMonitor.requireDoneAdding();
-
+
// All pending operations are independent of each other so we can
// run them concurrently.
while (!fOperationsPending.isEmpty()) {
- executeSteps(fOperationsPending.poll());
+ executeSteps(fOperationsPending.poll());
}
}
};
-
+
/**
* If the sequence had to interrupt the execution context of interest,
* this step will resume it again to reach the same state as when we started.
@@ -1386,21 +1415,20 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
*/
protected class RestoreTargetStateStep extends Sequence.Step {
- /* public constructor required, so upper classes can override executeWithTargetAvailable */
- /** @since 4.5 */
- public RestoreTargetStateStep() {
- }
+ /* public constructor required, so upper classes can override executeWithTargetAvailable */
+ /** @since 4.5 */
+ public RestoreTargetStateStep() {
+ }
@Override
public void execute(final RequestMonitor rm) {
if (!isTargetAvailable()) {
assert fDisableNextRunningEvent == false;
fDisableNextRunningEvent = true;
-
+
// Can't use the resume() call because we 'silently' stopped
// so resume() will not know we are actually stopped
- fConnection.queueCommand(
- fCommandFactory.createMIExecContinue(getContextToSuspend()),
+ fConnection.queueCommand(fCommandFactory.createMIExecContinue(getContextToSuspend()),
new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
@Override
protected void handleSuccess() {
@@ -1412,7 +1440,7 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
protected void handleFailure() {
// Darn, we're unable to restart the target. Must cleanup!
fDisableNextRunningEvent = false;
-
+
// We must also sent the Stopped event that we had kept silent
if (fSilencedSignalEvent != null) {
eventDispatched(fSilencedSignalEvent);
@@ -1431,24 +1459,23 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
rm.done();
}
}
- };
+ };
- /* ******************************************************************************
- * End of section to support operations even when the target is unavailable.
- * ******************************************************************************/
+ /* ******************************************************************************
+ * End of section to support operations even when the target is unavailable.
+ * ******************************************************************************/
/**
* {@inheritDoc}
- * @since 1.1
- */
- @Override
+ * @since 1.1
+ */
+ @Override
public void flushCache(IDMContext context) {
- fMICommandCache.reset(context);
+ fMICommandCache.reset(context);
}
- private void moveToLocation(final IExecutionDMContext context,
- final String location, final Map<String, Object> bpAttributes,
- final RequestMonitor rm) {
+ private void moveToLocation(final IExecutionDMContext context, final String location,
+ final Map<String, Object> bpAttributes, final RequestMonitor rm) {
// first create a temporary breakpoint to stop the execution at
// the location we are about to jump to
@@ -1456,7 +1483,7 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
IBreakpointsTargetDMContext bpDmc = DMContexts.getAncestorOfType(context, IBreakpointsTargetDMContext.class);
if (bpService != null && bpDmc != null) {
bpService.insertBreakpoint(bpDmc, bpAttributes,
- new DataRequestMonitor<IBreakpointDMContext>(getExecutor(),rm) {
+ new DataRequestMonitor<IBreakpointDMContext>(getExecutor(), rm) {
@Override
protected void handleSuccess() {
// Now resume at the proper location
@@ -1464,8 +1491,7 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
}
});
} else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
- IDsfStatusConstants.NOT_SUPPORTED,
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED,
"Unable to set breakpoint", null)); //$NON-NLS-1$
rm.done();
}
@@ -1478,8 +1504,8 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
* @since 3.0
*/
@Override
- public void canRunToLine(IExecutionDMContext context, String sourceFile,
- int lineNumber, DataRequestMonitor<Boolean> rm) {
+ public void canRunToLine(IExecutionDMContext context, String sourceFile, int lineNumber,
+ DataRequestMonitor<Boolean> rm) {
canResume(context, rm);
}
@@ -1490,15 +1516,15 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
* @since 3.0
*/
@Override
- public void runToLine(final IExecutionDMContext context, String sourceFile,
- final int lineNumber, final boolean skipBreakpoints, final RequestMonitor rm) {
-
- determineDebuggerPath(context, sourceFile, new ImmediateDataRequestMonitor<String>(rm) {
- @Override
- protected void handleSuccess() {
- runToLocation(context, getData() + ":" + Integer.toString(lineNumber), skipBreakpoints, rm); //$NON-NLS-1$
- }
- });
+ public void runToLine(final IExecutionDMContext context, String sourceFile, final int lineNumber,
+ final boolean skipBreakpoints, final RequestMonitor rm) {
+
+ determineDebuggerPath(context, sourceFile, new ImmediateDataRequestMonitor<String>(rm) {
+ @Override
+ protected void handleSuccess() {
+ runToLocation(context, getData() + ":" + Integer.toString(lineNumber), skipBreakpoints, rm); //$NON-NLS-1$
+ }
+ });
}
/* (non-Javadoc)
@@ -1508,8 +1534,7 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
* @since 3.0
*/
@Override
- public void canRunToAddress(IExecutionDMContext context, IAddress address,
- DataRequestMonitor<Boolean> rm) {
+ public void canRunToAddress(IExecutionDMContext context, IAddress address, DataRequestMonitor<Boolean> rm) {
canResume(context, rm);
}
@@ -1520,8 +1545,8 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
* @since 3.0
*/
@Override
- public void runToAddress(IExecutionDMContext context, IAddress address,
- boolean skipBreakpoints, RequestMonitor rm) {
+ public void runToAddress(IExecutionDMContext context, IAddress address, boolean skipBreakpoints,
+ RequestMonitor rm) {
runToLocation(context, "*0x" + address.toString(16), skipBreakpoints, rm); //$NON-NLS-1$
}
@@ -1532,8 +1557,8 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
* @since 3.0
*/
@Override
- public void canMoveToLine(IExecutionDMContext context, String sourceFile,
- int lineNumber, boolean resume, DataRequestMonitor<Boolean> rm) {
+ public void canMoveToLine(IExecutionDMContext context, String sourceFile, int lineNumber, boolean resume,
+ DataRequestMonitor<Boolean> rm) {
canResume(context, rm);
}
@@ -1544,15 +1569,14 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
* @since 3.0
*/
@Override
- public void moveToLine(final IExecutionDMContext context, String sourceFile,
- final int lineNumber, final boolean resume, final RequestMonitor rm) {
+ public void moveToLine(final IExecutionDMContext context, String sourceFile, final int lineNumber,
+ final boolean resume, final RequestMonitor rm) {
final IMIExecutionDMContext threadExecDmc = DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
if (threadExecDmc == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Invalid thread context", null)); //$NON-NLS-1$
- rm.done();
- }
- else
- {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED,
+ "Invalid thread context", null)); //$NON-NLS-1$
+ rm.done();
+ } else {
determineDebuggerPath(context, sourceFile, new ImmediateDataRequestMonitor<String>(rm) {
@Override
protected void handleSuccess() {
@@ -1563,7 +1587,7 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
resumeAtLocation(context, location, rm);
} else {
// Create the breakpoint attributes
- Map<String,Object> attr = new HashMap<String,Object>();
+ Map<String, Object> attr = new HashMap<String, Object>();
attr.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.BREAKPOINT);
attr.put(MIBreakpoints.FILE_NAME, debuggerPath);
attr.put(MIBreakpoints.LINE_NUMBER, lineNumber);
@@ -1585,8 +1609,8 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
* @since 3.0
*/
@Override
- public void canMoveToAddress(IExecutionDMContext context, IAddress address,
- boolean resume, DataRequestMonitor<Boolean> rm) {
+ public void canMoveToAddress(IExecutionDMContext context, IAddress address, boolean resume,
+ DataRequestMonitor<Boolean> rm) {
canResume(context, rm);
}
@@ -1597,25 +1621,23 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
* @since 3.0
*/
@Override
- public void moveToAddress(IExecutionDMContext context, IAddress address,
- boolean resume, RequestMonitor rm) {
+ public void moveToAddress(IExecutionDMContext context, IAddress address, boolean resume, RequestMonitor rm) {
IMIExecutionDMContext threadExecDmc = DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
if (threadExecDmc == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Invalid thread context", null)); //$NON-NLS-1$
- rm.done();
- }
- else
- {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED,
+ "Invalid thread context", null)); //$NON-NLS-1$
+ rm.done();
+ } else {
String location = "*0x" + address.toString(16); //$NON-NLS-1$
if (resume)
resumeAtLocation(context, location, rm);
else {
// Create the breakpoint attributes
- Map<String,Object> attr = new HashMap<String,Object>();
+ Map<String, Object> attr = new HashMap<String, Object>();
attr.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.BREAKPOINT);
attr.put(MIBreakpoints.ADDRESS, "0x" + address.toString(16)); //$NON-NLS-1$
attr.put(MIBreakpointDMData.IS_TEMPORARY, true);
- attr.put(MIBreakpointDMData.THREAD_ID, threadExecDmc.getThreadId());
+ attr.put(MIBreakpointDMData.THREAD_ID, threadExecDmc.getThreadId());
// Now do the operation
moveToLocation(context, location, attr, rm);
@@ -1628,57 +1650,57 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
public IRunMode getRunMode() {
return MIRunMode.ALL_STOP;
}
-
+
/** @since 4.0 */
@Override
public boolean isTargetAcceptingCommands() {
// For all-stop mode:
// 1- if GDB is not terminated and
- // 2- if execution is suspended and
- // 3- if we didn't just send a resume/stop command, then
+ // 2- if execution is suspended and
+ // 3- if we didn't just send a resume/stop command, then
// we know GDB is accepting commands
return !fTerminated && fSuspended && !fResumePending;
}
-
+
/**
* Determine the path that should be sent to the debugger as per the source lookup service.
- *
+ *
* @param dmc A context that can be used to obtain the sourcelookup context.
* @param hostPath The path of the file on the host, which must be converted.
* @param rm The result of the conversion.
* @since 4.2
*/
- protected void determineDebuggerPath(IDMContext dmc, String hostPath, final DataRequestMonitor<String> rm)
- {
- final IBreakpoints breakpoints = getServicesTracker().getService(IBreakpoints.class);
- if (!(breakpoints instanceof IMIBreakpointPathAdjuster)) {
- rm.done(hostPath);
- return;
- }
- ISourceLookup sourceLookup = getServicesTracker().getService(ISourceLookup.class);
- ISourceLookupDMContext srcDmc = DMContexts.getAncestorOfType(dmc, ISourceLookupDMContext.class);
- if (sourceLookup == null || srcDmc == null) {
- // Source lookup not available for given context, use the host
- // path for the debugger path.
- // Hack around a MinGW bug; see 369622 (and also 196154 and 232415)
- rm.done(((IMIBreakpointPathAdjuster)breakpoints).adjustDebuggerPath(hostPath));
- return;
- }
-
- sourceLookup.getDebuggerPath(srcDmc, hostPath, new DataRequestMonitor<String>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- // Hack around a MinGW bug; see 369622 (and also 196154 and 232415)
- rm.done(((IMIBreakpointPathAdjuster)breakpoints).adjustDebuggerPath(getData()));
- }
- });
- }
-
+ protected void determineDebuggerPath(IDMContext dmc, String hostPath, final DataRequestMonitor<String> rm) {
+ final IBreakpoints breakpoints = getServicesTracker().getService(IBreakpoints.class);
+ if (!(breakpoints instanceof IMIBreakpointPathAdjuster)) {
+ rm.done(hostPath);
+ return;
+ }
+ ISourceLookup sourceLookup = getServicesTracker().getService(ISourceLookup.class);
+ ISourceLookupDMContext srcDmc = DMContexts.getAncestorOfType(dmc, ISourceLookupDMContext.class);
+ if (sourceLookup == null || srcDmc == null) {
+ // Source lookup not available for given context, use the host
+ // path for the debugger path.
+ // Hack around a MinGW bug; see 369622 (and also 196154 and 232415)
+ rm.done(((IMIBreakpointPathAdjuster) breakpoints).adjustDebuggerPath(hostPath));
+ return;
+ }
+
+ sourceLookup.getDebuggerPath(srcDmc, hostPath, new DataRequestMonitor<String>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ // Hack around a MinGW bug; see 369622 (and also 196154 and 232415)
+ rm.done(((IMIBreakpointPathAdjuster) breakpoints).adjustDebuggerPath(getData()));
+ }
+ });
+ }
+
/**
* @since 4.2
*/
@Override
- public void canStepIntoSelection(IExecutionDMContext context, String sourceFile, int lineNumber, IFunctionDeclaration selectedFunction, DataRequestMonitor<Boolean> rm) {
+ public void canStepIntoSelection(IExecutionDMContext context, String sourceFile, int lineNumber,
+ IFunctionDeclaration selectedFunction, DataRequestMonitor<Boolean> rm) {
rm.done(false);
}
@@ -1686,9 +1708,11 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
* @since 4.2
*/
@Override
- public void stepIntoSelection(IExecutionDMContext context, String sourceFile, int lineNumber, boolean skipBreakpoints, IFunctionDeclaration selectedFunction, RequestMonitor rm) {
- IStatus status = new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Step Into Selection not supported", null); //$NON-NLS-1$
+ public void stepIntoSelection(IExecutionDMContext context, String sourceFile, int lineNumber,
+ boolean skipBreakpoints, IFunctionDeclaration selectedFunction, RequestMonitor rm) {
+ IStatus status = new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED,
+ "Step Into Selection not supported", null); //$NON-NLS-1$
rm.done(status);
}
-
+
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIStack.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIStack.java
index b531bd0e7ab..e27079fe6af 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIStack.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIStack.java
@@ -67,29 +67,29 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.osgi.framework.BundleContext;
-public class MIStack extends AbstractDsfService
-implements IStack, ICachingService {
+public class MIStack extends AbstractDsfService implements IStack, ICachingService {
private static final int DEFAULT_STACK_DEPTH = 5;
- protected static class MIFrameDMC extends AbstractDMContext
- implements IFrameDMContext
- {
+ protected static class MIFrameDMC extends AbstractDMContext implements IFrameDMContext {
private final int fLevel;
+
public MIFrameDMC(String sessionId, IExecutionDMContext execDmc, int level) {
super(sessionId, new IDMContext[] { execDmc });
fLevel = level;
}
@Override
- public int getLevel() { return fLevel; }
+ public int getLevel() {
+ return fLevel;
+ }
@Override
public boolean equals(Object other) {
if (!(other instanceof MIFrameDMC)) {
return false;
}
-
- return super.baseEquals(other) && ((MIFrameDMC)other).fLevel == fLevel;
+
+ return super.baseEquals(other) && ((MIFrameDMC) other).fLevel == fLevel;
}
@Override
@@ -99,14 +99,17 @@ implements IStack, ICachingService {
@Override
public String toString() {
- return baseToString() + ".frame[" + fLevel + "]"; //$NON-NLS-1$ //$NON-NLS-2$
+ return baseToString() + ".frame[" + fLevel + "]"; //$NON-NLS-1$ //$NON-NLS-2$
}
}
- protected static class MIVariableDMC extends AbstractDMContext
- implements IVariableDMContext
- {
- public enum Type { ARGUMENT, LOCAL, /** @since 4.4 */RETURN_VALUES }
+ protected static class MIVariableDMC extends AbstractDMContext implements IVariableDMContext {
+ public enum Type {
+ ARGUMENT, LOCAL,
+ /** @since 4.4 */
+ RETURN_VALUES
+ }
+
private final Type fType;
private final int fIndex;
@@ -116,18 +119,22 @@ implements IStack, ICachingService {
fType = type;
}
- public int getIndex() { return fIndex; }
- public Type getType() { return fType; }
+ public int getIndex() {
+ return fIndex;
+ }
+
+ public Type getType() {
+ return fType;
+ }
@Override
public boolean equals(Object other) {
if (!(other instanceof MIVariableDMC)) {
return false;
}
-
- return super.baseEquals(other) &&
- ((MIVariableDMC)other).fType == fType &&
- ((MIVariableDMC)other).fIndex == fIndex;
+
+ return super.baseEquals(other) && ((MIVariableDMC) other).fType == fType
+ && ((MIVariableDMC) other).fIndex == fIndex;
}
@Override
@@ -145,9 +152,10 @@ implements IStack, ICachingService {
@Override
public String toString() {
- return baseToString() + ".variable(" + fType + ")[" + fIndex + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ return baseToString() + ".variable(" + fType + ")[" + fIndex + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
}
+
/**
* Same as with frame objects, this is a base class for the IVariableDMData object that uses an MIArg object to
* provide the data. Sub-classes must supply the MIArg object.
@@ -155,7 +163,7 @@ implements IStack, ICachingService {
private static class VariableData implements IVariableDMData {
private MIArg fMIArg;
- public VariableData(MIArg arg){
+ public VariableData(MIArg arg) {
fMIArg = arg;
}
@@ -279,12 +287,12 @@ implements IStack, ICachingService {
This cache allows us to know that if we already asked for a stack depth
we can potentially re-use the answer.
<br>
- The same concept is applicable for the -stack-list-frames command with different limits.
+ The same concept is applicable for the -stack-list-frames command with different limits.
Also, the stack depth can be deduced from the frames list, so we don't need to ask gdb for it again.
<p>
The second reason is that gdb is unreliable when it comes to returning frames. The MI protocol only allows to reply
- with data or with error. When gdb is unwinding sometimes it gets both, and while the console CLI protocol has no
- problem with that, for MI, gdb replies randomly, sometimes with data, sometimes with error. If we cache the valid data
+ with data or with error. When gdb is unwinding sometimes it gets both, and while the console CLI protocol has no
+ problem with that, for MI, gdb replies randomly, sometimes with data, sometimes with error. If we cache the valid data
it will eliminate the issue with invalid data on subsequent invocations. We don't cache errors.
*/
@SuppressWarnings("serial")
@@ -295,7 +303,8 @@ implements IStack, ICachingService {
remove(execDmc.getThreadId());
} else {
clear();
- };
+ }
+ ;
}
public FramesCacheInfo getThreadFramesCache(String threadId) {
@@ -350,8 +359,7 @@ implements IStack, ICachingService {
* Base class for the IFrameDMData object that uses an MIFrame object to
* provide the data. Sub-classes must provide the MIFrame object
*/
- private abstract class FrameData implements IFrameDMData
- {
+ private abstract class FrameData implements IFrameDMData {
protected abstract MIFrame getMIFrame();
@Override
@@ -371,27 +379,47 @@ implements IStack, ICachingService {
}
@Override
- public int getColumn() { return 0; }
+ public int getColumn() {
+ return 0;
+ }
@Override
- public String getFile() { return getMIFrame().getFile(); }
+ public String getFile() {
+ return getMIFrame().getFile();
+ }
+
@Override
- public int getLine() { return getMIFrame().getLine(); }
+ public int getLine() {
+ return getMIFrame().getLine();
+ }
+
@Override
- public String getFunction() { return getMIFrame().getFunction(); }
+ public String getFunction() {
+ return getMIFrame().getFunction();
+ }
+
@Override
- public String getModule() { return ""; }//$NON-NLS-1$
+ public String getModule() {
+ return ""; //$NON-NLS-1$
+ }
@Override
- public String toString() { return getMIFrame().toString(); }
+ public String toString() {
+ return getMIFrame().toString();
+ }
}
-
private class FrameDataFromStoppedEvent extends FrameData {
private final MIStoppedEvent fEvent;
- FrameDataFromStoppedEvent(MIStoppedEvent event) { fEvent = event; }
+
+ FrameDataFromStoppedEvent(MIStoppedEvent event) {
+ fEvent = event;
+ }
+
@Override
- protected MIFrame getMIFrame() { return fEvent.getFrame(); }
+ protected MIFrame getMIFrame() {
+ return fEvent.getFrame();
+ }
}
private class FrameDataFromMIStackFrameListInfo extends FrameData {
@@ -404,23 +432,24 @@ implements IStack, ICachingService {
}
@Override
- protected MIFrame getMIFrame() { return fFrameDataCacheInfo.getMIFrames()[fFrameIndex]; }
+ protected MIFrame getMIFrame() {
+ return fFrameDataCacheInfo.getMIFrames()[fFrameIndex];
+ }
}
@Override
- protected BundleContext getBundleContext() {
+ protected BundleContext getBundleContext() {
return GdbPlugin.getBundleContext();
}
@Override
public void initialize(final RequestMonitor rm) {
- super.initialize(
- new ImmediateRequestMonitor(rm) {
- @Override
- protected void handleSuccess() {
- doInitialize(rm);
- }
- });
+ super.initialize(new ImmediateRequestMonitor(rm) {
+ @Override
+ protected void handleSuccess() {
+ doInitialize(rm);
+ }
+ });
}
private void doInitialize(RequestMonitor rm) {
@@ -442,13 +471,12 @@ implements IStack, ICachingService {
fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
getSession().addServiceEventListener(this, null);
- register(new String[]{IStack.class.getName(), MIStack.class.getName()}, new Hashtable<String,String>());
+ register(new String[] { IStack.class.getName(), MIStack.class.getName() }, new Hashtable<String, String>());
rm.done();
}
@Override
- public void shutdown(RequestMonitor rm)
- {
+ public void shutdown(RequestMonitor rm) {
unregister();
getSession().removeServiceEventListener(this);
fMICommandCache.reset();
@@ -476,9 +504,11 @@ implements IStack, ICachingService {
}
@Override
- public void getFrames(final IDMContext ctx, final int startIndex, final int endIndex, final DataRequestMonitor<IFrameDMContext[]> rm) {
+ public void getFrames(final IDMContext ctx, final int startIndex, final int endIndex,
+ final DataRequestMonitor<IFrameDMContext[]> rm) {
if (startIndex < 0 || endIndex > 0 && endIndex < startIndex) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid stack frame range [" + startIndex + ',' + endIndex + ']', null)); //$NON-NLS-1$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE,
+ "Invalid stack frame range [" + startIndex + ',' + endIndex + ']', null)); //$NON-NLS-1$
rm.done();
return;
}
@@ -486,35 +516,35 @@ implements IStack, ICachingService {
final IMIExecutionDMContext execDmc = DMContexts.getAncestorOfType(ctx, IMIExecutionDMContext.class);
if (execDmc == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid context " + ctx, null)); //$NON-NLS-1$
+ rm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid context " + ctx, null)); //$NON-NLS-1$
rm.done();
return;
}
// Make sure the thread is stopped but only if we are not visualizing trace data
if (!fTraceVisualization && !fRunControl.isSuspended(execDmc)) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Context is running: " + ctx, null)); //$NON-NLS-1$
+ rm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Context is running: " + ctx, null)); //$NON-NLS-1$
rm.done();
return;
}
if (startIndex == 0 && endIndex == 0) {
// Try to retrieve the top stack frame from the cached stopped event.
- if (fCachedStoppedEvent != null &&
- fCachedStoppedEvent.getFrame() != null &&
- execDmc.equals(fCachedStoppedEvent.getDMContext()))
- {
- rm.setData(new IFrameDMContext[] { createFrameDMContext(execDmc, fCachedStoppedEvent.getFrame().getLevel()) });
+ if (fCachedStoppedEvent != null && fCachedStoppedEvent.getFrame() != null
+ && execDmc.equals(fCachedStoppedEvent.getDMContext())) {
+ rm.setData(new IFrameDMContext[] {
+ createFrameDMContext(execDmc, fCachedStoppedEvent.getFrame().getLevel()) });
rm.done();
return;
}
}
- String threadId = execDmc.getThreadId();
+ String threadId = execDmc.getThreadId();
// if requested stack limit is bigger then currently cached this call will return -1
final int maxDepth = endIndex > 0 ? endIndex + 1 : -1;
- int depth = fFramesCache.getThreadFramesCache(threadId).getStackDepth(
- maxDepth);
+ int depth = fFramesCache.getThreadFramesCache(threadId).getStackDepth(maxDepth);
if (depth > 0) { // our stack depth cache is good so we can use it to fill levels array
rm.setData(getDMFrames(execDmc, startIndex, endIndex, depth));
rm.done();
@@ -534,8 +564,8 @@ implements IStack, ICachingService {
});
}
- private IFrameDMContext[] getDMFrames(final IMIExecutionDMContext execDmc, int startIndex,
- int endIndex, int stackDepth) {
+ private IFrameDMContext[] getDMFrames(final IMIExecutionDMContext execDmc, int startIndex, int endIndex,
+ int stackDepth) {
if (endIndex > stackDepth - 1 || endIndex < 0) {
endIndex = stackDepth - 1;
}
@@ -575,10 +605,8 @@ implements IStack, ICachingService {
}
// Try to retrieve the top stack frame from the cached stopped event.
- if (fCachedStoppedEvent != null &&
- fCachedStoppedEvent.getFrame() != null &&
- execDmc.equals(fCachedStoppedEvent.getDMContext()))
- {
+ if (fCachedStoppedEvent != null && fCachedStoppedEvent.getFrame() != null
+ && execDmc.equals(fCachedStoppedEvent.getDMContext())) {
rm.setData(createFrameDMContext(execDmc, fCachedStoppedEvent.getFrame().getLevel()));
rm.done();
return;
@@ -586,37 +614,35 @@ implements IStack, ICachingService {
// If stopped event is not available or doesn't contain frame info,
// query top stack frame
- getFrames(
- ctx,
- 0,
- 0,
- new DataRequestMonitor<IFrameDMContext[]>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- rm.setData(getData()[0]);
- rm.done();
- }
- });
+ getFrames(ctx, 0, 0, new DataRequestMonitor<IFrameDMContext[]>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ rm.setData(getData()[0]);
+ rm.done();
+ }
+ });
}
@Override
public void getFrameData(final IFrameDMContext frameDmc, final DataRequestMonitor<IFrameDMData> rm) {
if (!(frameDmc instanceof MIFrameDMC)) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid context type " + frameDmc, null)); //$NON-NLS-1$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE,
+ "Invalid context type " + frameDmc, null)); //$NON-NLS-1$
rm.done();
return;
}
- final MIFrameDMC miFrameDmc = (MIFrameDMC)frameDmc;
+ final MIFrameDMC miFrameDmc = (MIFrameDMC) frameDmc;
final IMIExecutionDMContext execDmc = DMContexts.getAncestorOfType(frameDmc, IMIExecutionDMContext.class);
if (execDmc == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "No execution context found in " + frameDmc, null)); //$NON-NLS-1$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE,
+ "No execution context found in " + frameDmc, null)); //$NON-NLS-1$
rm.done();
return;
}
- String threadId = execDmc.getThreadId();
+ String threadId = execDmc.getThreadId();
final int frameLevel = miFrameDmc.fLevel;
FrameData fd = fFramesCache.getThreadFramesCache(threadId).getFrameData(frameLevel);
if (fd != null) {
@@ -643,8 +669,7 @@ implements IStack, ICachingService {
}
// If not, retrieve the full list of frame data.
- fMICommandCache.execute(
- createMIStackListFrames(execDmc),
+ fMICommandCache.execute(createMIStackListFrames(execDmc),
new DataRequestMonitor<MIStackListFramesInfo>(getExecutor(), rm) {
@Override
protected void handleSuccess() {
@@ -664,15 +689,15 @@ implements IStack, ICachingService {
// frames with no limits, but the same command succeeds if the request is limited
// to one frame. So try again with a limit of 1.
// It's better to show just one frame than none at all
- fMICommandCache.execute(
- createMIStackListFrames(execDmc, frameLevel, frameLevel),
+ fMICommandCache.execute(createMIStackListFrames(execDmc, frameLevel, frameLevel),
new DataRequestMonitor<MIStackListFramesInfo>(getExecutor(), rm) {
@Override
protected void handleSuccess() {
- FrameData frameData = fFramesCache.update(threadId, getData()).getFrameData(frameLevel);
+ FrameData frameData = fFramesCache.update(threadId, getData())
+ .getFrameData(frameLevel);
if (frameData == null) {
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
- INVALID_HANDLE, "Invalid frame " + frameDmc, null)); //$NON-NLS-1$
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE,
+ "Invalid frame " + frameDmc, null)); //$NON-NLS-1$
} else {
rm.done(frameData);
}
@@ -686,22 +711,19 @@ implements IStack, ICachingService {
public void getArguments(final IFrameDMContext frameDmc, final DataRequestMonitor<IVariableDMContext[]> rm) {
final IMIExecutionDMContext execDmc = DMContexts.getAncestorOfType(frameDmc, IMIExecutionDMContext.class);
if (execDmc == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "No execution context found in " + frameDmc, null)); //$NON-NLS-1$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE,
+ "No execution context found in " + frameDmc, null)); //$NON-NLS-1$
rm.done();
return;
}
-
// If requested frame is the top stack frame, try to retrieve it from
// the stopped event data.
- if (frameDmc.getLevel() == 0 &&
- fCachedStoppedEvent != null &&
- fCachedStoppedEvent.getFrame() != null &&
- execDmc.equals(fCachedStoppedEvent.getDMContext()) &&
- fCachedStoppedEvent.getFrame().getArgs() != null)
- {
- rm.setData(makeVariableDMCs(
- frameDmc, MIVariableDMC.Type.ARGUMENT, fCachedStoppedEvent.getFrame().getArgs()));
+ if (frameDmc.getLevel() == 0 && fCachedStoppedEvent != null && fCachedStoppedEvent.getFrame() != null
+ && execDmc.equals(fCachedStoppedEvent.getDMContext())
+ && fCachedStoppedEvent.getFrame().getArgs() != null) {
+ rm.setData(
+ makeVariableDMCs(frameDmc, MIVariableDMC.Type.ARGUMENT, fCachedStoppedEvent.getFrame().getArgs()));
rm.done();
return;
}
@@ -724,7 +746,8 @@ implements IStack, ICachingService {
// partial lists of stack frames.
int idx = frameDmc.getLevel();
if (idx == -1 || idx >= getData().getMIFrames().length) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid frame " + frameDmc, null)); //$NON-NLS-1$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE,
+ "Invalid frame " + frameDmc, null)); //$NON-NLS-1$
rm.done();
return;
}
@@ -737,14 +760,14 @@ implements IStack, ICachingService {
rm.setData(makeVariableDMCs(frameDmc, MIVariableDMC.Type.ARGUMENT, args));
rm.done();
}
+
@Override
protected void handleError() {
// If the command fails it can be because we asked for values.
// This can happen with uninitialized values and pretty printers (bug 307614).
// Since asking for values was simply an optimization
// to store the command in the cache, let's retry the command without asking for values.
- fMICommandCache.execute(
- fCommandFactory.createMIStackListArguments(execDmc, false),
+ fMICommandCache.execute(fCommandFactory.createMIStackListArguments(execDmc, false),
new DataRequestMonitor<MIStackListArgumentsInfo>(getExecutor(), rm) {
@Override
protected void handleSuccess() {
@@ -753,7 +776,8 @@ implements IStack, ICachingService {
// partial lists of stack frames.
int idx = frameDmc.getLevel();
if (idx == -1 || idx >= getData().getMIFrames().length) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid frame " + frameDmc, null)); //$NON-NLS-1$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE,
+ "Invalid frame " + frameDmc, null)); //$NON-NLS-1$
rm.done();
return;
}
@@ -774,35 +798,37 @@ implements IStack, ICachingService {
@Override
public void getVariableData(IVariableDMContext variableDmc, final DataRequestMonitor<IVariableDMData> rm) {
if (!(variableDmc instanceof MIVariableDMC)) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid context type " + variableDmc, null)); //$NON-NLS-1$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE,
+ "Invalid context type " + variableDmc, null)); //$NON-NLS-1$
rm.done();
return;
}
- final MIVariableDMC miVariableDmc = (MIVariableDMC)variableDmc;
+ final MIVariableDMC miVariableDmc = (MIVariableDMC) variableDmc;
// Extract the frame DMC from the variable DMC.
final MIFrameDMC frameDmc = DMContexts.getAncestorOfType(variableDmc, MIFrameDMC.class);
if (frameDmc == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "No frame context found in " + variableDmc, null)); //$NON-NLS-1$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE,
+ "No frame context found in " + variableDmc, null)); //$NON-NLS-1$
rm.done();
return;
}
final IMIExecutionDMContext execDmc = DMContexts.getAncestorOfType(frameDmc, IMIExecutionDMContext.class);
if (execDmc == null) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "No execution context found in " + frameDmc, null)); //$NON-NLS-1$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE,
+ "No execution context found in " + frameDmc, null)); //$NON-NLS-1$
rm.done();
return;
}
// Check if the stopped event can be used to extract the variable value.
- if (miVariableDmc.fType == MIVariableDMC.Type.ARGUMENT &&
- frameDmc.fLevel == 0 && fCachedStoppedEvent != null && fCachedStoppedEvent.getFrame() != null &&
- execDmc.equals(fCachedStoppedEvent.getDMContext()) &&
- fCachedStoppedEvent.getFrame().getArgs() != null)
- {
+ if (miVariableDmc.fType == MIVariableDMC.Type.ARGUMENT && frameDmc.fLevel == 0 && fCachedStoppedEvent != null
+ && fCachedStoppedEvent.getFrame() != null && execDmc.equals(fCachedStoppedEvent.getDMContext())
+ && fCachedStoppedEvent.getFrame().getArgs() != null) {
if (miVariableDmc.fIndex >= fCachedStoppedEvent.getFrame().getArgs().length) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, "Invalid variable " + miVariableDmc, null)); //$NON-NLS-1$
+ rm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, "Invalid variable " + miVariableDmc, null)); //$NON-NLS-1$
rm.done();
return;
}
@@ -812,7 +838,7 @@ implements IStack, ICachingService {
return;
}
- if (miVariableDmc.fType == MIVariableDMC.Type.ARGUMENT){
+ if (miVariableDmc.fType == MIVariableDMC.Type.ARGUMENT) {
fMICommandCache.execute(
// Don't ask for value when we are visualizing trace data, since some
// data will not be there, and the command will fail
@@ -821,44 +847,48 @@ implements IStack, ICachingService {
@Override
protected void handleSuccess() {
// Find the correct frame and argument
- if ( frameDmc.fLevel >= getData().getMIFrames().length ||
- miVariableDmc.fIndex >= getData().getMIFrames()[frameDmc.fLevel].getArgs().length )
- {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid variable " + miVariableDmc, null)); //$NON-NLS-1$
+ if (frameDmc.fLevel >= getData().getMIFrames().length
+ || miVariableDmc.fIndex >= getData().getMIFrames()[frameDmc.fLevel]
+ .getArgs().length) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE,
+ "Invalid variable " + miVariableDmc, null)); //$NON-NLS-1$
rm.done();
return;
}
// Create the data object.
- rm.setData(new VariableData(getData().getMIFrames()[frameDmc.fLevel].getArgs()[miVariableDmc.fIndex]));
+ rm.setData(new VariableData(
+ getData().getMIFrames()[frameDmc.fLevel].getArgs()[miVariableDmc.fIndex]));
rm.done();
}
+
@Override
protected void handleError() {
// Unable to get the values. This can happen with uninitialized values and pretty printers (bug 307614)
// Let's try to ask for the arguments without their values, which is better than nothing
- fMICommandCache.execute(
- fCommandFactory.createMIStackListArguments(execDmc, false),
+ fMICommandCache.execute(fCommandFactory.createMIStackListArguments(execDmc, false),
new DataRequestMonitor<MIStackListArgumentsInfo>(getExecutor(), rm) {
@Override
protected void handleSuccess() {
// Find the correct frame and argument
- if ( frameDmc.fLevel >= getData().getMIFrames().length ||
- miVariableDmc.fIndex >= getData().getMIFrames()[frameDmc.fLevel].getArgs().length )
- {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid variable " + miVariableDmc, null)); //$NON-NLS-1$
+ if (frameDmc.fLevel >= getData().getMIFrames().length
+ || miVariableDmc.fIndex >= getData().getMIFrames()[frameDmc.fLevel]
+ .getArgs().length) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
+ INVALID_HANDLE, "Invalid variable " + miVariableDmc, null)); //$NON-NLS-1$
rm.done();
return;
}
// Create the data object.
- rm.setData(new VariableData(getData().getMIFrames()[frameDmc.fLevel].getArgs()[miVariableDmc.fIndex]));
+ rm.setData(new VariableData(getData().getMIFrames()[frameDmc.fLevel]
+ .getArgs()[miVariableDmc.fIndex]));
rm.done();
}
});
}
});
- } else if (miVariableDmc.fType == MIVariableDMC.Type.LOCAL){
+ } else if (miVariableDmc.fType == MIVariableDMC.Type.LOCAL) {
fMICommandCache.execute(
// Don't ask for value when we are visualizing trace data, since some
// data will not be there, and the command will fail
@@ -871,16 +901,17 @@ implements IStack, ICachingService {
if (locals.length > miVariableDmc.fIndex) {
rm.setData(new VariableData(locals[miVariableDmc.fIndex]));
} else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid variable " + miVariableDmc, null)); //$NON-NLS-1$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE,
+ "Invalid variable " + miVariableDmc, null)); //$NON-NLS-1$
}
rm.done();
}
+
@Override
protected void handleError() {
// Unable to get the value. This can happen with uninitialized values and pretty printers (bug 307614).
// Let's try to ask for the variables without their values, which is better than nothing
- fMICommandCache.execute(
- fCommandFactory.createMIStackListLocals(frameDmc, false),
+ fMICommandCache.execute(fCommandFactory.createMIStackListLocals(frameDmc, false),
new DataRequestMonitor<MIStackListLocalsInfo>(getExecutor(), rm) {
@Override
protected void handleSuccess() {
@@ -889,7 +920,8 @@ implements IStack, ICachingService {
if (locals.length > miVariableDmc.fIndex) {
rm.setData(new VariableData(locals[miVariableDmc.fIndex]));
} else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid variable " + miVariableDmc, null)); //$NON-NLS-1$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
+ INVALID_HANDLE, "Invalid variable " + miVariableDmc, null)); //$NON-NLS-1$
}
rm.done();
}
@@ -901,11 +933,13 @@ implements IStack, ICachingService {
if (var != null) {
rm.setData(var);
} else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Return value not found", null)); //$NON-NLS-1$
+ rm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Return value not found", null)); //$NON-NLS-1$
}
rm.done();
} else {
- rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid variable type " + miVariableDmc.fType, null)); //$NON-NLS-1$
+ rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE,
+ "Invalid variable type " + miVariableDmc.fType, null)); //$NON-NLS-1$
}
}
@@ -955,33 +989,29 @@ implements IStack, ICachingService {
final CountingRequestMonitor countingRm = new CountingRequestMonitor(getExecutor(), rm) {
@Override
protected void handleSuccess() {
- rm.setData( localsList.toArray(new IVariableDMContext[localsList.size()]) );
+ rm.setData(localsList.toArray(new IVariableDMContext[localsList.size()]));
rm.done();
}
};
countingRm.setDoneCount(3);
// First show any return values of methods
- getReturnValues(
- frameDmc,
- new DataRequestMonitor<IVariableDMContext[]>(getExecutor(), countingRm) {
- @Override
- protected void handleSuccess() {
- localsList.addAll( Arrays.asList(getData()) );
- countingRm.done();
- }
- });
+ getReturnValues(frameDmc, new DataRequestMonitor<IVariableDMContext[]>(getExecutor(), countingRm) {
+ @Override
+ protected void handleSuccess() {
+ localsList.addAll(Arrays.asList(getData()));
+ countingRm.done();
+ }
+ });
// Then show arguments
- getArguments(
- frameDmc,
- new DataRequestMonitor<IVariableDMContext[]>(getExecutor(), countingRm) {
- @Override
- protected void handleSuccess() {
- localsList.addAll( Arrays.asList(getData()) );
- countingRm.done();
- }
- });
+ getArguments(frameDmc, new DataRequestMonitor<IVariableDMContext[]>(getExecutor(), countingRm) {
+ @Override
+ protected void handleSuccess() {
+ localsList.addAll(Arrays.asList(getData()));
+ countingRm.done();
+ }
+ });
// Finally get the local variables
fMICommandCache.execute(
@@ -995,23 +1025,23 @@ implements IStack, ICachingService {
new DataRequestMonitor<MIStackListLocalsInfo>(getExecutor(), countingRm) {
@Override
protected void handleSuccess() {
- localsList.addAll( Arrays.asList(
- makeVariableDMCs(frameDmc, MIVariableDMC.Type.LOCAL, getData().getLocals())) );
+ localsList.addAll(Arrays
+ .asList(makeVariableDMCs(frameDmc, MIVariableDMC.Type.LOCAL, getData().getLocals())));
countingRm.done();
}
+
@Override
protected void handleError() {
// If the command fails it can be because we asked for values.
// This can happen with uninitialized values and pretty printers (bug 307614).
// Since asking for values was simply an optimization
// to store the command in the cache, let's retry the command without asking for values.
- fMICommandCache.execute(
- fCommandFactory.createMIStackListLocals(frameDmc, false),
+ fMICommandCache.execute(fCommandFactory.createMIStackListLocals(frameDmc, false),
new DataRequestMonitor<MIStackListLocalsInfo>(getExecutor(), countingRm) {
@Override
protected void handleSuccess() {
- localsList.addAll( Arrays.asList(
- makeVariableDMCs(frameDmc, MIVariableDMC.Type.LOCAL, getData().getLocals())) );
+ localsList.addAll(Arrays.asList(makeVariableDMCs(frameDmc,
+ MIVariableDMC.Type.LOCAL, getData().getLocals())));
countingRm.done();
}
});
@@ -1030,7 +1060,7 @@ implements IStack, ICachingService {
return;
}
- String threadId = execDmc.getThreadId();
+ String threadId = execDmc.getThreadId();
// Check our internal cache first because different commands can
// still be re-used.
int depth = fFramesCache.getThreadFramesCache(threadId).getStackDepth(maxDepth);
@@ -1047,36 +1077,35 @@ implements IStack, ICachingService {
depthCommand = fCommandFactory.createMIStackInfoDepth(execDmc);
}
- fMICommandCache.execute(
- depthCommand,
- new DataRequestMonitor<MIStackInfoDepthInfo>(getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- // Store result in our internal cache
- int stackDepth = getData().getDepth();
- fFramesCache.update(threadId, stackDepth, maxDepth);
- rm.setData(stackDepth);
- rm.done();
- }
- @Override
- protected void handleError() {
- if (fTraceVisualization) {
- // when visualizing trace data with GDB 7.2, the command
- // -stack-info-depth will return an error if we ask for any level
- // that GDB does not know about. We would have to iteratively
- // try different depths until we found the deepest that succeeds.
- // That is too much of a hack, especially since GDB 7.3 answers correctly.
- // For 7.2, we can safely say we have one stack
- // frame, which is going to be the case for 95% of the cases.
- // To have more stack frames, the user would have to have collected
- // the registers and enough stack memory for GDB to build another frame.
- rm.setData(1);
- rm.done();
- } else {
- // gdb fails when being asked for the stack depth but stack frames command succeeds
- // it seems like an overkill but it will cached and ui later will ask for it anyway
- fMICommandCache.execute(createMIStackListFrames(execDmc, 0, maxDepth - 1),
- new DataRequestMonitor<MIStackListFramesInfo>(getExecutor(), rm) {
+ fMICommandCache.execute(depthCommand, new DataRequestMonitor<MIStackInfoDepthInfo>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ // Store result in our internal cache
+ int stackDepth = getData().getDepth();
+ fFramesCache.update(threadId, stackDepth, maxDepth);
+ rm.setData(stackDepth);
+ rm.done();
+ }
+
+ @Override
+ protected void handleError() {
+ if (fTraceVisualization) {
+ // when visualizing trace data with GDB 7.2, the command
+ // -stack-info-depth will return an error if we ask for any level
+ // that GDB does not know about. We would have to iteratively
+ // try different depths until we found the deepest that succeeds.
+ // That is too much of a hack, especially since GDB 7.3 answers correctly.
+ // For 7.2, we can safely say we have one stack
+ // frame, which is going to be the case for 95% of the cases.
+ // To have more stack frames, the user would have to have collected
+ // the registers and enough stack memory for GDB to build another frame.
+ rm.setData(1);
+ rm.done();
+ } else {
+ // gdb fails when being asked for the stack depth but stack frames command succeeds
+ // it seems like an overkill but it will cached and ui later will ask for it anyway
+ fMICommandCache.execute(createMIStackListFrames(execDmc, 0, maxDepth - 1),
+ new DataRequestMonitor<MIStackListFramesInfo>(getExecutor(), rm) {
@Override
protected void handleSuccess() {
FramesCacheInfo info = fFramesCache.update(threadId, getData());
@@ -1093,9 +1122,9 @@ implements IStack, ICachingService {
rm.done(fFramesCache.getThreadFramesCache(threadId).getValidStackDepth());
};
});
- }
- }
- });
+ }
+ }
+ });
} else {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid context", null)); //$NON-NLS-1$
rm.done();
@@ -1159,7 +1188,7 @@ implements IStack, ICachingService {
// This avoids a race conditions where the actual MIFunctionFinishedEvent
// can arrive here, faster that a preceding IResumedDMEvent
if (e instanceof IMIDMEvent) {
- Object miEvent = ((IMIDMEvent)e).getMIEvent();
+ Object miEvent = ((IMIDMEvent) e).getMIEvent();
if (miEvent instanceof MIFunctionFinishedEvent) {
// When returning out of a function, we want to show the return value
// for the thread that finished the call. To do that, we store
@@ -1169,21 +1198,21 @@ implements IStack, ICachingService {
IMIExecutionDMContext finishedEventThread = null;
if (e instanceof IContainerSuspendedDMEvent) {
// All-stop mode
- IExecutionDMContext[] triggerContexts = ((IContainerSuspendedDMEvent)e).getTriggeringContexts();
+ IExecutionDMContext[] triggerContexts = ((IContainerSuspendedDMEvent) e).getTriggeringContexts();
if (triggerContexts.length != 0 && triggerContexts[0] instanceof IMIExecutionDMContext) {
- finishedEventThread = (IMIExecutionDMContext)triggerContexts[0];
+ finishedEventThread = (IMIExecutionDMContext) triggerContexts[0];
}
} else {
// Non-stop mode
IDMContext ctx = e.getDMContext();
if (ctx instanceof IMIExecutionDMContext) {
- finishedEventThread = (IMIExecutionDMContext)ctx;
+ finishedEventThread = (IMIExecutionDMContext) ctx;
}
}
if (finishedEventThread != null) {
- String name = ((MIFunctionFinishedEvent)miEvent).getGDBResultVar();
- String value = ((MIFunctionFinishedEvent)miEvent).getReturnValue();
+ String name = ((MIFunctionFinishedEvent) miEvent).getGDBResultVar();
+ String value = ((MIFunctionFinishedEvent) miEvent).getReturnValue();
if (name != null && !name.isEmpty() && value != null && !value.isEmpty()) {
fThreadToReturnVariable.put(finishedEventThread, new VariableData(new MIArg(name, value)));
@@ -1201,7 +1230,7 @@ implements IStack, ICachingService {
@DsfServiceEventHandler
public void eventDispatched(IMIDMEvent e) {
if (e.getMIEvent() instanceof MIStoppedEvent) {
- fCachedStoppedEvent = (MIStoppedEvent)e.getMIEvent();
+ fCachedStoppedEvent = (MIStoppedEvent) e.getMIEvent();
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIVariableManager.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIVariableManager.java
index a86e575136d..cc5f756b122 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIVariableManager.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIVariableManager.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Monta Vista - initial API and implementation
* Ericsson - Modified for handling of multiple execution contexts
@@ -99,25 +99,25 @@ import org.eclipse.core.runtime.Status;
/**
* Manages a list of variable objects as created through GDB/MI commands.
- *
+ *
* This class is passed expression-meta-commands which have their own cache.
* Therefore, we don't use the standard MICommandCache in this class.
* In fact, we can't even use it, because many variableObject MI commands,
* should not be cached as they alter the state of the back-end.
- *
+ *
* Design details:
* ==============
- *
+ *
* GDB variable object information
* -------------------------------
- * o Variable objects are recursively hierarchical, where children can be created through
+ * o Variable objects are recursively hierarchical, where children can be created through
* the parent.
* o A varObject created with -var-create is a ROOT
* o A varObject created with -var-list-children, is not a root
- * o Only varObject with no children or varObjects that are pointers can change values
- * and therefore
+ * o Only varObject with no children or varObjects that are pointers can change values
+ * and therefore
* those objects can be used with -var-assign
- * o After a program stops, a varObject must be 'updated' before used
+ * o After a program stops, a varObject must be 'updated' before used
* o Only root varObject can be updated with -var-update, which will trigger all
* of the root's descendants to be updated.
* o Once updated, a varObject need not be updated until the program resumes again;
@@ -130,44 +130,44 @@ import org.eclipse.core.runtime.Status;
* expression as the out-of-scope varObject
* o deleting a varObject will delete all its descendants, therefore, it is only
* necessary to delete roots
- *
- *
+ *
+ *
* Class details
* -------------
* - We have an MIVariableObject class which represents a variable object in GDB
- *
+ *
* - MIVariableObject includes a buffered value for each allowed format.
- *
+ *
* - We have an MIRootVariableObject class inheriting from MIVariableObject to describe
* root varObjects created with -var-create. Objects created with -var-list-children
- * are MIVariableObjects only. The root class will keep track of if the root object
- * needs to be updated, if the root object is out-of-scope, and of a list of all
- * modifiable descendants of this root. The list of modifiable descendants is
- * accessed using the gdb-given name to allow quick updates from the -var-update
+ * are MIVariableObjects only. The root class will keep track of if the root object
+ * needs to be updated, if the root object is out-of-scope, and of a list of all
+ * modifiable descendants of this root. The list of modifiable descendants is
+ * accessed using the gdb-given name to allow quick updates from the -var-update
* result (see below.)
- *
+ *
* - we do not use -var-list-children for arrays, but create them manually
- *
- * - when the program stops, we should mark all roots as needing to be updated.
+ *
+ * - when the program stops, we should mark all roots as needing to be updated.
* To achieve this efficiently, we have a dedicated list of roots that are updated.
* When the program stops, we go through this list, remove each element and mark it
* as needing to be updated.
- *
+ *
* - when a varObject is accessed, if its root must be updated, the var-update
* command shall be used. The result of that command will indicate all
* modifiable descendants that have changed. We also use --all-values with -var-update
* to get the new value (in the current format) for each modified descendant. Using the list of modifiable
* descendants of the root, we can quickly update the changed ones to invalidate their buffered
* values and store the new current format value.
- *
+ *
* - all values of non-modifiable varObjects (except arrays) will be set to {...}
* without going to the back-end
- *
+ *
* - requesting the value of an array varObject will trigger the creation of a new
* varObject for the array's address. Note that we must still use a variable
* object and not the command -data-evaluate-expression, because we still need to get
* the array address in multiple formats.
- *
+ *
* - we keep an LRU (Least Recently Used) structure of all variable objects. This LRU
* will be bounded to a maximum allowed number of variable objects. Whenever we get an
* object from the LRU cleanup will be done if the maximum size has been reached.
@@ -182,7 +182,7 @@ import org.eclipse.core.runtime.Status;
* its root is out-of-scope) the following should be done:
* - replace the varObject in the LRU with a newly created one in GDB
* - if the old object was a root, delete it in GDB.
- *
+ *
* - In GDB, -var-update will only report a change if -var-evaluate-expression has
* changed -- in the current format--. This means that situations like
* double z = 1.2;
@@ -200,19 +200,19 @@ import org.eclipse.core.runtime.Status;
* Note that versions of GDB after 6.7 will allows to issue -var-evaluate-expression
* with a specified format, therefore allowing us to never use -var-set-format, and
* consequently, to easily keep the display format of all variable objects to natural.
- *
+ *
* Notes on Dynamic Variable Objects (varobj)
* ------------------------------------------
* - with version 7.0, gdb support so-called pretty printers.
- *
+ *
* - pretty printers are registered for certain types
- *
+ *
* - if there is a pretty printer registered for the type of a variable,
* the pretty printer provides the value and the children of that variable
- *
+ *
* - a varobj whose value and/or children are provided by a pretty printer,
* are referred to as dynamic variable objects
- *
+ *
* - dynamic varobjs change the game: it's not wise to ask it about all its
* children, not even the number of children it has. The reason is that
* in order to find out about the number of children the pretty printer
@@ -220,17 +220,17 @@ import org.eclipse.core.runtime.Status;
* is not yet initialized, the set of children are random, and thus might
* be huge. Even worse, there are data structures where fetching all
* children may result in an endless loop. The Eclipse debugger then hangs.
- *
+ *
* - In order to avoid this, we will always fetch up to a certain maximum
* number of children. Furthermore, it is possible to find out whether there
* are more children available. In the UI, all the currently fetched
* children are available. In addition, if there are more children
* available, a special node will be appended to indicate that there is
* more the user could fetch.
- *
+ *
* - Dynamic varobjs can change their value, as leaf varobjs can do.
* Especially, children can be added or removed during an update.
- *
+ *
* - There is no expression for children of dynamic varobjs (at least not
* yet, http://sourceware.org/bugzilla/show_bug.cgi?id=10252 would fix that).
* The reason -var-info-path-expression returns garbage for children of
@@ -242,7 +242,7 @@ import org.eclipse.core.runtime.Status;
* within this parent for each non-root variable, and later use
* -var-list-children parent indexInParent (indexInParent + 1)
* in order to create the MI variable anew.
- *
+ *
* - The fetching of children for dynamic varobjs becomes a bit more complicated.
* For the traditional varobjs, once children where requested, all children
* were fetched. For dynamic varobjs, we can no longer fetch all children.
@@ -260,13 +260,13 @@ public class MIVariableManager implements ICommandControl {
/**
* Stores the information about children of a variable object.
- *
+ *
* @since 4.0
*/
protected static class ChildrenInfo {
private final ExpressionInfo[] children;
private final boolean hasMore;
-
+
public ChildrenInfo(ExpressionInfo[] children, boolean hasMore) {
this.children = children;
this.hasMore = hasMore;
@@ -279,7 +279,7 @@ public class MIVariableManager implements ICommandControl {
public ExpressionInfo[] getChildren() {
return children;
}
-
+
/**
* @return true, if there are more than just those returned by
* {@link #getChildren()}.
@@ -288,16 +288,16 @@ public class MIVariableManager implements ICommandControl {
return hasMore;
}
}
-
+
/**
* Stores the information about the children count of a variable object.
- *
+ *
* @since 4.0
*/
protected static class ChildrenCountInfo {
private final int childrenCount;
private final boolean hasMore;
-
+
public ChildrenCountInfo(int childrenCount, boolean hasMore) {
this.childrenCount = childrenCount;
this.hasMore = hasMore;
@@ -320,7 +320,7 @@ public class MIVariableManager implements ICommandControl {
return hasMore;
}
}
-
+
/**
* Utility class to track the progress and information of MI variable objects
*/
@@ -335,23 +335,23 @@ public class MIVariableManager implements ICommandControl {
protected static final int STATE_CREATING = 11;
/** @since 4.0 */
protected static final int STATE_CREATION_FAILED = 12;
-
- protected int currentState;
+
+ protected int currentState;
// This is the lock used when we must run multiple
// operations at once. This lock should be independent of the
// UPDATING state, which is why we don't make it part of the state
private boolean fLocked = false;
-
- // This id is the one used to search for this object in our hash-map
- private final VariableObjectId fInternalId;
- /** The raw MI value for this variable object
+ // This id is the one used to search for this object in our hash-map
+ private final VariableObjectId fInternalId;
+
+ /** The raw MI value for this variable object
* @since 4.6
*/
- private MITuple fRaw;
+ private MITuple fRaw;
- // This is the name of the variable object, as given by GDB (e.g., var1 or var1.public.x)
+ // This is the name of the variable object, as given by GDB (e.g., var1 or var1.public.x)
private String fGdbName = null;
// The current format of this variable object, within GDB
private String fFormat = IFormattedValues.NATURAL_FORMAT;
@@ -370,37 +370,37 @@ public class MIVariableManager implements ICommandControl {
// The current values of the expression for each format. (null if not known yet)
private Map<String, String> fValueMap = null;
-
+
// A queue of request monitors waiting for this object to be ready
private LinkedList<RequestMonitor> fOperationsPending;
-
+
// A queue of request monitors that requested an update
protected LinkedList<DataRequestMonitor<Boolean>> updatesPending;
-
+
/** @since 4.0 */
protected LinkedList<DataRequestMonitor<ChildrenInfo>> fetchChildrenPending;
- // The children of this variable, if any.
+ // The children of this variable, if any.
// Null means we didn't fetch them yet, while an empty array means no children
- private ExpressionInfo[] fChildren = null;
- // we need to keep track of fake children because they are in the LRU and need to be removed in some cases.
- private List<ExpressionInfo> fFakeChildren = new ArrayList<>(3);
+ private ExpressionInfo[] fChildren = null;
+ // we need to keep track of fake children because they are in the LRU and need to be removed in some cases.
+ private List<ExpressionInfo> fFakeChildren = new ArrayList<>(3);
private boolean fHasMore = false;
private MIDisplayHint fDisplayHint = MIDisplayHint.NONE;
-
- // The parent of this variable object within GDB. Null if this object has no parent
- private MIVariableObject fParent = null;
-
- // The root parent that must be used to issue -var-update.
- // If this object is a root, then the rootToUpdate is itself
- private MIRootVariableObject fRootToUpdate = null;
-
+
+ // The parent of this variable object within GDB. Null if this object has no parent
+ private MIVariableObject fParent = null;
+
+ // The root parent that must be used to issue -var-update.
+ // If this object is a root, then the rootToUpdate is itself
+ private MIRootVariableObject fRootToUpdate = null;
+
protected boolean outOfScope = false;
-
+
private boolean fFetchingChildren = false;
-
- /**
- * In case of base class variables that are accessed in a derived class
+
+ /**
+ * In case of base class variables that are accessed in a derived class
* we cannot trust var-info-path-expression because of a bug in gdb.
* We have to use a workaround and apply it to the complete hierarchy of this varObject.
* Bug 320277
@@ -410,24 +410,23 @@ public class MIVariableManager implements ICommandControl {
public MIVariableObject(VariableObjectId id, MIVariableObject parentObj) {
this(id, parentObj, false);
}
-
+
/** @since 4.0 */
- public MIVariableObject(VariableObjectId id, MIVariableObject parentObj,
- boolean needsCreation) {
- currentState = needsCreation ? STATE_NOT_CREATED : STATE_READY;
-
+ public MIVariableObject(VariableObjectId id, MIVariableObject parentObj, boolean needsCreation) {
+ currentState = needsCreation ? STATE_NOT_CREATED : STATE_READY;
+
fOperationsPending = new LinkedList<>();
updatesPending = new LinkedList<>();
fetchChildrenPending = new LinkedList<>();
-
+
fInternalId = id;
setParent(parentObj);
-
+
// No values are available yet
fValueMap = new HashMap<>();
resetValues();
}
-
+
/** Return the raw fields reported via MI.
*
* This method can be used to obtain information from debugger that
@@ -435,77 +434,114 @@ public class MIVariableManager implements ICommandControl {
* be represented as fields or methods in this class.
* @since 4.7
*/
- public MITuple getRawFields() { return fRaw; }
-
- public VariableObjectId getInternalId() { return fInternalId; }
- public String getGdbName() { return fGdbName; }
- public String getCurrentFormat() { return fFormat; }
- public MIVariableObject getParent() { return fParent; }
- public MIRootVariableObject getRootToUpdate() { return fRootToUpdate; }
-
- public String getExpression() { return fExprInfo.getFullExpr(); }
- public String getType() { return fType; }
-
+ public MITuple getRawFields() {
+ return fRaw;
+ }
+
+ public VariableObjectId getInternalId() {
+ return fInternalId;
+ }
+
+ public String getGdbName() {
+ return fGdbName;
+ }
+
+ public String getCurrentFormat() {
+ return fFormat;
+ }
+
+ public MIVariableObject getParent() {
+ return fParent;
+ }
+
+ public MIRootVariableObject getRootToUpdate() {
+ return fRootToUpdate;
+ }
+
+ public String getExpression() {
+ return fExprInfo.getFullExpr();
+ }
+
+ public String getType() {
+ return fType;
+ }
+
/**
* @since 4.0
*/
- public ExpressionInfo getExpressionInfo() { return fExprInfo; }
+ public ExpressionInfo getExpressionInfo() {
+ return fExprInfo;
+ }
/**
* @return <code>true</code> if value and children of this varobj are
* currently provided by a pretty printer.
- *
+ *
* @since 4.0
*/
- public boolean isDynamic() { return fExprInfo.isDynamic(); }
-
+ public boolean isDynamic() {
+ return fExprInfo.isDynamic();
+ }
+
/**
* @return For dynamic varobjs ({@link #isDynamic() returns true}) this
* method returns whether there are children in addition to the
* currently fetched, i.e. whether there are more children than
* {@link #getNumChildrenHint()} returns.
- *
+ *
* @since 4.0
*/
- public boolean hasMore() { return fHasMore; }
+ public boolean hasMore() {
+ return fHasMore;
+ }
/**
* @since 4.0
*/
- public MIDisplayHint getDisplayHint() { return fDisplayHint; };
-
+ public MIDisplayHint getDisplayHint() {
+ return fDisplayHint;
+ };
+
/**
* @since 4.3
*/
public void setDisplayHint(MIDisplayHint displayHint) {
this.fDisplayHint = displayHint;
};
-
+
/**
* @since 4.0
*/
- public boolean hasChildren() { return (getNumChildrenHint() != 0 || hasMore()); }
+ public boolean hasChildren() {
+ return (getNumChildrenHint() != 0 || hasMore());
+ }
/** @since 3.0 */
- public GDBType getGDBType() { return fGdbType; }
- /**
+ public GDBType getGDBType() {
+ return fGdbType;
+ }
+
+ /**
* Returns a hint to the number of children. This hint is often correct,
* except when we are dealing with C++ complex structures where
* GDB has 'private/public/protected' as children.
- *
+ *
* Use <code>isNumChildrenHintTrustworthy()</code> to know if the
* hint can be trusted.
- *
+ *
* Note that a hint of 0 children can always be trusted, except for
* <code>{@link #fHasMore} == true</code>.
- *
+ *
* @since 3.0 */
- public int getNumChildrenHint() { return fNumChildrenHint; }
- /**
- * Returns whether the number of children hint can be
+ public int getNumChildrenHint() {
+ return fNumChildrenHint;
+ }
+
+ /**
+ * Returns whether the number of children hint can be
* trusted for this variable object.
- *
- * @since 3.0
+ *
+ * @since 3.0
*/
public boolean isNumChildrenHintTrustworthy() {
// We cannot trust the hint about the number of children when we are
@@ -518,18 +554,31 @@ public class MIVariableManager implements ICommandControl {
// -var-info-expression. Do we have to use -var-info-expression for each
// variable object, or can we do it one time only for the whole program?
// Right now, we always assume we could be using C++
- return ((getNumChildrenHint() == 0 && ! hasMore()) || isArray());
- }
-
- public String getValue(String format) { return fValueMap.get(format); }
-
- public ExpressionInfo[] getChildren() { return fChildren; }
-
- public boolean isArray() { return (getGDBType() == null) ? false : getGDBType().getType() == GDBType.ARRAY; }
- public boolean isPointer() { return (getGDBType() == null) ? false : getGDBType().getType() == GDBType.POINTER; }
- public boolean isMethod() { return (getGDBType() == null) ? false : getGDBType().getType() == GDBType.FUNCTION; }
- // A complex variable is one with children. However, it must not be a pointer since a pointer
- // does have children, but is still a 'simple' variable, as it can be modified.
+ return ((getNumChildrenHint() == 0 && !hasMore()) || isArray());
+ }
+
+ public String getValue(String format) {
+ return fValueMap.get(format);
+ }
+
+ public ExpressionInfo[] getChildren() {
+ return fChildren;
+ }
+
+ public boolean isArray() {
+ return (getGDBType() == null) ? false : getGDBType().getType() == GDBType.ARRAY;
+ }
+
+ public boolean isPointer() {
+ return (getGDBType() == null) ? false : getGDBType().getType() == GDBType.POINTER;
+ }
+
+ public boolean isMethod() {
+ return (getGDBType() == null) ? false : getGDBType().getType() == GDBType.FUNCTION;
+ }
+
+ // A complex variable is one with children. However, it must not be a pointer since a pointer
+ // does have children, but is still a 'simple' variable, as it can be modified.
// A reference can be modified too, because it can be a reference to the base class before initialization
// and after initialization it can become a reference to the derived class (if gdb shows the value type and
// children taking into account RTTI ("set print object on")).
@@ -541,15 +590,15 @@ public class MIVariableManager implements ICommandControl {
// should at least get correct results.
return false;
}
-
+
/**
* @return Whether this varobj can safely be asked for all its children.
- *
+ *
* @since 4.0
*/
public boolean isSafeToAskForAllChildren() {
GdbDisplayHint displayHint = getDisplayHint().getGdbDisplayHint();
-
+
// Here we balance usability against a slight risk of instability:
//
// Usability: if you have a class/struct-like pretty printer
@@ -565,12 +614,17 @@ public class MIVariableManager implements ICommandControl {
// for collections.
boolean isDynamicButSafe = (displayHint == GdbDisplayHint.GDB_DISPLAY_HINT_STRING)
|| (displayHint == GdbDisplayHint.GDB_DISPLAY_HINT_NONE);
-
+
return !isDynamic() || isDynamicButSafe;
}
-
- public void setGdbName(String n) { fGdbName = n; }
- public void setCurrentFormat(String f) { fFormat = f; }
+
+ public void setGdbName(String n) {
+ fGdbName = n;
+ }
+
+ public void setCurrentFormat(String f) {
+ fFormat = f;
+ }
/**
* @param info
@@ -580,7 +634,7 @@ public class MIVariableManager implements ICommandControl {
* children currently fetched by gdb.
* @param hasMore
* Whether their are more children to fetch.
- *
+ *
* @since 4.0
*/
public void setExpressionData(ExpressionInfo info, String typeName, int num, boolean hasMore) {
@@ -589,7 +643,7 @@ public class MIVariableManager implements ICommandControl {
fNumChildrenHint = num;
this.fHasMore = hasMore;
}
-
+
/**
* @since 4.1
*/
@@ -598,13 +652,15 @@ public class MIVariableManager implements ICommandControl {
fGdbType = getGDBTypeParser().parse(newTypeName);
}
- public void setValue(String format, String val) { fValueMap.put(format, val); }
-
+ public void setValue(String format, String val) {
+ fValueMap.put(format, val);
+ }
+
public void resetValues(String valueInCurrentFormat) {
resetValues();
- setValue(getCurrentFormat(), valueInCurrentFormat);
+ setValue(getCurrentFormat(), valueInCurrentFormat);
}
-
+
public void resetValues() {
fValueMap.put(IFormattedValues.NATURAL_FORMAT, null);
fValueMap.put(IFormattedValues.BINARY_FORMAT, null);
@@ -612,104 +668,103 @@ public class MIVariableManager implements ICommandControl {
fValueMap.put(IFormattedValues.OCTAL_FORMAT, null);
fValueMap.put(IFormattedValues.DECIMAL_FORMAT, null);
}
-
+
/**
* @param c
* The new children, or null in order to force fetching
* children anew.
*/
- public void setChildren(ExpressionInfo[] c) {
- fChildren = c;
- if (fChildren != null) {
- fNumChildrenHint = fChildren.length;
- }
-
- if (fChildren != null) {
- for (ExpressionInfo child : fChildren) {
- assert (child != null);
- }
- }
- }
-
- /**
- * @param newChildren
- *
- * @since 4.0
- */
- public void addChildren(ExpressionInfo[] newChildren) {
- if (fChildren == null) {
- fChildren = new ExpressionInfo[newChildren.length];
- System.arraycopy(newChildren, 0, fChildren, 0, newChildren.length);
- } else {
- ExpressionInfo[] oldChildren = fChildren;
-
- fChildren = new ExpressionInfo[fChildren.length + newChildren.length];
-
- System.arraycopy(oldChildren, 0, fChildren, 0, oldChildren.length);
- System.arraycopy(newChildren, 0, fChildren, oldChildren.length, newChildren.length);
- }
-
- fNumChildrenHint = fChildren.length;
+ public void setChildren(ExpressionInfo[] c) {
+ fChildren = c;
+ if (fChildren != null) {
+ fNumChildrenHint = fChildren.length;
+ }
+
+ if (fChildren != null) {
+ for (ExpressionInfo child : fChildren) {
+ assert (child != null);
+ }
+ }
+ }
+
+ /**
+ * @param newChildren
+ *
+ * @since 4.0
+ */
+ public void addChildren(ExpressionInfo[] newChildren) {
+ if (fChildren == null) {
+ fChildren = new ExpressionInfo[newChildren.length];
+ System.arraycopy(newChildren, 0, fChildren, 0, newChildren.length);
+ } else {
+ ExpressionInfo[] oldChildren = fChildren;
+
+ fChildren = new ExpressionInfo[fChildren.length + newChildren.length];
+
+ System.arraycopy(oldChildren, 0, fChildren, 0, oldChildren.length);
+ System.arraycopy(newChildren, 0, fChildren, oldChildren.length, newChildren.length);
+ }
+
+ fNumChildrenHint = fChildren.length;
for (ExpressionInfo child : fChildren) {
assert (child != null);
}
- }
-
- /**
- * @param newChildren
- *
- * @since 4.0
- */
- protected void addChildren(ExpressionInfo[][] newChildren) {
- int requiredSize = 0;
-
- for (ExpressionInfo[] subArray : newChildren) {
- requiredSize += subArray.length;
+ }
+
+ /**
+ * @param newChildren
+ *
+ * @since 4.0
+ */
+ protected void addChildren(ExpressionInfo[][] newChildren) {
+ int requiredSize = 0;
+
+ for (ExpressionInfo[] subArray : newChildren) {
+ requiredSize += subArray.length;
}
- ExpressionInfo[] plainChildren = new ExpressionInfo[requiredSize];
+ ExpressionInfo[] plainChildren = new ExpressionInfo[requiredSize];
- int i = 0;
- for (ExpressionInfo[] subArray : newChildren) {
- System.arraycopy(subArray, 0, plainChildren, i, subArray.length);
- i += subArray.length;
+ int i = 0;
+ for (ExpressionInfo[] subArray : newChildren) {
+ System.arraycopy(subArray, 0, plainChildren, i, subArray.length);
+ i += subArray.length;
}
-
- addChildren(plainChildren);
- }
-
- /**
- * @param newNumChildren
- *
- * @since 4.0
- */
- public void shrinkChildrenTo(int newNumChildren) {
- if (fChildren != null) {
- ExpressionInfo[] oldChildren = fChildren;
- for (int i = oldChildren.length - 1; i >= newNumChildren; --i) {
- String childFullExpression = fChildren[i].getFullExpr();
-
- VariableObjectId childId = new VariableObjectId();
- childId.generateId(childFullExpression, getInternalId());
- lruVariableList.remove(childId);
- }
-
-
- fChildren = new ExpressionInfo[newNumChildren];
- System.arraycopy(oldChildren, 0, fChildren, 0, newNumChildren);
- }
-
- fNumChildrenHint = newNumChildren;
- }
-
- /**
+
+ addChildren(plainChildren);
+ }
+
+ /**
+ * @param newNumChildren
+ *
+ * @since 4.0
+ */
+ public void shrinkChildrenTo(int newNumChildren) {
+ if (fChildren != null) {
+ ExpressionInfo[] oldChildren = fChildren;
+ for (int i = oldChildren.length - 1; i >= newNumChildren; --i) {
+ String childFullExpression = fChildren[i].getFullExpr();
+
+ VariableObjectId childId = new VariableObjectId();
+ childId.generateId(childFullExpression, getInternalId());
+ lruVariableList.remove(childId);
+ }
+
+ fChildren = new ExpressionInfo[newNumChildren];
+ System.arraycopy(oldChildren, 0, fChildren, 0, newNumChildren);
+ }
+
+ fNumChildrenHint = newNumChildren;
+ }
+
+ /**
* Removes the specified child from LRU and makes the cleanup on its
* children (if any).
- *
- * @since 4.3
+ *
+ * @since 4.3
*/
- public void cleanupChild(ExpressionInfo child) {
+ public void cleanupChild(ExpressionInfo child) {
String childFullExpression = child.getFullExpr();
VariableObjectId childId = new VariableObjectId();
childId.generateId(childFullExpression, getInternalId());
@@ -720,48 +775,47 @@ public class MIVariableManager implements ICommandControl {
// Remove children recursively
varobjOfChild.cleanupChildren();
}
- }
-
- /**
+ }
+
+ /**
* Removes all the children (real and fake) of the variable object from
* LRU cache and from variable object itself. It is used when the type
* of variable was changed.
- *
+ *
* @since 4.1
*/
- public void cleanupChildren() {
- fHasMore = false;
- if (fChildren != null) {
- for (ExpressionInfo child : fChildren) {
- cleanupChild(child);
- }
- fChildren = null;
- fNumChildrenHint = 0;
- }
- for (ExpressionInfo fakeChild : fFakeChildren) {
- cleanupChild(fakeChild);
- }
- fFakeChildren.clear();
- }
-
- public void setParent(MIVariableObject p) {
- fParent = p;
- if (p == null) {
- fRootToUpdate = (this instanceof MIRootVariableObject) ? (MIRootVariableObject) this
- : null;
- } else {
- fRootToUpdate = p.getRootToUpdate();
- }
- }
-
- public void executeWhenNotUpdating(RequestMonitor rm) {
+ public void cleanupChildren() {
+ fHasMore = false;
+ if (fChildren != null) {
+ for (ExpressionInfo child : fChildren) {
+ cleanupChild(child);
+ }
+ fChildren = null;
+ fNumChildrenHint = 0;
+ }
+ for (ExpressionInfo fakeChild : fFakeChildren) {
+ cleanupChild(fakeChild);
+ }
+ fFakeChildren.clear();
+ }
+
+ public void setParent(MIVariableObject p) {
+ fParent = p;
+ if (p == null) {
+ fRootToUpdate = (this instanceof MIRootVariableObject) ? (MIRootVariableObject) this : null;
+ } else {
+ fRootToUpdate = p.getRootToUpdate();
+ }
+ }
+
+ public void executeWhenNotUpdating(RequestMonitor rm) {
getRootToUpdate().executeWhenNotUpdating(rm);
}
private void lock() {
fLocked = true;
}
-
+
private void unlock() {
fLocked = false;
@@ -770,15 +824,17 @@ public class MIVariableManager implements ICommandControl {
}
}
- public boolean isOutOfScope() { return outOfScope; }
+ public boolean isOutOfScope() {
+ return outOfScope;
+ }
/**
* @param success
- *
+ *
* @since 4.0
*/
protected void creationCompleted(boolean success) {
- // A creation completed we must be up-to-date, so we
+ // A creation completed we must be up-to-date, so we
// can tell any pending monitors that updates are done
if (success) {
currentState = STATE_READY;
@@ -794,8 +850,8 @@ public class MIVariableManager implements ICommandControl {
// Creation failed, inform anyone waiting.
while (!updatesPending.isEmpty()) {
RequestMonitor rm = updatesPending.poll();
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_HANDLE,
- "Unable to create variable object", null)); //$NON-NLS-1$
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_HANDLE,
+ "Unable to create variable object", null)); //$NON-NLS-1$
rm.done();
}
}
@@ -806,7 +862,7 @@ public class MIVariableManager implements ICommandControl {
* Updating a variable object is done by updating its root.
*/
public void update(final DataRequestMonitor<Boolean> rm) {
-
+
// We check to see if we are already out-of-scope
// We must do this to avoid the risk of re-creating this object
// twice, due to race conditions
@@ -817,20 +873,20 @@ public class MIVariableManager implements ICommandControl {
// If we were already updating, we just queue the request monitor
// until the on-going update finishes.
updatesPending.add(rm);
- } else {
+ } else {
currentState = STATE_UPDATING;
getRootToUpdate().update(new DataRequestMonitor<Boolean>(fSession.getExecutor(), rm) {
@Override
protected void handleCompleted() {
currentState = STATE_READY;
-
+
if (isSuccess()) {
outOfScope = getRootToUpdate().isOutOfScope();
// This request monitor is the one that should re-create
- // the variable object if the old one was out-of-scope
+ // the variable object if the old one was out-of-scope
rm.setData(outOfScope);
rm.done();
-
+
// All the other request monitors must be notified but must
// not re-create the object, even if it is out-of-scope
while (!updatesPending.isEmpty()) {
@@ -846,20 +902,20 @@ public class MIVariableManager implements ICommandControl {
DataRequestMonitor<Boolean> pendingRm = updatesPending.poll();
pendingRm.setStatus(getStatus());
pendingRm.done();
- }
+ }
}
}
});
}
}
-
+
/**
- * Process an update on this variable object.
- *
- * @param update What has changed.
- *
- * @since 4.0
- */
+ * Process an update on this variable object.
+ *
+ * @param update What has changed.
+ *
+ * @since 4.0
+ */
protected void processChange(final MIVarChange update, final RequestMonitor rm) {
// Handle the variable type change properly
@@ -869,27 +925,28 @@ public class MIVariableManager implements ICommandControl {
fEditable = null;
updateLimit(IMIExpressions.CHILD_COUNT_LIMIT_UNSPECIFIED);
}
-
- // These properties of the variable will probably not change,
- // but if they are - we should handle it properly.
+
+ // These properties of the variable will probably not change,
+ // but if they are - we should handle it properly.
setDisplayHint(update.getDisplayHint());
fExprInfo.setDynamic(update.isDynamic());
-
+
MIVar[] newChildren = update.getNewChildren();
// children == null means fetchChildren will happen later, so
// don't try to create a sparsely filled children array here.
final boolean addNewChildren = (fChildren != null);
- final ExpressionInfo[] addedChildren = (addNewChildren && (newChildren != null)) ? new ExpressionInfo[newChildren.length]
+ final ExpressionInfo[] addedChildren = (addNewChildren && (newChildren != null))
+ ? new ExpressionInfo[newChildren.length]
: null;
final CountingRequestMonitor countingRm = new CountingRequestMonitor(fSession.getExecutor(), rm) {
@Override
protected void handleCompleted() {
-
- if (! isSuccess()) {
+
+ if (!isSuccess()) {
rm.setStatus(getStatus());
} else {
if (update.numChildrenChanged()) {
@@ -908,8 +965,8 @@ public class MIVariableManager implements ICommandControl {
addChildren(addedChildren);
}
}
-
- assert((fChildren == null) || (fChildren.length == fNumChildrenHint));
+
+ assert ((fChildren == null) || (fChildren.length == fNumChildrenHint));
fHasMore = update.hasMore();
@@ -919,7 +976,7 @@ public class MIVariableManager implements ICommandControl {
// are requested, they will be fetched.
if (hasMore() && (fNumChildrenHint == 0)) {
setChildren(null);
- }
+ }
resetValues(update.getValue());
}
@@ -931,7 +988,7 @@ public class MIVariableManager implements ICommandControl {
int pendingVariableCreationCount = 0;
if (newChildren != null && newChildren.length != 0) {
int i = update.getNewNumChildren() - newChildren.length;
- int arrayPosition = 0;
+ int arrayPosition = 0;
for (final MIVar newChild : newChildren) {
@@ -941,9 +998,8 @@ public class MIVariableManager implements ICommandControl {
// be added during the update, if we are a child of a
// dynamic varobj, and in this case -var-info-path-expression
// won't work.
- final String childFullExpression = buildChildExpression(
- getExpression(), newChild.getExp());
-
+ final String childFullExpression = buildChildExpression(getExpression(), newChild.getExp());
+
// Now try to see if we already have this variable
// object in our Map
// Since our map names use the expression, and not the
@@ -955,43 +1011,43 @@ public class MIVariableManager implements ICommandControl {
MIVariableObject childVar = lruVariableList.get(childId);
if (childVar != null) {
- if ((childVar.currentState == STATE_CREATING)
- || (childVar.currentState == STATE_NOT_CREATED)) {
+ if ((childVar.currentState == STATE_CREATING) || (childVar.currentState == STATE_NOT_CREATED)) {
// We must wait until the child MIVariableObject is fully created.
// This might succeed, or fail. If it succeeds, we can reuse it as
// a child, otherwise we create a new MIVariableObject for the
// varobj just provided by gdb.
-
+
++pendingVariableCreationCount;
-
+
final int insertPosition = arrayPosition;
final MIVariableObject monitoredVar = childVar;
final int indexInParent = i;
-
+
// varobj is not fully created so add RequestMonitor to pending queue
- childVar.updatesPending.add(new DataRequestMonitor<Boolean>(fSession.getExecutor(), countingRm) {
+ childVar.updatesPending
+ .add(new DataRequestMonitor<Boolean>(fSession.getExecutor(), countingRm) {
+
+ @Override
+ protected void handleCompleted() {
+ if (isSuccess()) {
+ if (addNewChildren && addedChildren != null) {
+ addedChildren[insertPosition] = monitoredVar.fExprInfo;
+ }
+ } else {
+ // Create a fresh MIVariableObject for this child, using
+ // the new varobj provided by gdb.
+ MIVariableObject newVar = createChild(childId, childFullExpression,
+ indexInParent, newChild);
+ if (addNewChildren && addedChildren != null) {
+ addedChildren[insertPosition] = newVar.fExprInfo;
+ }
+ }
- @Override
- protected void handleCompleted() {
- if (isSuccess()) {
- if (addNewChildren && addedChildren != null) {
- addedChildren[insertPosition] = monitoredVar.fExprInfo;
- }
- } else {
- // Create a fresh MIVariableObject for this child, using
- // the new varobj provided by gdb.
- MIVariableObject newVar = createChild(childId, childFullExpression,
- indexInParent, newChild);
- if (addNewChildren && addedChildren != null) {
- addedChildren[insertPosition] = newVar.fExprInfo;
+ countingRm.done();
}
- }
-
- countingRm.done();
- }
-
- });
+
+ });
} else if (childVar.currentState == STATE_CREATION_FAILED) {
// There has been an attempt the create a MIRootVariableObject for a full
@@ -1011,7 +1067,7 @@ public class MIVariableManager implements ICommandControl {
// Note: we don't need to check for fake children (public, protected, private) here.
// We enter this code only if the children are provided by a pretty printer and
// they don't return such children.
-
+
if (childVar == null) {
// Create a fresh MIVariableObject for this child, using
// the new varobj provided by -var-update.
@@ -1020,7 +1076,7 @@ public class MIVariableManager implements ICommandControl {
addedChildren[arrayPosition] = childVar.fExprInfo;
}
}
-
+
++i;
++arrayPosition;
}
@@ -1033,54 +1089,55 @@ public class MIVariableManager implements ICommandControl {
* Variable objects need not be deleted unless they are root.
* This method is specialized in the MIRootVariableObject class.
*/
- public void deleteInGdb() {}
-
- /**
+ public void deleteInGdb() {
+ }
+
+ /**
* This method returns the value of the variable object attributes by
* using -var-show-attributes.
* Currently, the only attribute available is 'editable'.
- *
+ *
* @param rm
* The data request monitor that will hold the value returned
*/
- private void getAttributes(final DataRequestMonitor<Boolean> rm) {
- if (fEditable != null) {
- rm.setData(fEditable);
- rm.done();
- } else if (isComplex()) {
- fEditable = false;
- rm.setData(fEditable);
- rm.done();
- } else {
- fCommandControl.queueCommand(
- fCommandFactory.createMIVarShowAttributes(getRootToUpdate().getControlDMContext(), getGdbName()),
- new DataRequestMonitor<MIVarShowAttributesInfo>(fSession.getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- fEditable = getData().isEditable();
-
- rm.setData(fEditable);
- rm.done();
- }
- });
- }
- }
-
- /**
+ private void getAttributes(final DataRequestMonitor<Boolean> rm) {
+ if (fEditable != null) {
+ rm.setData(fEditable);
+ rm.done();
+ } else if (isComplex()) {
+ fEditable = false;
+ rm.setData(fEditable);
+ rm.done();
+ } else {
+ fCommandControl.queueCommand(
+ fCommandFactory.createMIVarShowAttributes(getRootToUpdate().getControlDMContext(),
+ getGdbName()),
+ new DataRequestMonitor<MIVarShowAttributesInfo>(fSession.getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ fEditable = getData().isEditable();
+
+ rm.setData(fEditable);
+ rm.done();
+ }
+ });
+ }
+ }
+
+ /**
* This method returns the value of the variable object.
* This operation translates to multiple MI commands which affect the state of the
* variable object in the back-end; therefore, we must make sure the object is not
* locked doing another operation, and we must lock the object once it is our turn
* to use it.
- *
- * @param dmc
+ *
+ * @param dmc
* The context containing the format to be used for the evaluation
* @param rm
* The data request monitor that will hold the value returned
* @since 4.3
*/
- protected void getValue(final FormattedValueDMContext dmc,
- final DataRequestMonitor<FormattedValueDMData> rm) {
+ protected void getValue(final FormattedValueDMContext dmc, final DataRequestMonitor<FormattedValueDMData> rm) {
// We might already know the value
String value = getValue(dmc.getFormatID());
@@ -1096,23 +1153,19 @@ public class MIVariableManager implements ICommandControl {
if (isArray()) {
// Figure out the address
IExpressionDMContext exprCxt = DMContexts.getAncestorOfType(dmc, IExpressionDMContext.class);
- IExpressionDMContext addrCxt = fExpressionService.createExpression(exprCxt, "&(" + exprCxt.getExpression() + ")"); //$NON-NLS-1$//$NON-NLS-2$
+ IExpressionDMContext addrCxt = fExpressionService.createExpression(exprCxt,
+ "&(" + exprCxt.getExpression() + ")"); //$NON-NLS-1$//$NON-NLS-2$
- final FormattedValueDMContext formatCxt = new FormattedValueDMContext(
- fSession.getId(),
- addrCxt,
- dmc.getFormatID()
- );
+ final FormattedValueDMContext formatCxt = new FormattedValueDMContext(fSession.getId(), addrCxt,
+ dmc.getFormatID());
- getVariable(
- addrCxt,
- new DataRequestMonitor<MIVariableObject>(fSession.getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- getData().getValue(formatCxt, rm);
+ getVariable(addrCxt, new DataRequestMonitor<MIVariableObject>(fSession.getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ getData().getValue(formatCxt, rm);
- }
- });
+ }
+ });
return;
}
@@ -1129,28 +1182,29 @@ public class MIVariableManager implements ICommandControl {
// If the format is already the one set for this variable object,
// we don't need to set it again
if (dmc.getFormatID().equals(getCurrentFormat())) {
- evaluate(rm);
+ evaluate(rm);
} else {
// We must first set the new format and then evaluate the variable
fCommandControl.queueCommand(
- fCommandFactory.createMIVarSetFormat(getRootToUpdate().getControlDMContext(), getGdbName(), dmc.getFormatID()),
+ fCommandFactory.createMIVarSetFormat(getRootToUpdate().getControlDMContext(), getGdbName(),
+ dmc.getFormatID()),
new DataRequestMonitor<MIVarSetFormatInfo>(fSession.getExecutor(), rm) {
@Override
protected void handleCompleted() {
if (isSuccess()) {
setCurrentFormat(dmc.getFormatID());
-
+
// If set-format returned the value, no need to evaluate
// This is only valid after GDB 6.7
if (getData().getValue() != null) {
- setValue(dmc.getFormatID(), getData().getValue());
+ setValue(dmc.getFormatID(), getData().getValue());
rm.setData(new FormattedValueDMData(getData().getValue()));
rm.done();
-
+
// Unlock is done within this method
resetFormatToNatural();
} else {
- evaluate(rm);
+ evaluate(rm);
}
} else {
rm.setStatus(getStatus());
@@ -1164,12 +1218,13 @@ public class MIVariableManager implements ICommandControl {
}
}
- /**
- * This method evaluates a variable object
+ /**
+ * This method evaluates a variable object
*/
private void evaluate(final DataRequestMonitor<FormattedValueDMData> rm) {
fCommandControl.queueCommand(
- fCommandFactory.createMIVarEvaluateExpression(getRootToUpdate().getControlDMContext(), getGdbName()),
+ fCommandFactory.createMIVarEvaluateExpression(getRootToUpdate().getControlDMContext(),
+ getGdbName()),
new DataRequestMonitor<MIVarEvaluateExpressionInfo>(fSession.getExecutor(), rm) {
@Override
protected void handleCompleted() {
@@ -1181,7 +1236,7 @@ public class MIVariableManager implements ICommandControl {
rm.setStatus(getStatus());
rm.done();
}
-
+
// Unlock is done within this method
resetFormatToNatural();
}
@@ -1206,7 +1261,8 @@ public class MIVariableManager implements ICommandControl {
private void resetFormatToNatural() {
if (!getCurrentFormat().equals(IFormattedValues.NATURAL_FORMAT)) {
fCommandControl.queueCommand(
- fCommandFactory.createMIVarSetFormat(getRootToUpdate().getControlDMContext(), getGdbName(), IFormattedValues.NATURAL_FORMAT),
+ fCommandFactory.createMIVarSetFormat(getRootToUpdate().getControlDMContext(), getGdbName(),
+ IFormattedValues.NATURAL_FORMAT),
new DataRequestMonitor<MIVarSetFormatInfo>(fSession.getExecutor(), null) {
@Override
protected void handleCompleted() {
@@ -1218,15 +1274,15 @@ public class MIVariableManager implements ICommandControl {
});
} else {
unlock();
- }
+ }
}
/**
* This method returns the list of children of the variable object
* passed as a parameter.
- *
+ *
* @param exprDmc
- *
+ *
* @param clientNumChildrenLimit
* If the current limit for the given expression is smaller,
* this limit will be applied.
@@ -1234,9 +1290,9 @@ public class MIVariableManager implements ICommandControl {
* The data request monitor that will hold the children
* returned
*/
- private void getChildren(final IExpressionDMContext exprDmc,
- final int clientNumChildrenLimit, final DataRequestMonitor<ChildrenInfo> rm) {
-
+ private void getChildren(final IExpressionDMContext exprDmc, final int clientNumChildrenLimit,
+ final DataRequestMonitor<ChildrenInfo> rm) {
+
if (fFetchingChildren) {
// Only one request monitor can fetch children at a time.
fetchChildrenPending.add(new DataRequestMonitor<ChildrenInfo>(fSession.getExecutor(), rm) {
@@ -1245,7 +1301,7 @@ public class MIVariableManager implements ICommandControl {
protected void handleSuccess() {
ChildrenInfo info = getData();
int numChildren = info.getChildren().length;
- if (! info.hasMore() || numChildren >= clientNumChildrenLimit) {
+ if (!info.hasMore() || numChildren >= clientNumChildrenLimit) {
// No need to fetch further children.
rm.setData(getData());
rm.done();
@@ -1254,47 +1310,48 @@ public class MIVariableManager implements ICommandControl {
getChildren(exprDmc, clientNumChildrenLimit, rm);
}
}
-
+
});
} else {
-
+
fFetchingChildren = true;
-
- fetchChildren(exprDmc, clientNumChildrenLimit, new DataRequestMonitor<ChildrenInfo>(fSession.getExecutor(), rm) {
- @Override
- protected void handleCompleted() {
- fFetchingChildren = false;
+ fetchChildren(exprDmc, clientNumChildrenLimit,
+ new DataRequestMonitor<ChildrenInfo>(fSession.getExecutor(), rm) {
- if (isSuccess()) {
- rm.setData(getData());
- rm.done();
-
- while (!fetchChildrenPending.isEmpty()) {
- DataRequestMonitor<ChildrenInfo> pendingRm = fetchChildrenPending.poll();
- pendingRm.setData(getData());
- pendingRm.done();
- }
- } else {
- rm.setStatus(getStatus());
- rm.done();
+ @Override
+ protected void handleCompleted() {
+ fFetchingChildren = false;
- while (!fetchChildrenPending.isEmpty()) {
- DataRequestMonitor<ChildrenInfo> pendingRm = fetchChildrenPending.poll();
- pendingRm.setStatus(getStatus());
- pendingRm.done();
- }
- }
- }
- });
+ if (isSuccess()) {
+ rm.setData(getData());
+ rm.done();
+
+ while (!fetchChildrenPending.isEmpty()) {
+ DataRequestMonitor<ChildrenInfo> pendingRm = fetchChildrenPending.poll();
+ pendingRm.setData(getData());
+ pendingRm.done();
+ }
+ } else {
+ rm.setStatus(getStatus());
+ rm.done();
+
+ while (!fetchChildrenPending.isEmpty()) {
+ DataRequestMonitor<ChildrenInfo> pendingRm = fetchChildrenPending.poll();
+ pendingRm.setStatus(getStatus());
+ pendingRm.done();
+ }
+ }
+ }
+ });
}
}
/**
* Fetch the out-standing children.
- *
+ *
* @param exprDmc
- *
+ *
* @param clientNumChildrenLimit
* If the current limit for the given expression is smaller,
* this limit will be applied.
@@ -1303,192 +1360,198 @@ public class MIVariableManager implements ICommandControl {
* returned
* @since 4.3
*/
- protected void fetchChildren(final IExpressionDMContext exprDmc,
- int clientNumChildrenLimit, final DataRequestMonitor<ChildrenInfo> rm) {
-
- final int newNumChildrenLimit = clientNumChildrenLimit != IMIExpressions.CHILD_COUNT_LIMIT_UNSPECIFIED ?
- clientNumChildrenLimit : 1;
+ protected void fetchChildren(final IExpressionDMContext exprDmc, int clientNumChildrenLimit,
+ final DataRequestMonitor<ChildrenInfo> rm) {
+
+ final int newNumChildrenLimit = clientNumChildrenLimit != IMIExpressions.CHILD_COUNT_LIMIT_UNSPECIFIED
+ ? clientNumChildrenLimit
+ : 1;
boolean addChildren = requiresAdditionalChildren(newNumChildrenLimit);
-
- // If we already know the children, no need to go to the back-end
+
+ // If we already know the children, no need to go to the back-end
ExpressionInfo[] childrenArray = getChildren();
- if (childrenArray != null && ! addChildren) {
- rm.setData(new ChildrenInfo(childrenArray, fHasMore));
- rm.done();
- return;
- }
-
+ if (childrenArray != null && !addChildren) {
+ rm.setData(new ChildrenInfo(childrenArray, fHasMore));
+ rm.done();
+ return;
+ }
+
// If the variable does not have children, we can return an empty list right away
- if (! hasChildren()) {
- // First store the empty list, for the next time
+ if (!hasChildren()) {
+ // First store the empty list, for the next time
setChildren(new ExpressionInfo[0]);
rm.setData(new ChildrenInfo(getChildren(), fHasMore));
rm.done();
return;
}
-
- // For arrays (which could be very large), we create the children ourselves. This is
- // to avoid creating an enormous amount of children variable objects that the view may
- // never need. Using -var-list-children will create a variable object for every child
- // immediately, that is why we don't want to use it for arrays.
- if (isArray()) {
- ExpressionInfo[] childrenOfArray = new ExpressionInfo[getNumChildrenHint()];
- String exprName = exprDmc.getExpression();
-
- int castingIndex = 0;
- // in case of casts, need to resolve that before dereferencing, to be safe
- if (exprDmc instanceof ICastedExpressionDMContext) {
- castingIndex = ((ICastedExpressionDMContext)exprDmc).getCastInfo().getArrayStartIndex();
- }
- if (exprDmc instanceof IIndexedPartitionDMContext) {
- castingIndex = ((IIndexedPartitionDMContext)exprDmc).getIndex();
- }
- for (int i= 0; i < childrenOfArray.length; i++) {
- String fullExpr = exprName + "[" + i + "]";//$NON-NLS-1$//$NON-NLS-2$
-
- String relExpr;
- if (exprDmc instanceof MIExpressionDMC) {
- relExpr = ((MIExpressionDMC)exprDmc).getRelativeExpression();
- } else {
- // Unexpected, but avoid exception
- relExpr = exprDmc.getExpression();
- }
- relExpr = relExpr + "[" + (castingIndex + i) + "]";//$NON-NLS-1$//$NON-NLS-2$
-
-
- childrenOfArray[i] = new ExpressionInfo(fullExpr, relExpr, false, fExprInfo, i);
- }
-
- // First store these children, for the next time
+
+ // For arrays (which could be very large), we create the children ourselves. This is
+ // to avoid creating an enormous amount of children variable objects that the view may
+ // never need. Using -var-list-children will create a variable object for every child
+ // immediately, that is why we don't want to use it for arrays.
+ if (isArray()) {
+ ExpressionInfo[] childrenOfArray = new ExpressionInfo[getNumChildrenHint()];
+ String exprName = exprDmc.getExpression();
+
+ int castingIndex = 0;
+ // in case of casts, need to resolve that before dereferencing, to be safe
+ if (exprDmc instanceof ICastedExpressionDMContext) {
+ castingIndex = ((ICastedExpressionDMContext) exprDmc).getCastInfo().getArrayStartIndex();
+ }
+ if (exprDmc instanceof IIndexedPartitionDMContext) {
+ castingIndex = ((IIndexedPartitionDMContext) exprDmc).getIndex();
+ }
+ for (int i = 0; i < childrenOfArray.length; i++) {
+ String fullExpr = exprName + "[" + i + "]";//$NON-NLS-1$//$NON-NLS-2$
+
+ String relExpr;
+ if (exprDmc instanceof MIExpressionDMC) {
+ relExpr = ((MIExpressionDMC) exprDmc).getRelativeExpression();
+ } else {
+ // Unexpected, but avoid exception
+ relExpr = exprDmc.getExpression();
+ }
+ relExpr = relExpr + "[" + (castingIndex + i) + "]";//$NON-NLS-1$//$NON-NLS-2$
+
+ childrenOfArray[i] = new ExpressionInfo(fullExpr, relExpr, false, fExprInfo, i);
+ }
+
+ // First store these children, for the next time
setChildren(childrenOfArray);
fHasMore = false;
rm.setData(new ChildrenInfo(getChildren(), fHasMore));
- rm.done();
- return;
- }
-
- // No need to wait for the object to be ready since listing children can be performed
- // at any time, as long as the object is created, which we know it is, since we can only
- // be called here with a fully created object.
- // Also no need to lock the object, since getting the children won't affect other operations
-
- final int from = (addChildren && (fChildren != null)) ? getNumChildrenHint() : 0;
- final int to = Math.max(newNumChildrenLimit, fExprInfo.getChildCountLimit());
-
- ICommand<MIVarListChildrenInfo> varListChildren = isSafeToAskForAllChildren() ?
- fCommandFactory.createMIVarListChildren(getRootToUpdate().getControlDMContext(), getGdbName())
- :fCommandFactory.createMIVarListChildren(getRootToUpdate().getControlDMContext(), getGdbName(), from, to);
-
- fCommandControl.queueCommand(
- varListChildren,
- new DataRequestMonitor<MIVarListChildrenInfo>(fSession.getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- MIVar[] children = getData().getMIVars();
- final boolean localHasMore = getData().hasMore();
-
- // The elements of this array normally are an ExpressionInfo, unless it corresponds to
- // a fake child (public, protected, private). In this case it is an ExpressionInfo[]
- // representing the children of the fake child.
- // This in done in order to preserve the order (the index-in-parent information),
- // when replacing a fake child by its real children.
- final ExpressionInfo[][] realChildren = new ExpressionInfo[children.length][];
-
- final CountingRequestMonitor countingRm = new CountingRequestMonitor(fSession.getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- // Store the children in our variable object cache
- addChildren(realChildren);
- fHasMore = localHasMore;
- rm.setData(new ChildrenInfo(getChildren(), fHasMore));
-
- int updateLimit = updateLimit(to);
-
- if (! isSafeToAskForAllChildren()) {
- // Make sure the gdb will not hang, if later
- // the varobj is updated, but the underlying
- // data is still uninitialized.
- fCommandControl.queueCommand(
- fCommandFactory.createMIVarSetUpdateRange(getRootToUpdate().getControlDMContext(),
- getGdbName(), 0, updateLimit), new DataRequestMonitor<MIInfo>(fSession.getExecutor(), rm));
- } else {
- rm.done();
- }
- }
- };
-
- int numSubRequests = 0;
- for (int i = 0; i < children.length; ++i) {
- final MIVar child = children[i];
- final int indexInParent = from + i;
- final int arrayPosition = i;
-
- // These children get created automatically as variable objects in GDB, so we should
- // add them to the LRU.
- // Note that if this variable object already exists, we can be in three scenarios:
- // 1- the existing object is the same variable object in GDB. In this case,
- // the existing and new one are identical so we can keep either one.
- // 2- the existing object is out-of-scope and should be replaced by the new one.
- // This can happen if a root was found to be out-of-scope, but this child
- // had not been accessed and therefore had not been removed.
- // 3- the existing object is an in-scope root object representing the same expression.
- // In this case, either object can be kept and the other one can be deleted.
- // The existing root could currently be in-use by another operation and may
- // not be deleted; but since we can only have one entry in the LRU, we are
- // forced to keep the existing root. Note that we need not worry about
- // the newly created child since it will automatically be deleted when
- // its root is deleted.
-
- numSubRequests++;
-
- // Class to keep track of the child's full expression, but also
- // if that child had to use the CastToBaseClassWorkaround,
- // which needs to be propagated to its own children.
- class ChildFullExpressionInfo {
- private String childFullExpression;
- private boolean childHasCastToBaseClassWorkaround;
-
- public ChildFullExpressionInfo(String path) {
- this(path, false);
- }
-
- public ChildFullExpressionInfo(String path, boolean hasWorkaround) {
- childFullExpression = path == null ? "" : path; //$NON-NLS-1$
- childHasCastToBaseClassWorkaround = hasWorkaround;
- }
-
- public String getChildPath() { return childFullExpression; }
- public boolean getChildHasCastToBaseClassWorkaround() { return childHasCastToBaseClassWorkaround; }
- }
-
- final DataRequestMonitor<ChildFullExpressionInfo> childPathRm =
- new DataRequestMonitor<ChildFullExpressionInfo>(fSession.getExecutor(), countingRm) {
- @Override
- protected void handleSuccess() {
- final String childPath = getData().getChildPath();
- // The child varObj we are about to create should have hasCastToBaseClassWorkaround
- // set in two conditions:
- // 1- if its parent was set (which is the current varObj)
- // 2- if the workaround was used for the child itself, which is part of ChildFullExpressionInfo
- final boolean childHasCastToBaseClassWorkaround =
- fHasCastToBaseClassWorkaround || getData().getChildHasCastToBaseClassWorkaround();
-
- // For children that do not map to a real expression (such as f.public)
- // GDB returns an empty string. In this case, we can use another unique
- // name, such as the variable name
- final boolean fakeChild = (childPath.length() == 0);
- final String childFullExpression = fakeChild ? child.getVarName() : childPath;
-
- // Now try to see if we already have this variable object in our Map
- // Since our map names use the expression, and not the GDB given
- // name, we must determine the correct map name from the varName
- final VariableObjectId childId = new VariableObjectId();
- childId.generateId(childFullExpression, getInternalId());
- MIVariableObject childVar = lruVariableList.get(childId);
+ rm.done();
+ return;
+ }
+
+ // No need to wait for the object to be ready since listing children can be performed
+ // at any time, as long as the object is created, which we know it is, since we can only
+ // be called here with a fully created object.
+ // Also no need to lock the object, since getting the children won't affect other operations
+
+ final int from = (addChildren && (fChildren != null)) ? getNumChildrenHint() : 0;
+ final int to = Math.max(newNumChildrenLimit, fExprInfo.getChildCountLimit());
+
+ ICommand<MIVarListChildrenInfo> varListChildren = isSafeToAskForAllChildren()
+ ? fCommandFactory.createMIVarListChildren(getRootToUpdate().getControlDMContext(), getGdbName())
+ : fCommandFactory.createMIVarListChildren(getRootToUpdate().getControlDMContext(), getGdbName(),
+ from, to);
+
+ fCommandControl.queueCommand(varListChildren,
+ new DataRequestMonitor<MIVarListChildrenInfo>(fSession.getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ MIVar[] children = getData().getMIVars();
+ final boolean localHasMore = getData().hasMore();
+
+ // The elements of this array normally are an ExpressionInfo, unless it corresponds to
+ // a fake child (public, protected, private). In this case it is an ExpressionInfo[]
+ // representing the children of the fake child.
+ // This in done in order to preserve the order (the index-in-parent information),
+ // when replacing a fake child by its real children.
+ final ExpressionInfo[][] realChildren = new ExpressionInfo[children.length][];
+
+ final CountingRequestMonitor countingRm = new CountingRequestMonitor(fSession.getExecutor(),
+ rm) {
+ @Override
+ protected void handleSuccess() {
+ // Store the children in our variable object cache
+ addChildren(realChildren);
+ fHasMore = localHasMore;
+ rm.setData(new ChildrenInfo(getChildren(), fHasMore));
+
+ int updateLimit = updateLimit(to);
+
+ if (!isSafeToAskForAllChildren()) {
+ // Make sure the gdb will not hang, if later
+ // the varobj is updated, but the underlying
+ // data is still uninitialized.
+ fCommandControl.queueCommand(fCommandFactory.createMIVarSetUpdateRange(
+ getRootToUpdate().getControlDMContext(), getGdbName(), 0, updateLimit),
+ new DataRequestMonitor<MIInfo>(fSession.getExecutor(), rm));
+ } else {
+ rm.done();
+ }
+ }
+ };
+
+ int numSubRequests = 0;
+ for (int i = 0; i < children.length; ++i) {
+ final MIVar child = children[i];
+ final int indexInParent = from + i;
+ final int arrayPosition = i;
+
+ // These children get created automatically as variable objects in GDB, so we should
+ // add them to the LRU.
+ // Note that if this variable object already exists, we can be in three scenarios:
+ // 1- the existing object is the same variable object in GDB. In this case,
+ // the existing and new one are identical so we can keep either one.
+ // 2- the existing object is out-of-scope and should be replaced by the new one.
+ // This can happen if a root was found to be out-of-scope, but this child
+ // had not been accessed and therefore had not been removed.
+ // 3- the existing object is an in-scope root object representing the same expression.
+ // In this case, either object can be kept and the other one can be deleted.
+ // The existing root could currently be in-use by another operation and may
+ // not be deleted; but since we can only have one entry in the LRU, we are
+ // forced to keep the existing root. Note that we need not worry about
+ // the newly created child since it will automatically be deleted when
+ // its root is deleted.
+
+ numSubRequests++;
+
+ // Class to keep track of the child's full expression, but also
+ // if that child had to use the CastToBaseClassWorkaround,
+ // which needs to be propagated to its own children.
+ class ChildFullExpressionInfo {
+ private String childFullExpression;
+ private boolean childHasCastToBaseClassWorkaround;
+
+ public ChildFullExpressionInfo(String path) {
+ this(path, false);
+ }
+
+ public ChildFullExpressionInfo(String path, boolean hasWorkaround) {
+ childFullExpression = path == null ? "" : path; //$NON-NLS-1$
+ childHasCastToBaseClassWorkaround = hasWorkaround;
+ }
+
+ public String getChildPath() {
+ return childFullExpression;
+ }
+
+ public boolean getChildHasCastToBaseClassWorkaround() {
+ return childHasCastToBaseClassWorkaround;
+ }
+ }
+
+ final DataRequestMonitor<ChildFullExpressionInfo> childPathRm = new DataRequestMonitor<ChildFullExpressionInfo>(
+ fSession.getExecutor(), countingRm) {
+ @Override
+ protected void handleSuccess() {
+ final String childPath = getData().getChildPath();
+ // The child varObj we are about to create should have hasCastToBaseClassWorkaround
+ // set in two conditions:
+ // 1- if its parent was set (which is the current varObj)
+ // 2- if the workaround was used for the child itself, which is part of ChildFullExpressionInfo
+ final boolean childHasCastToBaseClassWorkaround = fHasCastToBaseClassWorkaround
+ || getData().getChildHasCastToBaseClassWorkaround();
+
+ // For children that do not map to a real expression (such as f.public)
+ // GDB returns an empty string. In this case, we can use another unique
+ // name, such as the variable name
+ final boolean fakeChild = (childPath.length() == 0);
+ final String childFullExpression = fakeChild ? child.getVarName() : childPath;
+
+ // Now try to see if we already have this variable object in our Map
+ // Since our map names use the expression, and not the GDB given
+ // name, we must determine the correct map name from the varName
+ final VariableObjectId childId = new VariableObjectId();
+ childId.generateId(childFullExpression, getInternalId());
+ MIVariableObject childVar = lruVariableList.get(childId);
if (childVar != null) {
-
+
if ((childVar.currentState == STATE_CREATING)
|| (childVar.currentState == STATE_NOT_CREATED)) {
@@ -1496,36 +1559,39 @@ public class MIVariableManager implements ICommandControl {
// This might succeed, or fail. If it succeeds, we can reuse it as
// a child, otherwise we create a new MIVariableObject for the
// varobj just provided by gdb.
-
+
final MIVariableObject monitoredVar = childVar;
-
+
// childVar is not fully created so add a RequestMonitor to the queue
- childVar.updatesPending.add(new DataRequestMonitor<Boolean>(fSession.getExecutor(), countingRm) {
+ childVar.updatesPending.add(new DataRequestMonitor<Boolean>(
+ fSession.getExecutor(), countingRm) {
@Override
protected void handleCompleted() {
MIVariableObject var = monitoredVar;
-
- if (! isSuccess()) {
-
+
+ if (!isSuccess()) {
+
// Create a fresh MIVariableObject for this child, using
// the new varobj provided by gdb.
- var = createChild(childId, childFullExpression, indexInParent, child);
+ var = createChild(childId, childFullExpression,
+ indexInParent, child);
}
-
+
var.fHasCastToBaseClassWorkaround = childHasCastToBaseClassWorkaround;
-
+
if (fakeChild) {
- if (! isSuccess()) {
+ if (!isSuccess()) {
fFakeChildren.add(var.fExprInfo);
}
- addRealChildrenOfFake(var, exprDmc, realChildren,
+ addRealChildrenOfFake(var, exprDmc, realChildren,
arrayPosition, countingRm);
} else {
// This is a real child
- realChildren[arrayPosition] = new ExpressionInfo[] { var.fExprInfo };
+ realChildren[arrayPosition] = new ExpressionInfo[] {
+ var.fExprInfo };
countingRm.done();
- }
+ }
}
});
} else if (childVar.currentState == STATE_CREATION_FAILED) {
@@ -1545,7 +1611,7 @@ public class MIVariableManager implements ICommandControl {
childVar.fHasCastToBaseClassWorkaround = childHasCastToBaseClassWorkaround;
if (fakeChild) {
// I don't think this should happen, but we put it just in case
- addRealChildrenOfFake(childVar, exprDmc, realChildren,
+ addRealChildrenOfFake(childVar, exprDmc, realChildren,
arrayPosition, countingRm);
} else {
// This is a real child, use it directly, however, we must
@@ -1555,163 +1621,180 @@ public class MIVariableManager implements ICommandControl {
// That is why we set the relative expression explicitly
// See bug 432888
ExpressionInfo oldInfo = childVar.getExpressionInfo();
- realChildren[arrayPosition] =
- new ExpressionInfo[] { new ExpressionInfo(
- oldInfo.getFullExpr(), child.getExp(), oldInfo.isDynamic(),
- oldInfo.getParent(), oldInfo.getIndexInParentExpression()) };
+ realChildren[arrayPosition] = new ExpressionInfo[] {
+ new ExpressionInfo(oldInfo.getFullExpr(), child.getExp(),
+ oldInfo.isDynamic(), oldInfo.getParent(),
+ oldInfo.getIndexInParentExpression()) };
countingRm.done();
}
}
}
- if (childVar == null) {
- childVar = createChild(childId, childFullExpression, indexInParent, child);
-
+ if (childVar == null) {
+ childVar = createChild(childId, childFullExpression, indexInParent, child);
+
childVar.fHasCastToBaseClassWorkaround = childHasCastToBaseClassWorkaround;
if (fakeChild) {
fFakeChildren.add(childVar.fExprInfo);
- addRealChildrenOfFake(childVar, exprDmc, realChildren,
- arrayPosition, countingRm);
+ addRealChildrenOfFake(childVar, exprDmc, realChildren, arrayPosition,
+ countingRm);
} else {
// This is a real child
- realChildren[arrayPosition] = new ExpressionInfo[] { childVar.fExprInfo };
+ realChildren[arrayPosition] = new ExpressionInfo[] {
+ childVar.fExprInfo };
countingRm.done();
}
- }
- }
- };
-
-
- if (isAccessQualifier(child.getExp())) {
- // This is just a qualifier level of C++, so we don't need
- // to call -var-info-path-expression for real, but just pretend we did.
- childPathRm.setData(new ChildFullExpressionInfo("")); //$NON-NLS-1$
- childPathRm.done();
- } else if (isDynamic() || fExprInfo.hasDynamicAncestor()) {
- // Equivalent to (which can't be implemented): child.hasDynamicAncestor
- // The new child has a dynamic ancestor. Such children don't support
- // var-info-path-expression. Build the expression ourselves.
- childPathRm.setData(new ChildFullExpressionInfo(buildChildExpression(exprDmc.getExpression(), child.getExp())));
- childPathRm.done();
- } else if (fHasCastToBaseClassWorkaround) {
- // We had to use the "CastToBaseClass" workaround in the hierarchy, so we
- // know -var-info-path-expression won't work in this case. We have to
- // build the expression ourselves again to keep the workaround as part
- // of the child's expression.
- childPathRm.setData(new ChildFullExpressionInfo(buildChildExpression(exprDmc.getExpression(), child.getExp())));
- childPathRm.done();
- } else {
- // To build the child id, we need the fully qualified expression which we
- // can get from -var-info-path-expression starting from GDB 6.7
- fCommandControl.queueCommand(
- fCommandFactory.createMIVarInfoPathExpression(getRootToUpdate().getControlDMContext(), child.getVarName()),
- new DataRequestMonitor<MIVarInfoPathExpressionInfo>(fSession.getExecutor(), childPathRm) {
- @Override
- protected void handleCompleted() {
- if (isSuccess()) {
- final String expression = getData().getFullExpression();
-
- if (needFixForGDBBug320277() && child.getExp().equals(child.getType()) && !isAccessQualifier(getExpressionInfo().getRelExpr())) {
- // Special handling for a derived class that is cast to its base class (see bug 320277)
- //
- // If the name of a child equals its type then it could be a base class.
- // The exception is when the name of the actual variable is identical with the type name (bad coding style :-))
- // The only way to tell the difference is to check if the parent is a fake (public/private/protected).
- //
- // What we could do instead, is make sure we are using C++ (using -var-info-expression). That would
- // be safer. However, at this time, there does not seem to be a way to create a variable with the same
- // name and type using plain C, so we are safe.
- //
- // When we know we are dealing with derived class that is cast to its base class
- // -var-info-path-expression returns (*(testbase*) this) and in some cases
- // this expression will fail when being evaluated in GDB because of a GDB bug.
- // Instead, we need (*(struct testbase*) this).
- //
- // To check if GDB actually has this bug we call -data-evaluate-expression with the return value
- // of -var-info-path-expression
- IExpressionDMContext exprDmcMIData = fExpressionService.createExpression(exprDmc, expression);
- fCommandControl.queueCommand(
- fCommandFactory.createMIDataEvaluateExpression(exprDmcMIData),
- new DataRequestMonitor<MIDataEvaluateExpressionInfo>(fSession.getExecutor(), childPathRm) {
- @Override
- protected void handleCompleted() {
- if (isSuccess()) {
- childPathRm.setData(new ChildFullExpressionInfo(expression));
- childPathRm.done();
- } else {
- // We build the expression ourselves
- // We must also indicate that this workaround has been used for this child
- // so that we know to keep using it for further descendants.
- childPathRm.setData(new ChildFullExpressionInfo(buildDerivedChildExpression(exprDmc.getExpression(), child.getExp()), true));
- childPathRm.done();
- }
- }
- });
- } else {
- childPathRm.setData(new ChildFullExpressionInfo(expression));
- childPathRm.done();
- }
- } else {
- // If we don't have var-info-path-expression
- // build the expression ourselves
- // Note that this does not work well yet
- childPathRm.setData(new ChildFullExpressionInfo(buildChildExpression(exprDmc.getExpression(), child.getExp())));
- childPathRm.done();
- }
- }
- });
- }
- }
-
- countingRm.setDoneCount(numSubRequests);
- }
- });
- }
-
+ }
+ }
+ };
+
+ if (isAccessQualifier(child.getExp())) {
+ // This is just a qualifier level of C++, so we don't need
+ // to call -var-info-path-expression for real, but just pretend we did.
+ childPathRm.setData(new ChildFullExpressionInfo("")); //$NON-NLS-1$
+ childPathRm.done();
+ } else if (isDynamic() || fExprInfo.hasDynamicAncestor()) {
+ // Equivalent to (which can't be implemented): child.hasDynamicAncestor
+ // The new child has a dynamic ancestor. Such children don't support
+ // var-info-path-expression. Build the expression ourselves.
+ childPathRm.setData(new ChildFullExpressionInfo(
+ buildChildExpression(exprDmc.getExpression(), child.getExp())));
+ childPathRm.done();
+ } else if (fHasCastToBaseClassWorkaround) {
+ // We had to use the "CastToBaseClass" workaround in the hierarchy, so we
+ // know -var-info-path-expression won't work in this case. We have to
+ // build the expression ourselves again to keep the workaround as part
+ // of the child's expression.
+ childPathRm.setData(new ChildFullExpressionInfo(
+ buildChildExpression(exprDmc.getExpression(), child.getExp())));
+ childPathRm.done();
+ } else {
+ // To build the child id, we need the fully qualified expression which we
+ // can get from -var-info-path-expression starting from GDB 6.7
+ fCommandControl.queueCommand(
+ fCommandFactory.createMIVarInfoPathExpression(
+ getRootToUpdate().getControlDMContext(), child.getVarName()),
+ new DataRequestMonitor<MIVarInfoPathExpressionInfo>(fSession.getExecutor(),
+ childPathRm) {
+ @Override
+ protected void handleCompleted() {
+ if (isSuccess()) {
+ final String expression = getData().getFullExpression();
+
+ if (needFixForGDBBug320277()
+ && child.getExp().equals(child.getType())
+ && !isAccessQualifier(
+ getExpressionInfo().getRelExpr())) {
+ // Special handling for a derived class that is cast to its base class (see bug 320277)
+ //
+ // If the name of a child equals its type then it could be a base class.
+ // The exception is when the name of the actual variable is identical with the type name (bad coding style :-))
+ // The only way to tell the difference is to check if the parent is a fake (public/private/protected).
+ //
+ // What we could do instead, is make sure we are using C++ (using -var-info-expression). That would
+ // be safer. However, at this time, there does not seem to be a way to create a variable with the same
+ // name and type using plain C, so we are safe.
+ //
+ // When we know we are dealing with derived class that is cast to its base class
+ // -var-info-path-expression returns (*(testbase*) this) and in some cases
+ // this expression will fail when being evaluated in GDB because of a GDB bug.
+ // Instead, we need (*(struct testbase*) this).
+ //
+ // To check if GDB actually has this bug we call -data-evaluate-expression with the return value
+ // of -var-info-path-expression
+ IExpressionDMContext exprDmcMIData = fExpressionService
+ .createExpression(exprDmc, expression);
+ fCommandControl.queueCommand(
+ fCommandFactory.createMIDataEvaluateExpression(
+ exprDmcMIData),
+ new DataRequestMonitor<MIDataEvaluateExpressionInfo>(
+ fSession.getExecutor(), childPathRm) {
+ @Override
+ protected void handleCompleted() {
+ if (isSuccess()) {
+ childPathRm.setData(
+ new ChildFullExpressionInfo(
+ expression));
+ childPathRm.done();
+ } else {
+ // We build the expression ourselves
+ // We must also indicate that this workaround has been used for this child
+ // so that we know to keep using it for further descendants.
+ childPathRm.setData(
+ new ChildFullExpressionInfo(
+ buildDerivedChildExpression(
+ exprDmc.getExpression(),
+ child.getExp()),
+ true));
+ childPathRm.done();
+ }
+ }
+ });
+ } else {
+ childPathRm
+ .setData(new ChildFullExpressionInfo(expression));
+ childPathRm.done();
+ }
+ } else {
+ // If we don't have var-info-path-expression
+ // build the expression ourselves
+ // Note that this does not work well yet
+ childPathRm.setData(
+ new ChildFullExpressionInfo(buildChildExpression(
+ exprDmc.getExpression(), child.getExp())));
+ childPathRm.done();
+ }
+ }
+ });
+ }
+ }
+
+ countingRm.setDoneCount(numSubRequests);
+ }
+ });
+ }
+
/**
* Create a child variable of this MIVariableObject and initialize
* it from the given MIVar data.
- *
+ *
* @param childId
* @param childFullExpression
* @param indexInParent
* @param childData
- *
+ *
* @return The new child.
- *
+ *
* @since 4.0
*/
- protected MIVariableObject createChild(final VariableObjectId childId,
- final String childFullExpression, final int indexInParent,
- final MIVar childData) {
-
+ protected MIVariableObject createChild(final VariableObjectId childId, final String childFullExpression,
+ final int indexInParent, final MIVar childData) {
+
MIVariableObject var = createVariableObject(childId, this);
- ExpressionInfo childInfo = new ExpressionInfo(childFullExpression,
- childData.getExp(), childData.isDynamic(), fExprInfo,
- indexInParent);
+ ExpressionInfo childInfo = new ExpressionInfo(childFullExpression, childData.getExp(),
+ childData.isDynamic(), fExprInfo, indexInParent);
var.initFrom(childData, childInfo);
return var;
}
-
+
/**
* @param clientLimit
* @return True, if the client specified limit requires to check for
* further children.
- *
+ *
* @since 4.0
*/
protected boolean requiresAdditionalChildren(int clientLimit) {
- return !isSafeToAskForAllChildren()
- && (fExprInfo.getChildCountLimit() < calculateNewLimit(clientLimit));
+ return !isSafeToAskForAllChildren() && (fExprInfo.getChildCountLimit() < calculateNewLimit(clientLimit));
}
/**
* @param newLimit
* The new limit on the number of children being asked for or
* being updated.
- *
+ *
* @return The new limit.
* @since 4.0
*/
@@ -1719,10 +1802,10 @@ public class MIVariableManager implements ICommandControl {
fExprInfo.setChildCountLimit(calculateNewLimit(newLimit));
return fExprInfo.getChildCountLimit();
}
-
+
private int calculateNewLimit(int clientLimit) {
int limit = fExprInfo.getChildCountLimit();
-
+
if (!isSafeToAskForAllChildren() && clientLimit != IMIExpressions.CHILD_COUNT_LIMIT_UNSPECIFIED) {
if (limit == IMIExpressions.CHILD_COUNT_LIMIT_UNSPECIFIED) {
return clientLimit;
@@ -1730,40 +1813,34 @@ public class MIVariableManager implements ICommandControl {
return clientLimit;
}
}
-
+
return limit;
}
/**
* Obtain the children of the given fake child (public, protected, or
* private) and insert them into a list of children at a given position.
- *
+ *
* @param fakeChild
* @param frameCtxProvider
* @param realChildren
* @param position
* @param rm The request monitor on which to call done upon completion.
*/
- private void addRealChildrenOfFake(MIVariableObject fakeChild,
- IExpressionDMContext frameCtxProvider,
- final ExpressionInfo[][] realChildren, final int position,
- final RequestMonitor rm) {
+ private void addRealChildrenOfFake(MIVariableObject fakeChild, IExpressionDMContext frameCtxProvider,
+ final ExpressionInfo[][] realChildren, final int position, final RequestMonitor rm) {
- MIExpressionDMC fakeExprCtx = createExpressionCtx(frameCtxProvider,
- fakeChild.fExprInfo);
+ MIExpressionDMC fakeExprCtx = createExpressionCtx(frameCtxProvider, fakeChild.fExprInfo);
// This is just a qualifier level of C++, and we must get the
// children of this child to get the real children
- fakeChild.getChildren(fakeExprCtx,
- IMIExpressions.CHILD_COUNT_LIMIT_UNSPECIFIED,
- new DataRequestMonitor<ChildrenInfo>(
- fSession.getExecutor(), rm) {
+ fakeChild.getChildren(fakeExprCtx, IMIExpressions.CHILD_COUNT_LIMIT_UNSPECIFIED,
+ new DataRequestMonitor<ChildrenInfo>(fSession.getExecutor(), rm) {
@Override
protected void handleCompleted() {
if (isSuccess()) {
- realChildren[position] = getData()
- .getChildren();
+ realChildren[position] = getData().getChildren();
// Fake nodes can never be dynamic varobjs, and because
// of this, hasMore is always false.
@@ -1781,10 +1858,10 @@ public class MIVariableManager implements ICommandControl {
* (*(struct 'namespace::testbase'*) this)
*/
private String buildDerivedChildExpression(String parentExp, String childExpr) {
-
+
final String CAST_PREFIX = "struct "; //$NON-NLS-1$
-
- // Before doing the cast, let's surround the child expression (base class name) with quotes
+
+ // Before doing the cast, let's surround the child expression (base class name) with quotes
// if it contains a :: which indicates a namespace
String childNameForCast = childExpr.contains("::") ? "'" + childExpr + "'" : childExpr; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
String childFullExpression;
@@ -1795,14 +1872,14 @@ public class MIVariableManager implements ICommandControl {
// casting to base class
childFullExpression = "(" + CAST_PREFIX + childNameForCast + ")" + parentExp;//$NON-NLS-1$ //$NON-NLS-2$
}
-
+
return childFullExpression;
}
-
+
/**
* This method builds a child expression based on its parent's expression.
* It is a fallback solution for when GDB doesn't support the var-info-path-expression.
- *
+ *
* This method does not take care of inherited classes such as
* class foo : bar {
* ...
@@ -1817,20 +1894,20 @@ public class MIVariableManager implements ICommandControl {
if (isAccessQualifier(fExprInfo.getRelExpr())) {
parentExp = getParent().getExpression();
}
-
+
// For pointers, the child expression is already contained in the parent,
// so we must simply prefix with *
- // See Bug219179 for more information.
+ // See Bug219179 for more information.
if (!isDynamic() && !fExprInfo.hasDynamicAncestor() && isPointer()) {
- childFullExpression = "*("+parentExp+")"; //$NON-NLS-1$//$NON-NLS-2$
+ childFullExpression = "*(" + parentExp + ")"; //$NON-NLS-1$//$NON-NLS-2$
} else {
// We must surround the parentExp with parentheses because it
// may be a casted expression.
- childFullExpression = "("+parentExp+")." + childExp; //$NON-NLS-1$ //$NON-NLS-2$
+ childFullExpression = "(" + parentExp + ")." + childExp; //$NON-NLS-1$ //$NON-NLS-2$
}
-
- // No need for a special case for arrays since we deal with arrays differently
- // and don't call this method for them
+
+ // No need for a special case for arrays since we deal with arrays differently
+ // and don't call this method for them
return childFullExpression;
}
@@ -1838,15 +1915,15 @@ public class MIVariableManager implements ICommandControl {
/**
* This method returns the count of children of the variable object
* passed as a parameter.
- *
+ *
* @param exprDmc
- *
+ *
* @param numChildrenLimit
* No need to check for more than this number of children.
* However, it is legal to return a higher count if
* we already new from earlier call that there are more
* children.
- *
+ *
* @param rm
* The data request monitor that will hold the count of
* children returned
@@ -1854,29 +1931,25 @@ public class MIVariableManager implements ICommandControl {
*/
protected void getChildrenCount(IExpressionDMContext exprDmc, final int numChildrenLimit,
final DataRequestMonitor<ChildrenCountInfo> rm) {
- if (isNumChildrenHintTrustworthy()){
+ if (isNumChildrenHintTrustworthy()) {
rm.setData(new ChildrenCountInfo(getNumChildrenHint(), hasMore()));
rm.done();
return;
}
-
- getChildren(exprDmc, numChildrenLimit,
- new DataRequestMonitor<ChildrenInfo>(fSession.getExecutor(), rm) {
+
+ getChildren(exprDmc, numChildrenLimit, new DataRequestMonitor<ChildrenInfo>(fSession.getExecutor(), rm) {
@Override
protected void handleSuccess() {
- rm.setData(new ChildrenCountInfo(getData()
- .getChildren().length, getData().hasMore()));
+ rm.setData(new ChildrenCountInfo(getData().getChildren().length, getData().hasMore()));
rm.done();
}
});
}
-
-
- /**
+ /**
* This method request the back-end to change the value of the variable object.
- *
+ *
* @param value
* The new value.
* @param formatId
@@ -1888,68 +1961,63 @@ public class MIVariableManager implements ICommandControl {
// If the variable is a complex structure (including an array), then we cannot write to it
if (isComplex()) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.REQUEST_FAILED,
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.REQUEST_FAILED,
"Cannot change the value of a complex expression", null)); //$NON-NLS-1$
rm.done();
return;
- }
-
+ }
+
// First deal with the format. For GDB, the way to specify a format is to prefix the value with
// 0x for hex, 0 for octal etc So we need to make sure that 'value' has this prefix.
// Note that there is no way to specify a binary format for GDB up to and including
- // GDB 6.7.1, so we convert 'value' into a decimal format.
+ // GDB 6.7.1, so we convert 'value' into a decimal format.
// If the formatId is NATURAL, we do nothing for now because it is more complicated.
// For example for a bool, a value of "true" is correct and should be left as is,
// but for a pointer a value of 16 should be sent to GDB as 0x16. To figure this out,
// we need to know the type of the variable, which we don't have yet.
-
+
if (formatId.equals(IFormattedValues.HEX_FORMAT)) {
- if (!value.startsWith("0x")) { //$NON-NLS-1$
- value = "0x" + value; //$NON-NLS-1$
+ if (!value.startsWith("0x")) { //$NON-NLS-1$
+ value = "0x" + value; //$NON-NLS-1$
}
- }
- else if (formatId.equals(IFormattedValues.OCTAL_FORMAT)) {
- if (!value.startsWith("0")) { //$NON-NLS-1$
- value = "0" + value; //$NON-NLS-1$
+ } else if (formatId.equals(IFormattedValues.OCTAL_FORMAT)) {
+ if (!value.startsWith("0")) { //$NON-NLS-1$
+ value = "0" + value; //$NON-NLS-1$
}
- }
- else if (formatId.equals(IFormattedValues.BINARY_FORMAT)) {
+ } else if (formatId.equals(IFormattedValues.BINARY_FORMAT)) {
// convert from binary to decimal
- if (value.startsWith("0b")) { //$NON-NLS-1$
+ if (value.startsWith("0b")) { //$NON-NLS-1$
value = value.substring(2, value.length());
}
try {
- value = new BigInteger(value, 2).toString();
+ value = new BigInteger(value, 2).toString();
} catch (NumberFormatException e) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_HANDLE,
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_HANDLE,
"Invalid binary number: " + value, e)); //$NON-NLS-1$
rm.done();
return;
}
-
+
formatId = IFormattedValues.DECIMAL_FORMAT;
- }
- else if (formatId.equals(IFormattedValues.DECIMAL_FORMAT)) {
+ } else if (formatId.equals(IFormattedValues.DECIMAL_FORMAT)) {
// nothing to do
- }
- else if (formatId.equals(IFormattedValues.NATURAL_FORMAT)) {
+ } else if (formatId.equals(IFormattedValues.NATURAL_FORMAT)) {
// we do nothing for now and let the user have put in the proper value
- }
- else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_HANDLE,
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_HANDLE,
"Unknown format: " + formatId, null)); //$NON-NLS-1$
rm.done();
return;
}
-
+
// If the value has not changed, no need to set it.
// Return a warning status so that handleSuccess is not called and we don't send
// an ExpressionChanged event
if (value.equals(getValue(formatId))) {
- rm.setStatus(new Status(IStatus.WARNING, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED,
+ rm.setStatus(new Status(IStatus.WARNING, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED,
"Setting to the same value of: " + value, null)); //$NON-NLS-1$
rm.done();
- return;
+ return;
}
// No need to be in ready state or to lock the object
@@ -1961,25 +2029,25 @@ public class MIVariableManager implements ICommandControl {
// We must also mark all variable objects
// as out-of-date. This is because some variable objects may be affected
// by this one having changed.
- // e.g.,
- // int i;
+ // e.g.,
+ // int i;
// int* pi = &i;
// Here, if 'i' is changed by the user, then 'pi' will also change
// Since there is no way to know this unless we keep track of all addresses,
// we must mark everything as out-of-date. See bug 213061
markAllOutOfDate();
-
+
// Useless since we just marked everything as out-of-date
// resetValues(getData().getValue());
-
+
rm.done();
}
});
}
private boolean isAccessQualifier(String str) {
- return str.equals("private") || str.equals("public") || str.equals("protected"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
+ return str.equals("private") || str.equals("public") || str.equals("protected"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
/**
* @return If true, this variable object can be reported as changed in
@@ -1995,20 +2063,20 @@ public class MIVariableManager implements ICommandControl {
/**
* @param exprCtx
* @param rm
- *
+ *
* @since 4.0
*/
- public void create(final IExpressionDMContext exprCtx,
- final RequestMonitor rm) {
+ public void create(final IExpressionDMContext exprCtx, final RequestMonitor rm) {
if (currentState == STATE_NOT_CREATED) {
currentState = STATE_CREATING;
-
+
final MIExpressionDMC miExprCtx = (MIExpressionDMC) exprCtx;
final int indexInParent = miExprCtx.getExpressionInfo().getIndexInParentExpression();
- fCommandControl.queueCommand(fCommandFactory.createMIVarListChildren(getParent().getRootToUpdate().getControlDMContext(),
+ fCommandControl.queueCommand(
+ fCommandFactory.createMIVarListChildren(getParent().getRootToUpdate().getControlDMContext(),
getParent().getGdbName(), indexInParent, indexInParent + 1),
new DataRequestMonitor<MIVarListChildrenInfo>(fSession.getExecutor(), rm) {
@@ -2016,25 +2084,27 @@ public class MIVariableManager implements ICommandControl {
protected void handleSuccess() {
if (getData().getMIVars().length == 1) {
MIVar miVar = getData().getMIVars()[0];
-
+
ExpressionInfo localExprInfo = miExprCtx.getExpressionInfo();
-
+
localExprInfo.setDynamic(miVar.isDynamic());
-
+
initFrom(miVar, localExprInfo);
- if (fExprInfo.isDynamic()
- && (fExprInfo.getChildCountLimit() != IMIExpressions.CHILD_COUNT_LIMIT_UNSPECIFIED)) {
+ if (fExprInfo.isDynamic() && (fExprInfo
+ .getChildCountLimit() != IMIExpressions.CHILD_COUNT_LIMIT_UNSPECIFIED)) {
// Restore the original update range.
- fCommandControl.queueCommand(fCommandFactory.createMIVarSetUpdateRange(
- getRootToUpdate().getControlDMContext(),
- getGdbName(), 0, fExprInfo.getChildCountLimit()),
+ fCommandControl.queueCommand(
+ fCommandFactory.createMIVarSetUpdateRange(
+ getRootToUpdate().getControlDMContext(), getGdbName(), 0,
+ fExprInfo.getChildCountLimit()),
new DataRequestMonitor<MIInfo>(fSession.getExecutor(), rm));
} else {
rm.done();
}
} else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR,
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
+ IDsfStatusConstants.INTERNAL_ERROR,
"Unexpected return on -var-list-children", null)); //$NON-NLS-1$
rm.done();
}
@@ -2049,19 +2119,14 @@ public class MIVariableManager implements ICommandControl {
// Possible Optimization in GDB: In -var-list-children, the has_more
// field is missing for the children. As a workaround, we assume that
// if numChild is 0 and has_more is omitted, we have more children.
- boolean newHasMore = miVar.hasMore()
- || (miVar.isDynamic() && (miVar.getNumChild() == 0));
-
+ boolean newHasMore = miVar.hasMore() || (miVar.isDynamic() && (miVar.getNumChild() == 0));
+
assert miVar.getRawFields() != null;
fRaw = miVar.getRawFields();
setGdbName(miVar.getVarName());
setDisplayHint(miVar.getDisplayHint());
- setExpressionData(
- newExprInfo,
- miVar.getType(),
- miVar.getNumChild(),
- newHasMore);
+ setExpressionData(newExprInfo, miVar.getType(), miVar.getNumChild(), newHasMore);
// This will replace any existing entry
lruVariableList.put(getInternalId(), this);
@@ -2072,42 +2137,42 @@ public class MIVariableManager implements ICommandControl {
}
}
}
-
+
/**
* Method to allow to override the MIVariableObject creation
- *
- * @since 3.0
- */
+ *
+ * @since 3.0
+ */
protected MIVariableObject createVariableObject(VariableObjectId id, MIVariableObject parentObj) {
- return new MIVariableObject(id, parentObj);
+ return new MIVariableObject(id, parentObj);
}
/**
* Method to allow to override the MIVariableObject creation
- *
- * @since 4.0
+ *
+ * @since 4.0
*/
- protected MIVariableObject createVariableObject(VariableObjectId id,
- MIVariableObject parentObj, boolean needsCreation) {
+ protected MIVariableObject createVariableObject(VariableObjectId id, MIVariableObject parentObj,
+ boolean needsCreation) {
return new MIVariableObject(id, parentObj, needsCreation);
}
/**
- * @since 3.0
- */
+ * @since 3.0
+ */
public class MIRootVariableObject extends MIVariableObject {
// The control context within which this variable object was created
// It only needs to be stored in the Root VarObj since any children
// will have the same control context
- private ICommandControlDMContext fControlContext = null;
-
+ private ICommandControlDMContext fControlContext = null;
+
private boolean fOutOfDate = false;
-
+
/**
- * A modifiable descendant is any variable object that is a descendant and
- * for which the value (leaf variable objects and dynamic variable objects)
- * or number of children (dynamic variable objects) can change.
+ * A modifiable descendant is any variable object that is a descendant and
+ * for which the value (leaf variable objects and dynamic variable objects)
+ * or number of children (dynamic variable objects) can change.
*/
private Map<String, MIVariableObject> modifiableDescendants;
@@ -2117,40 +2182,48 @@ public class MIVariableManager implements ICommandControl {
modifiableDescendants = new HashMap<String, MIVariableObject>();
}
- public ICommandControlDMContext getControlDMContext() { return fControlContext; }
+ public ICommandControlDMContext getControlDMContext() {
+ return fControlContext;
+ }
+
+ public boolean isUpdating() {
+ return currentState == STATE_UPDATING;
+ }
+
+ public void setOutOfDate(boolean outOfDate) {
+ fOutOfDate = outOfDate;
+ }
+
+ public boolean getOutOfDate() {
+ return fOutOfDate;
+ }
- public boolean isUpdating() { return currentState == STATE_UPDATING; }
-
- public void setOutOfDate(boolean outOfDate) { fOutOfDate = outOfDate; }
-
- public boolean getOutOfDate() { return fOutOfDate; }
-
// Remember that we must add ourself as a modifiable descendant if our value can change
public void addModifiableDescendant(String gdbName, MIVariableObject descendant) {
modifiableDescendants.put(gdbName, descendant);
}
-
+
/**
* Removes the descendant with the specified name from the collection of
* modifiable descendants. Does nothing if there is no child with such
* name.
- *
+ *
* @since 4.1
*/
public void removeModifiableDescendant(String gdbName) {
modifiableDescendants.remove(gdbName);
}
-
+
/**
* @since 4.0
*/
public void processChanges(MIVarChange[] updates, RequestMonitor rm) {
CountingRequestMonitor countingRm = new CountingRequestMonitor(fSession.getExecutor(), rm);
countingRm.setDoneCount(updates.length);
-
+
for (MIVarChange update : updates) {
MIVariableObject descendant = modifiableDescendants.get(update.getVarName());
-
+
// Descendant should never be null, but just to be safe
if (descendant != null) {
descendant.processChange(update, countingRm);
@@ -2162,82 +2235,76 @@ public class MIVariableManager implements ICommandControl {
}
}
}
-
+
@Override
- public void create(final IExpressionDMContext exprCtx,
- final RequestMonitor rm) {
+ public void create(final IExpressionDMContext exprCtx, final RequestMonitor rm) {
if (currentState == STATE_NOT_CREATED) {
-
+
currentState = STATE_CREATING;
fControlContext = DMContexts.getAncestorOfType(exprCtx, ICommandControlDMContext.class);
- fCommandControl.queueCommand(
- fCommandFactory.createMIVarCreate(exprCtx, exprCtx.getExpression()),
+ fCommandControl.queueCommand(fCommandFactory.createMIVarCreate(exprCtx, exprCtx.getExpression()),
new DataRequestMonitor<MIVarCreateInfo>(fSession.getExecutor(), rm) {
@Override
protected void handleCompleted() {
if (isSuccess()) {
setGdbName(getData().getName());
setDisplayHint(getData().getDisplayHint());
-
+
MIExpressionDMC miExprCtx = (MIExpressionDMC) exprCtx;
- ExpressionInfo localExprInfo = miExprCtx
- .getExpressionInfo();
-
- localExprInfo.setDynamic(getData()
- .isDynamic());
-
+ ExpressionInfo localExprInfo = miExprCtx.getExpressionInfo();
+
+ localExprInfo.setDynamic(getData().isDynamic());
+
// Do not initialize the parent or indexInParent, since they may
// already be set to something. This will happen for arrays.
// Their default values are ok for other cases i.e., null and -1
// bug 420366
- setExpressionData(
- localExprInfo,
- getData().getType(),
- getData().getNumChildren(),
+ setExpressionData(localExprInfo, getData().getType(), getData().getNumChildren(),
getData().hasMore());
-
+
// Store the value returned at create (available in GDB 6.7)
// Don't store if it is an array, since we want to show
// the address of an array as its value
- if (getData().getValue() != null && !isArray()) {
+ if (getData().getValue() != null && !isArray()) {
setValue(getCurrentFormat(), getData().getValue());
}
-
+
// If we are modifiable, we should be in our modifiable list
if (isModifiable()) {
addModifiableDescendant(getData().getName(), MIRootVariableObject.this);
}
- if (localExprInfo.isDynamic()
- && (localExprInfo.getChildCountLimit() != IMIExpressions.CHILD_COUNT_LIMIT_UNSPECIFIED)) {
-
+ if (localExprInfo.isDynamic() && (localExprInfo
+ .getChildCountLimit() != IMIExpressions.CHILD_COUNT_LIMIT_UNSPECIFIED)) {
+
// Restore the original update range.
- fCommandControl.queueCommand(fCommandFactory.createMIVarSetUpdateRange(
- getRootToUpdate().getControlDMContext(),getGdbName(),
- 0,localExprInfo.getChildCountLimit()),
+ fCommandControl.queueCommand(
+ fCommandFactory.createMIVarSetUpdateRange(
+ getRootToUpdate().getControlDMContext(), getGdbName(), 0,
+ localExprInfo.getChildCountLimit()),
new DataRequestMonitor<MIInfo>(fSession.getExecutor(), rm));
} else {
rm.done();
- }
+ }
} else {
rm.setStatus(getStatus());
rm.done();
- }
+ }
}
});
} else {
assert false;
}
}
-
+
@Override
public void update(final DataRequestMonitor<Boolean> rm) {
if (isOutOfScope()) {
- rm.setData(false);
+ rm.setData(false);
rm.done();
} else if (currentState != STATE_READY) {
// Object is not fully created or is being updated
@@ -2261,7 +2328,7 @@ public class MIVariableManager implements ICommandControl {
// To solve this, we always do an update in the natural format; I am not aware
// of any case where the natural format would stay the same, but another format
// would change. However, since a var-update update all children as well,
- // we must make sure these children are also in the natural format
+ // we must make sure these children are also in the natural format
// The simplest way to do this is that whenever we change the format
// of a variable object, we immediately set it back to natural with a second
// var-set-format command. This is done in the getValue() method
@@ -2272,26 +2339,26 @@ public class MIVariableManager implements ICommandControl {
protected void handleCompleted() {
if (isSuccess()) {
setOutOfDate(false);
-
+
MIVarChange[] changes = getData().getMIVarChanges();
if (changes.length > 0 && !changes[0].isInScope()) {
// Object is out-of-scope
currentState = STATE_READY;
outOfScope = true;
-
+
// We can delete this root in GDB right away. This is safe, even
- // if the root has children, because they are also out-of-scope.
+ // if the root has children, because they are also out-of-scope.
// We -must- also remove this entry from our LRU. If we don't
// we can end-up with a race condition that create this object
// twice, or have an infinite loop while never re-creating the object.
- // The can happen if we update a child first then we request
+ // The can happen if we update a child first then we request
// the root later,
lruVariableList.remove(getInternalId());
rm.setData(true);
rm.done();
-
+
while (!updatesPending.isEmpty()) {
DataRequestMonitor<Boolean> pendingRm = updatesPending.poll();
pendingRm.setData(false);
@@ -2327,7 +2394,7 @@ public class MIVariableManager implements ICommandControl {
}
};
});
- }
+ }
} else {
// We were not able to update for some reason
currentState = STATE_READY;
@@ -2343,57 +2410,57 @@ public class MIVariableManager implements ICommandControl {
}
}
});
- }
+ }
}
/**
* This method request the back-end to delete a variable object.
* We check if the GDB name has been filled to confirm that this object
* was actually successfully created on the back-end.
- * Only root variable objects are deleted, while children are left in GDB
+ * Only root variable objects are deleted, while children are left in GDB
* to be deleted automatically when their root is deleted.
*/
@Override
- public void deleteInGdb() {
- if (getGdbName() != null) {
- fCommandControl.queueCommand(
- fCommandFactory.createMIVarDelete(getRootToUpdate().getControlDMContext(), getGdbName()),
- new DataRequestMonitor<MIVarDeleteInfo>(fSession.getExecutor(), null));
- // Nothing to do in the requestMonitor, since the object was already
- // removed from our list before calling this method.
-
- // Set the GDB name to null to make sure we don't attempt to delete
- // this variable a second time. This can happen if the LRU triggers
- // an automatic delete.
- setGdbName(null);
- } else {
- // Variable was never created or was already deleted, no need to do anything.
- }
-
+ public void deleteInGdb() {
+ if (getGdbName() != null) {
+ fCommandControl.queueCommand(
+ fCommandFactory.createMIVarDelete(getRootToUpdate().getControlDMContext(), getGdbName()),
+ new DataRequestMonitor<MIVarDeleteInfo>(fSession.getExecutor(), null));
+ // Nothing to do in the requestMonitor, since the object was already
+ // removed from our list before calling this method.
+
+ // Set the GDB name to null to make sure we don't attempt to delete
+ // this variable a second time. This can happen if the LRU triggers
+ // an automatic delete.
+ setGdbName(null);
+ } else {
+ // Variable was never created or was already deleted, no need to do anything.
+ }
+
super.deleteInGdb();
}
}
-
- /**
- * Method to allow to override the MIRootVariableObject creation.
+
+ /**
+ * Method to allow to override the MIRootVariableObject creation.
*
- * @since 3.0
- */
+ * @since 3.0
+ */
protected MIRootVariableObject createRootVariableObject(VariableObjectId id) {
- return new MIRootVariableObject(id);
+ return new MIRootVariableObject(id);
}
-
+
/**
* This class represents an unique identifier for a variable object.
- *
+ *
* The following must be considered to obtain a unique name:
* - the expression itself
- * - the execution context
+ * - the execution context
* - relative depth of frame based on the frame context and the total depth of the stack
- *
+ *
* Note that if no frameContext is specified (only Execution, or even only Container), which can
* characterize a global variable for example, we will only use the available information.
- *
+ *
* @since 3.0
*/
public class VariableObjectId {
@@ -2401,29 +2468,30 @@ public class MIVariableManager implements ICommandControl {
// See bug 187718. So we store the expression itself, and it's parent execution context.
private String fExpression = null;
private IExecutionDMContext fExecContext = null;
- // We need the depth of the frame. The frame level is not sufficient because
- // the same frame will have a different level based on the current depth of the stack
+ // We need the depth of the frame. The frame level is not sufficient because
+ // the same frame will have a different level based on the current depth of the stack
private Integer fFrameId = null;
-
+
public VariableObjectId() {
}
-
+
@Override
public boolean equals(Object other) {
if (other instanceof VariableObjectId) {
VariableObjectId otherId = (VariableObjectId) other;
- return (fExpression == null ? otherId.fExpression == null : fExpression.equals(otherId.fExpression)) &&
- (fExecContext == null ? otherId.fExecContext == null : fExecContext.equals(otherId.fExecContext)) &&
- (fFrameId == null ? otherId.fFrameId == null : fFrameId.equals(otherId.fFrameId));
+ return (fExpression == null ? otherId.fExpression == null : fExpression.equals(otherId.fExpression))
+ && (fExecContext == null ? otherId.fExecContext == null
+ : fExecContext.equals(otherId.fExecContext))
+ && (fFrameId == null ? otherId.fFrameId == null : fFrameId.equals(otherId.fFrameId));
}
return false;
}
@Override
public int hashCode() {
- return (fExpression == null ? 0 : fExpression.hashCode()) +
- (fExecContext == null ? 0 : fExecContext.hashCode()) +
- (fFrameId == null ? 0 : fFrameId.hashCode());
+ return (fExpression == null ? 0 : fExpression.hashCode())
+ + (fExecContext == null ? 0 : fExecContext.hashCode())
+ + (fFrameId == null ? 0 : fFrameId.hashCode());
}
public void generateId(IExpressionDMContext exprCtx, final RequestMonitor rm) {
@@ -2434,7 +2502,7 @@ public class MIVariableManager implements ICommandControl {
rm.done();
return;
}
-
+
final IFrameDMContext frameCtx = DMContexts.getAncestorOfType(exprCtx, IFrameDMContext.class);
if (frameCtx == null) {
rm.done();
@@ -2444,17 +2512,15 @@ public class MIVariableManager implements ICommandControl {
// We need the current stack depth to be able to make a unique and reproducible name
// for this expression. This is pretty efficient since the stackDepth will be retrieved
// from the StackService command cache after the first time.
- fStackService.getStackDepth(
- fExecContext, 0,
- new DataRequestMonitor<Integer>(fSession.getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- fFrameId = Integer.valueOf(getData() - frameCtx.getLevel());
- rm.done();
- }
- });
+ fStackService.getStackDepth(fExecContext, 0, new DataRequestMonitor<Integer>(fSession.getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ fFrameId = Integer.valueOf(getData() - frameCtx.getLevel());
+ rm.done();
+ }
+ });
}
-
+
public void generateId(String childFullExp, VariableObjectId parentId) {
// The execution context and the frame depth are the same as the parent
fExecContext = parentId.fExecContext;
@@ -2464,17 +2530,16 @@ public class MIVariableManager implements ICommandControl {
fExpression = childFullExp;
}
}
-
- /**
- * Method to allow to override the VariableObjectId creation.
+
+ /**
+ * Method to allow to override the VariableObjectId creation.
*
- * @since 3.0
- */
+ * @since 3.0
+ */
protected VariableObjectId createVariableObjectId() {
- return new VariableObjectId();
+ return new VariableObjectId();
}
-
/**
* This is the real work horse of managing our objects. Not only must every
* value be unique to get inserted, this also creates an LRU (least recently
@@ -2482,47 +2547,47 @@ public class MIVariableManager implements ICommandControl {
* make space. Removing means that a GDB request to delete the object is
* generated. We must also take into consideration the fact that GDB will
* automatically delete children of a variable object, when deleting the parent
- * variable object. Our solution to that is to tweak the LRU to make sure that
- * children are always older than their parents, to guarantee the children will
+ * variable object. Our solution to that is to tweak the LRU to make sure that
+ * children are always older than their parents, to guarantee the children will
* always be delete before their parents.
- *
+ *
*/
private static class LRUVariableCache extends LinkedHashMap<VariableObjectId, MIVariableObject> {
public static final long serialVersionUID = 0;
// Maximum allowed concurrent variables
private static final int MAX_VARIABLE_LIST = 1000;
-
+
public LRUVariableCache() {
- super(0, // Initial load capacity
- 0.75f, // Load factor as defined in JAVA 1.5
- true); // Order is dictated by access, not insertion
+ super(0, // Initial load capacity
+ 0.75f, // Load factor as defined in JAVA 1.5
+ true); // Order is dictated by access, not insertion
}
// We never remove doing put operations. Instead, we rely on our get() operations
// to trigger the remove. See bug 200897
@Override
public boolean removeEldestEntry(Map.Entry<VariableObjectId, MIVariableObject> eldest) {
- return false;
+ return false;
}
@Override
public MIVariableObject get(Object key) {
MIVariableObject varObj = super.get(key);
- touchAncestors(varObj);
-
- // If we're over our max size, attempt to remove eldest entry.
- if (size() > MAX_VARIABLE_LIST) {
- Map.Entry<VariableObjectId, MIVariableObject> eldest = entrySet().iterator().next();
- // First make sure we are not deleting ourselves!
- if (!eldest.getValue().equals(varObj) &&
- eldest.getValue().currentState == MIVariableObject.STATE_READY) {
- remove(eldest.getKey());
- }
- }
- return varObj;
- }
-
+ touchAncestors(varObj);
+
+ // If we're over our max size, attempt to remove eldest entry.
+ if (size() > MAX_VARIABLE_LIST) {
+ Map.Entry<VariableObjectId, MIVariableObject> eldest = entrySet().iterator().next();
+ // First make sure we are not deleting ourselves!
+ if (!eldest.getValue().equals(varObj)
+ && eldest.getValue().currentState == MIVariableObject.STATE_READY) {
+ remove(eldest.getKey());
+ }
+ }
+ return varObj;
+ }
+
private void touchAncestors(MIVariableObject varObj) {
while (varObj != null) {
varObj = varObj.getParent();
@@ -2533,16 +2598,16 @@ public class MIVariableManager implements ICommandControl {
}
}
- @Override
+ @Override
public MIVariableObject put(VariableObjectId key, MIVariableObject varObj) {
- MIVariableObject retVal = super.put(key, varObj);
+ MIVariableObject retVal = super.put(key, varObj);
- // Touch all parents of this element so as
- // to guarantee they are not deleted before their children.
- touchAncestors(varObj);
+ // Touch all parents of this element so as
+ // to guarantee they are not deleted before their children.
+ touchAncestors(varObj);
- return retVal;
- }
+ return retVal;
+ }
@Override
public MIVariableObject remove(Object key) {
@@ -2550,14 +2615,14 @@ public class MIVariableManager implements ICommandControl {
if (varObj != null) {
varObj.deleteInGdb();
}
- return varObj;
+ return varObj;
}
}
- private GDBTypeParser fGDBTypeParser = null;
-
+ private GDBTypeParser fGDBTypeParser = null;
+
private final DsfSession fSession;
-
+
/** Provides access to the GDB/MI back-end */
private final ICommandControl fCommandControl;
private CommandFactory fCommandFactory;
@@ -2569,103 +2634,99 @@ public class MIVariableManager implements ICommandControl {
private IExpressions fExpressionService;
// Typically, there will only be one listener, since only the ExpressionService will use this class
- private final List<ICommandListener> fCommandProcessors = new ArrayList<ICommandListener>();
-
+ private final List<ICommandListener> fCommandProcessors = new ArrayList<ICommandListener>();
+
/** Our least recently used cache */
private final LRUVariableCache lruVariableList;
-
+
/** The list of root variable objects that have been updated */
private final LinkedList<MIRootVariableObject> updatedRootList = new LinkedList<MIRootVariableObject>();
/**
* MIVariableManager constructor
- *
+ *
* @param session
* The session we are working with
* @param tracker
* The service tracker that can be used to find other services
*/
public MIVariableManager(DsfSession session, DsfServicesTracker tracker) {
- fSession = session;
+ fSession = session;
lruVariableList = new LRUVariableCache();
fCommandControl = tracker.getService(ICommandControl.class);
- fStackService = tracker.getService(IStack.class);
+ fStackService = tracker.getService(IStack.class);
fExpressionService = tracker.getService(IExpressions.class);
fCommandFactory = tracker.getService(IMICommandControl.class).getCommandFactory();
// Register to receive service events for this session.
- fSession.addServiceEventListener(this, null);
+ fSession.addServiceEventListener(this, null);
}
public void dispose() {
- fSession.removeServiceEventListener(this);
+ fSession.removeServiceEventListener(this);
}
- /**
- * @since 3.0
- */
+ /**
+ * @since 3.0
+ */
protected DsfSession getSession() {
- return fSession;
+ return fSession;
}
-
+
/**
- * @since 3.0
- */
+ * @since 3.0
+ */
protected ICommandControl getCommandControl() {
- return fCommandControl;
+ return fCommandControl;
}
-
- /**
- * @since 3.0
- */
+
+ /**
+ * @since 3.0
+ */
protected void rootVariableUpdated(MIRootVariableObject rootObj) {
- updatedRootList.add(rootObj);
+ updatedRootList.add(rootObj);
}
-
- /**
- * @since 3.0
- */
+
+ /**
+ * @since 3.0
+ */
protected Map<VariableObjectId, MIVariableObject> getLRUCache() {
return lruVariableList;
}
-
+
private GDBTypeParser getGDBTypeParser() {
if (fGDBTypeParser == null) {
fGDBTypeParser = createGDBTypeParser();
}
return fGDBTypeParser;
}
-
- /**
+
+ /**
* This method returns a variable object based on the specified
* ExpressionDMC, creating it in GDB if it was not created already.
* The method guarantees that the variable is finished creating and that
* is it not out-of-scope.
- *
+ *
* @param exprCtx
* The expression context to which the variable object is applied to.
- *
+ *
* @param rm
* The data request monitor that will contain the requested variable object
*/
- private void getVariable(final IExpressionDMContext exprCtx,
- final DataRequestMonitor<MIVariableObject> rm) {
+ private void getVariable(final IExpressionDMContext exprCtx, final DataRequestMonitor<MIVariableObject> rm) {
// Generate an id for this expression so that we can determine if we already
// have a variable object tracking it. If we don't we'll need to create one.
final VariableObjectId id = createVariableObjectId();
- id.generateId(
- exprCtx,
- new RequestMonitor(fSession.getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- getVariable(id, exprCtx, rm);
- }
- });
+ id.generateId(exprCtx, new RequestMonitor(fSession.getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ getVariable(id, exprCtx, rm);
+ }
+ });
}
- private void getVariable(final VariableObjectId id,
- final IExpressionDMContext exprCtx,
- final DataRequestMonitor<MIVariableObject> rm) {
+ private void getVariable(final VariableObjectId id, final IExpressionDMContext exprCtx,
+ final DataRequestMonitor<MIVariableObject> rm) {
final MIVariableObject varObj = lruVariableList.get(id);
@@ -2679,11 +2740,11 @@ public class MIVariableManager implements ICommandControl {
varObj.update(new DataRequestMonitor<Boolean>(fSession.getExecutor(), rm) {
@Override
protected void handleSuccess() {
-
+
boolean shouldCreateNew = getData().booleanValue();
-
+
if (varObj.isOutOfScope()) {
- // The variable object is out-of-scope and we
+ // The variable object is out-of-scope and we
// should not use it.
if (shouldCreateNew) {
/*
@@ -2693,14 +2754,14 @@ public class MIVariableManager implements ICommandControl {
* that expression. This can happen for example if two methods use the same name
* for a variable. In the case when we find that a varObject is out-of-scope (when
* its root is out-of-scope) the following should be done:
- *
- * - create a new varObject for the expression (as a root varObject) and insert it
- * in the LRU. Make sure that when creating children of this new varObject, they
- * will replace any old children with the same name in the LRU (this is ok since the
- * children being replaced are also out-of-scope).
+ *
+ * - create a new varObject for the expression (as a root varObject) and insert it
+ * in the LRU. Make sure that when creating children of this new varObject, they
+ * will replace any old children with the same name in the LRU (this is ok since the
+ * children being replaced are also out-of-scope).
*/
-
- createVariable(id, exprCtx, rm);
+
+ createVariable(id, exprCtx, rm);
} else {
// Just request the variable object again
// We must use this call to handle the fact that
@@ -2722,10 +2783,11 @@ public class MIVariableManager implements ICommandControl {
// and thus the parent-child relationship is not yet set.
// Set that relationship while keeping the relative expression of
// the original context (see bug 393930)
- miExprCtx.setExpressionInfo(new ExpressionInfo(miExprCtx.getExpression(), miExprCtx.getRelativeExpression(),
- varExprInfo.isDynamic(), varExprInfo.getParent(), varExprInfo.getIndexInParentExpression()));
+ miExprCtx.setExpressionInfo(new ExpressionInfo(miExprCtx.getExpression(),
+ miExprCtx.getRelativeExpression(), varExprInfo.isDynamic(), varExprInfo.getParent(),
+ varExprInfo.getIndexInParentExpression()));
}
-
+
rm.setData(varObj);
rm.done();
}
@@ -2734,60 +2796,54 @@ public class MIVariableManager implements ICommandControl {
}
}
-
-
/**
* This method creates a variable object in GDB.
*/
- private void createVariable(final VariableObjectId id,
- final IExpressionDMContext exprCtx,
- final DataRequestMonitor<MIVariableObject> rm) {
+ private void createVariable(final VariableObjectId id, final IExpressionDMContext exprCtx,
+ final DataRequestMonitor<MIVariableObject> rm) {
// If we have a dynamic variable object as ancestor, we cannot use
// -var-create, so we must create ourselves creating the root, and
// then use -var-list-children for each further ancestor.
- final MIExpressionDMC miExprCtx =(MIExpressionDMC) exprCtx;
+ final MIExpressionDMC miExprCtx = (MIExpressionDMC) exprCtx;
final ExpressionInfo parentInfo = miExprCtx.getExpressionInfo().getParent();
-
+
if ((parentInfo != null) && miExprCtx.getExpressionInfo().hasDynamicAncestor()) {
-
+
// Need to set parent when it is known.
final MIVariableObject newVarObj = createVariableObject(id, null, true);
- // We must put this object in our map right away, in case it is
+ // We must put this object in our map right away, in case it is
// requested again, before it completes its creation.
// Note that this will replace any old entry with the same id.
lruVariableList.put(id, newVarObj);
- MIExpressionDMC parentExprCtx = createExpressionCtx(exprCtx,
- parentInfo);
-
- getVariable(parentExprCtx,
- new DataRequestMonitor<MIVariableObject>(
- fSession.getExecutor(), rm) {
-
+ MIExpressionDMC parentExprCtx = createExpressionCtx(exprCtx, parentInfo);
+
+ getVariable(parentExprCtx, new DataRequestMonitor<MIVariableObject>(fSession.getExecutor(), rm) {
+
@Override
protected void handleCompleted() {
-
+
if (isSuccess()) {
final MIVariableObject parentObj = getData();
newVarObj.setParent(parentObj);
-
- newVarObj.create(miExprCtx, new RequestMonitor(fSession.getExecutor(), rm) {
+
+ newVarObj.create(miExprCtx, new RequestMonitor(fSession.getExecutor(), rm) {
@Override
protected void handleCompleted() {
- if (isSuccess()) {
+ if (isSuccess()) {
rm.setData(newVarObj);
newVarObj.creationCompleted(true);
} else {
// Object was not created, remove it from our list
lruVariableList.remove(id);
- // We avoid this race condition by sending the notifications _after_ removing
+ // We avoid this race condition by sending the notifications _after_ removing
// the object from the LRU, to avoid any new requests being queue.
// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=231655
newVarObj.creationCompleted(false);
- rm.setStatus(getStatus());
+ rm.setStatus(getStatus());
}
rm.done();
}
@@ -2795,35 +2851,35 @@ public class MIVariableManager implements ICommandControl {
} else {
// Object was not created, remove it from our list
lruVariableList.remove(id);
- // We avoid this race condition by sending the notifications _after_ removing
+ // We avoid this race condition by sending the notifications _after_ removing
// the object from the LRU, to avoid any new requests being queue.
// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=231655
newVarObj.creationCompleted(false);
-
+
rm.setStatus(getStatus());
rm.done();
}
}
});
-
+
return;
}
-
+
// Variable objects that are created directly like this, are considered ROOT variable objects
// in comparison to variable objects that are children of other variable objects.
final MIRootVariableObject newVarObj = createRootVariableObject(id);
-
- // We must put this object in our map right away, in case it is
+
+ // We must put this object in our map right away, in case it is
// requested again, before it completes its creation.
// Note that this will replace any old entry with the same id.
lruVariableList.put(id, newVarObj);
-
+
newVarObj.create(exprCtx, new RequestMonitor(fSession.getExecutor(), rm) {
@Override
protected void handleCompleted() {
if (isSuccess()) {
// Also store the object as a varObj that is up-to-date
- rootVariableUpdated(newVarObj);
+ rootVariableUpdated(newVarObj);
// VarObj can now be used by others
newVarObj.creationCompleted(true);
@@ -2836,11 +2892,11 @@ public class MIVariableManager implements ICommandControl {
// It is important to do this call after we have removed the id
// from our LRU; this is to avoid the following:
// The same varObj is requested before it was removed from the LRU
- // but after we called creationCompleted().
- // In this case, the request for this varObj would be queued, but
+ // but after we called creationCompleted().
+ // In this case, the request for this varObj would be queued, but
// since creationCompleted() already sent the notifications
// the newly queue request will never get serviced.
- // We avoid this race condition by sending the notifications _after_ removing
+ // We avoid this race condition by sending the notifications _after_ removing
// the object from the LRU, to avoid any new requests being queue.
// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=231655
newVarObj.creationCompleted(false);
@@ -2852,21 +2908,19 @@ public class MIVariableManager implements ICommandControl {
});
}
- private MIExpressionDMC createExpressionCtx(
- final IExpressionDMContext frameCtxProvider,
+ private MIExpressionDMC createExpressionCtx(final IExpressionDMContext frameCtxProvider,
final ExpressionInfo exprInfo) {
-
+
IFrameDMContext frameCtx = DMContexts.getAncestorOfType(frameCtxProvider, IFrameDMContext.class);
- MIExpressionDMC exprCtx = new MIExpressionDMC(
- frameCtxProvider.getSessionId(), exprInfo, frameCtx);
+ MIExpressionDMC exprCtx = new MIExpressionDMC(frameCtxProvider.getSessionId(), exprInfo, frameCtx);
return exprCtx;
}
- /**
+ /**
* This method requests the back-end to change the value of an expression.
- *
+ *
* @param ctx
* The context of the expression we want to change
* @param expressionValue
@@ -2877,311 +2931,293 @@ public class MIVariableManager implements ICommandControl {
* The request monitor to indicate the operation is finished
*/
// This method can be called directly from the ExpressionService, since it cannot be cached
- public void writeValue(final IExpressionDMContext ctx, final String expressionValue,
- final String formatId, final RequestMonitor rm) {
-
- getVariable(
- ctx,
- new DataRequestMonitor<MIVariableObject>(fSession.getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- getData().writeValue(expressionValue, formatId, rm);
- }
- });
+ public void writeValue(final IExpressionDMContext ctx, final String expressionValue, final String formatId,
+ final RequestMonitor rm) {
+
+ getVariable(ctx, new DataRequestMonitor<MIVariableObject>(fSession.getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ getData().writeValue(expressionValue, formatId, rm);
+ }
+ });
}
@Override
- public <V extends ICommandResult> ICommandToken queueCommand(final ICommand<V> command, DataRequestMonitor<V> rm) {
-
- final ICommandToken token = new ICommandToken() {
- @Override
- public ICommand<? extends ICommandResult> getCommand() {
- return command;
- }
- };
-
- // The MIVariableManager does not buffer commands itself, but sends them directly to the real
- // MICommandControl service. Therefore, we must immediately tell our calling cache that the command
- // has been sent, since we can never cancel it. Note that this removes any option of coalescing,
- // but coalescing was not applicable to variableObjects anyway.
- processCommandSent(token);
-
- if (command instanceof ExprMetaGetVar) {
- @SuppressWarnings("unchecked")
- final DataRequestMonitor<ExprMetaGetVarInfo> drm = (DataRequestMonitor<ExprMetaGetVarInfo>)rm;
- final MIExpressionDMC exprCtx = (MIExpressionDMC)(command.getContext());
-
- getVariable(
- exprCtx,
- new DataRequestMonitor<MIVariableObject>(fSession.getExecutor(), drm) {
- @Override
- protected void handleSuccess() {
- final MIVariableObject varObj = getData();
-
- if (varObj.isDynamic() && (varObj.getNumChildrenHint() == 0) && varObj.hasMore()) {
- // Bug/feature in gdb? MI sometimes reports 0 number of children, and hasMore=1.
- // This however, is not a safe indicator that there are children,
- // unless there has been a -var-list-children before.
- // The following call will
- // 1) try to fetch at least one child, because isNumChildrenHintTrustworthy()
- // returns false for this combination
- // 2) result in the desired -var-list-children, unless it has happened already
- // such that the number of children can at least be used to reliably
- // tell whether there are children or not.
- varObj.getChildrenCount(
- exprCtx, 1,
- new DataRequestMonitor<ChildrenCountInfo>(fSession.getExecutor(), drm) {
- @Override
- protected void handleSuccess() {
- drm.setData(
- new ExprMetaGetVarInfo(
- exprCtx.getRelativeExpression(),
- varObj,
- getData().getChildrenCount()));
- drm.done();
- processCommandDone(token, drm.getData());
- }
- });
- } else {
- drm.setData(
- new ExprMetaGetVarInfo(
- exprCtx.getRelativeExpression(),
- varObj));
- drm.done();
- processCommandDone(token, drm.getData());
- }
- }
- });
- } else if (command instanceof ExprMetaGetAttributes) {
- @SuppressWarnings("unchecked")
- final DataRequestMonitor<ExprMetaGetAttributesInfo> drm = (DataRequestMonitor<ExprMetaGetAttributesInfo>)rm;
- final IExpressionDMContext exprCtx = (IExpressionDMContext)(command.getContext());
-
- getVariable(
- exprCtx,
- new DataRequestMonitor<MIVariableObject>(fSession.getExecutor(), drm) {
- @Override
- protected void handleSuccess() {
- getData().getAttributes(
- new DataRequestMonitor<Boolean>(fSession.getExecutor(), drm) {
- @Override
- protected void handleSuccess() {
- drm.setData(new ExprMetaGetAttributesInfo(getData()));
- drm.done();
- processCommandDone(token, drm.getData());
- }
- });
- }
- });
-
-
- } else if (command instanceof ExprMetaGetValue) {
- @SuppressWarnings("unchecked")
- final DataRequestMonitor<ExprMetaGetValueInfo> drm = (DataRequestMonitor<ExprMetaGetValueInfo>)rm;
- final FormattedValueDMContext valueCtx = (FormattedValueDMContext)(command.getContext());
- final IExpressionDMContext exprCtx = DMContexts.getAncestorOfType(valueCtx, IExpressionDMContext.class);
-
- getVariable(
- exprCtx,
- new DataRequestMonitor<MIVariableObject>(fSession.getExecutor(), drm) {
- @Override
- protected void handleSuccess() {
- getData().getValue(
- valueCtx,
- new DataRequestMonitor<FormattedValueDMData>(fSession.getExecutor(), drm) {
- @Override
- protected void handleSuccess() {
- drm.setData(
- new ExprMetaGetValueInfo(getData().getFormattedValue()));
- drm.done();
- processCommandDone(token, drm.getData());
- }
- });
- }
- });
-
- } else if (command instanceof ExprMetaGetChildren) {
- @SuppressWarnings("unchecked")
- final DataRequestMonitor<ExprMetaGetChildrenInfo> drm = (DataRequestMonitor<ExprMetaGetChildrenInfo>)rm;
- final MIExpressionDMC exprCtx = (MIExpressionDMC)(command.getContext());
-
- getVariable(
- exprCtx,
- new DataRequestMonitor<MIVariableObject>(fSession.getExecutor(), drm) {
- @Override
- protected void handleSuccess() {
- getData().getChildren(exprCtx, ((ExprMetaGetChildren)command).getNumChildLimit(),
- new DataRequestMonitor<ChildrenInfo>(fSession.getExecutor(), drm) {
- @Override
- protected void handleSuccess() {
- drm.setData(new ExprMetaGetChildrenInfo(
- getData().getChildren()));
- drm.done();
- processCommandDone(token, drm.getData());
- }
- });
- }
- });
-
- } else if (command instanceof ExprMetaGetChildCount) {
- @SuppressWarnings("unchecked")
- final DataRequestMonitor<ExprMetaGetChildCountInfo> drm = (DataRequestMonitor<ExprMetaGetChildCountInfo>)rm;
- final MIExpressionDMC exprCtx = (MIExpressionDMC)(command.getContext());
-
- getVariable(
- exprCtx,
- new DataRequestMonitor<MIVariableObject>(fSession.getExecutor(), drm) {
- @Override
- protected void handleSuccess() {
-
- getData().getChildrenCount(
- exprCtx, ((ExprMetaGetChildCount) command).getNumChildLimit(),
- new DataRequestMonitor<ChildrenCountInfo>(fSession.getExecutor(), drm) {
- @Override
- protected void handleSuccess() {
- drm.setData(new ExprMetaGetChildCountInfo(
- getData().getChildrenCount()));
- drm.done();
- processCommandDone(token, drm.getData());
- }
- });
- }
- });
-
- } else if (command instanceof MIDataEvaluateExpression<?>) {
- // This does not use the variable objects but sends the command directly to the back-end
+ public <V extends ICommandResult> ICommandToken queueCommand(final ICommand<V> command, DataRequestMonitor<V> rm) {
+
+ final ICommandToken token = new ICommandToken() {
+ @Override
+ public ICommand<? extends ICommandResult> getCommand() {
+ return command;
+ }
+ };
+
+ // The MIVariableManager does not buffer commands itself, but sends them directly to the real
+ // MICommandControl service. Therefore, we must immediately tell our calling cache that the command
+ // has been sent, since we can never cancel it. Note that this removes any option of coalescing,
+ // but coalescing was not applicable to variableObjects anyway.
+ processCommandSent(token);
+
+ if (command instanceof ExprMetaGetVar) {
+ @SuppressWarnings("unchecked")
+ final DataRequestMonitor<ExprMetaGetVarInfo> drm = (DataRequestMonitor<ExprMetaGetVarInfo>) rm;
+ final MIExpressionDMC exprCtx = (MIExpressionDMC) (command.getContext());
+
+ getVariable(exprCtx, new DataRequestMonitor<MIVariableObject>(fSession.getExecutor(), drm) {
+ @Override
+ protected void handleSuccess() {
+ final MIVariableObject varObj = getData();
+
+ if (varObj.isDynamic() && (varObj.getNumChildrenHint() == 0) && varObj.hasMore()) {
+ // Bug/feature in gdb? MI sometimes reports 0 number of children, and hasMore=1.
+ // This however, is not a safe indicator that there are children,
+ // unless there has been a -var-list-children before.
+ // The following call will
+ // 1) try to fetch at least one child, because isNumChildrenHintTrustworthy()
+ // returns false for this combination
+ // 2) result in the desired -var-list-children, unless it has happened already
+ // such that the number of children can at least be used to reliably
+ // tell whether there are children or not.
+ varObj.getChildrenCount(exprCtx, 1,
+ new DataRequestMonitor<ChildrenCountInfo>(fSession.getExecutor(), drm) {
+ @Override
+ protected void handleSuccess() {
+ drm.setData(new ExprMetaGetVarInfo(exprCtx.getRelativeExpression(), varObj,
+ getData().getChildrenCount()));
+ drm.done();
+ processCommandDone(token, drm.getData());
+ }
+ });
+ } else {
+ drm.setData(new ExprMetaGetVarInfo(exprCtx.getRelativeExpression(), varObj));
+ drm.done();
+ processCommandDone(token, drm.getData());
+ }
+ }
+ });
+ } else if (command instanceof ExprMetaGetAttributes) {
+ @SuppressWarnings("unchecked")
+ final DataRequestMonitor<ExprMetaGetAttributesInfo> drm = (DataRequestMonitor<ExprMetaGetAttributesInfo>) rm;
+ final IExpressionDMContext exprCtx = (IExpressionDMContext) (command.getContext());
+
+ getVariable(exprCtx, new DataRequestMonitor<MIVariableObject>(fSession.getExecutor(), drm) {
+ @Override
+ protected void handleSuccess() {
+ getData().getAttributes(new DataRequestMonitor<Boolean>(fSession.getExecutor(), drm) {
+ @Override
+ protected void handleSuccess() {
+ drm.setData(new ExprMetaGetAttributesInfo(getData()));
+ drm.done();
+ processCommandDone(token, drm.getData());
+ }
+ });
+ }
+ });
+
+ } else if (command instanceof ExprMetaGetValue) {
+ @SuppressWarnings("unchecked")
+ final DataRequestMonitor<ExprMetaGetValueInfo> drm = (DataRequestMonitor<ExprMetaGetValueInfo>) rm;
+ final FormattedValueDMContext valueCtx = (FormattedValueDMContext) (command.getContext());
+ final IExpressionDMContext exprCtx = DMContexts.getAncestorOfType(valueCtx, IExpressionDMContext.class);
+
+ getVariable(exprCtx, new DataRequestMonitor<MIVariableObject>(fSession.getExecutor(), drm) {
+ @Override
+ protected void handleSuccess() {
+ getData().getValue(valueCtx,
+ new DataRequestMonitor<FormattedValueDMData>(fSession.getExecutor(), drm) {
+ @Override
+ protected void handleSuccess() {
+ drm.setData(new ExprMetaGetValueInfo(getData().getFormattedValue()));
+ drm.done();
+ processCommandDone(token, drm.getData());
+ }
+ });
+ }
+ });
+
+ } else if (command instanceof ExprMetaGetChildren) {
+ @SuppressWarnings("unchecked")
+ final DataRequestMonitor<ExprMetaGetChildrenInfo> drm = (DataRequestMonitor<ExprMetaGetChildrenInfo>) rm;
+ final MIExpressionDMC exprCtx = (MIExpressionDMC) (command.getContext());
+
+ getVariable(exprCtx, new DataRequestMonitor<MIVariableObject>(fSession.getExecutor(), drm) {
+ @Override
+ protected void handleSuccess() {
+ getData().getChildren(exprCtx, ((ExprMetaGetChildren) command).getNumChildLimit(),
+ new DataRequestMonitor<ChildrenInfo>(fSession.getExecutor(), drm) {
+ @Override
+ protected void handleSuccess() {
+ drm.setData(new ExprMetaGetChildrenInfo(getData().getChildren()));
+ drm.done();
+ processCommandDone(token, drm.getData());
+ }
+ });
+ }
+ });
+
+ } else if (command instanceof ExprMetaGetChildCount) {
+ @SuppressWarnings("unchecked")
+ final DataRequestMonitor<ExprMetaGetChildCountInfo> drm = (DataRequestMonitor<ExprMetaGetChildCountInfo>) rm;
+ final MIExpressionDMC exprCtx = (MIExpressionDMC) (command.getContext());
+
+ getVariable(exprCtx, new DataRequestMonitor<MIVariableObject>(fSession.getExecutor(), drm) {
+ @Override
+ protected void handleSuccess() {
+
+ getData().getChildrenCount(exprCtx, ((ExprMetaGetChildCount) command).getNumChildLimit(),
+ new DataRequestMonitor<ChildrenCountInfo>(fSession.getExecutor(), drm) {
+ @Override
+ protected void handleSuccess() {
+ drm.setData(new ExprMetaGetChildCountInfo(getData().getChildrenCount()));
+ drm.done();
+ processCommandDone(token, drm.getData());
+ }
+ });
+ }
+ });
+
+ } else if (command instanceof MIDataEvaluateExpression<?>) {
+ // This does not use the variable objects but sends the command directly to the back-end
fCommandControl.queueCommand(command, rm);
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR,
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR,
"Unexpected Expression Meta command", null)); //$NON-NLS-1$
rm.done();
- }
- return token;
- }
-
- /*
- * This is the command which allows the user to retract a previously issued command. The
- * state of the command is that it is in the waiting queue and has not yet been handed
- * to the back-end yet.
- *
- * (non-Javadoc)
- * @see org.eclipse.cdt.dsf.mi.service.command.IDebuggerControl#removeCommand(org.eclipse.cdt.dsf.mi.service.command.commands.ICommand)
- */
+ }
+ return token;
+ }
+
+ /*
+ * This is the command which allows the user to retract a previously issued command. The
+ * state of the command is that it is in the waiting queue and has not yet been handed
+ * to the back-end yet.
+ *
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.dsf.mi.service.command.IDebuggerControl#removeCommand(org.eclipse.cdt.dsf.mi.service.command.commands.ICommand)
+ */
@Override
- public void removeCommand(ICommandToken token) {
- // It is impossible to remove a command from the MIVariableManager.
- // This should never be called, if we did things right.
- assert false;
- }
-
- /*
- * This command allows the user to try and cancel commands which have been handed off to the
- * back-end. Some back-ends support this with extended GDB/MI commands. If the support is there
- * then we will attempt it. Because of the bidirectional nature of the GDB/MI command stream
- * there is no guarantee that this will work. The response to the command could be on its way
- * back when the cancel command is being issued.
- *
- * (non-Javadoc)
- * @see org.eclipse.cdt.dsf.mi.service.command.IDebuggerControl#cancelCommand(org.eclipse.cdt.dsf.mi.service.command.commands.ICommand)
- */
+ public void removeCommand(ICommandToken token) {
+ // It is impossible to remove a command from the MIVariableManager.
+ // This should never be called, if we did things right.
+ assert false;
+ }
+
+ /*
+ * This command allows the user to try and cancel commands which have been handed off to the
+ * back-end. Some back-ends support this with extended GDB/MI commands. If the support is there
+ * then we will attempt it. Because of the bidirectional nature of the GDB/MI command stream
+ * there is no guarantee that this will work. The response to the command could be on its way
+ * back when the cancel command is being issued.
+ *
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.dsf.mi.service.command.IDebuggerControl#cancelCommand(org.eclipse.cdt.dsf.mi.service.command.commands.ICommand)
+ */
@Override
- public void addCommandListener(ICommandListener processor) { fCommandProcessors.add(processor); }
- @Override
- public void removeCommandListener(ICommandListener processor) { fCommandProcessors.remove(processor); }
+ public void addCommandListener(ICommandListener processor) {
+ fCommandProcessors.add(processor);
+ }
+
@Override
- public void addEventListener(IEventListener processor) {}
+ public void removeCommandListener(ICommandListener processor) {
+ fCommandProcessors.remove(processor);
+ }
+
+ @Override
+ public void addEventListener(IEventListener processor) {
+ }
+
@Override
- public void removeEventListener(IEventListener processor) {}
-
-
- private void processCommandSent(ICommandToken token) {
- for (ICommandListener processor : fCommandProcessors) {
- processor.commandSent(token);
- }
- }
-
- private void processCommandDone(ICommandToken token, ICommandResult result) {
- for (ICommandListener processor : fCommandProcessors) {
- processor.commandDone(token, result);
- }
- }
-
- /**
- * @since 1.1
- */
- public void markAllOutOfDate() {
- MIRootVariableObject root;
- while ((root = updatedRootList.poll()) != null) {
- root.setOutOfDate(true);
- }
- }
-
- @DsfServiceEventHandler
- public void eventDispatched(IRunControl.IResumedDMEvent e) {
- // Program has resumed, all variable objects need to be updated.
- // Since only roots can actually be updated in GDB, we only need
- // to deal with those. Also, to optimize this operation, we have
- // a list of all roots that have been updated, so we only have to
- // set those to needing to be updated.
- markAllOutOfDate();
- }
-
- @DsfServiceEventHandler
- public void eventDispatched(IRunControl.ISuspendedDMEvent e) {
- }
-
- @DsfServiceEventHandler
- public void eventDispatched(IMemoryChangedEvent e) {
- // Some memory has changed. We currently do not know the address
- // of each of our variable objects, so there is no way to know
- // which one is affected. Mark them all as out of date.
- // The views will fully refresh on a MemoryChangedEvent
- markAllOutOfDate();
- }
-
- /**
+ public void removeEventListener(IEventListener processor) {
+ }
+
+ private void processCommandSent(ICommandToken token) {
+ for (ICommandListener processor : fCommandProcessors) {
+ processor.commandSent(token);
+ }
+ }
+
+ private void processCommandDone(ICommandToken token, ICommandResult result) {
+ for (ICommandListener processor : fCommandProcessors) {
+ processor.commandDone(token, result);
+ }
+ }
+
+ /**
+ * @since 1.1
+ */
+ public void markAllOutOfDate() {
+ MIRootVariableObject root;
+ while ((root = updatedRootList.poll()) != null) {
+ root.setOutOfDate(true);
+ }
+ }
+
+ @DsfServiceEventHandler
+ public void eventDispatched(IRunControl.IResumedDMEvent e) {
+ // Program has resumed, all variable objects need to be updated.
+ // Since only roots can actually be updated in GDB, we only need
+ // to deal with those. Also, to optimize this operation, we have
+ // a list of all roots that have been updated, so we only have to
+ // set those to needing to be updated.
+ markAllOutOfDate();
+ }
+
+ @DsfServiceEventHandler
+ public void eventDispatched(IRunControl.ISuspendedDMEvent e) {
+ }
+
+ @DsfServiceEventHandler
+ public void eventDispatched(IMemoryChangedEvent e) {
+ // Some memory has changed. We currently do not know the address
+ // of each of our variable objects, so there is no way to know
+ // which one is affected. Mark them all as out of date.
+ // The views will fully refresh on a MemoryChangedEvent
+ markAllOutOfDate();
+ }
+
+ /**
* @since 3.0
*/
- @DsfServiceEventHandler
- public void eventDispatched(ITraceRecordSelectedChangedDMEvent e) {
- // We have a big limitation with tracepoints!
- // GDB usually only reports a depth of 1, for every trace record, no
- // matter where it occurred. This means that our naming scheme for VariableObjectId
- // fails miserably because all objects will have the same depth and we will confuse
- // them. Until we find a good solution, we have to clear our entire list of
- // of variable objects (and delete them in GDB to avoid having too many).
- Iterator<Map.Entry<VariableObjectId, MIVariableObject>> iterator = lruVariableList.entrySet().iterator();
- while (iterator.hasNext()){
- iterator.next();
- iterator.remove();
- }
- }
-
- /**
- * GDB has a bug which makes -data-evaluate-expression fail when using
- * the return value of -var-info-path-expression in the case of derived classes.
- * To work around this bug, we don't use -var-info-path-expression for some derived
- * classes and all their descendants.
- *
- * This method can be overridden to easily disable the workaround, for versions
- * of GDB that no longer have the bug.
- *
- * See http://sourceware.org/bugzilla/show_bug.cgi?id=11912
- * and Bug 320277.
- *
- * The bug was fixed in GDB 7.3.1.
- *
- * @since 4.1
- */
- protected boolean needFixForGDBBug320277() {
- return true;
- }
-
- /**
+ @DsfServiceEventHandler
+ public void eventDispatched(ITraceRecordSelectedChangedDMEvent e) {
+ // We have a big limitation with tracepoints!
+ // GDB usually only reports a depth of 1, for every trace record, no
+ // matter where it occurred. This means that our naming scheme for VariableObjectId
+ // fails miserably because all objects will have the same depth and we will confuse
+ // them. Until we find a good solution, we have to clear our entire list of
+ // of variable objects (and delete them in GDB to avoid having too many).
+ Iterator<Map.Entry<VariableObjectId, MIVariableObject>> iterator = lruVariableList.entrySet().iterator();
+ while (iterator.hasNext()) {
+ iterator.next();
+ iterator.remove();
+ }
+ }
+
+ /**
+ * GDB has a bug which makes -data-evaluate-expression fail when using
+ * the return value of -var-info-path-expression in the case of derived classes.
+ * To work around this bug, we don't use -var-info-path-expression for some derived
+ * classes and all their descendants.
+ *
+ * This method can be overridden to easily disable the workaround, for versions
+ * of GDB that no longer have the bug.
+ *
+ * See http://sourceware.org/bugzilla/show_bug.cgi?id=11912
+ * and Bug 320277.
+ *
+ * The bug was fixed in GDB 7.3.1.
+ *
+ * @since 4.1
+ */
+ protected boolean needFixForGDBBug320277() {
+ return true;
+ }
+
+ /**
* @since 4.4
*/
- protected GDBTypeParser createGDBTypeParser() {
+ protected GDBTypeParser createGDBTypeParser() {
return new GDBTypeParser();
- }
-
+ }
+
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/Messages.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/Messages.java
index 2829c30449e..079f349c804 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/Messages.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/Messages.java
@@ -11,7 +11,7 @@
* Contributors:
* Ericsson - initial API and implementation
* Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121)
- * Alvaro Sanchez-Leon (Ericsson) - Support Register Groups (Bug 235747)
+ * Alvaro Sanchez-Leon (Ericsson) - Support Register Groups (Bug 235747)
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service;
@@ -29,7 +29,7 @@ class Messages extends NLS {
public static String MIExpressions_ReturnValueAlias;
public static String MIRegisters_General_Registers;
public static String MIRegisters_General_Registers_description;
-
+
static {
// initialize resource bundle
NLS.initializeMessages(Messages.class.getName(), Messages.class);
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/breakpoint/actions/BreakpointActionAdapter.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/breakpoint/actions/BreakpointActionAdapter.java
index f71acc8a155..94a821b29b2 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/breakpoint/actions/BreakpointActionAdapter.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/breakpoint/actions/BreakpointActionAdapter.java
@@ -29,32 +29,32 @@ import org.eclipse.core.runtime.IAdaptable;
*/
public class BreakpointActionAdapter implements IAdaptable {
- private final DsfExecutor fExecutor;
- private final DsfServicesTracker fServiceTracker;
- private final IDMContext fContext;
+ private final DsfExecutor fExecutor;
+ private final DsfServicesTracker fServiceTracker;
+ private final IDMContext fContext;
- public BreakpointActionAdapter(DsfExecutor executor, DsfServicesTracker serviceTracker, IDMContext context) {
- fExecutor = executor;
- fServiceTracker = serviceTracker;
- fContext = context;
- }
+ public BreakpointActionAdapter(DsfExecutor executor, DsfServicesTracker serviceTracker, IDMContext context) {
+ fExecutor = executor;
+ fServiceTracker = serviceTracker;
+ fContext = context;
+ }
@SuppressWarnings("unchecked")
@Override
- public <T> T getAdapter(Class<T> adapter) {
- if (adapter.equals(ILogActionEnabler.class)) {
- return (T)new MILogActionEnabler(fExecutor, fServiceTracker, fContext);
- }
- if (adapter.equals(IResumeActionEnabler.class)) {
- return (T)new MIResumeActionEnabler(fExecutor, fServiceTracker, fContext);
- }
- if (adapter.equals(IReverseDebugEnabler.class)) {
- return (T)new MIReverseDebugEnabler(fExecutor, fServiceTracker, fContext);
- }
- if (adapter.equals(ICLIDebugActionEnabler.class)) {
- return (T)new CLIDebugActionEnabler(fExecutor, fServiceTracker, fContext);
- }
- return null;
- }
+ public <T> T getAdapter(Class<T> adapter) {
+ if (adapter.equals(ILogActionEnabler.class)) {
+ return (T) new MILogActionEnabler(fExecutor, fServiceTracker, fContext);
+ }
+ if (adapter.equals(IResumeActionEnabler.class)) {
+ return (T) new MIResumeActionEnabler(fExecutor, fServiceTracker, fContext);
+ }
+ if (adapter.equals(IReverseDebugEnabler.class)) {
+ return (T) new MIReverseDebugEnabler(fExecutor, fServiceTracker, fContext);
+ }
+ if (adapter.equals(ICLIDebugActionEnabler.class)) {
+ return (T) new CLIDebugActionEnabler(fExecutor, fServiceTracker, fContext);
+ }
+ return null;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/breakpoint/actions/CLIDebugActionEnabler.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/breakpoint/actions/CLIDebugActionEnabler.java
index 03ee6f48019..f6b322aeb02 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/breakpoint/actions/CLIDebugActionEnabler.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/breakpoint/actions/CLIDebugActionEnabler.java
@@ -71,11 +71,10 @@ public class CLIDebugActionEnabler implements ICLIDebugActionEnabler {
}
private void executeSingleCommand(String str) {
- // Do not use the interpreter-exec for stepping operation the UI will fall out of step.
- // Also, do not use "interpreter-exec console" for MI commands.
+ // Do not use the interpreter-exec for stepping operation the UI will fall out of step.
+ // Also, do not use "interpreter-exec console" for MI commands.
ICommand<MIInfo> cmd;
- if (!isMIOperation(str) &&
- !CLIEventProcessor.isSteppingOperation(str)) {
+ if (!isMIOperation(str) && !CLIEventProcessor.isSteppingOperation(str)) {
cmd = new MIInterpreterExecConsole<>(fContext, str);
} else {
cmd = new CLICommand<>(fContext, str);
@@ -89,8 +88,7 @@ public class CLIDebugActionEnabler implements ICLIDebugActionEnabler {
commandControl.queueCommand(cmd, new ImmediateDataRequestMonitor<>());
} else {
// Should not happen, so log the situation but then ignore it
- GdbPlugin.log(new Status(
- IStatus.INFO, GdbPlugin.PLUGIN_ID,
+ GdbPlugin.log(new Status(IStatus.INFO, GdbPlugin.PLUGIN_ID,
"Unable to find service to execute breakpoint command")); //$NON-NLS-1$
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/breakpoint/actions/MILogActionEnabler.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/breakpoint/actions/MILogActionEnabler.java
index cc4214259f5..fde8f4b76c1 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/breakpoint/actions/MILogActionEnabler.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/breakpoint/actions/MILogActionEnabler.java
@@ -33,54 +33,53 @@ import org.eclipse.cdt.dsf.service.DsfServicesTracker;
*/
public class MILogActionEnabler implements ILogActionEnabler {
- private final DsfExecutor fExecutor;
- private final DsfServicesTracker fServiceTracker;
- private final IDMContext fContext;
+ private final DsfExecutor fExecutor;
+ private final DsfServicesTracker fServiceTracker;
+ private final IDMContext fContext;
- public MILogActionEnabler(DsfExecutor executor, DsfServicesTracker serviceTracker, IDMContext context) {
- fExecutor = executor;
- fServiceTracker = serviceTracker;
- fContext = context;
- }
+ public MILogActionEnabler(DsfExecutor executor, DsfServicesTracker serviceTracker, IDMContext context) {
+ fExecutor = executor;
+ fServiceTracker = serviceTracker;
+ fContext = context;
+ }
@Override
- public String evaluateExpression(final String expression) throws Exception {
- // Use a Query to synchronize the call
- Query<String> query = new Query<String>() {
- @Override
- protected void execute(final DataRequestMonitor<String> drm) {
- final IExpressions expressionService = fServiceTracker.getService(IExpressions.class);
- if (expressionService != null) {
- final IExpressionDMContext expressionDMC = expressionService.createExpression(fContext, expression);
- String formatId = IFormattedValues.NATURAL_FORMAT;
- FormattedValueDMContext valueDmc = expressionService.getFormattedValueContext(expressionDMC, formatId);
- expressionService.getFormattedExpressionValue(
- valueDmc,
- new DataRequestMonitor<FormattedValueDMData>(fExecutor, drm) {
- @Override
- protected void handleCompleted() {
- String result = expression + ": evaluation failed."; //$NON-NLS-1$
- if (isSuccess()) {
- result = getData().getFormattedValue();
- }
- drm.setData(result);
- drm.done();
- }
- }
- );
- }
- }
- };
- fExecutor.execute(query);
+ public String evaluateExpression(final String expression) throws Exception {
+ // Use a Query to synchronize the call
+ Query<String> query = new Query<String>() {
+ @Override
+ protected void execute(final DataRequestMonitor<String> drm) {
+ final IExpressions expressionService = fServiceTracker.getService(IExpressions.class);
+ if (expressionService != null) {
+ final IExpressionDMContext expressionDMC = expressionService.createExpression(fContext, expression);
+ String formatId = IFormattedValues.NATURAL_FORMAT;
+ FormattedValueDMContext valueDmc = expressionService.getFormattedValueContext(expressionDMC,
+ formatId);
+ expressionService.getFormattedExpressionValue(valueDmc,
+ new DataRequestMonitor<FormattedValueDMData>(fExecutor, drm) {
+ @Override
+ protected void handleCompleted() {
+ String result = expression + ": evaluation failed."; //$NON-NLS-1$
+ if (isSuccess()) {
+ result = getData().getFormattedValue();
+ }
+ drm.setData(result);
+ drm.done();
+ }
+ });
+ }
+ }
+ };
+ fExecutor.execute(query);
- try {
- // The happy case
- return query.get();
- } catch (InterruptedException e) {
- return "Error evaluating \"" + expression + "\" (InterruptedException)."; //$NON-NLS-1$ //$NON-NLS-2$
- } catch (ExecutionException e) {
- return "Error evaluating \"" + expression + "\" (ExecutionException)."; //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
+ try {
+ // The happy case
+ return query.get();
+ } catch (InterruptedException e) {
+ return "Error evaluating \"" + expression + "\" (InterruptedException)."; //$NON-NLS-1$ //$NON-NLS-2$
+ } catch (ExecutionException e) {
+ return "Error evaluating \"" + expression + "\" (ExecutionException)."; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/breakpoint/actions/MIResumeActionEnabler.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/breakpoint/actions/MIResumeActionEnabler.java
index 88b128ff409..ea7c4f7c986 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/breakpoint/actions/MIResumeActionEnabler.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/breakpoint/actions/MIResumeActionEnabler.java
@@ -28,26 +28,26 @@ import org.eclipse.cdt.dsf.service.DsfServicesTracker;
*/
public class MIResumeActionEnabler implements IResumeActionEnabler {
- private final DsfExecutor fExecutor;
- private final DsfServicesTracker fServiceTracker;
- private final IExecutionDMContext fContext;
+ private final DsfExecutor fExecutor;
+ private final DsfServicesTracker fServiceTracker;
+ private final IExecutionDMContext fContext;
- public MIResumeActionEnabler(DsfExecutor executor, DsfServicesTracker serviceTracker, IDMContext context) {
- fExecutor = executor;
- fServiceTracker = serviceTracker;
- fContext = (IExecutionDMContext) context;
- }
+ public MIResumeActionEnabler(DsfExecutor executor, DsfServicesTracker serviceTracker, IDMContext context) {
+ fExecutor = executor;
+ fServiceTracker = serviceTracker;
+ fContext = (IExecutionDMContext) context;
+ }
@Override
- public void resume() throws Exception {
- fExecutor.execute(new DsfRunnable() {
- @Override
- public void run() {
- final IRunControl runControlService = fServiceTracker.getService(IRunControl.class);
- if (runControlService != null) {
- runControlService.resume(fContext, new RequestMonitor(fExecutor, null));
- }
- }
- });
- }
+ public void resume() throws Exception {
+ fExecutor.execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ final IRunControl runControlService = fServiceTracker.getService(IRunControl.class);
+ if (runControlService != null) {
+ runControlService.resume(fContext, new RequestMonitor(fExecutor, null));
+ }
+ }
+ });
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/breakpoint/actions/MIReverseDebugEnabler.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/breakpoint/actions/MIReverseDebugEnabler.java
index 65a85314c60..e0e424bd5aa 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/breakpoint/actions/MIReverseDebugEnabler.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/breakpoint/actions/MIReverseDebugEnabler.java
@@ -25,31 +25,33 @@ import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommand
import org.eclipse.cdt.dsf.gdb.service.IReverseRunControl;
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
-
/**
- *
+ *
* This class permits to enable, disable or toggle the reverse
* debugging mode.
- *
+ *
* @since 4.2
*/
-public class MIReverseDebugEnabler implements IReverseDebugEnabler {
- private final DsfExecutor fExecutor;
- private final DsfServicesTracker fServiceTracker;
- private final ICommandControlDMContext fContext;
- private static enum REVERSE_DEBUG_MODE {ENABLE, DISABLE, TOGGLE};
+public class MIReverseDebugEnabler implements IReverseDebugEnabler {
+ private final DsfExecutor fExecutor;
+ private final DsfServicesTracker fServiceTracker;
+ private final ICommandControlDMContext fContext;
- /**
- * @param executor
- * @param serviceTracker
- * @param context
- */
- public MIReverseDebugEnabler(DsfExecutor executor, DsfServicesTracker serviceTracker, IDMContext context) {
- fExecutor = executor;
- fServiceTracker = serviceTracker;
- fContext = DMContexts.getAncestorOfType(context, ICommandControlDMContext.class);
- assert fContext != null;
- }
+ private static enum REVERSE_DEBUG_MODE {
+ ENABLE, DISABLE, TOGGLE
+ };
+
+ /**
+ * @param executor
+ * @param serviceTracker
+ * @param context
+ */
+ public MIReverseDebugEnabler(DsfExecutor executor, DsfServicesTracker serviceTracker, IDMContext context) {
+ fExecutor = executor;
+ fServiceTracker = serviceTracker;
+ fContext = DMContexts.getAncestorOfType(context, ICommandControlDMContext.class);
+ assert fContext != null;
+ }
@Override
public void enable() throws Exception {
@@ -60,33 +62,32 @@ public class MIReverseDebugEnabler implements IReverseDebugEnabler {
public void disable() throws Exception {
setMode(REVERSE_DEBUG_MODE.DISABLE);
}
-
+
@Override
public void toggle() throws Exception {
setMode(REVERSE_DEBUG_MODE.TOGGLE);
}
- private void setMode(final REVERSE_DEBUG_MODE mode) throws Exception {
- fExecutor.execute(new DsfRunnable() {
- @Override
- public void run() {
- final IReverseRunControl runControl = fServiceTracker.getService(IReverseRunControl.class);
- if (runControl != null) {
- runControl.isReverseModeEnabled(fContext, new DataRequestMonitor<Boolean>(fExecutor, null) {
- @Override
- public void handleSuccess() {
- Boolean enabled = getData();
- if ( (enabled.equals(false) && mode.equals(REVERSE_DEBUG_MODE.ENABLE) ) ||
- (enabled.equals(true) && mode.equals(REVERSE_DEBUG_MODE.DISABLE) ) ||
- (mode.equals(REVERSE_DEBUG_MODE.TOGGLE)) )
- {
- runControl.enableReverseMode(fContext, !enabled, new RequestMonitor(fExecutor, null));
- }
- }
- });
- }
- }
- });
+ private void setMode(final REVERSE_DEBUG_MODE mode) throws Exception {
+ fExecutor.execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ final IReverseRunControl runControl = fServiceTracker.getService(IReverseRunControl.class);
+ if (runControl != null) {
+ runControl.isReverseModeEnabled(fContext, new DataRequestMonitor<Boolean>(fExecutor, null) {
+ @Override
+ public void handleSuccess() {
+ Boolean enabled = getData();
+ if ((enabled.equals(false) && mode.equals(REVERSE_DEBUG_MODE.ENABLE))
+ || (enabled.equals(true) && mode.equals(REVERSE_DEBUG_MODE.DISABLE))
+ || (mode.equals(REVERSE_DEBUG_MODE.TOGGLE))) {
+ runControl.enableReverseMode(fContext, !enabled, new RequestMonitor(fExecutor, null));
+ }
+ }
+ });
+ }
+ }
+ });
}
-
+
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/AbstractCLIProcess.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/AbstractCLIProcess.java
index 63a60e08f47..6d997302e2c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/AbstractCLIProcess.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/AbstractCLIProcess.java
@@ -49,464 +49,478 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
/**
- * This Process implementation tracks the GDB process. This
+ * This Process implementation tracks the GDB process. This
* process object is displayed in the Debug view and is used to
* accept CLI commands and to write their output to the console.
- *
+ *
* Starting with GDB 7.12, as long as a PTY is available,
* this process is no longer used. Instead, the real GDB process,
* along with its console will be used directly. A second PTY
* will be used to communicate using MI.
- *
- * @see org.eclipse.debug.core.model.IProcess
+ *
+ * @see org.eclipse.debug.core.model.IProcess
*/
@ThreadSafe
-public abstract class AbstractCLIProcess extends Process
- implements IEventListener, ICommandListener
-{
- public static final String PRIMARY_PROMPT = "(gdb)"; //$NON-NLS-1$
- public static final String SECONDARY_PROMPT = ">"; //$NON-NLS-1$
-
- // This is the command that will end a secondary prompt
- private static final String SECONDARY_PROMPT_END_COMMAND = "end"; //$NON-NLS-1$
-
- private final DsfSession fSession;
- private final ICommandControlService fCommandControl;
+public abstract class AbstractCLIProcess extends Process implements IEventListener, ICommandListener {
+ public static final String PRIMARY_PROMPT = "(gdb)"; //$NON-NLS-1$
+ public static final String SECONDARY_PROMPT = ">"; //$NON-NLS-1$
+
+ // This is the command that will end a secondary prompt
+ private static final String SECONDARY_PROMPT_END_COMMAND = "end"; //$NON-NLS-1$
+
+ private final DsfSession fSession;
+ private final ICommandControlService fCommandControl;
private OutputStream fOutputStream;
-
- // Client process console stream.
- private PipedInputStream fMIInConsolePipe;
- private PipedOutputStream fMIOutConsolePipe;
- private PipedInputStream fMIInLogPipe;
- private PipedOutputStream fMIOutLogPipe;
-
- private boolean fDisposed = false;
-
- /**
- * Counter for tracking console commands sent by services.
- *
- * Services may issue console commands when the available MI commands are
- * not sufficient. However, these commands may produce console and log
- * output which should not be written to the user CLI terminal.
- *
- * This counter is incremented any time a console command is seen which was
- * not generated by this class. It is decremented whenever a service CLI
- * command is finished. When counter value is 0, the CLI process writes
- * the console output.
- */
- private int fSuppressConsoleOutputCounter = 0;
-
- // Primary prompt == "(gdb)"
- // Secondary Prompt == ">"
- // Secondary_prompt_missing means that the backend should be sending the secondary
- // prompt but it isn't. So we do it ourselves.
- private enum PromptType { IN_PRIMARY_PROMPT, IN_SECONDARY_PROMPT, IN_SECONDARY_PROMPT_MISSING };
- private PromptType fPrompt = PromptType.IN_PRIMARY_PROMPT;
-
- /**
- * @since 1.1
- */
- @ConfinedToDsfExecutor("fSession#getExecutor")
+
+ // Client process console stream.
+ private PipedInputStream fMIInConsolePipe;
+ private PipedOutputStream fMIOutConsolePipe;
+ private PipedInputStream fMIInLogPipe;
+ private PipedOutputStream fMIOutLogPipe;
+
+ private boolean fDisposed = false;
+
+ /**
+ * Counter for tracking console commands sent by services.
+ *
+ * Services may issue console commands when the available MI commands are
+ * not sufficient. However, these commands may produce console and log
+ * output which should not be written to the user CLI terminal.
+ *
+ * This counter is incremented any time a console command is seen which was
+ * not generated by this class. It is decremented whenever a service CLI
+ * command is finished. When counter value is 0, the CLI process writes
+ * the console output.
+ */
+ private int fSuppressConsoleOutputCounter = 0;
+
+ // Primary prompt == "(gdb)"
+ // Secondary Prompt == ">"
+ // Secondary_prompt_missing means that the backend should be sending the secondary
+ // prompt but it isn't. So we do it ourselves.
+ private enum PromptType {
+ IN_PRIMARY_PROMPT, IN_SECONDARY_PROMPT, IN_SECONDARY_PROMPT_MISSING
+ };
+
+ private PromptType fPrompt = PromptType.IN_PRIMARY_PROMPT;
+
+ /**
+ * @since 1.1
+ */
+ @ConfinedToDsfExecutor("fSession#getExecutor")
public AbstractCLIProcess(ICommandControlService commandControl) throws IOException {
- fSession = commandControl.getSession();
- fCommandControl = commandControl;
-
- if (handleIO()) {
- fOutputStream = new CLIOutputStream();
-
- commandControl.addEventListener(this);
- commandControl.addCommandListener(this);
-
- PipedInputStream miInConsolePipe = null;
- PipedOutputStream miOutConsolePipe = null;
- PipedInputStream miInLogPipe = null;
- PipedOutputStream miOutLogPipe = null;
-
- try {
- // Using a LargePipedInputStream see https://bugs.eclipse.org/bugs/show_bug.cgi?id=223154
- miOutConsolePipe = new PipedOutputStream();
- miInConsolePipe = new LargePipedInputStream(miOutConsolePipe);
- miOutLogPipe = new PipedOutputStream();
- miInLogPipe = new LargePipedInputStream(miOutLogPipe);
- } catch (IOException e) {
- ILog log = GdbPlugin.getDefault().getLog();
- if (log != null) {
- log.log(new Status(
- IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, "Error when creating log pipes", e)); //$NON-NLS-1$
- }
- }
- fMIOutConsolePipe = miOutConsolePipe;
- fMIInConsolePipe = miInConsolePipe;
- fMIOutLogPipe = miOutLogPipe;
- fMIInLogPipe = miInLogPipe;
- }
+ fSession = commandControl.getSession();
+ fCommandControl = commandControl;
+
+ if (handleIO()) {
+ fOutputStream = new CLIOutputStream();
+
+ commandControl.addEventListener(this);
+ commandControl.addCommandListener(this);
+
+ PipedInputStream miInConsolePipe = null;
+ PipedOutputStream miOutConsolePipe = null;
+ PipedInputStream miInLogPipe = null;
+ PipedOutputStream miOutLogPipe = null;
+
+ try {
+ // Using a LargePipedInputStream see https://bugs.eclipse.org/bugs/show_bug.cgi?id=223154
+ miOutConsolePipe = new PipedOutputStream();
+ miInConsolePipe = new LargePipedInputStream(miOutConsolePipe);
+ miOutLogPipe = new PipedOutputStream();
+ miInLogPipe = new LargePipedInputStream(miOutLogPipe);
+ } catch (IOException e) {
+ ILog log = GdbPlugin.getDefault().getLog();
+ if (log != null) {
+ log.log(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, "Error when creating log pipes", e)); //$NON-NLS-1$
+ }
+ }
+ fMIOutConsolePipe = miOutConsolePipe;
+ fMIInConsolePipe = miInConsolePipe;
+ fMIOutLogPipe = miOutLogPipe;
+ fMIInLogPipe = miInLogPipe;
+ }
}
-
- /**
- * Returns if this class should handle the IO streams of the CLI.
+
+ /**
+ * Returns if this class should handle the IO streams of the CLI.
* @since 5.2
*/
- protected boolean handleIO() { return true; }
-
- protected DsfSession getSession() { return fSession; }
-
- /**
- * @since 1.1
- */
- protected ICommandControlService getCommandControlService() { return fCommandControl; }
-
- protected boolean isDisposed() { return fDisposed; }
-
- @ConfinedToDsfExecutor("fSession#getExecutor")
- public void dispose() {
- if (fDisposed) return;
-
- fCommandControl.removeEventListener(this);
- fCommandControl.removeCommandListener(this);
-
- closeIO();
- fDisposed = true;
-
- // We have memory leaks that prevent this class from being
- // GCed. The problem becomes bad because we are holding
- // two LargePipedInputStream and eventually, the JUnit tests
- // run out of memory. To address this particular problem,
- // before the actual causes of the leaks are fixed, lets
- // make sure we release all our four streams which all have
- // a reference to a LargePipedInputStream
- // Bug 323071
- fMIInConsolePipe = null;
- fMIInLogPipe = null;
- fMIOutConsolePipe = null;
- fMIOutLogPipe = null;
- }
-
- private void closeIO() {
- if (fMIOutConsolePipe != null) {
- try {
- fMIOutConsolePipe.close();
- } catch (IOException e) {}
- }
- if (fMIInConsolePipe != null) {
- try {
- fMIInConsolePipe.close();
- } catch (IOException e) {}
- }
- if (fMIOutLogPipe != null) {
- try {
- fMIOutLogPipe.close();
- } catch (IOException e) {}
- }
- if (fMIInLogPipe != null) {
- try {
- fMIInLogPipe.close();
- } catch (IOException e) {}
- }
-
- }
-
+ protected boolean handleIO() {
+ return true;
+ }
+
+ protected DsfSession getSession() {
+ return fSession;
+ }
+
+ /**
+ * @since 1.1
+ */
+ protected ICommandControlService getCommandControlService() {
+ return fCommandControl;
+ }
+
+ protected boolean isDisposed() {
+ return fDisposed;
+ }
+
+ @ConfinedToDsfExecutor("fSession#getExecutor")
+ public void dispose() {
+ if (fDisposed)
+ return;
+
+ fCommandControl.removeEventListener(this);
+ fCommandControl.removeCommandListener(this);
+
+ closeIO();
+ fDisposed = true;
+
+ // We have memory leaks that prevent this class from being
+ // GCed. The problem becomes bad because we are holding
+ // two LargePipedInputStream and eventually, the JUnit tests
+ // run out of memory. To address this particular problem,
+ // before the actual causes of the leaks are fixed, lets
+ // make sure we release all our four streams which all have
+ // a reference to a LargePipedInputStream
+ // Bug 323071
+ fMIInConsolePipe = null;
+ fMIInLogPipe = null;
+ fMIOutConsolePipe = null;
+ fMIOutLogPipe = null;
+ }
+
+ private void closeIO() {
+ if (fMIOutConsolePipe != null) {
+ try {
+ fMIOutConsolePipe.close();
+ } catch (IOException e) {
+ }
+ }
+ if (fMIInConsolePipe != null) {
+ try {
+ fMIInConsolePipe.close();
+ } catch (IOException e) {
+ }
+ }
+ if (fMIOutLogPipe != null) {
+ try {
+ fMIOutLogPipe.close();
+ } catch (IOException e) {
+ }
+ }
+ if (fMIInLogPipe != null) {
+ try {
+ fMIInLogPipe.close();
+ } catch (IOException e) {
+ }
+ }
+
+ }
+
/**
* @see java.lang.Process#getErrorStream()
*/
@Override
- public InputStream getErrorStream() {
- return fMIInLogPipe;
+ public InputStream getErrorStream() {
+ return fMIInLogPipe;
}
/**
* @see java.lang.Process#getInputStream()
*/
@Override
- public InputStream getInputStream() {
- return fMIInConsolePipe;
+ public InputStream getInputStream() {
+ return fMIInConsolePipe;
}
/**
* @see java.lang.Process#getOutputStream()
*/
@Override
- public OutputStream getOutputStream() {
+ public OutputStream getOutputStream() {
return fOutputStream;
}
-
@Override
- public void eventReceived(Object output) {
- if (fSuppressConsoleOutputCounter > 0) return;
- for (MIOOBRecord oobr : ((MIOutput)output).getMIOOBRecords()) {
- if (oobr instanceof MIConsoleStreamOutput)
- {
- MIConsoleStreamOutput out = (MIConsoleStreamOutput) oobr;
- String str = out.getString();
-
- if (str.trim().equals(SECONDARY_PROMPT)) {
- // Make sure to skip any secondary prompt that we
- // have already printed ourselves. This would happen
- // when a new version of the backend starts sending
- // the secondary prompt for a command that it didn't
- // use to. In this case, we still send it ourselves.
- if (inMissingSecondaryPrompt()) {
- return;
- }
- // Add a space for readability
- str = SECONDARY_PROMPT + ' ';
- }
-
- setPrompt(str);
- try {
- if (fMIOutConsolePipe != null) {
- fMIOutConsolePipe.write(str.getBytes());
- fMIOutConsolePipe.flush();
- }
- } catch (IOException e) {
- }
- } else if (oobr instanceof MILogStreamOutput) {
- MILogStreamOutput out = (MILogStreamOutput) oobr;
- String str = out.getString();
- if (str != null) {
- try {
- if (fMIOutLogPipe != null) {
- fMIOutLogPipe.write(str.getBytes());
- fMIOutLogPipe.flush();
- }
- } catch (IOException e) {
- }
- }
- }
- }
- }
-
+ public void eventReceived(Object output) {
+ if (fSuppressConsoleOutputCounter > 0)
+ return;
+ for (MIOOBRecord oobr : ((MIOutput) output).getMIOOBRecords()) {
+ if (oobr instanceof MIConsoleStreamOutput) {
+ MIConsoleStreamOutput out = (MIConsoleStreamOutput) oobr;
+ String str = out.getString();
+
+ if (str.trim().equals(SECONDARY_PROMPT)) {
+ // Make sure to skip any secondary prompt that we
+ // have already printed ourselves. This would happen
+ // when a new version of the backend starts sending
+ // the secondary prompt for a command that it didn't
+ // use to. In this case, we still send it ourselves.
+ if (inMissingSecondaryPrompt()) {
+ return;
+ }
+ // Add a space for readability
+ str = SECONDARY_PROMPT + ' ';
+ }
+
+ setPrompt(str);
+ try {
+ if (fMIOutConsolePipe != null) {
+ fMIOutConsolePipe.write(str.getBytes());
+ fMIOutConsolePipe.flush();
+ }
+ } catch (IOException e) {
+ }
+ } else if (oobr instanceof MILogStreamOutput) {
+ MILogStreamOutput out = (MILogStreamOutput) oobr;
+ String str = out.getString();
+ if (str != null) {
+ try {
+ if (fMIOutLogPipe != null) {
+ fMIOutLogPipe.write(str.getBytes());
+ fMIOutLogPipe.flush();
+ }
+ } catch (IOException e) {
+ }
+ }
+ }
+ }
+ }
+
@Override
- public void commandQueued(ICommandToken token) {
- // Ignore
- }
+ public void commandQueued(ICommandToken token) {
+ // Ignore
+ }
@Override
- public void commandSent(ICommandToken token) {
- // Bug 285170
- // Don't reset the fPrompt here, in case we are
- // dealing with the missing secondary prompt.
-
- ICommand<?> command = token.getCommand();
- // Check if the command is a CLI command and if it did not originate from this class.
- if ((command instanceof CLICommand<?> || command instanceof MIInterpreterExecConsole<?>) &&
- !(command instanceof ProcessCLICommand || command instanceof ProcessMIInterpreterExecConsole))
- {
- fSuppressConsoleOutputCounter++;
- }
-
- // Bug 285170
- // Deal with missing secondary prompt, if needed.
- // The only two types we care about are ProcessMIInterpreterExecConsole
- // and RawCommand, both of which are MICommands
- if (command instanceof MICommand<?>) {
- checkMissingSecondaryPrompt((MICommand<?>)command);
- }
- }
-
- private void checkMissingSecondaryPrompt(MICommand<?> command) {
- // If the command send is one of ours, check if it is one that is missing a secondary prompt
- if (command instanceof ProcessMIInterpreterExecConsole) {
- String[] operations = ((ProcessMIInterpreterExecConsole)command).getParameters();
- if (operations != null && operations.length > 0) {
- // Get the command name.
- String operation = operations[0];
- int indx = operation.indexOf(' ');
- if (indx != -1) {
- operation = operation.substring(0, indx).trim();
- } else {
- operation = operation.trim();
- }
-
- if (isMissingSecondaryPromptCommand(operation)) {
- // For such commands, the backend does not send the secondary prompt
- // so we set it manually. We'll remain in this state until we get
- // a commandDone() call.
- // This logic will still work when a new version of the backend
- // fixes this lack of secondary prompt.
- fPrompt = PromptType.IN_SECONDARY_PROMPT_MISSING;
- }
- }
- }
-
- // Even if the previous check didn't kick in, we may already be in the missing
- // secondary prompt case. If so, we'll print the prompt ourselves.
- // Just make sure that this command is not ending the secondary prompt.
- if (fPrompt == PromptType.IN_SECONDARY_PROMPT_MISSING) {
- String operation = command.getOperation();
- if (operation != null) {
- int indx = operation.indexOf(' ');
- if (indx != -1) {
- operation = operation.substring(0, indx).trim();
- } else {
- operation = operation.trim();
- }
-
- if (!operation.equals(SECONDARY_PROMPT_END_COMMAND)) {
- // Add a space for readability
- String str = SECONDARY_PROMPT + ' ';
- try {
- if (fMIOutConsolePipe != null) {
- fMIOutConsolePipe.write(str.getBytes());
- fMIOutConsolePipe.flush();
- }
- } catch (IOException e) {
- }
- }
- }
- }
- }
-
- /**
- * Check to see if the user typed a command that we know the backend
- * does not send the secondary prompt for, but should.
- * If so, we'll need to pretend we are receiving the secondary prompt.
- *
- * @since 3.0
- */
- protected boolean isMissingSecondaryPromptCommand(String operation) {
- return false;
- }
-
+ public void commandSent(ICommandToken token) {
+ // Bug 285170
+ // Don't reset the fPrompt here, in case we are
+ // dealing with the missing secondary prompt.
+
+ ICommand<?> command = token.getCommand();
+ // Check if the command is a CLI command and if it did not originate from this class.
+ if ((command instanceof CLICommand<?> || command instanceof MIInterpreterExecConsole<?>)
+ && !(command instanceof ProcessCLICommand || command instanceof ProcessMIInterpreterExecConsole)) {
+ fSuppressConsoleOutputCounter++;
+ }
+
+ // Bug 285170
+ // Deal with missing secondary prompt, if needed.
+ // The only two types we care about are ProcessMIInterpreterExecConsole
+ // and RawCommand, both of which are MICommands
+ if (command instanceof MICommand<?>) {
+ checkMissingSecondaryPrompt((MICommand<?>) command);
+ }
+ }
+
+ private void checkMissingSecondaryPrompt(MICommand<?> command) {
+ // If the command send is one of ours, check if it is one that is missing a secondary prompt
+ if (command instanceof ProcessMIInterpreterExecConsole) {
+ String[] operations = ((ProcessMIInterpreterExecConsole) command).getParameters();
+ if (operations != null && operations.length > 0) {
+ // Get the command name.
+ String operation = operations[0];
+ int indx = operation.indexOf(' ');
+ if (indx != -1) {
+ operation = operation.substring(0, indx).trim();
+ } else {
+ operation = operation.trim();
+ }
+
+ if (isMissingSecondaryPromptCommand(operation)) {
+ // For such commands, the backend does not send the secondary prompt
+ // so we set it manually. We'll remain in this state until we get
+ // a commandDone() call.
+ // This logic will still work when a new version of the backend
+ // fixes this lack of secondary prompt.
+ fPrompt = PromptType.IN_SECONDARY_PROMPT_MISSING;
+ }
+ }
+ }
+
+ // Even if the previous check didn't kick in, we may already be in the missing
+ // secondary prompt case. If so, we'll print the prompt ourselves.
+ // Just make sure that this command is not ending the secondary prompt.
+ if (fPrompt == PromptType.IN_SECONDARY_PROMPT_MISSING) {
+ String operation = command.getOperation();
+ if (operation != null) {
+ int indx = operation.indexOf(' ');
+ if (indx != -1) {
+ operation = operation.substring(0, indx).trim();
+ } else {
+ operation = operation.trim();
+ }
+
+ if (!operation.equals(SECONDARY_PROMPT_END_COMMAND)) {
+ // Add a space for readability
+ String str = SECONDARY_PROMPT + ' ';
+ try {
+ if (fMIOutConsolePipe != null) {
+ fMIOutConsolePipe.write(str.getBytes());
+ fMIOutConsolePipe.flush();
+ }
+ } catch (IOException e) {
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Check to see if the user typed a command that we know the backend
+ * does not send the secondary prompt for, but should.
+ * If so, we'll need to pretend we are receiving the secondary prompt.
+ *
+ * @since 3.0
+ */
+ protected boolean isMissingSecondaryPromptCommand(String operation) {
+ return false;
+ }
+
@Override
- public void commandRemoved(ICommandToken token) {
- // Ignore
- }
+ public void commandRemoved(ICommandToken token) {
+ // Ignore
+ }
@Override
- public void commandDone(ICommandToken token, ICommandResult result) {
- // Whenever we get a command that is completed, we know we must be in the primary prompt
- fPrompt = PromptType.IN_PRIMARY_PROMPT;
-
- ICommand<?> command = token.getCommand();
- if ((command instanceof CLICommand<?> || command instanceof MIInterpreterExecConsole<?>) &&
- !(command instanceof ProcessCLICommand || command instanceof ProcessMIInterpreterExecConsole))
- {
- fSuppressConsoleOutputCounter--;
- }
- }
-
- void setPrompt(String line) {
- fPrompt = PromptType.IN_PRIMARY_PROMPT;
- // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=109733
- if (line == null)
- return;
- line = line.trim();
- if (line.equals(SECONDARY_PROMPT)) {
- fPrompt = PromptType.IN_SECONDARY_PROMPT;
- }
- }
-
- public boolean inPrimaryPrompt() {
- return fPrompt == PromptType.IN_PRIMARY_PROMPT;
- }
-
- public boolean inSecondaryPrompt() {
- return fPrompt == PromptType.IN_SECONDARY_PROMPT || fPrompt == PromptType.IN_SECONDARY_PROMPT_MISSING;
- }
-
- /**
+ public void commandDone(ICommandToken token, ICommandResult result) {
+ // Whenever we get a command that is completed, we know we must be in the primary prompt
+ fPrompt = PromptType.IN_PRIMARY_PROMPT;
+
+ ICommand<?> command = token.getCommand();
+ if ((command instanceof CLICommand<?> || command instanceof MIInterpreterExecConsole<?>)
+ && !(command instanceof ProcessCLICommand || command instanceof ProcessMIInterpreterExecConsole)) {
+ fSuppressConsoleOutputCounter--;
+ }
+ }
+
+ void setPrompt(String line) {
+ fPrompt = PromptType.IN_PRIMARY_PROMPT;
+ // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=109733
+ if (line == null)
+ return;
+ line = line.trim();
+ if (line.equals(SECONDARY_PROMPT)) {
+ fPrompt = PromptType.IN_SECONDARY_PROMPT;
+ }
+ }
+
+ public boolean inPrimaryPrompt() {
+ return fPrompt == PromptType.IN_PRIMARY_PROMPT;
+ }
+
+ public boolean inSecondaryPrompt() {
+ return fPrompt == PromptType.IN_SECONDARY_PROMPT || fPrompt == PromptType.IN_SECONDARY_PROMPT_MISSING;
+ }
+
+ /**
* @since 3.0
*/
- public boolean inMissingSecondaryPrompt() {
- return fPrompt == PromptType.IN_SECONDARY_PROMPT_MISSING;
- }
-
- private boolean isMIOperation(String operation) {
- // The definition of an MI command states that it starts with
- // [ token ] "-"
- // where 'token' is optional and a sequence of digits.
- // However, we don't accept a token from the user, because
- // we will be adding our own token when actually sending the command.
- if (operation.startsWith("-")) { //$NON-NLS-1$
- return true;
- }
- return false;
- }
-
- /**
- * Return the context under which CLI commands are sent to the backend.
- * <p>
- * Returning a context narrower than ICommandControlDMContext will cause
- * the communication with the backend to select the appropriate thread or
- * frame.
- *
- * @return the CLI context
- * @since 5.3
- */
- protected IDMContext getCliCommandContext() {
- return getCommandControlService().getContext();
- }
-
- private class CLIOutputStream extends OutputStream {
- private final StringBuilder buf = new StringBuilder();
-
- @Override
- public void write(int b) throws IOException {
- buf.append((char)b);
- if (b == '\n') {
- // Throw away the newline.
- final String bufString = buf.toString().trim();
- buf.setLength(0);
- try {
- fSession.getExecutor().execute(new DsfRunnable() { @Override public void run() {
- try {
- post(bufString);
- } catch (IOException e) {
- // Pipe closed.
- }
- }});
- } catch (RejectedExecutionException e) {
- // Session disposed.
- }
- }
- }
-
- // Encapsulate the string sent to gdb in a fake
- // command and post it to the TxThread.
- public void post(String str) throws IOException {
- if (isDisposed()) return;
- ICommand<MIInfo> cmd = null;
- // 1-
- // if We have the secondary prompt it means
- // that GDB is waiting for more feedback, use a RawCommand
- // 2-
- // Do not use the interpreter-exec for stepping operation
- // the UI will fall out of step.
- // Also, do not use "interpreter-exec console" for MI commands.
- // 3-
- // Normal Command Line Interface.
- boolean secondary = inSecondaryPrompt();
- IDMContext context = getCliCommandContext();
- if (secondary) {
- cmd = new RawCommand(context, str);
- }
- else if (! isMIOperation(str) &&
- ! CLIEventProcessor.isSteppingOperation(str))
- {
- cmd = new ProcessMIInterpreterExecConsole(context, str);
- }
- else {
- cmd = new ProcessCLICommand(context, str);
- }
- final ICommand<MIInfo> finalCmd = cmd;
- fSession.getExecutor().execute(new DsfRunnable() { @Override public void run() {
- if (isDisposed()) return;
- // Do not wait around for the answer.
- getCommandControlService().queueCommand(finalCmd, null);
- }});
- }
- }
-
- private class ProcessCLICommand extends CLICommand<MIInfo> {
- public ProcessCLICommand(IDMContext ctx, String oper) {
- super(ctx, oper);
- }
- }
-
- private class ProcessMIInterpreterExecConsole extends MIInterpreterExecConsole<MIInfo> {
- public ProcessMIInterpreterExecConsole(IDMContext ctx, String cmd) {
- super(ctx, cmd);
- }
- }
+ public boolean inMissingSecondaryPrompt() {
+ return fPrompt == PromptType.IN_SECONDARY_PROMPT_MISSING;
+ }
+
+ private boolean isMIOperation(String operation) {
+ // The definition of an MI command states that it starts with
+ // [ token ] "-"
+ // where 'token' is optional and a sequence of digits.
+ // However, we don't accept a token from the user, because
+ // we will be adding our own token when actually sending the command.
+ if (operation.startsWith("-")) { //$NON-NLS-1$
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Return the context under which CLI commands are sent to the backend.
+ * <p>
+ * Returning a context narrower than ICommandControlDMContext will cause
+ * the communication with the backend to select the appropriate thread or
+ * frame.
+ *
+ * @return the CLI context
+ * @since 5.3
+ */
+ protected IDMContext getCliCommandContext() {
+ return getCommandControlService().getContext();
+ }
+
+ private class CLIOutputStream extends OutputStream {
+ private final StringBuilder buf = new StringBuilder();
+
+ @Override
+ public void write(int b) throws IOException {
+ buf.append((char) b);
+ if (b == '\n') {
+ // Throw away the newline.
+ final String bufString = buf.toString().trim();
+ buf.setLength(0);
+ try {
+ fSession.getExecutor().execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ try {
+ post(bufString);
+ } catch (IOException e) {
+ // Pipe closed.
+ }
+ }
+ });
+ } catch (RejectedExecutionException e) {
+ // Session disposed.
+ }
+ }
+ }
+
+ // Encapsulate the string sent to gdb in a fake
+ // command and post it to the TxThread.
+ public void post(String str) throws IOException {
+ if (isDisposed())
+ return;
+ ICommand<MIInfo> cmd = null;
+ // 1-
+ // if We have the secondary prompt it means
+ // that GDB is waiting for more feedback, use a RawCommand
+ // 2-
+ // Do not use the interpreter-exec for stepping operation
+ // the UI will fall out of step.
+ // Also, do not use "interpreter-exec console" for MI commands.
+ // 3-
+ // Normal Command Line Interface.
+ boolean secondary = inSecondaryPrompt();
+ IDMContext context = getCliCommandContext();
+ if (secondary) {
+ cmd = new RawCommand(context, str);
+ } else if (!isMIOperation(str) && !CLIEventProcessor.isSteppingOperation(str)) {
+ cmd = new ProcessMIInterpreterExecConsole(context, str);
+ } else {
+ cmd = new ProcessCLICommand(context, str);
+ }
+ final ICommand<MIInfo> finalCmd = cmd;
+ fSession.getExecutor().execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ if (isDisposed())
+ return;
+ // Do not wait around for the answer.
+ getCommandControlService().queueCommand(finalCmd, null);
+ }
+ });
+ }
+ }
+
+ private class ProcessCLICommand extends CLICommand<MIInfo> {
+ public ProcessCLICommand(IDMContext ctx, String oper) {
+ super(ctx, oper);
+ }
+ }
+
+ private class ProcessMIInterpreterExecConsole extends MIInterpreterExecConsole<MIInfo> {
+ public ProcessMIInterpreterExecConsole(IDMContext ctx, String cmd) {
+ super(ctx, cmd);
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/AbstractMIControl.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/AbstractMIControl.java
index 42f13c86315..2a40598826e 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/AbstractMIControl.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/AbstractMIControl.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* Ericsson - Modified for handling of multiple stacks and threads
@@ -74,301 +74,305 @@ import org.eclipse.core.runtime.Status;
import com.ibm.icu.text.MessageFormat;
/**
- * Base implementation of an MI control service. It provides basic handling
+ * Base implementation of an MI control service. It provides basic handling
* of input/output channels, and processing of the commands.
* <p>
* Extending classes need to implement the initialize() and shutdown() methods.
*/
-public abstract class AbstractMIControl extends AbstractDsfService
- implements IMICommandControl
-{
+public abstract class AbstractMIControl extends AbstractDsfService implements IMICommandControl {
private static final String MI_TRACE_IDENTIFIER = "[MI]"; //$NON-NLS-1$
private static final int NUMBER_CONCURRENT_COMMANDS = 3;
private static final int DEVELOPMENT_TRACE_LIMIT_CHARS = 5000;
-
- /*
+
+ /*
* Thread control variables for the transmit and receive threads.
*/
private TxThread fTxThread;
- private RxThread fRxThread;
- private ErrorThread fErrorThread;
-
- // MI did not always support the --thread/--frame options
- // This boolean is used to know if we should use -thread-select and -stack-select-frame instead
- private boolean fUseThreadAndFrameOptions;
- // currentStackLevel and currentThreadId are only necessary when
- // we must use -thread-select and -stack-select-frame
- private int fCurrentStackLevel = -1;
- private String fCurrentThreadId = null;
-
- // boolean for --thread-group option which helps to handle multiple inferior behavior.
- // Since GDB.7.1
- private boolean fUseThreadGroupOption;
-
- private final BlockingQueue<CommandHandle> fTxCommands = new LinkedBlockingQueue<CommandHandle>();
- private final Map<Integer, CommandHandle> fRxCommands = Collections.synchronizedMap(new HashMap<Integer, CommandHandle>());
-
- /**
- * Handle that's inserted into the TX commands queue to signal
- * that the TX thread should shut down.
- */
- private final CommandHandle fTerminatorHandle = new CommandHandle(null, null);
-
- /*
- * Various listener control variables used to keep track of listeners who want to monitor
- * what the control object is doing.
- */
-
- private final List<ICommandListener> fCommandProcessors = new ArrayList<ICommandListener>();
- private final List<IEventListener> fEventProcessors = new ArrayList<IEventListener>();
-
- /**
- * Current command which have not been handed off to the backend yet.
- */
-
- private final List<CommandHandle> fCommandQueue = new ArrayList<CommandHandle>();
-
- /**
- * Flag indicating that the command control has stopped processing commands.
- */
- private boolean fStoppedCommandProcessing = false;
-
- /**
- * An output stream that MI communication should be output to.
- * It serves for debugging. Can be <code>null</code> to disable tracing.
- */
- private OutputStream fTracingStream = null;
-
- private CommandFactory fCommandFactory;
-
- public AbstractMIControl(DsfSession session) {
- this(session, false, false, new CommandFactory());
- }
-
- /**
- * @since 3.0
- */
- public AbstractMIControl(DsfSession session, boolean useThreadAndFrameOptions, CommandFactory factory) {
- this(session, false, useThreadAndFrameOptions, factory);
- }
-
- /**
+ private RxThread fRxThread;
+ private ErrorThread fErrorThread;
+
+ // MI did not always support the --thread/--frame options
+ // This boolean is used to know if we should use -thread-select and -stack-select-frame instead
+ private boolean fUseThreadAndFrameOptions;
+ // currentStackLevel and currentThreadId are only necessary when
+ // we must use -thread-select and -stack-select-frame
+ private int fCurrentStackLevel = -1;
+ private String fCurrentThreadId = null;
+
+ // boolean for --thread-group option which helps to handle multiple inferior behavior.
+ // Since GDB.7.1
+ private boolean fUseThreadGroupOption;
+
+ private final BlockingQueue<CommandHandle> fTxCommands = new LinkedBlockingQueue<CommandHandle>();
+ private final Map<Integer, CommandHandle> fRxCommands = Collections
+ .synchronizedMap(new HashMap<Integer, CommandHandle>());
+
+ /**
+ * Handle that's inserted into the TX commands queue to signal
+ * that the TX thread should shut down.
+ */
+ private final CommandHandle fTerminatorHandle = new CommandHandle(null, null);
+
+ /*
+ * Various listener control variables used to keep track of listeners who want to monitor
+ * what the control object is doing.
+ */
+
+ private final List<ICommandListener> fCommandProcessors = new ArrayList<ICommandListener>();
+ private final List<IEventListener> fEventProcessors = new ArrayList<IEventListener>();
+
+ /**
+ * Current command which have not been handed off to the backend yet.
+ */
+
+ private final List<CommandHandle> fCommandQueue = new ArrayList<CommandHandle>();
+
+ /**
+ * Flag indicating that the command control has stopped processing commands.
+ */
+ private boolean fStoppedCommandProcessing = false;
+
+ /**
+ * An output stream that MI communication should be output to.
+ * It serves for debugging. Can be <code>null</code> to disable tracing.
+ */
+ private OutputStream fTracingStream = null;
+
+ private CommandFactory fCommandFactory;
+
+ public AbstractMIControl(DsfSession session) {
+ this(session, false, false, new CommandFactory());
+ }
+
+ /**
+ * @since 3.0
+ */
+ public AbstractMIControl(DsfSession session, boolean useThreadAndFrameOptions, CommandFactory factory) {
+ this(session, false, useThreadAndFrameOptions, factory);
+ }
+
+ /**
* @since 4.0
*/
- public AbstractMIControl(DsfSession session, boolean useThreadGroupOption, boolean useThreadAndFrameOptions, CommandFactory factory) {
- super(session);
-
- // If we use the --thread-group option, we should automatically use the --thread/--frame option
- // since the --thread-group was added to GDB later than the --thread/--frame option
- assert useThreadGroupOption ? useThreadAndFrameOptions : true;
-
- fUseThreadGroupOption = useThreadGroupOption;
- fUseThreadAndFrameOptions = useThreadAndFrameOptions;
- if (fUseThreadGroupOption) {
- // If we use --thread-group option, we should automatically use the --thread option
- fUseThreadAndFrameOptions = true;
- }
- fCommandFactory = factory;
- }
-
- /**
- * Set the tracing stream for the MI communication. If this method is never
- * called, tracing will be off, by default.
- *
- * @param tracingStream The stream to use. Can be <code>null</code>
- * to disable tracing.
- * @since 2.0
- */
- protected synchronized void setMITracingStream(OutputStream tracingStream) {
- fTracingStream = tracingStream;
- }
-
- /**
- * Returns the MI tracing stream.
- */
- private synchronized OutputStream getMITracingStream() {
- return fTracingStream;
- }
-
- /**
+ public AbstractMIControl(DsfSession session, boolean useThreadGroupOption, boolean useThreadAndFrameOptions,
+ CommandFactory factory) {
+ super(session);
+
+ // If we use the --thread-group option, we should automatically use the --thread/--frame option
+ // since the --thread-group was added to GDB later than the --thread/--frame option
+ assert useThreadGroupOption ? useThreadAndFrameOptions : true;
+
+ fUseThreadGroupOption = useThreadGroupOption;
+ fUseThreadAndFrameOptions = useThreadAndFrameOptions;
+ if (fUseThreadGroupOption) {
+ // If we use --thread-group option, we should automatically use the --thread option
+ fUseThreadAndFrameOptions = true;
+ }
+ fCommandFactory = factory;
+ }
+
+ /**
+ * Set the tracing stream for the MI communication. If this method is never
+ * called, tracing will be off, by default.
+ *
+ * @param tracingStream The stream to use. Can be <code>null</code>
+ * to disable tracing.
+ * @since 2.0
+ */
+ protected synchronized void setMITracingStream(OutputStream tracingStream) {
+ fTracingStream = tracingStream;
+ }
+
+ /**
+ * Returns the MI tracing stream.
+ */
+ private synchronized OutputStream getMITracingStream() {
+ return fTracingStream;
+ }
+
+ /**
* @since 3.0
*/
- protected void setUseThreadAndFrameOptions(boolean shouldUse) {
- fUseThreadAndFrameOptions = shouldUse;
- }
-
- /**
+ protected void setUseThreadAndFrameOptions(boolean shouldUse) {
+ fUseThreadAndFrameOptions = shouldUse;
+ }
+
+ /**
* @since 4.0
*/
- protected void setUseThreadGroupOptions(boolean shouldUse) {
- fUseThreadGroupOption = shouldUse;
- if (shouldUse) {
- fUseThreadAndFrameOptions = true;
- }
- }
-
- /**
- * @since 3.0
- */
+ protected void setUseThreadGroupOptions(boolean shouldUse) {
+ fUseThreadGroupOption = shouldUse;
+ if (shouldUse) {
+ fUseThreadAndFrameOptions = true;
+ }
+ }
+
+ /**
+ * @since 3.0
+ */
@Override
- public CommandFactory getCommandFactory() {
- return fCommandFactory;
- }
-
- /**
- * Starts the threads that process the debugger input/output channels.
- * To be invoked by the initialization routine of the extending class.
- *
- * This version of the method will not start a thread for the error stream.
- *
- * @param inStream
- * @param outStream
- */
- protected void startCommandProcessing(InputStream inStream, OutputStream outStream) {
- startCommandProcessing(inStream, outStream, null);
- }
-
- /**
- * Starts the threads that process the debugger input/output/error channels.
- * To be invoked by the initialization routine of the extending class.
- *
- *
- * @param inStream
- * @param outStream
- * @param errorStream
- * @since 4.1
- */
- protected void startCommandProcessing(InputStream inStream, OutputStream outStream, InputStream errorStream) {
-
- fTxThread = new TxThread(outStream);
- fRxThread = new RxThread(inStream);
-
- if (errorStream != null) {
- fErrorThread = new ErrorThread(errorStream);
- }
-
- fTxThread.start();
- fRxThread.start();
- if (fErrorThread != null) {
- fErrorThread.start();
- }
- }
-
- /**
- * Stops the threads that process the debugger input/output channels, and notifies the
- * results of the outstanding commands. To be invoked by the shutdown routine of the
- * extending class.
- *
- * @param inStream
- * @param outStream
- */
-
- private Status genStatus(String str) {
- return new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, str, null);
- }
-
- protected void stopCommandProcessing() {
- // Guard against calling this multiple times (e.g. as a result of a
- // user request and an event from the back end).
- if (fStoppedCommandProcessing) return;
- fStoppedCommandProcessing = true;
-
- /*
- * First go through the commands which have been queueud and not yet sent to the backend.
- */
- for (CommandHandle commandHandle : fCommandQueue) {
- if (commandHandle.getRequestMonitor() == null) continue;
- commandHandle.getRequestMonitor().setStatus(genStatus("Connection is shut down")); //$NON-NLS-1$
- commandHandle.getRequestMonitor().done();
- }
- fCommandQueue.clear();
-
- /*
- * Now go through the commands which are outstanding in that they have been sent to the backend.
- */
- cancelRxCommands();
-
- /*
- * Now handle any requests which have not been transmitted, but weconsider them handed off.
- */
- List<CommandHandle> txCommands = new ArrayList<CommandHandle>();
- fTxCommands.drainTo(txCommands);
- for (CommandHandle commandHandle : txCommands) {
- if (commandHandle.getRequestMonitor() == null) continue;
- commandHandle.getRequestMonitor().setStatus(genStatus("Connection is shut down")); //$NON-NLS-1$
- commandHandle.getRequestMonitor().done();
- }
-
- // Queue a null value to tell the send thread to shut down.
- fTxCommands.add(fTerminatorHandle);
- }
-
- private synchronized void cancelRxCommands() {
- for (CommandHandle commandHandle : fRxCommands.values()) {
- if (commandHandle.getRequestMonitor() == null) continue;
- commandHandle.getRequestMonitor().setStatus(genStatus( "Connection is shut down")); //$NON-NLS-1$
- commandHandle.getRequestMonitor().done();
- }
- fRxCommands.clear();
- }
-
- /**
- * Queues the given MI command to be sent to the debugger back end.
- *
- * @param command Command to be executed. This parameter must be an
- * instance of DsfMICommand, otherwise a ClassCastException will be
- * thrown.
- * @param rm Request completion monitor
- *
- * @see org.eclipse.cdt.dsf.debug.service.command.ICommandControl#addCommand(org.eclipse.cdt.dsf.debug.service.command.ICommand, org.eclipse.cdt.dsf.concurrent.RequestMonitor)
- */
-
+ public CommandFactory getCommandFactory() {
+ return fCommandFactory;
+ }
+
+ /**
+ * Starts the threads that process the debugger input/output channels.
+ * To be invoked by the initialization routine of the extending class.
+ *
+ * This version of the method will not start a thread for the error stream.
+ *
+ * @param inStream
+ * @param outStream
+ */
+ protected void startCommandProcessing(InputStream inStream, OutputStream outStream) {
+ startCommandProcessing(inStream, outStream, null);
+ }
+
+ /**
+ * Starts the threads that process the debugger input/output/error channels.
+ * To be invoked by the initialization routine of the extending class.
+ *
+ *
+ * @param inStream
+ * @param outStream
+ * @param errorStream
+ * @since 4.1
+ */
+ protected void startCommandProcessing(InputStream inStream, OutputStream outStream, InputStream errorStream) {
+
+ fTxThread = new TxThread(outStream);
+ fRxThread = new RxThread(inStream);
+
+ if (errorStream != null) {
+ fErrorThread = new ErrorThread(errorStream);
+ }
+
+ fTxThread.start();
+ fRxThread.start();
+ if (fErrorThread != null) {
+ fErrorThread.start();
+ }
+ }
+
+ /**
+ * Stops the threads that process the debugger input/output channels, and notifies the
+ * results of the outstanding commands. To be invoked by the shutdown routine of the
+ * extending class.
+ *
+ * @param inStream
+ * @param outStream
+ */
+
+ private Status genStatus(String str) {
+ return new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, str, null);
+ }
+
+ protected void stopCommandProcessing() {
+ // Guard against calling this multiple times (e.g. as a result of a
+ // user request and an event from the back end).
+ if (fStoppedCommandProcessing)
+ return;
+ fStoppedCommandProcessing = true;
+
+ /*
+ * First go through the commands which have been queueud and not yet sent to the backend.
+ */
+ for (CommandHandle commandHandle : fCommandQueue) {
+ if (commandHandle.getRequestMonitor() == null)
+ continue;
+ commandHandle.getRequestMonitor().setStatus(genStatus("Connection is shut down")); //$NON-NLS-1$
+ commandHandle.getRequestMonitor().done();
+ }
+ fCommandQueue.clear();
+
+ /*
+ * Now go through the commands which are outstanding in that they have been sent to the backend.
+ */
+ cancelRxCommands();
+
+ /*
+ * Now handle any requests which have not been transmitted, but weconsider them handed off.
+ */
+ List<CommandHandle> txCommands = new ArrayList<CommandHandle>();
+ fTxCommands.drainTo(txCommands);
+ for (CommandHandle commandHandle : txCommands) {
+ if (commandHandle.getRequestMonitor() == null)
+ continue;
+ commandHandle.getRequestMonitor().setStatus(genStatus("Connection is shut down")); //$NON-NLS-1$
+ commandHandle.getRequestMonitor().done();
+ }
+
+ // Queue a null value to tell the send thread to shut down.
+ fTxCommands.add(fTerminatorHandle);
+ }
+
+ private synchronized void cancelRxCommands() {
+ for (CommandHandle commandHandle : fRxCommands.values()) {
+ if (commandHandle.getRequestMonitor() == null)
+ continue;
+ commandHandle.getRequestMonitor().setStatus(genStatus("Connection is shut down")); //$NON-NLS-1$
+ commandHandle.getRequestMonitor().done();
+ }
+ fRxCommands.clear();
+ }
+
+ /**
+ * Queues the given MI command to be sent to the debugger back end.
+ *
+ * @param command Command to be executed. This parameter must be an
+ * instance of DsfMICommand, otherwise a ClassCastException will be
+ * thrown.
+ * @param rm Request completion monitor
+ *
+ * @see org.eclipse.cdt.dsf.debug.service.command.ICommandControl#addCommand(org.eclipse.cdt.dsf.debug.service.command.ICommand, org.eclipse.cdt.dsf.concurrent.RequestMonitor)
+ */
+
@Override
- public <V extends ICommandResult> ICommandToken queueCommand(final ICommand<V> command, DataRequestMonitor<V> rm) {
-
- // Cast the command to MI Command type. This will cause a cast exception to be
- // thrown if the client did not give an MI command as an argument.
- @SuppressWarnings("unchecked")
- MICommand<MIInfo> miCommand = (MICommand<MIInfo>) command;
-
- // Cast the return token to match the result type of MI Command. This is checking
- // against an erased type so it should never throw any exceptions.
- @SuppressWarnings("unchecked")
- DataRequestMonitor<MIInfo> miDone = (DataRequestMonitor<MIInfo>) rm;
-
- final CommandHandle handle = new CommandHandle(miCommand, miDone);
-
- // If the command control stopped processing commands, just return an error immediately.
- if (fStoppedCommandProcessing) {
- rm.setStatus(genStatus("Connection is shut down")); //$NON-NLS-1$
- rm.done();
- } else {
- /*
- * We only allow three outstanding commands to be on the wire to the backend
- * at any one time. This allows for coalescing as well as canceling
- * existing commands on a state change. So we add it to the waiting list and let
- * the user know they can now work with this item if need be.
- */
- fCommandQueue.add(handle);
- processCommandQueued(handle);
-
- if (fRxCommands.size() < NUMBER_CONCURRENT_COMMANDS) {
- // In a separate dispatch cycle. This allows command listeners
- // to respond to the command queued event.
- getExecutor().execute(new DsfRunnable() {
- @Override
- public void run() {
- processNextQueuedCommand();
- }
- });
- }
- }
-
- return handle;
- }
-
- private void processNextQueuedCommand() {
+ public <V extends ICommandResult> ICommandToken queueCommand(final ICommand<V> command, DataRequestMonitor<V> rm) {
+
+ // Cast the command to MI Command type. This will cause a cast exception to be
+ // thrown if the client did not give an MI command as an argument.
+ @SuppressWarnings("unchecked")
+ MICommand<MIInfo> miCommand = (MICommand<MIInfo>) command;
+
+ // Cast the return token to match the result type of MI Command. This is checking
+ // against an erased type so it should never throw any exceptions.
+ @SuppressWarnings("unchecked")
+ DataRequestMonitor<MIInfo> miDone = (DataRequestMonitor<MIInfo>) rm;
+
+ final CommandHandle handle = new CommandHandle(miCommand, miDone);
+
+ // If the command control stopped processing commands, just return an error immediately.
+ if (fStoppedCommandProcessing) {
+ rm.setStatus(genStatus("Connection is shut down")); //$NON-NLS-1$
+ rm.done();
+ } else {
+ /*
+ * We only allow three outstanding commands to be on the wire to the backend
+ * at any one time. This allows for coalescing as well as canceling
+ * existing commands on a state change. So we add it to the waiting list and let
+ * the user know they can now work with this item if need be.
+ */
+ fCommandQueue.add(handle);
+ processCommandQueued(handle);
+
+ if (fRxCommands.size() < NUMBER_CONCURRENT_COMMANDS) {
+ // In a separate dispatch cycle. This allows command listeners
+ // to respond to the command queued event.
+ getExecutor().execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ processNextQueuedCommand();
+ }
+ });
+ }
+ }
+
+ return handle;
+ }
+
+ private void processNextQueuedCommand() {
if (!fCommandQueue.isEmpty()) {
final CommandHandle handle = fCommandQueue.remove(0);
if (handle != null) {
@@ -377,35 +381,37 @@ public abstract class AbstractMIControl extends AbstractDsfService
// Older debuggers didn't support the --thread/--frame options
// Also, not all commands support those options (e.g., CLI commands)
if (!fUseThreadAndFrameOptions || !handle.getCommand().supportsThreadAndFrameOptions()) {
- // Without the --thread/--frame, we need to send the proper
+ // Without the --thread/--frame, we need to send the proper
// -thread-select and -stack-frame-select before sending the command
-
+
final IDMContext targetContext = handle.fCommand.getContext();
final String targetThread = handle.getThreadId();
final int targetFrame = handle.getStackFrameId();
// The thread-select and frame-select make sense only if the thread is stopped.
IRunControl runControl = getServicesTracker().getService(IRunControl.class);
- IMIExecutionDMContext execDmc = DMContexts.getAncestorOfType(targetContext, IMIExecutionDMContext.class);
+ IMIExecutionDMContext execDmc = DMContexts.getAncestorOfType(targetContext,
+ IMIExecutionDMContext.class);
if (runControl != null && execDmc != null && runControl.isSuspended(execDmc)) {
- // Before the command is sent, Check the Thread Id and send it to
+ // Before the command is sent, Check the Thread Id and send it to
// the queue only if the id has been changed. Also, don't send a threadId of 0,
// because that id is only used internally for single-threaded programs
- if (targetThread != null && !targetThread.equals("0") && !targetThread.equals(fCurrentThreadId)) { //$NON-NLS-1$
+ if (targetThread != null && !targetThread.equals("0") //$NON-NLS-1$
+ && !targetThread.equals(fCurrentThreadId)) {
fCurrentThreadId = targetThread;
resetCurrentStackLevel();
- CommandHandle cmdHandle = new CommandHandle(
- (MICommand<MIInfo>)getCommandFactory().createMIThreadSelect(targetContext, targetThread), null);
+ CommandHandle cmdHandle = new CommandHandle((MICommand<MIInfo>) getCommandFactory()
+ .createMIThreadSelect(targetContext, targetThread), null);
cmdHandle.generateTokenId();
fTxCommands.add(cmdHandle);
}
- // Before the command is sent, Check the Stack level and send it to
- // the queue only if the level has been changed.
+ // Before the command is sent, Check the Stack level and send it to
+ // the queue only if the level has been changed.
if (targetFrame >= 0 && targetFrame != fCurrentStackLevel) {
fCurrentStackLevel = targetFrame;
- CommandHandle cmdHandle = new CommandHandle(
- (MICommand<MIInfo>)getCommandFactory().createMIStackSelectFrame(targetContext, targetFrame), null);
+ CommandHandle cmdHandle = new CommandHandle((MICommand<MIInfo>) getCommandFactory()
+ .createMIStackSelectFrame(targetContext, targetFrame), null);
cmdHandle.generateTokenId();
fTxCommands.add(cmdHandle);
}
@@ -418,131 +424,140 @@ public abstract class AbstractMIControl extends AbstractDsfService
// need a token id. In fact, GDB will fail if we send one in this case.
handle.generateTokenId();
}
- fTxCommands.add(handle);
+ fTxCommands.add(handle);
}
}
- }
-
- /*
- * This is the command which allows the user to retract a previously issued command. The
- * state of the command is that it is in the waiting queue and has not yet been handed
- * to the backend yet.
- *
- * (non-Javadoc)
- * @see org.eclipse.cdt.dsf.mi.service.command.IDebuggerControl#removeCommand(org.eclipse.cdt.dsf.mi.service.command.commands.ICommand)
- */
+ }
+
+ /*
+ * This is the command which allows the user to retract a previously issued command. The
+ * state of the command is that it is in the waiting queue and has not yet been handed
+ * to the backend yet.
+ *
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.dsf.mi.service.command.IDebuggerControl#removeCommand(org.eclipse.cdt.dsf.mi.service.command.commands.ICommand)
+ */
@Override
- public void removeCommand(ICommandToken token) {
-
- synchronized(fCommandQueue) {
-
- for ( CommandHandle handle : fCommandQueue ) {
- if ( handle.equals(token)) {
- fCommandQueue.remove(handle);
-
- final CommandHandle finalHandle = handle;
- getExecutor().execute(new DsfRunnable() {
- @Override
- public void run() {
- processCommandRemoved(finalHandle);
- }
- });
- break;
- }
- }
- }
- }
-
- /*
- * Allows a user ( typically a cache manager ) to sign up a listener to monitor command queue
- * activity.
- *
- * (non-Javadoc)
- * @see org.eclipse.cdt.dsf.mi.service.command.IDebuggerControl#addCommandListener(org.eclipse.cdt.dsf.mi.service.command.IDebuggerControl.ICommandListener)
- */
+ public void removeCommand(ICommandToken token) {
+
+ synchronized (fCommandQueue) {
+
+ for (CommandHandle handle : fCommandQueue) {
+ if (handle.equals(token)) {
+ fCommandQueue.remove(handle);
+
+ final CommandHandle finalHandle = handle;
+ getExecutor().execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ processCommandRemoved(finalHandle);
+ }
+ });
+ break;
+ }
+ }
+ }
+ }
+
+ /*
+ * Allows a user ( typically a cache manager ) to sign up a listener to monitor command queue
+ * activity.
+ *
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.dsf.mi.service.command.IDebuggerControl#addCommandListener(org.eclipse.cdt.dsf.mi.service.command.IDebuggerControl.ICommandListener)
+ */
@Override
- public void addCommandListener(ICommandListener processor) { fCommandProcessors.add(processor); }
-
- /*
- * Allows a user ( typically a cache manager ) to remove a monitoring listener.
- * (non-Javadoc)
- * @see org.eclipse.cdt.dsf.mi.service.command.IDebuggerControl#removeCommandListener(org.eclipse.cdt.dsf.mi.service.command.IDebuggerControl.ICommandListener)
- */
+ public void addCommandListener(ICommandListener processor) {
+ fCommandProcessors.add(processor);
+ }
+
+ /*
+ * Allows a user ( typically a cache manager ) to remove a monitoring listener.
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.dsf.mi.service.command.IDebuggerControl#removeCommandListener(org.eclipse.cdt.dsf.mi.service.command.IDebuggerControl.ICommandListener)
+ */
@Override
- public void removeCommandListener(ICommandListener processor) { fCommandProcessors.remove(processor); }
-
- /*
- * Allows a user to sign up to a listener which handles out of band messages ( events ).
- *
- * (non-Javadoc)
- * @see org.eclipse.cdt.dsf.mi.service.command.IDebuggerControl#addEventListener(org.eclipse.cdt.dsf.mi.service.command.IDebuggerControl.IEventListener)
- */
+ public void removeCommandListener(ICommandListener processor) {
+ fCommandProcessors.remove(processor);
+ }
+
+ /*
+ * Allows a user to sign up to a listener which handles out of band messages ( events ).
+ *
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.dsf.mi.service.command.IDebuggerControl#addEventListener(org.eclipse.cdt.dsf.mi.service.command.IDebuggerControl.IEventListener)
+ */
@Override
- public void addEventListener(IEventListener processor) { fEventProcessors.add(processor); }
-
- /*
- * Allows a user to remove a event monitoring listener.
- *
- * (non-Javadoc)
- * @see org.eclipse.cdt.dsf.mi.service.command.IDebuggerControl#removeEventListener(org.eclipse.cdt.dsf.mi.service.command.IDebuggerControl.IEventListener)
- */
+ public void addEventListener(IEventListener processor) {
+ fEventProcessors.add(processor);
+ }
+
+ /*
+ * Allows a user to remove a event monitoring listener.
+ *
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.dsf.mi.service.command.IDebuggerControl#removeEventListener(org.eclipse.cdt.dsf.mi.service.command.IDebuggerControl.IEventListener)
+ */
@Override
- public void removeEventListener(IEventListener processor) { fEventProcessors.remove(processor); }
-
+ public void removeEventListener(IEventListener processor) {
+ fEventProcessors.remove(processor);
+ }
+
/** @deprecated Replaced with {@link ICommandControlService#getContext()} */
@Deprecated
- abstract public MIControlDMContext getControlDMContext();
-
- /**
- * @since 1.1
- */
+ abstract public MIControlDMContext getControlDMContext();
+
+ /**
+ * @since 1.1
+ */
@Override
- public boolean isActive() {
- return !fStoppedCommandProcessing;
- }
-
- /*
- * These are the service routines which perform the various callouts back to the listeners.
- */
-
- private void processCommandQueued(CommandHandle commandHandle) {
- for (ICommandListener processor : fCommandProcessors) {
- processor.commandQueued(commandHandle);
- }
- }
- private void processCommandRemoved(CommandHandle commandHandle) {
- for (ICommandListener processor : fCommandProcessors) {
- processor.commandRemoved(commandHandle);
- }
- }
-
- private void processCommandSent(CommandHandle commandHandle) {
- for (ICommandListener processor : fCommandProcessors) {
- processor.commandSent(commandHandle);
- }
- }
-
- private void processCommandDone(CommandHandle commandHandle, ICommandResult result) {
- /*
- * Tell the listeners we have completed this one.
- */
- for (ICommandListener processor : fCommandProcessors) {
- processor.commandDone(commandHandle, result);
- }
- }
-
- private void processEvent(MIOutput output) {
- for (IEventListener processor : fEventProcessors) {
- processor.eventReceived(output);
- }
- }
+ public boolean isActive() {
+ return !fStoppedCommandProcessing;
+ }
+
+ /*
+ * These are the service routines which perform the various callouts back to the listeners.
+ */
+
+ private void processCommandQueued(CommandHandle commandHandle) {
+ for (ICommandListener processor : fCommandProcessors) {
+ processor.commandQueued(commandHandle);
+ }
+ }
+
+ private void processCommandRemoved(CommandHandle commandHandle) {
+ for (ICommandListener processor : fCommandProcessors) {
+ processor.commandRemoved(commandHandle);
+ }
+ }
+
+ private void processCommandSent(CommandHandle commandHandle) {
+ for (ICommandListener processor : fCommandProcessors) {
+ processor.commandSent(commandHandle);
+ }
+ }
+
+ private void processCommandDone(CommandHandle commandHandle, ICommandResult result) {
+ /*
+ * Tell the listeners we have completed this one.
+ */
+ for (ICommandListener processor : fCommandProcessors) {
+ processor.commandDone(commandHandle, result);
+ }
+ }
+
+ private void processEvent(MIOutput output) {
+ for (IEventListener processor : fEventProcessors) {
+ processor.eventReceived(output);
+ }
+ }
/*
* A global counter for all command, the token will be use to identify uniquely a command.
* Unless the value wraps around which is unlikely.
*/
- private int fTokenIdCounter = 0 ;
-
+ private int fTokenIdCounter = 0;
+
private int getNewTokenId() {
int count = ++fTokenIdCounter;
// If we ever wrap around.
@@ -551,175 +566,189 @@ public abstract class AbstractMIControl extends AbstractDsfService
}
return count;
}
-
+
/*
* Support class which creates a convenient wrapper for holding all information about an
* individual request.
*/
-
- private class CommandHandle implements ICommandToken {
-
- private MICommand<MIInfo> fCommand;
- private DataRequestMonitor<MIInfo> fRequestMonitor;
- private int fTokenId ;
-
- CommandHandle(MICommand<MIInfo> c, DataRequestMonitor<MIInfo> d) {
- fCommand = c;
- fRequestMonitor = d;
- fTokenId = -1; // Only initialize to a real value when needed
- }
-
- @Override
- public MICommand<MIInfo> getCommand() { return fCommand; }
- public DataRequestMonitor<MIInfo> getRequestMonitor() { return fRequestMonitor; }
- // This method allows us to generate the token Id when we area actually going to use
- // it. It is meant to help order the token ids based on when commands will actually
- // be sent
- public void generateTokenId() { fTokenId = getNewTokenId(); }
- public Integer getTokenId() { return fTokenId; }
-
- public int getStackFrameId() {
- IFrameDMContext frameCtx = DMContexts.getAncestorOfType(fCommand.getContext(), IFrameDMContext.class);
- if(frameCtx != null)
- return frameCtx.getLevel();
- return -1;
- }
-
- public String getThreadId() {
- IMIExecutionDMContext execCtx = DMContexts.getAncestorOfType(fCommand.getContext(), IMIExecutionDMContext.class);
- if(execCtx != null)
- return execCtx.getThreadId();
- return null;
- }
-
- public String getGroupId() {
- IMIContainerDMContext containerCtx = DMContexts.getAncestorOfType(fCommand.getContext(), IMIContainerDMContext.class);
- if(containerCtx != null)
- return containerCtx.getGroupId();
- return null;
- }
-
- @Override
- public String toString() {
- return Integer.toString(fTokenId) + fCommand;
- }
- }
-
- /*
- * This is the transmitter thread. When a command is given to this thread it has been
- * considered to be sent, even if it has not actually been sent yet. This assumption
- * makes it easier from state management. Whomever fill this pipeline handles all of
- * the required state notification ( callbacks ). This thread simply physically gives
- * the message to the backend.
- */
-
- private class TxThread extends Thread {
-
- final private OutputStream fOutputStream;
-
- public TxThread(OutputStream outStream) {
- super("MI TX Thread"); //$NON-NLS-1$
- fOutputStream = outStream;
- }
-
- @Override
- public void run () {
- while (true) {
- CommandHandle commandHandle = null;
-
- try {
- commandHandle = fTxCommands.take();
- } catch (InterruptedException e) {
- break; // Shutting down.
- }
-
- if (commandHandle == fTerminatorHandle) {
- // There is a small possibility that a new command was inserted
- // in the fRxCommands map after we cleared that map.
- // Just to be safe, clear it again.
- // We do this to avoid synchronizing the handling of fRxCommands
- // because this is more efficient, as it happens only once at shutdown.
- cancelRxCommands();
- break; // Null command is an indicator that we're shutting down.
- }
-
- /*
- * We note that this is an outstanding request at this point.
- */
- if (!(commandHandle.getCommand() instanceof RawCommand)) {
- // RawCommands will not get an answer, so we cannot put them in the receive queue.
- fRxCommands.put(commandHandle.getTokenId(), commandHandle);
- }
-
- /*
- * Construct the new command and push this command out the pipeline.
- */
-
- final String str;
- if (commandHandle.getCommand() instanceof RawCommand) {
- // RawCommands CANNOT have a token id: GDB would read it as part of the RawCommand!
- str = commandHandle.getCommand().constructCommand();
- } else if (fUseThreadGroupOption) {
- // Implies that fUseThreadAndFrameOptions == true
- str = commandHandle.getTokenId() + commandHandle.getCommand().constructCommand(commandHandle.getGroupId(),
- commandHandle.getThreadId(),
- commandHandle.getStackFrameId());
- } else if (fUseThreadAndFrameOptions) {
- str = commandHandle.getTokenId() + commandHandle.getCommand().constructCommand(commandHandle.getThreadId(),
- commandHandle.getStackFrameId());
- } else {
- str = commandHandle.getTokenId() + commandHandle.getCommand().constructCommand();
- }
-
- try {
- if (fOutputStream != null) {
-
- if (GdbDebugOptions.DEBUG) {
- GdbDebugOptions.trace(String.format( "%s %s %s", GdbPlugin.getDebugTime(), MI_TRACE_IDENTIFIER, str)); //$NON-NLS-1$
- }
- if (getMITracingStream() != null) {
- try {
- String message = GdbPlugin.getDebugTime() + " " + str; //$NON-NLS-1$
- while (message.length() > 100) {
- String partial = message.substring(0, 100) + "\\\n"; //$NON-NLS-1$
- message = message.substring(100);
- getMITracingStream().write(partial.getBytes());
- }
- getMITracingStream().write(message.getBytes());
- } catch (IOException e) {
- // The tracing stream could be closed at any time
- // since the user can set a preference to turn off
- // this tracing.
- setMITracingStream(null);
- }
- }
-
- fOutputStream.write(str.getBytes());
- fOutputStream.flush();
- }
- } catch (IOException e) {
- // Shutdown thread in case of IO error.
- break;
- }
- }
- // Must close the stream here to avoid leaking
- // Bug 345164 and Bug 339379
- try {
- if (fOutputStream != null) fOutputStream.close();
+
+ private class CommandHandle implements ICommandToken {
+
+ private MICommand<MIInfo> fCommand;
+ private DataRequestMonitor<MIInfo> fRequestMonitor;
+ private int fTokenId;
+
+ CommandHandle(MICommand<MIInfo> c, DataRequestMonitor<MIInfo> d) {
+ fCommand = c;
+ fRequestMonitor = d;
+ fTokenId = -1; // Only initialize to a real value when needed
+ }
+
+ @Override
+ public MICommand<MIInfo> getCommand() {
+ return fCommand;
+ }
+
+ public DataRequestMonitor<MIInfo> getRequestMonitor() {
+ return fRequestMonitor;
+ }
+
+ // This method allows us to generate the token Id when we area actually going to use
+ // it. It is meant to help order the token ids based on when commands will actually
+ // be sent
+ public void generateTokenId() {
+ fTokenId = getNewTokenId();
+ }
+
+ public Integer getTokenId() {
+ return fTokenId;
+ }
+
+ public int getStackFrameId() {
+ IFrameDMContext frameCtx = DMContexts.getAncestorOfType(fCommand.getContext(), IFrameDMContext.class);
+ if (frameCtx != null)
+ return frameCtx.getLevel();
+ return -1;
+ }
+
+ public String getThreadId() {
+ IMIExecutionDMContext execCtx = DMContexts.getAncestorOfType(fCommand.getContext(),
+ IMIExecutionDMContext.class);
+ if (execCtx != null)
+ return execCtx.getThreadId();
+ return null;
+ }
+
+ public String getGroupId() {
+ IMIContainerDMContext containerCtx = DMContexts.getAncestorOfType(fCommand.getContext(),
+ IMIContainerDMContext.class);
+ if (containerCtx != null)
+ return containerCtx.getGroupId();
+ return null;
+ }
+
+ @Override
+ public String toString() {
+ return Integer.toString(fTokenId) + fCommand;
+ }
+ }
+
+ /*
+ * This is the transmitter thread. When a command is given to this thread it has been
+ * considered to be sent, even if it has not actually been sent yet. This assumption
+ * makes it easier from state management. Whomever fill this pipeline handles all of
+ * the required state notification ( callbacks ). This thread simply physically gives
+ * the message to the backend.
+ */
+
+ private class TxThread extends Thread {
+
+ final private OutputStream fOutputStream;
+
+ public TxThread(OutputStream outStream) {
+ super("MI TX Thread"); //$NON-NLS-1$
+ fOutputStream = outStream;
+ }
+
+ @Override
+ public void run() {
+ while (true) {
+ CommandHandle commandHandle = null;
+
+ try {
+ commandHandle = fTxCommands.take();
+ } catch (InterruptedException e) {
+ break; // Shutting down.
+ }
+
+ if (commandHandle == fTerminatorHandle) {
+ // There is a small possibility that a new command was inserted
+ // in the fRxCommands map after we cleared that map.
+ // Just to be safe, clear it again.
+ // We do this to avoid synchronizing the handling of fRxCommands
+ // because this is more efficient, as it happens only once at shutdown.
+ cancelRxCommands();
+ break; // Null command is an indicator that we're shutting down.
+ }
+
+ /*
+ * We note that this is an outstanding request at this point.
+ */
+ if (!(commandHandle.getCommand() instanceof RawCommand)) {
+ // RawCommands will not get an answer, so we cannot put them in the receive queue.
+ fRxCommands.put(commandHandle.getTokenId(), commandHandle);
+ }
+
+ /*
+ * Construct the new command and push this command out the pipeline.
+ */
+
+ final String str;
+ if (commandHandle.getCommand() instanceof RawCommand) {
+ // RawCommands CANNOT have a token id: GDB would read it as part of the RawCommand!
+ str = commandHandle.getCommand().constructCommand();
+ } else if (fUseThreadGroupOption) {
+ // Implies that fUseThreadAndFrameOptions == true
+ str = commandHandle.getTokenId() + commandHandle.getCommand().constructCommand(
+ commandHandle.getGroupId(), commandHandle.getThreadId(), commandHandle.getStackFrameId());
+ } else if (fUseThreadAndFrameOptions) {
+ str = commandHandle.getTokenId() + commandHandle.getCommand()
+ .constructCommand(commandHandle.getThreadId(), commandHandle.getStackFrameId());
+ } else {
+ str = commandHandle.getTokenId() + commandHandle.getCommand().constructCommand();
+ }
+
+ try {
+ if (fOutputStream != null) {
+
+ if (GdbDebugOptions.DEBUG) {
+ GdbDebugOptions.trace(
+ String.format("%s %s %s", GdbPlugin.getDebugTime(), MI_TRACE_IDENTIFIER, str)); //$NON-NLS-1$
+ }
+ if (getMITracingStream() != null) {
+ try {
+ String message = GdbPlugin.getDebugTime() + " " + str; //$NON-NLS-1$
+ while (message.length() > 100) {
+ String partial = message.substring(0, 100) + "\\\n"; //$NON-NLS-1$
+ message = message.substring(100);
+ getMITracingStream().write(partial.getBytes());
+ }
+ getMITracingStream().write(message.getBytes());
+ } catch (IOException e) {
+ // The tracing stream could be closed at any time
+ // since the user can set a preference to turn off
+ // this tracing.
+ setMITracingStream(null);
+ }
+ }
+
+ fOutputStream.write(str.getBytes());
+ fOutputStream.flush();
+ }
+ } catch (IOException e) {
+ // Shutdown thread in case of IO error.
+ break;
+ }
+ }
+ // Must close the stream here to avoid leaking
+ // Bug 345164 and Bug 339379
+ try {
+ if (fOutputStream != null)
+ fOutputStream.close();
} catch (IOException e) {
}
- }
- }
+ }
+ }
- private class RxThread extends Thread {
- private final InputStream fInputStream;
- private final MIParser fMiParser = new MIParser();
+ private class RxThread extends Thread {
+ private final InputStream fInputStream;
+ private final MIParser fMiParser = new MIParser();
/**
* List of out of band records since the last result record. Out of band
* records are required for processing the results of CLI commands.
*/
- private final List<MIOOBRecord> fAccumulatedOOBRecords = new LinkedList<MIOOBRecord>();
+ private final List<MIOOBRecord> fAccumulatedOOBRecords = new LinkedList<MIOOBRecord>();
/**
* List of stream records since the last result record, not including
@@ -727,252 +756,254 @@ public abstract class AbstractMIControl extends AbstractDsfService
* a subset of {@link #fAccumulatedOOBRecords}, as a stream record is a
* particular type of OOB record.
*/
- private final List<MIStreamRecord> fAccumulatedStreamRecords = new LinkedList<MIStreamRecord>();
-
- public RxThread(InputStream inputStream) {
- super("MI RX Thread"); //$NON-NLS-1$
- fInputStream = inputStream;
- }
-
- @Override
- public void run() {
- BufferedReader reader = new BufferedReader(new InputStreamReader(fInputStream));
- try {
- String line;
- while ((line = reader.readLine()) != null) {
- if (line.length() != 0) {
- // Write Gdb response to sysout or file
- if(GdbDebugOptions.DEBUG) {
- if (line.length() < DEVELOPMENT_TRACE_LIMIT_CHARS) {
- GdbDebugOptions.trace(String.format( "%s %s %s\n", GdbPlugin.getDebugTime(), MI_TRACE_IDENTIFIER, line)); //$NON-NLS-1$
- } else {
- // "-list-thread-groups --available" give a very large output that is not very useful but that makes
- // looking at the traces much more difficult. Don't show the full output in the traces.
- // If we really need to see that output, it will still be in the 'gdb traces'.
- GdbDebugOptions.trace(String.format( "%s %s %s\n", GdbPlugin.getDebugTime(), MI_TRACE_IDENTIFIER, //$NON-NLS-1$
- line.substring(0, DEVELOPMENT_TRACE_LIMIT_CHARS) +
- " [remaining output truncated. Refer to 'gdb traces' if full output needed.]")); //$NON-NLS-1$
- }
- }
-
- final String finalLine = line;
- if (getMITracingStream() != null) {
- try {
- String message = GdbPlugin.getDebugTime() + " " + finalLine + "\n"; //$NON-NLS-1$ //$NON-NLS-2$
- while (message.length() > 100) {
- String partial = message.substring(0, 100) + "\\\n"; //$NON-NLS-1$
- message = message.substring(100);
- getMITracingStream().write(partial.getBytes());
- }
- getMITracingStream().write(message.getBytes());
- } catch (IOException e) {
- // The tracing stream could be closed at any time
- // since the user can set a preference to turn off
- // this tracing.
- setMITracingStream(null);
- }
- }
-
- processMIOutput(line);
- }
- }
- } catch (IOException e) {
- // Socket is shut down.
- } catch (RejectedExecutionException e) {
- // Dispatch thread is down.
- }
- // Must close the stream here to avoid leaking and
- // to give enough time to read all the data
- // Bug 345164 and Bug 339379
- try {
+ private final List<MIStreamRecord> fAccumulatedStreamRecords = new LinkedList<MIStreamRecord>();
+
+ public RxThread(InputStream inputStream) {
+ super("MI RX Thread"); //$NON-NLS-1$
+ fInputStream = inputStream;
+ }
+
+ @Override
+ public void run() {
+ BufferedReader reader = new BufferedReader(new InputStreamReader(fInputStream));
+ try {
+ String line;
+ while ((line = reader.readLine()) != null) {
+ if (line.length() != 0) {
+ // Write Gdb response to sysout or file
+ if (GdbDebugOptions.DEBUG) {
+ if (line.length() < DEVELOPMENT_TRACE_LIMIT_CHARS) {
+ GdbDebugOptions.trace(String.format("%s %s %s\n", GdbPlugin.getDebugTime(), //$NON-NLS-1$
+ MI_TRACE_IDENTIFIER, line));
+ } else {
+ // "-list-thread-groups --available" give a very large output that is not very useful but that makes
+ // looking at the traces much more difficult. Don't show the full output in the traces.
+ // If we really need to see that output, it will still be in the 'gdb traces'.
+ GdbDebugOptions.trace(String.format("%s %s %s\n", GdbPlugin.getDebugTime(), //$NON-NLS-1$
+ MI_TRACE_IDENTIFIER, line.substring(0, DEVELOPMENT_TRACE_LIMIT_CHARS)
+ + " [remaining output truncated. Refer to 'gdb traces' if full output needed.]")); //$NON-NLS-1$
+ }
+ }
+
+ final String finalLine = line;
+ if (getMITracingStream() != null) {
+ try {
+ String message = GdbPlugin.getDebugTime() + " " + finalLine + "\n"; //$NON-NLS-1$ //$NON-NLS-2$
+ while (message.length() > 100) {
+ String partial = message.substring(0, 100) + "\\\n"; //$NON-NLS-1$
+ message = message.substring(100);
+ getMITracingStream().write(partial.getBytes());
+ }
+ getMITracingStream().write(message.getBytes());
+ } catch (IOException e) {
+ // The tracing stream could be closed at any time
+ // since the user can set a preference to turn off
+ // this tracing.
+ setMITracingStream(null);
+ }
+ }
+
+ processMIOutput(line);
+ }
+ }
+ } catch (IOException e) {
+ // Socket is shut down.
+ } catch (RejectedExecutionException e) {
+ // Dispatch thread is down.
+ }
+ // Must close the stream here to avoid leaking and
+ // to give enough time to read all the data
+ // Bug 345164 and Bug 339379
+ try {
fInputStream.close();
} catch (IOException e) {
}
- }
-
- private MIResult findResultRecord(MIResult[] results, String variable) {
- for (int i = 0; i < results.length; i++) {
- if (variable.equals(results[i].getVariable())) {
- return results[i];
- }
- }
- return null;
- }
-
- private String getStatusString(MICommand<MIInfo> origCommand, MIOutput response ) {
-
- // Attempt to extract a message from the result record:
- String message = null;
- String[] parameters = null;
- if (response != null && response.getMIResultRecord() != null) {
- MIResult[] results = response.getMIResultRecord().getMIResults();
-
- // Extract the parameters
- MIResult paramsRes = findResultRecord(results, "parameters"); //$NON-NLS-1$
- if (paramsRes != null && paramsRes.getMIValue() instanceof MIList) {
- MIValue[] paramValues = ((MIList)paramsRes.getMIValue()).getMIValues();
- parameters = new String[paramValues.length];
- for (int i = 0; i < paramValues.length; i++) {
- if (paramValues[i] instanceof MIConst) {
- parameters[i] = ((MIConst)paramValues[i]).getString();
- } else {
- parameters[i] = ""; //$NON-NLS-1$
- }
- }
- }
- MIResult messageRes = findResultRecord(results, "message"); //$NON-NLS-1$
- if (messageRes != null && messageRes.getMIValue() instanceof MIConst) {
- message = ((MIConst)messageRes.getMIValue()).getString();
- }
- // FRCH: I believe that the actual string is "msg" ...
- // FRCH: (at least for the version of gdb I'm using)
- else {
- messageRes = findResultRecord(results, "msg"); //$NON-NLS-1$
- if (messageRes != null && messageRes.getMIValue() instanceof MIConst) {
- message = ((MIConst)messageRes.getMIValue()).getString();
- }
- }
- }
- StringBuilder clientMsg = new StringBuilder();
- clientMsg.append("Failed to execute MI command:\n"); //$NON-NLS-1$
- clientMsg.append(origCommand.toString());
- if (message != null) {
- message = message.replaceAll("\\\\n", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
- clientMsg.append("Error message from debugger back end:\n"); //$NON-NLS-1$
- if (parameters != null) {
- try {
- clientMsg.append(MessageFormat.format(message, (Object[])parameters));
- } catch(IllegalArgumentException e2) {
- // Message format string invalid. Fallback to just appending the strings.
- clientMsg.append(message);
- clientMsg.append(Arrays.toString(parameters));
- }
- } else {
- clientMsg.append(message);
- }
- }
- return clientMsg.toString();
- }
-
- private String getBackendMessage(MIOutput response) {
-
- // Attempt to extract a message from the result record:
- String message = null;
- String[] parameters = null;
- if (response != null && response.getMIResultRecord() != null) {
- MIResult[] results = response.getMIResultRecord().getMIResults();
-
- // Extract the parameters
- MIResult paramsRes = findResultRecord(results, "parameters"); //$NON-NLS-1$
- if (paramsRes != null && paramsRes.getMIValue() instanceof MIList) {
- MIValue[] paramValues = ((MIList)paramsRes.getMIValue()).getMIValues();
- parameters = new String[paramValues.length];
- for (int i = 0; i < paramValues.length; i++) {
- if (paramValues[i] instanceof MIConst) {
- parameters[i] = ((MIConst)paramValues[i]).getString();
- } else {
- parameters[i] = ""; //$NON-NLS-1$
- }
- }
- }
- MIResult messageRes = findResultRecord(results, "message"); //$NON-NLS-1$
- if (messageRes != null && messageRes.getMIValue() instanceof MIConst) {
- message = ((MIConst)messageRes.getMIValue()).getString();
- }
- // FRCH: I believe that the actual string is "msg" ...
- // FRCH: (at least for the version of gdb I'm using)
- else {
- messageRes = findResultRecord(results, "msg"); //$NON-NLS-1$
- if (messageRes != null && messageRes.getMIValue() instanceof MIConst) {
- message = ((MIConst)messageRes.getMIValue()).getString();
- }
- }
- }
- StringBuilder clientMsg = new StringBuilder();
- if (message != null) {
- if (parameters != null) {
- try {
- clientMsg.append(MessageFormat.format(message, (Object[])parameters));
- } catch(IllegalArgumentException e2) {
- // Message format string invalid. Fallback to just appending the strings.
- clientMsg.append(message);
- clientMsg.append(Arrays.toString(parameters));
- }
- } else {
- clientMsg.append(message);
- }
- }
- return clientMsg.toString();
- }
-
- void processMIOutput(String line) {
-
- MIParser.RecordType recordType = fMiParser.getRecordType(line);
-
- if (recordType == MIParser.RecordType.ResultRecord) {
- final MIResultRecord rr = fMiParser.parseMIResultRecord(line);
-
-
- /*
- * Find the command in the current output list. If we cannot then this is
- * some form of asynchronous notification. Or perhaps general IO.
- */
- int id = rr.getToken();
-
- final CommandHandle commandHandle = fRxCommands.remove(id);
-
- if (commandHandle != null) {
- final MIOutput response = new MIOutput(
- rr, fAccumulatedOOBRecords.toArray(new MIOOBRecord[fAccumulatedOOBRecords.size()]) );
- fAccumulatedOOBRecords.clear();
- fAccumulatedStreamRecords.clear();
-
- MIInfo result = commandHandle.getCommand().getResult(response);
+ }
+
+ private MIResult findResultRecord(MIResult[] results, String variable) {
+ for (int i = 0; i < results.length; i++) {
+ if (variable.equals(results[i].getVariable())) {
+ return results[i];
+ }
+ }
+ return null;
+ }
+
+ private String getStatusString(MICommand<MIInfo> origCommand, MIOutput response) {
+
+ // Attempt to extract a message from the result record:
+ String message = null;
+ String[] parameters = null;
+ if (response != null && response.getMIResultRecord() != null) {
+ MIResult[] results = response.getMIResultRecord().getMIResults();
+
+ // Extract the parameters
+ MIResult paramsRes = findResultRecord(results, "parameters"); //$NON-NLS-1$
+ if (paramsRes != null && paramsRes.getMIValue() instanceof MIList) {
+ MIValue[] paramValues = ((MIList) paramsRes.getMIValue()).getMIValues();
+ parameters = new String[paramValues.length];
+ for (int i = 0; i < paramValues.length; i++) {
+ if (paramValues[i] instanceof MIConst) {
+ parameters[i] = ((MIConst) paramValues[i]).getString();
+ } else {
+ parameters[i] = ""; //$NON-NLS-1$
+ }
+ }
+ }
+ MIResult messageRes = findResultRecord(results, "message"); //$NON-NLS-1$
+ if (messageRes != null && messageRes.getMIValue() instanceof MIConst) {
+ message = ((MIConst) messageRes.getMIValue()).getString();
+ }
+ // FRCH: I believe that the actual string is "msg" ...
+ // FRCH: (at least for the version of gdb I'm using)
+ else {
+ messageRes = findResultRecord(results, "msg"); //$NON-NLS-1$
+ if (messageRes != null && messageRes.getMIValue() instanceof MIConst) {
+ message = ((MIConst) messageRes.getMIValue()).getString();
+ }
+ }
+ }
+ StringBuilder clientMsg = new StringBuilder();
+ clientMsg.append("Failed to execute MI command:\n"); //$NON-NLS-1$
+ clientMsg.append(origCommand.toString());
+ if (message != null) {
+ message = message.replaceAll("\\\\n", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ clientMsg.append("Error message from debugger back end:\n"); //$NON-NLS-1$
+ if (parameters != null) {
+ try {
+ clientMsg.append(MessageFormat.format(message, (Object[]) parameters));
+ } catch (IllegalArgumentException e2) {
+ // Message format string invalid. Fallback to just appending the strings.
+ clientMsg.append(message);
+ clientMsg.append(Arrays.toString(parameters));
+ }
+ } else {
+ clientMsg.append(message);
+ }
+ }
+ return clientMsg.toString();
+ }
+
+ private String getBackendMessage(MIOutput response) {
+
+ // Attempt to extract a message from the result record:
+ String message = null;
+ String[] parameters = null;
+ if (response != null && response.getMIResultRecord() != null) {
+ MIResult[] results = response.getMIResultRecord().getMIResults();
+
+ // Extract the parameters
+ MIResult paramsRes = findResultRecord(results, "parameters"); //$NON-NLS-1$
+ if (paramsRes != null && paramsRes.getMIValue() instanceof MIList) {
+ MIValue[] paramValues = ((MIList) paramsRes.getMIValue()).getMIValues();
+ parameters = new String[paramValues.length];
+ for (int i = 0; i < paramValues.length; i++) {
+ if (paramValues[i] instanceof MIConst) {
+ parameters[i] = ((MIConst) paramValues[i]).getString();
+ } else {
+ parameters[i] = ""; //$NON-NLS-1$
+ }
+ }
+ }
+ MIResult messageRes = findResultRecord(results, "message"); //$NON-NLS-1$
+ if (messageRes != null && messageRes.getMIValue() instanceof MIConst) {
+ message = ((MIConst) messageRes.getMIValue()).getString();
+ }
+ // FRCH: I believe that the actual string is "msg" ...
+ // FRCH: (at least for the version of gdb I'm using)
+ else {
+ messageRes = findResultRecord(results, "msg"); //$NON-NLS-1$
+ if (messageRes != null && messageRes.getMIValue() instanceof MIConst) {
+ message = ((MIConst) messageRes.getMIValue()).getString();
+ }
+ }
+ }
+ StringBuilder clientMsg = new StringBuilder();
+ if (message != null) {
+ if (parameters != null) {
+ try {
+ clientMsg.append(MessageFormat.format(message, (Object[]) parameters));
+ } catch (IllegalArgumentException e2) {
+ // Message format string invalid. Fallback to just appending the strings.
+ clientMsg.append(message);
+ clientMsg.append(Arrays.toString(parameters));
+ }
+ } else {
+ clientMsg.append(message);
+ }
+ }
+ return clientMsg.toString();
+ }
+
+ void processMIOutput(String line) {
+
+ MIParser.RecordType recordType = fMiParser.getRecordType(line);
+
+ if (recordType == MIParser.RecordType.ResultRecord) {
+ final MIResultRecord rr = fMiParser.parseMIResultRecord(line);
+
+ /*
+ * Find the command in the current output list. If we cannot then this is
+ * some form of asynchronous notification. Or perhaps general IO.
+ */
+ int id = rr.getToken();
+
+ final CommandHandle commandHandle = fRxCommands.remove(id);
+
+ if (commandHandle != null) {
+ final MIOutput response = new MIOutput(rr,
+ fAccumulatedOOBRecords.toArray(new MIOOBRecord[fAccumulatedOOBRecords.size()]));
+ fAccumulatedOOBRecords.clear();
+ fAccumulatedStreamRecords.clear();
+
+ MIInfo result = commandHandle.getCommand().getResult(response);
DataRequestMonitor<MIInfo> rm = commandHandle.getRequestMonitor();
-
+
/*
* Not all users want to get there results. They indicate so by not having
- * a completion object.
+ * a completion object.
*/
- if ( rm != null ) {
+ if (rm != null) {
rm.setData(result);
-
+
/*
* We need to indicate if this request had an error or not.
*/
- String errorResult = rr.getResultClass();
-
- if ( errorResult.equals(MIResultRecord.ERROR) ) {
- String status = getStatusString(commandHandle.getCommand(),response);
+ String errorResult = rr.getResultClass();
+
+ if (errorResult.equals(MIResultRecord.ERROR)) {
+ String status = getStatusString(commandHandle.getCommand(), response);
String message = getBackendMessage(response);
Exception exception = new Exception(message);
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, status, exception));
+ rm.setStatus(
+ new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, status, exception));
}
-
+
/*
* We need to complete the command on the DSF thread for data security.
*/
final ICommandResult finalResult = result;
getExecutor().execute(new DsfRunnable() {
@Override
- public void run() {
- /*
- * Complete the specific command.
- */
- if (commandHandle.getRequestMonitor() != null) {
- commandHandle.getRequestMonitor().done();
- }
-
- /*
- * Now tell the generic listeners about it.
- */
- processCommandDone(commandHandle, finalResult);
- }
- @Override
- public String toString() {
- return "MI command output received for: " + commandHandle.getCommand(); //$NON-NLS-1$
- }
- });
+ public void run() {
+ /*
+ * Complete the specific command.
+ */
+ if (commandHandle.getRequestMonitor() != null) {
+ commandHandle.getRequestMonitor().done();
+ }
+
+ /*
+ * Now tell the generic listeners about it.
+ */
+ processCommandDone(commandHandle, finalResult);
+ }
+
+ @Override
+ public String toString() {
+ return "MI command output received for: " + commandHandle.getCommand(); //$NON-NLS-1$
+ }
+ });
} else {
/*
* While the specific requestor did not care about the completion we
@@ -983,163 +1014,168 @@ public abstract class AbstractMIControl extends AbstractDsfService
final ICommandResult finalResult = result;
getExecutor().execute(new DsfRunnable() {
@Override
- public void run() {
- processCommandDone(commandHandle, finalResult);
- }
- @Override
- public String toString() {
- return "MI command output received for: " + commandHandle.getCommand(); //$NON-NLS-1$
- }
- });
+ public void run() {
+ processCommandDone(commandHandle, finalResult);
+ }
+
+ @Override
+ public String toString() {
+ return "MI command output received for: " + commandHandle.getCommand(); //$NON-NLS-1$
+ }
+ });
}
- } else {
- /*
- * GDB apparently can sometimes send multiple responses to the same command. In those cases,
- * the command handle is gone, so post the result as an event. To avoid processing OOB records
- * as events multiple times, do not include the accumulated OOB record list in the response
- * MIOutput object.
- */
- final MIOutput response = new MIOutput(rr, new MIOOBRecord[0]);
-
- getExecutor().execute(new DsfRunnable() {
- @Override
- public void run() {
- processEvent(response);
- }
- @Override
- public String toString() {
- return "MI asynchronous output received: " + response; //$NON-NLS-1$
- }
- });
- }
- } else if (recordType == MIParser.RecordType.OOBRecord) {
+ } else {
+ /*
+ * GDB apparently can sometimes send multiple responses to the same command. In those cases,
+ * the command handle is gone, so post the result as an event. To avoid processing OOB records
+ * as events multiple times, do not include the accumulated OOB record list in the response
+ * MIOutput object.
+ */
+ final MIOutput response = new MIOutput(rr, new MIOOBRecord[0]);
+
+ getExecutor().execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ processEvent(response);
+ }
+
+ @Override
+ public String toString() {
+ return "MI asynchronous output received: " + response; //$NON-NLS-1$
+ }
+ });
+ }
+ } else if (recordType == MIParser.RecordType.OOBRecord) {
// Process OOBs
- final MIOOBRecord oob = fMiParser.parseMIOOBRecord(line);
+ final MIOOBRecord oob = fMiParser.parseMIOOBRecord(line);
- fAccumulatedOOBRecords.add(oob);
- // limit growth, but only if these are not responses to CLI commands
- // Bug 302927 & 330608
- if (fRxCommands.isEmpty() && fAccumulatedOOBRecords.size() > 20) {
- fAccumulatedOOBRecords.remove(0);
- }
+ fAccumulatedOOBRecords.add(oob);
+ // limit growth, but only if these are not responses to CLI commands
+ // Bug 302927 & 330608
+ if (fRxCommands.isEmpty() && fAccumulatedOOBRecords.size() > 20) {
+ fAccumulatedOOBRecords.remove(0);
+ }
// The handling of this OOB record may need the stream records
// that preceded it. One such case is a stopped event caused by a
// catchpoint in gdb < 7.0. The stopped event provides no
// reason, but we can determine it was caused by a catchpoint by
// looking at the target stream.
-
- final MIOutput response = new MIOutput(oob, fAccumulatedStreamRecords.toArray(new MIStreamRecord[fAccumulatedStreamRecords.size()]));
+
+ final MIOutput response = new MIOutput(oob,
+ fAccumulatedStreamRecords.toArray(new MIStreamRecord[fAccumulatedStreamRecords.size()]));
// If this is a stream record, add it to the accumulated bucket
// for possible use in handling a future OOB (see comment above)
- if (oob instanceof MIStreamRecord) {
- fAccumulatedStreamRecords.add((MIStreamRecord)oob);
- if (fAccumulatedStreamRecords.size() > 20) { // limit growth; see bug 302927
- fAccumulatedStreamRecords.remove(0);
- }
- }
-
- /*
- * OOBS are events. So we pass them to any event listeners who want to see them. Again this must
- * be done on the DSF thread for integrity.
- */
- getExecutor().execute(new DsfRunnable() {
- @Override
- public void run() {
- processEvent(response);
- }
- @Override
- public String toString() {
- return "MI asynchronous output received: " + response; //$NON-NLS-1$
- }
- });
- }
-
- getExecutor().execute(new DsfRunnable() {
- @Override
- public void run() {
- processNextQueuedCommand();
- }
- });
- }
- }
-
- /**
- * A thread that will read GDB's stderr stream.
- * When a PTY is not being used for the inferior, everything
- * the inferior writes to stderr will be output on GDB's stderr.
- * If we don't read it, gdb eventually blocks, when the sream is
- * full.
- *
- * Although we could write this error output to the inferior
- * console, we actually write it to the GDB console. This is
- * because we cannot differentiate between inferior errors printouts
- * and GDB error printouts.
- *
- * See bug 327617 for details.
- */
- private class ErrorThread extends Thread {
- private final InputStream fErrorStream;
- private final MIParser fMiParser = new MIParser();
-
- public ErrorThread(InputStream errorStream) {
- super("MI Error Thread"); //$NON-NLS-1$
- fErrorStream = errorStream;
- }
-
- @Override
- public void run() {
- BufferedReader reader = new BufferedReader(new InputStreamReader(fErrorStream));
- try {
- String line;
- while ((line = reader.readLine()) != null) {
- // Create an error MI out-of-band record so that our gdb console prints it.
- final MIOOBRecord oob = fMiParser.parseMIOOBRecord("&"+line+"\n"); //$NON-NLS-1$//$NON-NLS-2$
- final MIOutput response = new MIOutput(oob, new MIStreamRecord[0]);
- getExecutor().execute(new DsfRunnable() {
- @Override
- public void run() {
- processEvent(response);
- }
- @Override
- public String toString() {
- return "MI error output received: " + response; //$NON-NLS-1$
- }
- });
- }
- } catch (IOException e) {
- // Socket is shut down.
- } catch (RejectedExecutionException e) {
- // Dispatch thread is down.
- }
- // Must close the stream here to avoid leaking
- // Bug 345164 and Bug 339379
- try {
- fErrorStream.close();
+ if (oob instanceof MIStreamRecord) {
+ fAccumulatedStreamRecords.add((MIStreamRecord) oob);
+ if (fAccumulatedStreamRecords.size() > 20) { // limit growth; see bug 302927
+ fAccumulatedStreamRecords.remove(0);
+ }
+ }
+
+ /*
+ * OOBS are events. So we pass them to any event listeners who want to see them. Again this must
+ * be done on the DSF thread for integrity.
+ */
+ getExecutor().execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ processEvent(response);
+ }
+
+ @Override
+ public String toString() {
+ return "MI asynchronous output received: " + response; //$NON-NLS-1$
+ }
+ });
+ }
+
+ getExecutor().execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ processNextQueuedCommand();
+ }
+ });
+ }
+ }
+
+ /**
+ * A thread that will read GDB's stderr stream.
+ * When a PTY is not being used for the inferior, everything
+ * the inferior writes to stderr will be output on GDB's stderr.
+ * If we don't read it, gdb eventually blocks, when the sream is
+ * full.
+ *
+ * Although we could write this error output to the inferior
+ * console, we actually write it to the GDB console. This is
+ * because we cannot differentiate between inferior errors printouts
+ * and GDB error printouts.
+ *
+ * See bug 327617 for details.
+ */
+ private class ErrorThread extends Thread {
+ private final InputStream fErrorStream;
+ private final MIParser fMiParser = new MIParser();
+
+ public ErrorThread(InputStream errorStream) {
+ super("MI Error Thread"); //$NON-NLS-1$
+ fErrorStream = errorStream;
+ }
+
+ @Override
+ public void run() {
+ BufferedReader reader = new BufferedReader(new InputStreamReader(fErrorStream));
+ try {
+ String line;
+ while ((line = reader.readLine()) != null) {
+ // Create an error MI out-of-band record so that our gdb console prints it.
+ final MIOOBRecord oob = fMiParser.parseMIOOBRecord("&" + line + "\n"); //$NON-NLS-1$//$NON-NLS-2$
+ final MIOutput response = new MIOutput(oob, new MIStreamRecord[0]);
+ getExecutor().execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ processEvent(response);
+ }
+
+ @Override
+ public String toString() {
+ return "MI error output received: " + response; //$NON-NLS-1$
+ }
+ });
+ }
} catch (IOException e) {
+ // Socket is shut down.
+ } catch (RejectedExecutionException e) {
+ // Dispatch thread is down.
}
- }
- }
-
- // we keep track of currentStackLevel and currentThreadId because in
- // some cases we must use -thread-select and -stack-select-frame
- public void resetCurrentThreadLevel(){
- fCurrentThreadId = null;
- }
-
- public void resetCurrentStackLevel(){
- fCurrentStackLevel = -1;
- }
-
- /**
+ // Must close the stream here to avoid leaking
+ // Bug 345164 and Bug 339379
+ try {
+ fErrorStream.close();
+ } catch (IOException e) {
+ }
+ }
+ }
+
+ // we keep track of currentStackLevel and currentThreadId because in
+ // some cases we must use -thread-select and -stack-select-frame
+ public void resetCurrentThreadLevel() {
+ fCurrentThreadId = null;
+ }
+
+ public void resetCurrentStackLevel() {
+ fCurrentStackLevel = -1;
+ }
+
+ /**
* @since 4.1
*/
- @ConfinedToDsfExecutor("this.getExecutor()")
- protected void commandFailed(ICommandToken token, int statusCode, String errorMessage) {
- if ( !(token instanceof CommandHandle && token.getCommand() instanceof MICommand<?>) )
- return;
- final CommandHandle commandHandle = (CommandHandle)token;
+ @ConfinedToDsfExecutor("this.getExecutor()")
+ protected void commandFailed(ICommandToken token, int statusCode, String errorMessage) {
+ if (!(token instanceof CommandHandle && token.getCommand() instanceof MICommand<?>))
+ return;
+ final CommandHandle commandHandle = (CommandHandle) token;
Integer tokenId = commandHandle.getTokenId();
// If the timeout value is too small a command can be timed out but still processed by RxThread.
@@ -1148,7 +1184,7 @@ public abstract class AbstractMIControl extends AbstractDsfService
if (h == null)
// Command has already been processed by RxThread.
return;
-
+
MIConst value = new MIConst();
value.setCString(errorMessage);
MIResult result = new MIResult();
@@ -1162,16 +1198,16 @@ public abstract class AbstractMIControl extends AbstractDsfService
final MIInfo info = commandHandle.getCommand().getResult(miOutput);
DataRequestMonitor<MIInfo> rm = commandHandle.getRequestMonitor();
-
- if ( rm != null ) {
- rm.setData(info);
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, statusCode, errorMessage, null));
+
+ if (rm != null) {
+ rm.setData(info);
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, statusCode, errorMessage, null));
rm.done();
-
- /*
- * Now tell the generic listeners about it.
- */
- processCommandDone(commandHandle, info);
+
+ /*
+ * Now tell the generic listeners about it.
+ */
+ processCommandDone(commandHandle, info);
}
- }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CLIEventProcessor.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CLIEventProcessor.java
index c0c8ec1340f..5c6dee48e91 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CLIEventProcessor.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CLIEventProcessor.java
@@ -11,7 +11,7 @@
* Contributors:
* QNX Software Systems - Initial API and implementation
* Wind River Systems - Modified for new DSF Reference Implementation
- * Ericsson AB - Additional handling of events
+ * Ericsson AB - Additional handling of events
* Mikhail Khodjaiants (Mentor Graphics) - Refactor common code in GDBControl* classes (bug 372795)
*******************************************************************************/
@@ -52,340 +52,335 @@ import org.eclipse.cdt.dsf.service.DsfServicesTracker;
* GDB debugger output listener.
*/
@ConfinedToDsfExecutor("fConnection#getExecutor")
-public class CLIEventProcessor
- implements IEventProcessor
-{
- private final ICommandControlService fCommandControl;
- private final ICommandControlDMContext fControlDmc;
-
- // Last Thread ID created
+public class CLIEventProcessor implements IEventProcessor {
+ private final ICommandControlService fCommandControl;
+ private final ICommandControlDMContext fControlDmc;
+
+ // Last Thread ID created
private int fLastThreadId;
-
- private final DsfServicesTracker fServicesTracker;
-
- /**
- * @since 1.1
- */
- public CLIEventProcessor(ICommandControlService connection, ICommandControlDMContext controlDmc) {
- fCommandControl = connection;
- fControlDmc = controlDmc;
- fServicesTracker = new DsfServicesTracker(GdbPlugin.getBundleContext(), fCommandControl.getSession().getId());
- connection.addCommandListener(this);
- connection.addEventListener(this);
-
- fCommandControl.getSession().addServiceEventListener(this, null);
- }
+
+ private final DsfServicesTracker fServicesTracker;
+
+ /**
+ * @since 1.1
+ */
+ public CLIEventProcessor(ICommandControlService connection, ICommandControlDMContext controlDmc) {
+ fCommandControl = connection;
+ fControlDmc = controlDmc;
+ fServicesTracker = new DsfServicesTracker(GdbPlugin.getBundleContext(), fCommandControl.getSession().getId());
+ connection.addCommandListener(this);
+ connection.addEventListener(this);
+
+ fCommandControl.getSession().addServiceEventListener(this, null);
+ }
@Override
public void dispose() {
- fCommandControl.getSession().removeServiceEventListener(this);
- fCommandControl.removeCommandListener(this);
- fCommandControl.removeEventListener(this);
- fServicesTracker.dispose();
- }
-
+ fCommandControl.getSession().removeServiceEventListener(this);
+ fCommandControl.removeCommandListener(this);
+ fCommandControl.removeEventListener(this);
+ fServicesTracker.dispose();
+ }
+
@Override
- public void commandSent(ICommandToken token) {
- if (token.getCommand() instanceof CLICommand<?>) {
- processStateChanges( (CLICommand<?>)token.getCommand() );
- }
- else if (token.getCommand() instanceof MIInterpreterExecConsole<?>) {
- processStateChanges( (MIInterpreterExecConsole<?>)token.getCommand() );
- }
- }
-
+ public void commandSent(ICommandToken token) {
+ if (token.getCommand() instanceof CLICommand<?>) {
+ processStateChanges((CLICommand<?>) token.getCommand());
+ } else if (token.getCommand() instanceof MIInterpreterExecConsole<?>) {
+ processStateChanges((MIInterpreterExecConsole<?>) token.getCommand());
+ }
+ }
+
@Override
- public void commandDone(ICommandToken token, ICommandResult result) {
- if (token.getCommand() instanceof CLICommand<?>) {
- processSettingChanges( (CLICommand<?>)token.getCommand() );
- }
- else if (token.getCommand() instanceof MIInterpreterExecConsole<?>) {
- processSettingChanges( (MIInterpreterExecConsole<?>)token.getCommand() );
- }
- }
-
+ public void commandDone(ICommandToken token, ICommandResult result) {
+ if (token.getCommand() instanceof CLICommand<?>) {
+ processSettingChanges((CLICommand<?>) token.getCommand());
+ } else if (token.getCommand() instanceof MIInterpreterExecConsole<?>) {
+ processSettingChanges((MIInterpreterExecConsole<?>) token.getCommand());
+ }
+ }
+
@Override
- public void commandQueued(ICommandToken token) {
- // No action
- }
-
+ public void commandQueued(ICommandToken token) {
+ // No action
+ }
+
@Override
- public void commandRemoved(ICommandToken token) {
- // No action
- }
-
+ public void commandRemoved(ICommandToken token) {
+ // No action
+ }
+
@Override
- public void eventReceived(Object output) {
- for (MIOOBRecord oobr : ((MIOutput)output).getMIOOBRecords()) {
- if (oobr instanceof MIConsoleStreamOutput) {
- // Process Events of type DsfMIConsoleStreamOutput here
- MIConsoleStreamOutput exec = (MIConsoleStreamOutput) oobr;
-
- // Look for events that indicate a new thread:
- // Examples:
- // [New Thread 1077300144 (LWP 7973) // POSIX
- // [New thread 4092.0x8c4] // cygwin and mingw
+ public void eventReceived(Object output) {
+ for (MIOOBRecord oobr : ((MIOutput) output).getMIOOBRecords()) {
+ if (oobr instanceof MIConsoleStreamOutput) {
+ // Process Events of type DsfMIConsoleStreamOutput here
+ MIConsoleStreamOutput exec = (MIConsoleStreamOutput) oobr;
+
+ // Look for events that indicate a new thread:
+ // Examples:
+ // [New Thread 1077300144 (LWP 7973) // POSIX
+ // [New thread 4092.0x8c4] // cygwin and mingw
// Since we currently don't use any of the information in the
// message, we'll use a simple regex pattern
- Pattern pattern = Pattern.compile("^\\[New [Tt]hread\\s+"); //$NON-NLS-1$
- Matcher matcher = pattern.matcher(exec.getCString());
- if (matcher.find()) {
- String threadId = Integer.toString(++fLastThreadId);
-
- IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
- if (procService != null) {
- IContainerDMContext processContainerDmc = procService.createContainerContextFromGroupId(fControlDmc, MIProcesses.UNIQUE_GROUP_ID);
- MIEvent<?> e = new MIThreadCreatedEvent(processContainerDmc, threadId);
- fCommandControl.getSession().dispatchEvent(e, fCommandControl.getProperties());
- }
- }
-
- // For GDB thread exit events, we won't use the events generated by GDB. This event is
- // raised in GDBRunControl class by polling and comparing the ExecutionContexts returned by
- // -thread-list-ids command. This is done as threads reported by exit event are still reported till
- // they completely exit the system.
- }
- }
- }
-
-
- private void processStateChanges(CLICommand<? extends ICommandResult> cmd) {
- String operation = cmd.getOperation().trim();
- // In refactoring we are no longer generating the token id as
- // part of the command. It is passed here and stored away and
- // then never really used. So it has just been changed to 0.
- processStateChanges(0, operation);
- }
-
- private void processStateChanges(MIInterpreterExecConsole<? extends ICommandResult> exec) {
- String[] operations = exec.getParameters();
- if (operations != null && operations.length > 0) {
- // In refactoring we are no longer generating the token id as
- // part of the command. It is passed here and stored away and
- // then never really used. So it has just been changed to 0.
- processStateChanges(0, operations[0]);
- }
- }
-
- private void processStateChanges(int token, String operation) {
- // Check the type of command
- int type = getSteppingOperationKind(operation);
- if (type != -1) {
- // if it was a step instruction set state running
- IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
- if (procService != null) {
- IContainerDMContext processContainerDmc = procService.createContainerContextFromGroupId(fControlDmc, MIProcesses.UNIQUE_GROUP_ID);
- MIEvent<?> event = new MIRunningEvent(processContainerDmc, token, type);
- fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
- }
- }
- }
-
- /**
- * An attempt to discover the command type and
- * fire an event if necessary.
- */
- private void processSettingChanges(CLICommand<?> cmd) {
- String operation = cmd.getOperation().trim();
- // In refactoring we are no longer generating the token id as
- // part of the command. It is passed here and stored away and
- // then never really used. So it has just been changed to 0.
- processSettingChanges(cmd.getContext(), 0, operation);
- }
-
- private void processSettingChanges(MIInterpreterExecConsole<?> exec) {
- String[] operations = exec.getParameters();
- if (operations != null && operations.length > 0) {
- // In refactoring we are no longer generating the token id as
- // part of the command. It is passed here and stored away and
- // then never really used. So it has just been changed to 0.
- processSettingChanges(exec.getContext(), 0, operations[0]);
- }
- }
-
- private void processSettingChanges(IDMContext dmc, int token, String operation) {
- // Get the command name.
- int indx = operation.indexOf(' ');
- if (indx != -1) {
- operation = operation.substring(0, indx).trim();
- } else {
- operation = operation.trim();
- }
-
- // Check the type of command
-
- if (isSettingBreakpoint(operation) ||
- isSettingWatchpoint(operation) ||
- isChangeBreakpoint(operation) ||
- isDeletingBreakpoint(operation))
- {
- // We know something change, we just do not know what.
- // So the easiest way is to let the top layer handle it.
- IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(dmc, IBreakpointsTargetDMContext.class);
- if (bpTargetDmc != null) {
- MIEvent<?> event = new MIBreakpointChangedEvent(bpTargetDmc, 0);
- fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
- }
- } else if (isSettingSignal(operation)) {
- // We do no know which signal let the upper layer find it.
- ISignalsDMContext signalDmc = DMContexts.getAncestorOfType(dmc, ISignalsDMContext.class);
- if (signalDmc != null) {
- MIEvent<?> event = new MISignalChangedEvent(signalDmc, ""); //$NON-NLS-1$
- fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
- }
- } else if (isDetach(operation)) {
- // if it was a "detach" command change the state.
- ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
- if (controlDmc != null) {
- MIEvent<?> event = new MIDetachedEvent(controlDmc, token);
- fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
- }
- }
- }
-
- private static int getSteppingOperationKind(String operation) {
- // Get the command name.
- int indx = operation.indexOf(' ');
- if (indx != -1) {
- operation = operation.substring(0, indx).trim();
- } else {
- operation = operation.trim();
- }
-
- int type = -1;
- /* execution commands: n, next, s, step, si, stepi, u, until, finish, return,
- c, continue, fg */
- if (operation.equals("n") || operation.equals("next")) { //$NON-NLS-1$ //$NON-NLS-2$
- type = MIRunningEvent.NEXT;
- } else if (operation.equals("ni") || operation.equals("nexti")) { //$NON-NLS-1$ //$NON-NLS-2$
- type = MIRunningEvent.NEXTI;
- } else if (operation.equals("s") || operation.equals("step")) { //$NON-NLS-1$ //$NON-NLS-2$
- type = MIRunningEvent.STEP;
- } else if (operation.equals("si") || operation.equals("stepi")) { //$NON-NLS-1$ //$NON-NLS-2$
- type = MIRunningEvent.STEPI;
- } else if (operation.equals("u") || //$NON-NLS-1$
- (operation.startsWith("unt") && "until".indexOf(operation) != -1)) { //$NON-NLS-1$ //$NON-NLS-2$
- type = MIRunningEvent.UNTIL;
- } else if (operation.startsWith("fin") && "finish".indexOf(operation) != -1) { //$NON-NLS-1$ //$NON-NLS-2$
- type = MIRunningEvent.FINISH;
+ Pattern pattern = Pattern.compile("^\\[New [Tt]hread\\s+"); //$NON-NLS-1$
+ Matcher matcher = pattern.matcher(exec.getCString());
+ if (matcher.find()) {
+ String threadId = Integer.toString(++fLastThreadId);
+
+ IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
+ if (procService != null) {
+ IContainerDMContext processContainerDmc = procService
+ .createContainerContextFromGroupId(fControlDmc, MIProcesses.UNIQUE_GROUP_ID);
+ MIEvent<?> e = new MIThreadCreatedEvent(processContainerDmc, threadId);
+ fCommandControl.getSession().dispatchEvent(e, fCommandControl.getProperties());
+ }
+ }
+
+ // For GDB thread exit events, we won't use the events generated by GDB. This event is
+ // raised in GDBRunControl class by polling and comparing the ExecutionContexts returned by
+ // -thread-list-ids command. This is done as threads reported by exit event are still reported till
+ // they completely exit the system.
+ }
+ }
+ }
+
+ private void processStateChanges(CLICommand<? extends ICommandResult> cmd) {
+ String operation = cmd.getOperation().trim();
+ // In refactoring we are no longer generating the token id as
+ // part of the command. It is passed here and stored away and
+ // then never really used. So it has just been changed to 0.
+ processStateChanges(0, operation);
+ }
+
+ private void processStateChanges(MIInterpreterExecConsole<? extends ICommandResult> exec) {
+ String[] operations = exec.getParameters();
+ if (operations != null && operations.length > 0) {
+ // In refactoring we are no longer generating the token id as
+ // part of the command. It is passed here and stored away and
+ // then never really used. So it has just been changed to 0.
+ processStateChanges(0, operations[0]);
+ }
+ }
+
+ private void processStateChanges(int token, String operation) {
+ // Check the type of command
+ int type = getSteppingOperationKind(operation);
+ if (type != -1) {
+ // if it was a step instruction set state running
+ IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
+ if (procService != null) {
+ IContainerDMContext processContainerDmc = procService.createContainerContextFromGroupId(fControlDmc,
+ MIProcesses.UNIQUE_GROUP_ID);
+ MIEvent<?> event = new MIRunningEvent(processContainerDmc, token, type);
+ fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
+ }
+ }
+ }
+
+ /**
+ * An attempt to discover the command type and
+ * fire an event if necessary.
+ */
+ private void processSettingChanges(CLICommand<?> cmd) {
+ String operation = cmd.getOperation().trim();
+ // In refactoring we are no longer generating the token id as
+ // part of the command. It is passed here and stored away and
+ // then never really used. So it has just been changed to 0.
+ processSettingChanges(cmd.getContext(), 0, operation);
+ }
+
+ private void processSettingChanges(MIInterpreterExecConsole<?> exec) {
+ String[] operations = exec.getParameters();
+ if (operations != null && operations.length > 0) {
+ // In refactoring we are no longer generating the token id as
+ // part of the command. It is passed here and stored away and
+ // then never really used. So it has just been changed to 0.
+ processSettingChanges(exec.getContext(), 0, operations[0]);
+ }
+ }
+
+ private void processSettingChanges(IDMContext dmc, int token, String operation) {
+ // Get the command name.
+ int indx = operation.indexOf(' ');
+ if (indx != -1) {
+ operation = operation.substring(0, indx).trim();
+ } else {
+ operation = operation.trim();
+ }
+
+ // Check the type of command
+
+ if (isSettingBreakpoint(operation) || isSettingWatchpoint(operation) || isChangeBreakpoint(operation)
+ || isDeletingBreakpoint(operation)) {
+ // We know something change, we just do not know what.
+ // So the easiest way is to let the top layer handle it.
+ IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(dmc,
+ IBreakpointsTargetDMContext.class);
+ if (bpTargetDmc != null) {
+ MIEvent<?> event = new MIBreakpointChangedEvent(bpTargetDmc, 0);
+ fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
+ }
+ } else if (isSettingSignal(operation)) {
+ // We do no know which signal let the upper layer find it.
+ ISignalsDMContext signalDmc = DMContexts.getAncestorOfType(dmc, ISignalsDMContext.class);
+ if (signalDmc != null) {
+ MIEvent<?> event = new MISignalChangedEvent(signalDmc, ""); //$NON-NLS-1$
+ fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
+ }
+ } else if (isDetach(operation)) {
+ // if it was a "detach" command change the state.
+ ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
+ if (controlDmc != null) {
+ MIEvent<?> event = new MIDetachedEvent(controlDmc, token);
+ fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
+ }
+ }
+ }
+
+ private static int getSteppingOperationKind(String operation) {
+ // Get the command name.
+ int indx = operation.indexOf(' ');
+ if (indx != -1) {
+ operation = operation.substring(0, indx).trim();
+ } else {
+ operation = operation.trim();
+ }
+
+ int type = -1;
+ /* execution commands: n, next, s, step, si, stepi, u, until, finish, return,
+ c, continue, fg */
+ if (operation.equals("n") || operation.equals("next")) { //$NON-NLS-1$ //$NON-NLS-2$
+ type = MIRunningEvent.NEXT;
+ } else if (operation.equals("ni") || operation.equals("nexti")) { //$NON-NLS-1$ //$NON-NLS-2$
+ type = MIRunningEvent.NEXTI;
+ } else if (operation.equals("s") || operation.equals("step")) { //$NON-NLS-1$ //$NON-NLS-2$
+ type = MIRunningEvent.STEP;
+ } else if (operation.equals("si") || operation.equals("stepi")) { //$NON-NLS-1$ //$NON-NLS-2$
+ type = MIRunningEvent.STEPI;
+ } else if (operation.equals("u") || //$NON-NLS-1$
+ (operation.startsWith("unt") && "until".indexOf(operation) != -1)) { //$NON-NLS-1$ //$NON-NLS-2$
+ type = MIRunningEvent.UNTIL;
+ } else if (operation.startsWith("fin") && "finish".indexOf(operation) != -1) { //$NON-NLS-1$ //$NON-NLS-2$
+ type = MIRunningEvent.FINISH;
} else if (operation.startsWith("ret") && "return".indexOf(operation) != -1) { //$NON-NLS-1$ //$NON-NLS-2$
type = MIRunningEvent.RETURN;
- } else if (operation.equals("c") || operation.equals("fg") || //$NON-NLS-1$ //$NON-NLS-2$
- (operation.startsWith("cont") && "continue".indexOf(operation) != -1)) { //$NON-NLS-1$ //$NON-NLS-2$
- type = MIRunningEvent.CONTINUE;
- } else if (operation.startsWith("sig") && "signal".indexOf(operation) != -1) { //$NON-NLS-1$ //$NON-NLS-2$
- type = MIRunningEvent.CONTINUE;
- } else if (operation.startsWith("j") && "jump".indexOf(operation) != -1) { //$NON-NLS-1$ //$NON-NLS-2$
- type = MIRunningEvent.CONTINUE;
- } else if (operation.equals("r") || operation.equals("run")) { //$NON-NLS-1$ //$NON-NLS-2$
- type = MIRunningEvent.CONTINUE;
- }
- return type;
- }
-
- /**
- * Return true if the operation is a stepping operation.
- *
- * @param operation
- * @return
- */
- public static boolean isSteppingOperation(String operation) {
- int type = getSteppingOperationKind(operation);
- return type != -1;
- }
-
- /**
- * Return true if the operation is a attaching operation.
- *
- * @param operation
- * @return
- * @since 4.0
- */
- public static boolean isAttachingOperation(String operation) {
- // Get the command name.
- int indx = operation.indexOf(' ');
- if (indx != -1) {
- operation = operation.substring(0, indx).trim();
- } else {
- operation = operation.trim();
- }
- /* attach: at, att, atta, attac, attach */
- return (operation.startsWith("at") && "attach".indexOf(operation) != -1); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- private boolean isSettingBreakpoint(String operation) {
- boolean isbreak = false;
- /* breakpoints: b, break, hbreak, tbreak, rbreak, thbreak */
- /* watchpoints: watch, rwatch, awatch, tbreak, rbreak, thbreak */
- if ((operation.startsWith("b") && "break".indexOf(operation) != -1) || //$NON-NLS-1$ //$NON-NLS-2$
- (operation.startsWith("tb") && "tbreak".indexOf(operation) != -1) || //$NON-NLS-1$ //$NON-NLS-2$
- (operation.startsWith("hb") && "hbreak".indexOf(operation) != -1) || //$NON-NLS-1$ //$NON-NLS-2$
- (operation.startsWith("thb") && "thbreak".indexOf(operation) != -1) || //$NON-NLS-1$ //$NON-NLS-2$
- (operation.startsWith("rb") && "rbreak".indexOf(operation) != -1)) { //$NON-NLS-1$ //$NON-NLS-2$
- isbreak = true;
- }
- return isbreak;
- }
-
- private boolean isSettingWatchpoint(String operation) {
- boolean isWatch = false;
- /* watchpoints: watch, rwatch, awatch, tbreak, rbreak, thbreak */
- if ((operation.startsWith("wa") && "watch".indexOf(operation) != -1) || //$NON-NLS-1$ //$NON-NLS-2$
- (operation.startsWith("rw") && "rwatch".indexOf(operation) != -1) || //$NON-NLS-1$ //$NON-NLS-2$
- (operation.startsWith("aw") && "awatch".indexOf(operation) != -1)) { //$NON-NLS-1$ //$NON-NLS-2$
- isWatch = true;
- }
- return isWatch;
- }
-
- private boolean isDeletingBreakpoint(String operation) {
- boolean isDelete = false;
- /* deleting breaks: clear, delete */
- if ((operation.startsWith("cl") && "clear".indexOf(operation) != -1) || //$NON-NLS-1$ //$NON-NLS-2$
- (operation.equals("d") || (operation.startsWith("del") && "delete".indexOf(operation) != -1))) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- isDelete = true;
- }
- return isDelete;
- }
-
- private boolean isChangeBreakpoint(String operation) {
- boolean isChange = false;
- /* changing breaks: enable, disable */
- if ((operation.equals("dis") || operation.equals("disa") || //$NON-NLS-1$ //$NON-NLS-2$
- (operation.startsWith("disa") && "disable".indexOf(operation) != -1)) || //$NON-NLS-1$ //$NON-NLS-2$
- (operation.equals("en") || (operation.startsWith("en") && "enable".indexOf(operation) != -1)) || //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- (operation.startsWith("ig") && "ignore".indexOf(operation) != -1) || //$NON-NLS-1$ //$NON-NLS-2$
- (operation.startsWith("cond") && "condition".indexOf(operation) != -1)) { //$NON-NLS-1$ //$NON-NLS-2$
- isChange = true;
- }
- return isChange;
- }
-
- private boolean isSettingSignal(String operation) {
- boolean isChange = false;
- /* changing signal: handle, signal */
- if (operation.startsWith("ha") && "handle".indexOf(operation) != -1) { //$NON-NLS-1$ //$NON-NLS-2$
- isChange = true;
- }
- return isChange;
- }
-
- /**
- * @param operation
- * @return
- */
- private boolean isDetach(String operation) {
- return (operation.startsWith("det") && "detach".indexOf(operation) != -1); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /** @since 4.0 */
- @DsfServiceEventHandler
- public void eventDispatched(IStartedDMEvent e) {
- if (e.getDMContext() instanceof IContainerDMContext) {
- // If a process restarts, we must reset the thread id
- // No need to worry about multi-process in this version.
- fLastThreadId = 0;
- }
- }
+ } else if (operation.equals("c") || operation.equals("fg") || //$NON-NLS-1$ //$NON-NLS-2$
+ (operation.startsWith("cont") && "continue".indexOf(operation) != -1)) { //$NON-NLS-1$ //$NON-NLS-2$
+ type = MIRunningEvent.CONTINUE;
+ } else if (operation.startsWith("sig") && "signal".indexOf(operation) != -1) { //$NON-NLS-1$ //$NON-NLS-2$
+ type = MIRunningEvent.CONTINUE;
+ } else if (operation.startsWith("j") && "jump".indexOf(operation) != -1) { //$NON-NLS-1$ //$NON-NLS-2$
+ type = MIRunningEvent.CONTINUE;
+ } else if (operation.equals("r") || operation.equals("run")) { //$NON-NLS-1$ //$NON-NLS-2$
+ type = MIRunningEvent.CONTINUE;
+ }
+ return type;
+ }
+
+ /**
+ * Return true if the operation is a stepping operation.
+ *
+ * @param operation
+ * @return
+ */
+ public static boolean isSteppingOperation(String operation) {
+ int type = getSteppingOperationKind(operation);
+ return type != -1;
+ }
+
+ /**
+ * Return true if the operation is a attaching operation.
+ *
+ * @param operation
+ * @return
+ * @since 4.0
+ */
+ public static boolean isAttachingOperation(String operation) {
+ // Get the command name.
+ int indx = operation.indexOf(' ');
+ if (indx != -1) {
+ operation = operation.substring(0, indx).trim();
+ } else {
+ operation = operation.trim();
+ }
+ /* attach: at, att, atta, attac, attach */
+ return (operation.startsWith("at") && "attach".indexOf(operation) != -1); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ private boolean isSettingBreakpoint(String operation) {
+ boolean isbreak = false;
+ /* breakpoints: b, break, hbreak, tbreak, rbreak, thbreak */
+ /* watchpoints: watch, rwatch, awatch, tbreak, rbreak, thbreak */
+ if ((operation.startsWith("b") && "break".indexOf(operation) != -1) || //$NON-NLS-1$ //$NON-NLS-2$
+ (operation.startsWith("tb") && "tbreak".indexOf(operation) != -1) || //$NON-NLS-1$ //$NON-NLS-2$
+ (operation.startsWith("hb") && "hbreak".indexOf(operation) != -1) || //$NON-NLS-1$ //$NON-NLS-2$
+ (operation.startsWith("thb") && "thbreak".indexOf(operation) != -1) || //$NON-NLS-1$ //$NON-NLS-2$
+ (operation.startsWith("rb") && "rbreak".indexOf(operation) != -1)) { //$NON-NLS-1$ //$NON-NLS-2$
+ isbreak = true;
+ }
+ return isbreak;
+ }
+
+ private boolean isSettingWatchpoint(String operation) {
+ boolean isWatch = false;
+ /* watchpoints: watch, rwatch, awatch, tbreak, rbreak, thbreak */
+ if ((operation.startsWith("wa") && "watch".indexOf(operation) != -1) || //$NON-NLS-1$ //$NON-NLS-2$
+ (operation.startsWith("rw") && "rwatch".indexOf(operation) != -1) || //$NON-NLS-1$ //$NON-NLS-2$
+ (operation.startsWith("aw") && "awatch".indexOf(operation) != -1)) { //$NON-NLS-1$ //$NON-NLS-2$
+ isWatch = true;
+ }
+ return isWatch;
+ }
+
+ private boolean isDeletingBreakpoint(String operation) {
+ boolean isDelete = false;
+ /* deleting breaks: clear, delete */
+ if ((operation.startsWith("cl") && "clear".indexOf(operation) != -1) || //$NON-NLS-1$ //$NON-NLS-2$
+ (operation.equals("d") || (operation.startsWith("del") && "delete".indexOf(operation) != -1))) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ isDelete = true;
+ }
+ return isDelete;
+ }
+
+ private boolean isChangeBreakpoint(String operation) {
+ boolean isChange = false;
+ /* changing breaks: enable, disable */
+ if ((operation.equals("dis") || operation.equals("disa") || //$NON-NLS-1$ //$NON-NLS-2$
+ (operation.startsWith("disa") && "disable".indexOf(operation) != -1)) || //$NON-NLS-1$ //$NON-NLS-2$
+ (operation.equals("en") || (operation.startsWith("en") && "enable".indexOf(operation) != -1)) || //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ (operation.startsWith("ig") && "ignore".indexOf(operation) != -1) || //$NON-NLS-1$ //$NON-NLS-2$
+ (operation.startsWith("cond") && "condition".indexOf(operation) != -1)) { //$NON-NLS-1$ //$NON-NLS-2$
+ isChange = true;
+ }
+ return isChange;
+ }
+
+ private boolean isSettingSignal(String operation) {
+ boolean isChange = false;
+ /* changing signal: handle, signal */
+ if (operation.startsWith("ha") && "handle".indexOf(operation) != -1) { //$NON-NLS-1$ //$NON-NLS-2$
+ isChange = true;
+ }
+ return isChange;
+ }
+
+ /**
+ * @param operation
+ * @return
+ */
+ private boolean isDetach(String operation) {
+ return (operation.startsWith("det") && "detach".indexOf(operation) != -1); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /** @since 4.0 */
+ @DsfServiceEventHandler
+ public void eventDispatched(IStartedDMEvent e) {
+ if (e.getDMContext() instanceof IContainerDMContext) {
+ // If a process restarts, we must reset the thread id
+ // No need to worry about multi-process in this version.
+ fLastThreadId = 0;
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CLIEventProcessor_7_0.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CLIEventProcessor_7_0.java
index 7de5badebfe..35079907ca5 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CLIEventProcessor_7_0.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CLIEventProcessor_7_0.java
@@ -11,8 +11,8 @@
* Contributors:
* QNX Software Systems - Initial API and implementation
* Wind River Systems - Modified for new DSF Reference Implementation
- * Ericsson AB - Additional handling of events
- * Ericsson - Version 7.0
+ * Ericsson AB - Additional handling of events
+ * Ericsson - Version 7.0
* Mikhail Khodjaiants (Mentor Graphics) - Refactor common code in GDBControl* classes (bug 372795)
*******************************************************************************/
@@ -40,260 +40,253 @@ import org.eclipse.cdt.dsf.mi.service.command.events.MISignalChangedEvent;
* @since 1.1
*/
@ConfinedToDsfExecutor("fConnection#getExecutor")
-public class CLIEventProcessor_7_0
- implements IEventProcessor
-{
- private final ICommandControlService fCommandControl;
-
- public CLIEventProcessor_7_0(ICommandControlService connection, ICommandControlDMContext controlDmc) {
- fCommandControl = connection;
- fCommandControl.addCommandListener(this);
- fCommandControl.addEventListener(this);
- }
+public class CLIEventProcessor_7_0 implements IEventProcessor {
+ private final ICommandControlService fCommandControl;
+
+ public CLIEventProcessor_7_0(ICommandControlService connection, ICommandControlDMContext controlDmc) {
+ fCommandControl = connection;
+ fCommandControl.addCommandListener(this);
+ fCommandControl.addEventListener(this);
+ }
@Override
public void dispose() {
- fCommandControl.removeCommandListener(this);
- fCommandControl.removeEventListener(this);
- }
-
- @Override
- public void commandSent(ICommandToken token) {
- if (token.getCommand() instanceof CLICommand<?>) {
- processStateChanges( (CLICommand<?>)token.getCommand() );
- }
- else if (token.getCommand() instanceof MIInterpreterExecConsole<?>) {
- processStateChanges( (MIInterpreterExecConsole<?>)token.getCommand() );
- }
- }
-
+ fCommandControl.removeCommandListener(this);
+ fCommandControl.removeEventListener(this);
+ }
+
@Override
- public void commandDone(ICommandToken token, ICommandResult result) {
- if (token.getCommand() instanceof CLICommand<?>) {
- processSettingChanges( (CLICommand<?>)token.getCommand() );
- }
- else if (token.getCommand() instanceof MIInterpreterExecConsole<?>) {
- processSettingChanges( (MIInterpreterExecConsole<?>)token.getCommand() );
- }
- }
-
+ public void commandSent(ICommandToken token) {
+ if (token.getCommand() instanceof CLICommand<?>) {
+ processStateChanges((CLICommand<?>) token.getCommand());
+ } else if (token.getCommand() instanceof MIInterpreterExecConsole<?>) {
+ processStateChanges((MIInterpreterExecConsole<?>) token.getCommand());
+ }
+ }
+
@Override
- public void commandQueued(ICommandToken token) {
- // No action
- }
-
+ public void commandDone(ICommandToken token, ICommandResult result) {
+ if (token.getCommand() instanceof CLICommand<?>) {
+ processSettingChanges((CLICommand<?>) token.getCommand());
+ } else if (token.getCommand() instanceof MIInterpreterExecConsole<?>) {
+ processSettingChanges((MIInterpreterExecConsole<?>) token.getCommand());
+ }
+ }
+
@Override
- public void commandRemoved(ICommandToken token) {
- // No action
- }
-
+ public void commandQueued(ICommandToken token) {
+ // No action
+ }
+
@Override
- public void eventReceived(Object output) {
- }
+ public void commandRemoved(ICommandToken token) {
+ // No action
+ }
+ @Override
+ public void eventReceived(Object output) {
+ }
- private void processStateChanges(CLICommand<? extends ICommandResult> cmd) {
- String operation = cmd.getOperation().trim();
- // In refactoring we are no longer generating the token id as
- // part of the command. It is passed here and stored away and
- // then never really used. So it has just been changed to 0.
- processStateChanges(0, operation);
- }
+ private void processStateChanges(CLICommand<? extends ICommandResult> cmd) {
+ String operation = cmd.getOperation().trim();
+ // In refactoring we are no longer generating the token id as
+ // part of the command. It is passed here and stored away and
+ // then never really used. So it has just been changed to 0.
+ processStateChanges(0, operation);
+ }
- private void processStateChanges(MIInterpreterExecConsole<? extends ICommandResult> exec) {
- String[] operations = exec.getParameters();
- if (operations != null && operations.length > 0) {
- // In refactoring we are no longer generating the token id as
- // part of the command. It is passed here and stored away and
- // then never really used. So it has just been changed to 0.
- processStateChanges(0, operations[0]);
- }
- }
+ private void processStateChanges(MIInterpreterExecConsole<? extends ICommandResult> exec) {
+ String[] operations = exec.getParameters();
+ if (operations != null && operations.length > 0) {
+ // In refactoring we are no longer generating the token id as
+ // part of the command. It is passed here and stored away and
+ // then never really used. So it has just been changed to 0.
+ processStateChanges(0, operations[0]);
+ }
+ }
- private void processStateChanges(int token, String operation) {
- // Get the command name.
- int indx = operation.indexOf(' ');
- if (indx != -1) {
- operation = operation.substring(0, indx).trim();
- } else {
- operation = operation.trim();
- }
+ private void processStateChanges(int token, String operation) {
+ // Get the command name.
+ int indx = operation.indexOf(' ');
+ if (indx != -1) {
+ operation = operation.substring(0, indx).trim();
+ } else {
+ operation = operation.trim();
+ }
- // Check the type of command
- int type = getSteppingOperationKind(operation);
- if (type != -1) {
- // Should set MIrunControlEventProcessor_7_0.fLastRunningCmdType
- }
- }
+ // Check the type of command
+ int type = getSteppingOperationKind(operation);
+ if (type != -1) {
+ // Should set MIrunControlEventProcessor_7_0.fLastRunningCmdType
+ }
+ }
- /**
- * An attempt to discover the command type and
- * fire an event if necessary.
- */
- private void processSettingChanges(CLICommand<?> cmd) {
- String operation = cmd.getOperation().trim();
- // In refactoring we are no longer genwerating the token id as
- // part of the command. It is passed here and stored away and
- // then never really used. So it has just been changed to 0.
- processSettingChanges(cmd.getContext(), 0, operation);
- }
+ /**
+ * An attempt to discover the command type and
+ * fire an event if necessary.
+ */
+ private void processSettingChanges(CLICommand<?> cmd) {
+ String operation = cmd.getOperation().trim();
+ // In refactoring we are no longer genwerating the token id as
+ // part of the command. It is passed here and stored away and
+ // then never really used. So it has just been changed to 0.
+ processSettingChanges(cmd.getContext(), 0, operation);
+ }
- private void processSettingChanges(MIInterpreterExecConsole<?> exec) {
- String[] operations = exec.getParameters();
- if (operations != null && operations.length > 0) {
- // In refactoring we are no longer genwerating the token id as
- // part of the command. It is passed here and stored away and
- // then never really used. So it has just been changed to 0.
- processSettingChanges(exec.getContext(), 0, operations[0]);
- }
- }
+ private void processSettingChanges(MIInterpreterExecConsole<?> exec) {
+ String[] operations = exec.getParameters();
+ if (operations != null && operations.length > 0) {
+ // In refactoring we are no longer genwerating the token id as
+ // part of the command. It is passed here and stored away and
+ // then never really used. So it has just been changed to 0.
+ processSettingChanges(exec.getContext(), 0, operations[0]);
+ }
+ }
- private void processSettingChanges(IDMContext dmc, int token, String operation) {
- // Get the command name.
- int indx = operation.indexOf(' ');
- if (indx != -1) {
- operation = operation.substring(0, indx).trim();
- } else {
- operation = operation.trim();
- }
+ private void processSettingChanges(IDMContext dmc, int token, String operation) {
+ // Get the command name.
+ int indx = operation.indexOf(' ');
+ if (indx != -1) {
+ operation = operation.substring(0, indx).trim();
+ } else {
+ operation = operation.trim();
+ }
- // Check the type of command
+ // Check the type of command
- if (isSettingBreakpoint(operation) ||
- isSettingWatchpoint(operation) ||
- isChangeBreakpoint(operation) ||
- isDeletingBreakpoint(operation))
- {
- // We know something change, we just do not know what.
- // So the easiest way is to let the top layer handle it.
- IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(dmc, IBreakpointsTargetDMContext.class);
- if (bpTargetDmc != null) {
- MIEvent<?> event = new MIBreakpointChangedEvent(bpTargetDmc, 0);
- fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
- }
- } else if (isSettingSignal(operation)) {
- // We do no know which signal let the upper layer find it.
- ISignalsDMContext signalDmc = DMContexts.getAncestorOfType(dmc, ISignalsDMContext.class);
- if (signalDmc != null) {
- MIEvent<?> event = new MISignalChangedEvent(signalDmc, ""); //$NON-NLS-1$
- fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
- }
- } else if (isDetach(operation)) {
- // if it was a "detach" command change the state.
- ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
- if (controlDmc != null) {
- MIEvent<?> event = new MIDetachedEvent(controlDmc, token);
- fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
- }
- }
- }
+ if (isSettingBreakpoint(operation) || isSettingWatchpoint(operation) || isChangeBreakpoint(operation)
+ || isDeletingBreakpoint(operation)) {
+ // We know something change, we just do not know what.
+ // So the easiest way is to let the top layer handle it.
+ IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(dmc,
+ IBreakpointsTargetDMContext.class);
+ if (bpTargetDmc != null) {
+ MIEvent<?> event = new MIBreakpointChangedEvent(bpTargetDmc, 0);
+ fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
+ }
+ } else if (isSettingSignal(operation)) {
+ // We do no know which signal let the upper layer find it.
+ ISignalsDMContext signalDmc = DMContexts.getAncestorOfType(dmc, ISignalsDMContext.class);
+ if (signalDmc != null) {
+ MIEvent<?> event = new MISignalChangedEvent(signalDmc, ""); //$NON-NLS-1$
+ fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
+ }
+ } else if (isDetach(operation)) {
+ // if it was a "detach" command change the state.
+ ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
+ if (controlDmc != null) {
+ MIEvent<?> event = new MIDetachedEvent(controlDmc, token);
+ fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
+ }
+ }
+ }
- private static int getSteppingOperationKind(String operation) {
- int type = -1;
- /* execution commands: n, next, s, step, si, stepi, u, until, finish, rerurn,
- c, continue, fg */
- if (operation.equals("n") || operation.equals("next")) { //$NON-NLS-1$ //$NON-NLS-2$
- type = MIRunningEvent.NEXT;
- } else if (operation.equals("ni") || operation.equals("nexti")) { //$NON-NLS-1$ //$NON-NLS-2$
- type = MIRunningEvent.NEXTI;
- } else if (operation.equals("s") || operation.equals("step")) { //$NON-NLS-1$ //$NON-NLS-2$
- type = MIRunningEvent.STEP;
- } else if (operation.equals("si") || operation.equals("stepi")) { //$NON-NLS-1$ //$NON-NLS-2$
- type = MIRunningEvent.STEPI;
- } else if (operation.equals("u") || //$NON-NLS-1$
- (operation.startsWith("unt") && "until".indexOf(operation) != -1)) { //$NON-NLS-1$ //$NON-NLS-2$
- type = MIRunningEvent.UNTIL;
- } else if (operation.startsWith("fin") && "finish".indexOf(operation) != -1) { //$NON-NLS-1$ //$NON-NLS-2$
- type = MIRunningEvent.FINISH;
+ private static int getSteppingOperationKind(String operation) {
+ int type = -1;
+ /* execution commands: n, next, s, step, si, stepi, u, until, finish, rerurn,
+ c, continue, fg */
+ if (operation.equals("n") || operation.equals("next")) { //$NON-NLS-1$ //$NON-NLS-2$
+ type = MIRunningEvent.NEXT;
+ } else if (operation.equals("ni") || operation.equals("nexti")) { //$NON-NLS-1$ //$NON-NLS-2$
+ type = MIRunningEvent.NEXTI;
+ } else if (operation.equals("s") || operation.equals("step")) { //$NON-NLS-1$ //$NON-NLS-2$
+ type = MIRunningEvent.STEP;
+ } else if (operation.equals("si") || operation.equals("stepi")) { //$NON-NLS-1$ //$NON-NLS-2$
+ type = MIRunningEvent.STEPI;
+ } else if (operation.equals("u") || //$NON-NLS-1$
+ (operation.startsWith("unt") && "until".indexOf(operation) != -1)) { //$NON-NLS-1$ //$NON-NLS-2$
+ type = MIRunningEvent.UNTIL;
+ } else if (operation.startsWith("fin") && "finish".indexOf(operation) != -1) { //$NON-NLS-1$ //$NON-NLS-2$
+ type = MIRunningEvent.FINISH;
} else if (operation.startsWith("ret") && "return".indexOf(operation) != -1) { //$NON-NLS-1$ //$NON-NLS-2$
type = MIRunningEvent.RETURN;
- } else if (operation.equals("c") || operation.equals("fg") || //$NON-NLS-1$ //$NON-NLS-2$
- (operation.startsWith("cont") && "continue".indexOf(operation) != -1)) { //$NON-NLS-1$ //$NON-NLS-2$
- type = MIRunningEvent.CONTINUE;
- } else if (operation.startsWith("sig") && "signal".indexOf(operation) != -1) { //$NON-NLS-1$ //$NON-NLS-2$
- type = MIRunningEvent.CONTINUE;
- } else if (operation.startsWith("j") && "jump".indexOf(operation) != -1) { //$NON-NLS-1$ //$NON-NLS-2$
- type = MIRunningEvent.CONTINUE;
- } else if (operation.equals("r") || operation.equals("run")) { //$NON-NLS-1$ //$NON-NLS-2$
- type = MIRunningEvent.CONTINUE;
- }
- return type;
- }
+ } else if (operation.equals("c") || operation.equals("fg") || //$NON-NLS-1$ //$NON-NLS-2$
+ (operation.startsWith("cont") && "continue".indexOf(operation) != -1)) { //$NON-NLS-1$ //$NON-NLS-2$
+ type = MIRunningEvent.CONTINUE;
+ } else if (operation.startsWith("sig") && "signal".indexOf(operation) != -1) { //$NON-NLS-1$ //$NON-NLS-2$
+ type = MIRunningEvent.CONTINUE;
+ } else if (operation.startsWith("j") && "jump".indexOf(operation) != -1) { //$NON-NLS-1$ //$NON-NLS-2$
+ type = MIRunningEvent.CONTINUE;
+ } else if (operation.equals("r") || operation.equals("run")) { //$NON-NLS-1$ //$NON-NLS-2$
+ type = MIRunningEvent.CONTINUE;
+ }
+ return type;
+ }
- /**
- * Return true if the operation is a stepping operation.
- *
- * @param operation
- * @return
- */
- public static boolean isSteppingOperation(String operation) {
- int type = getSteppingOperationKind(operation);
- return type != -1;
- }
+ /**
+ * Return true if the operation is a stepping operation.
+ *
+ * @param operation
+ * @return
+ */
+ public static boolean isSteppingOperation(String operation) {
+ int type = getSteppingOperationKind(operation);
+ return type != -1;
+ }
- private boolean isSettingBreakpoint(String operation) {
- boolean isbreak = false;
- /* breakpoints: b, break, hbreak, tbreak, rbreak, thbreak */
- /* watchpoints: watch, rwatch, awatch, tbreak, rbreak, thbreak */
- if ((operation.startsWith("b") && "break".indexOf(operation) != -1) || //$NON-NLS-1$ //$NON-NLS-2$
- (operation.startsWith("tb") && "tbreak".indexOf(operation) != -1) || //$NON-NLS-1$ //$NON-NLS-2$
- (operation.startsWith("hb") && "hbreak".indexOf(operation) != -1) || //$NON-NLS-1$ //$NON-NLS-2$
- (operation.startsWith("thb") && "thbreak".indexOf(operation) != -1) || //$NON-NLS-1$ //$NON-NLS-2$
- (operation.startsWith("rb") && "rbreak".indexOf(operation) != -1)) { //$NON-NLS-1$ //$NON-NLS-2$
- isbreak = true;
- }
- return isbreak;
- }
+ private boolean isSettingBreakpoint(String operation) {
+ boolean isbreak = false;
+ /* breakpoints: b, break, hbreak, tbreak, rbreak, thbreak */
+ /* watchpoints: watch, rwatch, awatch, tbreak, rbreak, thbreak */
+ if ((operation.startsWith("b") && "break".indexOf(operation) != -1) || //$NON-NLS-1$ //$NON-NLS-2$
+ (operation.startsWith("tb") && "tbreak".indexOf(operation) != -1) || //$NON-NLS-1$ //$NON-NLS-2$
+ (operation.startsWith("hb") && "hbreak".indexOf(operation) != -1) || //$NON-NLS-1$ //$NON-NLS-2$
+ (operation.startsWith("thb") && "thbreak".indexOf(operation) != -1) || //$NON-NLS-1$ //$NON-NLS-2$
+ (operation.startsWith("rb") && "rbreak".indexOf(operation) != -1)) { //$NON-NLS-1$ //$NON-NLS-2$
+ isbreak = true;
+ }
+ return isbreak;
+ }
- private boolean isSettingWatchpoint(String operation) {
- boolean isWatch = false;
- /* watchpoints: watch, rwatch, awatch, tbreak, rbreak, thbreak */
- if ((operation.startsWith("wa") && "watch".indexOf(operation) != -1) || //$NON-NLS-1$ //$NON-NLS-2$
- (operation.startsWith("rw") && "rwatch".indexOf(operation) != -1) || //$NON-NLS-1$ //$NON-NLS-2$
- (operation.startsWith("aw") && "awatch".indexOf(operation) != -1)) { //$NON-NLS-1$ //$NON-NLS-2$
- isWatch = true;
- }
- return isWatch;
- }
+ private boolean isSettingWatchpoint(String operation) {
+ boolean isWatch = false;
+ /* watchpoints: watch, rwatch, awatch, tbreak, rbreak, thbreak */
+ if ((operation.startsWith("wa") && "watch".indexOf(operation) != -1) || //$NON-NLS-1$ //$NON-NLS-2$
+ (operation.startsWith("rw") && "rwatch".indexOf(operation) != -1) || //$NON-NLS-1$ //$NON-NLS-2$
+ (operation.startsWith("aw") && "awatch".indexOf(operation) != -1)) { //$NON-NLS-1$ //$NON-NLS-2$
+ isWatch = true;
+ }
+ return isWatch;
+ }
- private boolean isDeletingBreakpoint(String operation) {
- boolean isDelete = false;
- /* deleting breaks: clear, delete */
- if ((operation.startsWith("cl") && "clear".indexOf(operation) != -1) || //$NON-NLS-1$ //$NON-NLS-2$
- (operation.equals("d") || (operation.startsWith("del") && "delete".indexOf(operation) != -1))) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- isDelete = true;
- }
- return isDelete;
- }
+ private boolean isDeletingBreakpoint(String operation) {
+ boolean isDelete = false;
+ /* deleting breaks: clear, delete */
+ if ((operation.startsWith("cl") && "clear".indexOf(operation) != -1) || //$NON-NLS-1$ //$NON-NLS-2$
+ (operation.equals("d") || (operation.startsWith("del") && "delete".indexOf(operation) != -1))) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ isDelete = true;
+ }
+ return isDelete;
+ }
- private boolean isChangeBreakpoint(String operation) {
- boolean isChange = false;
- /* changing breaks: enable, disable */
- if ((operation.equals("dis") || operation.equals("disa") || //$NON-NLS-1$ //$NON-NLS-2$
- (operation.startsWith("disa") && "disable".indexOf(operation) != -1)) || //$NON-NLS-1$ //$NON-NLS-2$
- (operation.equals("en") || (operation.startsWith("en") && "enable".indexOf(operation) != -1)) || //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- (operation.startsWith("ig") && "ignore".indexOf(operation) != -1) || //$NON-NLS-1$ //$NON-NLS-2$
- (operation.startsWith("cond") && "condition".indexOf(operation) != -1)) { //$NON-NLS-1$ //$NON-NLS-2$
- isChange = true;
- }
- return isChange;
- }
+ private boolean isChangeBreakpoint(String operation) {
+ boolean isChange = false;
+ /* changing breaks: enable, disable */
+ if ((operation.equals("dis") || operation.equals("disa") || //$NON-NLS-1$ //$NON-NLS-2$
+ (operation.startsWith("disa") && "disable".indexOf(operation) != -1)) || //$NON-NLS-1$ //$NON-NLS-2$
+ (operation.equals("en") || (operation.startsWith("en") && "enable".indexOf(operation) != -1)) || //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ (operation.startsWith("ig") && "ignore".indexOf(operation) != -1) || //$NON-NLS-1$ //$NON-NLS-2$
+ (operation.startsWith("cond") && "condition".indexOf(operation) != -1)) { //$NON-NLS-1$ //$NON-NLS-2$
+ isChange = true;
+ }
+ return isChange;
+ }
- private boolean isSettingSignal(String operation) {
- boolean isChange = false;
- /* changing signal: handle, signal */
- if (operation.startsWith("ha") && "handle".indexOf(operation) != -1) { //$NON-NLS-1$ //$NON-NLS-2$
- isChange = true;
- }
- return isChange;
- }
+ private boolean isSettingSignal(String operation) {
+ boolean isChange = false;
+ /* changing signal: handle, signal */
+ if (operation.startsWith("ha") && "handle".indexOf(operation) != -1) { //$NON-NLS-1$ //$NON-NLS-2$
+ isChange = true;
+ }
+ return isChange;
+ }
- /**
- * @param operation
- * @return
- */
- private boolean isDetach(String operation) {
- return (operation.startsWith("det") && "detach".indexOf(operation) != -1); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ /**
+ * @param operation
+ * @return
+ */
+ private boolean isDetach(String operation) {
+ return (operation.startsWith("det") && "detach".indexOf(operation) != -1); //$NON-NLS-1$ //$NON-NLS-2$
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CLIEventProcessor_7_7.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CLIEventProcessor_7_7.java
index fafc9a7e0e0..cff4b51f29c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CLIEventProcessor_7_7.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CLIEventProcessor_7_7.java
@@ -29,22 +29,20 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
* @since 4.4
*/
@ConfinedToDsfExecutor("fConnection#getExecutor")
-public class CLIEventProcessor_7_7 extends CLIEventProcessor_7_0
- implements IEventProcessor
-{
- private final ICommandControlService fControl;
- private boolean fResetDPrintfStyle;
-
- public CLIEventProcessor_7_7(ICommandControlService connection, ICommandControlDMContext controlDmc) {
- super(connection, controlDmc);
- fControl = connection;
- }
+public class CLIEventProcessor_7_7 extends CLIEventProcessor_7_0 implements IEventProcessor {
+ private final ICommandControlService fControl;
+ private boolean fResetDPrintfStyle;
+
+ public CLIEventProcessor_7_7(ICommandControlService connection, ICommandControlDMContext controlDmc) {
+ super(connection, controlDmc);
+ fControl = connection;
+ }
@Override
- public void eventReceived(Object output) {
+ public void eventReceived(Object output) {
if (!fResetDPrintfStyle) {
// Only do this if we haven't already reset the dprintf style
- for (MIOOBRecord oobr : ((MIOutput)output).getMIOOBRecords()) {
+ for (MIOOBRecord oobr : ((MIOutput) output).getMIOOBRecords()) {
if (oobr instanceof MIConsoleStreamOutput) {
MIConsoleStreamOutput exec = (MIConsoleStreamOutput) oobr;
@@ -55,10 +53,9 @@ public class CLIEventProcessor_7_7 extends CLIEventProcessor_7_0
// and not the 'call' one.
fResetDPrintfStyle = true;
if (fControl instanceof IMICommandControl) {
- CommandFactory factory = ((IMICommandControl)fControl).getCommandFactory();
- fControl.queueCommand(
- factory.createMIGDBSetDPrintfStyle(fControl.getContext(), MIGDBSetDPrintfStyle.GDB_STYLE),
- new ImmediateDataRequestMonitor<MIInfo>() {
+ CommandFactory factory = ((IMICommandControl) fControl).getCommandFactory();
+ fControl.queueCommand(factory.createMIGDBSetDPrintfStyle(fControl.getContext(),
+ MIGDBSetDPrintfStyle.GDB_STYLE), new ImmediateDataRequestMonitor<MIInfo>() {
@Override
protected void handleCompleted() {
// We accept errors
@@ -69,6 +66,6 @@ public class CLIEventProcessor_7_7 extends CLIEventProcessor_7_0
}
}
}
- super.eventReceived(output);
- }
+ super.eventReceived(output);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CommandFactory.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CommandFactory.java
index 948922f0b06..e700ff075ac 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CommandFactory.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CommandFactory.java
@@ -257,7 +257,7 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIVarUpdateInfo;
/**
* Factory to create MI/CLI commands.
- *
+ *
* @since 3.0
*/
public class CommandFactory {
@@ -280,7 +280,7 @@ public class CommandFactory {
public ICommand<CLICatchInfo> createCLICatch(IBreakpointsTargetDMContext ctx, String event, String[] args) {
return new CLICatch(ctx, event, args);
}
-
+
public ICommand<MIInfo> createCLIDetach(IDMContext ctx) {
return new CLIDetach(ctx);
}
@@ -298,7 +298,7 @@ public class CommandFactory {
public ICommand<CLIInfoBreakInfo> createCLIInfoBreak(IDMContext ctx) {
return new CLIInfoBreak(ctx);
}
-
+
/** @since 4.2 */
public ICommand<CLIInfoBreakInfo> createCLIInfoBreak(IDMContext ctx, int bpRef) {
return new CLIInfoBreak(ctx, bpRef);
@@ -408,19 +408,21 @@ public class CommandFactory {
public ICommand<MIAddInferiorInfo> createMIAddInferior(ICommandControlDMContext ctx) {
return new MIAddInferior(ctx);
}
-
+
/** @since 5.0 */
public ICommand<MIInfo> createMIBreakAfter(IBreakpointsTargetDMContext ctx, String breakpoint, int ignoreCount) {
return new MIBreakAfter(ctx, breakpoint, ignoreCount);
}
/** @since 5.0 */
- public ICommand<MIInfo> createMIBreakCommands(IBreakpointsTargetDMContext ctx, String breakpoint, String[] commands) {
+ public ICommand<MIInfo> createMIBreakCommands(IBreakpointsTargetDMContext ctx, String breakpoint,
+ String[] commands) {
return new MIBreakCommands(ctx, breakpoint, commands);
}
-
+
/** @since 5.0 */
- public ICommand<MIInfo> createMIBreakCondition(IBreakpointsTargetDMContext ctx, String breakpoint, String condition) {
+ public ICommand<MIInfo> createMIBreakCondition(IBreakpointsTargetDMContext ctx, String breakpoint,
+ String condition) {
return new MIBreakCondition(ctx, breakpoint, condition);
}
@@ -444,21 +446,21 @@ public class CommandFactory {
}
/**
- * @since 5.0
- */
- public ICommand<MIBreakInsertInfo> createMIBreakInsert(IBreakpointsTargetDMContext ctx, boolean isTemporary,
- boolean isHardware, String condition, int ignoreCount,
- String line, String tid) {
+ * @since 5.0
+ */
+ public ICommand<MIBreakInsertInfo> createMIBreakInsert(IBreakpointsTargetDMContext ctx, boolean isTemporary,
+ boolean isHardware, String condition, int ignoreCount, String line, String tid) {
return new MIBreakInsert(ctx, isTemporary, isHardware, condition, ignoreCount, line, tid, false);
}
/**
- * @since 5.0
- */
+ * @since 5.0
+ */
public ICommand<MIBreakInsertInfo> createMIBreakInsert(IBreakpointsTargetDMContext ctx, boolean isTemporary,
- boolean isHardware, String condition, int ignoreCount,
- String location, String tid, boolean disabled, boolean isTracepoint) {
- return new MIBreakInsert(ctx, isTemporary, isHardware, condition, ignoreCount, location, tid, disabled, isTracepoint, false);
+ boolean isHardware, String condition, int ignoreCount, String location, String tid, boolean disabled,
+ boolean isTracepoint) {
+ return new MIBreakInsert(ctx, isTemporary, isHardware, condition, ignoreCount, location, tid, disabled,
+ isTracepoint, false);
}
public ICommand<MIBreakListInfo> createMIBreakList(IBreakpointsTargetDMContext ctx) {
@@ -469,37 +471,45 @@ public class CommandFactory {
return new MIBreakPasscount(ctx, tracepoint, passCount);
}
- public ICommand<MIBreakInsertInfo> createMIBreakWatch(IBreakpointsTargetDMContext ctx, boolean isRead, boolean isWrite, String expression) {
+ public ICommand<MIBreakInsertInfo> createMIBreakWatch(IBreakpointsTargetDMContext ctx, boolean isRead,
+ boolean isWrite, String expression) {
return new MIBreakWatch(ctx, isRead, isWrite, expression);
}
- public ICommand<MIDataDisassembleInfo> createMIDataDisassemble(IDisassemblyDMContext ctx, String start, String end, boolean mode) {
+ public ICommand<MIDataDisassembleInfo> createMIDataDisassemble(IDisassemblyDMContext ctx, String start, String end,
+ boolean mode) {
return new MIDataDisassemble(ctx, start, end, mode);
}
/** @since 4.1 */
- public ICommand<MIDataDisassembleInfo> createMIDataDisassemble(IDisassemblyDMContext ctx, String start, String end, int mode) {
+ public ICommand<MIDataDisassembleInfo> createMIDataDisassemble(IDisassemblyDMContext ctx, String start, String end,
+ int mode) {
return new MIDataDisassemble(ctx, start, end, mode);
}
- public ICommand<MIDataDisassembleInfo> createMIDataDisassemble(IDisassemblyDMContext ctx, String file, int linenum, int lines, boolean mode) {
+ public ICommand<MIDataDisassembleInfo> createMIDataDisassemble(IDisassemblyDMContext ctx, String file, int linenum,
+ int lines, boolean mode) {
return new MIDataDisassemble(ctx, file, linenum, lines, mode);
}
/** @since 4.1 */
- public ICommand<MIDataDisassembleInfo> createMIDataDisassemble(IDisassemblyDMContext ctx, String file, int linenum, int lines, int mode) {
+ public ICommand<MIDataDisassembleInfo> createMIDataDisassemble(IDisassemblyDMContext ctx, String file, int linenum,
+ int lines, int mode) {
return new MIDataDisassemble(ctx, file, linenum, lines, mode);
}
- public ICommand<MIDataEvaluateExpressionInfo> createMIDataEvaluateExpression(ICommandControlDMContext ctx, String expr) {
+ public ICommand<MIDataEvaluateExpressionInfo> createMIDataEvaluateExpression(ICommandControlDMContext ctx,
+ String expr) {
return new MIDataEvaluateExpression<MIDataEvaluateExpressionInfo>(ctx, expr);
}
- public ICommand<MIDataEvaluateExpressionInfo> createMIDataEvaluateExpression(IMIExecutionDMContext execDmc, String expr) {
+ public ICommand<MIDataEvaluateExpressionInfo> createMIDataEvaluateExpression(IMIExecutionDMContext execDmc,
+ String expr) {
return new MIDataEvaluateExpression<MIDataEvaluateExpressionInfo>(execDmc, expr);
}
- public ICommand<MIDataEvaluateExpressionInfo> createMIDataEvaluateExpression(IFrameDMContext frameDmc, String expr) {
+ public ICommand<MIDataEvaluateExpressionInfo> createMIDataEvaluateExpression(IFrameDMContext frameDmc,
+ String expr) {
return new MIDataEvaluateExpression<MIDataEvaluateExpressionInfo>(frameDmc, expr);
}
@@ -511,7 +521,7 @@ public class CommandFactory {
return new MIDataListRegisterNames(ctx);
}
- public ICommand<MIDataListRegisterNamesInfo> createMIDataListRegisterNames(IContainerDMContext ctx, int [] regnos) {
+ public ICommand<MIDataListRegisterNamesInfo> createMIDataListRegisterNames(IContainerDMContext ctx, int[] regnos) {
return new MIDataListRegisterNames(ctx, regnos);
}
@@ -525,31 +535,31 @@ public class CommandFactory {
/**
* @since 4.3
*/
- public ICommand<MIDataListRegisterValuesInfo> createMIDataListRegisterValues(IFrameDMContext ctx, int fmt, int [] regnos) {
+ public ICommand<MIDataListRegisterValuesInfo> createMIDataListRegisterValues(IFrameDMContext ctx, int fmt,
+ int[] regnos) {
return new MIDataListRegisterValues(ctx, fmt, regnos);
}
- public ICommand<MIDataReadMemoryInfo> createMIDataReadMemory(IDMContext ctx, long offset, String address,
- int word_format, int word_size, int rows, int cols,
- Character asChar) {
+ public ICommand<MIDataReadMemoryInfo> createMIDataReadMemory(IDMContext ctx, long offset, String address,
+ int word_format, int word_size, int rows, int cols, Character asChar) {
return new MIDataReadMemory(ctx, offset, address, word_format, word_size, rows, cols, asChar);
}
/** @since 4.0 */
- public ICommand<MIDataReadMemoryBytesInfo> createMIDataReadMemoryBytes(IDMContext ctx, String address,
- long offset, int num_bytes) {
+ public ICommand<MIDataReadMemoryBytesInfo> createMIDataReadMemoryBytes(IDMContext ctx, String address, long offset,
+ int num_bytes) {
return new MIDataReadMemoryBytes(ctx, address, offset, num_bytes);
}
/**
* @since 4.4
*/
- public ICommand<MIDataReadMemoryBytesInfo> createMIDataReadMemoryBytes(IDMContext ctx, String address,
- long offset, int word_count, int word_size) {
+ public ICommand<MIDataReadMemoryBytesInfo> createMIDataReadMemoryBytes(IDMContext ctx, String address, long offset,
+ int word_count, int word_size) {
return new MIDataReadMemoryBytes(ctx, address, offset, word_count, word_size);
}
-
- public ICommand<MIDataWriteMemoryInfo> createMIDataWriteMemory(IDMContext ctx, long offset, String address,
+
+ public ICommand<MIDataWriteMemoryInfo> createMIDataWriteMemory(IDMContext ctx, long offset, String address,
int wordFormat, int wordSize, String value) {
return new MIDataWriteMemory(ctx, offset, address, wordFormat, wordSize, value);
}
@@ -558,7 +568,7 @@ public class CommandFactory {
public ICommand<MIInfo> createMIDataWriteMemoryBytes(IDMContext ctx, String address, byte[] contents) {
return new MIDataWriteMemoryBytes(ctx, address, contents);
}
-
+
/** @since 4.4 */
public ICommand<MIBreakInsertInfo> createMIDPrintfInsert(IBreakpointsTargetDMContext ctx, boolean isTemporary,
String condition, int ignoreCount, int tid, boolean disabled, String location, String printfStr) {
@@ -582,7 +592,7 @@ public class CommandFactory {
public ICommand<MIInfo> createMIExecArguments(IMIContainerDMContext ctx, String[] args) {
return new MIExecArguments(ctx, args);
}
-
+
public ICommand<MIInfo> createMIExecContinue(IExecutionDMContext dmc) {
return new MIExecContinue(dmc);
}
@@ -618,7 +628,7 @@ public class CommandFactory {
public ICommand<MIInfo> createMIExecNext(IExecutionDMContext dmc) {
return new MIExecNext(dmc);
}
-
+
public ICommand<MIInfo> createMIExecNext(IExecutionDMContext dmc, int count) {
return new MIExecNext(dmc, count);
}
@@ -646,11 +656,11 @@ public class CommandFactory {
public ICommand<MIInfo> createMIExecReverseNext(IExecutionDMContext dmc) {
return new MIExecReverseNext(dmc);
}
-
+
public ICommand<MIInfo> createMIExecReverseNext(IExecutionDMContext dmc, int count) {
return new MIExecReverseNext(dmc, count);
}
-
+
public ICommand<MIInfo> createMIExecReverseNextInstruction(IExecutionDMContext dmc) {
return new MIExecReverseNextInstruction(dmc);
}
@@ -662,11 +672,11 @@ public class CommandFactory {
public ICommand<MIInfo> createMIExecReverseStep(IExecutionDMContext dmc) {
return new MIExecReverseStep(dmc);
}
-
+
public ICommand<MIInfo> createMIExecReverseStep(IExecutionDMContext dmc, int count) {
return new MIExecReverseStep(dmc, count);
}
-
+
public ICommand<MIInfo> createMIExecReverseStepInstruction(IExecutionDMContext dmc) {
return new MIExecReverseStepInstruction(dmc);
}
@@ -686,11 +696,11 @@ public class CommandFactory {
public ICommand<MIInfo> createMIExecStep(IExecutionDMContext dmc) {
return new MIExecStep(dmc);
}
-
+
public ICommand<MIInfo> createMIExecStep(IExecutionDMContext dmc, int count) {
return new MIExecStep(dmc, count);
}
-
+
public ICommand<MIInfo> createMIExecStepInstruction(IExecutionDMContext dmc) {
return new MIExecStepInstruction(dmc);
}
@@ -720,7 +730,7 @@ public class CommandFactory {
public ICommand<MIInfo> createMIFileExecAndSymbols(IMIContainerDMContext dmc) {
return new MIFileExecAndSymbols(dmc);
}
-
+
public ICommand<MIInfo> createMIFileExecFile(ICommandControlDMContext dmc, String file) {
return new MIFileExecFile(dmc, file);
}
@@ -754,7 +764,7 @@ public class CommandFactory {
public ICommand<MIInfo> createMIGDBSetArgs(IMIContainerDMContext dmc, String[] arguments) {
return new MIGDBSetArgs(dmc, arguments);
}
-
+
public ICommand<MIInfo> createMIGDBSetAutoSolib(ICommandControlDMContext ctx, boolean isSet) {
return new MIGDBSetAutoSolib(ctx, isSet);
}
@@ -773,7 +783,7 @@ public class CommandFactory {
public ICommand<MIInfo> createMIGDBSetCircularTraceBuffer(ITraceTargetDMContext ctx, boolean useCircularBuffer) {
return new MIGDBSetCircularTraceBuffer(ctx, useCircularBuffer);
}
-
+
/** @since 4.0 */
public ICommand<MIInfo> createMIGDBSetDetachOnFork(ICommandControlDMContext ctx, boolean detach) {
return new MIGDBSetDetachOnFork(ctx, detach);
@@ -787,7 +797,7 @@ public class CommandFactory {
/** @since 4.4 */
public ICommand<MIInfo> createMIGDBSetDPrintfStyle(ICommandControlDMContext ctx, String style) {
return new MIGDBSetDPrintfStyle(ctx, style);
- }
+ }
public ICommand<MIInfo> createMIGDBSetEnv(ICommandControlDMContext dmc, String name) {
return new MIGDBSetEnv(dmc, name);
@@ -833,7 +843,7 @@ public class CommandFactory {
/** @since 4.1 */
public ICommand<MIInfo> createMIGDBSetPythonPrintStack(ICommandControlDMContext ctx, String option) {
return new MIGDBSetPythonPrintStack(ctx, option);
- }
+ }
/** @since 5.2 */
public ICommand<MIInfo> createMIGDBSetRecordFullStopAtLimit(ICommandControlDMContext ctx, boolean isSet) {
@@ -854,16 +864,16 @@ public class CommandFactory {
public ICommand<MIInfo> createMIGDBSetTargetCharset(ICommandControlDMContext ctx, String targetCharset) {
return new MIGDBSetTargetCharset(ctx, targetCharset);
}
-
+
/** @since 4.1 */
public ICommand<MIInfo> createMIGDBSetTargetWideCharset(ICommandControlDMContext ctx, String targetWideCharset) {
return new MIGDBSetTargetWideCharset(ctx, targetWideCharset);
}
-
+
public ICommand<MIInfo> createMIGDBSetSolibAbsolutePrefix(ICommandControlDMContext ctx, String prefix) {
return new MIGDBSetSolibAbsolutePrefix(ctx, prefix);
}
-
+
public ICommand<MIInfo> createMIGDBSetSolibSearchPath(ICommandControlDMContext ctx, String[] paths) {
return new MIGDBSetSolibSearchPath(ctx, paths);
}
@@ -900,7 +910,7 @@ public class CommandFactory {
public ICommand<MIGDBVersionInfo> createMIGDBVersion(ICommandControlDMContext ctx) {
return new MIGDBVersion(ctx);
}
-
+
/** @since 4.0 */
public ICommand<MIInfo> createMIInferiorTTYSet(IMIContainerDMContext dmc, String tty) {
return new MIInferiorTTYSet(dmc, tty);
@@ -919,11 +929,11 @@ public class CommandFactory {
public ICommand<MIInfoOsInfo> createMIInfoOS(IDMContext ctx, String resourceClass) {
return new MIInfoOs(ctx, resourceClass);
}
-
+
public ICommand<MIInfo> createMIInterpreterExec(IDMContext ctx, String interpreter, String cmd) {
return new MIInterpreterExec<MIInfo>(ctx, interpreter, cmd);
}
-
+
public ICommand<MIInfo> createMIInterpreterExecConsole(IDMContext ctx, String cmd) {
return new MIInterpreterExecConsole<MIInfo>(ctx, cmd);
}
@@ -951,7 +961,8 @@ public class CommandFactory {
}
/** @since 4.1 */
- public ICommand<MIListThreadGroupsInfo> createMIListThreadGroups(ICommandControlDMContext ctx, boolean listAll, boolean recurse) {
+ public ICommand<MIListThreadGroupsInfo> createMIListThreadGroups(ICommandControlDMContext ctx, boolean listAll,
+ boolean recurse) {
return new MIListThreadGroups(ctx, listAll, recurse);
}
@@ -973,7 +984,8 @@ public class CommandFactory {
return new MIStackInfoDepth(ctx, maxDepth);
}
- public ICommand<MIStackListArgumentsInfo> createMIStackListArguments(IMIExecutionDMContext execDmc, boolean showValues) {
+ public ICommand<MIStackListArgumentsInfo> createMIStackListArguments(IMIExecutionDMContext execDmc,
+ boolean showValues) {
return new MIStackListArguments(execDmc, showValues);
}
@@ -982,11 +994,13 @@ public class CommandFactory {
}
/** @since 5.5 */
- public ICommand<MIStackListArgumentsInfo> createMIStackListArguments(IFrameDMContext frameDmc, boolean showValues, int low, int high) {
+ public ICommand<MIStackListArgumentsInfo> createMIStackListArguments(IFrameDMContext frameDmc, boolean showValues,
+ int low, int high) {
return new MIStackListArguments(frameDmc, showValues, low, high);
}
- public ICommand<MIStackListArgumentsInfo> createMIStackListArguments(IMIExecutionDMContext execDmc, boolean showValues, int low, int high) {
+ public ICommand<MIStackListArgumentsInfo> createMIStackListArguments(IMIExecutionDMContext execDmc,
+ boolean showValues, int low, int high) {
return new MIStackListArguments(execDmc, showValues, low, high);
}
@@ -1017,7 +1031,8 @@ public class CommandFactory {
}
/** @since 5.4 */
- public ICommand<MIInfo> createMITargetAttach(IMIContainerDMContext ctx, String groupId, boolean interrupt, boolean extraNewline) {
+ public ICommand<MIInfo> createMITargetAttach(IMIContainerDMContext ctx, String groupId, boolean interrupt,
+ boolean extraNewline) {
return new MITargetAttach(ctx, groupId, interrupt, extraNewline);
}
@@ -1030,13 +1045,13 @@ public class CommandFactory {
return new MITargetDetach(ctx);
}
- public ICommand<MIInfo> createMITargetSelect(IDMContext ctx, String[] params) {
- return new MITargetSelect(ctx, params);
- }
+ public ICommand<MIInfo> createMITargetSelect(IDMContext ctx, String[] params) {
+ return new MITargetSelect(ctx, params);
+ }
- public ICommand<MIInfo> createMITargetSelect(IDMContext ctx, String host, String port, boolean extended) {
- return new MITargetSelect(ctx, host, port, extended);
- }
+ public ICommand<MIInfo> createMITargetSelect(IDMContext ctx, String host, String port, boolean extended) {
+ return new MITargetSelect(ctx, host, port, extended);
+ }
public ICommand<MIInfo> createMITargetSelect(IDMContext ctx, String serialDevice, boolean extended) {
return new MITargetSelect(ctx, serialDevice, extended);
@@ -1050,18 +1065,18 @@ public class CommandFactory {
return new MITargetSelectTFile(ctx, traceFilePath);
}
- /** @since 4.1 */
- public ICommand<MIInfo> createMITargetDisconnect(ICommandControlDMContext ctx) {
- return new MITargetDisconnect(ctx);
- }
+ /** @since 4.1 */
+ public ICommand<MIInfo> createMITargetDisconnect(ICommandControlDMContext ctx) {
+ return new MITargetDisconnect(ctx);
+ }
- public ICommand<MITargetDownloadInfo> createMITargetDownload(ICommandControlDMContext ctx) {
- return new MITargetDownload(ctx);
- }
+ public ICommand<MITargetDownloadInfo> createMITargetDownload(ICommandControlDMContext ctx) {
+ return new MITargetDownload(ctx);
+ }
- public ICommand<MITargetDownloadInfo> createMITargetDownload(ICommandControlDMContext ctx, String file) {
- return new MITargetDownload(ctx, file);
- }
+ public ICommand<MITargetDownloadInfo> createMITargetDownload(ICommandControlDMContext ctx, String file) {
+ return new MITargetDownload(ctx, file);
+ }
public ICommand<MIThreadInfoInfo> createMIThreadInfo(ICommandControlDMContext dmc) {
return new MIThreadInfo(dmc);
@@ -1094,9 +1109,11 @@ public class CommandFactory {
public ICommand<MITraceFindInfo> createMITraceFind(ITraceTargetDMContext ctx, String[] params) {
return new MITraceFind(ctx, params);
}
+
public ICommand<MITraceFindInfo> createMITraceFindFrameNumber(ITraceTargetDMContext ctx, int frameReference) {
return new MITraceFindFrameNumber(ctx, frameReference);
}
+
public ICommand<MITraceFindInfo> createMITraceFindNone(ITraceTargetDMContext ctx) {
return new MITraceFindNone(ctx);
}
@@ -1133,7 +1150,8 @@ public class CommandFactory {
return new MIVarCreate(dmc, name, expression);
}
- public ICommand<MIVarCreateInfo> createMIVarCreate(IExpressionDMContext dmc, String name, String frameAddr, String expression) {
+ public ICommand<MIVarCreateInfo> createMIVarCreate(IExpressionDMContext dmc, String name, String frameAddr,
+ String expression) {
return new MIVarCreate(dmc, name, frameAddr, expression);
}
@@ -1141,7 +1159,8 @@ public class CommandFactory {
return new MIVarDelete(dmc, name);
}
- public ICommand<MIVarEvaluateExpressionInfo> createMIVarEvaluateExpression(ICommandControlDMContext dmc, String name) {
+ public ICommand<MIVarEvaluateExpressionInfo> createMIVarEvaluateExpression(ICommandControlDMContext dmc,
+ String name) {
return new MIVarEvaluateExpression(dmc, name);
}
@@ -1153,7 +1172,8 @@ public class CommandFactory {
return new MIVarInfoNumChildren(ctx, name);
}
- public ICommand<MIVarInfoPathExpressionInfo> createMIVarInfoPathExpression(ICommandControlDMContext dmc, String name) {
+ public ICommand<MIVarInfoPathExpressionInfo> createMIVarInfoPathExpression(ICommandControlDMContext dmc,
+ String name) {
return new MIVarInfoPathExpression(dmc, name);
}
@@ -1166,7 +1186,8 @@ public class CommandFactory {
}
/** @since 4.0 */
- public ICommand<MIVarListChildrenInfo> createMIVarListChildren(ICommandControlDMContext ctx, String name, int from, int to) {
+ public ICommand<MIVarListChildrenInfo> createMIVarListChildren(ICommandControlDMContext ctx, String name, int from,
+ int to) {
return new MIVarListChildren(ctx, name, from, to);
}
@@ -1175,7 +1196,7 @@ public class CommandFactory {
}
/** @since 4.0 */
- public ICommand<MIInfo> createMIVarSetUpdateRange(ICommandControlDMContext ctx,String name, int from, int to) {
+ public ICommand<MIInfo> createMIVarSetUpdateRange(ICommandControlDMContext ctx, String name, int from, int to) {
return new MIVarSetUpdateRange(ctx, name, from, to);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/IEventProcessor.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/IEventProcessor.java
index c2fc9f1919e..8a720aae9cf 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/IEventProcessor.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/IEventProcessor.java
@@ -19,7 +19,7 @@ import org.eclipse.cdt.dsf.debug.service.command.IEventListener;
/**
* Common interface that represents all MI and CLI event/command processors.
- *
+ *
* @since 4.1
*/
public interface IEventProcessor extends IEventListener, ICommandListener {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/LargePipedInputStream.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/LargePipedInputStream.java
index 7f12f574302..70e6bd6fc55 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/LargePipedInputStream.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/LargePipedInputStream.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* Marc Khouzam (Ericsson) - Specify the larger size in the new constructor
@@ -19,15 +19,12 @@ import java.io.IOException;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
-
class LargePipedInputStream extends PipedInputStream {
-
+
private static final int LARGE_BUF_SIZE = 1024 * 1024; // 1M
-
- public LargePipedInputStream(PipedOutputStream pipedoutputstream)
- throws IOException
- {
+
+ public LargePipedInputStream(PipedOutputStream pipedoutputstream) throws IOException {
super(pipedoutputstream, LARGE_BUF_SIZE);
- }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIAsyncErrorProcessor.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIAsyncErrorProcessor.java
index e2f22d9a087..83023202e0f 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIAsyncErrorProcessor.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIAsyncErrorProcessor.java
@@ -31,23 +31,23 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIResultRecord;
import org.eclipse.cdt.dsf.service.DsfSession;
/**
- * In some cases GDB reports 'exec-*' commands failure after the '^running' event is fired.
- * For instance, if an invalid breakpoint is set no error is reported but the consequent
+ * In some cases GDB reports 'exec-*' commands failure after the '^running' event is fired.
+ * For instance, if an invalid breakpoint is set no error is reported but the consequent
* 'exec-continue' command fails.
- *
+ *
* 36-exec-continue --thread 1
* 36^running
* *running,thread-id="all"
- * (gdb)
+ * (gdb)
* &"Warning:\n"
* &"Cannot insert breakpoint 2.\n"
* &"Cannot access memory at address 0x0\n"
* &"\n"
* 36^error,msg="Command aborted."
* (gdb)
- *
+ *
* This class handles these type of situations by firing MIErrorEvent when such an error appears.
- *
+ *
* @since 5.3
*/
public class MIAsyncErrorProcessor implements IEventProcessor {
@@ -65,11 +65,11 @@ public class MIAsyncErrorProcessor implements IEventProcessor {
@Override
public void eventReceived(Object output) {
- MIResultRecord rr = ((MIOutput)output).getMIResultRecord();
- // Handling the asynchronous error case, i.e. when the "<token>^running" event
+ MIResultRecord rr = ((MIOutput) output).getMIResultRecord();
+ // Handling the asynchronous error case, i.e. when the "<token>^running" event
// appears before "<token>^error, msg=<error_message>" for run control commands.
if (rr != null && MIResultRecord.ERROR.equals(rr.getResultClass())) {
- handleAsyncError((MIOutput)output);
+ handleAsyncError((MIOutput) output);
}
}
@@ -88,12 +88,12 @@ public class MIAsyncErrorProcessor implements IEventProcessor {
@SuppressWarnings("unchecked")
@Override
public void commandDone(ICommandToken token, ICommandResult result) {
- if (token.getCommand() instanceof MICommand<?> && result instanceof MIInfo && ((MIInfo)result).isRunning()) {
- IDMContext ctx = ((MICommand<MIInfo>)token.getCommand()).getContext();
+ if (token.getCommand() instanceof MICommand<?> && result instanceof MIInfo && ((MIInfo) result).isRunning()) {
+ IDMContext ctx = ((MICommand<MIInfo>) token.getCommand()).getContext();
if (ctx instanceof IExecutionDMContext) {
- MIResultRecord rr = ((MIInfo)result).getMIOutput().getMIResultRecord();
+ MIResultRecord rr = ((MIInfo) result).getMIOutput().getMIResultRecord();
if (rr != null) {
- fRunCommands.put((IExecutionDMContext)ctx, Integer.valueOf(rr.getToken()));
+ fRunCommands.put((IExecutionDMContext) ctx, Integer.valueOf(rr.getToken()));
}
}
}
@@ -109,7 +109,7 @@ public class MIAsyncErrorProcessor implements IEventProcessor {
protected ICommandControlService getCommandControl() {
return fCommandControl;
}
-
+
protected void handleAsyncError(MIOutput output) {
int token = output.getMIResultRecord().getToken();
for (Entry<IExecutionDMContext, Integer> entry : fRunCommands.entrySet()) {
@@ -118,10 +118,12 @@ public class MIAsyncErrorProcessor implements IEventProcessor {
}
}
}
-
+
protected void fireStoppedEvent(final MIOutput output, final IExecutionDMContext ctx) {
DsfSession session = DsfSession.getSession(ctx.getSessionId());
int token = output.getMIResultRecord().getToken();
- session.dispatchEvent(MIErrorEvent.parse(ctx, token, output.getMIResultRecord().getMIResults(), output.getMIOOBRecords()), null);
+ session.dispatchEvent(
+ MIErrorEvent.parse(ctx, token, output.getMIResultRecord().getMIResults(), output.getMIOOBRecords()),
+ null);
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIBackendCLIProcess.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIBackendCLIProcess.java
index 8295aeb8389..c9ed9f08796 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIBackendCLIProcess.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIBackendCLIProcess.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -45,138 +45,140 @@ import org.eclipse.core.runtime.Status;
* this process is no longer used. Instead, the real GDB process,
* along with its console will be used directly. A second PTY
* will be used to communicate using MI.
- *
+ *
* @since 1.1
*/
public class MIBackendCLIProcess extends AbstractCLIProcess {
private IMIBackend fMIBackend;
- private AtomicInteger fExitCode = new AtomicInteger(-1);
+ private AtomicInteger fExitCode = new AtomicInteger(-1);
private BackedExitedEventListener fExitedEventListener;
-
- @ConfinedToDsfExecutor("getSession()#getExecutor")
+
+ @ConfinedToDsfExecutor("getSession()#getExecutor")
public MIBackendCLIProcess(ICommandControlService commandControl, IMIBackend backend) throws IOException {
super(commandControl);
fMIBackend = backend;
if (fMIBackend.getState() == IMIBackend.State.TERMINATED) {
- fExitCode.set(fMIBackend.getExitCode());
+ fExitCode.set(fMIBackend.getExitCode());
}
fExitedEventListener = new BackedExitedEventListener();
- getSession().addServiceEventListener(fExitedEventListener, null);
+ getSession().addServiceEventListener(fExitedEventListener, null);
+ }
+
+ public class BackedExitedEventListener {
+ private final List<RequestMonitor> fWaitForRMs = new ArrayList<RequestMonitor>();
+
+ @DsfServiceEventHandler
+ public void eventDispatched(BackendStateChangedEvent event) {
+ if (event.getState() == IMIBackend.State.TERMINATED && event.getBackendId().equals(fMIBackend.getId())) {
+ fExitCode.set(fMIBackend.getExitCode());
+ for (RequestMonitor rm : fWaitForRMs) {
+ rm.done();
+ }
+ fWaitForRMs.clear();
+ }
+ }
+
+ void dispose() {
+ for (RequestMonitor rm : fWaitForRMs) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.REQUEST_FAILED,
+ "Backend terminate event never received", null)); //$NON-NLS-1$
+ rm.done();
+ }
+ fWaitForRMs.clear();
+ }
+ }
+
+ /**
+ * @see java.lang.Process#waitFor()
+ */
+ @Override
+ public int waitFor() throws InterruptedException {
+ if (!DsfSession.isSessionActive(getSession().getId())) {
+ return fExitCode.get();
+ }
+
+ try {
+ Query<Object> query = new Query<Object>() {
+ @Override
+ protected void execute(final DataRequestMonitor<Object> rm) {
+ if (!DsfSession.isSessionActive(getSession().getId()) || isDisposed()
+ || fMIBackend.getState() == IMIBackend.State.TERMINATED) {
+ rm.setData(new Object());
+ rm.done();
+ } else {
+ fExitedEventListener.fWaitForRMs.add(new ImmediateRequestMonitor(rm) {
+ @Override
+ protected void handleSuccess() {
+ rm.setData(new Object());
+ rm.done();
+ }
+ });
+ }
+ }
+ };
+ getSession().getExecutor().execute(query);
+ query.get();
+ } catch (RejectedExecutionException e) {
+ } catch (ExecutionException e) {
+ }
+ return fExitCode.get();
}
- public class BackedExitedEventListener {
- private final List<RequestMonitor> fWaitForRMs = new ArrayList<RequestMonitor>();
-
- @DsfServiceEventHandler
- public void eventDispatched(BackendStateChangedEvent event) {
- if (event.getState() == IMIBackend.State.TERMINATED &&
- event.getBackendId().equals(fMIBackend.getId()))
- {
- fExitCode.set(fMIBackend.getExitCode());
- for (RequestMonitor rm : fWaitForRMs) {
- rm.done();
- }
- fWaitForRMs.clear();
- }
- }
-
- void dispose() {
- for (RequestMonitor rm : fWaitForRMs) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.REQUEST_FAILED, "Backend terminate event never received", null)); //$NON-NLS-1$
- rm.done();
- }
- fWaitForRMs.clear();
- }
- }
-
- /**
- * @see java.lang.Process#waitFor()
- */
- @Override
- public int waitFor() throws InterruptedException {
- if (!DsfSession.isSessionActive(getSession().getId())) {
- return fExitCode.get();
- }
+ /**
+ * @see java.lang.Process#exitValue()
+ */
+ @Override
+ public int exitValue() {
+ if (!DsfSession.isSessionActive(getSession().getId())) {
+ return fExitCode.get();
+ }
+ try {
+ getSession().getExecutor().submit(new Callable<Object>() {
+ @Override
+ public Object call() throws Exception {
+ if (fMIBackend.getState() != IMIBackend.State.TERMINATED) {
+ throw new IllegalThreadStateException("Backend Process has not exited"); //$NON-NLS-1$
+ }
+ return null;
+ }
+ }).get();
+ } catch (RejectedExecutionException e) {
+ } catch (InterruptedException e) {
+ } catch (ExecutionException e) {
+ if (e.getCause() instanceof RuntimeException) {
+ throw (RuntimeException) e.getCause();
+ }
+ }
+ return fExitCode.get();
+ }
- try {
- Query<Object> query = new Query<Object>() {
- @Override
- protected void execute(final DataRequestMonitor<Object> rm) {
- if ( !DsfSession.isSessionActive(getSession().getId()) ||
- isDisposed() ||
- fMIBackend.getState() == IMIBackend.State.TERMINATED )
- {
- rm.setData(new Object());
- rm.done();
- } else {
- fExitedEventListener.fWaitForRMs.add(
- new ImmediateRequestMonitor(rm) {
- @Override
- protected void handleSuccess() {
- rm.setData(new Object());
- rm.done();
- }
- });
- }
- }
- };
- getSession().getExecutor().execute(query);
- query.get();
- } catch (RejectedExecutionException e) {
- } catch (ExecutionException e) {
- }
- return fExitCode.get();
- }
+ /**
+ * @see java.lang.Process#destroy()
+ */
+ @Override
+ public void destroy() {
+ try {
+ getSession().getExecutor().execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ if (!DsfSession.isSessionActive(getSession().getId()))
+ return;
+ if (isDisposed())
+ return;
-
- /**
- * @see java.lang.Process#exitValue()
- */
- @Override
- public int exitValue() {
- if (!DsfSession.isSessionActive(getSession().getId())) {
- return fExitCode.get();
- }
- try {
- getSession().getExecutor().submit(new Callable<Object>() {
- @Override
- public Object call() throws Exception {
- if (fMIBackend.getState() != IMIBackend.State.TERMINATED) {
- throw new IllegalThreadStateException("Backend Process has not exited"); //$NON-NLS-1$
- }
- return null;
- }}).get();
- } catch (RejectedExecutionException e) {
- } catch (InterruptedException e) {
- } catch (ExecutionException e) {
- if (e.getCause() instanceof RuntimeException) {
- throw (RuntimeException)e.getCause();
- }
- }
- return fExitCode.get();
- }
- /**
- * @see java.lang.Process#destroy()
- */
- @Override
- public void destroy() {
- try {
- getSession().getExecutor().execute(new DsfRunnable() { @Override public void run() {
- if (!DsfSession.isSessionActive(getSession().getId())) return;
- if (isDisposed()) return;
+ fMIBackend.destroy();
+ }
+ });
+ } catch (RejectedExecutionException e) {
+ // Session disposed.
+ }
+ }
- fMIBackend.destroy();
- }});
- } catch (RejectedExecutionException e) {
- // Session disposed.
- }
- }
-
- @Override
- public void dispose() {
- fExitedEventListener.dispose();
- getSession().removeServiceEventListener(fExitedEventListener);
- super.dispose();
- }
+ @Override
+ public void dispose() {
+ fExitedEventListener.dispose();
+ getSession().removeServiceEventListener(fExitedEventListener);
+ super.dispose();
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIControlDMContext.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIControlDMContext.java
index 64bd180dfc0..97415e63742 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIControlDMContext.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIControlDMContext.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -23,56 +23,53 @@ import org.eclipse.cdt.dsf.service.IDsfService;
import org.osgi.framework.Constants;
/**
- *
+ *
*/
-public class MIControlDMContext extends AbstractDMContext
- implements ICommandControlDMContext
-{
- final static String PROP_INSTANCE_ID = GdbPlugin.PLUGIN_ID + ".miControlInstanceId"; //$NON-NLS-1$
+public class MIControlDMContext extends AbstractDMContext implements ICommandControlDMContext {
+ final static String PROP_INSTANCE_ID = GdbPlugin.PLUGIN_ID + ".miControlInstanceId"; //$NON-NLS-1$
+
+ private final String fCommandControlFilter;
+ private final String fCommandControlId;
+
+ public MIControlDMContext(String sessionId, String commandControlId) {
+ this(sessionId, DMContexts.EMPTY_CONTEXTS_ARRAY, commandControlId);
+ }
- private final String fCommandControlFilter;
- private final String fCommandControlId;
-
- public MIControlDMContext(String sessionId, String commandControlId) {
- this(sessionId, DMContexts.EMPTY_CONTEXTS_ARRAY, commandControlId);
- }
+ public MIControlDMContext(String sessionId, IDMContext[] parents, String commandControlId) {
+ super(sessionId, parents);
- public MIControlDMContext(String sessionId, IDMContext[] parents, String commandControlId) {
- super(sessionId, parents);
+ fCommandControlId = commandControlId;
+ fCommandControlFilter = "(&" + //$NON-NLS-1$
+ "(" + Constants.OBJECTCLASS + "=" + ICommandControl.class.getName() + ")" + //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
+ "(" + IDsfService.PROP_SESSION_ID + "=" + sessionId + ")" + //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
+ "(" + PROP_INSTANCE_ID + "=" + commandControlId + ")" + //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
+ ")"; //$NON-NLS-1$
+ }
- fCommandControlId = commandControlId;
- fCommandControlFilter =
- "(&" + //$NON-NLS-1$
- "(" + Constants.OBJECTCLASS + "=" + ICommandControl.class.getName() + ")" + //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
- "(" + IDsfService.PROP_SESSION_ID + "=" + sessionId + ")" + //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
- "(" + PROP_INSTANCE_ID + "=" + commandControlId + ")" + //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
- ")"; //$NON-NLS-1$
- }
+ public String getCommandControlFilter() {
+ return fCommandControlFilter;
+ }
- public String getCommandControlFilter() {
- return fCommandControlFilter;
- }
+ /**
+ * @since 1.1
+ */
+ @Override
+ public String getCommandControlId() {
+ return fCommandControlId;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return baseEquals(obj) && fCommandControlId.equals(((MIControlDMContext) obj).fCommandControlId);
+ }
- /**
- * @since 1.1
- */
@Override
- public String getCommandControlId() {
- return fCommandControlId;
- }
-
- @Override
- public boolean equals(Object obj) {
- return baseEquals(obj) && fCommandControlId.equals(((MIControlDMContext)obj).fCommandControlId);
- }
+ public int hashCode() {
+ return baseHashCode() + fCommandControlId.hashCode();
+ }
- @Override
- public int hashCode() {
- return baseHashCode() + fCommandControlId.hashCode();
- }
-
- @Override
- public String toString() {
- return baseToString() + fCommandControlId;
- }
+ @Override
+ public String toString() {
+ return baseToString() + fCommandControlId;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIInferiorProcess.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIInferiorProcess.java
index 79b47618b78..ff10903d7b8 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIInferiorProcess.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIInferiorProcess.java
@@ -65,478 +65,492 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
/**
- * This Process implementation tracks one of the inferiors that is being debugged
+ * This Process implementation tracks one of the inferiors that is being debugged
* by GDB. The process object, although not displayed in the Debug view, is used to
* channel the STDIO of the inferior process to the console view.
- *
- * @see org.eclipse.debug.core.model.IProcess
+ *
+ * @see org.eclipse.debug.core.model.IProcess
*/
-public class MIInferiorProcess extends Process
- implements IEventListener, ICommandListener
-{
-
+public class MIInferiorProcess extends Process implements IEventListener, ICommandListener {
+
// Indicates that the inferior has been started
// It implies the ContainerDMContext is fully-formed
// with the pid of the process (as a parent dmc)
private boolean fStarted;
-
+
// Indicates that the inferior has been terminated
- private boolean fTerminated;
-
- private OutputStream fOutputStream;
- private InputStream fInputStream;
-
- private PipedOutputStream fInputStreamPiped;
-
- private PipedInputStream fErrorStream;
- private PipedOutputStream fErrorStreamPiped;
-
- private final DsfSession fSession;
-
- private final IMICommandControl fCommandControl;
- private CommandFactory fCommandFactory;
-
- private IContainerDMContext fContainerDMContext;
-
- @ConfinedToDsfExecutor("fSession#getExecutor")
- private boolean fDisposed = false;
-
- /**
- * Counter for tracking console commands sent by services.
- *
- * The CLI 'monitor' command produces target output which should
- * not be written to the target console, since it is in response to a CLI
- * command. In fact, CLI commands should never have their output sent
- * to the target console.
- *
- * This counter is incremented any time a CLI command is seen. It is
- * decremented whenever a CLI command is finished. When counter
- * value is 0, the inferior process writes the target output.
- */
- private int fSuppressTargetOutputCounter = 0;
-
- @ThreadSafe
- Integer fExitCode = null;
-
- /**
- * @returns whether the inferior has been started, which means
- * we can obtain its process id.
+ private boolean fTerminated;
+
+ private OutputStream fOutputStream;
+ private InputStream fInputStream;
+
+ private PipedOutputStream fInputStreamPiped;
+
+ private PipedInputStream fErrorStream;
+ private PipedOutputStream fErrorStreamPiped;
+
+ private final DsfSession fSession;
+
+ private final IMICommandControl fCommandControl;
+ private CommandFactory fCommandFactory;
+
+ private IContainerDMContext fContainerDMContext;
+
+ @ConfinedToDsfExecutor("fSession#getExecutor")
+ private boolean fDisposed = false;
+
+ /**
+ * Counter for tracking console commands sent by services.
+ *
+ * The CLI 'monitor' command produces target output which should
+ * not be written to the target console, since it is in response to a CLI
+ * command. In fact, CLI commands should never have their output sent
+ * to the target console.
+ *
+ * This counter is incremented any time a CLI command is seen. It is
+ * decremented whenever a CLI command is finished. When counter
+ * value is 0, the inferior process writes the target output.
+ */
+ private int fSuppressTargetOutputCounter = 0;
+
+ @ThreadSafe
+ Integer fExitCode = null;
+
+ /**
+ * @returns whether the inferior has been started, which means
+ * we can obtain its process id.
* @since 4.7
*/
- protected boolean isStarted() {
+ protected boolean isStarted() {
return fStarted;
}
-
- /** @since 4.7 */
- protected IContainerDMContext getContainer() {
+
+ /** @since 4.7 */
+ protected IContainerDMContext getContainer() {
return fContainerDMContext;
}
-
- /** @since 4.7 */
- protected synchronized boolean isTerminated() {
+
+ /** @since 4.7 */
+ protected synchronized boolean isTerminated() {
return fTerminated;
}
-
- /**
- * Creates an inferior process object which uses the given output stream
- * to write the user standard input into.
- *
- * @param container The process that this inferior represents
- * @param gdbOutputStream The output stream to use to write user IO into.
- * @since 4.0
- */
- @ConfinedToDsfExecutor("fSession#getExecutor")
- public MIInferiorProcess(IContainerDMContext container, OutputStream gdbOutputStream) {
- this(container, gdbOutputStream, null);
- }
-
- /**
- * Creates an inferior process object which uses the given terminal
- * to write the user standard input into.
- *
- * @param container The process that this inferior represents
- * @param p The terminal to use to write user IO into.
- * @since 4.0
- */
- @ConfinedToDsfExecutor("fSession#getExecutor")
- public MIInferiorProcess(IContainerDMContext container, PTY p) {
- this(container, null, p);
- }
-
- /** @since 4.7 */
- @ConfinedToDsfExecutor("fSession#getExecutor")
- protected MIInferiorProcess(IContainerDMContext container, final OutputStream gdbOutputStream, PTY pty) {
- fSession = DsfSession.getSession(container.getSessionId());
- fSession.addServiceEventListener(this, null);
-
- fContainerDMContext = container;
- IMIProcessDMContext processDmc = DMContexts.getAncestorOfType(fContainerDMContext, IMIProcessDMContext.class);
- if (processDmc != null && processDmc.getProcId() != MIProcesses.UNKNOWN_PROCESS_ID) {
- // If we already know the pid, it implies the process is already started.
- // It also means we won't get the IStartedDMEvent for the process.
- // This happens when the inferior is restarted, in which case, this class
- // is created after the process is running and the IStartedDMEvent was sent.
- fStarted = true;
- }
-
- DsfServicesTracker tracker = new DsfServicesTracker(GdbPlugin.getBundleContext(), fSession.getId());
- fCommandControl = tracker.getService(IMICommandControl.class);
- tracker.dispose();
-
- fCommandFactory = fCommandControl.getCommandFactory();
-
- fCommandControl.addEventListener(this);
- fCommandControl.addCommandListener(this);
-
- if (pty != null) {
- fOutputStream = pty.getOutputStream();
- fInputStream = pty.getInputStream();
- fInputStreamPiped = null;
- } else {
- fOutputStream = new OutputStream() {
- @Override
- public void write(int b) throws IOException {
- gdbOutputStream.write(b);
- }
- };
-
- fInputStreamPiped = new PipedOutputStream();
- PipedInputStream inputStream = null;
- try {
- // Using a LargePipedInputStream see https://bugs.eclipse.org/bugs/show_bug.cgi?id=223154
- inputStream = new LargePipedInputStream(fInputStreamPiped);
- } catch (IOException e) {
- }
- fInputStream = inputStream;
-
- }
-
- // Note: We do not have any err stream from gdb/mi so this gdb
- // err channel instead.
- fErrorStreamPiped = new PipedOutputStream();
- PipedInputStream errorStream = null;
- try {
- // Using a LargePipedInputStream see https://bugs.eclipse.org/bugs/show_bug.cgi?id=223154
- errorStream = new LargePipedInputStream(fErrorStreamPiped);
- } catch (IOException e) {
- }
- fErrorStream = errorStream;
- }
-
- @ConfinedToDsfExecutor("fSession#getExecutor")
- public void dispose() {
- fSession.removeServiceEventListener(this);
-
- fCommandControl.removeEventListener(this);
- fCommandControl.removeCommandListener(this);
-
- closeIO();
-
- setTerminated();
-
- fDisposed = true;
- }
-
- @ConfinedToDsfExecutor("fSession#getExecutor")
- protected boolean isDisposed() { return fDisposed; }
-
- @Override
- public OutputStream getOutputStream() {
- return fOutputStream;
- }
-
- @Override
- public InputStream getInputStream() {
- return fInputStream;
- }
-
- @Override
- public InputStream getErrorStream() {
- return fErrorStream;
- }
-
- @ThreadSafeAndProhibitedFromDsfExecutor("fSession#getExecutor")
- public synchronized void waitForSync() throws InterruptedException {
- assert !fSession.getExecutor().isInExecutorThread();
-
- while (!fTerminated) {
- wait(100);
- }
- }
-
- /**
- * @see java.lang.Process#waitFor()
- */
- @ThreadSafeAndProhibitedFromDsfExecutor("fSession#getExecutor")
- @Override
- public int waitFor() throws InterruptedException {
- assert !fSession.getExecutor().isInExecutorThread();
-
- waitForSync();
- return exitValue();
- }
-
- @ThreadSafeAndProhibitedFromDsfExecutor("fSession#getExecutor")
- @Override
- public int exitValue() {
- assert !fSession.getExecutor().isInExecutorThread();
-
- synchronized (this) {
- if (fExitCode != null) {
- return fExitCode;
- }
- }
-
- // Fetch the exit code using $_exitcode of GDB when doing single
- // process debugging (GDB <= 7.1)
- // Note that for GDB 7.2, there is no proper solution for the exit code
- // because although we support multi-process, $_exitcode was still the
- // only way to get the exit code, and that variable does not work properly
- // with multi-process (it is re-used by the different processes).
- // We use it still for GDB 7.2, since the single-process case is the most common.
- try {
- Query<Integer> exitCodeQuery = new Query<Integer>() {
- @Override
- protected void execute(final DataRequestMonitor<Integer> rm) {
- // Guard against session disposed.
- if (!DsfSession.isSessionActive(fSession.getId())) {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE, "Debug session already shut down.", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- if (isDisposed()) {
- rm.setData(0);
- rm.done();
- } else if (!fTerminated) {
- // This will cause ExecutionException to be thrown with a CoreException,
- // which will in turn contain the IllegalThreadStateException.
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE, "Inferior is still running.", new IllegalThreadStateException())); //$NON-NLS-1$
- rm.done();
- } else {
- // The exitCode from GDB does not seem to be handled for multi-process
- // so there is no point is specifying the container
- fCommandControl.queueCommand(
- fCommandFactory.createMIGDBShowExitCode(fCommandControl.getContext()),
- new DataRequestMonitor<MIGDBShowExitCodeInfo>(fSession.getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- rm.setData(getData().getCode());
- rm.done();
- }
- });
-
- }
- }
- };
- fSession.getExecutor().execute(exitCodeQuery);
-
- int exitCode = exitCodeQuery.get();
- synchronized(this) {
- fExitCode = exitCode;
- }
- return exitCode;
- } catch (RejectedExecutionException e) {
- } catch (InterruptedException e) {
- } catch (CancellationException e) {
- } catch (ExecutionException e) {
- if (e.getCause() instanceof CoreException &&
- ((CoreException)e.getCause()).getStatus().getException() instanceof RuntimeException )
- {
- throw (RuntimeException)((CoreException)e.getCause()).getStatus().getException();
- }
- }
- return 0;
- }
-
- /**
- * @see java.lang.Process#destroy()
- */
- @Override
- public void destroy() {
- try {
- fSession.getExecutor().execute(new DsfRunnable() {
- @Override
- public void run() {
- doDestroy();
- }
- });
- } catch (RejectedExecutionException e) {
- // Session disposed.
- }
- closeIO();
- }
-
- private void closeIO() {
- try {
- if (fOutputStream != null) fOutputStream.close();
- // Make sure things get GCed
- fOutputStream = null;
- } catch (IOException e) {}
- try {
- if (fInputStream != null) fInputStream.close();
- // Make sure things get GCed
- fInputStream = null;
- } catch (IOException e) {}
- try {
- if (fInputStreamPiped != null) fInputStreamPiped.close();
- // Make sure things get GCed
- fInputStreamPiped = null;
- } catch (IOException e) {}
- try {
- if (fErrorStream != null) fErrorStream.close();
- // Make sure things get GCed
- fErrorStream = null;
- } catch (IOException e) {}
- try {
- if (fErrorStreamPiped != null) fErrorStreamPiped.close();
- // Make sure things get GCed
- fErrorStreamPiped = null;
- } catch (IOException e) {}
- }
-
- @ConfinedToDsfExecutor("fSession#getExecutor")
- private void doDestroy() {
- if (isDisposed() || !fSession.isActive() || fTerminated) return;
-
- DsfServicesTracker tracker = new DsfServicesTracker(GdbPlugin.getBundleContext(), fSession.getId());
- IProcesses procService = tracker.getService(IProcesses.class);
- tracker.dispose();
- if (procService != null) {
- IProcessDMContext procDmc = DMContexts.getAncestorOfType(fContainerDMContext, IProcessDMContext.class);
- procService.terminate(procDmc, new ImmediateRequestMonitor());
- } else {
- setTerminated();
- }
- }
-
- @ConfinedToDsfExecutor("fSession#getExecutor")
- private synchronized void setTerminated() {
- if (fTerminated) return;
- fTerminated = true;
- closeIO();
- notifyAll();
- }
-
- public OutputStream getPipedOutputStream() {
- return fInputStreamPiped;
- }
-
- public OutputStream getPipedErrorStream() {
- return fErrorStreamPiped;
- }
-
+
+ /**
+ * Creates an inferior process object which uses the given output stream
+ * to write the user standard input into.
+ *
+ * @param container The process that this inferior represents
+ * @param gdbOutputStream The output stream to use to write user IO into.
+ * @since 4.0
+ */
+ @ConfinedToDsfExecutor("fSession#getExecutor")
+ public MIInferiorProcess(IContainerDMContext container, OutputStream gdbOutputStream) {
+ this(container, gdbOutputStream, null);
+ }
+
+ /**
+ * Creates an inferior process object which uses the given terminal
+ * to write the user standard input into.
+ *
+ * @param container The process that this inferior represents
+ * @param p The terminal to use to write user IO into.
+ * @since 4.0
+ */
+ @ConfinedToDsfExecutor("fSession#getExecutor")
+ public MIInferiorProcess(IContainerDMContext container, PTY p) {
+ this(container, null, p);
+ }
+
+ /** @since 4.7 */
+ @ConfinedToDsfExecutor("fSession#getExecutor")
+ protected MIInferiorProcess(IContainerDMContext container, final OutputStream gdbOutputStream, PTY pty) {
+ fSession = DsfSession.getSession(container.getSessionId());
+ fSession.addServiceEventListener(this, null);
+
+ fContainerDMContext = container;
+ IMIProcessDMContext processDmc = DMContexts.getAncestorOfType(fContainerDMContext, IMIProcessDMContext.class);
+ if (processDmc != null && processDmc.getProcId() != MIProcesses.UNKNOWN_PROCESS_ID) {
+ // If we already know the pid, it implies the process is already started.
+ // It also means we won't get the IStartedDMEvent for the process.
+ // This happens when the inferior is restarted, in which case, this class
+ // is created after the process is running and the IStartedDMEvent was sent.
+ fStarted = true;
+ }
+
+ DsfServicesTracker tracker = new DsfServicesTracker(GdbPlugin.getBundleContext(), fSession.getId());
+ fCommandControl = tracker.getService(IMICommandControl.class);
+ tracker.dispose();
+
+ fCommandFactory = fCommandControl.getCommandFactory();
+
+ fCommandControl.addEventListener(this);
+ fCommandControl.addCommandListener(this);
+
+ if (pty != null) {
+ fOutputStream = pty.getOutputStream();
+ fInputStream = pty.getInputStream();
+ fInputStreamPiped = null;
+ } else {
+ fOutputStream = new OutputStream() {
+ @Override
+ public void write(int b) throws IOException {
+ gdbOutputStream.write(b);
+ }
+ };
+
+ fInputStreamPiped = new PipedOutputStream();
+ PipedInputStream inputStream = null;
+ try {
+ // Using a LargePipedInputStream see https://bugs.eclipse.org/bugs/show_bug.cgi?id=223154
+ inputStream = new LargePipedInputStream(fInputStreamPiped);
+ } catch (IOException e) {
+ }
+ fInputStream = inputStream;
+
+ }
+
+ // Note: We do not have any err stream from gdb/mi so this gdb
+ // err channel instead.
+ fErrorStreamPiped = new PipedOutputStream();
+ PipedInputStream errorStream = null;
+ try {
+ // Using a LargePipedInputStream see https://bugs.eclipse.org/bugs/show_bug.cgi?id=223154
+ errorStream = new LargePipedInputStream(fErrorStreamPiped);
+ } catch (IOException e) {
+ }
+ fErrorStream = errorStream;
+ }
+
+ @ConfinedToDsfExecutor("fSession#getExecutor")
+ public void dispose() {
+ fSession.removeServiceEventListener(this);
+
+ fCommandControl.removeEventListener(this);
+ fCommandControl.removeCommandListener(this);
+
+ closeIO();
+
+ setTerminated();
+
+ fDisposed = true;
+ }
+
+ @ConfinedToDsfExecutor("fSession#getExecutor")
+ protected boolean isDisposed() {
+ return fDisposed;
+ }
+
+ @Override
+ public OutputStream getOutputStream() {
+ return fOutputStream;
+ }
+
+ @Override
+ public InputStream getInputStream() {
+ return fInputStream;
+ }
+
+ @Override
+ public InputStream getErrorStream() {
+ return fErrorStream;
+ }
+
+ @ThreadSafeAndProhibitedFromDsfExecutor("fSession#getExecutor")
+ public synchronized void waitForSync() throws InterruptedException {
+ assert !fSession.getExecutor().isInExecutorThread();
+
+ while (!fTerminated) {
+ wait(100);
+ }
+ }
+
+ /**
+ * @see java.lang.Process#waitFor()
+ */
+ @ThreadSafeAndProhibitedFromDsfExecutor("fSession#getExecutor")
+ @Override
+ public int waitFor() throws InterruptedException {
+ assert !fSession.getExecutor().isInExecutorThread();
+
+ waitForSync();
+ return exitValue();
+ }
+
+ @ThreadSafeAndProhibitedFromDsfExecutor("fSession#getExecutor")
+ @Override
+ public int exitValue() {
+ assert !fSession.getExecutor().isInExecutorThread();
+
+ synchronized (this) {
+ if (fExitCode != null) {
+ return fExitCode;
+ }
+ }
+
+ // Fetch the exit code using $_exitcode of GDB when doing single
+ // process debugging (GDB <= 7.1)
+ // Note that for GDB 7.2, there is no proper solution for the exit code
+ // because although we support multi-process, $_exitcode was still the
+ // only way to get the exit code, and that variable does not work properly
+ // with multi-process (it is re-used by the different processes).
+ // We use it still for GDB 7.2, since the single-process case is the most common.
+ try {
+ Query<Integer> exitCodeQuery = new Query<Integer>() {
+ @Override
+ protected void execute(final DataRequestMonitor<Integer> rm) {
+ // Guard against session disposed.
+ if (!DsfSession.isSessionActive(fSession.getId())) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE,
+ "Debug session already shut down.", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ if (isDisposed()) {
+ rm.setData(0);
+ rm.done();
+ } else if (!fTerminated) {
+ // This will cause ExecutionException to be thrown with a CoreException,
+ // which will in turn contain the IllegalThreadStateException.
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE,
+ "Inferior is still running.", new IllegalThreadStateException())); //$NON-NLS-1$
+ rm.done();
+ } else {
+ // The exitCode from GDB does not seem to be handled for multi-process
+ // so there is no point is specifying the container
+ fCommandControl.queueCommand(
+ fCommandFactory.createMIGDBShowExitCode(fCommandControl.getContext()),
+ new DataRequestMonitor<MIGDBShowExitCodeInfo>(fSession.getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ rm.setData(getData().getCode());
+ rm.done();
+ }
+ });
+
+ }
+ }
+ };
+ fSession.getExecutor().execute(exitCodeQuery);
+
+ int exitCode = exitCodeQuery.get();
+ synchronized (this) {
+ fExitCode = exitCode;
+ }
+ return exitCode;
+ } catch (RejectedExecutionException e) {
+ } catch (InterruptedException e) {
+ } catch (CancellationException e) {
+ } catch (ExecutionException e) {
+ if (e.getCause() instanceof CoreException
+ && ((CoreException) e.getCause()).getStatus().getException() instanceof RuntimeException) {
+ throw (RuntimeException) ((CoreException) e.getCause()).getStatus().getException();
+ }
+ }
+ return 0;
+ }
+
+ /**
+ * @see java.lang.Process#destroy()
+ */
+ @Override
+ public void destroy() {
+ try {
+ fSession.getExecutor().execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ doDestroy();
+ }
+ });
+ } catch (RejectedExecutionException e) {
+ // Session disposed.
+ }
+ closeIO();
+ }
+
+ private void closeIO() {
+ try {
+ if (fOutputStream != null)
+ fOutputStream.close();
+ // Make sure things get GCed
+ fOutputStream = null;
+ } catch (IOException e) {
+ }
+ try {
+ if (fInputStream != null)
+ fInputStream.close();
+ // Make sure things get GCed
+ fInputStream = null;
+ } catch (IOException e) {
+ }
+ try {
+ if (fInputStreamPiped != null)
+ fInputStreamPiped.close();
+ // Make sure things get GCed
+ fInputStreamPiped = null;
+ } catch (IOException e) {
+ }
+ try {
+ if (fErrorStream != null)
+ fErrorStream.close();
+ // Make sure things get GCed
+ fErrorStream = null;
+ } catch (IOException e) {
+ }
+ try {
+ if (fErrorStreamPiped != null)
+ fErrorStreamPiped.close();
+ // Make sure things get GCed
+ fErrorStreamPiped = null;
+ } catch (IOException e) {
+ }
+ }
+
+ @ConfinedToDsfExecutor("fSession#getExecutor")
+ private void doDestroy() {
+ if (isDisposed() || !fSession.isActive() || fTerminated)
+ return;
+
+ DsfServicesTracker tracker = new DsfServicesTracker(GdbPlugin.getBundleContext(), fSession.getId());
+ IProcesses procService = tracker.getService(IProcesses.class);
+ tracker.dispose();
+ if (procService != null) {
+ IProcessDMContext procDmc = DMContexts.getAncestorOfType(fContainerDMContext, IProcessDMContext.class);
+ procService.terminate(procDmc, new ImmediateRequestMonitor());
+ } else {
+ setTerminated();
+ }
+ }
+
+ @ConfinedToDsfExecutor("fSession#getExecutor")
+ private synchronized void setTerminated() {
+ if (fTerminated)
+ return;
+ fTerminated = true;
+ closeIO();
+ notifyAll();
+ }
+
+ public OutputStream getPipedOutputStream() {
+ return fInputStreamPiped;
+ }
+
+ public OutputStream getPipedErrorStream() {
+ return fErrorStreamPiped;
+ }
+
@Override
- public void eventReceived(Object output) {
- for (MIOOBRecord oobr : ((MIOutput)output).getMIOOBRecords()) {
- if (oobr instanceof MITargetStreamOutput) {
- if (fSuppressTargetOutputCounter > 0) return;
- MITargetStreamOutput tgtOut = (MITargetStreamOutput)oobr;
- if (fInputStreamPiped != null && tgtOut.getString() != null) {
- try {
- fInputStreamPiped.write(tgtOut.getString().getBytes());
- fInputStreamPiped.flush();
- } catch (IOException e) {
- }
- }
- }
- }
- }
-
+ public void eventReceived(Object output) {
+ for (MIOOBRecord oobr : ((MIOutput) output).getMIOOBRecords()) {
+ if (oobr instanceof MITargetStreamOutput) {
+ if (fSuppressTargetOutputCounter > 0)
+ return;
+ MITargetStreamOutput tgtOut = (MITargetStreamOutput) oobr;
+ if (fInputStreamPiped != null && tgtOut.getString() != null) {
+ try {
+ fInputStreamPiped.write(tgtOut.getString().getBytes());
+ fInputStreamPiped.flush();
+ } catch (IOException e) {
+ }
+ }
+ }
+ }
+ }
+
@Override
- public void commandQueued(ICommandToken token) {
- // No action
- }
-
+ public void commandQueued(ICommandToken token) {
+ // No action
+ }
+
@Override
- public void commandSent(ICommandToken token) {
- if (token.getCommand() instanceof CLICommand<?>) {
- fSuppressTargetOutputCounter++;
- }
- }
-
+ public void commandSent(ICommandToken token) {
+ if (token.getCommand() instanceof CLICommand<?>) {
+ fSuppressTargetOutputCounter++;
+ }
+ }
+
@Override
- public void commandRemoved(ICommandToken token) {
- // No action
- }
-
+ public void commandRemoved(ICommandToken token) {
+ // No action
+ }
+
@Override
- public void commandDone(ICommandToken token, ICommandResult result) {
- if (token.getCommand() instanceof CLICommand<?>) {
- fSuppressTargetOutputCounter--;
- }
- }
+ public void commandDone(ICommandToken token, ICommandResult result) {
+ if (token.getCommand() instanceof CLICommand<?>) {
+ fSuppressTargetOutputCounter--;
+ }
+ }
- /**
+ /**
* @since 4.0
*/
- @DsfServiceEventHandler
- public void eventDispatched(IExitedDMEvent e) {
- if (e.getDMContext() instanceof IMIContainerDMContext) {
- // For multi-process, make sure the exited event
- // is actually for this inferior.
- if (e.getDMContext().equals(fContainerDMContext)) {
- // With recent changes, we notice a restart by the exited/started
- // events, and only then create the new inferior; this means the new
- // inferior will no longer receive the exited event for the old inferior.
- // But it does not hurt to leave the below if check just in case.
- assert fStarted : "Exited event should only be received for a started inferior"; //$NON-NLS-1$
- if (fStarted) {
- // Only mark this process as terminated if it was already
- // started. This was to protect ourselves in the case of
- // a restart, where we used to create the new inferior before
- // killing the old one. In that case we would get the exited
- // event of the old inferior, which we had to ignore.
- //
- setTerminated();
- }
- }
- }
- }
-
- /** @since 4.2 */
- @DsfServiceEventHandler
- public void eventDispatched(MIThreadGroupExitedEvent e) {
- }
-
- /**
+ @DsfServiceEventHandler
+ public void eventDispatched(IExitedDMEvent e) {
+ if (e.getDMContext() instanceof IMIContainerDMContext) {
+ // For multi-process, make sure the exited event
+ // is actually for this inferior.
+ if (e.getDMContext().equals(fContainerDMContext)) {
+ // With recent changes, we notice a restart by the exited/started
+ // events, and only then create the new inferior; this means the new
+ // inferior will no longer receive the exited event for the old inferior.
+ // But it does not hurt to leave the below if check just in case.
+ assert fStarted : "Exited event should only be received for a started inferior"; //$NON-NLS-1$
+ if (fStarted) {
+ // Only mark this process as terminated if it was already
+ // started. This was to protect ourselves in the case of
+ // a restart, where we used to create the new inferior before
+ // killing the old one. In that case we would get the exited
+ // event of the old inferior, which we had to ignore.
+ //
+ setTerminated();
+ }
+ }
+ }
+ }
+
+ /** @since 4.2 */
+ @DsfServiceEventHandler
+ public void eventDispatched(MIThreadGroupExitedEvent e) {
+ }
+
+ /**
* @since 4.0
*/
- @DsfServiceEventHandler
- public void eventDispatched(IStartedDMEvent e) {
- if (e.getDMContext() instanceof IMIContainerDMContext) {
- // Mark the inferior started if the event is for this inferior.
- // We may get other started events in the case of a restart
- if (!fStarted) {
- // For multi-process, make sure the started event
- // is actually for this inferior.
- // We must compare the groupId and not the full context
- // because the container that we currently hold is incomplete
- // because the pid was not determined yet.
- String inferiorGroup = ((IMIContainerDMContext)fContainerDMContext).getGroupId();
-
- if (inferiorGroup == null || inferiorGroup.length() == 0) {
- // Single process case, so we know we have started
- fStarted = true;
- // Store the fully-formed container
- fContainerDMContext = (IMIContainerDMContext)e.getDMContext();
- } else {
- String startedGroup = ((IMIContainerDMContext)e.getDMContext()).getGroupId();
- if (inferiorGroup.equals(startedGroup)) {
- fStarted = true;
- // Store the fully-formed container
- fContainerDMContext = (IMIContainerDMContext)e.getDMContext();
- }
- }
- }
- }
- }
-
- /**
+ @DsfServiceEventHandler
+ public void eventDispatched(IStartedDMEvent e) {
+ if (e.getDMContext() instanceof IMIContainerDMContext) {
+ // Mark the inferior started if the event is for this inferior.
+ // We may get other started events in the case of a restart
+ if (!fStarted) {
+ // For multi-process, make sure the started event
+ // is actually for this inferior.
+ // We must compare the groupId and not the full context
+ // because the container that we currently hold is incomplete
+ // because the pid was not determined yet.
+ String inferiorGroup = ((IMIContainerDMContext) fContainerDMContext).getGroupId();
+
+ if (inferiorGroup == null || inferiorGroup.length() == 0) {
+ // Single process case, so we know we have started
+ fStarted = true;
+ // Store the fully-formed container
+ fContainerDMContext = (IMIContainerDMContext) e.getDMContext();
+ } else {
+ String startedGroup = ((IMIContainerDMContext) e.getDMContext()).getGroupId();
+ if (inferiorGroup.equals(startedGroup)) {
+ fStarted = true;
+ // Store the fully-formed container
+ fContainerDMContext = (IMIContainerDMContext) e.getDMContext();
+ }
+ }
+ }
+ }
+ }
+
+ /**
* @since 4.0
*/
- @DsfServiceEventHandler
- public void eventDispatched(ICommandControlShutdownDMEvent e) {
- dispose();
- }
+ @DsfServiceEventHandler
+ public void eventDispatched(ICommandControlShutdownDMEvent e) {
+ dispose();
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIInferiorProcess_7_3.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIInferiorProcess_7_3.java
index 690a3643fc8..6618cc043d0 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIInferiorProcess_7_3.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIInferiorProcess_7_3.java
@@ -31,98 +31,98 @@ import org.eclipse.debug.core.model.IProcess;
/**
* Specialization for GDB >= 7.3.
- *
+ *
* @since 4.7
*/
-public class MIInferiorProcess_7_3 extends MIInferiorProcess
-{
+public class MIInferiorProcess_7_3 extends MIInferiorProcess {
private DsfSession fSession;
-
- @ConfinedToDsfExecutor("fSession#getExecutor")
- public MIInferiorProcess_7_3(IContainerDMContext container, OutputStream gdbOutputStream) {
- this(container, gdbOutputStream, null);
- }
-
- @ConfinedToDsfExecutor("fSession#getExecutor")
- public MIInferiorProcess_7_3(IContainerDMContext container, PTY p) {
- this(container, null, p);
- }
-
- @ConfinedToDsfExecutor("fSession#getExecutor")
- protected MIInferiorProcess_7_3(IContainerDMContext container, final OutputStream gdbOutputStream, PTY pty) {
- super(container, gdbOutputStream, pty);
- fSession = DsfSession.getSession(container.getSessionId());
- }
-
- @ThreadSafeAndProhibitedFromDsfExecutor("fSession#getExecutor")
- @Override
- public int exitValue() {
- assert !fSession.getExecutor().isInExecutorThread();
-
- synchronized(this) {
- if (fExitCode != null) {
- return fExitCode;
- }
- }
-
- if (!isTerminated()) {
- // Throw an exception because the process is still running.
- throw new IllegalThreadStateException();
- }
-
- return 0;
- }
-
- /** @since 4.2 */
- @Override
+
+ @ConfinedToDsfExecutor("fSession#getExecutor")
+ public MIInferiorProcess_7_3(IContainerDMContext container, OutputStream gdbOutputStream) {
+ this(container, gdbOutputStream, null);
+ }
+
+ @ConfinedToDsfExecutor("fSession#getExecutor")
+ public MIInferiorProcess_7_3(IContainerDMContext container, PTY p) {
+ this(container, null, p);
+ }
+
+ @ConfinedToDsfExecutor("fSession#getExecutor")
+ protected MIInferiorProcess_7_3(IContainerDMContext container, final OutputStream gdbOutputStream, PTY pty) {
+ super(container, gdbOutputStream, pty);
+ fSession = DsfSession.getSession(container.getSessionId());
+ }
+
+ @ThreadSafeAndProhibitedFromDsfExecutor("fSession#getExecutor")
+ @Override
+ public int exitValue() {
+ assert !fSession.getExecutor().isInExecutorThread();
+
+ synchronized (this) {
+ if (fExitCode != null) {
+ return fExitCode;
+ }
+ }
+
+ if (!isTerminated()) {
+ // Throw an exception because the process is still running.
+ throw new IllegalThreadStateException();
+ }
+
+ return 0;
+ }
+
+ /** @since 4.2 */
+ @Override
@DsfServiceEventHandler
- public void eventDispatched(MIThreadGroupExitedEvent e) {
+ public void eventDispatched(MIThreadGroupExitedEvent e) {
if (getContainer() instanceof IMIContainerDMContext) {
- if (((IMIContainerDMContext)getContainer()).getGroupId().equals(e.getGroupId())) {
- // With recent changes, we notice a restart by the exited/started
- // events, and only then create the new inferior; this means the new
- // inferior will no longer receive the exited event for the old inferior.
- // But it does not hurt to leave the below if check just in case.
- assert isStarted() : "Exited event should only be received for a started inferior"; //$NON-NLS-1$
-
- if (isStarted()) {
- // Only handle this event if this process was already
- // started. This is to protect ourselves in the case of
- // a restart, where the new inferior is already created
- // and gets the exited event for the old inferior.
- String exitCode = e.getExitCode();
- if (exitCode != null) {
- setExitCodeAttribute();
- try {
- // Must use 'decode' since GDB returns an octal value
- Integer decodedExitCode = Integer.decode(exitCode);
- synchronized(this) {
- fExitCode = decodedExitCode;
- }
- } catch (NumberFormatException exception) {
- }
- }
- }
- }
- }
- }
-
+ if (((IMIContainerDMContext) getContainer()).getGroupId().equals(e.getGroupId())) {
+ // With recent changes, we notice a restart by the exited/started
+ // events, and only then create the new inferior; this means the new
+ // inferior will no longer receive the exited event for the old inferior.
+ // But it does not hurt to leave the below if check just in case.
+ assert isStarted() : "Exited event should only be received for a started inferior"; //$NON-NLS-1$
+
+ if (isStarted()) {
+ // Only handle this event if this process was already
+ // started. This is to protect ourselves in the case of
+ // a restart, where the new inferior is already created
+ // and gets the exited event for the old inferior.
+ String exitCode = e.getExitCode();
+ if (exitCode != null) {
+ setExitCodeAttribute();
+ try {
+ // Must use 'decode' since GDB returns an octal value
+ Integer decodedExitCode = Integer.decode(exitCode);
+ synchronized (this) {
+ fExitCode = decodedExitCode;
+ }
+ } catch (NumberFormatException exception) {
+ }
+ }
+ }
+ }
+ }
+ }
+
/**
* Set an attribute in the inferior process of the launch to indicate
* that the inferior has properly exited and its exit value can be used.
*/
- @ConfinedToDsfExecutor("fSession#getExecutor")
+ @ConfinedToDsfExecutor("fSession#getExecutor")
private void setExitCodeAttribute() {
// Update the console label to contain the exit code
- ILaunch launch = (ILaunch)fSession.getModelAdapter(ILaunch.class);
+ ILaunch launch = (ILaunch) fSession.getModelAdapter(ILaunch.class);
IProcess[] launchProcesses = launch.getProcesses();
for (IProcess proc : launchProcesses) {
if (proc instanceof InferiorRuntimeProcess) {
String groupAttribute = proc.getAttribute(IGdbDebugConstants.INFERIOR_GROUPID_ATTR);
if (getContainer() instanceof IMIContainerDMContext) {
- if (groupAttribute != null && groupAttribute.equals(((IMIContainerDMContext)getContainer()).getGroupId())) {
+ if (groupAttribute != null
+ && groupAttribute.equals(((IMIContainerDMContext) getContainer()).getGroupId())) {
// Simply set the attribute that indicates the inferior has properly exited and its
// exit code can be used.
proc.setAttribute(IGdbDebugConstants.INFERIOR_EXITED_ATTR, ""); //$NON-NLS-1$
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor.java
index 477b1c229b9..a2ce531140e 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor.java
@@ -7,10 +7,10 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
- * Ericsson - Additional handling of events
+ * Ericsson - Additional handling of events
* Mikhail Khodjaiants (Mentor Graphics) - Refactor common code in GDBControl* classes (bug 372795)
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command;
@@ -77,107 +77,106 @@ import org.eclipse.cdt.dsf.service.DsfServicesTracker;
* generates corresponding MI events. The generated MI events are then
* received by other services and clients.
*/
-public class MIRunControlEventProcessor
- implements IEventProcessor
-{
+public class MIRunControlEventProcessor implements IEventProcessor {
private static final String STOPPED_REASON = "stopped"; //$NON-NLS-1$
-
+
+ /**
+ * The connection service that this event processor is registered with.
+ */
+ private final AbstractMIControl fCommandControl;
+
/**
- * The connection service that this event processor is registered with.
- */
- private final AbstractMIControl fCommandControl;
-
- /**
- * Container context used as the context for the run control events generated
- * by this processor.
- */
- private final ICommandControlDMContext fControlDmc;
-
- private final DsfServicesTracker fServicesTracker;
-
- /**
- * Creates the event processor and registers it as listener with the debugger
- * control.
- * @param connection
- * @param inferior
- * @since 1.1
- */
- public MIRunControlEventProcessor(AbstractMIControl connection, ICommandControlDMContext controlDmc) {
- fCommandControl = connection;
- fControlDmc = controlDmc;
- fServicesTracker = new DsfServicesTracker(GdbPlugin.getBundleContext(), fCommandControl.getSession().getId());
- connection.addEventListener(this);
- connection.addCommandListener(this);
- }
-
- /**
- * This processor must be disposed before the control service is un-registered.
- */
- @Override
- public void dispose() {
- fCommandControl.removeEventListener(this);
- fCommandControl.removeCommandListener(this);
- fServicesTracker.dispose();
- }
-
+ * Container context used as the context for the run control events generated
+ * by this processor.
+ */
+ private final ICommandControlDMContext fControlDmc;
+
+ private final DsfServicesTracker fServicesTracker;
+
+ /**
+ * Creates the event processor and registers it as listener with the debugger
+ * control.
+ * @param connection
+ * @param inferior
+ * @since 1.1
+ */
+ public MIRunControlEventProcessor(AbstractMIControl connection, ICommandControlDMContext controlDmc) {
+ fCommandControl = connection;
+ fControlDmc = controlDmc;
+ fServicesTracker = new DsfServicesTracker(GdbPlugin.getBundleContext(), fCommandControl.getSession().getId());
+ connection.addEventListener(this);
+ connection.addCommandListener(this);
+ }
+
+ /**
+ * This processor must be disposed before the control service is un-registered.
+ */
+ @Override
+ public void dispose() {
+ fCommandControl.removeEventListener(this);
+ fCommandControl.removeCommandListener(this);
+ fServicesTracker.dispose();
+ }
+
@Override
- public void eventReceived(Object output) {
- for (MIOOBRecord oobr : ((MIOutput)output).getMIOOBRecords()) {
+ public void eventReceived(Object output) {
+ for (MIOOBRecord oobr : ((MIOutput) output).getMIOOBRecords()) {
List<MIEvent<?>> events = new LinkedList<MIEvent<?>>();
- if (oobr instanceof MIExecAsyncOutput) {
- MIExecAsyncOutput exec = (MIExecAsyncOutput) oobr;
- // Change of state.
- String state = exec.getAsyncClass();
- if ("stopped".equals(state)) { //$NON-NLS-1$
- // Re-set the thread and stack level to -1 when stopped event is recvd.
- // This is to synchronize the state between GDB back-end and AbstractMIControl.
- fCommandControl.resetCurrentThreadLevel();
- fCommandControl.resetCurrentStackLevel();
-
- MIResult[] results = exec.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- MIValue val = results[i].getMIValue();
- if (var.equals("reason")) { //$NON-NLS-1$
- if (val instanceof MIConst) {
- String reason = ((MIConst) val).getString();
- MIEvent<?> e = createEvent(reason, exec);
- if (e != null) {
- events.add(e);
- continue;
- }
- }
- }
- }
-
+ if (oobr instanceof MIExecAsyncOutput) {
+ MIExecAsyncOutput exec = (MIExecAsyncOutput) oobr;
+ // Change of state.
+ String state = exec.getAsyncClass();
+ if ("stopped".equals(state)) { //$NON-NLS-1$
+ // Re-set the thread and stack level to -1 when stopped event is recvd.
+ // This is to synchronize the state between GDB back-end and AbstractMIControl.
+ fCommandControl.resetCurrentThreadLevel();
+ fCommandControl.resetCurrentStackLevel();
+
+ MIResult[] results = exec.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ MIValue val = results[i].getMIValue();
+ if (var.equals("reason")) { //$NON-NLS-1$
+ if (val instanceof MIConst) {
+ String reason = ((MIConst) val).getString();
+ MIEvent<?> e = createEvent(reason, exec);
+ if (e != null) {
+ events.add(e);
+ continue;
+ }
+ }
+ }
+ }
+
// GDB < 7.0 does not provide a reason when stopping on a
// catchpoint. However, the reason is contained in the
// stream records that precede the exec async output one.
// This is ugly, but we don't really have an alternative.
- if (events.isEmpty()) {
- MIStreamRecord[] streamRecords = ((MIOutput)output).getStreamRecords();
- for (MIStreamRecord streamRecord : streamRecords) {
- String log = streamRecord.getString();
- if (log.startsWith("Catchpoint ")) { //$NON-NLS-1$
- events.add(MICatchpointHitEvent.parse(getExecutionContext(exec), exec.getToken(), results, streamRecord));
- }
- }
- }
-
- // We were stopped for some unknown reason, for example
- // GDB for temporary breakpoints will not send the
- // "reason" ??? still fire a stopped event.
- if (events.isEmpty()) {
- MIEvent<?> e = createEvent(STOPPED_REASON, exec);
+ if (events.isEmpty()) {
+ MIStreamRecord[] streamRecords = ((MIOutput) output).getStreamRecords();
+ for (MIStreamRecord streamRecord : streamRecords) {
+ String log = streamRecord.getString();
+ if (log.startsWith("Catchpoint ")) { //$NON-NLS-1$
+ events.add(MICatchpointHitEvent.parse(getExecutionContext(exec), exec.getToken(),
+ results, streamRecord));
+ }
+ }
+ }
+
+ // We were stopped for some unknown reason, for example
+ // GDB for temporary breakpoints will not send the
+ // "reason" ??? still fire a stopped event.
+ if (events.isEmpty()) {
+ MIEvent<?> e = createEvent(STOPPED_REASON, exec);
if (e != null) {
events.add(e);
}
- }
+ }
- for (MIEvent<?> event : events) {
- fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
- }
- }
+ for (MIEvent<?> event : events) {
+ fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
+ }
+ }
} else if (oobr instanceof MIConsoleStreamOutput) {
MIConsoleStreamOutput stream = (MIConsoleStreamOutput) oobr;
if (stream.getCString().startsWith("Program terminated with signal")) {//$NON-NLS-1$
@@ -210,232 +209,252 @@ public class MIRunControlEventProcessor
fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
}
}
- }
- }
-
- // Now check for a oob command result. This happens on Windows when interrupting GDB.
- // In this case, GDB before 7.0 does not always send a *stopped event, so we must do it ourselves
- // Bug 304096 (if you have the patience to go through it :-))
- MIResultRecord rr = ((MIOutput)output).getMIResultRecord();
- if (rr != null) {
- int id = rr.getToken();
- String state = rr.getResultClass();
- if ("error".equals(state)) { //$NON-NLS-1$
-
- MIResult[] results = rr.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- MIValue val = results[i].getMIValue();
- if (var.equals("msg")) { //$NON-NLS-1$
- if (val instanceof MIConst) {
- String message = ((MIConst) val).getString();
- if (message.toLowerCase().startsWith("quit")) { //$NON-NLS-1$
- IRunControl runControl = fServicesTracker.getService(IRunControl.class);
- IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
- if (runControl != null && procService != null) {
- // We don't know which thread stopped so we simply create a container event.
- IContainerDMContext processContainerDmc = procService.createContainerContextFromGroupId(fControlDmc, MIProcesses.UNIQUE_GROUP_ID);
-
- if (runControl.isSuspended(processContainerDmc) == false) {
- // Create an MISignalEvent because that is what the *stopped event should have been
- MIEvent<?> event = MISignalEvent.parse(processContainerDmc, id, rr.getMIResults());
- fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
- }
- }
- }
- }
- }
- }
- }
- }
- }
+ }
+ }
+
+ // Now check for a oob command result. This happens on Windows when interrupting GDB.
+ // In this case, GDB before 7.0 does not always send a *stopped event, so we must do it ourselves
+ // Bug 304096 (if you have the patience to go through it :-))
+ MIResultRecord rr = ((MIOutput) output).getMIResultRecord();
+ if (rr != null) {
+ int id = rr.getToken();
+ String state = rr.getResultClass();
+ if ("error".equals(state)) { //$NON-NLS-1$
+
+ MIResult[] results = rr.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ MIValue val = results[i].getMIValue();
+ if (var.equals("msg")) { //$NON-NLS-1$
+ if (val instanceof MIConst) {
+ String message = ((MIConst) val).getString();
+ if (message.toLowerCase().startsWith("quit")) { //$NON-NLS-1$
+ IRunControl runControl = fServicesTracker.getService(IRunControl.class);
+ IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
+ if (runControl != null && procService != null) {
+ // We don't know which thread stopped so we simply create a container event.
+ IContainerDMContext processContainerDmc = procService
+ .createContainerContextFromGroupId(fControlDmc,
+ MIProcesses.UNIQUE_GROUP_ID);
+
+ if (runControl.isSuspended(processContainerDmc) == false) {
+ // Create an MISignalEvent because that is what the *stopped event should have been
+ MIEvent<?> event = MISignalEvent.parse(processContainerDmc, id,
+ rr.getMIResults());
+ fCommandControl.getSession().dispatchEvent(event,
+ fCommandControl.getProperties());
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
/**
- * Create an execution context given an exec-async-output OOB record
- *
+ * Create an execution context given an exec-async-output OOB record
+ *
* @since 3.0
*/
- protected IExecutionDMContext getExecutionContext(MIExecAsyncOutput exec) {
- String threadId = null;
-
- MIResult[] results = exec.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- MIValue val = results[i].getMIValue();
-
- if (var.equals("thread-id")) { //$NON-NLS-1$
- if (val instanceof MIConst) {
- threadId = ((MIConst)val).getString();
- }
- }
- }
-
- IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
- if (procService == null) {
- return null;
- }
-
- IContainerDMContext processContainerDmc = procService.createContainerContextFromGroupId(fControlDmc, MIProcesses.UNIQUE_GROUP_ID);
-
- IExecutionDMContext execDmc = processContainerDmc;
- if (threadId != null) {
- IProcessDMContext procDmc = DMContexts.getAncestorOfType(processContainerDmc, IProcessDMContext.class);
- IThreadDMContext threadDmc = procService.createThreadContext(procDmc, threadId);
- execDmc = procService.createExecutionContext(processContainerDmc, threadDmc, threadId);
- }
-
- return execDmc;
- }
-
- @ConfinedToDsfExecutor("")
- protected MIEvent<?> createEvent(String reason, MIExecAsyncOutput exec) {
- IExecutionDMContext execDmc = getExecutionContext(exec);
- MIEvent<?> event = null;
- if ("breakpoint-hit".equals(reason)) { //$NON-NLS-1$
- event = MIBreakpointHitEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
- } else if (
- "watchpoint-trigger".equals(reason) //$NON-NLS-1$
- || "read-watchpoint-trigger".equals(reason) //$NON-NLS-1$
- || "access-watchpoint-trigger".equals(reason)) { //$NON-NLS-1$
- event = MIWatchpointTriggerEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
- } else if ("watchpoint-scope".equals(reason)) { //$NON-NLS-1$
- event = MIWatchpointScopeEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
- } else if ("end-stepping-range".equals(reason)) { //$NON-NLS-1$
- event = MISteppingRangeEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
- } else if ("signal-received".equals(reason)) { //$NON-NLS-1$
- event = MISignalEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
- } else if ("location-reached".equals(reason)) { //$NON-NLS-1$
- event = MILocationReachedEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
- } else if ("function-finished".equals(reason)) { //$NON-NLS-1$
- event = MIFunctionFinishedEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
+ protected IExecutionDMContext getExecutionContext(MIExecAsyncOutput exec) {
+ String threadId = null;
+
+ MIResult[] results = exec.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ MIValue val = results[i].getMIValue();
+
+ if (var.equals("thread-id")) { //$NON-NLS-1$
+ if (val instanceof MIConst) {
+ threadId = ((MIConst) val).getString();
+ }
+ }
+ }
+
+ IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
+ if (procService == null) {
+ return null;
+ }
+
+ IContainerDMContext processContainerDmc = procService.createContainerContextFromGroupId(fControlDmc,
+ MIProcesses.UNIQUE_GROUP_ID);
+
+ IExecutionDMContext execDmc = processContainerDmc;
+ if (threadId != null) {
+ IProcessDMContext procDmc = DMContexts.getAncestorOfType(processContainerDmc, IProcessDMContext.class);
+ IThreadDMContext threadDmc = procService.createThreadContext(procDmc, threadId);
+ execDmc = procService.createExecutionContext(processContainerDmc, threadDmc, threadId);
+ }
+
+ return execDmc;
+ }
+
+ @ConfinedToDsfExecutor("")
+ protected MIEvent<?> createEvent(String reason, MIExecAsyncOutput exec) {
+ IExecutionDMContext execDmc = getExecutionContext(exec);
+ MIEvent<?> event = null;
+ if ("breakpoint-hit".equals(reason)) { //$NON-NLS-1$
+ event = MIBreakpointHitEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
+ } else if ("watchpoint-trigger".equals(reason) //$NON-NLS-1$
+ || "read-watchpoint-trigger".equals(reason) //$NON-NLS-1$
+ || "access-watchpoint-trigger".equals(reason)) { //$NON-NLS-1$
+ event = MIWatchpointTriggerEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
+ } else if ("watchpoint-scope".equals(reason)) { //$NON-NLS-1$
+ event = MIWatchpointScopeEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
+ } else if ("end-stepping-range".equals(reason)) { //$NON-NLS-1$
+ event = MISteppingRangeEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
+ } else if ("signal-received".equals(reason)) { //$NON-NLS-1$
+ event = MISignalEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
+ } else if ("location-reached".equals(reason)) { //$NON-NLS-1$
+ event = MILocationReachedEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
+ } else if ("function-finished".equals(reason)) { //$NON-NLS-1$
+ event = MIFunctionFinishedEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
} else if ("solib-event".equals(reason)) { //$NON-NLS-1$
event = MISharedLibEvent.parse(execDmc, exec.getToken(), exec.getMIResults(), null);
- } else if ("exited-normally".equals(reason) || "exited".equals(reason)) { //$NON-NLS-1$ //$NON-NLS-2$
- event = MIInferiorExitEvent.parse(fCommandControl.getContext(), exec.getToken(), exec.getMIResults());
- // Until we clean up the handling of all these events, we need to send the containerExited event
- // Only needed GDB < 7.0, because GDB itself does not yet send an MI event about the inferior terminating
- sendContainerExitedEvent();
- } else if ("exited-signalled".equals(reason)) { //$NON-NLS-1$
- event = MIInferiorSignalExitEvent.parse(fCommandControl.getContext(), exec.getToken(), exec.getMIResults());
- // Until we clean up the handling of all these events, we need to send the containerExited event
- // Only needed GDB < 7.0, because GDB itself does not yet send an MI event about the inferior terminating
- sendContainerExitedEvent();
- } else if (STOPPED_REASON.equals(reason)) {
- event = MIStoppedEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
- }
- return event;
- }
-
- private void sendContainerExitedEvent() {
- IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
- if (procService != null) {
- IContainerDMContext processContainerDmc = procService.createContainerContextFromGroupId(fControlDmc, MIProcesses.UNIQUE_GROUP_ID);
-
- fCommandControl.getSession().dispatchEvent(
- new ContainerExitedDMEvent(processContainerDmc), fCommandControl.getProperties());
- }
- }
-
+ } else if ("exited-normally".equals(reason) || "exited".equals(reason)) { //$NON-NLS-1$ //$NON-NLS-2$
+ event = MIInferiorExitEvent.parse(fCommandControl.getContext(), exec.getToken(), exec.getMIResults());
+ // Until we clean up the handling of all these events, we need to send the containerExited event
+ // Only needed GDB < 7.0, because GDB itself does not yet send an MI event about the inferior terminating
+ sendContainerExitedEvent();
+ } else if ("exited-signalled".equals(reason)) { //$NON-NLS-1$
+ event = MIInferiorSignalExitEvent.parse(fCommandControl.getContext(), exec.getToken(), exec.getMIResults());
+ // Until we clean up the handling of all these events, we need to send the containerExited event
+ // Only needed GDB < 7.0, because GDB itself does not yet send an MI event about the inferior terminating
+ sendContainerExitedEvent();
+ } else if (STOPPED_REASON.equals(reason)) {
+ event = MIStoppedEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
+ }
+ return event;
+ }
+
+ private void sendContainerExitedEvent() {
+ IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
+ if (procService != null) {
+ IContainerDMContext processContainerDmc = procService.createContainerContextFromGroupId(fControlDmc,
+ MIProcesses.UNIQUE_GROUP_ID);
+
+ fCommandControl.getSession().dispatchEvent(new ContainerExitedDMEvent(processContainerDmc),
+ fCommandControl.getProperties());
+ }
+ }
+
@Override
- public void commandQueued(ICommandToken token) {
- // Do nothing.
- }
-
+ public void commandQueued(ICommandToken token) {
+ // Do nothing.
+ }
+
@Override
- public void commandSent(ICommandToken token) {
- // Do nothing.
- }
-
+ public void commandSent(ICommandToken token) {
+ // Do nothing.
+ }
+
@Override
- public void commandRemoved(ICommandToken token) {
- // Do nothing.
- }
-
+ public void commandRemoved(ICommandToken token) {
+ // Do nothing.
+ }
+
@Override
- public void commandDone(ICommandToken token, ICommandResult result) {
- ICommand<?> cmd = token.getCommand();
- MIInfo cmdResult = (MIInfo) result ;
- MIOutput output = cmdResult.getMIOutput();
- MIResultRecord rr = output.getMIResultRecord();
- if (rr != null) {
- int id = rr.getToken();
- // Check if the state changed.
- String state = rr.getResultClass();
- if ("running".equals(state)) { //$NON-NLS-1$
- int type = 0;
- // Check the type of command
- // if it was a step instruction set state stepping
-
- if (cmd instanceof MIExecNext) { type = MIRunningEvent.NEXT; }
- else if (cmd instanceof MIExecNextInstruction) { type = MIRunningEvent.NEXTI; }
- else if (cmd instanceof MIExecStep) { type = MIRunningEvent.STEP; }
- else if (cmd instanceof MIExecStepInstruction) { type = MIRunningEvent.STEPI; }
- else if (cmd instanceof MIExecUntil) { type = MIRunningEvent.UNTIL; }
- else if (cmd instanceof MIExecFinish) { type = MIRunningEvent.FINISH; }
- else if (cmd instanceof MIExecReturn) { type = MIRunningEvent.RETURN; }
- else if (cmd instanceof MIExecContinue) { type = MIRunningEvent.CONTINUE; }
- else { type = MIRunningEvent.CONTINUE; }
-
- IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
- if (procService != null) {
- IContainerDMContext processContainerDmc = procService.createContainerContextFromGroupId(fControlDmc, MIProcesses.UNIQUE_GROUP_ID);
-
- fCommandControl.getSession().dispatchEvent(
- new MIRunningEvent(processContainerDmc, id, type), fCommandControl.getProperties());
- }
- } else if ("exit".equals(state)) { //$NON-NLS-1$
- // No need to do anything, terminate() will.
- // Send exited?
- } else if ("connected".equals(state)) { //$NON-NLS-1$
- // This will happen for a CORE or REMOTE session.
- // For a CORE session this is the only indication
- // that the inferior has 'started'. So we use
- // it to trigger the ContainerStarted event.
- // In the case of a REMOTE session, it is a proper
- // indicator as well but not if it is a remote attach.
- // For an attach session, it only indicates
- // that we are connected to a remote node but we still
- // need to wait until we are attached to the process before
- // sending the event, which will happen in the attaching code.
- IGDBBackend backendService = fServicesTracker.getService(IGDBBackend.class);
- if (backendService != null && backendService.getIsAttachSession() == false) {
- IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
- if (procService != null) {
- IContainerDMContext processContainerDmc = procService.createContainerContextFromGroupId(fControlDmc, MIProcesses.UNIQUE_GROUP_ID);
-
- fCommandControl.getSession().dispatchEvent(
- new ContainerStartedDMEvent(processContainerDmc), fCommandControl.getProperties());
- }
- }
- } else if ("error".equals(state)) { //$NON-NLS-1$
- } else if ("done".equals(state)) { //$NON-NLS-1$
- // For GDBs older than 7.0, GDB does not trigger a *stopped event
- // when it stops due to a CLI command. We have to trigger the
- // MIStoppedEvent ourselves
- if (cmd instanceof CLICommand<?>) {
- // It is important to limit this to runControl operations (e.g., 'next', 'continue', 'jump')
- // There are other CLI commands that we use that could still be sent when the target is considered
- // running, due to timing issues.
- boolean isAttachingOperation = CLIEventProcessor.isAttachingOperation(((CLICommand<?>)cmd).getOperation());
- boolean isSteppingOperation = CLIEventProcessor.isSteppingOperation(((CLICommand<?>)cmd).getOperation());
- if (isSteppingOperation || isAttachingOperation) {
- IRunControl runControl = fServicesTracker.getService(IRunControl.class);
- IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
- if (runControl != null && procService != null) {
- // We don't know which thread stopped so we simply create a container event.
- IContainerDMContext processContainerDmc = procService.createContainerContextFromGroupId(fControlDmc, MIProcesses.UNIQUE_GROUP_ID);
-
- // An attaching operation is debugging a new inferior and always stops it.
- // We should not check that the container is suspended, because at startup, we are considered
- // suspended, even though we can get a *stopped event.
- if (isAttachingOperation || runControl.isSuspended(processContainerDmc) == false) {
- MIEvent<?> event = MIStoppedEvent.parse(processContainerDmc, id, rr.getMIResults());
- fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
- }
- }
- }
- }
- }
- }
- }
+ public void commandDone(ICommandToken token, ICommandResult result) {
+ ICommand<?> cmd = token.getCommand();
+ MIInfo cmdResult = (MIInfo) result;
+ MIOutput output = cmdResult.getMIOutput();
+ MIResultRecord rr = output.getMIResultRecord();
+ if (rr != null) {
+ int id = rr.getToken();
+ // Check if the state changed.
+ String state = rr.getResultClass();
+ if ("running".equals(state)) { //$NON-NLS-1$
+ int type = 0;
+ // Check the type of command
+ // if it was a step instruction set state stepping
+
+ if (cmd instanceof MIExecNext) {
+ type = MIRunningEvent.NEXT;
+ } else if (cmd instanceof MIExecNextInstruction) {
+ type = MIRunningEvent.NEXTI;
+ } else if (cmd instanceof MIExecStep) {
+ type = MIRunningEvent.STEP;
+ } else if (cmd instanceof MIExecStepInstruction) {
+ type = MIRunningEvent.STEPI;
+ } else if (cmd instanceof MIExecUntil) {
+ type = MIRunningEvent.UNTIL;
+ } else if (cmd instanceof MIExecFinish) {
+ type = MIRunningEvent.FINISH;
+ } else if (cmd instanceof MIExecReturn) {
+ type = MIRunningEvent.RETURN;
+ } else if (cmd instanceof MIExecContinue) {
+ type = MIRunningEvent.CONTINUE;
+ } else {
+ type = MIRunningEvent.CONTINUE;
+ }
+
+ IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
+ if (procService != null) {
+ IContainerDMContext processContainerDmc = procService.createContainerContextFromGroupId(fControlDmc,
+ MIProcesses.UNIQUE_GROUP_ID);
+
+ fCommandControl.getSession().dispatchEvent(new MIRunningEvent(processContainerDmc, id, type),
+ fCommandControl.getProperties());
+ }
+ } else if ("exit".equals(state)) { //$NON-NLS-1$
+ // No need to do anything, terminate() will.
+ // Send exited?
+ } else if ("connected".equals(state)) { //$NON-NLS-1$
+ // This will happen for a CORE or REMOTE session.
+ // For a CORE session this is the only indication
+ // that the inferior has 'started'. So we use
+ // it to trigger the ContainerStarted event.
+ // In the case of a REMOTE session, it is a proper
+ // indicator as well but not if it is a remote attach.
+ // For an attach session, it only indicates
+ // that we are connected to a remote node but we still
+ // need to wait until we are attached to the process before
+ // sending the event, which will happen in the attaching code.
+ IGDBBackend backendService = fServicesTracker.getService(IGDBBackend.class);
+ if (backendService != null && backendService.getIsAttachSession() == false) {
+ IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
+ if (procService != null) {
+ IContainerDMContext processContainerDmc = procService
+ .createContainerContextFromGroupId(fControlDmc, MIProcesses.UNIQUE_GROUP_ID);
+
+ fCommandControl.getSession().dispatchEvent(new ContainerStartedDMEvent(processContainerDmc),
+ fCommandControl.getProperties());
+ }
+ }
+ } else if ("error".equals(state)) { //$NON-NLS-1$
+ } else if ("done".equals(state)) { //$NON-NLS-1$
+ // For GDBs older than 7.0, GDB does not trigger a *stopped event
+ // when it stops due to a CLI command. We have to trigger the
+ // MIStoppedEvent ourselves
+ if (cmd instanceof CLICommand<?>) {
+ // It is important to limit this to runControl operations (e.g., 'next', 'continue', 'jump')
+ // There are other CLI commands that we use that could still be sent when the target is considered
+ // running, due to timing issues.
+ boolean isAttachingOperation = CLIEventProcessor
+ .isAttachingOperation(((CLICommand<?>) cmd).getOperation());
+ boolean isSteppingOperation = CLIEventProcessor
+ .isSteppingOperation(((CLICommand<?>) cmd).getOperation());
+ if (isSteppingOperation || isAttachingOperation) {
+ IRunControl runControl = fServicesTracker.getService(IRunControl.class);
+ IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
+ if (runControl != null && procService != null) {
+ // We don't know which thread stopped so we simply create a container event.
+ IContainerDMContext processContainerDmc = procService
+ .createContainerContextFromGroupId(fControlDmc, MIProcesses.UNIQUE_GROUP_ID);
+
+ // An attaching operation is debugging a new inferior and always stops it.
+ // We should not check that the container is suspended, because at startup, we are considered
+ // suspended, even though we can get a *stopped event.
+ if (isAttachingOperation || runControl.isSuspended(processContainerDmc) == false) {
+ MIEvent<?> event = MIStoppedEvent.parse(processContainerDmc, id, rr.getMIResults());
+ fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
+ }
+ }
+ }
+ }
+ }
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor_7_0.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor_7_0.java
index 2df68a4dc44..3726a94c4d2 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor_7_0.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor_7_0.java
@@ -7,10 +7,10 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
- * Ericsson - Version 7.0
+ * Ericsson - Version 7.0
* Mikhail Khodjaiants (Mentor Graphics) - Refactor common code in GDBControl* classes (bug 372795)
* Marc Khouzam (Ericsson) - Display exit code in process console (Bug 402054)
*******************************************************************************/
@@ -78,228 +78,227 @@ import org.eclipse.cdt.dsf.service.DsfServicesTracker;
* received by other services and clients.
* @since 1.1
*/
-public class MIRunControlEventProcessor_7_0
- implements IEventProcessor
-{
+public class MIRunControlEventProcessor_7_0 implements IEventProcessor {
private static final String STOPPED_REASON = "stopped"; //$NON-NLS-1$
private static final String RUNNING_REASON = "running"; //$NON-NLS-1$
-
+
private Integer fLastRunningCmdType = null;
/**
- * The connection service that this event processor is registered with.
- */
- private final AbstractMIControl fCommandControl;
-
- /**
- * Container context used as the context for the run control events generated
- * by this processor.
- */
- private final ICommandControlDMContext fControlDmc;
-
- private final DsfServicesTracker fServicesTracker;
-
- /**
- * Creates the event processor and registers it as listener with the debugger
- * control.
- * @param connection
- * @param inferior
- */
- public MIRunControlEventProcessor_7_0(AbstractMIControl connection, ICommandControlDMContext controlDmc) {
- fCommandControl = connection;
- fControlDmc = controlDmc;
- fServicesTracker = new DsfServicesTracker(GdbPlugin.getBundleContext(), fCommandControl.getSession().getId());
- connection.addEventListener(this);
- connection.addCommandListener(this);
- }
-
- /**
- * This processor must be disposed before the control service is un-registered.
- */
- @Override
- public void dispose() {
- fCommandControl.removeEventListener(this);
- fCommandControl.removeCommandListener(this);
- fServicesTracker.dispose();
- }
-
+ * The connection service that this event processor is registered with.
+ */
+ private final AbstractMIControl fCommandControl;
+
+ /**
+ * Container context used as the context for the run control events generated
+ * by this processor.
+ */
+ private final ICommandControlDMContext fControlDmc;
+
+ private final DsfServicesTracker fServicesTracker;
+
+ /**
+ * Creates the event processor and registers it as listener with the debugger
+ * control.
+ * @param connection
+ * @param inferior
+ */
+ public MIRunControlEventProcessor_7_0(AbstractMIControl connection, ICommandControlDMContext controlDmc) {
+ fCommandControl = connection;
+ fControlDmc = controlDmc;
+ fServicesTracker = new DsfServicesTracker(GdbPlugin.getBundleContext(), fCommandControl.getSession().getId());
+ connection.addEventListener(this);
+ connection.addCommandListener(this);
+ }
+
+ /**
+ * This processor must be disposed before the control service is un-registered.
+ */
+ @Override
+ public void dispose() {
+ fCommandControl.removeEventListener(this);
+ fCommandControl.removeCommandListener(this);
+ fServicesTracker.dispose();
+ }
+
@Override
- public void eventReceived(Object output) {
- for (MIOOBRecord oobr : ((MIOutput)output).getMIOOBRecords()) {
+ public void eventReceived(Object output) {
+ for (MIOOBRecord oobr : ((MIOutput) output).getMIOOBRecords()) {
List<MIEvent<?>> events = new LinkedList<MIEvent<?>>();
- if (oobr instanceof MIExecAsyncOutput) {
- MIExecAsyncOutput exec = (MIExecAsyncOutput) oobr;
- // Change of state.
- String state = exec.getAsyncClass();
- if (STOPPED_REASON.equals(state)) {
- // Re-set the thread and stack level to -1 when stopped event is recvd.
- // This is to synchronize the state between GDB back-end and AbstractMIControl.
- fCommandControl.resetCurrentThreadLevel();
- fCommandControl.resetCurrentStackLevel();
-
- MIResult[] results = exec.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- MIValue val = results[i].getMIValue();
- if (var.equals("reason")) { //$NON-NLS-1$
- if (val instanceof MIConst) {
- String reason = ((MIConst) val).getString();
- MIEvent<?> e = createEvent(reason, exec);
- if (e != null) {
- events.add(e);
- continue;
- }
- }
- }
- }
- // We were stopped for some unknown reason, for example
- // GDB for temporary breakpoints will not send the
- // "reason" ??? still fire a stopped event.
- if (events.isEmpty()) {
- MIEvent<?> e = createEvent(STOPPED_REASON, exec);
+ if (oobr instanceof MIExecAsyncOutput) {
+ MIExecAsyncOutput exec = (MIExecAsyncOutput) oobr;
+ // Change of state.
+ String state = exec.getAsyncClass();
+ if (STOPPED_REASON.equals(state)) {
+ // Re-set the thread and stack level to -1 when stopped event is recvd.
+ // This is to synchronize the state between GDB back-end and AbstractMIControl.
+ fCommandControl.resetCurrentThreadLevel();
+ fCommandControl.resetCurrentStackLevel();
+
+ MIResult[] results = exec.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ MIValue val = results[i].getMIValue();
+ if (var.equals("reason")) { //$NON-NLS-1$
+ if (val instanceof MIConst) {
+ String reason = ((MIConst) val).getString();
+ MIEvent<?> e = createEvent(reason, exec);
+ if (e != null) {
+ events.add(e);
+ continue;
+ }
+ }
+ }
+ }
+ // We were stopped for some unknown reason, for example
+ // GDB for temporary breakpoints will not send the
+ // "reason" ??? still fire a stopped event.
+ if (events.isEmpty()) {
+ MIEvent<?> e = createEvent(STOPPED_REASON, exec);
if (e != null) {
events.add(e);
}
- }
+ }
- for (MIEvent<?> event : events) {
- fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
- }
- }
- else if (RUNNING_REASON.equals(state)) {
+ for (MIEvent<?> event : events) {
+ fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
+ }
+ } else if (RUNNING_REASON.equals(state)) {
MIEvent<?> event = createEvent(RUNNING_REASON, exec);
if (event != null) {
fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
}
- }
- } else if (oobr instanceof MINotifyAsyncOutput) {
- // Parse the string and dispatch the corresponding event
- MINotifyAsyncOutput exec = (MINotifyAsyncOutput) oobr;
- String miEvent = exec.getAsyncClass();
- if ("thread-created".equals(miEvent) || "thread-exited".equals(miEvent)) { //$NON-NLS-1$ //$NON-NLS-2$
- String threadId = null;
- String groupId = null;
-
- MIResult[] results = exec.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- MIValue val = results[i].getMIValue();
- if (var.equals("group-id")) { //$NON-NLS-1$
- if (val instanceof MIConst) {
- groupId = ((MIConst) val).getString();
- }
- } else if (var.equals("id")) { //$NON-NLS-1$
- if (val instanceof MIConst) {
- threadId = ((MIConst) val).getString();
- }
- }
- }
-
- // Until GDB is officially supporting multi-process, we may not get
- // a groupId. In this case, we are running single process and we'll
- // need its groupId
- if (groupId == null) {
- groupId = MIProcesses.UNIQUE_GROUP_ID;
- }
-
- // Here, threads are created and removed. We cannot use the IMIProcesses service
- // to map a threadId to a groupId, because there would be a race condition.
- // Since we have the groupId anyway, we have no problems.
- IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
-
- if (procService != null) {
- IContainerDMContext processContainerDmc = procService.createContainerContextFromGroupId(fControlDmc, groupId);
-
- MIEvent<?> event = null;
- if ("thread-created".equals(miEvent)) { //$NON-NLS-1$
- event = new MIThreadCreatedEvent(processContainerDmc, exec.getToken(), threadId);
- } else if ("thread-exited".equals(miEvent)) { //$NON-NLS-1$
- event = new MIThreadExitEvent(processContainerDmc, exec.getToken(), threadId);
- }
- else {
- assert false; // earlier check should have guaranteed this isn't possible
- }
-
- fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
- }
- } else if ("thread-group-added".equals(miEvent)) { //$NON-NLS-1$
- // With GDB >= 7.2
- String groupId = null;
-
- MIResult[] results = exec.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- MIValue val = results[i].getMIValue();
- if (var.equals("id")) { //$NON-NLS-1$
- if (val instanceof MIConst) {
- groupId = ((MIConst) val).getString().trim();
- }
- }
- }
-
- IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
- if (procService != null) {
- // When a thread-group is first added, there is no process and therefore no pid, so we use UNKNOWN_PROCESS_ID
- IProcessDMContext processDmc = procService.createProcessContext(fCommandControl.getContext(), MIProcesses.UNKNOWN_PROCESS_ID);
- MIEvent<?> event = new MIThreadGroupAddedEvent(processDmc, exec.getToken(), groupId);
- fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
- }
- } else if ("thread-group-created".equals(miEvent) || "thread-group-started".equals(miEvent)) { //$NON-NLS-1$ //$NON-NLS-2$
- // =thread-group-created was used for GDB 7.0 and 7.1,
- // but then became =thread-group-started starting with GDB 7.2
- String groupId = null;
- String pId = null;
-
- MIResult[] results = exec.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- MIValue val = results[i].getMIValue();
- if (var.equals("id")) { //$NON-NLS-1$
- if (val instanceof MIConst) {
- groupId = ((MIConst) val).getString().trim();
- }
- } else if (var.equals("pid")) { //$NON-NLS-1$
- // Available starting with GDB 7.2
- if (val instanceof MIConst) {
- pId = ((MIConst) val).getString().trim();
- }
- }
- }
-
- if (pId == null) {
- // Before GDB 7.2, the groupId was the pid of the process
- pId = groupId;
- }
+ }
+ } else if (oobr instanceof MINotifyAsyncOutput) {
+ // Parse the string and dispatch the corresponding event
+ MINotifyAsyncOutput exec = (MINotifyAsyncOutput) oobr;
+ String miEvent = exec.getAsyncClass();
+ if ("thread-created".equals(miEvent) || "thread-exited".equals(miEvent)) { //$NON-NLS-1$ //$NON-NLS-2$
+ String threadId = null;
+ String groupId = null;
+
+ MIResult[] results = exec.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ MIValue val = results[i].getMIValue();
+ if (var.equals("group-id")) { //$NON-NLS-1$
+ if (val instanceof MIConst) {
+ groupId = ((MIConst) val).getString();
+ }
+ } else if (var.equals("id")) { //$NON-NLS-1$
+ if (val instanceof MIConst) {
+ threadId = ((MIConst) val).getString();
+ }
+ }
+ }
+ // Until GDB is officially supporting multi-process, we may not get
+ // a groupId. In this case, we are running single process and we'll
+ // need its groupId
+ if (groupId == null) {
+ groupId = MIProcesses.UNIQUE_GROUP_ID;
+ }
+
+ // Here, threads are created and removed. We cannot use the IMIProcesses service
+ // to map a threadId to a groupId, because there would be a race condition.
+ // Since we have the groupId anyway, we have no problems.
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
- if (pId != null && procService != null) {
- IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, pId);
-
- MIEvent<?> event = new MIThreadGroupCreatedEvent(procDmc, exec.getToken(), groupId);
- fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
- }
- } else if ("thread-group-exited".equals(miEvent)) { //$NON-NLS-1$
- String groupId = null;
-
- MIResult[] results = exec.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- MIValue val = results[i].getMIValue();
- if (var.equals("id")) { //$NON-NLS-1$
- if (val instanceof MIConst) {
- groupId = ((MIConst) val).getString().trim();
- }
- }
- }
-
+
+ if (procService != null) {
+ IContainerDMContext processContainerDmc = procService
+ .createContainerContextFromGroupId(fControlDmc, groupId);
+
+ MIEvent<?> event = null;
+ if ("thread-created".equals(miEvent)) { //$NON-NLS-1$
+ event = new MIThreadCreatedEvent(processContainerDmc, exec.getToken(), threadId);
+ } else if ("thread-exited".equals(miEvent)) { //$NON-NLS-1$
+ event = new MIThreadExitEvent(processContainerDmc, exec.getToken(), threadId);
+ } else {
+ assert false; // earlier check should have guaranteed this isn't possible
+ }
+
+ fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
+ }
+ } else if ("thread-group-added".equals(miEvent)) { //$NON-NLS-1$
+ // With GDB >= 7.2
+ String groupId = null;
+
+ MIResult[] results = exec.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ MIValue val = results[i].getMIValue();
+ if (var.equals("id")) { //$NON-NLS-1$
+ if (val instanceof MIConst) {
+ groupId = ((MIConst) val).getString().trim();
+ }
+ }
+ }
+
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
- if (procService != null) {
- IContainerDMContext containerDmc = procService.createContainerContextFromGroupId(fControlDmc, groupId);
- IProcessDMContext procDmc = DMContexts.getAncestorOfType(containerDmc, IProcessDMContext.class);
-
- MIEvent<?> event = new MIThreadGroupExitedEvent(procDmc, exec.getToken(), exec.getMIResults());
- fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
- }
- }
+ if (procService != null) {
+ // When a thread-group is first added, there is no process and therefore no pid, so we use UNKNOWN_PROCESS_ID
+ IProcessDMContext processDmc = procService.createProcessContext(fCommandControl.getContext(),
+ MIProcesses.UNKNOWN_PROCESS_ID);
+ MIEvent<?> event = new MIThreadGroupAddedEvent(processDmc, exec.getToken(), groupId);
+ fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
+ }
+ } else if ("thread-group-created".equals(miEvent) || "thread-group-started".equals(miEvent)) { //$NON-NLS-1$ //$NON-NLS-2$
+ // =thread-group-created was used for GDB 7.0 and 7.1,
+ // but then became =thread-group-started starting with GDB 7.2
+ String groupId = null;
+ String pId = null;
+
+ MIResult[] results = exec.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ MIValue val = results[i].getMIValue();
+ if (var.equals("id")) { //$NON-NLS-1$
+ if (val instanceof MIConst) {
+ groupId = ((MIConst) val).getString().trim();
+ }
+ } else if (var.equals("pid")) { //$NON-NLS-1$
+ // Available starting with GDB 7.2
+ if (val instanceof MIConst) {
+ pId = ((MIConst) val).getString().trim();
+ }
+ }
+ }
+
+ if (pId == null) {
+ // Before GDB 7.2, the groupId was the pid of the process
+ pId = groupId;
+ }
+
+ IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
+ if (pId != null && procService != null) {
+ IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, pId);
+
+ MIEvent<?> event = new MIThreadGroupCreatedEvent(procDmc, exec.getToken(), groupId);
+ fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
+ }
+ } else if ("thread-group-exited".equals(miEvent)) { //$NON-NLS-1$
+ String groupId = null;
+
+ MIResult[] results = exec.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ MIValue val = results[i].getMIValue();
+ if (var.equals("id")) { //$NON-NLS-1$
+ if (val instanceof MIConst) {
+ groupId = ((MIConst) val).getString().trim();
+ }
+ }
+ }
+
+ IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
+ if (procService != null) {
+ IContainerDMContext containerDmc = procService.createContainerContextFromGroupId(fControlDmc,
+ groupId);
+ IProcessDMContext procDmc = DMContexts.getAncestorOfType(containerDmc, IProcessDMContext.class);
+
+ MIEvent<?> event = new MIThreadGroupExitedEvent(procDmc, exec.getToken(), exec.getMIResults());
+ fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
+ }
+ }
} else if (oobr instanceof MIConsoleStreamOutput) {
MIConsoleStreamOutput stream = (MIConsoleStreamOutput) oobr;
if (stream.getCString().startsWith("Program terminated with signal")) {//$NON-NLS-1$
@@ -332,144 +331,153 @@ public class MIRunControlEventProcessor_7_0
fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
}
}
- }
- }
- }
-
- @ConfinedToDsfExecutor("")
- protected MIEvent<?> createEvent(String reason, MIExecAsyncOutput exec) {
- MIEvent<?> event = null;
-
- if ("exited-normally".equals(reason) || "exited".equals(reason)) { //$NON-NLS-1$ //$NON-NLS-2$
- event = MIInferiorExitEvent.parse(fCommandControl.getContext(), exec.getToken(), exec.getMIResults());
- } else if ("exited-signalled".equals(reason)) { //$NON-NLS-1$
- event = MIInferiorSignalExitEvent.parse(fCommandControl.getContext(), exec.getToken(), exec.getMIResults());
- } else {
-
- String threadId = null;
- String groupId = null;
-
- MIResult[] results = exec.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- MIValue val = results[i].getMIValue();
-
- if (var.equals("thread-id")) { //$NON-NLS-1$
- if (val instanceof MIConst) {
- threadId = ((MIConst)val).getString();
- }
- } else if (var.equals("group-id")) { //$NON-NLS-1$
- if (val instanceof MIConst) {
- groupId = ((MIConst)val).getString();
- }
- }
- }
-
- IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
- if (procService == null) {
- return null;
- }
-
- IProcessDMContext procDmc = null;
- IContainerDMContext containerDmc = null;
- if (groupId == null) {
- // MI does not currently provide the group-id in these events
-
- // In some cases, gdb sends a bare stopped event. Likely a bug, but
- // we need to react to it all the same. See bug 311118.
- if (threadId == null) {
- threadId = "all"; //$NON-NLS-1$
- }
-
- containerDmc = procService.createContainerContextFromThreadId(fControlDmc, threadId);
- procDmc = DMContexts.getAncestorOfType(containerDmc, IProcessDMContext.class);
- } else {
- // This code would only trigger if the groupId was provided by MI
- containerDmc = procService.createContainerContextFromGroupId(fControlDmc, groupId);
- }
-
- IExecutionDMContext execDmc = containerDmc;
- if (threadId != null && !threadId.equals("all")) { //$NON-NLS-1$
- IThreadDMContext threadDmc = procService.createThreadContext(procDmc, threadId);
- execDmc = procService.createExecutionContext(containerDmc, threadDmc, threadId);
- }
-
- if (execDmc == null) {
- // Badly formatted event
- return null;
- }
-
- if ("breakpoint-hit".equals(reason)) { //$NON-NLS-1$
- event = MIBreakpointHitEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
- } else if (
- "watchpoint-trigger".equals(reason) //$NON-NLS-1$
- || "read-watchpoint-trigger".equals(reason) //$NON-NLS-1$
- || "access-watchpoint-trigger".equals(reason)) { //$NON-NLS-1$
- event = MIWatchpointTriggerEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
- } else if ("watchpoint-scope".equals(reason)) { //$NON-NLS-1$
- event = MIWatchpointScopeEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
- } else if ("end-stepping-range".equals(reason)) { //$NON-NLS-1$
- event = MISteppingRangeEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
- } else if ("signal-received".equals(reason)) { //$NON-NLS-1$
- event = MISignalEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
- } else if ("location-reached".equals(reason)) { //$NON-NLS-1$
- event = MILocationReachedEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
- } else if ("function-finished".equals(reason)) { //$NON-NLS-1$
- event = MIFunctionFinishedEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
- } else if ("solib-event".equals(reason)) { //$NON-NLS-1$
- event = MISharedLibEvent.parse(execDmc, exec.getToken(), exec.getMIResults(), null);
- } else if (STOPPED_REASON.equals(reason)) {
- event = MIStoppedEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
- } else if (RUNNING_REASON.equals(reason)) {
- // Retrieve the type of command from what we last stored
- int type = MIRunningEvent.CONTINUE;
- if (fLastRunningCmdType != null) {
- type = fLastRunningCmdType;
- fLastRunningCmdType = null;
- }
- event = new MIRunningEvent(execDmc, exec.getToken(), type);
- }
- }
- return event;
- }
-
+ }
+ }
+ }
+
+ @ConfinedToDsfExecutor("")
+ protected MIEvent<?> createEvent(String reason, MIExecAsyncOutput exec) {
+ MIEvent<?> event = null;
+
+ if ("exited-normally".equals(reason) || "exited".equals(reason)) { //$NON-NLS-1$ //$NON-NLS-2$
+ event = MIInferiorExitEvent.parse(fCommandControl.getContext(), exec.getToken(), exec.getMIResults());
+ } else if ("exited-signalled".equals(reason)) { //$NON-NLS-1$
+ event = MIInferiorSignalExitEvent.parse(fCommandControl.getContext(), exec.getToken(), exec.getMIResults());
+ } else {
+
+ String threadId = null;
+ String groupId = null;
+
+ MIResult[] results = exec.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ MIValue val = results[i].getMIValue();
+
+ if (var.equals("thread-id")) { //$NON-NLS-1$
+ if (val instanceof MIConst) {
+ threadId = ((MIConst) val).getString();
+ }
+ } else if (var.equals("group-id")) { //$NON-NLS-1$
+ if (val instanceof MIConst) {
+ groupId = ((MIConst) val).getString();
+ }
+ }
+ }
+
+ IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
+ if (procService == null) {
+ return null;
+ }
+
+ IProcessDMContext procDmc = null;
+ IContainerDMContext containerDmc = null;
+ if (groupId == null) {
+ // MI does not currently provide the group-id in these events
+
+ // In some cases, gdb sends a bare stopped event. Likely a bug, but
+ // we need to react to it all the same. See bug 311118.
+ if (threadId == null) {
+ threadId = "all"; //$NON-NLS-1$
+ }
+
+ containerDmc = procService.createContainerContextFromThreadId(fControlDmc, threadId);
+ procDmc = DMContexts.getAncestorOfType(containerDmc, IProcessDMContext.class);
+ } else {
+ // This code would only trigger if the groupId was provided by MI
+ containerDmc = procService.createContainerContextFromGroupId(fControlDmc, groupId);
+ }
+
+ IExecutionDMContext execDmc = containerDmc;
+ if (threadId != null && !threadId.equals("all")) { //$NON-NLS-1$
+ IThreadDMContext threadDmc = procService.createThreadContext(procDmc, threadId);
+ execDmc = procService.createExecutionContext(containerDmc, threadDmc, threadId);
+ }
+
+ if (execDmc == null) {
+ // Badly formatted event
+ return null;
+ }
+
+ if ("breakpoint-hit".equals(reason)) { //$NON-NLS-1$
+ event = MIBreakpointHitEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
+ } else if ("watchpoint-trigger".equals(reason) //$NON-NLS-1$
+ || "read-watchpoint-trigger".equals(reason) //$NON-NLS-1$
+ || "access-watchpoint-trigger".equals(reason)) { //$NON-NLS-1$
+ event = MIWatchpointTriggerEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
+ } else if ("watchpoint-scope".equals(reason)) { //$NON-NLS-1$
+ event = MIWatchpointScopeEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
+ } else if ("end-stepping-range".equals(reason)) { //$NON-NLS-1$
+ event = MISteppingRangeEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
+ } else if ("signal-received".equals(reason)) { //$NON-NLS-1$
+ event = MISignalEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
+ } else if ("location-reached".equals(reason)) { //$NON-NLS-1$
+ event = MILocationReachedEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
+ } else if ("function-finished".equals(reason)) { //$NON-NLS-1$
+ event = MIFunctionFinishedEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
+ } else if ("solib-event".equals(reason)) { //$NON-NLS-1$
+ event = MISharedLibEvent.parse(execDmc, exec.getToken(), exec.getMIResults(), null);
+ } else if (STOPPED_REASON.equals(reason)) {
+ event = MIStoppedEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
+ } else if (RUNNING_REASON.equals(reason)) {
+ // Retrieve the type of command from what we last stored
+ int type = MIRunningEvent.CONTINUE;
+ if (fLastRunningCmdType != null) {
+ type = fLastRunningCmdType;
+ fLastRunningCmdType = null;
+ }
+ event = new MIRunningEvent(execDmc, exec.getToken(), type);
+ }
+ }
+ return event;
+ }
+
@Override
- public void commandQueued(ICommandToken token) {
- // Do nothing.
- }
-
+ public void commandQueued(ICommandToken token) {
+ // Do nothing.
+ }
+
@Override
- public void commandSent(ICommandToken token) {
- // Do nothing.
- }
-
+ public void commandSent(ICommandToken token) {
+ // Do nothing.
+ }
+
@Override
- public void commandRemoved(ICommandToken token) {
- // Do nothing.
- }
-
+ public void commandRemoved(ICommandToken token) {
+ // Do nothing.
+ }
+
@Override
- public void commandDone(ICommandToken token, ICommandResult result) {
- ICommand<?> cmd = token.getCommand();
- MIInfo cmdResult = (MIInfo) result ;
- MIOutput output = cmdResult.getMIOutput();
- MIResultRecord rr = output.getMIResultRecord();
- if (rr != null) {
- // Check if the state changed.
- String state = rr.getResultClass();
- if (RUNNING_REASON.equals(state)) {
- // Store the type of command that is the trigger for the coming
- // *running event
- if (cmd instanceof MIExecNext) { fLastRunningCmdType = MIRunningEvent.NEXT; }
- else if (cmd instanceof MIExecNextInstruction) { fLastRunningCmdType = MIRunningEvent.NEXTI; }
- else if (cmd instanceof MIExecStep) { fLastRunningCmdType = MIRunningEvent.STEP; }
- else if (cmd instanceof MIExecStepInstruction) { fLastRunningCmdType = MIRunningEvent.STEPI; }
- else if (cmd instanceof MIExecUntil) { fLastRunningCmdType = MIRunningEvent.UNTIL; }
- else if (cmd instanceof MIExecFinish) { fLastRunningCmdType = MIRunningEvent.FINISH; }
- else if (cmd instanceof MIExecReturn) { fLastRunningCmdType = MIRunningEvent.RETURN; }
- else if (cmd instanceof MIExecContinue) { fLastRunningCmdType = MIRunningEvent.CONTINUE; }
- else { fLastRunningCmdType = MIRunningEvent.CONTINUE; }
- }
- }
- }
+ public void commandDone(ICommandToken token, ICommandResult result) {
+ ICommand<?> cmd = token.getCommand();
+ MIInfo cmdResult = (MIInfo) result;
+ MIOutput output = cmdResult.getMIOutput();
+ MIResultRecord rr = output.getMIResultRecord();
+ if (rr != null) {
+ // Check if the state changed.
+ String state = rr.getResultClass();
+ if (RUNNING_REASON.equals(state)) {
+ // Store the type of command that is the trigger for the coming
+ // *running event
+ if (cmd instanceof MIExecNext) {
+ fLastRunningCmdType = MIRunningEvent.NEXT;
+ } else if (cmd instanceof MIExecNextInstruction) {
+ fLastRunningCmdType = MIRunningEvent.NEXTI;
+ } else if (cmd instanceof MIExecStep) {
+ fLastRunningCmdType = MIRunningEvent.STEP;
+ } else if (cmd instanceof MIExecStepInstruction) {
+ fLastRunningCmdType = MIRunningEvent.STEPI;
+ } else if (cmd instanceof MIExecUntil) {
+ fLastRunningCmdType = MIRunningEvent.UNTIL;
+ } else if (cmd instanceof MIExecFinish) {
+ fLastRunningCmdType = MIRunningEvent.FINISH;
+ } else if (cmd instanceof MIExecReturn) {
+ fLastRunningCmdType = MIRunningEvent.RETURN;
+ } else if (cmd instanceof MIExecContinue) {
+ fLastRunningCmdType = MIRunningEvent.CONTINUE;
+ } else {
+ fLastRunningCmdType = MIRunningEvent.CONTINUE;
+ }
+ }
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor_7_12.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor_7_12.java
index f06d5f1955b..07da6701004 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor_7_12.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor_7_12.java
@@ -21,14 +21,14 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
/**
* Listens to events on the MI channel and takes proper action.
* Specialization for GDB 7.12.
- *
+ *
* @since 5.3
*/
public class MIRunControlEventProcessor_7_12 extends MIRunControlEventProcessor_7_0
{
private final AbstractMIControl fCommandControl;
- private final ICommandControlDMContext fControlDmc;
+ private final ICommandControlDMContext fControlDmc;
public MIRunControlEventProcessor_7_12(AbstractMIControl connection, ICommandControlDMContext controlDmc) {
super(connection, controlDmc);
@@ -38,7 +38,7 @@ public class MIRunControlEventProcessor_7_12 extends MIRunControlEventProcessor_
@Override
public void eventReceived(Object output) {
- for (MIOOBRecord oobr : ((MIOutput)output).getMIOOBRecords()) {
+ for (MIOOBRecord oobr : ((MIOutput) output).getMIOOBRecords()) {
if (oobr instanceof MIConsoleStreamOutput) {
MIConsoleStreamOutput stream = (MIConsoleStreamOutput) oobr;
if (stream.getCString().indexOf("(y or n)") != -1 && //$NON-NLS-1$
@@ -51,7 +51,7 @@ public class MIRunControlEventProcessor_7_12 extends MIRunControlEventProcessor_
// we can't be sure it is the right answer, but it is better
// than simply hanging there forever.
fCommandControl.queueCommand(new RawCommand(fControlDmc, "y"), //$NON-NLS-1$
- new ImmediateDataRequestMonitor<MIInfo>());
+ new ImmediateDataRequestMonitor<MIInfo>());
}
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/Adjustable.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/Adjustable.java
index a340bb6135d..68e771b2056 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/Adjustable.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/Adjustable.java
@@ -15,15 +15,15 @@ package org.eclipse.cdt.dsf.mi.service.command.commands;
/**
* The implementor of this interface may adjust its output.
- *
+ *
* This is used for MICommands where the output of each option and/or parameter
* may be adjusted independently to conform to the current version of the MI
* interface.
- *
+ *
*/
public interface Adjustable {
-
+
String getValue();
-
+
String getAdjustedValue();
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIAddressableSize.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIAddressableSize.java
index 026a8cea8f7..173ba32c9b1 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIAddressableSize.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIAddressableSize.java
@@ -25,21 +25,21 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
* <br>
* This is
* then resolved by retrieving a hex representation of -1 casted to the size of
- * a "char"
+ * a "char"
* <br>
- * <br>E.g. from GDB command line
+ * <br>E.g. from GDB command line
* <br>
- * > p/x (char)-1 <br>
+ * > p/x (char)-1 <br>
* > $7 = 0xffff <br>
- *
+ *
* <p>Since two hex characters are representing one octet, for the above example
* this method should return 2</p>
- *
+ *
* @since 4.4
*/
public class CLIAddressableSize extends MIInterpreterExecConsole<CLIAddressableSizeInfo> {
- private static final String hexOfBitsContainedInChar = "p/x (char)-1"; //$NON-NLS-1$
+ private static final String hexOfBitsContainedInChar = "p/x (char)-1"; //$NON-NLS-1$
public CLIAddressableSize(IMemoryDMContext ctx) {
super(ctx, hexOfBitsContainedInChar);
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIAttach.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIAttach.java
index 57bef92ac04..993776312a5 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIAttach.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIAttach.java
@@ -25,10 +25,10 @@ public class CLIAttach extends CLICommand<MIInfo> {
public CLIAttach(IDMContext ctx, int pid) {
super(ctx, "attach " + Integer.toString(pid)); //$NON-NLS-1$
}
-
+
/**
- * @since 1.1
- */
+ * @since 1.1
+ */
public CLIAttach(ICommandControlDMContext ctx, String pid) {
super(ctx, "attach " + pid); //$NON-NLS-1$
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLICatch.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLICatch.java
index df85417f01a..9641e837c3e 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLICatch.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLICatch.java
@@ -22,7 +22,7 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
/**
* gdb 'catch' command. Even though the command has been around since gdb 6.6,
* it's still not supported in gdb 7.0 MI.
- *
+ *
* @since 3.0
*/
public class CLICatch extends CLICommand<CLICatchInfo> {
@@ -34,21 +34,21 @@ public class CLICatch extends CLICommand<CLICatchInfo> {
}
return oper.toString();
}
-
+
/**
* Constructor
* @param ctx the context for the command
- * @param event the type of event to be caught; one of the keywords documented in 'help catch'
+ * @param event the type of event to be caught; one of the keywords documented in 'help catch'
* @param args zero or more arguments particular to the 'event'
*/
- public CLICatch(IBreakpointsTargetDMContext ctx, String event, String[] args) {
+ public CLICatch(IBreakpointsTargetDMContext ctx, String event, String[] args) {
super(ctx, formOperation(event, args));
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.dsf.mi.service.command.commands.MICommand#getResult(org.eclipse.cdt.dsf.mi.service.command.output.MIOutput)
- */
- @Override
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.dsf.mi.service.command.commands.MICommand#getResult(org.eclipse.cdt.dsf.mi.service.command.output.MIOutput)
+ */
+ @Override
public MIInfo getResult(MIOutput MIresult) {
return new CLICatchInfo(MIresult);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLICommand.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLICommand.java
index 53a5f4fa473..fb16b4cfa07 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLICommand.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLICommand.java
@@ -21,15 +21,18 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
* Represents a CLI command.
*/
-public class CLICommand<V extends MIInfo> extends MICommand<V>
-{
- public CLICommand(IDMContext ctx, String oper) {
- super(ctx, oper);
- }
-
- @Override
- public boolean supportsThreadAndFrameOptions() { return false; }
-
- @Override
- public boolean supportsThreadGroupOption() { return false; }
+public class CLICommand<V extends MIInfo> extends MICommand<V> {
+ public CLICommand(IDMContext ctx, String oper) {
+ super(ctx, oper);
+ }
+
+ @Override
+ public boolean supportsThreadAndFrameOptions() {
+ return false;
+ }
+
+ @Override
+ public boolean supportsThreadGroupOption() {
+ return false;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIExecAbort.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIExecAbort.java
index e0096ef61ff..8fc7be7b3cf 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIExecAbort.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIExecAbort.java
@@ -19,18 +19,17 @@ import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommand
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
- *
+ *
* kill
*
* Terminates the user (MI inferior) process
- *
+ *
*/
-public class CLIExecAbort extends CLICommand<MIInfo>
-{
- /**
- * @since 1.1
- */
- public CLIExecAbort(ICommandControlDMContext ctx) {
- super(ctx, "kill"); //$NON-NLS-1$
- }
+public class CLIExecAbort extends CLICommand<MIInfo> {
+ /**
+ * @since 1.1
+ */
+ public CLIExecAbort(ICommandControlDMContext ctx) {
+ super(ctx, "kill"); //$NON-NLS-1$
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIInferior.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIInferior.java
index 49628286ab1..eb5028c57d2 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIInferior.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIInferior.java
@@ -16,12 +16,12 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
* Selects the specified inferior in GDB.
- *
+ *
* @since 5.2
*/
public class CLIInferior extends MIInterpreterExecConsole<MIInfo> {
- private static final String INFERIOR = "inferior "; //$NON-NLS-1$
+ private static final String INFERIOR = "inferior "; //$NON-NLS-1$
public CLIInferior(ICommandControlDMContext ctx, String inferiorId) {
super(ctx, INFERIOR + inferiorId);
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIInfoBreak.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIInfoBreak.java
index cc2726bf11e..0dde5725cfa 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIInfoBreak.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIInfoBreak.java
@@ -19,27 +19,27 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
/**
* 'info break [BP_REFERENCE]
- *
+ *
* will return information about the specified breakpoint. If no breakpoint is
- * specified, it will return information about all breakpoints.
- * We use it to find out to which inferior a breakpoint is applicable.
+ * specified, it will return information about all breakpoints.
+ * We use it to find out to which inferior a breakpoint is applicable.
* This information is not available from -break-list or -break-info until GDB 7.6.
- *
+ *
* @since 4.2
*/
public class CLIInfoBreak extends CLICommand<CLIInfoBreakInfo> {
- private static final String INFO_BREAK = "info break"; //$NON-NLS-1$
-
+ private static final String INFO_BREAK = "info break"; //$NON-NLS-1$
+
public CLIInfoBreak(IDMContext ctx) {
- super(ctx, INFO_BREAK);
+ super(ctx, INFO_BREAK);
};
public CLIInfoBreak(IDMContext ctx, int bpReference) {
super(ctx, INFO_BREAK + Integer.toString(bpReference));
}
-
- @Override
+
+ @Override
public CLIInfoBreakInfo getResult(MIOutput MIresult) {
return new CLIInfoBreakInfo(MIresult);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIInfoProgram.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIInfoProgram.java
index 1fef10c1fe5..32bc67fbd58 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIInfoProgram.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIInfoProgram.java
@@ -23,13 +23,13 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
*/
public class CLIInfoProgram extends CLICommand<CLIInfoProgramInfo> {
- public CLIInfoProgram(IContainerDMContext ctx) {
+ public CLIInfoProgram(IContainerDMContext ctx) {
super(ctx, "info program"); //$NON-NLS-1$
}
@Override
public CLIInfoProgramInfo getResult(MIOutput output) {
- return (CLIInfoProgramInfo)getMIInfo(output);
+ return (CLIInfoProgramInfo) getMIInfo(output);
}
public MIInfo getMIInfo(MIOutput out) {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIInfoRecord.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIInfoRecord.java
index 077bd34a9a3..480e3cb2c48 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIInfoRecord.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIInfoRecord.java
@@ -23,10 +23,10 @@ import org.eclipse.cdt.dsf.mi.service.command.output.CLIInfoRecordInfo;
*/
public class CLIInfoRecord extends MIInterpreterExecConsole<CLIInfoRecordInfo> {
private static final String COMMAND = "info record"; //$NON-NLS-1$
-
+
public CLIInfoRecord(ICommandControlDMContext ctx) {
- super(ctx, COMMAND);
- }
+ super(ctx, COMMAND);
+ }
@Override
public MIInfo getResult(MIOutput out) {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIInfoSharedLibrary.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIInfoSharedLibrary.java
index 02551f83f7e..62b82d74b48 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIInfoSharedLibrary.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIInfoSharedLibrary.java
@@ -15,7 +15,6 @@
package org.eclipse.cdt.dsf.mi.service.command.commands;
-
import org.eclipse.cdt.dsf.debug.service.IModules.IModuleDMContext;
import org.eclipse.cdt.dsf.debug.service.IModules.ISymbolDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.CLIInfoSharedLibraryInfo;
@@ -23,23 +22,25 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
/**
- *
+ *
* info sharedlibrary
*
*/
public class CLIInfoSharedLibrary extends CLICommand<CLIInfoSharedLibraryInfo> {
-
+
public CLIInfoSharedLibrary(ISymbolDMContext ctx) {
super(ctx, "info sharedlibrary"); //$NON-NLS-1$
}
+
public CLIInfoSharedLibrary(IModuleDMContext ctx) {
super(ctx, "info sharedlibrary"); //$NON-NLS-1$
}
+
@Override
public CLIInfoSharedLibraryInfo getResult(MIOutput output) {
- return (CLIInfoSharedLibraryInfo)getMIInfo(output);
+ return (CLIInfoSharedLibraryInfo) getMIInfo(output);
}
-
+
public MIInfo getMIInfo(MIOutput out) {
MIInfo info = null;
if (out != null) {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIInfoThreads.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIInfoThreads.java
index 004ac4168e6..15d4d4c8864 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIInfoThreads.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIInfoThreads.java
@@ -15,27 +15,25 @@
package org.eclipse.cdt.dsf.mi.service.command.commands;
-
-
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.CLIInfoThreadsInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
/**
- *
+ *
* info threads
*
*/
public class CLIInfoThreads extends CLICommand<CLIInfoThreadsInfo> {
- public CLIInfoThreads(IContainerDMContext ctx) {
+ public CLIInfoThreads(IContainerDMContext ctx) {
super(ctx, "info threads"); //$NON-NLS-1$
}
@Override
public CLIInfoThreadsInfo getResult(MIOutput output) {
- return (CLIInfoThreadsInfo)getMIInfo(output);
+ return (CLIInfoThreadsInfo) getMIInfo(output);
}
public MIInfo getMIInfo(MIOutput out) {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIJump.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIJump.java
index f0130fb8ff2..5eed7e848a8 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIJump.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIJump.java
@@ -20,7 +20,7 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
* jump LINESPEC
* jump LOCATION
* Resume execution at line LINESPEC or at address given by LOCATION.
- *
+ *
* @since 3.0
*/
public class CLIJump extends CLICommand<MIInfo> {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIPasscount.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIPasscount.java
index b83c35b123a..83785a60338 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIPasscount.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIPasscount.java
@@ -17,18 +17,17 @@ import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContex
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
- * Set the passcount of a tracepoint. The passcount is a way to automatically stop a trace experiment.
+ * Set the passcount of a tracepoint. The passcount is a way to automatically stop a trace experiment.
* If a tracepoint's passcount is N, then the trace experiment will be automatically stopped on the N'th
- * time that tracepoint is hit. If no passcount is given, the trace experiment will run until stopped
+ * time that tracepoint is hit. If no passcount is given, the trace experiment will run until stopped
* explicitly by the user.
* @since 3.0
*/
public class CLIPasscount extends CLICommand<MIInfo> {
- /** @since 5.0 */
- public CLIPasscount(IBreakpointsTargetDMContext ctx, String breakpoint, int passcount) {
- super(ctx, "passcount"); //$NON-NLS-1$
+ /** @since 5.0 */
+ public CLIPasscount(IBreakpointsTargetDMContext ctx, String breakpoint, int passcount) {
+ super(ctx, "passcount"); //$NON-NLS-1$
setParameters(new String[] { Integer.toString(passcount), breakpoint });
- }
+ }
}
-
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIRecord.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIRecord.java
index a839c6b8782..b3e54912916 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIRecord.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIRecord.java
@@ -20,7 +20,7 @@ import org.eclipse.cdt.debug.core.model.IChangeReverseMethodHandler.ReverseDebug
/**
* This command turns on on off the recording of "Process Record and Replay".
- *
+ *
* @since 3.0
*/
public class CLIRecord extends CLICommand<MIInfo> {
@@ -31,28 +31,27 @@ public class CLIRecord extends CLICommand<MIInfo> {
/** Only available for GDB >= 7.10 */
/** @since 5.0 */
- public CLIRecord(ICommandControlDMContext ctx, ReverseDebugMethod traceMethod) {
- super(ctx, "record" + createRecordParams(traceMethod)); //$NON-NLS-1$
- }
+ public CLIRecord(ICommandControlDMContext ctx, ReverseDebugMethod traceMethod) {
+ super(ctx, "record" + createRecordParams(traceMethod)); //$NON-NLS-1$
+ }
- private static String createRecordParams(ReverseDebugMethod traceMethod)
- {
- String recordParam;
+ private static String createRecordParams(ReverseDebugMethod traceMethod) {
+ String recordParam;
- if (traceMethod == ReverseDebugMethod.OFF) {
- recordParam = " stop"; //$NON-NLS-1$
- } else if (traceMethod == ReverseDebugMethod.SOFTWARE) {
- recordParam = " full"; //$NON-NLS-1$
- } else if (traceMethod == ReverseDebugMethod.BRANCH_TRACE) {
- recordParam = " btrace bts"; //$NON-NLS-1$
- } else if (traceMethod == ReverseDebugMethod.PROCESSOR_TRACE) {
- recordParam = " btrace pt"; //$NON-NLS-1$
- } else if (traceMethod == ReverseDebugMethod.GDB_TRACE) {
- recordParam = " btrace"; //$NON-NLS-1$
- } else {// no trace method defined
- recordParam = ""; //$NON-NLS-1$
- }
+ if (traceMethod == ReverseDebugMethod.OFF) {
+ recordParam = " stop"; //$NON-NLS-1$
+ } else if (traceMethod == ReverseDebugMethod.SOFTWARE) {
+ recordParam = " full"; //$NON-NLS-1$
+ } else if (traceMethod == ReverseDebugMethod.BRANCH_TRACE) {
+ recordParam = " btrace bts"; //$NON-NLS-1$
+ } else if (traceMethod == ReverseDebugMethod.PROCESSOR_TRACE) {
+ recordParam = " btrace pt"; //$NON-NLS-1$
+ } else if (traceMethod == ReverseDebugMethod.GDB_TRACE) {
+ recordParam = " btrace"; //$NON-NLS-1$
+ } else {// no trace method defined
+ recordParam = ""; //$NON-NLS-1$
+ }
- return recordParam;
- }
+ return recordParam;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIRemote.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIRemote.java
index 7d9213fa442..4b09e23b742 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIRemote.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIRemote.java
@@ -18,13 +18,12 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
* Base class for the 'remote' command of GDB.
- *
+ *
* @since 4.1
*/
-public class CLIRemote extends CLICommand<MIInfo>
-{
- public CLIRemote(IDMContext ctx, String[] params) {
- super(ctx, "remote"); //$NON-NLS-1$
- setParameters(params);
- }
+public class CLIRemote extends CLICommand<MIInfo> {
+ public CLIRemote(IDMContext ctx, String[] params) {
+ super(ctx, "remote"); //$NON-NLS-1$
+ setParameters(params);
+ }
} \ No newline at end of file
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIRemoteGet.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIRemoteGet.java
index bd2bb0bf795..cb359026a6c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIRemoteGet.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIRemoteGet.java
@@ -20,9 +20,8 @@ import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommand
* Copy file targetfile from the target system to hostfile on the host system.
* @since 4.1
*/
-public class CLIRemoteGet extends CLIRemote
-{
+public class CLIRemoteGet extends CLIRemote {
public CLIRemoteGet(ICommandControlDMContext ctx, String targetfile, String hostfile) {
- super(ctx, new String[] { "get", targetfile, hostfile }); //$NON-NLS-1$
- }
+ super(ctx, new String[] { "get", targetfile, hostfile }); //$NON-NLS-1$
+ }
} \ No newline at end of file
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLISharedLibrary.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLISharedLibrary.java
index 5a49fe94482..74510a8bc71 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLISharedLibrary.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLISharedLibrary.java
@@ -23,11 +23,11 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
* expression. As with files loaded automatically, it only loads shared
* libraries required by your program for a core file or after typing run. If
* regex is omitted all shared libraries required by your program are loaded.
- *
+ *
* @since 4.6
*/
public class CLISharedLibrary extends MIInterpreterExecConsole<MIInfo> {
- private static final String SHARED_LIBRARY = "sharedlibrary"; //$NON-NLS-1$
+ private static final String SHARED_LIBRARY = "sharedlibrary"; //$NON-NLS-1$
public CLISharedLibrary(ISymbolDMContext ctx) {
super(ctx, SHARED_LIBRARY);
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIShowEndian.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIShowEndian.java
index f46c87c2d3f..0df178fef36 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIShowEndian.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIShowEndian.java
@@ -10,7 +10,7 @@
*
* Contributors:
* Mentor Graphics - Initial API and implementation
- * John Dallaway - Add methods to get the endianness and address size (Bug 225609)
+ * John Dallaway - Add methods to get the endianness and address size (Bug 225609)
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command.commands;
@@ -21,12 +21,12 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
/**
* Returns the endianness of the current GDB target.
- *
+ *
* @since 4.2
*/
public class CLIShowEndian extends MIInterpreterExecConsole<CLIShowEndianInfo> {
- private static final String SHOW_ENDIAN = "show endian"; //$NON-NLS-1$
+ private static final String SHOW_ENDIAN = "show endian"; //$NON-NLS-1$
public CLIShowEndian(IMemoryDMContext ctx) {
super(ctx, SHOW_ENDIAN);
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLISource.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLISource.java
index b12c4b9e607..442463e2ae4 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLISource.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLISource.java
@@ -17,17 +17,17 @@ import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommand
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
- *
+ *
* source FILE
*
* Source a file of commands
- *
+ *
*/
public class CLISource extends CLICommand<MIInfo> {
- /**
- * @since 1.1
- */
- public CLISource(ICommandControlDMContext ctx, String file) {
- super(ctx, "source " + file); //$NON-NLS-1$
- }
+ /**
+ * @since 1.1
+ */
+ public CLISource(ICommandControlDMContext ctx, String file) {
+ super(ctx, "source " + file); //$NON-NLS-1$
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIThread.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIThread.java
index b516782f55d..211b0df92a0 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIThread.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIThread.java
@@ -19,17 +19,17 @@ import org.eclipse.cdt.dsf.mi.service.command.output.CLIThreadInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
/**
- *
+ *
* thread
- *
+ *
* [Current thread is 1 (Thread 0xb7cc56b0 (LWP 5488))]
- *
+ *
* @since 3.0
*
*/
public class CLIThread extends CLICommand<CLIThreadInfo> {
- public CLIThread(IContainerDMContext ctx) {
+ public CLIThread(IContainerDMContext ctx) {
super(ctx, "thread"); //$NON-NLS-1$
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLITrace.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLITrace.java
index 16482063446..6b0cf0c7be0 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLITrace.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLITrace.java
@@ -27,18 +27,18 @@ public class CLITrace extends CLICommand<CLITraceInfo> {
this(ctx, location, null);
}
- // In this particular case, because of a GDB peculiarity, setParameters() is
+ // In this particular case, because of a GDB peculiarity, setParameters() is
// not used and the whole command is formatted on the parent's constructor.
// See bug 213076 for more information.
public CLITrace(IBreakpointsTargetDMContext ctx, String location, String condition) {
super(ctx, "trace " + location + //$NON-NLS-1$
- ((condition != null && condition.trim().length() > 0) ? " if " + condition : "")); //$NON-NLS-1$ //$NON-NLS-2$
+ ((condition != null && condition.trim().length() > 0) ? " if " + condition : "")); //$NON-NLS-1$ //$NON-NLS-2$
}
-
+
@Override
public CLITraceInfo getResult(MIOutput output) {
- return (CLITraceInfo)getMIInfo(output);
+ return (CLITraceInfo) getMIInfo(output);
}
public MIInfo getMIInfo(MIOutput out) {
@@ -49,4 +49,3 @@ public class CLITrace extends CLICommand<CLITraceInfo> {
return info;
}
}
-
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLITraceDump.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLITraceDump.java
index 21ec997761b..453edd3a7bf 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLITraceDump.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLITraceDump.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Ericsson
+ * Copyright (c) 2011 Ericsson
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -17,23 +17,22 @@ import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl.ITraceRecordDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
import org.eclipse.cdt.dsf.mi.service.command.output.CLITraceDumpInfo;
-
/**
* GDB tdump CLI command.
* @since 4.0
*
*/
public class CLITraceDump extends CLICommand<CLITraceDumpInfo> {
-
+
/**
* @param ctx trace context
*/
public CLITraceDump(ITraceRecordDMContext ctx) {
super(ctx, "tdump"); //$NON-NLS-1$
}
-
- @Override
- public CLITraceDumpInfo getResult(MIOutput out) {
- return new CLITraceDumpInfo(out);
- }
-} \ No newline at end of file
+
+ @Override
+ public CLITraceDumpInfo getResult(MIOutput out) {
+ return new CLITraceDumpInfo(out);
+ }
+} \ No newline at end of file
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIUnsetEnv.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIUnsetEnv.java
index c18c48638bd..e5fd50c0f5b 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIUnsetEnv.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIUnsetEnv.java
@@ -17,12 +17,12 @@ import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommand
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
- *
+ *
* unset env [VARNAME]
- *
+ *
* Deletes the environment variable VARNAME for the inferior, not GDB itself.
* If VARNAME is omitted, all environment variables are deleted.
- *
+ *
* @since 3.0
*/
public class CLIUnsetEnv extends CLICommand<MIInfo> {
@@ -33,7 +33,7 @@ public class CLIUnsetEnv extends CLICommand<MIInfo> {
public CLIUnsetEnv(ICommandControlDMContext ctx) {
this(ctx, null);
}
-
+
/**
* Delete the environment variable specified by 'name'
* If 'name' is null, all variables will be deleted.
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIUnsetSubstitutePath.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIUnsetSubstitutePath.java
index 48827180db6..8fadc9a4033 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIUnsetSubstitutePath.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIUnsetSubstitutePath.java
@@ -18,9 +18,9 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
* unset substitute-path
- *
+ *
* Deletes all the path substitutions.
- *
+ *
* @since 5.0
*/
public class CLIUnsetSubstitutePath extends MIInterpreterExecConsole<MIInfo> {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/ExprMetaCommand.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/ExprMetaCommand.java
index e728fd50165..1d7a5b61c17 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/ExprMetaCommand.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/ExprMetaCommand.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
@@ -21,54 +21,56 @@ import org.eclipse.cdt.dsf.debug.service.command.ICommandResult;
public class ExprMetaCommand<V extends ICommandResult> implements ICommand<V> {
- private final IDMContext fCtx;
-
- public ExprMetaCommand(IDMContext ctx) {
- fCtx = ctx;
- }
-
- /*
- * Takes the supplied command and coalesces it with this one.
- * The result is a new third command which represent the two
- * original command.
- */
+ private final IDMContext fCtx;
+
+ public ExprMetaCommand(IDMContext ctx) {
+ fCtx = ctx;
+ }
+
+ /*
+ * Takes the supplied command and coalesces it with this one.
+ * The result is a new third command which represent the two
+ * original command.
+ */
+ @Override
+ public ICommand<? extends ICommandResult> coalesceWith(ICommand<? extends ICommandResult> command) {
+ return null;
+ }
+
+ @Override
+ public IDMContext getContext() {
+ return fCtx;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == null)
+ return false;
+ if (!(other.getClass().equals(getClass())))
+ return false;
+
+ // Since other is the same class is this, we are sure it is of type DsfExprMetaCommand also
+ ExprMetaCommand<?> otherCmd = (ExprMetaCommand<?>) other;
+ return fCtx == null ? otherCmd.fCtx == null : fCtx.equals(otherCmd.fCtx);
+ }
+
@Override
- public ICommand<? extends ICommandResult> coalesceWith( ICommand<? extends ICommandResult> command ) {
- return null ;
- }
+ public int hashCode() {
+ return fCtx == null ? getClass().hashCode() : getClass().hashCode() ^ fCtx.hashCode();
+ }
@Override
- public IDMContext getContext(){
- return fCtx;
- }
+ public String toString() {
+ IExpressionDMContext exprDmc = DMContexts.getAncestorOfType(fCtx, IExpressionDMContext.class);
+ if (exprDmc != null) {
+ return getClass().getSimpleName() + "(\"" + //$NON-NLS-1$
+ exprDmc.getExpression() + "\")"; //$NON-NLS-1$
+ } else {
+ return getClass().getName() + (fCtx == null ? "null" : fCtx.toString()); //$NON-NLS-1$
+ }
+ }
- @Override
- public boolean equals(Object other) {
- if (other == null) return false;
- if (!(other.getClass().equals(getClass()))) return false;
-
- // Since other is the same class is this, we are sure it is of type DsfExprMetaCommand also
- ExprMetaCommand<?> otherCmd = (ExprMetaCommand<?>)other;
- return fCtx == null ? otherCmd.fCtx == null : fCtx.equals(otherCmd.fCtx);
- }
-
- @Override
- public int hashCode() {
- return fCtx == null ? getClass().hashCode() : getClass().hashCode() ^ fCtx.hashCode();
- }
-
- @Override
- public String toString() {
- IExpressionDMContext exprDmc = DMContexts.getAncestorOfType(fCtx, IExpressionDMContext.class);
- if (exprDmc != null) {
- return getClass().getSimpleName() + "(\"" + //$NON-NLS-1$
- exprDmc.getExpression() + "\")"; //$NON-NLS-1$
- } else {
- return getClass().getName() + (fCtx == null ? "null" : fCtx.toString()); //$NON-NLS-1$
- }
- }
-
- public String getCommandControlFilter() {
- return null;
- }
+ public String getCommandControlFilter() {
+ return null;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/ExprMetaGetAttributes.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/ExprMetaGetAttributes.java
index 5957fa1bc94..d5ddd4b9704 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/ExprMetaGetAttributes.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/ExprMetaGetAttributes.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/ExprMetaGetChildCount.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/ExprMetaGetChildCount.java
index 8165a046d21..00e0fa370c8 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/ExprMetaGetChildCount.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/ExprMetaGetChildCount.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
* Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121)
@@ -21,7 +21,7 @@ import org.eclipse.cdt.dsf.mi.service.command.output.ExprMetaGetChildCountInfo;
public class ExprMetaGetChildCount extends ExprMetaCommand<ExprMetaGetChildCountInfo> {
private int numChildLimit = IMIExpressions.CHILD_COUNT_LIMIT_UNSPECIFIED;
-
+
public ExprMetaGetChildCount(IExpressionDMContext ctx) {
super(ctx);
}
@@ -29,14 +29,14 @@ public class ExprMetaGetChildCount extends ExprMetaCommand<ExprMetaGetChildCount
/**
* @param ctx
* @param numChildLimit
- *
+ *
* @since 4.0
*/
public ExprMetaGetChildCount(IExpressionDMContext ctx, int numChildLimit) {
super(ctx);
this.numChildLimit = numChildLimit;
}
-
+
/**
* @since 4.0
*/
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/ExprMetaGetChildren.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/ExprMetaGetChildren.java
index ddd99b74a1a..469365e715f 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/ExprMetaGetChildren.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/ExprMetaGetChildren.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
* Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121)
@@ -21,22 +21,22 @@ import org.eclipse.cdt.dsf.mi.service.command.output.ExprMetaGetChildrenInfo;
public class ExprMetaGetChildren extends ExprMetaCommand<ExprMetaGetChildrenInfo> {
private int numChildLimit = IMIExpressions.CHILD_COUNT_LIMIT_UNSPECIFIED;
-
+
public ExprMetaGetChildren(IExpressionDMContext ctx) {
super(ctx);
}
-
+
/**
* @param ctx
* @param numChildLimit
- *
+ *
* @since 4.0
*/
public ExprMetaGetChildren(IExpressionDMContext ctx, int numChildLimit) {
super(ctx);
this.numChildLimit = numChildLimit;
}
-
+
/**
* @since 4.0
*/
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/ExprMetaGetValue.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/ExprMetaGetValue.java
index 7e9ebb4c016..a1a41ee7484 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/ExprMetaGetValue.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/ExprMetaGetValue.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
@@ -23,16 +23,16 @@ public class ExprMetaGetValue extends ExprMetaCommand<ExprMetaGetValueInfo> {
public ExprMetaGetValue(FormattedValueDMContext ctx) {
super(ctx);
}
-
- @Override
- public String toString() {
- IExpressionDMContext exprDmc = DMContexts.getAncestorOfType(getContext(), IExpressionDMContext.class);
- if (exprDmc != null) {
- return getClass().getSimpleName() + "(\"" + //$NON-NLS-1$
- exprDmc.getExpression() + "\", " + //$NON-NLS-1$
- ((FormattedValueDMContext)getContext()).getFormatID() + ")"; //$NON-NLS-1$
- } else {
- return super.toString();
- }
- }
+
+ @Override
+ public String toString() {
+ IExpressionDMContext exprDmc = DMContexts.getAncestorOfType(getContext(), IExpressionDMContext.class);
+ if (exprDmc != null) {
+ return getClass().getSimpleName() + "(\"" + //$NON-NLS-1$
+ exprDmc.getExpression() + "\", " + //$NON-NLS-1$
+ ((FormattedValueDMContext) getContext()).getFormatID() + ")"; //$NON-NLS-1$
+ } else {
+ return super.toString();
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/ExprMetaGetVar.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/ExprMetaGetVar.java
index e68f8d0a903..c3facddd566 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/ExprMetaGetVar.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/ExprMetaGetVar.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIAddInferior.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIAddInferior.java
index 2ce30f0b63f..e3d138e4eb1 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIAddInferior.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIAddInferior.java
@@ -18,26 +18,24 @@ import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommand
import org.eclipse.cdt.dsf.mi.service.command.output.MIAddInferiorInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
-
-/**
+/**
* -add-inferior
* ^done,inferior="i2"
- *
- * Creates a new inferior. The created inferior is not associated with any executable.
+ *
+ * Creates a new inferior. The created inferior is not associated with any executable.
* Such association may be established with the '-file-exec-and-symbols' command.
- * The command response has a single field, 'thread-group', whose value is the
+ * The command response has a single field, 'thread-group', whose value is the
* identifier of the thread group corresponding to the new inferior.
- *
+ *
* @since 4.0
*/
-public class MIAddInferior extends MICommand<MIAddInferiorInfo>
-{
- public MIAddInferior(ICommandControlDMContext dmc) {
- super(dmc, "-add-inferior"); //$NON-NLS-1$
- }
-
- @Override
- public MIAddInferiorInfo getResult(MIOutput output) {
- return new MIAddInferiorInfo(output);
- }
+public class MIAddInferior extends MICommand<MIAddInferiorInfo> {
+ public MIAddInferior(ICommandControlDMContext dmc) {
+ super(dmc, "-add-inferior"); //$NON-NLS-1$
+ }
+
+ @Override
+ public MIAddInferiorInfo getResult(MIOutput output) {
+ return new MIAddInferiorInfo(output);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakAfter.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakAfter.java
index 468d3a57f9f..815c34f4f22 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakAfter.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakAfter.java
@@ -18,18 +18,17 @@ import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContex
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
- *
+ *
* -break-after NUMBER COUNT
*
* The breakpoint number NUMBER is not in effect until it has been hit
* COUNT times. The count becomes part of the `-break-list' output
* (see the description of the DsfMIBreakList).
*/
-
-public class MIBreakAfter extends MICommand<MIInfo>
-{
- /** @since 5.0 */
- public MIBreakAfter(IBreakpointsTargetDMContext ctx, String breakpoint, int ignoreCount) {
- super(ctx, "-break-after", new String[] { breakpoint, Integer.toString(ignoreCount) }); //$NON-NLS-1$
- }
+
+public class MIBreakAfter extends MICommand<MIInfo> {
+ /** @since 5.0 */
+ public MIBreakAfter(IBreakpointsTargetDMContext ctx, String breakpoint, int ignoreCount) {
+ super(ctx, "-break-after", new String[] { breakpoint, Integer.toString(ignoreCount) }); //$NON-NLS-1$
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakCommands.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakCommands.java
index 92eaeb1b10e..4bf880f6455 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakCommands.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakCommands.java
@@ -18,20 +18,19 @@ import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContex
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
- *
+ *
* -break-commands NUMBER [ COMMAND-1 ... COMMAND-N ]
- *
+ *
* Specifies the CLI commands that should be executed when breakpoint NUMBER is hit.
* The parameters COMMAND-1 to COMMAND-N are the commands. If no command is specified,
* any previously-set commands are cleared.
- *
+ *
* Available since GDB 7.0
- *
+ *
* @since 3.0
*/
-
-public class MIBreakCommands extends MICommand<MIInfo>
-{
+
+public class MIBreakCommands extends MICommand<MIInfo> {
/** @since 5.0 */
public MIBreakCommands(IBreakpointsTargetDMContext ctx, String breakpoint, String[] commands) {
super(ctx, "-break-commands"); //$NON-NLS-1$
@@ -41,7 +40,7 @@ public class MIBreakCommands extends MICommand<MIInfo>
String[] params = new String[commands.length + 1];
params[0] = breakpoint;
for (int i = 1; i < params.length; i++) {
- params[i] = commands[i-1];
+ params[i] = commands[i - 1];
}
setParameters(params);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakCondition.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakCondition.java
index 6fc050a98b9..ef91b0e2da0 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakCondition.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakCondition.java
@@ -26,8 +26,7 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
* (see the description of the DsfMIBreakList).
*/
-public class MIBreakCondition extends MICommand<MIInfo>
-{
+public class MIBreakCondition extends MICommand<MIInfo> {
/*
* MICommand wraps a parameter with double quotes if it contains a space.
* However, GDB does not want quotes around a condition.
@@ -41,9 +40,9 @@ public class MIBreakCondition extends MICommand<MIInfo>
*/
/** @since 5.0 */
public MIBreakCondition(IBreakpointsTargetDMContext ctx, String breakpoint, String condition) {
- super(ctx, "-break-condition"); //$NON-NLS-1$
+ super(ctx, "-break-condition"); //$NON-NLS-1$
- setParameters(new Adjustable[]{ new MIStandardParameterAdjustable(breakpoint),
- new MINoChangeAdjustable(condition) });
- }
+ setParameters(new Adjustable[] { new MIStandardParameterAdjustable(breakpoint),
+ new MINoChangeAdjustable(condition) });
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakDelete.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakDelete.java
index fc47a28b68d..a653c522c9e 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakDelete.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakDelete.java
@@ -19,28 +19,27 @@ import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContex
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
- *
+ *
* -break-delete ( BREAKPOINT )+
*
* Delete the breakpoint(s) whose number(s) are specified in the
* argument list. This is obviously reflected in the breakpoint list.
- *
+ *
* Result:
* ^done
*
*/
-
-public class MIBreakDelete extends MICommand<MIInfo>
-{
- /** @since 5.0 */
- public MIBreakDelete (IBreakpointsTargetDMContext ctx, String[] array) {
- super(ctx, "-break-delete"); //$NON-NLS-1$
- if (array != null && array.length > 0) {
- String[] brkids = new String[array.length];
- for (int i = 0; i < array.length; i++) {
- brkids[i] = array[i];
- }
- setParameters(brkids);
- }
- }
+
+public class MIBreakDelete extends MICommand<MIInfo> {
+ /** @since 5.0 */
+ public MIBreakDelete(IBreakpointsTargetDMContext ctx, String[] array) {
+ super(ctx, "-break-delete"); //$NON-NLS-1$
+ if (array != null && array.length > 0) {
+ String[] brkids = new String[array.length];
+ for (int i = 0; i < array.length; i++) {
+ brkids[i] = array[i];
+ }
+ setParameters(brkids);
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakDisable.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakDisable.java
index 4e76b7ba6c5..ac5a93d8998 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakDisable.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakDisable.java
@@ -19,27 +19,26 @@ import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContex
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
- *
+ *
* -break-disable ( BREAKPOINT )+
*
* Disable the named BREAKPOINT(s). The field `enabled' in the break
* list is now set to `n' for the named BREAKPOINT(s).
- *
+ *
* Result:
* ^done
*/
-
-public class MIBreakDisable extends MICommand<MIInfo>
-{
- /** @since 5.0 */
- public MIBreakDisable (IBreakpointsTargetDMContext ctx, String[] array) {
- super(ctx, "-break-disable"); //$NON-NLS-1$
- if (array != null && array.length > 0) {
- String[] brkids = new String[array.length];
- for (int i = 0; i < array.length; i++) {
- brkids[i] = array[i];
- }
- setParameters(brkids);
- }
- }
+
+public class MIBreakDisable extends MICommand<MIInfo> {
+ /** @since 5.0 */
+ public MIBreakDisable(IBreakpointsTargetDMContext ctx, String[] array) {
+ super(ctx, "-break-disable"); //$NON-NLS-1$
+ if (array != null && array.length > 0) {
+ String[] brkids = new String[array.length];
+ for (int i = 0; i < array.length; i++) {
+ brkids[i] = array[i];
+ }
+ setParameters(brkids);
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakEnable.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakEnable.java
index e037cfc42dd..aabb93e7cfb 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakEnable.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakEnable.java
@@ -19,26 +19,25 @@ import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContex
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
- *
+ *
* -break-enable ( BREAKPOINT )+
*
* Enable (previously disabled) BREAKPOINT(s).
- *
+ *
* Result:
* ^done
*/
-
-public class MIBreakEnable extends MICommand<MIInfo>
-{
- /** @since 5.0 */
- public MIBreakEnable (IBreakpointsTargetDMContext ctx, String[] array) {
- super(ctx, "-break-enable"); //$NON-NLS-1$
- if (array != null && array.length > 0) {
- String[] brkids = new String[array.length];
- for (int i = 0; i < array.length; i++) {
- brkids[i] = array[i];
- }
- setParameters(brkids);
- }
- }
+
+public class MIBreakEnable extends MICommand<MIInfo> {
+ /** @since 5.0 */
+ public MIBreakEnable(IBreakpointsTargetDMContext ctx, String[] array) {
+ super(ctx, "-break-enable"); //$NON-NLS-1$
+ if (array != null && array.length > 0) {
+ String[] brkids = new String[array.length];
+ for (int i = 0; i < array.length; i++) {
+ brkids[i] = array[i];
+ }
+ setParameters(brkids);
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakInsert.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakInsert.java
index 0082ec5c8cd..dc8c7b0dd48 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakInsert.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakInsert.java
@@ -25,13 +25,13 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
* -break-insert [ -t ] [ -h ] [ -f ] [ -d ] [ -a ]
* [ -c CONDITION ] [ -i IGNORE-COUNT ]
* [ -p THREAD ] [ LOCATION ]
- *
+ *
* If specified, LOCATION, can be one of:
* * function
* * filename:linenum
* * filename:function
* * *address
- *
+ *
* The possible optional parameters of this command are:
*
* '-t'
@@ -48,7 +48,7 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
* Initialize the IGNORE-COUNT (number of breakpoint hits before breaking).
*
* '-f'
- * If location cannot be parsed (for example if it refers to unknown files or
+ * If location cannot be parsed (for example if it refers to unknown files or
* functions), create a pending breakpoint. Without this flag, if a location
* cannot be parsed, the breakpoint will not be created and an error will be
* reported.
@@ -57,35 +57,34 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
* '-d'
* Create a disabled breakpoint.
* Only available starting GDB 7.0
- *
+ *
* '-a'
* Insert a tracepoint instead of a breakpoint
* Only available starting GDB 7.2
- *
+ *
* '-p THREAD'
* THREAD on which to apply the breakpoint
*/
-public class MIBreakInsert extends MICommand<MIBreakInsertInfo>
-{
+public class MIBreakInsert extends MICommand<MIBreakInsertInfo> {
/** @since 4.0 */
public MIBreakInsert(IBreakpointsTargetDMContext ctx, String func, boolean allowPending) {
this(ctx, false, false, null, 0, func, "0", allowPending); //$NON-NLS-1$
}
-
+
/** @since 5.0*/
- public MIBreakInsert(IBreakpointsTargetDMContext ctx, boolean isTemporary, boolean isHardware,
- String condition, int ignoreCount, String line, String tid, boolean allowPending) {
+ public MIBreakInsert(IBreakpointsTargetDMContext ctx, boolean isTemporary, boolean isHardware, String condition,
+ int ignoreCount, String line, String tid, boolean allowPending) {
this(ctx, isTemporary, isHardware, condition, ignoreCount, line, tid, false, false, allowPending);
}
-
+
/**
* This constructor allows to specify if the breakpoint should actually be
* a tracepoint (this will only work starting with GDB 7.1)
* It also includes if a breakpoint should be created disabled (starting GDB 7.0)
* @since 5.0
*/
- public MIBreakInsert(IBreakpointsTargetDMContext ctx, boolean isTemporary, boolean isHardware,
- String condition, int ignoreCount, String location, String tid, boolean disabled, boolean isTracepoint,
+ public MIBreakInsert(IBreakpointsTargetDMContext ctx, boolean isTemporary, boolean isHardware, String condition,
+ int ignoreCount, String location, String tid, boolean disabled, boolean isTracepoint,
boolean allowPending) {
super(ctx, "-break-insert"); //$NON-NLS-1$
@@ -100,88 +99,88 @@ public class MIBreakInsert extends MICommand<MIBreakInsertInfo>
tid = "0"; //$NON-NLS-1$
}
- // Determine the number of optional parameters that are present
- // and allocate a corresponding string array
- int i = 0;
- if (isTemporary) {
- i++;
- }
- if (isHardware) {
- i++;
- }
- if (condition != null && !condition.isEmpty()) {
- i += 2;
- }
- if (ignoreCount > 0) {
- i += 2;
- }
- if (!tid.equals("0")) { //$NON-NLS-1$
- i += 2;
- }
- if (disabled) {
- i++;
- }
- if (isTracepoint) {
- i++;
- }
- if (allowPending) {
- i ++;
- }
+ // Determine the number of optional parameters that are present
+ // and allocate a corresponding string array
+ int i = 0;
+ if (isTemporary) {
+ i++;
+ }
+ if (isHardware) {
+ i++;
+ }
+ if (condition != null && !condition.isEmpty()) {
+ i += 2;
+ }
+ if (ignoreCount > 0) {
+ i += 2;
+ }
+ if (!tid.equals("0")) { //$NON-NLS-1$
+ i += 2;
+ }
+ if (disabled) {
+ i++;
+ }
+ if (isTracepoint) {
+ i++;
+ }
+ if (allowPending) {
+ i++;
+ }
- String[] opts = new String[i];
+ String[] opts = new String[i];
- // Fill in the optional parameters
- i = 0;
- if (isTemporary) {
- opts[i] = "-t"; //$NON-NLS-1$
- i++;
- }
- if (isHardware) {
- // For tracepoints, this will request a fast tracepoint
- opts[i] = "-h"; //$NON-NLS-1$
- i++;
- }
- if (condition != null && !condition.isEmpty()) {
- opts[i] = "-c"; //$NON-NLS-1$
- i++;
- opts[i] = condition;
- i++;
- }
- if (ignoreCount > 0) {
- opts[i] = "-i"; //$NON-NLS-1$
- i++;
- opts[i] = Integer.toString(ignoreCount);
- i++;
- }
- if (!tid.equals("0")) { //$NON-NLS-1$
- opts[i] = "-p"; //$NON-NLS-1$
- i++;
- opts[i] = tid;
- i++;
- }
- if (disabled) {
- opts[i] = "-d"; //$NON-NLS-1$
- i++;
- }
- if (isTracepoint) {
- opts[i] = "-a"; //$NON-NLS-1$
- i++;
- }
- if (allowPending) {
- opts[i] = "-f"; //$NON-NLS-1$
- i ++;
- }
+ // Fill in the optional parameters
+ i = 0;
+ if (isTemporary) {
+ opts[i] = "-t"; //$NON-NLS-1$
+ i++;
+ }
+ if (isHardware) {
+ // For tracepoints, this will request a fast tracepoint
+ opts[i] = "-h"; //$NON-NLS-1$
+ i++;
+ }
+ if (condition != null && !condition.isEmpty()) {
+ opts[i] = "-c"; //$NON-NLS-1$
+ i++;
+ opts[i] = condition;
+ i++;
+ }
+ if (ignoreCount > 0) {
+ opts[i] = "-i"; //$NON-NLS-1$
+ i++;
+ opts[i] = Integer.toString(ignoreCount);
+ i++;
+ }
+ if (!tid.equals("0")) { //$NON-NLS-1$
+ opts[i] = "-p"; //$NON-NLS-1$
+ i++;
+ opts[i] = tid;
+ i++;
+ }
+ if (disabled) {
+ opts[i] = "-d"; //$NON-NLS-1$
+ i++;
+ }
+ if (isTracepoint) {
+ opts[i] = "-a"; //$NON-NLS-1$
+ i++;
+ }
+ if (allowPending) {
+ opts[i] = "-f"; //$NON-NLS-1$
+ i++;
+ }
- if (opts.length > 0) {
- setOptions(opts);
- }
- // Code that replaced double backslashes with single backslashes is removed.
- // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=426834 for details.
- setParameters(new Adjustable[]{ new MIStandardParameterAdjustable(location)});
- }
+ if (opts.length > 0) {
+ setOptions(opts);
+ }
+ // Code that replaced double backslashes with single backslashes is removed.
+ // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=426834 for details.
+ setParameters(new Adjustable[] { new MIStandardParameterAdjustable(location) });
+ }
- @Override
- public MIBreakInsertInfo getResult(MIOutput output) {
- return new MIBreakInsertInfo(output);
- }
+ @Override
+ public MIBreakInsertInfo getResult(MIOutput output) {
+ return new MIBreakInsertInfo(output);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakList.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakList.java
index b1384b14908..b10e68e6aef 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakList.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakList.java
@@ -20,7 +20,7 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakListInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
/**
- *
+ *
* -break-list
*
* Displays the list of inserted breakpoints, showing the following
@@ -52,14 +52,13 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
* `body' field is an empty list.
*
*/
-public class MIBreakList extends MICommand<MIBreakListInfo>
-{
- public MIBreakList (IBreakpointsTargetDMContext ctx) {
- super(ctx, "-break-list"); //$NON-NLS-1$
- }
-
- @Override
- public MIBreakListInfo getResult(MIOutput output) {
- return new MIBreakListInfo(output);
- }
+public class MIBreakList extends MICommand<MIBreakListInfo> {
+ public MIBreakList(IBreakpointsTargetDMContext ctx) {
+ super(ctx, "-break-list"); //$NON-NLS-1$
+ }
+
+ @Override
+ public MIBreakListInfo getResult(MIOutput output) {
+ return new MIBreakListInfo(output);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakPasscount.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakPasscount.java
index 75317859a27..48254f5cdea 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakPasscount.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakPasscount.java
@@ -18,21 +18,21 @@ import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContex
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
- *
+ *
* -break-passcount TRACEPOINT-NUMBER PASSCOUNT
*
- * Set the passcount for tracepoint TRACEPOINT_NUMBER to PASSCOUNT. If the breakpoint
- * referred to by TRACEPOINT_NUMBER is not a tracepoint, an error is emitted. This
+ * Set the passcount for tracepoint TRACEPOINT_NUMBER to PASSCOUNT. If the breakpoint
+ * referred to by TRACEPOINT_NUMBER is not a tracepoint, an error is emitted. This
* corresponds to the CLI command 'passcount'.
- *
+ *
* Available starting with GDB 7.1
- *
+ *
* @since 3.0
*/
-
-public class MIBreakPasscount extends MICommand<MIInfo>
-{
- public MIBreakPasscount(IBreakpointsTargetDMContext ctx, int tracepoint, int passCount) {
- super(ctx, "-break-passcount", null, new String[] { Integer.toString(tracepoint), Integer.toString(passCount) }); //$NON-NLS-1$
- }
+
+public class MIBreakPasscount extends MICommand<MIInfo> {
+ public MIBreakPasscount(IBreakpointsTargetDMContext ctx, int tracepoint, int passCount) {
+ super(ctx, "-break-passcount", null, //$NON-NLS-1$
+ new String[] { Integer.toString(tracepoint), Integer.toString(passCount) });
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakWatch.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakWatch.java
index b0ec4216d8b..68ab15a9928 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakWatch.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakWatch.java
@@ -20,7 +20,7 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
/**
* -break-watch [ -a | -r ] LOCATION
- *
+ *
* Create a watchpoint on LOCATION. Without either of the options, the watchpoint
* created is a regular watchpoint, i.e., a watchpoint that triggers when the
* memory LOCATION is accessed for writing.
@@ -35,24 +35,22 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
* Creates a read watchpoint i.e. a watchpoint that triggers only when
* the memory location is accessed for reading.
*/
-public class MIBreakWatch extends MICommand<MIBreakInsertInfo>
-{
- public MIBreakWatch(IBreakpointsTargetDMContext ctx, boolean isRead, boolean isWrite, String expression)
- {
+public class MIBreakWatch extends MICommand<MIBreakInsertInfo> {
+ public MIBreakWatch(IBreakpointsTargetDMContext ctx, boolean isRead, boolean isWrite, String expression) {
super(ctx, "-break-watch"); //$NON-NLS-1$
if (isRead) {
if (isWrite)
- setOptions(new String[] { "-a" }); //$NON-NLS-1$
- else
- setOptions(new String[] { "-r" }); //$NON-NLS-1$
+ setOptions(new String[] { "-a" }); //$NON-NLS-1$
+ else
+ setOptions(new String[] { "-r" }); //$NON-NLS-1$
}
- setParameters(new String[]{ expression });
- }
+ setParameters(new String[] { expression });
+ }
- @Override
- public MIBreakInsertInfo getResult(MIOutput output) {
- return new MIBreakInsertInfo(output);
- }
+ @Override
+ public MIBreakInsertInfo getResult(MIOutput output) {
+ return new MIBreakInsertInfo(output);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MICommand.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MICommand.java
index c3df7081aeb..e8156cd1f43 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MICommand.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MICommand.java
@@ -36,31 +36,31 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
* Represents any MI command.
*/
public class MICommand<V extends MIInfo> implements ICommand<V> {
- private static final String[] empty = {};
+ private static final String[] empty = {};
- List<Adjustable> fOptions = new ArrayList<>();
- List<Adjustable> fParameters = new ArrayList<>();
- String fOperation = ""; //$NON-NLS-1$
- Function<String, Adjustable> fParamToAdjustable;
- IDMContext fCtx;
+ List<Adjustable> fOptions = new ArrayList<>();
+ List<Adjustable> fParameters = new ArrayList<>();
+ String fOperation = ""; //$NON-NLS-1$
+ Function<String, Adjustable> fParamToAdjustable;
+ IDMContext fCtx;
- /*
- * Constructors.
- */
+ /*
+ * Constructors.
+ */
- public MICommand(IDMContext ctx, String operation) {
- this(ctx, operation, empty, empty);
- }
+ public MICommand(IDMContext ctx, String operation) {
+ this(ctx, operation, empty, empty);
+ }
- public MICommand(IDMContext ctx, String operation, String[] params) {
- this(ctx, operation, empty, params);
- }
+ public MICommand(IDMContext ctx, String operation, String[] params) {
+ this(ctx, operation, empty, params);
+ }
- public MICommand(IDMContext ctx, String operation, String[] options, String[] params) {
- this(ctx, operation, options, params, null);
- }
+ public MICommand(IDMContext ctx, String operation, String[] options, String[] params) {
+ this(ctx, operation, options, params, null);
+ }
- /**
+ /**
* @since 5.2
*/
public MICommand(IDMContext ctx, String operation, String[] options, String[] params,
@@ -88,133 +88,132 @@ public class MICommand<V extends MIInfo> implements ICommand<V> {
: Collections.emptyList();
}
- public String getCommandControlFilter() {
- MIControlDMContext controlDmc = DMContexts.getAncestorOfType(getContext(), MIControlDMContext.class);
- return controlDmc.getCommandControlFilter();
- }
-
- /**
- * Returns the operation of this command.
- */
- public String getOperation() {
- return fOperation;
- }
-
- /**
- * Returns an array of command's options. An empty collection is
- * returned if there are no options.
- */
- public String[] getOptions() {
+ public String getCommandControlFilter() {
+ MIControlDMContext controlDmc = DMContexts.getAncestorOfType(getContext(), MIControlDMContext.class);
+ return controlDmc.getCommandControlFilter();
+ }
+
+ /**
+ * Returns the operation of this command.
+ */
+ public String getOperation() {
+ return fOperation;
+ }
+
+ /**
+ * Returns an array of command's options. An empty collection is
+ * returned if there are no options.
+ */
+ public String[] getOptions() {
List<String> result = new ArrayList<>();
for (Adjustable option : fOptions) {
result.add(option.getValue());
}
return result.toArray(new String[fOptions.size()]);
- }
+ }
- public void setOptions(String[] options) {
- fOptions = optionsToAdjustables(options);
- }
+ public void setOptions(String[] options) {
+ fOptions = optionsToAdjustables(options);
+ }
- /**
- * Returns an array of command's parameters. An empty collection is
- * returned if there are no parameters.
- */
- public String[] getParameters() {
+ /**
+ * Returns an array of command's parameters. An empty collection is
+ * returned if there are no parameters.
+ */
+ public String[] getParameters() {
List<String> result = new ArrayList<>();
for (Adjustable parameter : fParameters) {
result.add(parameter.getValue());
}
return result.toArray(new String[fParameters.size()]);
- }
+ }
- public void setParameters(String[] params) {
+ public void setParameters(String[] params) {
fParameters = parametersToAdjustables(params);
- }
+ }
public void setParameters(Adjustable... params) {
fParameters = Arrays.asList(params);
}
- /**
- * Returns the constructed command without using the --thread/--frame options.
- */
- public String constructCommand() {
- return constructCommand(null, -1);
- }
-
- /**
- * Returns the constructed command potentially using the --thread/--frame options.
- *
- * @since 1.1
- */
- public String constructCommand(String threadId, int frameId) {
- return constructCommand(null, threadId, frameId);
- }
-
- /**
- * With GDB 7.1 the --thread-group option is used to support multiple processes.
- *
- * @since 4.0
- */
- public String constructCommand(String groupId, String threadId, int frameId) {
- StringBuilder command = new StringBuilder(getOperation());
-
- // Add the --thread option
- if (supportsThreadAndFrameOptions() && threadId != null && !threadId.trim().isEmpty()) {
- command.append(" --thread ").append(threadId); //$NON-NLS-1$
-
- // Add the --frame option, but only if we are using the --thread option
- if (frameId >= 0) {
- command.append(" --frame ").append(frameId); //$NON-NLS-1$
- }
- } else if (supportsThreadGroupOption() && groupId != null && !groupId.trim().isEmpty()) {
- // The --thread-group option is only allowed if we are not using the --thread option
- command.append(" --thread-group ").append(groupId); //$NON-NLS-1$
- }
-
- String opt = optionsToString();
- if (!opt.isEmpty()) {
- command.append(' ').append(opt);
- }
- String p = parametersToString();
- if (!p.isEmpty()) {
- command.append(' ').append(p);
- }
- command.append('\n');
- return command.toString();
- }
-
-// /*
-// * Checks to see if the current command can be coalesced with the
-// * supplied command.
-// */
-// public boolean canCoalesce(ICommand<? extends ICommandResult> command) {
-// return false;
-// }
+ /**
+ * Returns the constructed command without using the --thread/--frame options.
+ */
+ public String constructCommand() {
+ return constructCommand(null, -1);
+ }
- @Override
- public ICommand<? extends ICommandResult> coalesceWith(ICommand<? extends ICommandResult> command) {
- return null;
- }
+ /**
+ * Returns the constructed command potentially using the --thread/--frame options.
+ *
+ * @since 1.1
+ */
+ public String constructCommand(String threadId, int frameId) {
+ return constructCommand(null, threadId, frameId);
+ }
+
+ /**
+ * With GDB 7.1 the --thread-group option is used to support multiple processes.
+ *
+ * @since 4.0
+ */
+ public String constructCommand(String groupId, String threadId, int frameId) {
+ StringBuilder command = new StringBuilder(getOperation());
+
+ // Add the --thread option
+ if (supportsThreadAndFrameOptions() && threadId != null && !threadId.trim().isEmpty()) {
+ command.append(" --thread ").append(threadId); //$NON-NLS-1$
+ // Add the --frame option, but only if we are using the --thread option
+ if (frameId >= 0) {
+ command.append(" --frame ").append(frameId); //$NON-NLS-1$
+ }
+ } else if (supportsThreadGroupOption() && groupId != null && !groupId.trim().isEmpty()) {
+ // The --thread-group option is only allowed if we are not using the --thread option
+ command.append(" --thread-group ").append(groupId); //$NON-NLS-1$
+ }
+
+ String opt = optionsToString();
+ if (!opt.isEmpty()) {
+ command.append(' ').append(opt);
+ }
+ String p = parametersToString();
+ if (!p.isEmpty()) {
+ command.append(' ').append(p);
+ }
+ command.append('\n');
+ return command.toString();
+ }
+
+ // /*
+ // * Checks to see if the current command can be coalesced with the
+ // * supplied command.
+ // */
+ // public boolean canCoalesce(ICommand<? extends ICommandResult> command) {
+ // return false;
+ // }
@Override
- public IDMContext getContext() {
- return fCtx;
- }
-
- /**
- * Produces the corresponding ICommandResult result for this
- * command.
- *
- * @return result for this command
- */
- public MIInfo getResult(MIOutput MIresult) {
- return new MIInfo(MIresult);
- }
-
- protected String optionsToString() {
+ public ICommand<? extends ICommandResult> coalesceWith(ICommand<? extends ICommandResult> command) {
+ return null;
+ }
+
+ @Override
+ public IDMContext getContext() {
+ return fCtx;
+ }
+
+ /**
+ * Produces the corresponding ICommandResult result for this
+ * command.
+ *
+ * @return result for this command
+ */
+ public MIInfo getResult(MIOutput MIresult) {
+ return new MIInfo(MIresult);
+ }
+
+ protected String optionsToString() {
StringBuilder sb = new StringBuilder();
if (fOptions != null && !fOptions.isEmpty()) {
for (Adjustable option : fOptions) {
@@ -222,9 +221,9 @@ public class MICommand<V extends MIInfo> implements ICommand<V> {
}
}
return sb.toString().trim();
- }
+ }
- protected String parametersToString() {
+ protected String parametersToString() {
String[] options = getOptions();
StringBuilder buffer = new StringBuilder();
if (fParameters != null && !fParameters.isEmpty()) {
@@ -244,54 +243,54 @@ public class MICommand<V extends MIInfo> implements ICommand<V> {
}
}
return buffer.toString().trim();
- }
-
- protected static boolean containsWhitespace(String s) {
- for (int i = 0; i < s.length(); i++) {
- if (Character.isWhitespace(s.charAt(i))) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * @since 1.1
- */
- public boolean supportsThreadAndFrameOptions() {
- return true;
- }
-
- /**
- * @since 4.0
- */
- public boolean supportsThreadGroupOption() {
- return true;
- }
-
- /**
- * Compares commands based on the MI command string that they generate,
- * without the token.
- */
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof MICommand<?>) {
- MICommand<?> otherCmd = (MICommand<?>) obj;
- return ((fCtx == null && otherCmd.fCtx == null) || (fCtx != null && fCtx.equals(otherCmd.fCtx))) &&
- constructCommand().equals(otherCmd.constructCommand());
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return constructCommand().hashCode();
- }
-
- @Override
- public String toString() {
- return constructCommand();
- }
+ }
+
+ protected static boolean containsWhitespace(String s) {
+ for (int i = 0; i < s.length(); i++) {
+ if (Character.isWhitespace(s.charAt(i))) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @since 1.1
+ */
+ public boolean supportsThreadAndFrameOptions() {
+ return true;
+ }
+
+ /**
+ * @since 4.0
+ */
+ public boolean supportsThreadGroupOption() {
+ return true;
+ }
+
+ /**
+ * Compares commands based on the MI command string that they generate,
+ * without the token.
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof MICommand<?>) {
+ MICommand<?> otherCmd = (MICommand<?>) obj;
+ return ((fCtx == null && otherCmd.fCtx == null) || (fCtx != null && fCtx.equals(otherCmd.fCtx)))
+ && constructCommand().equals(otherCmd.constructCommand());
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return constructCommand().hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return constructCommand();
+ }
public static class MIStandardOptionAdjustable extends MICommandAdjustable {
@@ -327,8 +326,7 @@ public class MICommand<V extends MIInfo> implements ICommand<V> {
}
}
- public static class MIStandardParameterAdjustable extends
- MICommandAdjustable {
+ public static class MIStandardParameterAdjustable extends MICommandAdjustable {
public MIStandardParameterAdjustable(String parameter) {
super(parameter);
}
@@ -351,15 +349,15 @@ public class MICommand<V extends MIInfo> implements ICommand<V> {
builder.append('"');
}
-// Although this change makes sense, it could have impacts on many
-// different commands we send to GDB. The risk outweighs the benefits,
-// so we comment it out. See bugs 412471 and 414959 for details.
-//
-// // an empty parameter can be passed with two single quotes
-// if (builder.length() == 0) {
-// builder.append("''"); //$NON-NLS-1$
-// }
-//
+ // Although this change makes sense, it could have impacts on many
+ // different commands we send to GDB. The risk outweighs the benefits,
+ // so we comment it out. See bugs 412471 and 414959 for details.
+ //
+ // // an empty parameter can be passed with two single quotes
+ // if (builder.length() == 0) {
+ // builder.append("''"); //$NON-NLS-1$
+ // }
+ //
return builder.toString();
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDPrintfInsert.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDPrintfInsert.java
index d37a6d6a22f..78305277abc 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDPrintfInsert.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDPrintfInsert.java
@@ -25,15 +25,15 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
/**
* -dprintf-insert [ -t ] [ -f ] [ -d ]
* [ -c CONDITION ] [ -i IGNORE-COUNT ]
- * [ -p THREAD ] [ LOCATION ] [ FORMAT ] [ ARGUMENT ]
- *
+ * [ -p THREAD ] [ LOCATION ] [ FORMAT ] [ ARGUMENT ]
+ *
* If specified, LOCATION, can be one of:
* * function
* * filename:linenum
* * filename:function
* * *address
- *
- *
+ *
+ *
* The possible optional parameters of this command are:
*
* '-t'
@@ -46,115 +46,113 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
* Initialize the IGNORE-COUNT.
*
* '-f'
- * If location cannot be parsed (for example if it refers to unknown files or
+ * If location cannot be parsed (for example if it refers to unknown files or
* functions), create a pending dprintf. Without this flag, if a location
* cannot be parsed, the dprintf will not be created and an error will be
* reported.
*
* '-d'
* Create a disabled dprintf.
- *
+ *
* '-p THREAD'
* THREAD on which to apply the dprintf
- *
+ *
* Available with GDB 7.7.
- *
+ *
* @since 4.4
*/
-public class MIDPrintfInsert extends MICommand<MIBreakInsertInfo>
-{
- public MIDPrintfInsert(IBreakpointsTargetDMContext ctx, boolean isTemporary,
- String condition, int ignoreCount, int tid, boolean disabled,
- boolean allowPending, String location, String printfStr) {
+public class MIDPrintfInsert extends MICommand<MIBreakInsertInfo> {
+ public MIDPrintfInsert(IBreakpointsTargetDMContext ctx, boolean isTemporary, String condition, int ignoreCount,
+ int tid, boolean disabled, boolean allowPending, String location, String printfStr) {
super(ctx, "-dprintf-insert"); //$NON-NLS-1$
- // Determine the number of optional parameters that are present
- // and allocate a corresponding string array
- int i = 0;
- if (isTemporary) {
- i++;
- }
- if (condition != null && !condition.isEmpty()) {
- i += 2;
- }
- if (ignoreCount > 0) {
- i += 2;
- }
- if (tid > 0) {
- i += 2;
- }
- if (disabled) {
- i++;
- }
- if (allowPending) {
- i ++;
- }
-
- String[] opts = new String[i];
-
- // Fill in the optional parameters
- i = 0;
- if (isTemporary) {
- opts[i] = "-t"; //$NON-NLS-1$
- i++;
- }
- if (condition != null && !condition.isEmpty()) {
- opts[i] = "-c"; //$NON-NLS-1$
- i++;
- opts[i] = condition;
- i++;
- }
- if (ignoreCount > 0) {
- opts[i] = "-i"; //$NON-NLS-1$
- i++;
- opts[i] = Integer.toString(ignoreCount);
- i++;
- }
- if (tid > 0) {
- opts[i] = "-p"; //$NON-NLS-1$
- i++;
- opts[i] = Integer.toString(tid);
- i++;
- }
- if (disabled) {
- opts[i] = "-d"; //$NON-NLS-1$
- i++;
- }
- if (allowPending) {
- opts[i] = "-f"; //$NON-NLS-1$
- i ++;
- }
-
- if (opts.length > 0) {
- setOptions(opts);
- }
-
- setParameters(createParameters(location, printfStr));
- }
+ // Determine the number of optional parameters that are present
+ // and allocate a corresponding string array
+ int i = 0;
+ if (isTemporary) {
+ i++;
+ }
+ if (condition != null && !condition.isEmpty()) {
+ i += 2;
+ }
+ if (ignoreCount > 0) {
+ i += 2;
+ }
+ if (tid > 0) {
+ i += 2;
+ }
+ if (disabled) {
+ i++;
+ }
+ if (allowPending) {
+ i++;
+ }
+
+ String[] opts = new String[i];
+
+ // Fill in the optional parameters
+ i = 0;
+ if (isTemporary) {
+ opts[i] = "-t"; //$NON-NLS-1$
+ i++;
+ }
+ if (condition != null && !condition.isEmpty()) {
+ opts[i] = "-c"; //$NON-NLS-1$
+ i++;
+ opts[i] = condition;
+ i++;
+ }
+ if (ignoreCount > 0) {
+ opts[i] = "-i"; //$NON-NLS-1$
+ i++;
+ opts[i] = Integer.toString(ignoreCount);
+ i++;
+ }
+ if (tid > 0) {
+ opts[i] = "-p"; //$NON-NLS-1$
+ i++;
+ opts[i] = Integer.toString(tid);
+ i++;
+ }
+ if (disabled) {
+ opts[i] = "-d"; //$NON-NLS-1$
+ i++;
+ }
+ if (allowPending) {
+ opts[i] = "-f"; //$NON-NLS-1$
+ i++;
+ }
+
+ if (opts.length > 0) {
+ setOptions(opts);
+ }
+
+ setParameters(createParameters(location, printfStr));
+ }
private Adjustable[] createParameters(String location, String printfStr) {
List<Adjustable> paramsList = new ArrayList<Adjustable>();
-
+
paramsList.add(new MIStandardParameterAdjustable(location));
-
- GDBDynamicPrintfUtils.GDBDynamicPrintfString parsedStr =
- new GDBDynamicPrintfUtils.GDBDynamicPrintfString(printfStr);
-
+
+ GDBDynamicPrintfUtils.GDBDynamicPrintfString parsedStr = new GDBDynamicPrintfUtils.GDBDynamicPrintfString(
+ printfStr);
+
if (parsedStr.isValid()) {
paramsList.add(new DPrintfAdjustable(parsedStr.getString()));
for (String arg : parsedStr.getArguments()) {
- paramsList.add(new MIStandardParameterAdjustable(arg));
- }
+ paramsList.add(new MIStandardParameterAdjustable(arg));
+ }
}
-
+
return paramsList.toArray(new Adjustable[paramsList.size()]);
}
- @Override
- public MIBreakInsertInfo getResult(MIOutput output) {
- return new MIBreakInsertInfo(output);
- }
-
+ @Override
+ public MIBreakInsertInfo getResult(MIOutput output) {
+ return new MIBreakInsertInfo(output);
+ }
+
/**
* This adjustable makes sure that the dprintf parameters will not be modified
* any further. The reason for that is that the -dprintf-insert command
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataDisassemble.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataDisassemble.java
index e7388948bbe..7ba6ba42e7e 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataDisassemble.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataDisassemble.java
@@ -71,58 +71,57 @@ public class MIDataDisassemble extends MICommand<MIDataDisassembleInfo> {
public static final int DATA_DISASSEMBLE_MODE_MIXED_OPCODES = 3;
private static final int MAX_MODE = 3;
-
-
+
private static final String MODE_OUT_OF_RANGE = "Mode out of range: "; //$NON-NLS-1$
-
+
public MIDataDisassemble(IDisassemblyDMContext ctx, String start, String end, boolean mode) {
this(ctx, start, end, mode ? DATA_DISASSEMBLE_MODE_MIXED : DATA_DISASSEMBLE_MODE_DISASSEMBLY);
}
-
+
/** @since 4.1 */
public MIDataDisassemble(IDisassemblyDMContext ctx, String start, String end, int mode) {
super(ctx, "-data-disassemble"); //$NON-NLS-1$
- setOptions(new String[]{"-s", start, "-e", end}); //$NON-NLS-1$ //$NON-NLS-2$
-
- if (mode >= MIN_MODE && mode <= MAX_MODE) {
- setParameters(new String[] { Integer.toString(mode) });
- } else {
- throw new IllegalArgumentException(MODE_OUT_OF_RANGE + mode);
- }
+ setOptions(new String[] { "-s", start, "-e", end }); //$NON-NLS-1$ //$NON-NLS-2$
+
+ if (mode >= MIN_MODE && mode <= MAX_MODE) {
+ setParameters(new String[] { Integer.toString(mode) });
+ } else {
+ throw new IllegalArgumentException(MODE_OUT_OF_RANGE + mode);
+ }
}
- public MIDataDisassemble(IDisassemblyDMContext ctx, String file, int linenum, int lines, boolean mode) {
- this(ctx, file, linenum, lines, mode ? DATA_DISASSEMBLE_MODE_MIXED : DATA_DISASSEMBLE_MODE_DISASSEMBLY);
- }
+ public MIDataDisassemble(IDisassemblyDMContext ctx, String file, int linenum, int lines, boolean mode) {
+ this(ctx, file, linenum, lines, mode ? DATA_DISASSEMBLE_MODE_MIXED : DATA_DISASSEMBLE_MODE_DISASSEMBLY);
+ }
/** @since 4.1 */
- public MIDataDisassemble(IDisassemblyDMContext ctx, String file, int linenum, int lines, int mode) {
- super(ctx, "-data-disassemble"); //$NON-NLS-1$
- setOptions(new String[]{"-f", file, "-l", //$NON-NLS-1$ //$NON-NLS-2$
- Integer.toString(linenum), "-n", Integer.toString(lines)}); //$NON-NLS-1$
-
- if (mode >= MIN_MODE && mode <= MAX_MODE) {
- setParameters(new String[] { Integer.toString(mode) });
- } else {
- throw new IllegalArgumentException(MODE_OUT_OF_RANGE + mode);
- }
- }
-
- /*
- * -data-disassemble uses "--" as a separator with only the MODE
- * So override the MICommand
- */
- @Override
- protected String parametersToString() {
- String[] parameters = getParameters();
- if (parameters != null && parameters.length > 0) {
- return "-- " + parameters[0]; //$NON-NLS-1$
- }
- return ""; //$NON-NLS-1$
- }
-
- @Override
- public MIDataDisassembleInfo getResult(MIOutput output) {
- return new MIDataDisassembleInfo(output);
- }
+ public MIDataDisassemble(IDisassemblyDMContext ctx, String file, int linenum, int lines, int mode) {
+ super(ctx, "-data-disassemble"); //$NON-NLS-1$
+ setOptions(new String[] { "-f", file, "-l", //$NON-NLS-1$ //$NON-NLS-2$
+ Integer.toString(linenum), "-n", Integer.toString(lines) }); //$NON-NLS-1$
+
+ if (mode >= MIN_MODE && mode <= MAX_MODE) {
+ setParameters(new String[] { Integer.toString(mode) });
+ } else {
+ throw new IllegalArgumentException(MODE_OUT_OF_RANGE + mode);
+ }
+ }
+
+ /*
+ * -data-disassemble uses "--" as a separator with only the MODE
+ * So override the MICommand
+ */
+ @Override
+ protected String parametersToString() {
+ String[] parameters = getParameters();
+ if (parameters != null && parameters.length > 0) {
+ return "-- " + parameters[0]; //$NON-NLS-1$
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ @Override
+ public MIDataDisassembleInfo getResult(MIOutput output) {
+ return new MIDataDisassembleInfo(output);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataEvaluateExpression.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataEvaluateExpression.java
index c1218a1f724..ea5734c1bcb 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataEvaluateExpression.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataEvaluateExpression.java
@@ -23,7 +23,7 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIDataEvaluateExpressionInf
import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
/**
- *
+ *
* -data-evaluate-expression EXPR
*
* Evaluate EXPR as an expression. The expression could contain an
@@ -31,29 +31,28 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
*If the expression contains spaces, it must be enclosed in double quotes.
*
*/
-public class MIDataEvaluateExpression<V extends MIDataEvaluateExpressionInfo> extends MICommand<V>
-{
- /**
- * @since 1.1
- */
- public MIDataEvaluateExpression(ICommandControlDMContext ctx, String expr) {
- super(ctx, "-data-evaluate-expression", new String[]{expr}); //$NON-NLS-1$
- }
+public class MIDataEvaluateExpression<V extends MIDataEvaluateExpressionInfo> extends MICommand<V> {
+ /**
+ * @since 1.1
+ */
+ public MIDataEvaluateExpression(ICommandControlDMContext ctx, String expr) {
+ super(ctx, "-data-evaluate-expression", new String[] { expr }); //$NON-NLS-1$
+ }
- public MIDataEvaluateExpression(IMIExecutionDMContext execDmc, String expr) {
- super(execDmc, "-data-evaluate-expression", new String[]{expr}); //$NON-NLS-1$
- }
+ public MIDataEvaluateExpression(IMIExecutionDMContext execDmc, String expr) {
+ super(execDmc, "-data-evaluate-expression", new String[] { expr }); //$NON-NLS-1$
+ }
- public MIDataEvaluateExpression(IFrameDMContext frameDmc, String expr) {
- super(frameDmc, "-data-evaluate-expression", new String[]{expr}); //$NON-NLS-1$
- }
+ public MIDataEvaluateExpression(IFrameDMContext frameDmc, String expr) {
+ super(frameDmc, "-data-evaluate-expression", new String[] { expr }); //$NON-NLS-1$
+ }
- public MIDataEvaluateExpression(IExpressionDMContext exprDmc) {
- super(exprDmc, "-data-evaluate-expression", new String[]{exprDmc.getExpression()}); //$NON-NLS-1$
- }
+ public MIDataEvaluateExpression(IExpressionDMContext exprDmc) {
+ super(exprDmc, "-data-evaluate-expression", new String[] { exprDmc.getExpression() }); //$NON-NLS-1$
+ }
- @Override
- public MIDataEvaluateExpressionInfo getResult(MIOutput output) {
- return new MIDataEvaluateExpressionInfo(output);
- }
+ @Override
+ public MIDataEvaluateExpressionInfo getResult(MIOutput output) {
+ return new MIDataEvaluateExpressionInfo(output);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataListRegisterNames.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataListRegisterNames.java
index f10164f56c2..c9bcde356d4 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataListRegisterNames.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataListRegisterNames.java
@@ -20,7 +20,7 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIDataListRegisterNamesInfo
import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
/**
- *
+ *
* -data-list-register-names [ ( REGNO )+ ]
*
* Show a list of register names for the current target. If no
@@ -31,25 +31,24 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
* include empty register names.
*
*/
-public class MIDataListRegisterNames extends MICommand<MIDataListRegisterNamesInfo>
-{
- public MIDataListRegisterNames(IContainerDMContext ctx) {
- super(ctx, "-data-list-register-names"); //$NON-NLS-1$
- }
+public class MIDataListRegisterNames extends MICommand<MIDataListRegisterNamesInfo> {
+ public MIDataListRegisterNames(IContainerDMContext ctx) {
+ super(ctx, "-data-list-register-names"); //$NON-NLS-1$
+ }
+
+ public MIDataListRegisterNames(IContainerDMContext ctx, int[] regnos) {
+ this(ctx);
+ if (regnos != null && regnos.length > 0) {
+ String[] array = new String[regnos.length];
+ for (int i = 0; i < regnos.length; i++) {
+ array[i] = Integer.toString(regnos[i]);
+ }
+ setParameters(array);
+ }
+ }
- public MIDataListRegisterNames(IContainerDMContext ctx, int [] regnos) {
- this(ctx);
- if (regnos != null && regnos.length > 0) {
- String[] array = new String[regnos.length];
- for (int i = 0; i < regnos.length; i++) {
- array[i] = Integer.toString(regnos[i]);
- }
- setParameters(array);
- }
- }
-
- @Override
- public MIDataListRegisterNamesInfo getResult(MIOutput output) {
- return new MIDataListRegisterNamesInfo(output);
- }
+ @Override
+ public MIDataListRegisterNamesInfo getResult(MIOutput output) {
+ return new MIDataListRegisterNamesInfo(output);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataListRegisterValues.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataListRegisterValues.java
index 4be6ce8d8a0..04cbc3dfa52 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataListRegisterValues.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataListRegisterValues.java
@@ -25,9 +25,9 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIDataListRegisterValuesInf
import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
/**
- *
+ *
* -data-list-register-values FMT [ ( REGNO )*]
- *
+ *
* Display the registers' contents. FMT is the format according to
* which the registers' contents are to be returned, followed by an
* optional list of numbers specifying the registers to display. A
@@ -36,139 +36,155 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
*
*/
public class MIDataListRegisterValues extends MICommand<MIDataListRegisterValuesInfo> {
-
- int[] regnums;
- int fFmt;
-
- /**
+
+ int[] regnums;
+ int fFmt;
+
+ /**
* @since 4.3
*/
- public MIDataListRegisterValues(IFrameDMContext ctx, int fmt) {
- this(ctx, fmt, null);
- }
-
- /**
- * @since 4.3
- */
- public MIDataListRegisterValues(IFrameDMContext ctx, int fmt, int [] regnos) {
- super(ctx, "-data-list-register-values"); //$NON-NLS-1$
- init(fmt, regnos);
- }
-
- private void init(int fmt, int [] regnos) {
- regnums = regnos;
-
- String format = "x"; //$NON-NLS-1$
- switch (fmt) {
- case MIFormat.NATURAL: format = "N"; break ; //$NON-NLS-1$
- case MIFormat.RAW: format = "r"; break ; //$NON-NLS-1$
- case MIFormat.DECIMAL: format = "d"; break ; //$NON-NLS-1$
- case MIFormat.BINARY: format = "t"; break ; //$NON-NLS-1$
- case MIFormat.OCTAL: format = "o"; break ; //$NON-NLS-1$
- case MIFormat.HEXADECIMAL: format = "x"; break ; //$NON-NLS-1$
- default: format = "x"; break ; //$NON-NLS-1$
- }
-
- fFmt = fmt;
-
- setOptions(new String[]{format});
-
- if (regnos != null && regnos.length > 0) {
- String[] array = new String[regnos.length];
- for (int i = 0; i < regnos.length; i++) {
- array[i] = Integer.toString(regnos[i]);
- }
- setParameters(array);
- }
- }
-
- public int[] getRegList() {
- return regnums;
- }
-
- @Override
- public MIDataListRegisterValuesInfo getResult(MIOutput output) {
- return new MIDataListRegisterValuesInfo(output);
- }
-
- /*
- * Takes the supplied command and coalesces it with this one.
- * The result is a new third command which represent the two
- * original command.
- */
- @Override
- public MIDataListRegisterValues coalesceWith(ICommand<? extends ICommandResult> command ) {
- /*
- * Can coalesce only with other DsfMIDataListRegisterValues commands.
- */
- if (! (command instanceof MIDataListRegisterValues) ) return null;
-
- IDMContext context = getContext();
-
- /*
- * Make sure we are coalescing over the same context
- */
- if (!command.getContext().equals(context)) {
- return null;
- }
-
- MIDataListRegisterValues cmd = (MIDataListRegisterValues) command;
-
- /*
- * If the format is different then this cannot be added to the list.
- */
- if ( fFmt != cmd.fFmt ) return null;
-
- int[] newregnos = new int[ regnums.length + cmd.regnums.length];
-
- /*
- * We need to add the new register #'s to the list. If one is already there
- * then do not add it twice. So copy the original list of this command.
- */
-
- for ( int idx = 0 ; idx < regnums.length ; idx ++) {
- newregnos[ idx ] = regnums[ idx ];
- }
-
- int curloc = regnums.length;
-
- for ( int ndx = 0 ; ndx < cmd.regnums.length; ndx ++) {
-
- int curnum = cmd.regnums[ ndx ] ;
- int ldx;
-
- /*
- * Search the current list to see if this entry is in it.
- */
-
- for ( ldx = 0 ; ldx < regnums.length; ldx ++ ) {
- if ( newregnos[ ldx ] == curnum ) {
- break ;
- }
- }
-
- if ( ldx == regnums.length ) {
-
- /*
- * Since we did not find a match add it at the end of the list.
- */
- newregnos[ curloc ] = curnum;
- curloc ++;
- }
- }
-
- /*
- * Create a final proper array set of the new combined list.
- */
- int[] finalregnums = new int[ curloc ] ;
-
- for ( int fdx = 0 ; fdx < curloc ; fdx ++ ) {
- finalregnums[ fdx ] = newregnos[ fdx ];
- }
-
- /*
- * Now construct a new one. The format we will use is this command.
- */
- return new MIDataListRegisterValues((IFrameDMContext)getContext(), fFmt, finalregnums);
- }
+ public MIDataListRegisterValues(IFrameDMContext ctx, int fmt) {
+ this(ctx, fmt, null);
+ }
+
+ /**
+ * @since 4.3
+ */
+ public MIDataListRegisterValues(IFrameDMContext ctx, int fmt, int[] regnos) {
+ super(ctx, "-data-list-register-values"); //$NON-NLS-1$
+ init(fmt, regnos);
+ }
+
+ private void init(int fmt, int[] regnos) {
+ regnums = regnos;
+
+ String format = "x"; //$NON-NLS-1$
+ switch (fmt) {
+ case MIFormat.NATURAL:
+ format = "N"; //$NON-NLS-1$
+ break;
+ case MIFormat.RAW:
+ format = "r"; //$NON-NLS-1$
+ break;
+ case MIFormat.DECIMAL:
+ format = "d"; //$NON-NLS-1$
+ break;
+ case MIFormat.BINARY:
+ format = "t"; //$NON-NLS-1$
+ break;
+ case MIFormat.OCTAL:
+ format = "o"; //$NON-NLS-1$
+ break;
+ case MIFormat.HEXADECIMAL:
+ format = "x"; //$NON-NLS-1$
+ break;
+ default:
+ format = "x"; //$NON-NLS-1$
+ break;
+ }
+
+ fFmt = fmt;
+
+ setOptions(new String[] { format });
+
+ if (regnos != null && regnos.length > 0) {
+ String[] array = new String[regnos.length];
+ for (int i = 0; i < regnos.length; i++) {
+ array[i] = Integer.toString(regnos[i]);
+ }
+ setParameters(array);
+ }
+ }
+
+ public int[] getRegList() {
+ return regnums;
+ }
+
+ @Override
+ public MIDataListRegisterValuesInfo getResult(MIOutput output) {
+ return new MIDataListRegisterValuesInfo(output);
+ }
+
+ /*
+ * Takes the supplied command and coalesces it with this one.
+ * The result is a new third command which represent the two
+ * original command.
+ */
+ @Override
+ public MIDataListRegisterValues coalesceWith(ICommand<? extends ICommandResult> command) {
+ /*
+ * Can coalesce only with other DsfMIDataListRegisterValues commands.
+ */
+ if (!(command instanceof MIDataListRegisterValues))
+ return null;
+
+ IDMContext context = getContext();
+
+ /*
+ * Make sure we are coalescing over the same context
+ */
+ if (!command.getContext().equals(context)) {
+ return null;
+ }
+
+ MIDataListRegisterValues cmd = (MIDataListRegisterValues) command;
+
+ /*
+ * If the format is different then this cannot be added to the list.
+ */
+ if (fFmt != cmd.fFmt)
+ return null;
+
+ int[] newregnos = new int[regnums.length + cmd.regnums.length];
+
+ /*
+ * We need to add the new register #'s to the list. If one is already there
+ * then do not add it twice. So copy the original list of this command.
+ */
+
+ for (int idx = 0; idx < regnums.length; idx++) {
+ newregnos[idx] = regnums[idx];
+ }
+
+ int curloc = regnums.length;
+
+ for (int ndx = 0; ndx < cmd.regnums.length; ndx++) {
+
+ int curnum = cmd.regnums[ndx];
+ int ldx;
+
+ /*
+ * Search the current list to see if this entry is in it.
+ */
+
+ for (ldx = 0; ldx < regnums.length; ldx++) {
+ if (newregnos[ldx] == curnum) {
+ break;
+ }
+ }
+
+ if (ldx == regnums.length) {
+
+ /*
+ * Since we did not find a match add it at the end of the list.
+ */
+ newregnos[curloc] = curnum;
+ curloc++;
+ }
+ }
+
+ /*
+ * Create a final proper array set of the new combined list.
+ */
+ int[] finalregnums = new int[curloc];
+
+ for (int fdx = 0; fdx < curloc; fdx++) {
+ finalregnums[fdx] = newregnos[fdx];
+ }
+
+ /*
+ * Now construct a new one. The format we will use is this command.
+ */
+ return new MIDataListRegisterValues((IFrameDMContext) getContext(), fFmt, finalregnums);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataReadMemory.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataReadMemory.java
index e10be59a670..9cbb12ee33c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataReadMemory.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataReadMemory.java
@@ -25,130 +25,111 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
* -data-read-memory [ -o BYTE-OFFSET ]
* ADDRESS WORD-FORMAT WORD-SIZE
* NR-ROWS NR-COLS [ ASCHAR ]
- *
+ *
* where:
- *
+ *
* 'ADDRESS'
* An expression specifying the address of the first memory word to be
* read. Complex expressions containing embedded white space should
* be quoted using the C convention.
- *
+ *
* 'WORD-FORMAT'
* The format to be used to print the memory words. The notation is
* the same as for GDB's `print' command (*note Output formats:
* Output Formats.).
- *
+ *
* 'WORD-SIZE'
* The size of each memory word in bytes.
- *
+ *
* 'NR-ROWS'
* The number of rows in the output table.
- *
+ *
* 'NR-COLS'
* The number of columns in the output table.
- *
+ *
* 'ASCHAR'
* If present, indicates that each row should include an ASCII dump.
* The value of ASCHAR is used as a padding character when a byte is
* not a member of the printable ASCII character set (printable ASCII
* characters are those whose code is between 32 and 126,
* inclusively).
- *
+ *
* 'BYTE-OFFSET'
* An offset to add to ADDRESS before fetching the memory.
*
*/
public class MIDataReadMemory extends MICommand<MIDataReadMemoryInfo> {
-
+
int fword_size;
- public MIDataReadMemory(
- IDMContext ctx,
- long offset,
- String address,
- int word_format,
- int word_size,
- int rows,
- int cols,
- Character asChar)
- {
+ public MIDataReadMemory(IDMContext ctx, long offset, String address, int word_format, int word_size, int rows,
+ int cols, Character asChar) {
super(ctx, "-data-read-memory"); //$NON-NLS-1$
// Save this for the result parser
fword_size = word_size;
if (offset != 0) {
- setOptions(new String[] { "-o", Long.toString(offset)}); //$NON-NLS-1$
+ setOptions(new String[] { "-o", Long.toString(offset) }); //$NON-NLS-1$
}
String format = "x"; //$NON-NLS-1$
switch (word_format) {
- case MIFormat.UNSIGNED :
- format = "u"; //$NON-NLS-1$
- break;
-
- case MIFormat.FLOAT :
- format = "f"; //$NON-NLS-1$
- break;
-
- case MIFormat.ADDRESS :
- format = "a"; //$NON-NLS-1$
- break;
-
- case MIFormat.INSTRUCTION :
- format = "i"; //$NON-NLS-1$
- break;
-
- case MIFormat.CHAR :
- format = "c"; //$NON-NLS-1$
- break;
-
- case MIFormat.STRING :
- format = "s"; //$NON-NLS-1$
- break;
-
- case MIFormat.DECIMAL :
- case MIFormat.NATURAL :
- format = "d"; //$NON-NLS-1$
- break;
-
- case MIFormat.BINARY :
- format = "t"; //$NON-NLS-1$
- break;
-
- case MIFormat.OCTAL :
- format = "o"; //$NON-NLS-1$
- break;
-
- case MIFormat.HEXADECIMAL :
- case MIFormat.RAW :
- default :
- format = "x"; //$NON-NLS-1$
- break;
+ case MIFormat.UNSIGNED:
+ format = "u"; //$NON-NLS-1$
+ break;
+
+ case MIFormat.FLOAT:
+ format = "f"; //$NON-NLS-1$
+ break;
+
+ case MIFormat.ADDRESS:
+ format = "a"; //$NON-NLS-1$
+ break;
+
+ case MIFormat.INSTRUCTION:
+ format = "i"; //$NON-NLS-1$
+ break;
+
+ case MIFormat.CHAR:
+ format = "c"; //$NON-NLS-1$
+ break;
+
+ case MIFormat.STRING:
+ format = "s"; //$NON-NLS-1$
+ break;
+
+ case MIFormat.DECIMAL:
+ case MIFormat.NATURAL:
+ format = "d"; //$NON-NLS-1$
+ break;
+
+ case MIFormat.BINARY:
+ format = "t"; //$NON-NLS-1$
+ break;
+
+ case MIFormat.OCTAL:
+ format = "o"; //$NON-NLS-1$
+ break;
+
+ case MIFormat.HEXADECIMAL:
+ case MIFormat.RAW:
+ default:
+ format = "x"; //$NON-NLS-1$
+ break;
}
if (asChar == null) {
- setParameters(
- new String[] {
- address,
- format,
- Integer.toString(word_size),
- Integer.toString(rows),
- Integer.toString(cols)});
+ setParameters(new String[] { address, format, Integer.toString(word_size), Integer.toString(rows),
+ Integer.toString(cols) });
} else {
- setParameters(
- new String[] {
- address,
- format,
- Integer.toString(word_size),
- Integer.toString(rows),
- Integer.toString(cols),
- asChar.toString()});
+ setParameters(new String[] { address, format, Integer.toString(word_size), Integer.toString(rows),
+ Integer.toString(cols), asChar.toString() });
}
}
- @Override
- public MIDataReadMemoryInfo getResult(MIOutput out) {
- return new MIDataReadMemoryInfo(out, fword_size);
- }
+ @Override
+ public MIDataReadMemoryInfo getResult(MIOutput out) {
+ return new MIDataReadMemoryInfo(out, fword_size);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataReadMemoryBytes.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataReadMemoryBytes.java
index 21e5272191e..43d80f0ab49 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataReadMemoryBytes.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataReadMemoryBytes.java
@@ -23,42 +23,39 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
* -data-read-memory-bytes [ -o BYTE-OFFSET ]
* ADDRESS COUNT
* where:
- *
+ *
* `ADDRESS'
* An expression specifying the address of the first memory word to be
* read. Complex expressions containing embedded white space should
* be quoted using the C convention.
- *
+ *
* `COUNT'
* The number of addressable units to read. This should be an integer literal.
- *
+ *
* `BYTE-OFFSET'
* The offset in addressable units relative to ADDRESS at which to start
* reading. This should be an integer literal. This option is
* provided so that a frontend is not required to first evaluate
* address and then perform address arithmetics itself.
* @since 4.0
- */
+ */
public class MIDataReadMemoryBytes extends MICommand<MIDataReadMemoryBytesInfo> {
-
+
private static final int DEFAULT_ADDRESSABLE_SIZE = 1;
private int fCount;
private int fword_size;
- public MIDataReadMemoryBytes(IDMContext ctx, String address, long offset,
- int count) {
+ public MIDataReadMemoryBytes(IDMContext ctx, String address, long offset, int count) {
this(ctx, address, offset, count, DEFAULT_ADDRESSABLE_SIZE);
}
-
/**
* @param count - The number of addressable units to read from memory
* @since 4.4
*/
- public MIDataReadMemoryBytes(IDMContext ctx, String address, long offset,
- int count, int word_size) {
+ public MIDataReadMemoryBytes(IDMContext ctx, String address, long offset, int count, int word_size) {
super(ctx, "-data-read-memory-bytes"); //$NON-NLS-1$
-
+
fCount = count;
fword_size = word_size;
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataWriteMemory.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataWriteMemory.java
index 7151b69bea0..23d652cfeb5 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataWriteMemory.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataWriteMemory.java
@@ -21,20 +21,20 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIDataWriteMemoryInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
/**
- * -data-write-memory [ -o COLUMN_OFFSET ]
+ * -data-write-memory [ -o COLUMN_OFFSET ]
* ADDRESS WORD-FORMAT WORD-SIZE VALUE
- *
+ *
* where:
- *
+ *
* 'COLUMN_OFFSET'
* The cell offset from the beginning of the memory grid row
- *
+ *
* 'ADDRESS'
* Row address of the cell to be written
- *
+ *
* 'WORD-FORMAT'
* The format to be used to print the memory words
- *
+ *
* 'WORD-SIZE'
* The size of each memory word in bytes
*
@@ -46,76 +46,64 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
*/
public class MIDataWriteMemory extends MICommand<MIDataWriteMemoryInfo> {
- public MIDataWriteMemory(
- IDMContext ctx,
- long offset,
- String address,
- int wordFormat,
- int wordSize,
- String value)
- {
+ public MIDataWriteMemory(IDMContext ctx, long offset, String address, int wordFormat, int wordSize, String value) {
super(ctx, "-data-write-memory"); //$NON-NLS-1$
if (offset != 0) {
- setOptions(new String[] { "-o", Long.toString(offset)}); //$NON-NLS-1$
+ setOptions(new String[] { "-o", Long.toString(offset) }); //$NON-NLS-1$
}
String format = "x"; //$NON-NLS-1$
switch (wordFormat) {
- case MIFormat.UNSIGNED :
- format = "u"; //$NON-NLS-1$
- break;
-
- case MIFormat.FLOAT :
- format = "f"; //$NON-NLS-1$
- break;
-
- case MIFormat.ADDRESS :
- format = "a"; //$NON-NLS-1$
- break;
-
- case MIFormat.INSTRUCTION :
- format = "i"; //$NON-NLS-1$
- break;
-
- case MIFormat.CHAR :
- format = "c"; //$NON-NLS-1$
- break;
-
- case MIFormat.STRING :
- format = "s"; //$NON-NLS-1$
- break;
-
- case MIFormat.DECIMAL :
- case MIFormat.NATURAL :
- format = "d"; //$NON-NLS-1$
- break;
-
- case MIFormat.BINARY :
- format = "t"; //$NON-NLS-1$
- break;
-
- case MIFormat.OCTAL :
- format = "o"; //$NON-NLS-1$
- break;
-
- case MIFormat.HEXADECIMAL :
- case MIFormat.RAW :
- default :
- format = "x"; //$NON-NLS-1$
- break;
+ case MIFormat.UNSIGNED:
+ format = "u"; //$NON-NLS-1$
+ break;
+
+ case MIFormat.FLOAT:
+ format = "f"; //$NON-NLS-1$
+ break;
+
+ case MIFormat.ADDRESS:
+ format = "a"; //$NON-NLS-1$
+ break;
+
+ case MIFormat.INSTRUCTION:
+ format = "i"; //$NON-NLS-1$
+ break;
+
+ case MIFormat.CHAR:
+ format = "c"; //$NON-NLS-1$
+ break;
+
+ case MIFormat.STRING:
+ format = "s"; //$NON-NLS-1$
+ break;
+
+ case MIFormat.DECIMAL:
+ case MIFormat.NATURAL:
+ format = "d"; //$NON-NLS-1$
+ break;
+
+ case MIFormat.BINARY:
+ format = "t"; //$NON-NLS-1$
+ break;
+
+ case MIFormat.OCTAL:
+ format = "o"; //$NON-NLS-1$
+ break;
+
+ case MIFormat.HEXADECIMAL:
+ case MIFormat.RAW:
+ default:
+ format = "x"; //$NON-NLS-1$
+ break;
}
- setParameters(
- new String[] {
- address,
- format,
- Integer.toString(wordSize),
- value});
+ setParameters(new String[] { address, format, Integer.toString(wordSize), value });
}
- @Override
- public MIDataWriteMemoryInfo getResult(MIOutput out) {
- return new MIDataWriteMemoryInfo(out);
- }
+ @Override
+ public MIDataWriteMemoryInfo getResult(MIOutput out) {
+ return new MIDataWriteMemoryInfo(out);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataWriteMemoryBytes.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataWriteMemoryBytes.java
index 71c53a1a856..52f6f7aba59 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataWriteMemoryBytes.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataWriteMemoryBytes.java
@@ -33,24 +33,17 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
*/
public class MIDataWriteMemoryBytes extends MICommand<MIInfo> {
- public MIDataWriteMemoryBytes(
- IDMContext ctx,
- String address,
- byte[] contents)
- {
+ public MIDataWriteMemoryBytes(IDMContext ctx, String address, byte[] contents) {
super(ctx, "-data-write-memory-bytes"); //$NON-NLS-1$
// performance-oriented conversion of byte[] to hex string
- final char[] digits = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
+ final char[] digits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
char[] hex = new char[contents.length * 2];
for (int n = 0; n < contents.length; n++) {
final int val = contents[n] & 0xFF;
- hex[n*2] = digits[val >>> 4];
- hex[n*2 + 1] = digits[val & 0x0F];
+ hex[n * 2] = digits[val >>> 4];
+ hex[n * 2 + 1] = digits[val & 0x0F];
}
- setParameters(
- new String[] {
- address,
- new String(hex)});
+ setParameters(new String[] { address, new String(hex) });
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIEnablePrettyPrinting.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIEnablePrettyPrinting.java
index 1a714e16acd..79ba7f2d247 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIEnablePrettyPrinting.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIEnablePrettyPrinting.java
@@ -20,15 +20,14 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
* -enable-pretty-printing
*
* Enables Python based Pretty printing
- *
+ *
* @since 4.0
*/
-public class MIEnablePrettyPrinting extends MICommand<MIInfo>
-{
+public class MIEnablePrettyPrinting extends MICommand<MIInfo> {
/**
* @param dmc
*/
- public MIEnablePrettyPrinting(ICommandControlDMContext dmc) {
- super(dmc, "-enable-pretty-printing"); //$NON-NLS-1$
- }
+ public MIEnablePrettyPrinting(ICommandControlDMContext dmc) {
+ super(dmc, "-enable-pretty-printing"); //$NON-NLS-1$
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIEnvironmentCD.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIEnvironmentCD.java
index 04086ef4f54..64c1d19994a 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIEnvironmentCD.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIEnvironmentCD.java
@@ -22,11 +22,10 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
*
* Set GDB's working directory.
* @since 1.1
- *
+ *
*/
-public class MIEnvironmentCD extends MICommand <MIInfo>
-{
+public class MIEnvironmentCD extends MICommand<MIInfo> {
public MIEnvironmentCD(ICommandControlDMContext ctx, String path) {
- super(ctx, "-environment-cd", new String[]{path}); //$NON-NLS-1$
+ super(ctx, "-environment-cd", new String[] { path }); //$NON-NLS-1$
}
} \ No newline at end of file
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIEnvironmentDirectory.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIEnvironmentDirectory.java
index 3869a59fe5b..8be3efaca69 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIEnvironmentDirectory.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIEnvironmentDirectory.java
@@ -18,20 +18,20 @@ import org.eclipse.cdt.dsf.datamodel.IDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
- *
+ *
* -environment-directory [-r] PATHDIR
*
* Add directory PATHDIR to beginning of search path for source files.
* -r will first reset the path to its default
- *
+ *
*/
public class MIEnvironmentDirectory extends MICommand<MIInfo> {
-
+
public MIEnvironmentDirectory(IDMContext ctx, String[] paths, boolean reset) {
super(ctx, "-environment-directory", paths); //$NON-NLS-1$
if (reset) {
- setOptions(new String[] {"-r"}); //$NON-NLS-1$
+ setOptions(new String[] { "-r" }); //$NON-NLS-1$
}
}
} \ No newline at end of file
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecArguments.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecArguments.java
index ffb98a160d6..6bac7df35dc 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecArguments.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecArguments.java
@@ -18,16 +18,15 @@ import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
- *
+ *
* -exec-arguments ARGS
*
* Set the inferior program arguments, to be used in the next `-exec-run'.
* Equivalent to using {@link MIGDBSetArgs}
- *
+ *
* @since 4.0
*/
-public class MIExecArguments extends MICommand<MIInfo>
-{
+public class MIExecArguments extends MICommand<MIInfo> {
public MIExecArguments(IMIContainerDMContext ctx, String[] args) {
super(ctx, "-exec-arguments", args); //$NON-NLS-1$
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecContinue.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecContinue.java
index daa7c4b1363..de122095672 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecContinue.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecContinue.java
@@ -19,44 +19,43 @@ import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
- *
+ *
* -exec-continue [--all | --thread-group ID]
- *
+ *
* Asynchronous command. Resumes the execution of the inferior program
* until a breakpoint is encountered, or until the inferior exits.
- *
+ *
*/
-public class MIExecContinue extends MICommand<MIInfo>
-{
- public MIExecContinue(IExecutionDMContext dmc) {
- this(dmc, false);
- }
+public class MIExecContinue extends MICommand<MIInfo> {
+ public MIExecContinue(IExecutionDMContext dmc) {
+ this(dmc, false);
+ }
- /**
- * @since 1.1
- */
- public MIExecContinue(IExecutionDMContext dmc, boolean allThreads) {
- this(dmc, allThreads, null);
- }
+ /**
+ * @since 1.1
+ */
+ public MIExecContinue(IExecutionDMContext dmc, boolean allThreads) {
+ this(dmc, allThreads, null);
+ }
- /**
+ /**
* @since 3.0
*/
- public MIExecContinue(IExecutionDMContext dmc, String groupId) {
- this(dmc, false, groupId);
- }
-
- /*
- * The parameters allThreads and groupId are mutually exclusive. allThreads must be false
- * if we are to use groupId. The value of this method is to only have one place
- * where we use the hard-coded strings.
- */
- private MIExecContinue(IExecutionDMContext dmc, boolean allThreads, String groupId) {
- super(dmc, "-exec-continue"); //$NON-NLS-1$
- if (allThreads) {
- setParameters(new String[] { "--all" }); //$NON-NLS-1$
- } else if (groupId != null) {
- setParameters(new String[] { "--thread-group", groupId }); //$NON-NLS-1$
- }
- }
+ public MIExecContinue(IExecutionDMContext dmc, String groupId) {
+ this(dmc, false, groupId);
+ }
+
+ /*
+ * The parameters allThreads and groupId are mutually exclusive. allThreads must be false
+ * if we are to use groupId. The value of this method is to only have one place
+ * where we use the hard-coded strings.
+ */
+ private MIExecContinue(IExecutionDMContext dmc, boolean allThreads, String groupId) {
+ super(dmc, "-exec-continue"); //$NON-NLS-1$
+ if (allThreads) {
+ setParameters(new String[] { "--all" }); //$NON-NLS-1$
+ } else if (groupId != null) {
+ setParameters(new String[] { "--thread-group", groupId }); //$NON-NLS-1$
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecFinish.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecFinish.java
index f585f998fda..58eb95cdbe4 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecFinish.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecFinish.java
@@ -27,14 +27,13 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
* the function.
* </p>
* <p>
- * The <code>-exec-finish</code> command operates on the selected stack
+ * The <code>-exec-finish</code> command operates on the selected stack
* frame. Therefore the constructor requires a stack frame context.
* </p>
- *
+ *
*/
-public class MIExecFinish extends MICommand<MIInfo>
-{
- public MIExecFinish(IFrameDMContext dmc) {
- super(dmc, "-exec-finish"); //$NON-NLS-1$
- }
+public class MIExecFinish extends MICommand<MIInfo> {
+ public MIExecFinish(IFrameDMContext dmc) {
+ super(dmc, "-exec-finish"); //$NON-NLS-1$
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecInterrupt.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecInterrupt.java
index 99239e7bb0c..34b79d66ff3 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecInterrupt.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecInterrupt.java
@@ -20,7 +20,7 @@ import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
- *
+ *
* -exec-interrupt [--all | --thread-group ID]
*
* Asynchronous command. Interrupts the background execution of the
@@ -29,39 +29,38 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
* interrupt itself only appears in the `^done' output. If the user is
* trying to interrupt a non-running program, an error message will be
* printed.
- *
+ *
*/
-public class MIExecInterrupt extends MICommand<MIInfo>
-{
- public MIExecInterrupt(IExecutionDMContext dmc) {
- this(dmc, false);
- }
+public class MIExecInterrupt extends MICommand<MIInfo> {
+ public MIExecInterrupt(IExecutionDMContext dmc) {
+ this(dmc, false);
+ }
+
+ /**
+ * @since 1.1
+ */
+ public MIExecInterrupt(IExecutionDMContext dmc, boolean allThreads) {
+ this(dmc, allThreads, null);
+ }
- /**
- * @since 1.1
- */
- public MIExecInterrupt(IExecutionDMContext dmc, boolean allThreads) {
- this(dmc, allThreads, null);
- }
-
- /**
+ /**
* @since 3.0
*/
- public MIExecInterrupt(IExecutionDMContext dmc, String groupId) {
- this(dmc, false, groupId);
- }
-
- /*
- * The parameters allThreads and groupId are mutually exclusive. allThreads must be false
- * if we are to use groupId. The value of this method is to only have one place
- * where we use the hard-coded strings.
- */
- private MIExecInterrupt(IExecutionDMContext dmc, boolean allThreads, String groupId) {
- super(dmc, "-exec-interrupt"); //$NON-NLS-1$
- if (allThreads) {
- setParameters(new String[] { "--all" }); //$NON-NLS-1$
- } else if (groupId != null) {
- setParameters(new String[] { "--thread-group", groupId }); //$NON-NLS-1$
- }
- }
+ public MIExecInterrupt(IExecutionDMContext dmc, String groupId) {
+ this(dmc, false, groupId);
+ }
+
+ /*
+ * The parameters allThreads and groupId are mutually exclusive. allThreads must be false
+ * if we are to use groupId. The value of this method is to only have one place
+ * where we use the hard-coded strings.
+ */
+ private MIExecInterrupt(IExecutionDMContext dmc, boolean allThreads, String groupId) {
+ super(dmc, "-exec-interrupt"); //$NON-NLS-1$
+ if (allThreads) {
+ setParameters(new String[] { "--all" }); //$NON-NLS-1$
+ } else if (groupId != null) {
+ setParameters(new String[] { "--thread-group", groupId }); //$NON-NLS-1$
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecJump.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecJump.java
index 84a2f5c09ab..bc8765e343d 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecJump.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecJump.java
@@ -11,27 +11,26 @@
* Contributors:
* Ericsson - Initial API and implementation
*******************************************************************************/
-
+
package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
- *
+ *
* -exec-jump LOCATION
*
* <p>
* Resumes execution of the inferior program at LOCATION
* </p>
- *
+ *
* Available since GDB 7.0
- *
+ *
* @since 3.0
*/
-public class MIExecJump extends MICommand<MIInfo>
-{
+public class MIExecJump extends MICommand<MIInfo> {
public MIExecJump(IExecutionDMContext ctx, String location) {
- super(ctx, "-exec-jump", null, new String[] { location }); //$NON-NLS-1$
- }
+ super(ctx, "-exec-jump", null, new String[] { location }); //$NON-NLS-1$
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecNext.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecNext.java
index ee5c8d99f01..cfa9834c9e8 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecNext.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecNext.java
@@ -20,20 +20,19 @@ import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
- *
+ *
* -exec-next [count]
*
* Asynchronous command. Resumes execution of the inferior program,
* stopping when the beginning of the next source line is reached.
- *
+ *
*/
-public class MIExecNext extends MICommand<MIInfo>
-{
+public class MIExecNext extends MICommand<MIInfo> {
public MIExecNext(IExecutionDMContext dmc) {
- this(dmc, 1);
+ this(dmc, 1);
}
public MIExecNext(IExecutionDMContext dmc, int count) {
- super(dmc, "-exec-next", new String[] { Integer.toString(count) }); //$NON-NLS-1$
+ super(dmc, "-exec-next", new String[] { Integer.toString(count) }); //$NON-NLS-1$
}
} \ No newline at end of file
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecNextInstruction.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecNextInstruction.java
index 2b9db2577ec..efe2b8af893 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecNextInstruction.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecNextInstruction.java
@@ -19,22 +19,21 @@ import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
- *
+ *
* -exec-next-instruction [count]
*
* Asynchronous command. Executes one machine instruction. If the
* instruction is a function call continues until the function returns. If
* the program stops at an instruction in the middle of a source line, the
* address will be printed as well.
- *
+ *
*/
-public class MIExecNextInstruction extends MICommand<MIInfo>
-{
- public MIExecNextInstruction(IExecutionDMContext dmc) {
- this(dmc, 1);
- }
+public class MIExecNextInstruction extends MICommand<MIInfo> {
+ public MIExecNextInstruction(IExecutionDMContext dmc) {
+ this(dmc, 1);
+ }
- public MIExecNextInstruction(IExecutionDMContext dmc, int count) {
- super(dmc, "-exec-next-instruction", new String[] { Integer.toString(count) }); //$NON-NLS-1$
- }
+ public MIExecNextInstruction(IExecutionDMContext dmc, int count) {
+ super(dmc, "-exec-next-instruction", new String[] { Integer.toString(count) }); //$NON-NLS-1$
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReturn.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReturn.java
index d78caaa96cc..c1e8bb2b3ea 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReturn.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReturn.java
@@ -12,14 +12,14 @@
* QNX Software Systems - Initial API and implementation
* Wind River Systems - Modified for new DSF Reference Implementation
*******************************************************************************/
-
+
package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
- *
+ *
* -exec-return [arg]
*
* <p>
@@ -27,18 +27,17 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
* inferior. Displays the new current frame.
* </p>
* <p>
- * The <code>-exec-return</code> command operates on the selected stack
+ * The <code>-exec-return</code> command operates on the selected stack
* frame. Therefore the constructor requires a stack frame context.
* </p>
- *
+ *
*/
-public class MIExecReturn extends MICommand<MIInfo>
-{
- public MIExecReturn(IFrameDMContext dmc) {
- super(dmc, "-exec-return"); //$NON-NLS-1$
- }
+public class MIExecReturn extends MICommand<MIInfo> {
+ public MIExecReturn(IFrameDMContext dmc) {
+ super(dmc, "-exec-return"); //$NON-NLS-1$
+ }
- public MIExecReturn(IFrameDMContext dmc, String arg) {
- super(dmc, "-exec-return", new String[] { arg }); //$NON-NLS-1$
- }
+ public MIExecReturn(IFrameDMContext dmc, String arg) {
+ super(dmc, "-exec-return", new String[] { arg }); //$NON-NLS-1$
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseContinue.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseContinue.java
index 4a2fa10d876..ae4c8ba35eb 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseContinue.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseContinue.java
@@ -16,14 +16,14 @@ package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
-/**
- * Resume backwards.
- *
+/**
+ * Resume backwards.
+ *
* @since 2.0
*/
public class MIExecReverseContinue extends MICommand<MIInfo> {
- public MIExecReverseContinue(IExecutionDMContext dmc) {
- super(dmc, "-interpreter-exec", new String[] {"console", "reverse-continue"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
+ public MIExecReverseContinue(IExecutionDMContext dmc) {
+ super(dmc, "-interpreter-exec", new String[] { "console", "reverse-continue" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseNext.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseNext.java
index 9825340bc95..1c6bc159370 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseNext.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseNext.java
@@ -16,18 +16,18 @@ package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
-/**
+/**
* Steps backward one source code line, not entering function calls.
- *
+ *
* @since 2.0
*/
public class MIExecReverseNext extends MICommand<MIInfo> {
- public MIExecReverseNext(IExecutionDMContext dmc) {
- this(dmc, 1);
- }
+ public MIExecReverseNext(IExecutionDMContext dmc) {
+ this(dmc, 1);
+ }
- public MIExecReverseNext(IExecutionDMContext dmc, int count) {
- super(dmc, "-interpreter-exec", new String[] {"console", "reverse-next " + Integer.toString(count) }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
+ public MIExecReverseNext(IExecutionDMContext dmc, int count) {
+ super(dmc, "-interpreter-exec", new String[] { "console", "reverse-next " + Integer.toString(count) }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseNextInstruction.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseNextInstruction.java
index b6c2b272a4e..2428fc89c6d 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseNextInstruction.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseNextInstruction.java
@@ -16,18 +16,18 @@ package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
-/**
- * Steps backward one machine instruction, not entering function calls.
- *
+/**
+ * Steps backward one machine instruction, not entering function calls.
+ *
* @since 2.0
*/
public class MIExecReverseNextInstruction extends MICommand<MIInfo> {
- public MIExecReverseNextInstruction(IExecutionDMContext dmc) {
- this(dmc, 1);
- }
+ public MIExecReverseNextInstruction(IExecutionDMContext dmc) {
+ this(dmc, 1);
+ }
- public MIExecReverseNextInstruction(IExecutionDMContext dmc, int count) {
- super(dmc, "-interpreter-exec", new String[] {"console", "reverse-nexti " + Integer.toString(count) }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
+ public MIExecReverseNextInstruction(IExecutionDMContext dmc, int count) {
+ super(dmc, "-interpreter-exec", new String[] { "console", "reverse-nexti " + Integer.toString(count) }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseStep.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseStep.java
index 81bd85527ce..a53deea1775 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseStep.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseStep.java
@@ -16,17 +16,18 @@ package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
-/**
- * Step backwards i source lines, entering function calls.
- *
+/**
+ * Step backwards i source lines, entering function calls.
+ *
* @since 2.0
*/
public class MIExecReverseStep extends MICommand<MIInfo> {
- public MIExecReverseStep(IExecutionDMContext dmc) {
- this(dmc, 1);
- }
- public MIExecReverseStep(IExecutionDMContext dmc, int count) {
- super(dmc, "-interpreter-exec", new String[] {"console", "reverse-step " + Integer.toString(count) }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
+ public MIExecReverseStep(IExecutionDMContext dmc) {
+ this(dmc, 1);
+ }
+
+ public MIExecReverseStep(IExecutionDMContext dmc, int count) {
+ super(dmc, "-interpreter-exec", new String[] { "console", "reverse-step " + Integer.toString(count) }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseStepInstruction.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseStepInstruction.java
index d858255bac8..b41ca94a2fe 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseStepInstruction.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseStepInstruction.java
@@ -16,17 +16,18 @@ package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
-/**
- * Step backwards i instructions, entering function calls.
- *
+/**
+ * Step backwards i instructions, entering function calls.
+ *
* @since 2.0
*/
public class MIExecReverseStepInstruction extends MICommand<MIInfo> {
- public MIExecReverseStepInstruction(IExecutionDMContext dmc) {
- this(dmc, 1);
- }
- public MIExecReverseStepInstruction(IExecutionDMContext dmc, int count) {
- super(dmc, "-interpreter-exec", new String[] {"console", "reverse-stepi " + Integer.toString(count) }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
+ public MIExecReverseStepInstruction(IExecutionDMContext dmc) {
+ this(dmc, 1);
+ }
+
+ public MIExecReverseStepInstruction(IExecutionDMContext dmc, int count) {
+ super(dmc, "-interpreter-exec", new String[] { "console", "reverse-stepi " + Integer.toString(count) }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecRun.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecRun.java
index d683ed9704f..e3928643bf9 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecRun.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecRun.java
@@ -20,23 +20,22 @@ import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
- *
+ *
* -exec-run [ARGS]
*
* Asynchronous command. Starts execution of the inferior from the
* beginning. The inferior executes until either a breakpoint is
* encountered or the program exits.
- *
+ *
* ARGS will be passed to the inferior. This option is not documented.
- *
+ *
*/
-public class MIExecRun extends MICommand<MIInfo>
-{
- public MIExecRun(IExecutionDMContext dmc) {
- super(dmc, "-exec-run"); //$NON-NLS-1$
- }
-
- public MIExecRun(IExecutionDMContext dmc, String[] args) {
- super(dmc, "-exec-run", args); //$NON-NLS-1$
- }
+public class MIExecRun extends MICommand<MIInfo> {
+ public MIExecRun(IExecutionDMContext dmc) {
+ super(dmc, "-exec-run"); //$NON-NLS-1$
+ }
+
+ public MIExecRun(IExecutionDMContext dmc, String[] args) {
+ super(dmc, "-exec-run", args); //$NON-NLS-1$
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecStep.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecStep.java
index cd5c13a742e..c43d2f87795 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecStep.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecStep.java
@@ -20,22 +20,21 @@ import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
- *
+ *
* -exec-step [count]
*
* Asynchronous command. Resumes execution of the inferior program,
* stopping when the beginning of the next source line is reached, if the
* next source line is not a function call. If it is, stop at the first
* instruction of the called function.
- *
+ *
*/
-public class MIExecStep extends MICommand<MIInfo>
-{
- public MIExecStep(IExecutionDMContext dmc) {
- this(dmc, 1);
- }
+public class MIExecStep extends MICommand<MIInfo> {
+ public MIExecStep(IExecutionDMContext dmc) {
+ this(dmc, 1);
+ }
- public MIExecStep(IExecutionDMContext dmc, int count) {
- super(dmc, "-exec-step", new String[] { Integer.toString(count) }); //$NON-NLS-1$
- }
+ public MIExecStep(IExecutionDMContext dmc, int count) {
+ super(dmc, "-exec-step", new String[] { Integer.toString(count) }); //$NON-NLS-1$
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecStepInstruction.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecStepInstruction.java
index 06e673155be..0db6c6e8ad2 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecStepInstruction.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecStepInstruction.java
@@ -19,7 +19,7 @@ import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
- *
+ *
* -exec-step-instruction [count]
* Asynchronous command. Resumes the inferior which executes one
@@ -27,15 +27,14 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
* depending on whether we have stopped in the middle of a source line or
* not. In the former case, the address at which the program stopped will
* be printed as well.
- *
+ *
*/
-public class MIExecStepInstruction extends MICommand<MIInfo>
-{
- public MIExecStepInstruction(IExecutionDMContext dmc) {
- this(dmc, 1);
- }
+public class MIExecStepInstruction extends MICommand<MIInfo> {
+ public MIExecStepInstruction(IExecutionDMContext dmc) {
+ this(dmc, 1);
+ }
- public MIExecStepInstruction(IExecutionDMContext dmc, int count) {
- super(dmc, "-exec-step-instruction", new String[] { Integer.toString(count) }); //$NON-NLS-1$
- }
+ public MIExecStepInstruction(IExecutionDMContext dmc, int count) {
+ super(dmc, "-exec-step-instruction", new String[] { Integer.toString(count) }); //$NON-NLS-1$
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecUncall.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecUncall.java
index 307bcd484ca..e1b358ca706 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecUncall.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecUncall.java
@@ -16,15 +16,15 @@ package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
-/**
+/**
* Steps backward until the line where the current method
* was originally called.
- *
+ *
* @since 2.0
*/
public class MIExecUncall extends MICommand<MIInfo> {
- public MIExecUncall(IFrameDMContext dmc) {
- super(dmc, "-interpreter-exec", new String[] {"console", "reverse-finish"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
+ public MIExecUncall(IFrameDMContext dmc) {
+ super(dmc, "-interpreter-exec", new String[] { "console", "reverse-finish" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecUntil.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecUntil.java
index cf4645b4e9a..93587d47b9b 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecUntil.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecUntil.java
@@ -20,7 +20,7 @@ import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
- *
+ *
* -exec-until [ LOCATION ]
*
* Asynchronous command. Executes the inferior until the LOCATION
@@ -28,15 +28,14 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
* inferior executes until a source line greater than the current one is
* reached. The reason for stopping in this case will be
* `location-reached'.
- *
+ *
*/
-public class MIExecUntil extends MICommand<MIInfo>
-{
- public MIExecUntil(IExecutionDMContext dmc) {
- super(dmc, "-exec-until"); //$NON-NLS-1$
- }
+public class MIExecUntil extends MICommand<MIInfo> {
+ public MIExecUntil(IExecutionDMContext dmc) {
+ super(dmc, "-exec-until"); //$NON-NLS-1$
+ }
- public MIExecUntil(IExecutionDMContext dmc, String loc) {
- super(dmc, "-exec-until", new String[] { loc }); //$NON-NLS-1$
- }
+ public MIExecUntil(IExecutionDMContext dmc, String loc) {
+ super(dmc, "-exec-until", new String[] { loc }); //$NON-NLS-1$
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIFileExecAndSymbols.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIFileExecAndSymbols.java
index 1b58327828d..3757f11313d 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIFileExecAndSymbols.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIFileExecAndSymbols.java
@@ -20,22 +20,21 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
* -file-exec-and-symbols [FILE]
- *
+ *
* Specify the executable file to be debugged. This file is the one from which
* the symbol table is also read. If no file is specified, the command clears
* the executable and symbol information. If breakpoints are set when using this
* command with no arguments, gdb will produce error messages. Otherwise, no
* output is produced, except a completion notification.
*/
-public class MIFileExecAndSymbols extends MICommand<MIInfo>
-{
- /** @since 4.0 */
- public MIFileExecAndSymbols(IMIContainerDMContext dmc) {
- this(dmc, null);
- }
+public class MIFileExecAndSymbols extends MICommand<MIInfo> {
+ /** @since 4.0 */
+ public MIFileExecAndSymbols(IMIContainerDMContext dmc) {
+ this(dmc, null);
+ }
- /** @since 4.0 */
- public MIFileExecAndSymbols(IMIContainerDMContext dmc, String file) {
- super(dmc, "-file-exec-and-symbols", null, file == null ? null : new String[] {file}); //$NON-NLS-1$
- }
+ /** @since 4.0 */
+ public MIFileExecAndSymbols(IMIContainerDMContext dmc, String file) {
+ super(dmc, "-file-exec-and-symbols", null, file == null ? null : new String[] { file }); //$NON-NLS-1$
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIFileExecFile.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIFileExecFile.java
index be4c4999335..dbf13bb1a54 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIFileExecFile.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIFileExecFile.java
@@ -18,28 +18,26 @@ 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;
-
-/**
+/**
* -file-exec-file [FILE]
- *
- * Specify the executable file to be debugged. Unlike `-file-exec-and-symbols',
- * the symbol table is not read from this file. If used without argument, GDB
- * clears the information about the executable file. No output is produced,
+ *
+ * Specify the executable file to be debugged. Unlike `-file-exec-and-symbols',
+ * the symbol table is not read from this file. If used without argument, GDB
+ * clears the information about the executable file. No output is produced,
* except a completion notification.
*/
-public class MIFileExecFile extends MICommand<MIInfo>
-{
- /**
- * @since 1.1
- */
- public MIFileExecFile(ICommandControlDMContext dmc, String file) {
- super(dmc, "-file-exec-file", null, new String[] {file}); //$NON-NLS-1$
- }
+public class MIFileExecFile extends MICommand<MIInfo> {
+ /**
+ * @since 1.1
+ */
+ public MIFileExecFile(ICommandControlDMContext dmc, String file) {
+ super(dmc, "-file-exec-file", null, new String[] { file }); //$NON-NLS-1$
+ }
- /**
- * @since 1.1
- */
- public MIFileExecFile(ICommandControlDMContext dmc) {
- super(dmc, "-file-exec-file"); //$NON-NLS-1$
- }
+ /**
+ * @since 1.1
+ */
+ public MIFileExecFile(ICommandControlDMContext dmc) {
+ super(dmc, "-file-exec-file"); //$NON-NLS-1$
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIFileSymbolFile.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIFileSymbolFile.java
index 4cf108a0178..e711a0edfe9 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIFileSymbolFile.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIFileSymbolFile.java
@@ -18,27 +18,25 @@ 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;
-
-/**
+/**
* -file-symbol-file [FILE]
- *
- * Read symbol table info from the specified file argument. When used without
- * arguments, clears GDB's symbol table info. No output is produced, except
+ *
+ * Read symbol table info from the specified file argument. When used without
+ * arguments, clears GDB's symbol table info. No output is produced, except
* for a completion notification.
*/
-public class MIFileSymbolFile extends MICommand<MIInfo>
-{
- /**
- * @since 1.1
- */
- public MIFileSymbolFile(ICommandControlDMContext dmc, String file) {
- super(dmc, "-file-symbol-file", null, new String[] {file}); //$NON-NLS-1$
- }
-
- /**
- * @since 1.1
- */
- public MIFileSymbolFile(ICommandControlDMContext dmc) {
- super(dmc, "-file-symbol-file"); //$NON-NLS-1$
- }
+public class MIFileSymbolFile extends MICommand<MIInfo> {
+ /**
+ * @since 1.1
+ */
+ public MIFileSymbolFile(ICommandControlDMContext dmc, String file) {
+ super(dmc, "-file-symbol-file", null, new String[] { file }); //$NON-NLS-1$
+ }
+
+ /**
+ * @since 1.1
+ */
+ public MIFileSymbolFile(ICommandControlDMContext dmc) {
+ super(dmc, "-file-symbol-file"); //$NON-NLS-1$
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBExit.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBExit.java
index 1c8a70c171a..5ce1f6f2645 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBExit.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBExit.java
@@ -19,15 +19,14 @@ import org.eclipse.cdt.dsf.datamodel.IDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
- *
+ *
* -gdb-exit
*
* Exit GDB immediately.
- *
+ *
*/
-public class MIGDBExit extends MICommand<MIInfo>
-{
- public MIGDBExit(IDMContext ctx) {
- super(ctx, "-gdb-exit"); //$NON-NLS-1$
- }
+public class MIGDBExit extends MICommand<MIInfo> {
+ public MIGDBExit(IDMContext ctx) {
+ super(ctx, "-gdb-exit"); //$NON-NLS-1$
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSet.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSet.java
index 2fdcd2bcade..751e3bd03b4 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSet.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSet.java
@@ -20,20 +20,19 @@ import org.eclipse.cdt.dsf.datamodel.IDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
- *
+ *
* -gdb-set
- *
+ *
*/
-public class MIGDBSet extends MICommand<MIInfo>
-{
- public MIGDBSet(IDMContext ctx, String[] params) {
- super(ctx, "-gdb-set", null, params); //$NON-NLS-1$
- }
+public class MIGDBSet extends MICommand<MIInfo> {
+ public MIGDBSet(IDMContext ctx, String[] params) {
+ super(ctx, "-gdb-set", null, params); //$NON-NLS-1$
+ }
- /**
+ /**
* @since 5.2
*/
- public MIGDBSet(IDMContext ctx, String[] params, Function<String, Adjustable> paramToAdjustable) {
- super(ctx, "-gdb-set", null, params, paramToAdjustable); //$NON-NLS-1$
- }
+ public MIGDBSet(IDMContext ctx, String[] params, Function<String, Adjustable> paramToAdjustable) {
+ super(ctx, "-gdb-set", null, params, paramToAdjustable); //$NON-NLS-1$
+ }
} \ No newline at end of file
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetAutoSolib.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetAutoSolib.java
index 340aa67964a..d83d3acdf85 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetAutoSolib.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetAutoSolib.java
@@ -16,16 +16,15 @@ package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
/**
- *
+ *
* -gdb-set
- *
+ *
*/
-public class MIGDBSetAutoSolib extends MIGDBSet
-{
- /**
- * @since 1.1
- */
- public MIGDBSetAutoSolib(ICommandControlDMContext ctx, boolean isSet) {
- super(ctx, new String[] {"auto-solib-add", isSet ? "on" : "off"});//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
- }
+public class MIGDBSetAutoSolib extends MIGDBSet {
+ /**
+ * @since 1.1
+ */
+ public MIGDBSetAutoSolib(ICommandControlDMContext ctx, boolean isSet) {
+ super(ctx, new String[] { "auto-solib-add", isSet ? "on" : "off" });//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
+ }
} \ No newline at end of file
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetBreakpointPending.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetBreakpointPending.java
index 7d27ea5b59a..e327630054f 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetBreakpointPending.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetBreakpointPending.java
@@ -16,20 +16,19 @@ package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
/**
- *
+ *
* -gdb-set breakpoint pending [on | off]
- *
+ *
* This command should be used to make breakpoints/tracepoints that are created
* using a CLI command to be set as potentially pending breakpoints in GDB.
- *
+ *
* Available with GDB 6.1
- *
+ *
* @since 4.0
- *
+ *
*/
-public class MIGDBSetBreakpointPending extends MIGDBSet
-{
- public MIGDBSetBreakpointPending(ICommandControlDMContext ctx, boolean enable) {
- super(ctx, new String[] {"breakpoint", "pending", enable ? "on" : "off"});//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$
- }
+public class MIGDBSetBreakpointPending extends MIGDBSet {
+ public MIGDBSetBreakpointPending(ICommandControlDMContext ctx, boolean enable) {
+ super(ctx, new String[] { "breakpoint", "pending", enable ? "on" : "off" });//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$
+ }
} \ No newline at end of file
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetCharset.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetCharset.java
index a5d56f95c37..5dd052e9082 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetCharset.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetCharset.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Mathias Kunter - Initial API and implementation
*******************************************************************************/
@@ -17,17 +17,17 @@ package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
/**
- *
+ *
* -gdb-set charset CHARSET
- *
+ *
* Sets both the current host and target charset to CHARSET. The host charset is the
* charset used by gdb. The target charset is the charset used by the char type of the
* inferior program.
- *
+ *
* @since 4.1
*/
public class MIGDBSetCharset extends MIGDBSet {
public MIGDBSetCharset(ICommandControlDMContext ctx, String charset) {
- super(ctx, new String[] {"charset", charset}); //$NON-NLS-1$
+ super(ctx, new String[] { "charset", charset }); //$NON-NLS-1$
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetCircularTraceBuffer.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetCircularTraceBuffer.java
index 538334fdb48..b04131d6f3c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetCircularTraceBuffer.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetCircularTraceBuffer.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Dmitry Kozlov (Mentor Graphics) - Initial API and implementation
*******************************************************************************/
@@ -18,12 +18,12 @@ import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl.ITraceTargetDMContext;
/**
* -gdb-set circular-trace-buffer on | off
- *
+ *
* Sets circular trace buffer on or off.
* @since 4.4
*/
public class MIGDBSetCircularTraceBuffer extends MIGDBSet {
public MIGDBSetCircularTraceBuffer(ITraceTargetDMContext ctx, boolean useCircularTraceBuffer) {
- super(ctx, new String[] {"circular-trace-buffer", useCircularTraceBuffer ? "on": "off"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ super(ctx, new String[] { "circular-trace-buffer", useCircularTraceBuffer ? "on" : "off" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetDPrintfStyle.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetDPrintfStyle.java
index b1341be7110..9b0b68d5ffd 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetDPrintfStyle.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetDPrintfStyle.java
@@ -18,27 +18,27 @@ import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommand
/**
* -gdb-set dprintf-style STYLE
- *
- * Set the dprintf output to be handled in one of several different styles enumerated below.
- * A change of style affects all existing dynamic printfs immediately.
- *
+ *
+ * Set the dprintf output to be handled in one of several different styles enumerated below.
+ * A change of style affects all existing dynamic printfs immediately.
+ *
* gdb
* Handle the output using the gdb printf command.
* call
* Handle the output by calling a function in your program (normally printf).
* agent
- * Have the remote debugging agent (such as gdbserver) handle the output itself.
+ * Have the remote debugging agent (such as gdbserver) handle the output itself.
* This style is only available for agents that support running commands on the target.
- *
+ *
* @since 4.4
*/
public class MIGDBSetDPrintfStyle extends MIGDBSet {
- public static final String GDB_STYLE = "gdb"; //$NON-NLS-1$
- public static final String CALL_STYLE = "call"; //$NON-NLS-1$
+ public static final String GDB_STYLE = "gdb"; //$NON-NLS-1$
+ public static final String CALL_STYLE = "call"; //$NON-NLS-1$
public static final String AGENT_STYLE = "agent"; //$NON-NLS-1$
public MIGDBSetDPrintfStyle(ICommandControlDMContext dmc, String style) {
super(dmc, new String[] { "dprintf-style", style }); //$NON-NLS-1$
- }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetDetachOnFork.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetDetachOnFork.java
index e52e3e265cc..591a0f2a02c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetDetachOnFork.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetDetachOnFork.java
@@ -16,17 +16,16 @@ package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
/**
- *
+ *
* -gdb-set detach-on-fork [on|off]
- *
+ *
* When 'on', tells GDB to detach from process that has been forked.
* When 'off', automatically starts debugging a forked process in a multi-process session.
- *
+ *
* @since 4.0
*/
-public class MIGDBSetDetachOnFork extends MIGDBSet
-{
- public MIGDBSetDetachOnFork(ICommandControlDMContext ctx, boolean detach) {
- super(ctx, new String[] {"detach-on-fork", detach ? "on" : "off"});//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
- }
+public class MIGDBSetDetachOnFork extends MIGDBSet {
+ public MIGDBSetDetachOnFork(ICommandControlDMContext ctx, boolean detach) {
+ super(ctx, new String[] { "detach-on-fork", detach ? "on" : "off" });//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
+ }
} \ No newline at end of file
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetDisconnectedTracing.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetDisconnectedTracing.java
index 7689ea374a0..47e4b44fec9 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetDisconnectedTracing.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetDisconnectedTracing.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Dmitry Kozlov (Mentor Graphics) - Initial API and implementation
*******************************************************************************/
@@ -18,12 +18,12 @@ import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl.ITraceTargetDMContext;
/**
* -gdb-set disconnected-tracing on | off
- *
+ *
* Sets disconnected-tracing on or off.
* @since 4.4
*/
public class MIGDBSetDisconnectedTracing extends MIGDBSet {
public MIGDBSetDisconnectedTracing(ITraceTargetDMContext ctx, boolean disconnectedTracing) {
- super(ctx, new String[] {"disconnected-tracing", disconnectedTracing ? "on": "off"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ super(ctx, new String[] { "disconnected-tracing", disconnectedTracing ? "on" : "off" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetEnv.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetEnv.java
index 34c4eaa0571..bc0d4c8d079 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetEnv.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetEnv.java
@@ -17,49 +17,48 @@ package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
/**
- *
+ *
* -gdb-set env VARNAME [=VALUE]
*
- * Set environment variable VARNAME to VALUE. The value changes for your program only,
- * not for gdb itself. VALUE may be any string; the values of environment variables are
+ * Set environment variable VARNAME to VALUE. The value changes for your program only,
+ * not for gdb itself. VALUE may be any string; the values of environment variables are
* just strings, and any interpretation is supplied by your program itself. The VALUE
* parameter is optional; if it is omitted, the variable is set to a null value.
*
* @since 3.0
- *
+ *
*/
-public class MIGDBSetEnv extends MIGDBSet
-{
- public MIGDBSetEnv(ICommandControlDMContext dmc, String name) {
- this(dmc, name, null);
- }
+public class MIGDBSetEnv extends MIGDBSet {
+ public MIGDBSetEnv(ICommandControlDMContext dmc, String name) {
+ this(dmc, name, null);
+ }
+
+ public MIGDBSetEnv(ICommandControlDMContext dmc, String name, String value) {
+ // MICommand wraps a parameter with double quotes if it contains a space. If the
+ // value of the environment variable has a space, and we bundle the var name, the
+ // '=' and the value as a single parameter, then we'll end up with something like
+ //
+ // -gdb-set env "MYVAR=MY VAR"
+ //
+ // which defines an environment variable named "MYVAR=MY VAR", with an empty
+ // string for a value. To avoid this, we send each element as a separate parameter
+ //
+ // -gdb-set env MYVAR = MY VAR
+ super(dmc, null);
+
+ if (value == null || value.length() == 0) {
+ setParameters(new String[] { "env", name }); //$NON-NLS-1$
+ } else {
+ String[] splitValue = value.split(" "); //$NON-NLS-1$
+ String[] params = new String[splitValue.length + 3];
+ params[0] = "env"; //$NON-NLS-1$
+ params[1] = name;
+ params[2] = "="; //$NON-NLS-1$
+ for (int i = 3; i < params.length; i++) {
+ params[i] = splitValue[i - 3];
+ }
- public MIGDBSetEnv(ICommandControlDMContext dmc, String name, String value) {
- // MICommand wraps a parameter with double quotes if it contains a space. If the
- // value of the environment variable has a space, and we bundle the var name, the
- // '=' and the value as a single parameter, then we'll end up with something like
- //
- // -gdb-set env "MYVAR=MY VAR"
- //
- // which defines an environment variable named "MYVAR=MY VAR", with an empty
- // string for a value. To avoid this, we send each element as a separate parameter
- //
- // -gdb-set env MYVAR = MY VAR
- super(dmc, null);
-
- if (value == null || value.length() == 0) {
- setParameters(new String[] { "env", name }); //$NON-NLS-1$
- } else {
- String[] splitValue = value.split(" "); //$NON-NLS-1$
- String[] params = new String[splitValue.length+3];
- params[0] = "env"; //$NON-NLS-1$
- params[1] = name;
- params[2] = "="; //$NON-NLS-1$
- for (int i=3; i<params.length; i++) {
- params[i] = splitValue[i-3];
- }
-
- setParameters(params);
- }
- }
+ setParameters(params);
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetHostCharset.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetHostCharset.java
index ee858eda880..b987dde97b5 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetHostCharset.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetHostCharset.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Mathias Kunter - Initial API and implementation
*******************************************************************************/
@@ -17,15 +17,15 @@ package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
/**
- *
+ *
* -gdb-set host-charset CHARSET
- *
+ *
* Sets the current host charset to CHARSET. The host charset is the charset used by gdb.
- *
+ *
* @since 4.1
*/
public class MIGDBSetHostCharset extends MIGDBSet {
public MIGDBSetHostCharset(ICommandControlDMContext ctx, String hostCharset) {
- super(ctx, new String[] {"host-charset", hostCharset}); //$NON-NLS-1$
+ super(ctx, new String[] { "host-charset", hostCharset }); //$NON-NLS-1$
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetLanguage.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetLanguage.java
index f3ecc0047f0..a930dadf213 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetLanguage.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetLanguage.java
@@ -17,7 +17,7 @@ package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.datamodel.IDMContext;
/**
- *
+ *
* -gdb-set language
*
* @since 4.3
@@ -25,6 +25,6 @@ import org.eclipse.cdt.dsf.datamodel.IDMContext;
public class MIGDBSetLanguage extends MIGDBSet {
public MIGDBSetLanguage(IDMContext ctx, String language) {
- super(ctx, new String[] {"language", language}); //$NON-NLS-1$
+ super(ctx, new String[] { "language", language }); //$NON-NLS-1$
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetNewConsole.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetNewConsole.java
index b9d2d249af9..ee173cc5eae 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetNewConsole.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetNewConsole.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Kichwa Coders - initial API and implementation
*******************************************************************************/
@@ -19,7 +19,7 @@ import org.eclipse.cdt.dsf.datamodel.IDMContext;
* -gdb-set new-console on|off
*
* Set whether to start in a new console or not
- *
+ *
* @since 5.4
*/
public class MIGDBSetNewConsole extends MIGDBSet {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetNonStop.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetNonStop.java
index c62cb5dcdd6..0f24516adf8 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetNonStop.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetNonStop.java
@@ -16,14 +16,13 @@ package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
/**
- *
+ *
* -gdb-set non-stop [on | off]
* @since 1.1
- *
+ *
*/
-public class MIGDBSetNonStop extends MIGDBSet
-{
- public MIGDBSetNonStop(ICommandControlDMContext ctx, boolean isSet) {
- super(ctx, new String[] {"non-stop", isSet ? "on" : "off"});//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
- }
+public class MIGDBSetNonStop extends MIGDBSet {
+ public MIGDBSetNonStop(ICommandControlDMContext ctx, boolean isSet) {
+ super(ctx, new String[] { "non-stop", isSet ? "on" : "off" });//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
+ }
} \ No newline at end of file
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPagination.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPagination.java
index fdc2f4a3fef..5d14f3f4c5c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPagination.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPagination.java
@@ -16,14 +16,13 @@ package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
/**
- *
+ *
* -gdb-set pagination [on | off]
- *
+ *
* @since 3.0
*/
-public class MIGDBSetPagination extends MIGDBSet
-{
- public MIGDBSetPagination(ICommandControlDMContext ctx, boolean isSet) {
- super(ctx, new String[] {"pagination", isSet ? "on" : "off"});//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
- }
+public class MIGDBSetPagination extends MIGDBSet {
+ public MIGDBSetPagination(ICommandControlDMContext ctx, boolean isSet) {
+ super(ctx, new String[] { "pagination", isSet ? "on" : "off" });//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPrintObject.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPrintObject.java
index 61e7efc5ae1..aebe6bc90e3 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPrintObject.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPrintObject.java
@@ -16,18 +16,18 @@ package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
/**
- *
+ *
* -gdb-set print object [on | off]
- *
+ *
* When on:
* for GDB <= 7.4, Runtime Type Information will be used in the gdb console.
* for GDB >= 7.5, Runtime Type Information will be used in the debug views.
* When off, only static type of variable is taken into account.
- *
+ *
* @since 4.1
*/
public class MIGDBSetPrintObject extends MIGDBSet {
public MIGDBSetPrintObject(ICommandControlDMContext ctx, boolean enable) {
- super(ctx, new String[] {"print", "object", enable ? "on" : "off"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ super(ctx, new String[] { "print", "object", enable ? "on" : "off" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPrintSevenbitStrings.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPrintSevenbitStrings.java
index 5c8898f2e54..888de587c7d 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPrintSevenbitStrings.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPrintSevenbitStrings.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Mathias Kunter - Initial API and implementation
*******************************************************************************/
@@ -17,16 +17,16 @@ package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
/**
- *
+ *
* -gdb-set print sevenbit-strings [on | off]
- *
+ *
* When on, gdb displays any eight-bit characters (in strings or character values) using
* the octal escape notation \nnn. When off, prints full eight-bit characters.
- *
+ *
* @since 4.1
*/
public class MIGDBSetPrintSevenbitStrings extends MIGDBSet {
public MIGDBSetPrintSevenbitStrings(ICommandControlDMContext ctx, boolean enable) {
- super(ctx, new String[] {"print", "sevenbit-strings", enable ? "on" : "off"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ super(ctx, new String[] { "print", "sevenbit-strings", enable ? "on" : "off" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPythonPrintStack.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPythonPrintStack.java
index 7708787a880..f57faf58fb7 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPythonPrintStack.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPythonPrintStack.java
@@ -16,22 +16,21 @@ package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
/**
- *
+ *
* -gdb-set python print-stack [ none | message | full ]
- *
- * By default, gdb will print only the message component of a Python exception when an error occurs
- * in a Python script. This can be controlled using set python print-stack: if full, then full Python
+ *
+ * By default, gdb will print only the message component of a Python exception when an error occurs
+ * in a Python script. This can be controlled using set python print-stack: if full, then full Python
* stack printing is enabled; if none, then Python stack and message printing is disabled; if message,
* the default, only the message component of the error is printed.
- *
+ *
* Available with GDB 7.4
- *
+ *
* @since 4.1
- *
+ *
*/
-public class MIGDBSetPythonPrintStack extends MIGDBSet
-{
- public MIGDBSetPythonPrintStack(ICommandControlDMContext ctx, String option) {
- super(ctx, new String[] {"python", "print-stack", option}); //$NON-NLS-1$//$NON-NLS-2$
- }
+public class MIGDBSetPythonPrintStack extends MIGDBSet {
+ public MIGDBSetPythonPrintStack(ICommandControlDMContext ctx, String option) {
+ super(ctx, new String[] { "python", "print-stack", option }); //$NON-NLS-1$//$NON-NLS-2$
+ }
} \ No newline at end of file
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetRecordFullStopAtLimit.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetRecordFullStopAtLimit.java
index df4c6690365..b3295a63353 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetRecordFullStopAtLimit.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetRecordFullStopAtLimit.java
@@ -15,11 +15,10 @@ import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommand
/**
* -gdb-set record full stop-at-limit [on | off]
* @since 5.2
- *
+ *
*/
-public class MIGDBSetRecordFullStopAtLimit extends MIGDBSet
-{
- public MIGDBSetRecordFullStopAtLimit(ICommandControlDMContext ctx, boolean isSet) {
- super(ctx, new String[] {"record", "full", "stop-at-limit", isSet ? "on" : "off"});//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- }
+public class MIGDBSetRecordFullStopAtLimit extends MIGDBSet {
+ public MIGDBSetRecordFullStopAtLimit(ICommandControlDMContext ctx, boolean isSet) {
+ super(ctx, new String[] { "record", "full", "stop-at-limit", isSet ? "on" : "off" });//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ }
} \ No newline at end of file
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetRemoteTimeout.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetRemoteTimeout.java
index a7fddac4b88..7d6feb15184 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetRemoteTimeout.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetRemoteTimeout.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Jonah Graham (Kichwa Coders)- Initial API and implementation
*/
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetSchedulerLocking.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetSchedulerLocking.java
index ae411d67bdd..26cbc8431b5 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetSchedulerLocking.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetSchedulerLocking.java
@@ -16,26 +16,25 @@ package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
/**
- *
+ *
* -gdb-set scheduler-locking [on|step|off]
- *
- * Set the scheduler locking mode. If it is off, then there is no locking and any thread may run at any time.
- * If on, then only the current thread may run when the inferior is resumed. The step mode optimizes for
- * single-stepping; it prevents other threads from preempting the current thread while you are stepping, so
- * that the focus of debugging does not change unexpectedly. Other threads only rarely (or never) get a chance
- * to run when you step. They are more likely to run when you `next' over a function call, and they are
- * completely free to run when you use commands like `continue', `until', or `finish'. However, unless another
- * thread hits a breakpoint during its timeslice, gdb does not change the current thread away from the thread
- * that you are debugging.
- *
+ *
+ * Set the scheduler locking mode. If it is off, then there is no locking and any thread may run at any time.
+ * If on, then only the current thread may run when the inferior is resumed. The step mode optimizes for
+ * single-stepping; it prevents other threads from preempting the current thread while you are stepping, so
+ * that the focus of debugging does not change unexpectedly. Other threads only rarely (or never) get a chance
+ * to run when you step. They are more likely to run when you `next' over a function call, and they are
+ * completely free to run when you use commands like `continue', `until', or `finish'. However, unless another
+ * thread hits a breakpoint during its timeslice, gdb does not change the current thread away from the thread
+ * that you are debugging.
+ *
* @since 4.1
*/
-public class MIGDBSetSchedulerLocking extends MIGDBSet
-{
+public class MIGDBSetSchedulerLocking extends MIGDBSet {
/**
* @param mode The value to be send to GDB. Can be 'on', 'off', 'step'
*/
- public MIGDBSetSchedulerLocking(ICommandControlDMContext ctx, String mode) {
- super(ctx, new String[] {"scheduler-locking", mode});//$NON-NLS-1$
- }
+ public MIGDBSetSchedulerLocking(ICommandControlDMContext ctx, String mode) {
+ super(ctx, new String[] { "scheduler-locking", mode });//$NON-NLS-1$
+ }
} \ No newline at end of file
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetSolibAbsolutePrefix.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetSolibAbsolutePrefix.java
index 0a749829d3b..37dc992e7f2 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetSolibAbsolutePrefix.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetSolibAbsolutePrefix.java
@@ -15,6 +15,7 @@
package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
+
/**
*
* -gdb-set solib-absolute-prefix PATH
@@ -24,7 +25,7 @@ import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommand
public class MIGDBSetSolibAbsolutePrefix extends MIGDBSet {
public MIGDBSetSolibAbsolutePrefix(ICommandControlDMContext ctx, String prefix) {
- super(ctx, new String[] {"solib-absolute-prefix", prefix}, x-> new MINoChangeAdjustable(x)); //$NON-NLS-1$
+ super(ctx, new String[] { "solib-absolute-prefix", prefix }, x -> new MINoChangeAdjustable(x)); //$NON-NLS-1$
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetSolibSearchPath.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetSolibSearchPath.java
index 71ea4ee6412..bf0d616a863 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetSolibSearchPath.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetSolibSearchPath.java
@@ -17,19 +17,17 @@ package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
/**
- *
+ *
* -gdb-set solib-search-path COLON-SEPARATED-PATH
- *
+ *
*/
-public class MIGDBSetSolibSearchPath extends MIGDBSet
-{
+public class MIGDBSetSolibSearchPath extends MIGDBSet {
/**
- * @since 1.1
- */
+ * @since 1.1
+ */
public MIGDBSetSolibSearchPath(ICommandControlDMContext ctx, String[] paths) {
- super(ctx,
- new String[] {"solib-search-path", concat(paths, System.getProperty("path.separator", ":"))}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- x-> new MINoChangeAdjustable(x));
+ super(ctx, new String[] { "solib-search-path", concat(paths, System.getProperty("path.separator", ":")) }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ x -> new MINoChangeAdjustable(x));
}
private static String concat(String[] paths, String sep) {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetStopOnSolibEvents.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetStopOnSolibEvents.java
index f7f020a3f88..c439aa61e6c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetStopOnSolibEvents.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetStopOnSolibEvents.java
@@ -16,18 +16,17 @@ package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
/**
- *
+ *
* -gdb-set stop-on-solib-events
- *
- * Controls whether GDB should give you control when the dynamic linker
- * notifies it about some shared library event. The most common event of interest is loading
+ *
+ * Controls whether GDB should give you control when the dynamic linker
+ * notifies it about some shared library event. The most common event of interest is loading
* or unloading of a new shared library.
- *
+ *
* @since 1.1
*/
-public class MIGDBSetStopOnSolibEvents extends MIGDBSet
-{
- public MIGDBSetStopOnSolibEvents(ICommandControlDMContext ctx, boolean isSet) {
- super(ctx, new String[] {"stop-on-solib-events", (isSet) ? "1" : "0"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
+public class MIGDBSetStopOnSolibEvents extends MIGDBSet {
+ public MIGDBSetStopOnSolibEvents(ICommandControlDMContext ctx, boolean isSet) {
+ super(ctx, new String[] { "stop-on-solib-events", (isSet) ? "1" : "0" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
} \ No newline at end of file
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetSysroot.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetSysroot.java
index 384541ba193..50fef637783 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetSysroot.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetSysroot.java
@@ -22,10 +22,9 @@ import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommand
* @since 1.1
*
*/
-public class MIGDBSetSysroot extends MIGDBSet
-{
+public class MIGDBSetSysroot extends MIGDBSet {
public MIGDBSetSysroot(ICommandControlDMContext ctx, String path) {
- super(ctx, new String[] {"sysroot", path}, x-> new MINoChangeAdjustable(x));//$NON-NLS-1$
+ super(ctx, new String[] { "sysroot", path }, x -> new MINoChangeAdjustable(x));//$NON-NLS-1$
}
// Using /dev/null is the recommended way to disable sysroot
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetTargetAsync.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetTargetAsync.java
index 6b0fdc9dcd9..2d7f9b51dbc 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetTargetAsync.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetTargetAsync.java
@@ -16,14 +16,13 @@ package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
/**
- *
+ *
* -gdb-set target-async [on | off]
- *
+ *
* @since 3.0
*/
-public class MIGDBSetTargetAsync extends MIGDBSet
-{
- public MIGDBSetTargetAsync(ICommandControlDMContext ctx, boolean isSet) {
- super(ctx, new String[] {"target-async", isSet ? "on" : "off"});//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
- }
+public class MIGDBSetTargetAsync extends MIGDBSet {
+ public MIGDBSetTargetAsync(ICommandControlDMContext ctx, boolean isSet) {
+ super(ctx, new String[] { "target-async", isSet ? "on" : "off" });//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetTargetCharset.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetTargetCharset.java
index 191560e53d4..f8cd23b1d1e 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetTargetCharset.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetTargetCharset.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Mathias Kunter - Initial API and implementation
*******************************************************************************/
@@ -17,16 +17,16 @@ package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
/**
- *
+ *
* -gdb-set target-charset CHARSET
- *
+ *
* Sets the current target charset to CHARSET. The target charset is the charset used
* by the char type of the inferior program.
- *
+ *
* @since 4.1
*/
public class MIGDBSetTargetCharset extends MIGDBSet {
public MIGDBSetTargetCharset(ICommandControlDMContext ctx, String targetCharset) {
- super(ctx, new String[] {"target-charset", targetCharset}); //$NON-NLS-1$
+ super(ctx, new String[] { "target-charset", targetCharset }); //$NON-NLS-1$
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetTargetWideCharset.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetTargetWideCharset.java
index 2d37a71e6e5..3725d3d36c0 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetTargetWideCharset.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetTargetWideCharset.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Mathias Kunter - Initial API and implementation
*******************************************************************************/
@@ -17,18 +17,18 @@ package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
/**
- *
+ *
* -gdb-set target-wide-charset CHARSET
- *
+ *
* Sets the current target wide charset to CHARSET. The target wide charset is the charset
* used by the wchar_t type of the inferior program.
- *
+ *
* Available with gdb 7.0
- *
+ *
* @since 4.1
*/
public class MIGDBSetTargetWideCharset extends MIGDBSet {
public MIGDBSetTargetWideCharset(ICommandControlDMContext ctx, String targetWideCharset) {
- super(ctx, new String[] {"target-wide-charset", targetWideCharset}); //$NON-NLS-1$
+ super(ctx, new String[] { "target-wide-charset", targetWideCharset }); //$NON-NLS-1$
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetTraceNotes.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetTraceNotes.java
index 278c9ed31d7..e6ee2bde217 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetTraceNotes.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetTraceNotes.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Dmitry Kozlov (Mentor Graphics) - Initial API and implementation
*******************************************************************************/
@@ -18,12 +18,12 @@ import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl.ITraceTargetDMContext;
/**
* -gdb-set trace-notes "note"
- *
+ *
* Sets trace notes
* @since 4.4
*/
public class MIGDBSetTraceNotes extends MIGDBSet {
public MIGDBSetTraceNotes(ITraceTargetDMContext ctx, String notes) {
- super(ctx, new String[] {"trace-notes", notes}); //$NON-NLS-1$
+ super(ctx, new String[] { "trace-notes", notes }); //$NON-NLS-1$
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetTraceUser.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetTraceUser.java
index c36dcd98db2..ff73da89dc0 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetTraceUser.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetTraceUser.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Dmitry Kozlov (Mentor Graphics) - Initial API and implementation
*******************************************************************************/
@@ -18,12 +18,12 @@ import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl.ITraceTargetDMContext;
/**
* -gdb-set trace-user "user"
- *
+ *
* Sets trace user
* @since 4.4
*/
public class MIGDBSetTraceUser extends MIGDBSet {
public MIGDBSetTraceUser(ITraceTargetDMContext ctx, String userName) {
- super(ctx, new String[] {"trace-user", userName}); //$NON-NLS-1$
+ super(ctx, new String[] { "trace-user", userName }); //$NON-NLS-1$
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBShow.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBShow.java
index 432fd8f28ee..ba9e6565d52 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBShow.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBShow.java
@@ -17,15 +17,14 @@ import org.eclipse.cdt.dsf.datamodel.IDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
- *
+ *
* -gdb-show
- *
+ *
* @since 4.3
- *
+ *
*/
-public class MIGDBShow<V extends MIInfo> extends MICommand<V>
-{
- public MIGDBShow(IDMContext ctx, String[] params) {
- super(ctx, "-gdb-show", null, params); //$NON-NLS-1$
- }
+public class MIGDBShow<V extends MIInfo> extends MICommand<V> {
+ public MIGDBShow(IDMContext ctx, String[] params) {
+ super(ctx, "-gdb-show", null, params); //$NON-NLS-1$
+ }
} \ No newline at end of file
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBShowExitCode.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBShowExitCode.java
index 6d1a177dad1..186ce8f5e9b 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBShowExitCode.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBShowExitCode.java
@@ -20,27 +20,27 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIGDBShowExitCodeInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
/**
- *
+ *
*-data-evaluate-expression $_exitcode
* ^done,value="10"
*
* Show the current value of a $_exitcode
- *
+ *
* With GDB 7.3, the exit code is provided by the MI =thread-group-exited event,
* which allows to handle multi-process situations.
- *
+ *
*/
public class MIGDBShowExitCode extends MIDataEvaluateExpression<MIGDBShowExitCodeInfo> {
- /**
- * @since 1.1
- */
- public MIGDBShowExitCode(ICommandControlDMContext ctx) {
- super(ctx, "$_exitcode"); //$NON-NLS-1$
- }
-
- @Override
- public MIGDBShowExitCodeInfo getResult(MIOutput output) {
- return new MIGDBShowExitCodeInfo(output);
- }
+ /**
+ * @since 1.1
+ */
+ public MIGDBShowExitCode(ICommandControlDMContext ctx) {
+ super(ctx, "$_exitcode"); //$NON-NLS-1$
+ }
+
+ @Override
+ public MIGDBShowExitCodeInfo getResult(MIOutput output) {
+ return new MIGDBShowExitCodeInfo(output);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBShowLanguage.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBShowLanguage.java
index 29a5936de09..fb05706be49 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBShowLanguage.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBShowLanguage.java
@@ -18,19 +18,18 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
import org.eclipse.cdt.dsf.mi.service.command.output.MIGDBShowLanguageInfo;
/**
- *
+ *
* -gdb-show language
- *
+ *
* @since 4.3
- *
+ *
*/
-public class MIGDBShowLanguage extends MIGDBShow<MIGDBShowLanguageInfo>
-{
- public MIGDBShowLanguage(IDMContext ctx) {
- super(ctx, new String[] {"language"}); //$NON-NLS-1$
- }
+public class MIGDBShowLanguage extends MIGDBShow<MIGDBShowLanguageInfo> {
+ public MIGDBShowLanguage(IDMContext ctx) {
+ super(ctx, new String[] { "language" }); //$NON-NLS-1$
+ }
- @Override
+ @Override
public MIGDBShowLanguageInfo getResult(MIOutput miResult) {
return new MIGDBShowLanguageInfo(miResult);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBShowNewConsole.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBShowNewConsole.java
index 54e5ea1f9a3..bd1a88f6742 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBShowNewConsole.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBShowNewConsole.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Kichwa Coders - initial API and implementation
*******************************************************************************/
@@ -18,11 +18,11 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIGDBShowNewConsoleInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
/**
- *
+ *
* -gdb-show new-console
- *
+ *
* @since 5.4
- *
+ *
*/
public class MIGDBShowNewConsole extends MIGDBShow<MIGDBShowNewConsoleInfo> {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBVersion.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBVersion.java
index 2e0a4e6f3d0..e39a91c0c24 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBVersion.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBVersion.java
@@ -19,18 +19,18 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
/**
- *
+ *
* -gdb-version
- *
+ *
* @since 4.6
- *
+ *
*/
public class MIGDBVersion extends MICommand<MIGDBVersionInfo> {
private static final String COMMAND = "-gdb-version"; //$NON-NLS-1$
-
+
public MIGDBVersion(ICommandControlDMContext ctx) {
- super(ctx, COMMAND);
- }
+ super(ctx, COMMAND);
+ }
@Override
public MIInfo getResult(MIOutput out) {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIInferiorTTYSet.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIInferiorTTYSet.java
index ecdd62f0b66..fafcf242217 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIInferiorTTYSet.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIInferiorTTYSet.java
@@ -17,18 +17,16 @@ package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
-
-/**
+/**
* -inferior-tty-set TTY
- *
+ *
* Set terminal for future runs of the specified program.
*/
-public class MIInferiorTTYSet extends MICommand<MIInfo>
-{
- /**
- * @since 4.0
- */
- public MIInferiorTTYSet(IMIContainerDMContext dmc, String tty) {
- super(dmc, "-inferior-tty-set", null, new String[] {tty}); //$NON-NLS-1$
- }
-} \ No newline at end of file
+public class MIInferiorTTYSet extends MICommand<MIInfo> {
+ /**
+ * @since 4.0
+ */
+ public MIInferiorTTYSet(IMIContainerDMContext dmc, String tty) {
+ super(dmc, "-inferior-tty-set", null, new String[] { tty }); //$NON-NLS-1$
+ }
+} \ No newline at end of file
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIInfoOs.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIInfoOs.java
index f68c8c1bdb6..736c10e0241 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIInfoOs.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIInfoOs.java
@@ -33,14 +33,12 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
*/
public class MIInfoOs extends MICommand<MIInfoOsInfo> {
- public MIInfoOs(IDMContext ctx)
- {
+ public MIInfoOs(IDMContext ctx) {
super(ctx, "-info-os"); //$NON-NLS-1$
}
- public MIInfoOs(IDMContext ctx, String resourceClass)
- {
- super(ctx, "-info-os", new String[]{resourceClass}); //$NON-NLS-1$
+ public MIInfoOs(IDMContext ctx, String resourceClass) {
+ super(ctx, "-info-os", new String[] { resourceClass }); //$NON-NLS-1$
specificResource = true;
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIInterpreterExec.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIInterpreterExec.java
index 854b0769ec3..ea664bf6352 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIInterpreterExec.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIInterpreterExec.java
@@ -11,7 +11,7 @@
* Contributors:
* QNX Software Systems - Initial API and implementation
* Wind River Systems - Modified for new DSF Reference Implementation
- * Ericsson - Modified for additional features in DSF Reference implementation
+ * Ericsson - Modified for additional features in DSF Reference implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command.commands;
@@ -21,13 +21,13 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
* MIInterpreterExec
- *
+ *
* -interpreter-exec
*
* -interpreter-exec interpreter command
- *
+ *
* Execute the specified command in the given interpreter.
- *
+ *
* -interpreter-exec console "break main"
* &"During symbol reading, couldn't parse type; debugger out of date?.\n"
* &"During symbol reading, bad structure-type format.\n"
@@ -37,11 +37,11 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
*/
public class MIInterpreterExec<V extends MIInfo> extends MICommand<V> {
- /**
- * @param oper
- */
- public MIInterpreterExec(IDMContext ctx, String interpreter, String cmd) {
- super(ctx, "-interpreter-exec", new String[] {interpreter, cmd}); //$NON-NLS-1$
- }
+ /**
+ * @param oper
+ */
+ public MIInterpreterExec(IDMContext ctx, String interpreter, String cmd) {
+ super(ctx, "-interpreter-exec", new String[] { interpreter, cmd }); //$NON-NLS-1$
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIInterpreterExecConsole.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIInterpreterExecConsole.java
index 797cc730988..0febcd055d1 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIInterpreterExecConsole.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIInterpreterExecConsole.java
@@ -24,12 +24,12 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
*/
public class MIInterpreterExecConsole<V extends MIInfo> extends MIInterpreterExec<V> {
- /**
- * @param interpreter
- * @param cmd
- */
- public MIInterpreterExecConsole(IDMContext ctx, String cmd) {
- super(ctx, "console", cmd); //$NON-NLS-1$
- }
+ /**
+ * @param interpreter
+ * @param cmd
+ */
+ public MIInterpreterExecConsole(IDMContext ctx, String cmd) {
+ super(ctx, "console", cmd); //$NON-NLS-1$
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIInterpreterExecConsoleKill.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIInterpreterExecConsoleKill.java
index bccf029c5ff..4e508bd9598 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIInterpreterExecConsoleKill.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIInterpreterExecConsoleKill.java
@@ -24,7 +24,7 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
*/
public class MIInterpreterExecConsoleKill extends MIInterpreterExecConsole<MIInfo> {
- public MIInterpreterExecConsoleKill(IMIContainerDMContext ctx) {
- super(ctx, "kill"); //$NON-NLS-1$
- }
+ public MIInterpreterExecConsoleKill(IMIContainerDMContext ctx) {
+ super(ctx, "kill"); //$NON-NLS-1$
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIListFeatures.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIListFeatures.java
index 7f04cb1d1b4..5975661cba0 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIListFeatures.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIListFeatures.java
@@ -18,19 +18,18 @@ import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommand
import org.eclipse.cdt.dsf.mi.service.command.output.MIListFeaturesInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
-
/**
* -list-features
- *
+ *
* Returns a list of particular features of the MI protocol that this
* version of gdb implements. A feature can be a command, or a new field
* in an output of some command, or even an important bugfix. While a
* frontend can sometimes detect presence of a feature at runtime, it is
* easier to perform detection at debugger startup.
- *
+ *
* The command returns a list of strings, with each string naming an
* available feature. Each returned string is just a name, it does not
- * have any internal structure.
+ * have any internal structure.
* @since 4.0
*/
public class MIListFeatures extends MICommand<MIListFeaturesInfo> {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIListThreadGroups.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIListThreadGroups.java
index 30d55469c4c..cb849383243 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIListThreadGroups.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIListThreadGroups.java
@@ -21,55 +21,55 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
/**
* -list-thread-groups [--available | GROUP] [ --recurse 1 ]
- *
- * When used without GROUP parameter, this will list top-level
- * thread groups that are being debugged. When used with the GROUP
- * parameter, the children of the specified group will be listed.
+ *
+ * When used without GROUP parameter, this will list top-level
+ * thread groups that are being debugged. When used with the GROUP
+ * parameter, the children of the specified group will be listed.
* The children can be either threads, or other groups. At present,
- * GDB will not report both threads and groups as children at the
+ * GDB will not report both threads and groups as children at the
* same time, but it may change in future.
- *
+ *
* With the --available option, instead of reporting groups that are
- * being debugged, GDB will report all thread groups available on the
- * target, not only the presently debugged ones. Using the --available
+ * being debugged, GDB will report all thread groups available on the
+ * target, not only the presently debugged ones. Using the --available
* option together with explicit GROUP is not likely to work on all targets.
*
* The output of the command is:
*
* ^done,threads=[<thread>],groups=[<group>]
- *
+ *
* where each thread group is like this:
- *
+ *
* {id="xxx",type="process",pid="yyy",num_children="1",cores=[1,2]}
- *
+ *
* The id of a thread group should be considered an opaque string.
- *
- * As of GDB 7.1, the --recurse option has been added. If this option is
- * present, then every reported thread group will also include its children,
+ *
+ * As of GDB 7.1, the --recurse option has been added. If this option is
+ * present, then every reported thread group will also include its children,
* either as `group' or `threads' field.
- *
- * In general, any combination of option and parameters is permitted, with
+ *
+ * In general, any combination of option and parameters is permitted, with
* the following caveats:
- * - When a single thread group is passed, the output will typically be the
- * `threads' result. Because threads may not contain anything, the
+ * - When a single thread group is passed, the output will typically be the
+ * `threads' result. Because threads may not contain anything, the
* `recurse' option will be ignored.
- * - When the `--available' option is passed, limited information may be
- * available. In particular, the list of threads of a process might be
- * inaccessible. Further, specifying specific thread groups might not give
- * any performance advantage over listing all thread groups. The frontend
- * should assume that `-list-thread-groups --available' is always an
+ * - When the `--available' option is passed, limited information may be
+ * available. In particular, the list of threads of a process might be
+ * inaccessible. Further, specifying specific thread groups might not give
+ * any performance advantage over listing all thread groups. The frontend
+ * should assume that `-list-thread-groups --available' is always an
* expensive operation and cache the results.
- *
+ *
* As of GDB 7.1, the 'core' output field has been added.
* - cores This field is a list of integers, each identifying a core that one
- * thread of the group is running on. This field may be absent if such
+ * thread of the group is running on. This field may be absent if such
* information is not available.
- *
+ *
* @since 1.1
*
*/
public class MIListThreadGroups extends MICommand<MIListThreadGroupsInfo> {
-
+
/**
* List all groups (processes) being debugged.
*/
@@ -79,7 +79,7 @@ public class MIListThreadGroups extends MICommand<MIListThreadGroupsInfo> {
/**
* If the parameter groupId is null, list all groups (processes) being debugged.
- * If the parameter groupId is a valid group, list all threads
+ * If the parameter groupId is a valid group, list all threads
* which are children of the specified group
*/
public MIListThreadGroups(ICommandControlDMContext ctx, String groupId) {
@@ -87,29 +87,29 @@ public class MIListThreadGroups extends MICommand<MIListThreadGroupsInfo> {
}
/**
- * If the parameter listAll is true, list all processes running on the
+ * If the parameter listAll is true, list all processes running on the
* target (not just the debugged ones).
- * If the parameter listAll is false, list only the processes being debugged.
+ * If the parameter listAll is false, list only the processes being debugged.
*/
public MIListThreadGroups(ICommandControlDMContext ctx, boolean listAll) {
this(ctx, null, listAll, false);
}
/**
- * If the parameter recurse is true, list all threads of all processes.
+ * If the parameter recurse is true, list all threads of all processes.
* @since 4.1
*/
public MIListThreadGroups(ICommandControlDMContext ctx, boolean listAll, boolean recurse) {
this(ctx, null, listAll, recurse);
}
-
+
// There should be no reason to have both listAll and groupId specified,
// so this constructor is private, and exists to avoid duplicating code.
private MIListThreadGroups(ICommandControlDMContext ctx, String groupId, boolean listAll, boolean recurse) {
super(ctx, "-list-thread-groups"); //$NON-NLS-1$
-
+
assert !((groupId != null) && listAll); // see comment above
-
+
final ArrayList<String> arguments = new ArrayList<String>();
if (listAll) {
arguments.add("--available"); //$NON-NLS-1$
@@ -131,7 +131,7 @@ public class MIListThreadGroups extends MICommand<MIListThreadGroupsInfo> {
}
@Override
- public MIListThreadGroupsInfo getResult(MIOutput out) {
- return new MIListThreadGroupsInfo(out);
- }
+ public MIListThreadGroupsInfo getResult(MIOutput out) {
+ return new MIListThreadGroupsInfo(out);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIRemoveInferior.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIRemoveInferior.java
index c1ce8ae1c97..cc92b3eba2b 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIRemoveInferior.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIRemoveInferior.java
@@ -17,17 +17,16 @@ 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;
-/**
+/**
* -remove-inferior GROUPID
* ^done
- *
+ *
* Remove the specified inferior.
- *
+ *
* @since 4.0
*/
-public class MIRemoveInferior extends MICommand<MIInfo>
-{
- public MIRemoveInferior(ICommandControlDMContext dmc, String groupId) {
- super(dmc, "-remove-inferior", new String[] { groupId }); //$NON-NLS-1$
- }
+public class MIRemoveInferior extends MICommand<MIInfo> {
+ public MIRemoveInferior(ICommandControlDMContext dmc, String groupId) {
+ super(dmc, "-remove-inferior", new String[] { groupId }); //$NON-NLS-1$
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MISetSubstitutePath.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MISetSubstitutePath.java
index f6a66d520dc..09ada39f31b 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MISetSubstitutePath.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MISetSubstitutePath.java
@@ -17,7 +17,7 @@ import org.eclipse.cdt.dsf.debug.service.ISourceLookup.ISourceLookupDMContext;
/**
* -gdb-set substitute-path from to
- *
+ *
* @since 5.0
*/
public class MISetSubstitutePath extends MIGDBSet {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIStackInfoDepth.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIStackInfoDepth.java
index c3ca46826c5..e1fd0b9c623 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIStackInfoDepth.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIStackInfoDepth.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - Initial Implementation
*******************************************************************************/
@@ -19,24 +19,23 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
import org.eclipse.cdt.dsf.mi.service.command.output.MIStackInfoDepthInfo;
/**
- *
+ *
* -stack-info-depth [maxDepth]
*
- *
+ *
*/
-public class MIStackInfoDepth extends MICommand<MIStackInfoDepthInfo>
-{
-
- public MIStackInfoDepth(IMIExecutionDMContext ctx) {
- super(ctx, "-stack-info-depth"); //$NON-NLS-1$
- }
+public class MIStackInfoDepth extends MICommand<MIStackInfoDepthInfo> {
+
+ public MIStackInfoDepth(IMIExecutionDMContext ctx) {
+ super(ctx, "-stack-info-depth"); //$NON-NLS-1$
+ }
- public MIStackInfoDepth(IMIExecutionDMContext ctx, int maxDepth) {
- super(ctx, "-stack-info-depth", new String[]{Integer.toString(maxDepth)}); //$NON-NLS-1$
- }
+ public MIStackInfoDepth(IMIExecutionDMContext ctx, int maxDepth) {
+ super(ctx, "-stack-info-depth", new String[] { Integer.toString(maxDepth) }); //$NON-NLS-1$
+ }
- @Override
- public MIStackInfoDepthInfo getResult(MIOutput out) {
- return new MIStackInfoDepthInfo(out);
- }
+ @Override
+ public MIStackInfoDepthInfo getResult(MIOutput out) {
+ return new MIStackInfoDepthInfo(out);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIStackListArguments.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIStackListArguments.java
index 5267fb60534..401a88677d8 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIStackListArguments.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIStackListArguments.java
@@ -23,7 +23,7 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
import org.eclipse.cdt.dsf.mi.service.command.output.MIStackListArgumentsInfo;
/**
- *
+ *
* -stack-list-arguments SHOW-VALUES
* [ LOW-FRAME HIGH-FRAME ]
*
@@ -34,31 +34,30 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIStackListArgumentsInfo;
* The SHOW-VALUES argument must have a value of 0 or 1. A value of 0
* means that only the names of the arguments are listed, a value of 1
* means that both names and values of the arguments are printed.
- *
+ *
*/
-public class MIStackListArguments extends MICommand<MIStackListArgumentsInfo>
-{
- public MIStackListArguments(IMIExecutionDMContext execDmc, boolean showValues) {
- super(execDmc, "-stack-list-arguments", new String[] { showValues ? "1" : "0" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
+public class MIStackListArguments extends MICommand<MIStackListArgumentsInfo> {
+ public MIStackListArguments(IMIExecutionDMContext execDmc, boolean showValues) {
+ super(execDmc, "-stack-list-arguments", new String[] { showValues ? "1" : "0" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+ public MIStackListArguments(IFrameDMContext frameDmc, boolean showValues) {
+ super(frameDmc, "-stack-list-arguments", new String[] { showValues ? "1" : "0" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+ /** @since 5.5 */
+ public MIStackListArguments(IFrameDMContext frameDmc, boolean showValues, int low, int high) {
+ super(frameDmc, "-stack-list-arguments", //$NON-NLS-1$
+ new String[] { showValues ? "1" : "0", Integer.toString(low), Integer.toString(high) }); //$NON-NLS-1$ //$NON-NLS-2$
+ }
- public MIStackListArguments(IFrameDMContext frameDmc, boolean showValues) {
- super(frameDmc, "-stack-list-arguments", new String[] { showValues ? "1" : "0" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
+ public MIStackListArguments(IMIExecutionDMContext execDmc, boolean showValues, int low, int high) {
+ super(execDmc, "-stack-list-arguments", //$NON-NLS-1$
+ new String[] { showValues ? "1" : "0", Integer.toString(low), Integer.toString(high) }); //$NON-NLS-1$ //$NON-NLS-2$
+ }
- /** @since 5.5 */
- public MIStackListArguments(IFrameDMContext frameDmc, boolean showValues, int low, int high) {
- super(frameDmc, "-stack-list-arguments", //$NON-NLS-1$
- new String[] { showValues ? "1" : "0", Integer.toString(low), Integer.toString(high)}); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public MIStackListArguments(IMIExecutionDMContext execDmc, boolean showValues, int low, int high) {
- super(execDmc, "-stack-list-arguments", //$NON-NLS-1$
- new String[] {showValues ? "1" : "0", Integer.toString(low), Integer.toString(high)}); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- @Override
- public MIStackListArgumentsInfo getResult(MIOutput out) {
- return new MIStackListArgumentsInfo(out);
- }
+ @Override
+ public MIStackListArgumentsInfo getResult(MIOutput out) {
+ return new MIStackListArgumentsInfo(out);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIStackListFrames.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIStackListFrames.java
index 487d7c872e1..01f6b1ae147 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIStackListFrames.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIStackListFrames.java
@@ -16,13 +16,12 @@
package org.eclipse.cdt.dsf.mi.service.command.commands;
-
import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
import org.eclipse.cdt.dsf.mi.service.command.output.MIStackListFramesInfo;
/**
- *
+ *
* -stack-list-frames [ LOW-FRAME HIGH-FRAME ]
*
* List the frames currently on the stack. For each frame it displays
@@ -52,20 +51,19 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIStackListFramesInfo;
* whole stack. If given two integer arguments, it shows the frames whose
* levels are between the two arguments (inclusive). If the two arguments
* are equal, it shows the single frame at the corresponding level.
- *
+ *
*/
-public class MIStackListFrames extends MICommand<MIStackListFramesInfo>
-{
- public MIStackListFrames(IMIExecutionDMContext execDmc) {
- super(execDmc, "-stack-list-frames"); //$NON-NLS-1$
- }
-
- public MIStackListFrames(IMIExecutionDMContext execDmc, int low, int high) {
- super(execDmc, "-stack-list-frames", new String[] { Integer.toString(low), Integer.toString(high) }); //$NON-NLS-1$
- }
-
- @Override
- public MIStackListFramesInfo getResult(MIOutput out) {
- return new MIStackListFramesInfo(out);
- }
+public class MIStackListFrames extends MICommand<MIStackListFramesInfo> {
+ public MIStackListFrames(IMIExecutionDMContext execDmc) {
+ super(execDmc, "-stack-list-frames"); //$NON-NLS-1$
+ }
+
+ public MIStackListFrames(IMIExecutionDMContext execDmc, int low, int high) {
+ super(execDmc, "-stack-list-frames", new String[] { Integer.toString(low), Integer.toString(high) }); //$NON-NLS-1$
+ }
+
+ @Override
+ public MIStackListFramesInfo getResult(MIOutput out) {
+ return new MIStackListFramesInfo(out);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIStackListLocals.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIStackListLocals.java
index 172b0479508..1f890e7b3b9 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIStackListLocals.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIStackListLocals.java
@@ -21,23 +21,22 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
import org.eclipse.cdt.dsf.mi.service.command.output.MIStackListLocalsInfo;
/**
- *
+ *
* -stack-list-locals PRINT-VALUES
*
* Display the local variable names for the current frame. With an
* argument of 0 prints only the names of the variables, with argument of 1
* prints also their values.
- *
+ *
*/
-public class MIStackListLocals extends MICommand<MIStackListLocalsInfo>
-{
-
- public MIStackListLocals(IFrameDMContext frameCtx, boolean printValues) {
- super(frameCtx, "-stack-list-locals", new String[] { printValues ? "1" : "0" } ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
+public class MIStackListLocals extends MICommand<MIStackListLocalsInfo> {
+
+ public MIStackListLocals(IFrameDMContext frameCtx, boolean printValues) {
+ super(frameCtx, "-stack-list-locals", new String[] { printValues ? "1" : "0" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
- @Override
- public MIStackListLocalsInfo getResult(MIOutput out) {
- return new MIStackListLocalsInfo(out);
- }
+ @Override
+ public MIStackListLocalsInfo getResult(MIOutput out) {
+ return new MIStackListLocalsInfo(out);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIStackSelectFrame.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIStackSelectFrame.java
index e88f2d2b897..bcec3e4258e 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIStackSelectFrame.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIStackSelectFrame.java
@@ -19,16 +19,16 @@ import org.eclipse.cdt.dsf.datamodel.IDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
- *
+ *
* -stack-select-frame FRAMENUM
*
* Change the current frame. Select a different frame FRAMENUM on the
* stack.
- *
+ *
*/
public class MIStackSelectFrame extends MICommand<MIInfo> {
-
+
public MIStackSelectFrame(IDMContext ctx, int frameNum) {
- super(ctx, "-stack-select-frame", new String[]{Integer.toString(frameNum)}); //$NON-NLS-1$
+ super(ctx, "-stack-select-frame", new String[] { Integer.toString(frameNum) }); //$NON-NLS-1$
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetAttach.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetAttach.java
index 35993292154..7486331f7a1 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetAttach.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetAttach.java
@@ -21,11 +21,11 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
* -target-attach < PID | THREAD_GROUP_ID >
- *
+ *
* This command attaches to the process specified by the PID
* or THREAD_GROUP_ID. If attaching to a thread group, the id
* previously returned by `-list-thread-groups --available' must be used.
- *
+ *
* @since 1.1
*/
public class MITargetAttach extends MICommand<MIInfo> {
@@ -34,7 +34,7 @@ public class MITargetAttach extends MICommand<MIInfo> {
/**
* @param ctx indicates which inferior should be used when doing the attach
* @param id the pid of the process to attach to
- *
+ *
* @since 4.0
*/
public MITargetAttach(IMIContainerDMContext ctx, String pid) {
@@ -47,7 +47,7 @@ public class MITargetAttach extends MICommand<MIInfo> {
* @param interrupt indicates if the process should be interrupted once the attach is done
* Leaving the process running is only support with target-async on, which
* we currently only use in non-stop mode
- *
+ *
* @since 4.0
*/
public MITargetAttach(IMIContainerDMContext ctx, String pid, boolean interrupt) {
@@ -71,7 +71,7 @@ public class MITargetAttach extends MICommand<MIInfo> {
/**
* Add an extra newline to force GDB 7.11 to flush error response to the MI
* channel.
- *
+ *
* @see GDBProcesses_7_2#targetAttachRequiresTrailingNewline
* @since 5.4
*/
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetDetach.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetDetach.java
index f828e6e32ab..83071990697 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetDetach.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetDetach.java
@@ -20,22 +20,22 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
* -target-detach < PID | THREAD_GROUP_ID >
- *
+ *
* This command detaches from the process specified by the PID
* or THREAD_GROUP_ID
* @since 1.1
*/
public class MITargetDetach extends MICommand<MIInfo> {
-
+
/*
* No need to specify an IMIContainerDMContext because
* only one such context is associated with ID; therefore,
* GDB will know which inferior to detach using only ID.
*/
public MITargetDetach(ICommandControlDMContext ctx, String groupId) {
- super(ctx, "-target-detach", new String[] {groupId}); //$NON-NLS-1$
+ super(ctx, "-target-detach", new String[] { groupId }); //$NON-NLS-1$
}
-
+
/*
* This method does not follow our convention of passing the highest required
* context and proper parameters. The proper way is handled by the method above
@@ -44,10 +44,10 @@ public class MITargetDetach extends MICommand<MIInfo> {
* Form 1: -target-detach --thread-group i2
* instead of the way the above method does, which is
* Form 2: -target-detach i2
- * Because of a bug in GDB 7.2, form 2 does not work.
- * However, this has been fixed with GDB 7.2.1, which is why we keep both
- * approaches.
- */
+ * Because of a bug in GDB 7.2, form 2 does not work.
+ * However, this has been fixed with GDB 7.2.1, which is why we keep both
+ * approaches.
+ */
/** @since 4.0 */
public MITargetDetach(IMIContainerDMContext ctx) {
super(ctx, "-target-detach"); //$NON-NLS-1$
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetDisconnect.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetDisconnect.java
index a446ddaea34..7b17de086fd 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetDisconnect.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetDisconnect.java
@@ -22,7 +22,7 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
*/
public class MITargetDisconnect extends MICommand<MIInfo> {
- public MITargetDisconnect(ICommandControlDMContext ctx) {
- super(ctx, "-target-disconnect"); //$NON-NLS-1$
- }
+ public MITargetDisconnect(ICommandControlDMContext ctx) {
+ super(ctx, "-target-disconnect"); //$NON-NLS-1$
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetDownload.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetDownload.java
index 91687394598..c362fbfbbb6 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetDownload.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetDownload.java
@@ -21,24 +21,24 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MITargetDownloadInfo;
/**
* This command downloads a file to a remote target.
- *
+ *
* @since 3.0
*/
public class MITargetDownload extends MICommand<MITargetDownloadInfo> {
- public MITargetDownload(ICommandControlDMContext ctx) {
- super(ctx, "-target-download"); //$NON-NLS-1$
- }
+ public MITargetDownload(ICommandControlDMContext ctx) {
+ super(ctx, "-target-download"); //$NON-NLS-1$
+ }
- public MITargetDownload(ICommandControlDMContext ctx, String file) {
- super(ctx, "-target-download", null, new String[] { file }); //$NON-NLS-1$
- }
+ public MITargetDownload(ICommandControlDMContext ctx, String file) {
+ super(ctx, "-target-download", null, new String[] { file }); //$NON-NLS-1$
+ }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.dsf.mi.service.command.commands.MICommand#getResult(org.eclipse.cdt.dsf.mi.service.command.output.MIOutput)
- */
- @Override
- public MIInfo getResult( MIOutput MIresult ) {
- return new MITargetDownloadInfo( MIresult );
- }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.dsf.mi.service.command.commands.MICommand#getResult(org.eclipse.cdt.dsf.mi.service.command.output.MIOutput)
+ */
+ @Override
+ public MIInfo getResult(MIOutput MIresult) {
+ return new MITargetDownloadInfo(MIresult);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetSelect.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetSelect.java
index 681b29c32a1..861f45216eb 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetSelect.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetSelect.java
@@ -21,24 +21,24 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
*/
public class MITargetSelect extends MICommand<MIInfo> {
- /**
+ /**
* @since 3.0
*/
- public MITargetSelect(IDMContext ctx, String[] params) {
- super(ctx, "-target-select", null, params); //$NON-NLS-1$
- }
-
+ public MITargetSelect(IDMContext ctx, String[] params) {
+ super(ctx, "-target-select", null, params); //$NON-NLS-1$
+ }
+
/**
* @since 1.1
*/
public MITargetSelect(IDMContext ctx, String host, String port, boolean extended) {
- super(ctx, "-target-select", new String[] { extended ? "extended-remote" : "remote", host + ":" + port}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ super(ctx, "-target-select", new String[] { extended ? "extended-remote" : "remote", host + ":" + port }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
-
+
/**
* @since 1.1
*/
public MITargetSelect(IDMContext ctx, String serialDevice, boolean extended) {
- super(ctx, "-target-select", new String[] { extended ? "extended-remote" : "remote", serialDevice}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ super(ctx, "-target-select", new String[] { extended ? "extended-remote" : "remote", serialDevice }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetSelectCore.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetSelectCore.java
index 95e0c69cafe..95160f4d022 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetSelectCore.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetSelectCore.java
@@ -22,6 +22,6 @@ import org.eclipse.cdt.dsf.datamodel.IDMContext;
public class MITargetSelectCore extends MITargetSelect {
public MITargetSelectCore(IDMContext ctx, String coreFilePath) {
- super(ctx, new String[] { "core", coreFilePath}); //$NON-NLS-1$
+ super(ctx, new String[] { "core", coreFilePath }); //$NON-NLS-1$
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetSelectTFile.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetSelectTFile.java
index d6f61c39f86..3f185286464 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetSelectTFile.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetSelectTFile.java
@@ -17,7 +17,7 @@ import org.eclipse.cdt.dsf.datamodel.IDMContext;
/**
* This command sets up a connection with a trace data file.
- *
+ *
* Available with GDB 7.1
*
* @since 3.0
@@ -25,6 +25,6 @@ import org.eclipse.cdt.dsf.datamodel.IDMContext;
public class MITargetSelectTFile extends MITargetSelect {
public MITargetSelectTFile(IDMContext ctx, String traceFilePath) {
- super(ctx, new String[] { "tfile", traceFilePath}); //$NON-NLS-1$
+ super(ctx, new String[] { "tfile", traceFilePath }); //$NON-NLS-1$
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIThreadInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIThreadInfo.java
index a910aaf8990..9d17a3867b2 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIThreadInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIThreadInfo.java
@@ -19,27 +19,27 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
import org.eclipse.cdt.dsf.mi.service.command.output.MIThreadInfoInfo;
/**
- *
+ *
* -thread-info [ thread-id ]
*
* Reports information about either a specific thread, if [thread-id] is present,
* or about all threads. When printing information about all threads, also reports
* the current thread.
* @since 1.1
- *
+ *
*/
public class MIThreadInfo extends MICommand<MIThreadInfoInfo> {
-
+
public MIThreadInfo(ICommandControlDMContext dmc) {
super(dmc, "-thread-info"); //$NON-NLS-1$
}
public MIThreadInfo(ICommandControlDMContext dmc, String threadId) {
- super(dmc, "-thread-info", new String[]{ threadId }); //$NON-NLS-1$
+ super(dmc, "-thread-info", new String[] { threadId }); //$NON-NLS-1$
}
- @Override
- public MIThreadInfoInfo getResult(MIOutput out) {
- return new MIThreadInfoInfo(out);
- }
+ @Override
+ public MIThreadInfoInfo getResult(MIOutput out) {
+ return new MIThreadInfoInfo(out);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIThreadListIds.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIThreadListIds.java
index a69e15ef5cc..a9e85bbf198 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIThreadListIds.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIThreadListIds.java
@@ -20,21 +20,21 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
import org.eclipse.cdt.dsf.mi.service.command.output.MIThreadListIdsInfo;
/**
- *
+ *
* -thread-list-ids
*
* Produces a list of the currently known GDB thread ids. At the end
* of the list it also prints the total number of such threads.
- *
+ *
*/
public class MIThreadListIds extends MICommand<MIThreadListIdsInfo> {
-
+
public MIThreadListIds(IContainerDMContext contDmc) {
super(contDmc, "-thread-list-ids"); //$NON-NLS-1$
}
- @Override
- public MIThreadListIdsInfo getResult(MIOutput out) {
- return new MIThreadListIdsInfo(out);
- }
+ @Override
+ public MIThreadListIdsInfo getResult(MIOutput out) {
+ return new MIThreadListIdsInfo(out);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIThreadSelect.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIThreadSelect.java
index 99d0402447e..62ca807e35c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIThreadSelect.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIThreadSelect.java
@@ -18,26 +18,24 @@ package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.datamodel.IDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
-
/**
- *
+ *
* -thread-select THREADNUM
*
* Make THREADNUM the current thread. It prints the number of the new
* current thread, and the topmost frame for that thread.
- *
+ *
*/
-public class MIThreadSelect extends MICommand<MIInfo>
-{
+public class MIThreadSelect extends MICommand<MIInfo> {
public MIThreadSelect(IDMContext ctx, int threadNum) {
this(ctx, Integer.toString(threadNum));
}
-
+
/**
- * @since 1.1
- */
+ * @since 1.1
+ */
public MIThreadSelect(IDMContext ctx, String threadNum) {
- super(ctx, "-thread-select", new String[]{threadNum}); //$NON-NLS-1$
+ super(ctx, "-thread-select", new String[] { threadNum }); //$NON-NLS-1$
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITraceDefineVariable.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITraceDefineVariable.java
index 6d45df515e1..d4cb5f47412 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITraceDefineVariable.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITraceDefineVariable.java
@@ -18,20 +18,20 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
* -trace-define-variable
- *
- * Creates trace variable name if it does not exist. If value is specified,
- * sets the initial value of the specified trace variable to that value.
+ *
+ * Creates trace variable name if it does not exist. If value is specified,
+ * sets the initial value of the specified trace variable to that value.
* Note that the name should start with the `$' character.
- *
+ *
* Available with GDB 7.1
- *
+ *
* @since 3.0
*/
public class MITraceDefineVariable extends MICommand<MIInfo> {
public MITraceDefineVariable(ITraceTargetDMContext ctx, String varName) {
this(ctx, varName, ""); //$NON-NLS-1$
}
-
+
public MITraceDefineVariable(ITraceTargetDMContext ctx, String varName, String varValue) {
super(ctx, "-trace-define-variable", new String[] { varName, varValue }); //$NON-NLS-1$
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITraceFind.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITraceFind.java
index 382f897eaa5..2f86462f91e 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITraceFind.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITraceFind.java
@@ -19,47 +19,47 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MITraceFindInfo;
/**
* -trace-find MODE [PARAMS...]
- *
+ *
* Find a trace frame using criteria defined by MODE and PARAMS. The following
* lists permissible modes and their parameters.
- *
+ *
* none - No parameters are required. Stops examining trace frames.
- * frame-number - An integer is required as parameter. Selects tracepoint frame
+ * frame-number - An integer is required as parameter. Selects tracepoint frame
* with that index.
- * tracepoint-number - An integer is required as parameter. Finds next trace
+ * tracepoint-number - An integer is required as parameter. Finds next trace
* frame that corresponds to tracepoint with the specified number.
* pc - An integer address is required as parameter. Finds next trace
* frame that corresponds to any tracepoint at the specified address.
- * pc-inside-range - Two integer addresses are required as parameters. Finds next
- * trace frame that corresponds to a tracepoint at an address inside
+ * pc-inside-range - Two integer addresses are required as parameters. Finds next
+ * trace frame that corresponds to a tracepoint at an address inside
* the specified range.
- * pc-outside-range - Two integer addresses are required as parameters. Finds next
+ * pc-outside-range - Two integer addresses are required as parameters. Finds next
* trace frame that corresponds to a tracepoint at an address outside
* the specified range.
- * line - Line specification is required as parameter.
- * Finds next trace frame that corresponds to a tracepoint at the
+ * line - Line specification is required as parameter.
+ * Finds next trace frame that corresponds to a tracepoint at the
* specified location.
- *
+ *
* If the 'none' was passed as mode, the response does not have fields. Otherwise, the
* response may have the following fields:
*
* found - This field has either 0 or 1 as the value, depending on whether a matching
* tracepoint was found.
- * traceframe - The index of the found traceframe. This field is present i f the 'found'
+ * traceframe - The index of the found traceframe. This field is present i f the 'found'
* field has value of 1.
- * tracepoint - The index of the found tracepoint. This field is present if the 'found'
+ * tracepoint - The index of the found tracepoint. This field is present if the 'found'
* field has value of 1.
* frame - The stack frame when the traceframe was collected
- *
+ *
* @since 3.0
*/
public class MITraceFind extends MICommand<MITraceFindInfo> {
public MITraceFind(ITraceTargetDMContext ctx, String[] params) {
super(ctx, "-trace-find", null, params); //$NON-NLS-1$
}
-
- @Override
- public MITraceFindInfo getResult(MIOutput out) {
- return new MITraceFindInfo(out);
- }
+
+ @Override
+ public MITraceFindInfo getResult(MIOutput out) {
+ return new MITraceFindInfo(out);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITraceListVariables.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITraceListVariables.java
index 9a4821e7182..4f9c622bfed 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITraceListVariables.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITraceListVariables.java
@@ -20,16 +20,16 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MITraceListVariablesInfo;
/**
* -trace-list-variables
*
- * Return a table of all defined trace variables. Each element of the table has the
+ * Return a table of all defined trace variables. Each element of the table has the
* following fields:
* 'name' The name of the trace variable. This field is always present.
* 'initial' The initial value. This is a 64-bit signed integer. This field is always present.
* 'current' The value the trace variable has at the moment. This is a 64-bit signed integer.
- * This field may is absent if the current value is not defined, for example if
+ * This field may is absent if the current value is not defined, for example if
* the trace was never run, or is presently running.
- *
+ *
* Available with GDB 7.1
- *
+ *
* @since 3.0
*/
public class MITraceListVariables extends MICommand<MITraceListVariablesInfo> {
@@ -37,9 +37,9 @@ public class MITraceListVariables extends MICommand<MITraceListVariablesInfo> {
public MITraceListVariables(ITraceTargetDMContext ctx) {
super(ctx, "-trace-list-variables"); //$NON-NLS-1$
}
-
- @Override
- public MITraceListVariablesInfo getResult(MIOutput out) {
- return new MITraceListVariablesInfo(out);
- }
+
+ @Override
+ public MITraceListVariablesInfo getResult(MIOutput out) {
+ return new MITraceListVariablesInfo(out);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITraceSave.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITraceSave.java
index 1237541f1f2..414460bdc2b 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITraceSave.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITraceSave.java
@@ -18,22 +18,22 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
* -trace-save [-r] FILENAME
- *
+ *
* Saves the collected trace data to FILENAME. Without the '-r' option, the data is downloaded
* from the target and saved in a local file. With the '-r' option the target is asked to perform
* the save.
- *
+ *
* Available with GDB 7.1
- *
+ *
* @since 3.0
*/
public class MITraceSave extends MICommand<MIInfo> {
-
+
public MITraceSave(ITraceTargetDMContext ctx, String file, boolean remoteSave) {
super(ctx, "-trace-save", null, new String[] { file }); //$NON-NLS-1$
if (remoteSave) {
setOptions(new String[] { "-r" }); //$NON-NLS-1$
}
}
-
+
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITraceStart.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITraceStart.java
index 55def2db052..195c9695528 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITraceStart.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITraceStart.java
@@ -18,11 +18,11 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
* -trace-start
- *
+ *
* Starts a tracing experiment. The result of this command does not have any fields.
- *
+ *
* Available with GDB 7.1
- *
+ *
* @since 3.0
*/
public class MITraceStart extends MICommand<MIInfo> {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITraceStatus.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITraceStatus.java
index bc1ec2174bd..c237b1a5a87 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITraceStatus.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITraceStatus.java
@@ -19,19 +19,20 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MITraceStatusInfo;
/**
* -trace-status
- *
+ *
* Gets the status of tracing.
- *
+ *
* Available with GDB 7.1
- *
+ *
* @since 3.0
*/
public class MITraceStatus extends MICommand<MITraceStatusInfo> {
public MITraceStatus(ITraceTargetDMContext ctx) {
super(ctx, "-trace-status"); //$NON-NLS-1$
}
- @Override
- public MITraceStatusInfo getResult(MIOutput out) {
- return new MITraceStatusInfo(out);
- }
+
+ @Override
+ public MITraceStatusInfo getResult(MIOutput out) {
+ return new MITraceStatusInfo(out);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITraceStop.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITraceStop.java
index e5ccbff55b2..cc490675d90 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITraceStop.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITraceStop.java
@@ -19,20 +19,21 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MITraceStopInfo;
/**
* -trace-stop
- *
- * Stops a tracing experiment. The result of this command has the same fields
+ *
+ * Stops a tracing experiment. The result of this command has the same fields
* as -trace-status, except that the 'supported' and 'running' fields are not output.
- *
+ *
* Available with GDB 7.1
- *
+ *
* @since 3.0
*/
public class MITraceStop extends MICommand<MITraceStopInfo> {
public MITraceStop(ITraceTargetDMContext ctx) {
super(ctx, "-trace-stop"); //$NON-NLS-1$
}
- @Override
- public MITraceStopInfo getResult(MIOutput out) {
- return new MITraceStopInfo(out);
- }
+
+ @Override
+ public MITraceStopInfo getResult(MIOutput out) {
+ return new MITraceStopInfo(out);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarAssign.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarAssign.java
index c5232bd6d73..41a3a1c01b2 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarAssign.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarAssign.java
@@ -19,24 +19,23 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
import org.eclipse.cdt.dsf.mi.service.command.output.MIVarAssignInfo;
/**
- *
+ *
* -var-assign NAME EXPRESSION
*
* Assigns the value of EXPRESSION to the variable object specified by
* NAME. The object must be `editable'.
- *
+ *
*/
-public class MIVarAssign extends MICommand<MIVarAssignInfo>
-{
+public class MIVarAssign extends MICommand<MIVarAssignInfo> {
/**
- * @since 1.1
- */
+ * @since 1.1
+ */
public MIVarAssign(ICommandControlDMContext ctx, String name, String expression) {
- super(ctx, "-var-assign", new String[]{name, expression}); //$NON-NLS-1$
+ super(ctx, "-var-assign", new String[] { name, expression }); //$NON-NLS-1$
+ }
+
+ @Override
+ public MIVarAssignInfo getResult(MIOutput out) {
+ return new MIVarAssignInfo(out);
}
-
- @Override
- public MIVarAssignInfo getResult(MIOutput out) {
- return new MIVarAssignInfo(out);
- }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarCreate.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarCreate.java
index f16c8952791..5bd27327717 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarCreate.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarCreate.java
@@ -20,9 +20,8 @@ import org.eclipse.cdt.dsf.debug.service.IExpressions.IExpressionDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
import org.eclipse.cdt.dsf.mi.service.command.output.MIVarCreateInfo;
-
/**
- *
+ *
* -var-create {NAME | "-"}
* {FRAME-ADDR | "*"} EXPRESSION
*
@@ -48,24 +47,23 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIVarCreateInfo;
* * `*ADDR-ADDR' -- a memory address range (TBD)
*
* * `$REGNAME' -- a CPU register name
- *
+ *
*/
-public class MIVarCreate extends MICommand<MIVarCreateInfo>
-{
- public MIVarCreate(IExpressionDMContext dmc, String expression) {
- this(dmc, "-", "*", expression); //$NON-NLS-1$ //$NON-NLS-2$
- }
+public class MIVarCreate extends MICommand<MIVarCreateInfo> {
+ public MIVarCreate(IExpressionDMContext dmc, String expression) {
+ this(dmc, "-", "*", expression); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ public MIVarCreate(IExpressionDMContext dmc, String name, String expression) {
+ this(dmc, name, "*", expression); //$NON-NLS-1$
+ }
- public MIVarCreate(IExpressionDMContext dmc, String name, String expression) {
- this(dmc, name, "*", expression); //$NON-NLS-1$
- }
+ public MIVarCreate(IExpressionDMContext dmc, String name, String frameAddr, String expression) {
+ super(dmc, "-var-create", new String[] { name, frameAddr, expression }); //$NON-NLS-1$
+ }
- public MIVarCreate(IExpressionDMContext dmc, String name, String frameAddr, String expression) {
- super(dmc, "-var-create", new String[]{name, frameAddr, expression}); //$NON-NLS-1$
- }
-
- @Override
- public MIVarCreateInfo getResult(MIOutput out) {
- return new MIVarCreateInfo(out);
- }
+ @Override
+ public MIVarCreateInfo getResult(MIOutput out) {
+ return new MIVarCreateInfo(out);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarDelete.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarDelete.java
index 1539a2673be..e09c3d3c51f 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarDelete.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarDelete.java
@@ -20,25 +20,24 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
import org.eclipse.cdt.dsf.mi.service.command.output.MIVarDeleteInfo;
/**
- *
+ *
* -var-delete NAME
*
* Deletes a previously created variable object and all of its children.
*
* Returns an error if the object NAME is not found.
- *
+ *
*/
-public class MIVarDelete extends MICommand<MIVarDeleteInfo>
-{
- /**
- * @since 1.1
- */
- public MIVarDelete(ICommandControlDMContext dmc, String name) {
- super(dmc, "-var-delete", new String[]{name}); //$NON-NLS-1$
- }
-
- @Override
- public MIVarDeleteInfo getResult(MIOutput out) {
- return new MIVarDeleteInfo(out);
- }
+public class MIVarDelete extends MICommand<MIVarDeleteInfo> {
+ /**
+ * @since 1.1
+ */
+ public MIVarDelete(ICommandControlDMContext dmc, String name) {
+ super(dmc, "-var-delete", new String[] { name }); //$NON-NLS-1$
+ }
+
+ @Override
+ public MIVarDeleteInfo getResult(MIOutput out) {
+ return new MIVarDeleteInfo(out);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarEvaluateExpression.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarEvaluateExpression.java
index a7afaa4a75d..5b7efe2531e 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarEvaluateExpression.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarEvaluateExpression.java
@@ -21,7 +21,7 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
import org.eclipse.cdt.dsf.mi.service.command.output.MIVarEvaluateExpressionInfo;
/**
- *
+ *
* -var-evaluate-expression NAME
*
* Evaluates the expression that is represented by the specified
@@ -29,19 +29,19 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIVarEvaluateExpressionInfo
* specified for the object:
*
* value=VALUE
- *
+ *
*/
public class MIVarEvaluateExpression extends MICommand<MIVarEvaluateExpressionInfo> {
-
- /**
- * @since 1.1
- */
- public MIVarEvaluateExpression(ICommandControlDMContext dmc, String name) {
- super(dmc, "-var-evaluate-expression", new String[] { name }); //$NON-NLS-1$
- }
-
- @Override
- public MIVarEvaluateExpressionInfo getResult(MIOutput out) {
- return new MIVarEvaluateExpressionInfo(out);
- }
+
+ /**
+ * @since 1.1
+ */
+ public MIVarEvaluateExpression(ICommandControlDMContext dmc, String name) {
+ super(dmc, "-var-evaluate-expression", new String[] { name }); //$NON-NLS-1$
+ }
+
+ @Override
+ public MIVarEvaluateExpressionInfo getResult(MIOutput out) {
+ return new MIVarEvaluateExpressionInfo(out);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarInfoExpression.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarInfoExpression.java
index 9a7dfa8a84f..b605cfbeb6c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarInfoExpression.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarInfoExpression.java
@@ -19,7 +19,7 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
import org.eclipse.cdt.dsf.mi.service.command.output.MIVarInfoExpressionInfo;
/**
- *
+ *
* -var-info-expression NAME
*
* Returns what is represented by the variable object NAME:
@@ -27,21 +27,20 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIVarInfoExpressionInfo;
* lang=LANG-SPEC,exp=EXPRESSION
*
* where LANG-SPEC is `{"C" | "C++" | "Java"}'.
- *
+ *
*/
//MIVarInfoExpression.java
-public class MIVarInfoExpression extends MICommand<MIVarInfoExpressionInfo>
-{
+public class MIVarInfoExpression extends MICommand<MIVarInfoExpressionInfo> {
/**
- * @since 1.1
- */
+ * @since 1.1
+ */
public MIVarInfoExpression(ICommandControlDMContext ctx, String name) {
- super(ctx, "-var-info-expression", new String[]{name}); //$NON-NLS-1$
+ super(ctx, "-var-info-expression", new String[] { name }); //$NON-NLS-1$
+ }
+
+ @Override
+ public MIVarInfoExpressionInfo getResult(MIOutput out) {
+ return new MIVarInfoExpressionInfo(out);
}
-
- @Override
- public MIVarInfoExpressionInfo getResult(MIOutput out) {
- return new MIVarInfoExpressionInfo(out);
- }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarInfoNumChildren.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarInfoNumChildren.java
index 8758965727d..13ce5361827 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarInfoNumChildren.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarInfoNumChildren.java
@@ -20,25 +20,24 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
import org.eclipse.cdt.dsf.mi.service.command.output.MIVarInfoNumChildrenInfo;
/**
- *
+ *
* -var-info-num-children NAME
- *
+ *
* Returns the number of children of a variable object NAME:
- *
+ *
* numchild=N
- *
+ *
* Note that this number is not completely reliable for a dynamic varobjs. It
* will return the current number of children, but more children may be
* available.
*/
-public class MIVarInfoNumChildren extends MICommand<MIVarInfoNumChildrenInfo>
-{
+public class MIVarInfoNumChildren extends MICommand<MIVarInfoNumChildrenInfo> {
public MIVarInfoNumChildren(IExpressionDMContext ctx, String name) {
- super(ctx, "-var-info-num-children", new String[]{name}); //$NON-NLS-1$
+ super(ctx, "-var-info-num-children", new String[] { name }); //$NON-NLS-1$
+ }
+
+ @Override
+ public MIVarInfoNumChildrenInfo getResult(MIOutput out) {
+ return new MIVarInfoNumChildrenInfo(out);
}
-
- @Override
- public MIVarInfoNumChildrenInfo getResult(MIOutput out) {
- return new MIVarInfoNumChildrenInfo(out);
- }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarInfoPathExpression.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarInfoPathExpression.java
index 2398adcad37..5627eff52a3 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarInfoPathExpression.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarInfoPathExpression.java
@@ -20,9 +20,9 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
import org.eclipse.cdt.dsf.mi.service.command.output.MIVarInfoPathExpressionInfo;
/**
- *
+ *
* -var-info-path-expression NAME
- *
+ *
* as of GDB 6.7
*
* Print full expression that this variable object represents:
@@ -34,18 +34,16 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIVarInfoPathExpressionInfo
* as ancestor.
*/
-public class MIVarInfoPathExpression extends MICommand<MIVarInfoPathExpressionInfo>
-{
+public class MIVarInfoPathExpression extends MICommand<MIVarInfoPathExpressionInfo> {
/**
- * @since 1.1
- */
+ * @since 1.1
+ */
public MIVarInfoPathExpression(ICommandControlDMContext dmc, String name) {
- super(dmc, "-var-info-path-expression", new String[]{name}); //$NON-NLS-1$
+ super(dmc, "-var-info-path-expression", new String[] { name }); //$NON-NLS-1$
}
- @Override
- public MIVarInfoPathExpressionInfo getResult(MIOutput out) {
- return new MIVarInfoPathExpressionInfo(out);
- }
+ @Override
+ public MIVarInfoPathExpressionInfo getResult(MIOutput out) {
+ return new MIVarInfoPathExpressionInfo(out);
+ }
}
-
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarInfoType.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarInfoType.java
index 48e495c7f23..e6e1c13bad6 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarInfoType.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarInfoType.java
@@ -18,28 +18,26 @@ import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommand
import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
import org.eclipse.cdt.dsf.mi.service.command.output.MIVarInfoTypeInfo;
-
/**
- *
+ *
* -var-info-type NAME
*
* Returns the type of the specified variable NAME. The type is
* returned as a string in the same format as it is output by the GDB CLI:
*
* type=TYPENAME
- *
+ *
*/
-public class MIVarInfoType extends MICommand<MIVarInfoTypeInfo>
-{
+public class MIVarInfoType extends MICommand<MIVarInfoTypeInfo> {
/**
- * @since 1.1
- */
+ * @since 1.1
+ */
public MIVarInfoType(ICommandControlDMContext ctx, String name) {
- super(ctx, "-var-info-type", new String[]{name}); //$NON-NLS-1$
+ super(ctx, "-var-info-type", new String[] { name }); //$NON-NLS-1$
+ }
+
+ @Override
+ public MIVarInfoTypeInfo getResult(MIOutput out) {
+ return new MIVarInfoTypeInfo(out);
}
-
- @Override
- public MIVarInfoTypeInfo getResult(MIOutput out) {
- return new MIVarInfoTypeInfo(out);
- }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarListChildren.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarListChildren.java
index ccc109b4db5..db95233acb4 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarListChildren.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarListChildren.java
@@ -16,28 +16,26 @@
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.MIOutput;
import org.eclipse.cdt.dsf.mi.service.command.output.MIVarListChildrenInfo;
/**
- *
+ *
* -var-list-children NAME
*
* Returns a list of the children of the specified variable object:
*
* numchild=N,children={{name=NAME,
* numchild=N,type=TYPE},(repeats N times)}
- *
+ *
*/
-public class MIVarListChildren extends MICommand<MIVarListChildrenInfo>
-{
+public class MIVarListChildren extends MICommand<MIVarListChildrenInfo> {
/**
- * @since 1.1
- */
+ * @since 1.1
+ */
public MIVarListChildren(ICommandControlDMContext ctx, String name) {
- super(ctx, "-var-list-children", new String[]{name}); //$NON-NLS-1$
+ super(ctx, "-var-list-children", new String[] { name }); //$NON-NLS-1$
}
/**
@@ -48,15 +46,15 @@ public class MIVarListChildren extends MICommand<MIVarListChildrenInfo>
* with this index.
* @param to
* One behind the last child to be listed.
- *
+ *
* @since 4.0
*/
public MIVarListChildren(ICommandControlDMContext ctx, String name, int from, int to) {
- super(ctx, "-var-list-children", new String[]{name, String.valueOf(from), String.valueOf(to)}); //$NON-NLS-1$
+ super(ctx, "-var-list-children", new String[] { name, String.valueOf(from), String.valueOf(to) }); //$NON-NLS-1$
+ }
+
+ @Override
+ public MIVarListChildrenInfo getResult(MIOutput out) {
+ return new MIVarListChildrenInfo(out);
}
-
- @Override
- public MIVarListChildrenInfo getResult(MIOutput out) {
- return new MIVarListChildrenInfo(out);
- }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarSetFormat.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarSetFormat.java
index 09a0238e1c8..780bc76f982 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarSetFormat.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarSetFormat.java
@@ -22,7 +22,7 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
import org.eclipse.cdt.dsf.mi.service.command.output.MIVarSetFormatInfo;
/**
- *
+ *
* -var-set-format NAME FORMAT-SPEC
*
* Sets the output format for the value of the object NAME to be
@@ -32,37 +32,36 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIVarSetFormatInfo;
*
* FORMAT-SPEC ==>
* {binary | decimal | hexadecimal | octal | natural}
- *
+ *
*/
-public class MIVarSetFormat extends MICommand<MIVarSetFormatInfo>
-{
- /**
- * @since 1.1
- */
- public MIVarSetFormat(ICommandControlDMContext ctx, String name, String fmt) {
- super(ctx, "-var-set-format"); //$NON-NLS-1$
- setParameters(new String[]{name, getFormat(fmt)});
- }
-
- private String getFormat(String fmt){
- String format = "natural"; //$NON-NLS-1$
-
- if (IFormattedValues.HEX_FORMAT.equals(fmt)) {
- format = "hexadecimal"; //$NON-NLS-1$
- } else if (IFormattedValues.BINARY_FORMAT.equals(fmt)) {
- format = "binary"; //$NON-NLS-1$
- } else if (IFormattedValues.OCTAL_FORMAT.equals(fmt)) {
- format = "octal"; //$NON-NLS-1$
- } else if (IFormattedValues.NATURAL_FORMAT.equals(fmt)) {
- format = "natural"; //$NON-NLS-1$
- } else if (IFormattedValues.DECIMAL_FORMAT.equals(fmt)) {
- format = "decimal"; //$NON-NLS-1$
- }
- return format;
- }
-
- @Override
- public MIVarSetFormatInfo getResult(MIOutput out) {
- return new MIVarSetFormatInfo(out);
- }
+public class MIVarSetFormat extends MICommand<MIVarSetFormatInfo> {
+ /**
+ * @since 1.1
+ */
+ public MIVarSetFormat(ICommandControlDMContext ctx, String name, String fmt) {
+ super(ctx, "-var-set-format"); //$NON-NLS-1$
+ setParameters(new String[] { name, getFormat(fmt) });
+ }
+
+ private String getFormat(String fmt) {
+ String format = "natural"; //$NON-NLS-1$
+
+ if (IFormattedValues.HEX_FORMAT.equals(fmt)) {
+ format = "hexadecimal"; //$NON-NLS-1$
+ } else if (IFormattedValues.BINARY_FORMAT.equals(fmt)) {
+ format = "binary"; //$NON-NLS-1$
+ } else if (IFormattedValues.OCTAL_FORMAT.equals(fmt)) {
+ format = "octal"; //$NON-NLS-1$
+ } else if (IFormattedValues.NATURAL_FORMAT.equals(fmt)) {
+ format = "natural"; //$NON-NLS-1$
+ } else if (IFormattedValues.DECIMAL_FORMAT.equals(fmt)) {
+ format = "decimal"; //$NON-NLS-1$
+ }
+ return format;
+ }
+
+ @Override
+ public MIVarSetFormatInfo getResult(MIOutput out) {
+ return new MIVarSetFormatInfo(out);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarSetUpdateRange.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarSetUpdateRange.java
index b90728f001b..96168d7cf28 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarSetUpdateRange.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarSetUpdateRange.java
@@ -18,15 +18,15 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
* -var-set-update-range name from to
- *
+ *
* Set the range of children to be returned by future invocations of
* -var-update.
- *
+ *
* <code>from</code> and <code>to</code> indicate the range of children to
* report in subsequent -var-update call. If from or to is less than zero, the
* range is reset and all children will be reported. Otherwise, children
* starting at from (zero-based) and up to and excluding to will be reported.
- *
+ *
* @since 4.0
*/
public class MIVarSetUpdateRange extends MICommand<MIInfo> {
@@ -38,6 +38,6 @@ public class MIVarSetUpdateRange extends MICommand<MIInfo> {
* @param to One behind the last child to be updated.
*/
public MIVarSetUpdateRange(ICommandControlDMContext ctx, String name, int from, int to) {
- super(ctx, "-var-set-update-range", new String[]{name, String.valueOf(from), String.valueOf(to)}); //$NON-NLS-1$
+ super(ctx, "-var-set-update-range", new String[] { name, String.valueOf(from), String.valueOf(to) }); //$NON-NLS-1$
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarShowAttributes.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarShowAttributes.java
index 5d71b5f439f..7a3dbd2a209 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarShowAttributes.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarShowAttributes.java
@@ -19,7 +19,7 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
import org.eclipse.cdt.dsf.mi.service.command.output.MIVarShowAttributesInfo;
/**
- *
+ *
* -var-show-attributes NAME
*
* List attributes of the specified variable object NAME:
@@ -27,21 +27,20 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIVarShowAttributesInfo;
* status=ATTR [ ( ,ATTR )* ]
*
* where ATTR is `{ { editable | noneditable } | TBD }'.
- *
+ *
*/
//DsfMIVarShowAttributesInfo
-public class MIVarShowAttributes extends MICommand<MIVarShowAttributesInfo>
-{
+public class MIVarShowAttributes extends MICommand<MIVarShowAttributesInfo> {
/**
- * @since 1.1
- */
+ * @since 1.1
+ */
public MIVarShowAttributes(ICommandControlDMContext ctx, String name) {
- super(ctx, "-var-show-attributes", new String[]{name}); //$NON-NLS-1$
+ super(ctx, "-var-show-attributes", new String[] { name }); //$NON-NLS-1$
+ }
+
+ @Override
+ public MIVarShowAttributesInfo getResult(MIOutput out) {
+ return new MIVarShowAttributesInfo(out);
}
-
- @Override
- public MIVarShowAttributesInfo getResult(MIOutput out) {
- return new MIVarShowAttributesInfo(out);
- }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarShowFormat.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarShowFormat.java
index 744acdb2a73..6de912074fd 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarShowFormat.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarShowFormat.java
@@ -19,26 +19,25 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
import org.eclipse.cdt.dsf.mi.service.command.output.MIVarShowFormatInfo;
/**
- *
+ *
* -var-show-format NAME
*
* Returns the format used to display the value of the object NAME.
*
* FORMAT ==>
* FORMAT-SPEC
- *
+ *
*/
-public class MIVarShowFormat extends MICommand<MIVarShowFormatInfo>
-{
+public class MIVarShowFormat extends MICommand<MIVarShowFormatInfo> {
/**
- * @since 1.1
- */
+ * @since 1.1
+ */
public MIVarShowFormat(ICommandControlDMContext ctx, String name) {
- super(ctx, "-var-show-format", new String[]{name}); //$NON-NLS-1$
+ super(ctx, "-var-show-format", new String[] { name }); //$NON-NLS-1$
}
- @Override
- public MIVarShowFormatInfo getResult(MIOutput out) {
- return new MIVarShowFormatInfo(out);
- }
+ @Override
+ public MIVarShowFormatInfo getResult(MIOutput out) {
+ return new MIVarShowFormatInfo(out);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarUpdate.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarUpdate.java
index 9f7261e599b..ad0f923fc8d 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarUpdate.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarUpdate.java
@@ -21,28 +21,28 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
import org.eclipse.cdt.dsf.mi.service.command.output.MIVarUpdateInfo;
/**
- *
+ *
* -var-update [print-values] {NAME | "*"}
*
* Update the value of the variable object NAME by evaluating its
* expression after fetching all the new values from memory or registers.
* A `*' causes all existing variable objects to be updated.
- * If print-values has a value for of 0 or --no-values, print only the names of the variables;
- * if print-values is 1 or --all-values, also print their values;
- * if it is 2 or --simple-values print the name and value for simple data types and just
- * the name for arrays, structures and unions.
+ * If print-values has a value for of 0 or --no-values, print only the names of the variables;
+ * if print-values is 1 or --all-values, also print their values;
+ * if it is 2 or --simple-values print the name and value for simple data types and just
+ * the name for arrays, structures and unions.
*/
public class MIVarUpdate extends MICommand<MIVarUpdateInfo> {
/**
- * @since 1.1
- */
+ * @since 1.1
+ */
public MIVarUpdate(ICommandControlDMContext dmc, String name) {
super(dmc, "-var-update", new String[] { "1", name }); //$NON-NLS-1$//$NON-NLS-2$
}
-
- @Override
- public MIVarUpdateInfo getResult(MIOutput out) {
- return new MIVarUpdateInfo(out);
- }
+
+ @Override
+ public MIVarUpdateInfo getResult(MIOutput out) {
+ return new MIVarUpdateInfo(out);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/RawCommand.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/RawCommand.java
index cc0dd528fca..f8e6b2110c3 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/RawCommand.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/RawCommand.java
@@ -23,23 +23,27 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
*/
public class RawCommand extends MICommand<MIInfo> {
- String fRaw;
-
- public RawCommand(IDMContext ctx, String operation) {
- super(ctx, operation);
- fRaw = operation;
- }
-
- @Override
- public boolean supportsThreadAndFrameOptions() { return false; }
-
- @Override
- public boolean supportsThreadGroupOption() { return false; }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.mi.core.command.Command#getMIOutput()
- */
- public MIOutput getMIOutput() {
- return new MIOutput();
- }
+ String fRaw;
+
+ public RawCommand(IDMContext ctx, String operation) {
+ super(ctx, operation);
+ fRaw = operation;
+ }
+
+ @Override
+ public boolean supportsThreadAndFrameOptions() {
+ return false;
+ }
+
+ @Override
+ public boolean supportsThreadGroupOption() {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.mi.core.command.Command#getMIOutput()
+ */
+ public MIOutput getMIOutput() {
+ return new MIOutput();
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/IMIDMEvent.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/IMIDMEvent.java
index 8c193af07ee..610581ea169 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/IMIDMEvent.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/IMIDMEvent.java
@@ -7,28 +7,27 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command.events;
-
/**
* Common interface for events that are directly caused by some MI event.
- *
+ *
* @since 1.1
*/
public interface IMIDMEvent {
-
- /**
- * Returns the underlying MI event that triggered this event.
- * <p>
- * Note: the return type is an object which can be safely cast to
- * an MIEvent. However returning a parametrized MIEvent type here
- * leads to compiler warnings related to generics (see bug 240997)
- * </p>
- * @see MIEvent
- */
+
+ /**
+ * Returns the underlying MI event that triggered this event.
+ * <p>
+ * Note: the return type is an object which can be safely cast to
+ * an MIEvent. However returning a parametrized MIEvent type here
+ * leads to compiler warnings related to generics (see bug 240997)
+ * </p>
+ * @see MIEvent
+ */
public Object getMIEvent();
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIBreakpointChangedEvent.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIBreakpointChangedEvent.java
index 2ae7dccf836..8d356abaeb6 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIBreakpointChangedEvent.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIBreakpointChangedEvent.java
@@ -18,26 +18,25 @@ package org.eclipse.cdt.dsf.mi.service.command.events;
import org.eclipse.cdt.dsf.concurrent.Immutable;
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext;
-
/**
*
*/
@Immutable
public class MIBreakpointChangedEvent extends MIEvent<IBreakpointsTargetDMContext> {
- final private int no;
+ final private int no;
- public MIBreakpointChangedEvent(IBreakpointsTargetDMContext ctx, int number) {
- this(ctx, 0, number);
- }
+ public MIBreakpointChangedEvent(IBreakpointsTargetDMContext ctx, int number) {
+ this(ctx, 0, number);
+ }
- public MIBreakpointChangedEvent(IBreakpointsTargetDMContext ctx, int id, int number) {
- super(ctx, id, null);
- no = number;
- }
+ public MIBreakpointChangedEvent(IBreakpointsTargetDMContext ctx, int id, int number) {
+ super(ctx, id, null);
+ no = number;
+ }
- public int getNumber() {
- return no;
- }
+ public int getNumber() {
+ return no;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIBreakpointHitEvent.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIBreakpointHitEvent.java
index 674d218d6dc..d419e077125 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIBreakpointHitEvent.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIBreakpointHitEvent.java
@@ -38,7 +38,7 @@ import org.eclipse.debug.core.model.IBreakpoint;
* Conveys that gdb reported the target stopped because of a breakpoint. This
* includes catchpoints, as gdb reports them as a breakpoint-hit. The
* async-exec-output record looks like this:
- *
+ *
* <code>
* ^stopped,reason="breakpoint-hit",bkptno="1",thread-id="0",frame={addr="0x08048468",func="main",args=[{name="argc",value="1"},{name="argv",value="0xbffff18c"}],file="hello.c",line="4"}
* </code>
@@ -46,69 +46,70 @@ import org.eclipse.debug.core.model.IBreakpoint;
@Immutable
public class MIBreakpointHitEvent extends MIStoppedEvent {
- private String bkptno;
+ private String bkptno;
+
+ /** @since 5.0 */
+ protected MIBreakpointHitEvent(IExecutionDMContext ctx, int token, MIResult[] results, MIFrame frame,
+ String bkptno) {
+ super(ctx, token, results, frame);
+ this.bkptno = bkptno;
+ }
- /** @since 5.0 */
- protected MIBreakpointHitEvent(IExecutionDMContext ctx, int token, MIResult[] results, MIFrame frame, String bkptno) {
- super(ctx, token, results, frame);
- this.bkptno = bkptno;
- }
+ /** @since 5.0 */
+ public String getNumber() {
+ return bkptno;
+ }
- /** @since 5.0 */
- public String getNumber() {
- return bkptno;
- }
-
- @ConfinedToDsfExecutor("")
- public static MIBreakpointHitEvent parse(IExecutionDMContext dmc, int token, MIResult[] results) {
- String bkptno = ""; //$NON-NLS-1$
+ @ConfinedToDsfExecutor("")
+ public static MIBreakpointHitEvent parse(IExecutionDMContext dmc, int token, MIResult[] results) {
+ String bkptno = ""; //$NON-NLS-1$
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- MIValue value = results[i].getMIValue();
- String str = ""; //$NON-NLS-1$
- if (value != null && value instanceof MIConst) {
- str = ((MIConst)value).getString();
- }
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ MIValue value = results[i].getMIValue();
+ String str = ""; //$NON-NLS-1$
+ if (value != null && value instanceof MIConst) {
+ str = ((MIConst) value).getString();
+ }
- if (var.equals("bkptno")) { //$NON-NLS-1$
- try {
- bkptno = str.trim();
- } catch (NumberFormatException e) {
- }
- }
- }
+ if (var.equals("bkptno")) { //$NON-NLS-1$
+ try {
+ bkptno = str.trim();
+ } catch (NumberFormatException e) {
+ }
+ }
+ }
- // We might be here because of a catchpoint hit; in gdb >= 7.0,
- // catchpoints are reported as breakpoints. Unfortunately, there's
- // nothing in the stopped event indicating it's a catchpoint, and unlike
+ // We might be here because of a catchpoint hit; in gdb >= 7.0,
+ // catchpoints are reported as breakpoints. Unfortunately, there's
+ // nothing in the stopped event indicating it's a catchpoint, and unlike
// gdb < 7.0, there are no stream records that tell us so. The only way
// to determine it's a catchpoint is to map the gdb breakpoint number
// back to the CBreakpoint (platform) object.
- IBreakpointsTargetDMContext bpsTarget = DMContexts.getAncestorOfType(dmc, IBreakpointsTargetDMContext.class);
- if (bpsTarget != null) {
- MIBreakpointDMContext bkpt = new MIBreakpointDMContext(dmc.getSessionId(), new IDMContext[] {bpsTarget}, bkptno);
- DsfServicesTracker tracker = new DsfServicesTracker(GdbPlugin.getBundleContext(), dmc.getSessionId());
- try {
- MIBreakpointsManager bkptMgr = tracker.getService(MIBreakpointsManager.class);
- if (bkptMgr != null) {
- IBreakpoint platformBkpt = bkptMgr.findPlatformBreakpoint(bkpt);
- if (platformBkpt instanceof CEventBreakpoint) {
- try {
- String eventTypeID = ((CEventBreakpoint)platformBkpt).getEventType();
- String gdbKeyword = GdbCatchpoints.eventToGdbCatchpointKeyword(eventTypeID);
- return MICatchpointHitEvent.parse(dmc, token, results, bkptno, gdbKeyword);
- } catch (DebugException e) {
- }
- }
- }
- }
- finally {
- tracker.dispose();
- }
- }
+ IBreakpointsTargetDMContext bpsTarget = DMContexts.getAncestorOfType(dmc, IBreakpointsTargetDMContext.class);
+ if (bpsTarget != null) {
+ MIBreakpointDMContext bkpt = new MIBreakpointDMContext(dmc.getSessionId(), new IDMContext[] { bpsTarget },
+ bkptno);
+ DsfServicesTracker tracker = new DsfServicesTracker(GdbPlugin.getBundleContext(), dmc.getSessionId());
+ try {
+ MIBreakpointsManager bkptMgr = tracker.getService(MIBreakpointsManager.class);
+ if (bkptMgr != null) {
+ IBreakpoint platformBkpt = bkptMgr.findPlatformBreakpoint(bkpt);
+ if (platformBkpt instanceof CEventBreakpoint) {
+ try {
+ String eventTypeID = ((CEventBreakpoint) platformBkpt).getEventType();
+ String gdbKeyword = GdbCatchpoints.eventToGdbCatchpointKeyword(eventTypeID);
+ return MICatchpointHitEvent.parse(dmc, token, results, bkptno, gdbKeyword);
+ } catch (DebugException e) {
+ }
+ }
+ }
+ } finally {
+ tracker.dispose();
+ }
+ }
- MIStoppedEvent stoppedEvent = MIStoppedEvent.parse(dmc, token, results);
- return new MIBreakpointHitEvent(stoppedEvent.getDMContext(), token, results, stoppedEvent.getFrame(), bkptno);
- }
+ MIStoppedEvent stoppedEvent = MIStoppedEvent.parse(dmc, token, results);
+ return new MIBreakpointHitEvent(stoppedEvent.getDMContext(), token, results, stoppedEvent.getFrame(), bkptno);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MICatchpointHitEvent.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MICatchpointHitEvent.java
index 8d9c31f5324..e23eaf2869f 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MICatchpointHitEvent.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MICatchpointHitEvent.java
@@ -29,10 +29,10 @@ public class MICatchpointHitEvent extends MIBreakpointHitEvent {
* See {@link #getReason()}
*/
private String fReason;
-
+
/** @since 5.0 */
- protected MICatchpointHitEvent(IExecutionDMContext ctx, int token,
- MIResult[] results, MIFrame frame, String bkptno, String reason) {
+ protected MICatchpointHitEvent(IExecutionDMContext ctx, int token, MIResult[] results, MIFrame frame, String bkptno,
+ String reason) {
super(ctx, token, results, frame, bkptno);
fReason = reason;
}
@@ -52,43 +52,44 @@ public class MICatchpointHitEvent extends MIBreakpointHitEvent {
* sends us a stopped event, but it doesn't include a reason in it.
* Fortunately, it does output a stream record that tells us not only that a
* catchpoint was hit, but what its breakpoint number is.
- *
+ *
* @param streamRecord
* the stream record that reveals that a catchpoint was hit and
* what the event was
*/
- public static MIBreakpointHitEvent parse(IExecutionDMContext dmc, int token, MIResult[] results, MIStreamRecord streamRecord) {
- // stream record example: "Catchpoint 1 (exception caught)"
- StringTokenizer tokenizer = new StringTokenizer(streamRecord.getString());
- tokenizer.nextToken(); // "Catchpoint"
- try {
- String bkptNumber = tokenizer.nextToken(); // "1"
- StringBuilder reason = new StringBuilder();
- boolean first = true;
- while (tokenizer.hasMoreElements()) {
- if (!first) {
- reason.append(" "); //$NON-NLS-1$ ok; technically, the delim could be any whitespace, but we know it's s a space char
- }
- reason.append(tokenizer.nextElement());
- first = false;
- }
+ public static MIBreakpointHitEvent parse(IExecutionDMContext dmc, int token, MIResult[] results,
+ MIStreamRecord streamRecord) {
+ // stream record example: "Catchpoint 1 (exception caught)"
+ StringTokenizer tokenizer = new StringTokenizer(streamRecord.getString());
+ tokenizer.nextToken(); // "Catchpoint"
+ try {
+ String bkptNumber = tokenizer.nextToken(); // "1"
+ StringBuilder reason = new StringBuilder();
+ boolean first = true;
+ while (tokenizer.hasMoreElements()) {
+ if (!first) {
+ reason.append(" "); //$NON-NLS-1$ ok; technically, the delim could be any whitespace, but we know it's s a space char
+ }
+ reason.append(tokenizer.nextElement());
+ first = false;
+ }
- // remove the parentheses
- if (reason.charAt(0) == '(') {
- reason.deleteCharAt(0);
- }
- if (reason.charAt(reason.length()-1) == ')') {
- reason.deleteCharAt(reason.length()-1);
- }
-
- MIStoppedEvent stoppedEvent = MIStoppedEvent.parse(dmc, token, results);
- return new MICatchpointHitEvent(stoppedEvent.getDMContext(), token, results, stoppedEvent.getFrame(), bkptNumber, reason.toString());
- }
- catch (NumberFormatException exc) {
- assert false : "unexpected catchpoint stream record format: " + streamRecord.getString(); //$NON-NLS-1$
- return null;
- }
- }
+ // remove the parentheses
+ if (reason.charAt(0) == '(') {
+ reason.deleteCharAt(0);
+ }
+ if (reason.charAt(reason.length() - 1) == ')') {
+ reason.deleteCharAt(reason.length() - 1);
+ }
+
+ MIStoppedEvent stoppedEvent = MIStoppedEvent.parse(dmc, token, results);
+ return new MICatchpointHitEvent(stoppedEvent.getDMContext(), token, results, stoppedEvent.getFrame(),
+ bkptNumber, reason.toString());
+ } catch (NumberFormatException exc) {
+ assert false : "unexpected catchpoint stream record format: " + streamRecord.getString(); //$NON-NLS-1$
+ return null;
+ }
+ }
/**
* This variant is for a catchpoint-hit in gdb >= 7.0.
@@ -100,10 +101,12 @@ public class MICatchpointHitEvent extends MIBreakpointHitEvent {
* "exception caught"). The inconsistency is fine. The user will get the
* insight he needs either way.
*
- * @since 5.0
+ * @since 5.0
*/
- public static MICatchpointHitEvent parse(IExecutionDMContext dmc, int token, MIResult[] results, String bkptNumber, String gdbKeyword) {
- MIStoppedEvent stoppedEvent = MIStoppedEvent.parse(dmc, token, results);
- return new MICatchpointHitEvent(stoppedEvent.getDMContext(), token, results, stoppedEvent.getFrame(), bkptNumber, gdbKeyword);
- }
+ public static MICatchpointHitEvent parse(IExecutionDMContext dmc, int token, MIResult[] results, String bkptNumber,
+ String gdbKeyword) {
+ MIStoppedEvent stoppedEvent = MIStoppedEvent.parse(dmc, token, results);
+ return new MICatchpointHitEvent(stoppedEvent.getDMContext(), token, results, stoppedEvent.getFrame(),
+ bkptNumber, gdbKeyword);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIDetachedEvent.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIDetachedEvent.java
index db1fb94626f..8705b305da2 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIDetachedEvent.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIDetachedEvent.java
@@ -18,7 +18,6 @@ package org.eclipse.cdt.dsf.mi.service.command.events;
import org.eclipse.cdt.dsf.concurrent.Immutable;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
-
/**
*
* ^running
@@ -26,15 +25,15 @@ import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommand
@Immutable
public class MIDetachedEvent extends MIEvent<ICommandControlDMContext> {
- /**
- * @since 1.1
- */
- public MIDetachedEvent(ICommandControlDMContext ctx, int token) {
- super(ctx, token, null);
- }
-
- @Override
- public String toString() {
- return "Detached"; //$NON-NLS-1$
- }
+ /**
+ * @since 1.1
+ */
+ public MIDetachedEvent(ICommandControlDMContext ctx, int token) {
+ super(ctx, token, null);
+ }
+
+ @Override
+ public String toString() {
+ return "Detached"; //$NON-NLS-1$
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIErrorEvent.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIErrorEvent.java
index 901f16a597e..9e8d6fea6fa 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIErrorEvent.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIErrorEvent.java
@@ -34,78 +34,75 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIValue;
@Immutable
public class MIErrorEvent extends MIStoppedEvent {
- final private String msg;
- final private String log;
- final private MIOOBRecord[] oobs;
+ final private String msg;
+ final private String log;
+ final private MIOOBRecord[] oobs;
- protected MIErrorEvent(
- IExecutionDMContext ctx, int token, MIResult[] results, MIOOBRecord[] oobs, String msg, String log)
- {
- super(ctx, token, results, null);
- this.msg = msg;
- this.log = log;
- this.oobs = oobs;
- }
+ protected MIErrorEvent(IExecutionDMContext ctx, int token, MIResult[] results, MIOOBRecord[] oobs, String msg,
+ String log) {
+ super(ctx, token, results, null);
+ this.msg = msg;
+ this.log = log;
+ this.oobs = oobs;
+ }
- public String getMessage() {
- return msg;
- }
+ public String getMessage() {
+ return msg;
+ }
- public String getLogMessage() {
- return log;
- }
+ public String getLogMessage() {
+ return log;
+ }
- /**
+ /**
* @since 5.3
*/
- public static MIErrorEvent parse(
- IExecutionDMContext execDmc, int token, MIResult[] results, MIOOBRecord[] oobs) {
- String msg = "", log = ""; //$NON-NLS-1$ //$NON-NLS-2$
-
- if (results != null) {
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- MIValue value = results[i].getMIValue();
- String str = ""; //$NON-NLS-1$
- if (value instanceof MIConst) {
- str = ((MIConst)value).getString();
- }
+ public static MIErrorEvent parse(IExecutionDMContext execDmc, int token, MIResult[] results, MIOOBRecord[] oobs) {
+ String msg = "", log = ""; //$NON-NLS-1$ //$NON-NLS-2$
- if (var.equals("msg")) { //$NON-NLS-1$
- msg = str;
- }
- }
- }
- if (oobs != null) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < oobs.length; i++) {
- if (oobs[i] instanceof MILogStreamOutput) {
- MIStreamRecord o = (MIStreamRecord)oobs[i];
- sb.append(o.getString());
- }
- }
- log = sb.toString();
- }
- return new MIErrorEvent(execDmc, token, results, oobs, msg, log);
- }
+ if (results != null) {
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ MIValue value = results[i].getMIValue();
+ String str = ""; //$NON-NLS-1$
+ if (value instanceof MIConst) {
+ str = ((MIConst) value).getString();
+ }
- public static MIErrorEvent parse(
- IContainerDMContext containerDmc, int token, MIResult[] results, MIOOBRecord[] oobs) {
- return MIErrorEvent.parse((IExecutionDMContext)containerDmc, token, results, oobs);
- }
-
- @Override
- public String toString() {
- if (oobs != null) {
- StringBuilder builder = new StringBuilder();
- for (MIOOBRecord oob : oobs) {
- builder.append(oob.toString());
- }
- builder.append(super.toString());
- return builder.toString();
- } else {
- return super.toString();
- }
- }
-}
+ if (var.equals("msg")) { //$NON-NLS-1$
+ msg = str;
+ }
+ }
+ }
+ if (oobs != null) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < oobs.length; i++) {
+ if (oobs[i] instanceof MILogStreamOutput) {
+ MIStreamRecord o = (MIStreamRecord) oobs[i];
+ sb.append(o.getString());
+ }
+ }
+ log = sb.toString();
+ }
+ return new MIErrorEvent(execDmc, token, results, oobs, msg, log);
+ }
+
+ public static MIErrorEvent parse(IContainerDMContext containerDmc, int token, MIResult[] results,
+ MIOOBRecord[] oobs) {
+ return MIErrorEvent.parse((IExecutionDMContext) containerDmc, token, results, oobs);
+ }
+ @Override
+ public String toString() {
+ if (oobs != null) {
+ StringBuilder builder = new StringBuilder();
+ for (MIOOBRecord oob : oobs) {
+ builder.append(oob.toString());
+ }
+ builder.append(super.toString());
+ return builder.toString();
+ } else {
+ return super.toString();
+ }
+ }
+}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIEvent.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIEvent.java
index 3536a67ef4f..163583171c2 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIEvent.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIEvent.java
@@ -20,41 +20,40 @@ import org.eclipse.cdt.dsf.datamodel.AbstractDMEvent;
import org.eclipse.cdt.dsf.datamodel.IDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.MIResult;
-
/**
*/
@Immutable
public abstract class MIEvent<V extends IDMContext> extends AbstractDMEvent<V> {
- private final int fToken;
- private final MIResult[] fResults;
+ private final int fToken;
+ private final MIResult[] fResults;
+
+ public MIEvent(V dmc, int token, MIResult[] results) {
+ super(dmc);
+ fToken = token;
+ fResults = results;
+ }
+
+ public int getToken() {
+ return fToken;
+ }
- public MIEvent(V dmc, int token, MIResult[] results) {
- super(dmc);
- fToken = token;
- fResults = results;
- }
+ public MIResult[] getResults() {
+ return fResults;
+ }
- public int getToken() {
- return fToken;
- }
-
- public MIResult[] getResults() {
- return fResults;
- }
-
- @Override
- public String toString() {
- if (fResults == null) {
- return super.toString();
- } else if (fResults.length == 1) {
- return fResults[0].toString();
- } else {
- StringBuilder builder = new StringBuilder();
- for (MIResult result : fResults) {
- builder.append(result);
- builder.append('\n');
- }
- return builder.toString();
- }
- }
+ @Override
+ public String toString() {
+ if (fResults == null) {
+ return super.toString();
+ } else if (fResults.length == 1) {
+ return fResults[0].toString();
+ } else {
+ StringBuilder builder = new StringBuilder();
+ for (MIResult result : fResults) {
+ builder.append(result);
+ builder.append('\n');
+ }
+ return builder.toString();
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIFunctionFinishedEvent.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIFunctionFinishedEvent.java
index daca690149f..dbb938ef738 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIFunctionFinishedEvent.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIFunctionFinishedEvent.java
@@ -28,59 +28,57 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIValue;
@Immutable
public class MIFunctionFinishedEvent extends MIStoppedEvent {
- final private String gdbResult;
- final private String returnValue;
- final private String returnType;
+ final private String gdbResult;
+ final private String returnValue;
+ final private String returnType;
- protected MIFunctionFinishedEvent(
- IExecutionDMContext ctx, int token, MIResult[] results, MIFrame frame, String gdbResult,
- String returnValue, String returnType)
- {
- super(ctx, token, results, frame);
- this.gdbResult = gdbResult;
- this.returnValue = returnValue;
- this.returnType = returnType;
- }
+ protected MIFunctionFinishedEvent(IExecutionDMContext ctx, int token, MIResult[] results, MIFrame frame,
+ String gdbResult, String returnValue, String returnType) {
+ super(ctx, token, results, frame);
+ this.gdbResult = gdbResult;
+ this.returnValue = returnValue;
+ this.returnType = returnType;
+ }
- public String getGDBResultVar() {
- return gdbResult;
- }
+ public String getGDBResultVar() {
+ return gdbResult;
+ }
- public String getReturnValue() {
- return returnValue;
- }
+ public String getReturnValue() {
+ return returnValue;
+ }
- public String getReturnType() {
- return returnType;
- }
+ public String getReturnType() {
+ return returnType;
+ }
- /**
- * @since 1.1
- */
- public static MIFunctionFinishedEvent parse(IExecutionDMContext dmc, int token, MIResult[] results)
- {
- String gdbResult = ""; //$NON-NLS-1$
- String returnValue = ""; //$NON-NLS-1$
- String returnType = ""; //$NON-NLS-1$
+ /**
+ * @since 1.1
+ */
+ public static MIFunctionFinishedEvent parse(IExecutionDMContext dmc, int token, MIResult[] results) {
+ String gdbResult = ""; //$NON-NLS-1$
+ String returnValue = ""; //$NON-NLS-1$
+ String returnType = ""; //$NON-NLS-1$
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- MIValue value = results[i].getMIValue();
- String str = ""; //$NON-NLS-1$
- if (value instanceof MIConst) {
- str = ((MIConst)value).getString();
- }
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ MIValue value = results[i].getMIValue();
+ String str = ""; //$NON-NLS-1$
+ if (value instanceof MIConst) {
+ str = ((MIConst) value).getString();
+ }
- if (var.equals("gdb-result-var")) { //$NON-NLS-1$
- gdbResult = str;
- } else if (var.equals("return-value")) { //$NON-NLS-1$
- returnValue = str;
- } else if (var.equals("return-type")) { //$NON-NLS-1$
- returnType = str;
- }
- }
+ if (var.equals("gdb-result-var")) { //$NON-NLS-1$
+ gdbResult = str;
+ } else if (var.equals("return-value")) { //$NON-NLS-1$
+ returnValue = str;
+ } else if (var.equals("return-type")) { //$NON-NLS-1$
+ returnType = str;
+ }
+ }
- MIStoppedEvent stoppedEvent = MIStoppedEvent.parse(dmc, token, results);
- return new MIFunctionFinishedEvent(stoppedEvent.getDMContext(), token, results, stoppedEvent.getFrame(), gdbResult, returnValue, returnType);
- }
+ MIStoppedEvent stoppedEvent = MIStoppedEvent.parse(dmc, token, results);
+ return new MIFunctionFinishedEvent(stoppedEvent.getDMContext(), token, results, stoppedEvent.getFrame(),
+ gdbResult, returnValue, returnType);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIInferiorExitEvent.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIInferiorExitEvent.java
index 2f1bac99398..194cd4b95fd 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIInferiorExitEvent.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIInferiorExitEvent.java
@@ -30,44 +30,43 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIValue;
@Immutable
public class MIInferiorExitEvent extends MIEvent<ICommandControlDMContext> {
- final private int code;
+ final private int code;
- /**
- * @since 1.1
- */
- public MIInferiorExitEvent(ICommandControlDMContext ctx, int token, MIResult[] results, int code) {
- super(ctx, token, results);
- this.code = code;
- }
-
- public int getExitCode() {
- return code;
- }
-
- /**
- * @since 1.1
- */
- public static MIInferiorExitEvent parse(ICommandControlDMContext ctx, int token, MIResult[] results)
- {
- int code = 0;
- if (results != null) {
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- MIValue value = results[i].getMIValue();
- String str = ""; //$NON-NLS-1$
- if (value instanceof MIConst) {
- str = ((MIConst)value).getString();
- }
+ /**
+ * @since 1.1
+ */
+ public MIInferiorExitEvent(ICommandControlDMContext ctx, int token, MIResult[] results, int code) {
+ super(ctx, token, results);
+ this.code = code;
+ }
- if (var.equals("exit-code")) { //$NON-NLS-1$
- try {
- code = Integer.decode(str.trim()).intValue();
- } catch (NumberFormatException e) {
- }
- }
- }
- }
- return new MIInferiorExitEvent(ctx, token, results, code);
- }
+ public int getExitCode() {
+ return code;
+ }
+
+ /**
+ * @since 1.1
+ */
+ public static MIInferiorExitEvent parse(ICommandControlDMContext ctx, int token, MIResult[] results) {
+ int code = 0;
+ if (results != null) {
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ MIValue value = results[i].getMIValue();
+ String str = ""; //$NON-NLS-1$
+ if (value instanceof MIConst) {
+ str = ((MIConst) value).getString();
+ }
+
+ if (var.equals("exit-code")) { //$NON-NLS-1$
+ try {
+ code = Integer.decode(str.trim()).intValue();
+ } catch (NumberFormatException e) {
+ }
+ }
+ }
+ }
+ return new MIInferiorExitEvent(ctx, token, results, code);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIInferiorSignalExitEvent.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIInferiorSignalExitEvent.java
index c26dc142221..c2529bc3878 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIInferiorSignalExitEvent.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIInferiorSignalExitEvent.java
@@ -30,40 +30,40 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIValue;
@Immutable
public class MIInferiorSignalExitEvent extends MIEvent<ICommandControlDMContext> {
- final private String sigName;
- final private String sigMeaning;
+ final private String sigName;
+ final private String sigMeaning;
- /**
- * @since 1.1
- */
- public MIInferiorSignalExitEvent(ICommandControlDMContext ctx, int token, MIResult[] results, String sigName, String sigMeaning) {
- super(ctx, token, results);
- this.sigName = sigName;
- this.sigMeaning = sigMeaning;
- }
-
- public String getName() {
- return sigName;
- }
+ /**
+ * @since 1.1
+ */
+ public MIInferiorSignalExitEvent(ICommandControlDMContext ctx, int token, MIResult[] results, String sigName,
+ String sigMeaning) {
+ super(ctx, token, results);
+ this.sigName = sigName;
+ this.sigMeaning = sigMeaning;
+ }
- public String getMeaning() {
- return sigMeaning;
- }
-
- /**
- * @since 1.1
- */
- public static MIInferiorSignalExitEvent parse(ICommandControlDMContext ctx, int token, MIResult[] results)
- {
- String sigName = ""; //$NON-NLS-1$
- String sigMeaning = ""; //$NON-NLS-1$
+ public String getName() {
+ return sigName;
+ }
+
+ public String getMeaning() {
+ return sigMeaning;
+ }
+
+ /**
+ * @since 1.1
+ */
+ public static MIInferiorSignalExitEvent parse(ICommandControlDMContext ctx, int token, MIResult[] results) {
+ String sigName = ""; //$NON-NLS-1$
+ String sigMeaning = ""; //$NON-NLS-1$
for (int i = 0; i < results.length; i++) {
String var = results[i].getVariable();
MIValue value = results[i].getMIValue();
String str = ""; //$NON-NLS-1$
if (value instanceof MIConst) {
- str = ((MIConst)value).getString();
+ str = ((MIConst) value).getString();
}
if (var.equals("signal-name")) { //$NON-NLS-1$
@@ -73,5 +73,5 @@ public class MIInferiorSignalExitEvent extends MIEvent<ICommandControlDMContext>
}
}
return new MIInferiorSignalExitEvent(ctx, token, results, sigName, sigMeaning);
- }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MILocationReachedEvent.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MILocationReachedEvent.java
index ce877e456a5..efbe42ed386 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MILocationReachedEvent.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MILocationReachedEvent.java
@@ -26,16 +26,15 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIResult;
@Immutable
public class MILocationReachedEvent extends MIStoppedEvent {
- protected MILocationReachedEvent(IExecutionDMContext ctx, int token, MIResult[] results, MIFrame frame) {
- super(ctx, token, results, frame);
- }
+ protected MILocationReachedEvent(IExecutionDMContext ctx, int token, MIResult[] results, MIFrame frame) {
+ super(ctx, token, results, frame);
+ }
- /**
- * @since 1.1
- */
- public static MILocationReachedEvent parse(IExecutionDMContext dmc, int token, MIResult[] results)
- {
- MIStoppedEvent stoppedEvent = MIStoppedEvent.parse(dmc, token, results);
- return new MILocationReachedEvent(stoppedEvent.getDMContext(), token, results, stoppedEvent.getFrame());
- }
+ /**
+ * @since 1.1
+ */
+ public static MILocationReachedEvent parse(IExecutionDMContext dmc, int token, MIResult[] results) {
+ MIStoppedEvent stoppedEvent = MIStoppedEvent.parse(dmc, token, results);
+ return new MILocationReachedEvent(stoppedEvent.getDMContext(), token, results, stoppedEvent.getFrame());
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIRunningEvent.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIRunningEvent.java
index d12b4601b9d..f4f0e903774 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIRunningEvent.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIRunningEvent.java
@@ -18,45 +18,44 @@ package org.eclipse.cdt.dsf.mi.service.command.events;
import org.eclipse.cdt.dsf.concurrent.Immutable;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
-
/**
*
* ^running
*/
@Immutable
public class MIRunningEvent extends MIEvent<IExecutionDMContext> {
- public static final int CONTINUE = 0;
- public static final int NEXT = 1;
- public static final int NEXTI = 2;
- public static final int STEP = 3;
- public static final int STEPI = 4;
- public static final int FINISH = 5;
- public static final int UNTIL = 6;
- public static final int RETURN = 7;
-
- final private int type;
- final private int threadId;
-
- public MIRunningEvent(IExecutionDMContext ctx, int token, int t) {
- this(ctx, token, t, -1);
- }
-
- public MIRunningEvent(IExecutionDMContext ctx, int token, int t, int threadId) {
- super(ctx, token, null);
- type = t;
- this.threadId = threadId;
- }
-
- public int getType() {
- return type;
- }
-
- public int getThreadId() {
- return threadId;
- }
-
- @Override
- public String toString() {
- return "Running"; //$NON-NLS-1$
- }
+ public static final int CONTINUE = 0;
+ public static final int NEXT = 1;
+ public static final int NEXTI = 2;
+ public static final int STEP = 3;
+ public static final int STEPI = 4;
+ public static final int FINISH = 5;
+ public static final int UNTIL = 6;
+ public static final int RETURN = 7;
+
+ final private int type;
+ final private int threadId;
+
+ public MIRunningEvent(IExecutionDMContext ctx, int token, int t) {
+ this(ctx, token, t, -1);
+ }
+
+ public MIRunningEvent(IExecutionDMContext ctx, int token, int t, int threadId) {
+ super(ctx, token, null);
+ type = t;
+ this.threadId = threadId;
+ }
+
+ public int getType() {
+ return type;
+ }
+
+ public int getThreadId() {
+ return threadId;
+ }
+
+ @Override
+ public String toString() {
+ return "Running"; //$NON-NLS-1$
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MISharedLibEvent.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MISharedLibEvent.java
index 4fc523e9c27..8106fa641bf 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MISharedLibEvent.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MISharedLibEvent.java
@@ -28,26 +28,26 @@ public class MISharedLibEvent extends MIStoppedEvent {
/** See {@link #getLibrary()} */
private String fLibrary;
-
- /**
+
+ /**
* @since 3.0
*/
- protected MISharedLibEvent(IExecutionDMContext ctx, int token, MIResult[] results, MIFrame frame, String library) {
- super(ctx, token, results, frame);
- fLibrary = library;
- }
-
- /** The library that was loaded, as reported by gdb.
- * @since 3.0*/
- public String getLibrary() {
- return fLibrary;
- }
+ protected MISharedLibEvent(IExecutionDMContext ctx, int token, MIResult[] results, MIFrame frame, String library) {
+ super(ctx, token, results, frame);
+ fLibrary = library;
+ }
+
+ /** The library that was loaded, as reported by gdb.
+ * @since 3.0*/
+ public String getLibrary() {
+ return fLibrary;
+ }
- /**
+ /**
* @since 3.0
*/
- public static MIStoppedEvent parse(IExecutionDMContext dmc, int token, MIResult[] results, String library) {
- MIStoppedEvent stoppedEvent = MIStoppedEvent.parse(dmc, token, results);
- return new MISharedLibEvent(stoppedEvent.getDMContext(), token, results, stoppedEvent.getFrame(), library);
- }
+ public static MIStoppedEvent parse(IExecutionDMContext dmc, int token, MIResult[] results, String library) {
+ MIStoppedEvent stoppedEvent = MIStoppedEvent.parse(dmc, token, results);
+ return new MISharedLibEvent(stoppedEvent.getDMContext(), token, results, stoppedEvent.getFrame(), library);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MISignalChangedEvent.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MISignalChangedEvent.java
index 66a31067533..8e82adf7b3f 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MISignalChangedEvent.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MISignalChangedEvent.java
@@ -18,26 +18,25 @@ package org.eclipse.cdt.dsf.mi.service.command.events;
import org.eclipse.cdt.dsf.concurrent.Immutable;
import org.eclipse.cdt.dsf.debug.service.ISignals.ISignalsDMContext;
-
/**
*
*/
@Immutable
public class MISignalChangedEvent extends MIEvent<ISignalsDMContext> {
- final private String name;
+ final private String name;
- public MISignalChangedEvent(ISignalsDMContext ctx, String n) {
- this(ctx, 0, n);
- }
+ public MISignalChangedEvent(ISignalsDMContext ctx, String n) {
+ this(ctx, 0, n);
+ }
- public MISignalChangedEvent(ISignalsDMContext ctx, int id, String n) {
- super(ctx, id, null);
- name = n;
- }
+ public MISignalChangedEvent(ISignalsDMContext ctx, int id, String n) {
+ super(ctx, id, null);
+ name = n;
+ }
- public String getName() {
- return name;
- }
+ public String getName() {
+ return name;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MISignalEvent.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MISignalEvent.java
index 6017e553c79..5e4f6785ec0 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MISignalEvent.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MISignalEvent.java
@@ -29,50 +29,48 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIValue;
@Immutable
public class MISignalEvent extends MIStoppedEvent {
- final private String sigName;
- final private String sigMeaning;
+ final private String sigName;
+ final private String sigMeaning;
- protected MISignalEvent(
- IExecutionDMContext ctx, int token, MIResult[] results, MIFrame frame,
- String sigName, String sigMeaning)
- {
- super(ctx, token, results, frame);
- this.sigName = sigName;
- this.sigMeaning = sigMeaning;
- }
-
- public String getName() {
- return sigName;
- }
+ protected MISignalEvent(IExecutionDMContext ctx, int token, MIResult[] results, MIFrame frame, String sigName,
+ String sigMeaning) {
+ super(ctx, token, results, frame);
+ this.sigName = sigName;
+ this.sigMeaning = sigMeaning;
+ }
- public String getMeaning() {
- return sigMeaning;
- }
-
- /**
- * @since 1.1
- */
- public static MISignalEvent parse(IExecutionDMContext dmc, int token, MIResult[] results)
- {
- String sigName = ""; //$NON-NLS-1$
- String sigMeaning = ""; //$NON-NLS-1$
+ public String getName() {
+ return sigName;
+ }
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- MIValue value = results[i].getMIValue();
- String str = ""; //$NON-NLS-1$
- if (value instanceof MIConst) {
- str = ((MIConst)value).getString();
- }
+ public String getMeaning() {
+ return sigMeaning;
+ }
- if (var.equals("signal-name")) { //$NON-NLS-1$
- sigName = str;
- } else if (var.equals("signal-meaning")) { //$NON-NLS-1$
- sigMeaning = str;
- }
- }
- MIStoppedEvent stoppedEvent = MIStoppedEvent.parse(dmc, token, results);
- return new MISignalEvent(stoppedEvent.getDMContext(), token, results, stoppedEvent.getFrame(), sigName, sigMeaning);
- }
+ /**
+ * @since 1.1
+ */
+ public static MISignalEvent parse(IExecutionDMContext dmc, int token, MIResult[] results) {
+ String sigName = ""; //$NON-NLS-1$
+ String sigMeaning = ""; //$NON-NLS-1$
+
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ MIValue value = results[i].getMIValue();
+ String str = ""; //$NON-NLS-1$
+ if (value instanceof MIConst) {
+ str = ((MIConst) value).getString();
+ }
+
+ if (var.equals("signal-name")) { //$NON-NLS-1$
+ sigName = str;
+ } else if (var.equals("signal-meaning")) { //$NON-NLS-1$
+ sigMeaning = str;
+ }
+ }
+ MIStoppedEvent stoppedEvent = MIStoppedEvent.parse(dmc, token, results);
+ return new MISignalEvent(stoppedEvent.getDMContext(), token, results, stoppedEvent.getFrame(), sigName,
+ sigMeaning);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MISteppingRangeEvent.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MISteppingRangeEvent.java
index b41bb009241..7f1f82af37f 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MISteppingRangeEvent.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MISteppingRangeEvent.java
@@ -27,16 +27,15 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIResult;
@Immutable
public class MISteppingRangeEvent extends MIStoppedEvent {
- protected MISteppingRangeEvent(IExecutionDMContext ctx, int token, MIResult[] results, MIFrame frame) {
- super(ctx, token, results, frame);
- }
-
- /**
- * @since 1.1
- */
- public static MISteppingRangeEvent parse(IExecutionDMContext dmc, int token, MIResult[] results)
- {
- MIStoppedEvent stoppedEvent = MIStoppedEvent.parse(dmc, token, results);
- return new MISteppingRangeEvent(stoppedEvent.getDMContext(), token, results, stoppedEvent.getFrame());
- }
+ protected MISteppingRangeEvent(IExecutionDMContext ctx, int token, MIResult[] results, MIFrame frame) {
+ super(ctx, token, results, frame);
+ }
+
+ /**
+ * @since 1.1
+ */
+ public static MISteppingRangeEvent parse(IExecutionDMContext dmc, int token, MIResult[] results) {
+ MIStoppedEvent stoppedEvent = MIStoppedEvent.parse(dmc, token, results);
+ return new MISteppingRangeEvent(stoppedEvent.getDMContext(), token, results, stoppedEvent.getFrame());
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIStoppedEvent.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIStoppedEvent.java
index ddc39f13b4c..52856b863ca 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIStoppedEvent.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIStoppedEvent.java
@@ -29,34 +29,33 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIValue;
@Immutable
public class MIStoppedEvent extends MIEvent<IExecutionDMContext> {
- final private MIFrame frame;
-
- protected MIStoppedEvent(IExecutionDMContext ctx, int token, MIResult[] results, MIFrame frame) {
- super(ctx, token, results);
- this.frame = frame;
- }
-
- public MIFrame getFrame() {
- return frame;
- }
-
- /**
- * @since 1.1
- */
- public static MIStoppedEvent parse(IExecutionDMContext dmc, int token, MIResult[] results)
- {
- MIFrame frame = null;
-
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- MIValue value = results[i].getMIValue();
-
- if (var.equals("frame")) { //$NON-NLS-1$
- if (value instanceof MITuple) {
- frame = new MIFrame((MITuple)value);
- }
- }
- }
- return new MIStoppedEvent(dmc, token, results, frame);
- }
+ final private MIFrame frame;
+
+ protected MIStoppedEvent(IExecutionDMContext ctx, int token, MIResult[] results, MIFrame frame) {
+ super(ctx, token, results);
+ this.frame = frame;
+ }
+
+ public MIFrame getFrame() {
+ return frame;
+ }
+
+ /**
+ * @since 1.1
+ */
+ public static MIStoppedEvent parse(IExecutionDMContext dmc, int token, MIResult[] results) {
+ MIFrame frame = null;
+
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ MIValue value = results[i].getMIValue();
+
+ if (var.equals("frame")) { //$NON-NLS-1$
+ if (value instanceof MITuple) {
+ frame = new MIFrame((MITuple) value);
+ }
+ }
+ }
+ return new MIStoppedEvent(dmc, token, results, frame);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIThreadCreatedEvent.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIThreadCreatedEvent.java
index 10783343308..184c6c7693b 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIThreadCreatedEvent.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIThreadCreatedEvent.java
@@ -18,7 +18,6 @@ package org.eclipse.cdt.dsf.mi.service.command.events;
import org.eclipse.cdt.dsf.concurrent.Immutable;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
-
/**
* This can only be detected by gdb/mi after GDB 6.8.
*
@@ -26,45 +25,44 @@ import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
@Immutable
public class MIThreadCreatedEvent extends MIEvent<IContainerDMContext> {
- final private String fThreadId;
+ final private String fThreadId;
+
+ public MIThreadCreatedEvent(IContainerDMContext ctx, int id) {
+ this(ctx, 0, id);
+ }
- public MIThreadCreatedEvent(IContainerDMContext ctx, int id) {
- this(ctx, 0, id);
- }
+ public MIThreadCreatedEvent(IContainerDMContext ctx, int token, int id) {
+ super(ctx, token, null);
+ fThreadId = Integer.toString(id);
+ }
- public MIThreadCreatedEvent(IContainerDMContext ctx, int token, int id) {
- super(ctx, token, null);
- fThreadId = Integer.toString(id);
- }
+ /**
+ * @since 1.1
+ */
+ public MIThreadCreatedEvent(IContainerDMContext ctx, String threadId) {
+ this(ctx, 0, threadId);
+ }
- /**
- * @since 1.1
- */
- public MIThreadCreatedEvent(IContainerDMContext ctx, String threadId) {
- this(ctx, 0, threadId);
- }
+ /**
+ * @since 1.1
+ */
+ public MIThreadCreatedEvent(IContainerDMContext ctx, int token, String threadId) {
+ super(ctx, token, null);
+ fThreadId = threadId;
+ }
- /**
- * @since 1.1
- */
- public MIThreadCreatedEvent(IContainerDMContext ctx, int token, String threadId) {
- super(ctx, token, null);
- fThreadId = threadId;
- }
+ public int getId() {
+ try {
+ return Integer.parseInt(fThreadId);
+ } catch (NumberFormatException e) {
+ return 0;
+ }
+ }
- public int getId() {
- try {
- return Integer.parseInt(fThreadId);
- }
- catch (NumberFormatException e) {
- return 0;
- }
- }
-
- /**
- * @since 1.1
- */
- public String getStrId() {
- return fThreadId;
- }
+ /**
+ * @since 1.1
+ */
+ public String getStrId() {
+ return fThreadId;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIThreadExitEvent.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIThreadExitEvent.java
index 03134f60b04..23fe3f3f190 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIThreadExitEvent.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIThreadExitEvent.java
@@ -18,7 +18,6 @@ package org.eclipse.cdt.dsf.mi.service.command.events;
import org.eclipse.cdt.dsf.concurrent.Immutable;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
-
/**
* This can not be detected yet by gdb/mi.
*
@@ -26,45 +25,44 @@ import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
@Immutable
public class MIThreadExitEvent extends MIEvent<IContainerDMContext> {
- final private String fThreadId;
+ final private String fThreadId;
+
+ public MIThreadExitEvent(IContainerDMContext ctx, int id) {
+ this(ctx, 0, id);
+ }
+
+ public MIThreadExitEvent(IContainerDMContext ctx, int token, int id) {
+ super(ctx, token, null);
+ fThreadId = Integer.toString(id);
+ }
+
+ /**
+ * @since 1.1
+ */
+ public MIThreadExitEvent(IContainerDMContext ctx, String threadId) {
+ this(ctx, 0, threadId);
+ }
- public MIThreadExitEvent(IContainerDMContext ctx, int id) {
- this(ctx, 0, id);
- }
-
- public MIThreadExitEvent(IContainerDMContext ctx, int token, int id) {
- super(ctx, token, null);
- fThreadId = Integer.toString(id);
- }
+ /**
+ * @since 1.1
+ */
+ public MIThreadExitEvent(IContainerDMContext ctx, int token, String threadId) {
+ super(ctx, token, null);
+ fThreadId = threadId;
+ }
- /**
- * @since 1.1
- */
- public MIThreadExitEvent(IContainerDMContext ctx, String threadId) {
- this(ctx, 0, threadId);
- }
-
- /**
- * @since 1.1
- */
- public MIThreadExitEvent(IContainerDMContext ctx, int token, String threadId) {
- super(ctx, token, null);
- fThreadId = threadId;
- }
+ public int getId() {
+ try {
+ return Integer.parseInt(fThreadId);
+ } catch (NumberFormatException e) {
+ return 0;
+ }
+ }
- public int getId() {
- try {
- return Integer.parseInt(fThreadId);
- }
- catch (NumberFormatException e) {
- return 0;
- }
- }
-
- /**
- * @since 1.1
- */
- public String getStrId() {
- return fThreadId;
- }
+ /**
+ * @since 1.1
+ */
+ public String getStrId() {
+ return fThreadId;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIThreadGroupAddedEvent.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIThreadGroupAddedEvent.java
index 3a697348c23..d81a4a88673 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIThreadGroupAddedEvent.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIThreadGroupAddedEvent.java
@@ -22,12 +22,14 @@ import org.eclipse.cdt.dsf.debug.service.IProcesses.IProcessDMContext;
@Immutable
public class MIThreadGroupAddedEvent extends MIEvent<IProcessDMContext> {
- final private String fGroupId;
+ final private String fGroupId;
- public MIThreadGroupAddedEvent(IProcessDMContext ctx, int token, String groupId) {
- super(ctx, token, null);
- fGroupId = groupId;
- }
-
- public String getGroupId() { return fGroupId; }
+ public MIThreadGroupAddedEvent(IProcessDMContext ctx, int token, String groupId) {
+ super(ctx, token, null);
+ fGroupId = groupId;
+ }
+
+ public String getGroupId() {
+ return fGroupId;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIThreadGroupCreatedEvent.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIThreadGroupCreatedEvent.java
index a60498d0635..9b6003bc57c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIThreadGroupCreatedEvent.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIThreadGroupCreatedEvent.java
@@ -17,7 +17,6 @@ package org.eclipse.cdt.dsf.mi.service.command.events;
import org.eclipse.cdt.dsf.concurrent.Immutable;
import org.eclipse.cdt.dsf.debug.service.IProcesses.IProcessDMContext;
-
/**
* This can only be detected by gdb/mi after GDB 6.8.
* @since 1.1
@@ -26,13 +25,15 @@ import org.eclipse.cdt.dsf.debug.service.IProcesses.IProcessDMContext;
@Immutable
public class MIThreadGroupCreatedEvent extends MIEvent<IProcessDMContext> {
- final private String fGroupId;
+ final private String fGroupId;
+
+ public MIThreadGroupCreatedEvent(IProcessDMContext ctx, int token, String groupId) {
+ super(ctx, token, null);
+ fGroupId = groupId;
+ }
- public MIThreadGroupCreatedEvent(IProcessDMContext ctx, int token, String groupId) {
- super(ctx, token, null);
- fGroupId = groupId;
- }
-
- public String getGroupId() { return fGroupId; }
+ public String getGroupId() {
+ return fGroupId;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIThreadGroupExitedEvent.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIThreadGroupExitedEvent.java
index d490d6406b5..95ebb4d36ad 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIThreadGroupExitedEvent.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIThreadGroupExitedEvent.java
@@ -21,7 +21,6 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIConst;
import org.eclipse.cdt.dsf.mi.service.command.output.MIResult;
import org.eclipse.cdt.dsf.mi.service.command.output.MIValue;
-
/**
* This can only be detected by gdb/mi starting with GDB 7.0.
* @since 1.1
@@ -29,30 +28,35 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIValue;
@Immutable
public class MIThreadGroupExitedEvent extends MIEvent<IProcessDMContext> {
- private String fGroupId;
- private String fExitCode;
+ private String fGroupId;
+ private String fExitCode;
+
+ /** @since 4.2 */
+ public MIThreadGroupExitedEvent(IProcessDMContext ctx, int token, MIResult[] results) {
+ super(ctx, token, results);
+ parse();
+ }
- /** @since 4.2 */
- public MIThreadGroupExitedEvent(IProcessDMContext ctx, int token, MIResult[] results) {
- super(ctx, token, results);
- parse();
- }
-
- public String getGroupId() { return fGroupId; }
+ public String getGroupId() {
+ return fGroupId;
+ }
- /**
- * Returns the exit code of the process or null if there is no exit code.
- * Note that this information is only available with GDB 7.3;
- * null will be returned for older GDB versions.
- *
- * @since 4.2
- */
- public String getExitCode() { return fExitCode; }
-
- private void parse() {
+ /**
+ * Returns the exit code of the process or null if there is no exit code.
+ * Note that this information is only available with GDB 7.3;
+ * null will be returned for older GDB versions.
+ *
+ * @since 4.2
+ */
+ public String getExitCode() {
+ return fExitCode;
+ }
+
+ private void parse() {
MIResult[] results = getResults();
- if (results == null) return;
-
+ if (results == null)
+ return;
+
for (int i = 0; i < results.length; i++) {
String var = results[i].getVariable();
MIValue val = results[i].getMIValue();
@@ -68,5 +72,5 @@ public class MIThreadGroupExitedEvent extends MIEvent<IProcessDMContext> {
}
}
}
- }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIWatchpointScopeEvent.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIWatchpointScopeEvent.java
index 15c664eb971..de487d7af4f 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIWatchpointScopeEvent.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIWatchpointScopeEvent.java
@@ -29,43 +29,41 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIValue;
@Immutable
public class MIWatchpointScopeEvent extends MIStoppedEvent {
- final private String number;
+ final private String number;
- /** @since 5.0 */
- protected MIWatchpointScopeEvent(
- IExecutionDMContext ctx, int token, MIResult[] results, MIFrame frame, String number)
- {
- super(ctx, token, results, frame);
- this.number = number;
- }
+ /** @since 5.0 */
+ protected MIWatchpointScopeEvent(IExecutionDMContext ctx, int token, MIResult[] results, MIFrame frame,
+ String number) {
+ super(ctx, token, results, frame);
+ this.number = number;
+ }
- /** @since 5.0 */
- public String getNumber() {
- return number;
- }
+ /** @since 5.0 */
+ public String getNumber() {
+ return number;
+ }
- /**
- * @since 1.1
- */
- public static MIWatchpointScopeEvent parse(IExecutionDMContext dmc, int token, MIResult[] results)
- {
- String number = ""; //$NON-NLS-1$
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- MIValue value = results[i].getMIValue();
+ /**
+ * @since 1.1
+ */
+ public static MIWatchpointScopeEvent parse(IExecutionDMContext dmc, int token, MIResult[] results) {
+ String number = ""; //$NON-NLS-1$
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ MIValue value = results[i].getMIValue();
- if (var.equals("wpnum")) { //$NON-NLS-1$
- if (value instanceof MIConst) {
- String str = ((MIConst) value).getString();
- try {
- number = str.trim();
- } catch (NumberFormatException e) {
- }
- }
- }
- }
+ if (var.equals("wpnum")) { //$NON-NLS-1$
+ if (value instanceof MIConst) {
+ String str = ((MIConst) value).getString();
+ try {
+ number = str.trim();
+ } catch (NumberFormatException e) {
+ }
+ }
+ }
+ }
- MIStoppedEvent stoppedEvent = MIStoppedEvent.parse(dmc, token, results);
- return new MIWatchpointScopeEvent(stoppedEvent.getDMContext(), token, results, stoppedEvent.getFrame(), number);
- }
+ MIStoppedEvent stoppedEvent = MIStoppedEvent.parse(dmc, token, results);
+ return new MIWatchpointScopeEvent(stoppedEvent.getDMContext(), token, results, stoppedEvent.getFrame(), number);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIWatchpointTriggerEvent.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIWatchpointTriggerEvent.java
index 4f2a993a33b..76f27b8dffb 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIWatchpointTriggerEvent.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIWatchpointTriggerEvent.java
@@ -30,102 +30,100 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIValue;
@Immutable
public class MIWatchpointTriggerEvent extends MIStoppedEvent {
- final private String number;
- final private String exp;
- final private String oldValue;
- final private String newValue;
+ final private String number;
+ final private String exp;
+ final private String oldValue;
+ final private String newValue;
- /**
+ /**
* @since 5.0
*/
- protected MIWatchpointTriggerEvent(
- IExecutionDMContext ctx, int token, MIResult[] results, MIFrame frame,
- String number, String exp, String oldValue, String newValue)
- {
- super(ctx, token, results, frame);
- this.number = number;
- this.exp = exp;
- this.oldValue = oldValue;
- this.newValue = newValue;
- }
+ protected MIWatchpointTriggerEvent(IExecutionDMContext ctx, int token, MIResult[] results, MIFrame frame,
+ String number, String exp, String oldValue, String newValue) {
+ super(ctx, token, results, frame);
+ this.number = number;
+ this.exp = exp;
+ this.oldValue = oldValue;
+ this.newValue = newValue;
+ }
- /**
+ /**
* @since 5.0
*/
- public String getNumber() {
- return number;
- }
+ public String getNumber() {
+ return number;
+ }
- public String getExpression() {
- return exp;
- }
+ public String getExpression() {
+ return exp;
+ }
- public String getOldValue() {
- return oldValue;
- }
+ public String getOldValue() {
+ return oldValue;
+ }
- public String getNewValue() {
- return newValue;
- }
+ public String getNewValue() {
+ return newValue;
+ }
- /**
- * @since 1.1
- */
- public static MIWatchpointTriggerEvent parse(IExecutionDMContext dmc, int token, MIResult[] results)
- {
- String number = ""; //$NON-NLS-1$
- String exp = ""; //$NON-NLS-1$
- String oldValue = ""; //$NON-NLS-1$
- String newValue = ""; //$NON-NLS-1$
+ /**
+ * @since 1.1
+ */
+ public static MIWatchpointTriggerEvent parse(IExecutionDMContext dmc, int token, MIResult[] results) {
+ String number = ""; //$NON-NLS-1$
+ String exp = ""; //$NON-NLS-1$
+ String oldValue = ""; //$NON-NLS-1$
+ String newValue = ""; //$NON-NLS-1$
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- MIValue value = results[i].getMIValue();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ MIValue value = results[i].getMIValue();
- if (var.equals("wpt") || var.equals("hw-awpt") || var.equals("hw-rwpt")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- if (value instanceof MITuple) {
- for (MIResult wptResult : ((MITuple) value).getMIResults()) {
- String wptVar = wptResult.getVariable();
- MIValue wptValue = wptResult.getMIValue();
+ if (var.equals("wpt") || var.equals("hw-awpt") || var.equals("hw-rwpt")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ if (value instanceof MITuple) {
+ for (MIResult wptResult : ((MITuple) value).getMIResults()) {
+ String wptVar = wptResult.getVariable();
+ MIValue wptValue = wptResult.getMIValue();
- if (wptVar.equals("number")) { //$NON-NLS-1$
- if (wptValue instanceof MIConst) {
- String str = ((MIConst) wptValue).getString();
- try {
- number = str;
- } catch (NumberFormatException e) {
- }
- }
- } else if (wptVar.equals("exp")) { //$NON-NLS-1$
- if (wptValue instanceof MIConst) {
- exp = ((MIConst) wptValue).getString();
- }
- }
- }
- }
- } else if (var.equals("value")) { //$NON-NLS-1$
- if (value instanceof MITuple) {
- for (MIResult valueResult : ((MITuple)value).getMIResults()) {
- String valueVar = valueResult.getVariable();
- MIValue valueValue = valueResult.getMIValue();
- String str = ""; //$NON-NLS-1$
- if (valueValue instanceof MIConst) {
- str = ((MIConst) valueValue).getString();
- }
+ if (wptVar.equals("number")) { //$NON-NLS-1$
+ if (wptValue instanceof MIConst) {
+ String str = ((MIConst) wptValue).getString();
+ try {
+ number = str;
+ } catch (NumberFormatException e) {
+ }
+ }
+ } else if (wptVar.equals("exp")) { //$NON-NLS-1$
+ if (wptValue instanceof MIConst) {
+ exp = ((MIConst) wptValue).getString();
+ }
+ }
+ }
+ }
+ } else if (var.equals("value")) { //$NON-NLS-1$
+ if (value instanceof MITuple) {
+ for (MIResult valueResult : ((MITuple) value).getMIResults()) {
+ String valueVar = valueResult.getVariable();
+ MIValue valueValue = valueResult.getMIValue();
+ String str = ""; //$NON-NLS-1$
+ if (valueValue instanceof MIConst) {
+ str = ((MIConst) valueValue).getString();
+ }
- if (valueVar.equals("old")) { //$NON-NLS-1$
- oldValue = str;
- } else if (valueVar.equals("new")) { //$NON-NLS-1$
- newValue = str;
- } else if (valueVar.equals("value")) { //$NON-NLS-1$
- oldValue = newValue = str;
- }
- }
+ if (valueVar.equals("old")) { //$NON-NLS-1$
+ oldValue = str;
+ } else if (valueVar.equals("new")) { //$NON-NLS-1$
+ newValue = str;
+ } else if (valueVar.equals("value")) { //$NON-NLS-1$
+ oldValue = newValue = str;
+ }
+ }
- }
- }
- }
- MIStoppedEvent stoppedEvent = MIStoppedEvent.parse(dmc, token, results);
- return new MIWatchpointTriggerEvent(stoppedEvent.getDMContext(), token, results, stoppedEvent.getFrame(), number, exp, oldValue, newValue);
- }
+ }
+ }
+ }
+ MIStoppedEvent stoppedEvent = MIStoppedEvent.parse(dmc, token, results);
+ return new MIWatchpointTriggerEvent(stoppedEvent.getDMContext(), token, results, stoppedEvent.getFrame(),
+ number, exp, oldValue, newValue);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIAddressableSizeInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIAddressableSizeInfo.java
index d95b4e0fac2..2c3e92fac71 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIAddressableSizeInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIAddressableSizeInfo.java
@@ -16,18 +16,18 @@ package org.eclipse.cdt.dsf.mi.service.command.output;
/**
* This class takes care of parsing and providing the result of the CLI command
- * <br>"p/x (char)-1"
- *
+ * <br>"p/x (char)-1"
+ *
* <p>E.g. if the response to 'p/x (char)-1' is</p>
* $n = 0xffff
- *
+ *
* <p>Then we can easily resolve it to 2 octets (e.g. 2 hex characters per octet)</p>
* @since 4.4
*/
public class CLIAddressableSizeInfo extends MIInfo {
-
+
private int fAddressableSize = 1;
-
+
public CLIAddressableSizeInfo(MIOutput record) {
super(record);
parse();
@@ -38,7 +38,7 @@ public class CLIAddressableSizeInfo extends MIInfo {
MIOutput out = getMIOutput();
for (MIOOBRecord oob : out.getMIOOBRecords()) {
if (oob instanceof MIConsoleStreamOutput) {
- String line = ((MIConsoleStreamOutput)oob).getString().trim();
+ String line = ((MIConsoleStreamOutput) oob).getString().trim();
fAddressableSize = hexToOctetCount(line);
}
}
@@ -48,16 +48,16 @@ public class CLIAddressableSizeInfo extends MIInfo {
public int getAddressableSize() {
return fAddressableSize;
}
-
- private int hexToOctetCount(String hexString) {
+
+ private int hexToOctetCount(String hexString) {
//Receiving format is expected in hex form e.g. "$n = 0xffff" or "$n = 0xff"
//which shall result in 2 and 1 octets respectively
int starts = hexString.indexOf("x"); //$NON-NLS-1$
- assert(starts > 0);
- String hexDigits = hexString.substring(starts+1);
+ assert (starts > 0);
+ String hexDigits = hexString.substring(starts + 1);
assert hexDigits.length() > 1;
- int octets = hexDigits.length()/2;
-
+ int octets = hexDigits.length() / 2;
+
return octets;
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLICatchInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLICatchInfo.java
index cc4d0853370..821511ee378 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLICatchInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLICatchInfo.java
@@ -16,7 +16,7 @@ package org.eclipse.cdt.dsf.mi.service.command.output;
/**
* Processes the result of a gdb 'catch' command. Even though the command has
* been around since gdb 6.6, it's still not supported in gdb 7.0 MI.
- *
+ *
* @since 3.0
*/
public class CLICatchInfo extends MIInfo {
@@ -41,7 +41,7 @@ public class CLICatchInfo extends MIInfo {
for (MIOOBRecord oob : out.getMIOOBRecords()) {
if (oob instanceof MIConsoleStreamOutput) {
// We are interested in the catchpoint info
- fMiBreakpoint = parseCatchpoint(((MIConsoleStreamOutput)oob).getString().trim());
+ fMiBreakpoint = parseCatchpoint(((MIConsoleStreamOutput) oob).getString().trim());
if (fMiBreakpoint != null) {
return;
}
@@ -56,7 +56,7 @@ public class CLICatchInfo extends MIInfo {
/**
* Create a target specific MIBreakpoint
- *
+ *
* @param value
* tuple suitable for passing to MIBreakpoint constructor
* @return new breakpoint
@@ -68,7 +68,7 @@ public class CLICatchInfo extends MIInfo {
/**
* Return an MIBreakpoint object for the catchpoint that was created.
- *
+ *
* @return an MIBreakpoint object or null if the command result had
* unexpected data
*/
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIInfoBreakInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIInfoBreakInfo.java
index 25e53de9960..5ee62d2db72 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIInfoBreakInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIInfoBreakInfo.java
@@ -23,18 +23,18 @@ import java.util.Set;
* 'info break [BP_REFERENCE] will return information about
* the specified breakpoint. We use it to find out to which
* inferiors a breakpoint is applicable.
- *
- * sample output:
+ *
+ * sample output:
*
* (gdb) info break
* Num Type Disp Enb Address What
- * 1 breakpoint keep y <MULTIPLE>
+ * 1 breakpoint keep y <MULTIPLE>
* 1.1 y 0x08048533 in main() at loopfirst.cc:8 inf 2
* 1.2 y 0x08048533 in main() at loopfirst.cc:8 inf 1
- * 2 breakpoint keep y <MULTIPLE>
+ * 2 breakpoint keep y <MULTIPLE>
* 2.1 y 0x08048553 in main() at loopfirst.cc:9 inf 2
* 2.2 y 0x08048553 in main() at loopfirst.cc:9 inf 1
- *
+ *
* If only one inferior is being debugged there is not mention of the inferior:
* (gdb) info break
* Num Type Disp Enb Address What
@@ -45,46 +45,46 @@ import java.util.Set;
* I haven't figured out a way to trigger it. Still, we should be prepared for it:
* (gdb) info break
* Num Type Disp Enb Address What
- * 1 breakpoint keep y <MULTIPLE>
+ * 1 breakpoint keep y <MULTIPLE>
* 1.1 y 0x08048533 in main() at loopfirst.cc:8 inf 3, 2
* 1.2 y 0x08048533 in main() at loopfirst.cc:8 inf 2, 1
- * 2 breakpoint keep y <MULTIPLE>
+ * 2 breakpoint keep y <MULTIPLE>
* 2.1 y 0x08048553 in main() at loopfirst.cc:9 inf 2, 1
* 2.2 y 0x08048553 in main() at loopfirst.cc:9 inf 3, 2, 1
- *
+ *
* @since 4.2
*/
public class CLIInfoBreakInfo extends MIInfo {
private Map<String, String[]> fBreakpointToGroupMap = new HashMap<String, String[]>();
- public CLIInfoBreakInfo(MIOutput out) {
+ public CLIInfoBreakInfo(MIOutput out) {
super(out);
parse();
}
-
+
/**
* Returns the map of breakpoint to groupId array indicating to which thread-group
* each breakpoint applies. If there is only a single thread-group being debugged, an
* empty map will be returned.
*/
public Map<String, String[]> getBreakpointToGroupMap() {
- return fBreakpointToGroupMap;
+ return fBreakpointToGroupMap;
}
-
+
protected void parse() {
final String INFERIOR_PREFIX = " inf "; //$NON-NLS-1$
if (isDone()) {
MIOutput out = getMIOutput();
for (MIOOBRecord oob : out.getMIOOBRecords()) {
if (oob instanceof MIConsoleStreamOutput) {
- String line = ((MIConsoleStreamOutput)oob).getString().trim();
+ String line = ((MIConsoleStreamOutput) oob).getString().trim();
int loc = line.indexOf(INFERIOR_PREFIX);
if (loc >= 0) {
// Get the breakpoint id by extracting the first element before a white space
// or before a period. We can set a limit of 2 since we only need the first element
String bpIdStr = line.split("[\\s\\.]", 2)[0]; //$NON-NLS-1$
-
+
String[] groups = fBreakpointToGroupMap.get(bpIdStr);
Set<String> groupIdList = new HashSet<String>();
if (groups != null) {
@@ -92,15 +92,15 @@ public class CLIInfoBreakInfo extends MIInfo {
// we have been building
groupIdList.addAll(Arrays.asList(groups));
}
-
+
// Get the comma-separated list of inferiors
// Split the list into individual ids
String inferiorIdStr = line.substring(loc + INFERIOR_PREFIX.length()).trim();
for (String id : inferiorIdStr.split(",")) { //$NON-NLS-1$
// Add the 'i' prefix as GDB does for MI commands
- groupIdList.add("i" + id.trim()); //$NON-NLS-1$
+ groupIdList.add("i" + id.trim()); //$NON-NLS-1$
}
-
+
fBreakpointToGroupMap.put(bpIdStr, groupIdList.toArray(new String[groupIdList.size()]));
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIInfoProgramInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIInfoProgramInfo.java
index 1f235992ed3..1395b45b39e 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIInfoProgramInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIInfoProgramInfo.java
@@ -32,7 +32,7 @@ public class CLIInfoProgramInfo extends MIInfo {
* find it there.
*/
public Long getPID() {
- return fPid;
+ return fPid;
}
void parse() {
@@ -41,8 +41,8 @@ public class CLIInfoProgramInfo extends MIInfo {
MIOOBRecord[] oobs = out.getMIOOBRecords();
for (MIOOBRecord oob : oobs) {
if (oob instanceof MIConsoleStreamOutput) {
- parseLine(((MIConsoleStreamOutput)oob).getString());
-
+ parseLine(((MIConsoleStreamOutput) oob).getString());
+
// quit parsing output once we have everything we want out
// of it
if (fPid != null) {
@@ -67,7 +67,8 @@ public class CLIInfoProgramInfo extends MIInfo {
while (st.hasMoreTokens()) {
String s = st.nextToken();
/* Not a process id if LWP is reported */
- if (s.equals("LWP")) break; //$NON-NLS-1$
+ if (s.equals("LWP")) //$NON-NLS-1$
+ break;
if (Character.isDigit(s.charAt(0))) {
try {
@@ -81,4 +82,3 @@ public class CLIInfoProgramInfo extends MIInfo {
}
}
}
-
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIInfoRecordInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIInfoRecordInfo.java
index 5d78ed6798a..3ea111f8055 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIInfoRecordInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIInfoRecordInfo.java
@@ -17,22 +17,22 @@ import org.eclipse.cdt.debug.core.model.IChangeReverseMethodHandler.ReverseDebug
/**
* 'info record' returns the selected reverse trace method.
- *
- * sample output:
+ *
+ * sample output:
*
* (gdb) info record
* ~ Active record target: record-btrace
* ~ Recording format: Branch Trace Store.
* ~ Buffer size: 64kB.
* ~ Recorded 0 instructions in 0 functions (0 gaps) for thread 1 (process 24645).
- *
+ *
* @since 5.0
*/
public class CLIInfoRecordInfo extends MIInfo {
private ReverseDebugMethod fReverseMethod;
-
+
public CLIInfoRecordInfo(MIOutput record) {
super(record);
parse();
@@ -44,10 +44,10 @@ public class CLIInfoRecordInfo extends MIInfo {
MIOOBRecord[] records = out.getMIOOBRecords();
StringBuilder builder = new StringBuilder();
for (MIOOBRecord rec : records) {
- if (rec instanceof MIConsoleStreamOutput) {
- MIStreamRecord o = (MIStreamRecord)rec;
- builder.append(o.getString());
- }
+ if (rec instanceof MIConsoleStreamOutput) {
+ MIStreamRecord o = (MIStreamRecord) rec;
+ builder.append(o.getString());
+ }
}
parseReverseMethod(builder.toString());
}
@@ -57,12 +57,12 @@ public class CLIInfoRecordInfo extends MIInfo {
if (output.contains("Processor")) { //$NON-NLS-1$
fReverseMethod = ReverseDebugMethod.PROCESSOR_TRACE;
} else if (output.contains("Branch")) { //$NON-NLS-1$
- fReverseMethod = ReverseDebugMethod.BRANCH_TRACE;
- } else if (output.contains("full")) { //$NON-NLS-1$
- fReverseMethod = ReverseDebugMethod.SOFTWARE;
- } else {
- fReverseMethod = ReverseDebugMethod.OFF;
- }
+ fReverseMethod = ReverseDebugMethod.BRANCH_TRACE;
+ } else if (output.contains("full")) { //$NON-NLS-1$
+ fReverseMethod = ReverseDebugMethod.SOFTWARE;
+ } else {
+ fReverseMethod = ReverseDebugMethod.OFF;
+ }
}
public ReverseDebugMethod getReverseMethod() {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIInfoSharedLibraryInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIInfoSharedLibraryInfo.java
index 7603e9bdbce..dbdfd5abcd0 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIInfoSharedLibraryInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIInfoSharedLibraryInfo.java
@@ -20,7 +20,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
- *
+ *
*/
public class CLIInfoSharedLibraryInfo extends MIInfo {
@@ -33,7 +33,7 @@ public class CLIInfoSharedLibraryInfo extends MIInfo {
boolean isread;
String name;
- public DsfMISharedInfo (String start, String end, boolean read, String location) {
+ public DsfMISharedInfo(String start, String end, boolean read, String location) {
from = start;
to = end;
isread = read;
@@ -59,7 +59,7 @@ public class CLIInfoSharedLibraryInfo extends MIInfo {
public void setSymbolsRead(boolean read) {
isread = read;
}
- }
+ }
public CLIInfoSharedLibraryInfo(MIOutput out) {
super(out);
@@ -93,15 +93,15 @@ public class CLIInfoSharedLibraryInfo extends MIInfo {
void parseShared(String str, List<DsfMISharedInfo> aList) {
if (!str.isEmpty()) {
// Parsing pattern of type ~"0x40000970 0x4001331f Yes /lib/ld-linux.so.2\n"
- Pattern pattern = Pattern.compile("(0x.*)(0x.*)(Yes|No)(\\s*)(.*)", Pattern.MULTILINE); //$NON-NLS-1$
- Matcher matcher = pattern.matcher(str);
- if (matcher.find()) {
+ Pattern pattern = Pattern.compile("(0x.*)(0x.*)(Yes|No)(\\s*)(.*)", Pattern.MULTILINE); //$NON-NLS-1$
+ Matcher matcher = pattern.matcher(str);
+ if (matcher.find()) {
DsfMISharedInfo s = new DsfMISharedInfo(matcher.group(1), matcher.group(2),
- (matcher.group(3).equals("Yes"))?true:false, //$NON-NLS-1$
- matcher.group(5));
+ (matcher.group(3).equals("Yes")) ? true : false, //$NON-NLS-1$
+ matcher.group(5));
aList.add(s);
- }
+ }
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIInfoThreadsInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIInfoThreadsInfo.java
index 20f2ba8588e..543ad3ca2b9 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIInfoThreadsInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIInfoThreadsInfo.java
@@ -15,13 +15,11 @@
package org.eclipse.cdt.dsf.mi.service.command.output;
-
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
/**
* GDB/MI thread list parsing.
~"\n"
@@ -38,16 +36,17 @@ public class CLIInfoThreadsInfo extends MIInfo {
* <code>
* &lt;x&gt; Thread &lt;y&gt; (LWP &lt;z&gt;)
* </code>
- *
+ *
* <p>
* Where 'y' is a hex number with a '0x' prefix.
- *
+ *
* <p>
* Note that the output likely includes non-LWP threads, but they are
* intentionally ignored
*/
- private static final Pattern RESULT_PATTERN_LWP = Pattern.compile(
- "(^\\*?\\s*\\d+)(\\s*[Tt][Hh][Rr][Ee][Aa][Dd]\\s*)(0x[0-9a-fA-F]+|-?\\d+)(\\s*\\([Ll][Ww][Pp]\\s*)(\\d*)", Pattern.MULTILINE); //$NON-NLS-1$
+ private static final Pattern RESULT_PATTERN_LWP = Pattern.compile(
+ "(^\\*?\\s*\\d+)(\\s*[Tt][Hh][Rr][Ee][Aa][Dd]\\s*)(0x[0-9a-fA-F]+|-?\\d+)(\\s*\\([Ll][Ww][Pp]\\s*)(\\d*)", //$NON-NLS-1$
+ Pattern.MULTILINE);
/**
* Matcher for 'info threads' output typically returned by gdbservers running
@@ -56,13 +55,13 @@ public class CLIInfoThreadsInfo extends MIInfo {
* <code>
* &lt;x&gt; Thread &lt;y&gt; (&lt;text&gt;)
* </code>
- *
- * <p>where 'y' is not necessarily numeric and (&lt;text&gt;) is optional
+ *
+ * <p>where 'y' is not necessarily numeric and (&lt;text&gt;) is optional
*/
- private static final Pattern RESULT_PATTERN = Pattern.compile(
- "(^\\*?\\s*\\d+)(\\s*[Tt][Hh][Rr][Ee][Aa][Dd]\\s*)(\\S+(\\s*\\(.*?\\))?)", Pattern.MULTILINE); //$NON-NLS-1$
-
- protected List<ThreadInfo> info;
+ private static final Pattern RESULT_PATTERN = Pattern
+ .compile("(^\\*?\\s*\\d+)(\\s*[Tt][Hh][Rr][Ee][Aa][Dd]\\s*)(\\S+(\\s*\\(.*?\\))?)", Pattern.MULTILINE); //$NON-NLS-1$
+
+ protected List<ThreadInfo> info;
public CLIInfoThreadsInfo(MIOutput out) {
super(out);
@@ -74,24 +73,34 @@ public class CLIInfoThreadsInfo extends MIInfo {
String fGdbId;
String fPid;
boolean fIsCurrentThread = false;
-
- public ThreadInfo(String tid, String pid, String name, boolean isCurrentThread)
- {
+
+ public ThreadInfo(String tid, String pid, String name, boolean isCurrentThread) {
this.fName = name;
this.fGdbId = tid;
this.fPid = pid;
this.fIsCurrentThread = isCurrentThread;
}
-
- public String getName(){ return fName ;}
+
+ public String getName() {
+ return fName;
+ }
+
// GDB id given to a thread. Needed to compare with ID stored in DMC fetched via DsfMIThreadListIds command
- public String getId(){ return fGdbId; }
- public String getOsId(){return fPid; }
- public boolean isCurrentThread(){return fIsCurrentThread; }
+ public String getId() {
+ return fGdbId;
+ }
+
+ public String getOsId() {
+ return fPid;
+ }
+
+ public boolean isCurrentThread() {
+ return fIsCurrentThread;
+ }
}
-
- public List<ThreadInfo> getThreadInfo(){
- return info;
+
+ public List<ThreadInfo> getThreadInfo() {
+ return info;
}
protected void parse() {
@@ -111,7 +120,7 @@ public class CLIInfoThreadsInfo extends MIInfo {
}
protected void parseThreadInfo(String str, List<ThreadInfo> info) {
- // Fetch the OS ThreadId & Find the current thread
+ // Fetch the OS ThreadId & Find the current thread
// Here is an example output from GDB which shows normal threads as well as
// LWP process threads. We ignore non-LWP threads.
//
@@ -126,7 +135,7 @@ public class CLIInfoThreadsInfo extends MIInfo {
//
// However, 'info threads' output varies, and depends on the gdbserver
//
- // [example B, observed with FreeBSD]
+ // [example B, observed with FreeBSD]
// (gdb) info threads
// 6 Thread 1286 (tid 38473, running) 0x00000000 in ?? ()
// 5 Thread 1029 (tid 34369, running) 0x00000000 in ?? ()
@@ -138,14 +147,14 @@ public class CLIInfoThreadsInfo extends MIInfo {
// from /cygdrive/c/WINDOWS/system32/ntdll.dll
// * 1 thread 5264.0x16f8 main (argc=1, argv=0x661f00) at MultiThread.cc:16
//
- // Note that windows gdbs returns lower case "thread" , so the matcher
- // needs to be case-insensitive.
+ // Note that windows gdbs returns lower case "thread" , so the matcher
+ // needs to be case-insensitive.
//
- // The original code favored the format in example A and so we will
- // continue to give it precedence. The newly added support for formats
+ // The original code favored the format in example A and so we will
+ // continue to give it precedence. The newly added support for formats
// B and C will have lower precedence.
- if(!str.isEmpty() ){
- Matcher matcher = RESULT_PATTERN_LWP.matcher(str); // example A
+ if (!str.isEmpty()) {
+ Matcher matcher = RESULT_PATTERN_LWP.matcher(str); // example A
boolean isCurrentThread = false;
if (matcher.find()) {
String id = matcher.group(1).trim();
@@ -154,9 +163,8 @@ public class CLIInfoThreadsInfo extends MIInfo {
id = id.substring(1).trim();
}
info.add(new ThreadInfo(id, matcher.group(5), "", isCurrentThread)); //$NON-NLS-1$
- }
- else {
- matcher = RESULT_PATTERN.matcher(str); // examples B and C
+ } else {
+ matcher = RESULT_PATTERN.matcher(str); // examples B and C
if (matcher.find()) {
String id = matcher.group(1).trim();
if (id.charAt(0) == '*') {
@@ -169,4 +177,3 @@ public class CLIInfoThreadsInfo extends MIInfo {
}
}
}
-
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIShowEndianInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIShowEndianInfo.java
index c3fa608c75f..fced26b3432 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIShowEndianInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIShowEndianInfo.java
@@ -16,20 +16,20 @@ package org.eclipse.cdt.dsf.mi.service.command.output;
/**
* 'show endian' returns the endianness of the current target.
- *
- * sample output:
+ *
+ * sample output:
*
* (gdb) show endian
* The target endianness is set automatically (currently little endian)
- *
+ *
* @since 4.2
*/
public class CLIShowEndianInfo extends MIInfo {
final private static String BIG_ENDIAN = "big endian"; //$NON-NLS-1$
-
+
private boolean fIsBigEndian = false;
-
+
public CLIShowEndianInfo(MIOutput record) {
super(record);
parse();
@@ -40,8 +40,8 @@ public class CLIShowEndianInfo extends MIInfo {
MIOutput out = getMIOutput();
for (MIOOBRecord oob : out.getMIOOBRecords()) {
if (oob instanceof MIConsoleStreamOutput) {
- String line = ((MIConsoleStreamOutput)oob).getString().trim();
- if (line.indexOf(BIG_ENDIAN) >= 0 ) {
+ String line = ((MIConsoleStreamOutput) oob).getString().trim();
+ if (line.indexOf(BIG_ENDIAN) >= 0) {
fIsBigEndian = true;
break;
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIThreadInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIThreadInfo.java
index 23579dba8c4..43aa4778663 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIThreadInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIThreadInfo.java
@@ -14,30 +14,28 @@
package org.eclipse.cdt.dsf.mi.service.command.output;
-
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
/**
* [Current thread is 1 (Thread 0xb7cc56b0 (LWP 5488))]
- *
+ *
* @since 3.0
*/
public class CLIThreadInfo extends MIInfo {
private String fCurrentThread;
-
+
public CLIThreadInfo(MIOutput out) {
super(out);
parse();
}
/**
- * @since 5.0
- */
- public String getCurrentThread(){
- return fCurrentThread;
+ * @since 5.0
+ */
+ public String getCurrentThread() {
+ return fCurrentThread;
}
protected void parse() {
@@ -56,14 +54,14 @@ public class CLIThreadInfo extends MIInfo {
}
protected void parseThreadInfo(String str) {
- // Fetch the OS ThreadId & Find the current thread
- if(!str.isEmpty() ){
- Pattern pattern = Pattern.compile("Current thread is (\\d+)", Pattern.MULTILINE); //$NON-NLS-1$
- Matcher matcher = pattern.matcher(str);
- if (matcher.find()) {
- String id = matcher.group(1).trim();
- fCurrentThread = id;
- }
+ // Fetch the OS ThreadId & Find the current thread
+ if (!str.isEmpty()) {
+ Pattern pattern = Pattern.compile("Current thread is (\\d+)", Pattern.MULTILINE); //$NON-NLS-1$
+ Matcher matcher = pattern.matcher(str);
+ if (matcher.find()) {
+ String id = matcher.group(1).trim();
+ fCurrentThread = id;
}
+ }
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLITraceDumpInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLITraceDumpInfo.java
index a1d3fe36dac..20459d87e25 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLITraceDumpInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLITraceDumpInfo.java
@@ -16,7 +16,6 @@ package org.eclipse.cdt.dsf.mi.service.command.output;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
/**
* Parses the GDB "tdump" command printout, as returned by GDB, to make it a
* bit more human-friendly.
@@ -29,8 +28,8 @@ public class CLITraceDumpInfo extends MIInfo {
// Here is what this pattern looks-for - the first line of the tdump printout:
//~"Data collected at tracepoint 2, trace frame 555:\n"
- private static final Pattern RESULT_PATTERN_TPINFO = Pattern.compile(
- "Data collected at tracepoint (\\d+), trace frame (\\d+)", Pattern.CASE_INSENSITIVE); //$NON-NLS-1$
+ private static final Pattern RESULT_PATTERN_TPINFO = Pattern
+ .compile("Data collected at tracepoint (\\d+), trace frame (\\d+)", Pattern.CASE_INSENSITIVE); //$NON-NLS-1$
// raw output of command
private String fOutput = null;
@@ -51,10 +50,10 @@ public class CLITraceDumpInfo extends MIInfo {
super(out);
parse(KEEP_HEADER);
}
-
+
/**
* Alternative constructor. Use this one to have control if the tdump
- * header is kept or not in the result.
+ * header is kept or not in the result.
* @param out the output of the tdump printout
* @param keepHeader keep the tdump header in result or not
*/
@@ -63,29 +62,28 @@ public class CLITraceDumpInfo extends MIInfo {
parse(keepHeader);
}
-
/**
- * Do a quick parse of the tdump printout. The tdump command printout is
+ * Do a quick parse of the tdump printout. The tdump command printout is
* split in short pieces (records), each one wrapped like this:
* <p>
* ~"eax 0x10"
* <p>
- * Also, tabs and newlines are represented by symbols: \n and \t .
- * <p>
- * In this method, we strip the wrapping off each record and translate the
+ * Also, tabs and newlines are represented by symbols: \n and \t .
+ * <p>
+ * In this method, we strip the wrapping off each record and translate the
* symbols to their value. The resulting string is not parsed further.
* <p>
* See an example of a tdump printout at the end of this file.
*/
private void parse(boolean keepHeader) {
- final Pattern RESULT_PATTERN_UNWRAPRECORD = Pattern.compile("~\"(.*)\"", Pattern.CANON_EQ); //$NON-NLS-1$
+ final Pattern RESULT_PATTERN_UNWRAPRECORD = Pattern.compile("~\"(.*)\"", Pattern.CANON_EQ); //$NON-NLS-1$
StringBuilder buf = new StringBuilder();
String unwrapped;
if (isDone()) {
MIOutput out = getMIOutput();
// save raw output of command
fOutput = out.toString();
-
+
MIOOBRecord[] oobs = out.getMIOOBRecords();
for (MIOOBRecord oob : oobs) {
if (oob instanceof MIConsoleStreamOutput) {
@@ -100,25 +98,25 @@ public class CLITraceDumpInfo extends MIInfo {
// convert buffer into string
fParsedOutput = buf.toString();
// extract the tracepoint and frame numbers
- Matcher matcher = RESULT_PATTERN_TPINFO.matcher(fParsedOutput);
+ Matcher matcher = RESULT_PATTERN_TPINFO.matcher(fParsedOutput);
if (matcher.find()) {
fTracepointNum = matcher.group(1).trim();
fTraceFrameNumber = matcher.group(2).trim();
}
- // command result has the substrings "\n" and "\t" in it.
+ // command result has the substrings "\n" and "\t" in it.
// replace them by their actual meaning (real newline and tab)
- fParsedOutput = fParsedOutput.replaceAll("\\\\n", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
- fParsedOutput = fParsedOutput.replaceAll("\\\\t+", "\t"); //$NON-NLS-1$ //$NON-NLS-2$
+ fParsedOutput = fParsedOutput.replaceAll("\\\\n", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ fParsedOutput = fParsedOutput.replaceAll("\\\\t+", "\t"); //$NON-NLS-1$ //$NON-NLS-2$
- // Optionaly remove the header line from tdump printout
- if(!keepHeader) {
- fParsedOutput = fParsedOutput.replaceFirst("Data collected at tracepoint \\d+, trace frame \\d+:\\n", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ // Optionaly remove the header line from tdump printout
+ if (!keepHeader) {
+ fParsedOutput = fParsedOutput.replaceFirst("Data collected at tracepoint \\d+, trace frame \\d+:\\n", //$NON-NLS-1$
+ ""); //$NON-NLS-1$
}
}
}
-
/**
* @return the raw output of tdump.
*/
@@ -134,7 +132,7 @@ public class CLITraceDumpInfo extends MIInfo {
public String getContent() {
return fParsedOutput;
}
-
+
/**
* @return the tracepoint number
*/
@@ -142,7 +140,6 @@ public class CLITraceDumpInfo extends MIInfo {
return fTracepointNum;
}
-
/**
* @return the trace's frame number
*/
@@ -160,8 +157,7 @@ public class CLITraceDumpInfo extends MIInfo {
}
}
-
-/*
+/*
* Example of raw output from command tdump:
&"tdump\n"
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLITraceInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLITraceInfo.java
index 40615a4b661..88c6506811e 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLITraceInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLITraceInfo.java
@@ -16,12 +16,11 @@ package org.eclipse.cdt.dsf.mi.service.command.output;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
/**
* GDB/MI trace command output parsing.
- *
+ *
* ~"Tracepoint 2 at 0x4035a9: file /scratch/marc/test/src/main.cxx, line 109"
- *
+ *
* @since 3.0
*/
public class CLITraceInfo extends MIInfo {
@@ -32,10 +31,10 @@ public class CLITraceInfo extends MIInfo {
}
private String fReference = null;
-
+
/** @since 5.0 */
- public String getTraceReference(){
- return fReference;
+ public String getTraceReference() {
+ return fReference;
}
protected void parse() {
@@ -46,7 +45,7 @@ public class CLITraceInfo extends MIInfo {
if (oobs[i] instanceof MIConsoleStreamOutput) {
MIStreamRecord cons = (MIStreamRecord) oobs[i];
String str = cons.getString().trim();
- if(!str.isEmpty() ){
+ if (!str.isEmpty()) {
Pattern pattern = Pattern.compile("^Tracepoint\\s(\\d+)", Pattern.MULTILINE); //$NON-NLS-1$
Matcher matcher = pattern.matcher(str);
if (matcher.find()) {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetAttributesInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetAttributesInfo.java
index 1d3e54e6cb4..097615d9c90 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetAttributesInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetAttributesInfo.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
@@ -17,15 +17,17 @@ import org.eclipse.cdt.dsf.debug.service.command.ICommand;
import org.eclipse.cdt.dsf.debug.service.command.ICommandResult;
public class ExprMetaGetAttributesInfo implements ICommandResult {
-
+
private final boolean editable;
- public ExprMetaGetAttributesInfo(boolean e) {
- editable = e;
- }
-
- public boolean getEditable() { return editable; }
-
+ public ExprMetaGetAttributesInfo(boolean e) {
+ editable = e;
+ }
+
+ public boolean getEditable() {
+ return editable;
+ }
+
@Override
public <V extends ICommandResult> V getSubsetResult(ICommand<V> command) {
return null;
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetChildCountInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetChildCountInfo.java
index d78aca98159..d0ade4c210b 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetChildCountInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetChildCountInfo.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
@@ -17,20 +17,22 @@ import org.eclipse.cdt.dsf.debug.service.command.ICommand;
import org.eclipse.cdt.dsf.debug.service.command.ICommandResult;
public class ExprMetaGetChildCountInfo implements ICommandResult {
-
+
private final int childNum;
- public ExprMetaGetChildCountInfo(int n) {
- childNum = n;
- }
-
- public int getChildNum() { return childNum; }
-
+ public ExprMetaGetChildCountInfo(int n) {
+ childNum = n;
+ }
+
+ public int getChildNum() {
+ return childNum;
+ }
+
@Override
public <V extends ICommandResult> V getSubsetResult(ICommand<V> command) {
return null;
}
-
+
@Override
public String toString() {
return getClass().getSimpleName() + " (" + getChildNum() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetChildrenInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetChildrenInfo.java
index 9f7f91eadd8..f075232281d 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetChildrenInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetChildrenInfo.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
@@ -18,24 +18,25 @@ import org.eclipse.cdt.dsf.debug.service.command.ICommandResult;
import org.eclipse.cdt.dsf.mi.service.MIExpressions.ExpressionInfo;
public class ExprMetaGetChildrenInfo implements ICommandResult {
-
+
private final ExpressionInfo[] childrenExpressions;
- public ExprMetaGetChildrenInfo(ExpressionInfo[] c) {
- childrenExpressions = c;
- }
-
- public ExpressionInfo[] getChildrenExpressions() { return childrenExpressions; }
-
+ public ExprMetaGetChildrenInfo(ExpressionInfo[] c) {
+ childrenExpressions = c;
+ }
+
+ public ExpressionInfo[] getChildrenExpressions() {
+ return childrenExpressions;
+ }
+
@Override
public <V extends ICommandResult> V getSubsetResult(ICommand<V> command) {
return null;
}
-
+
@Override
public String toString() {
- return getClass().getSimpleName() + " [Array of " + //$NON-NLS-1$
- (getChildrenExpressions() == null ? 0 : getChildrenExpressions().length) +
- " children]"; //$NON-NLS-1$
+ return getClass().getSimpleName() + " [Array of " + //$NON-NLS-1$
+ (getChildrenExpressions() == null ? 0 : getChildrenExpressions().length) + " children]"; //$NON-NLS-1$
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetValueInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetValueInfo.java
index 119e5be894f..92c2946d18f 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetValueInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetValueInfo.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
@@ -17,22 +17,24 @@ import org.eclipse.cdt.dsf.debug.service.command.ICommand;
import org.eclipse.cdt.dsf.debug.service.command.ICommandResult;
public class ExprMetaGetValueInfo implements ICommandResult {
-
- private final String value;
- public ExprMetaGetValueInfo(String v) {
- value = v;
- }
-
- public String getValue() { return value; }
-
- @Override
- public <V extends ICommandResult> V getSubsetResult(ICommand<V> command) {
- return null;
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + " (" + getValue() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- } \ No newline at end of file
+ private final String value;
+
+ public ExprMetaGetValueInfo(String v) {
+ value = v;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ @Override
+ public <V extends ICommandResult> V getSubsetResult(ICommand<V> command) {
+ return null;
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + " (" + getValue() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+} \ No newline at end of file
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetVarInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetVarInfo.java
index 339dc668e3a..74ff8f5e497 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetVarInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetVarInfo.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
* Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121)
@@ -22,7 +22,7 @@ import org.eclipse.cdt.dsf.mi.service.MIVariableManager.MIVariableObject;
import org.eclipse.cdt.dsf.mi.service.command.commands.ExprMetaGetChildCount;
public class ExprMetaGetVarInfo implements ICommandResult {
-
+
private final String expression;
private final int numChildHint;
private final String type;
@@ -32,43 +32,37 @@ public class ExprMetaGetVarInfo implements ICommandResult {
private final boolean isCollectionHint;
private final boolean isSafeToAskForAllChildren;
private MIVariableObject varObj;
-
- public ExprMetaGetVarInfo(String e, int n, String t, boolean edit) {
- this (e, n, t, null, edit);
- }
+
+ public ExprMetaGetVarInfo(String e, int n, String t, boolean edit) {
+ this(e, n, t, null, edit);
+ }
/**
- * @since 3.0
- */
+ * @since 3.0
+ */
public ExprMetaGetVarInfo(String e, int n, String t, GDBType gt, boolean edit) {
this(e, true, n, t, gt, edit, false);
- }
+ }
/**
- * @since 4.0
- */
- public ExprMetaGetVarInfo(String e, boolean isSafeToAskForAllChildren, int n,
- String t, GDBType gt, boolean edit, boolean isCollectionHint) {
- expression = e;
- this.isSafeToAskForAllChildren = isSafeToAskForAllChildren;
- numChildHint = n;
- type = t;
- editable = edit;
- gdbType = gt;
- this.isCollectionHint = isCollectionHint;
- }
+ * @since 4.0
+ */
+ public ExprMetaGetVarInfo(String e, boolean isSafeToAskForAllChildren, int n, String t, GDBType gt, boolean edit,
+ boolean isCollectionHint) {
+ expression = e;
+ this.isSafeToAskForAllChildren = isSafeToAskForAllChildren;
+ numChildHint = n;
+ type = t;
+ editable = edit;
+ gdbType = gt;
+ this.isCollectionHint = isCollectionHint;
+ }
/**
* @since 4.7
*/
- public ExprMetaGetVarInfo(String e, MIVariableObject varObj, int n)
- {
- this(e,
- varObj.isSafeToAskForAllChildren(),
- n,
- varObj.getType(),
- varObj.getGDBType(),
- !varObj.isComplex(),
+ public ExprMetaGetVarInfo(String e, MIVariableObject varObj, int n) {
+ this(e, varObj.isSafeToAskForAllChildren(), n, varObj.getType(), varObj.getGDBType(), !varObj.isComplex(),
varObj.getDisplayHint().isCollectionHint());
this.varObj = varObj;
}
@@ -76,25 +70,26 @@ public class ExprMetaGetVarInfo implements ICommandResult {
/**
* @since 4.7
*/
- public ExprMetaGetVarInfo(String e, MIVariableObject varObj)
- {
+ public ExprMetaGetVarInfo(String e, MIVariableObject varObj) {
// We only provide the hint here. It will be used for hasChildren()
// To obtain the correct number of children, the user should use
// IExpressions#getSubExpressionCount()
this(e, varObj, varObj.getNumChildrenHint());
}
- /**
+ /**
* Return raw MI fields for this variable or null if
* no available.
* @since 4.7
*/
- public MITuple getRawFields() {
- return varObj != null ? varObj.getRawFields() : null;
+ public MITuple getRawFields() {
+ return varObj != null ? varObj.getRawFields() : null;
+ }
+
+ public String getExpr() {
+ return expression;
}
-
- public String getExpr() { return expression; }
-
+
/**
* This method only returns a 'hint' to the number of children. In the case
* of C++ complex structures, this number will not be the actual number of
@@ -103,45 +98,53 @@ public class ExprMetaGetVarInfo implements ICommandResult {
* In case of variable backed by a pretty printer, the number represents
* only the number of currently fetched children, not all children that
* might be available.
- *
+ *
* @return The hint on the number of children.
- *
+ *
* @deprecated Its not possible to tell the exact number of children, but
* you can use {@link #hasChildren()} in order to find out
* whether the variable has children at all. In order to find
* out about the correct number of children, use {@link ExprMetaGetChildCount}.
*/
- @Deprecated
- public int getNumChildren() { return numChildHint; }
-
- /**
- * @return Whether the variable has children or not (reliable).
- *
- * @since 4.0
- */
- public boolean hasChildren() {
- return (numChildHint > 0);
- }
-
- public String getType() { return type; }
-
- /**
- * @since 3.0
- */
- public GDBType getGDBType() { return gdbType; }
-
- public boolean getEditable() { return editable; }
-
- /**
- * @return If <code>true</code>, the variable is definitely a collection,
- * if <code>false</code>, it's most probably not.
- *
- * @since 4.0
- */
- public boolean getCollectionHint() {
+ @Deprecated
+ public int getNumChildren() {
+ return numChildHint;
+ }
+
+ /**
+ * @return Whether the variable has children or not (reliable).
+ *
+ * @since 4.0
+ */
+ public boolean hasChildren() {
+ return (numChildHint > 0);
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * @since 3.0
+ */
+ public GDBType getGDBType() {
+ return gdbType;
+ }
+
+ public boolean getEditable() {
+ return editable;
+ }
+
+ /**
+ * @return If <code>true</code>, the variable is definitely a collection,
+ * if <code>false</code>, it's most probably not.
+ *
+ * @since 4.0
+ */
+ public boolean getCollectionHint() {
return isCollectionHint;
}
-
+
@Override
public <V extends ICommandResult> V getSubsetResult(ICommand<V> command) {
return null;
@@ -151,17 +154,17 @@ public class ExprMetaGetVarInfo implements ICommandResult {
* @return Whether this variable can be safely ask for all its children, or
* whether clients need to specify a limit on the number of children
* to be fetched, because otherwise the gdb might hang up.
- *
+ *
* @since 4.0
*/
public boolean isSafeToAskForAllChildren() {
return isSafeToAskForAllChildren;
}
-
+
@Override
public String toString() {
- return getClass().getSimpleName() + " (" + //$NON-NLS-1$
- getExpr() + ", " + getNumChildren() + ", " + //$NON-NLS-1$ //$NON-NLS-2$
+ return getClass().getSimpleName() + " (" + //$NON-NLS-1$
+ getExpr() + ", " + getNumChildren() + ", " + //$NON-NLS-1$ //$NON-NLS-2$
getType() + ", " + getEditable() + ", " + //$NON-NLS-1$ //$NON-NLS-2$
getCollectionHint() + ")"; //$NON-NLS-1$
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIAddInferiorInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIAddInferiorInfo.java
index b0fc4fd8ea8..10075f367ad 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIAddInferiorInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIAddInferiorInfo.java
@@ -17,37 +17,37 @@ package org.eclipse.cdt.dsf.mi.service.command.output;
/**
* -add-inferior
* ^done,inferior="i2"
- *
+ *
* @since 4.0
*/
public class MIAddInferiorInfo extends MIInfo {
- private String fGroupId;
+ private String fGroupId;
+
+ public MIAddInferiorInfo(MIOutput record) {
+ super(record);
+ if (isDone()) {
+ MIOutput out = getMIOutput();
+ MIResultRecord rr = out.getMIResultRecord();
+ if (rr != null) {
+ MIResult[] results = rr.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ MIValue resultVal = results[i].getMIValue();
+ String str = ""; //$NON-NLS-1$
+ if (resultVal instanceof MIConst) {
+ str = ((MIConst) resultVal).getString();
+ }
- public MIAddInferiorInfo(MIOutput record) {
- super(record);
- if (isDone()) {
- MIOutput out = getMIOutput();
- MIResultRecord rr = out.getMIResultRecord();
- if (rr != null) {
- MIResult[] results = rr.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- MIValue resultVal = results[i].getMIValue();
- String str = ""; //$NON-NLS-1$
- if (resultVal instanceof MIConst) {
- str = ((MIConst)resultVal).getString();
- }
+ if (var.equals("inferior")) { //$NON-NLS-1$
+ fGroupId = str;
+ }
+ }
+ }
+ }
+ }
- if (var.equals("inferior")) { //$NON-NLS-1$
- fGroupId = str;
- }
- }
- }
- }
- }
-
- public String getGroupId() {
- return fGroupId;
- }
+ public String getGroupId() {
+ return fGroupId;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIArg.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIArg.java
index 7329440e586..0899b1cd329 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIArg.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIArg.java
@@ -18,118 +18,118 @@ package org.eclipse.cdt.dsf.mi.service.command.output;
import java.util.ArrayList;
import java.util.List;
-
/**
* Represents a set name=value.
*/
public class MIArg {
- String name;
- String value;
+ String name;
+ String value;
+
+ public MIArg(String name, String value) {
+ this.name = name;
+ this.value = value;
+ }
- public MIArg(String name, String value) {
- this.name = name;
- this.value = value;
- }
+ public String getName() {
+ return name;
+ }
- public String getName() {
- return name;
- }
+ public String getValue() {
+ return value;
+ }
- public String getValue() {
- return value;
- }
+ /**
+ * Parsing a DsfMIList of the form:
+ * [{name="xxx",value="yyy"},{name="xxx",value="yyy"},..]
+ * [name="xxx",name="xxx",..]
+ * [{name="xxx"},{name="xxx"}]
+ */
+ public static MIArg[] getMIArgs(MIList miList) {
+ List<MIArg> aList = new ArrayList<MIArg>();
+ MIValue[] values = miList.getMIValues();
+ for (int i = 0; i < values.length; i++) {
+ if (values[i] instanceof MITuple) {
+ MIArg arg = getMIArg((MITuple) values[i]);
+ if (arg != null) {
+ aList.add(arg);
+ }
+ }
+ }
+ MIResult[] results = miList.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ MIValue value = results[i].getMIValue();
+ if (value instanceof MIConst) {
+ String str = ((MIConst) value).getCString();
+ aList.add(new MIArg(str, "")); //$NON-NLS-1$
+ }
+ }
+ return (aList.toArray(new MIArg[aList.size()]));
+ }
- /**
- * Parsing a DsfMIList of the form:
- * [{name="xxx",value="yyy"},{name="xxx",value="yyy"},..]
- * [name="xxx",name="xxx",..]
- * [{name="xxx"},{name="xxx"}]
- */
- public static MIArg[] getMIArgs(MIList miList) {
- List<MIArg> aList = new ArrayList<MIArg>();
- MIValue[] values = miList.getMIValues();
- for (int i = 0; i < values.length; i++) {
- if (values[i] instanceof MITuple) {
- MIArg arg = getMIArg((MITuple)values[i]);
- if (arg != null) {
- aList.add(arg);
- }
- }
- }
- MIResult[] results = miList.getMIResults();
- for (int i = 0; i < results.length; i++) {
- MIValue value = results[i].getMIValue();
- if (value instanceof MIConst) {
- String str = ((MIConst)value).getCString();
- aList.add(new MIArg(str, "")); //$NON-NLS-1$
- }
- }
- return (aList.toArray(new MIArg[aList.size()]));
- }
+ /**
+ * Parsing a DsfMITuple of the form:
+ * {{name="xxx",value="yyy"},{name="xxx",value="yyy"},..}
+ * {name="xxx",name="xxx",..}
+ * {{name="xxx"},{name="xxx"}}
+ */
+ public static MIArg[] getMIArgs(MITuple miTuple) {
+ List<MIArg> aList = new ArrayList<MIArg>();
+ MIValue[] values = miTuple.getMIValues();
+ for (int i = 0; i < values.length; i++) {
+ if (values[i] instanceof MITuple) {
+ MIArg arg = getMIArg((MITuple) values[i]);
+ if (arg != null) {
+ aList.add(arg);
+ }
+ }
+ }
+ MIResult[] results = miTuple.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ MIValue value = results[i].getMIValue();
+ if (value instanceof MIConst) {
+ String str = ((MIConst) value).getCString();
+ aList.add(new MIArg(str, "")); //$NON-NLS-1$
+ }
+ }
+ return (aList.toArray(new MIArg[aList.size()]));
+ }
- /**
- * Parsing a DsfMITuple of the form:
- * {{name="xxx",value="yyy"},{name="xxx",value="yyy"},..}
- * {name="xxx",name="xxx",..}
- * {{name="xxx"},{name="xxx"}}
- */
- public static MIArg[] getMIArgs(MITuple miTuple) {
- List<MIArg> aList = new ArrayList<MIArg>();
- MIValue[] values = miTuple.getMIValues();
- for (int i = 0; i < values.length; i++) {
- if (values[i] instanceof MITuple) {
- MIArg arg = getMIArg((MITuple)values[i]);
- if (arg != null) {
- aList.add(arg);
- }
- }
- }
- MIResult[] results = miTuple.getMIResults();
- for (int i = 0; i < results.length; i++) {
- MIValue value = results[i].getMIValue();
- if (value instanceof MIConst) {
- String str = ((MIConst)value).getCString();
- aList.add(new MIArg(str, "")); //$NON-NLS-1$
- }
- }
- return (aList.toArray(new MIArg[aList.size()]));
- }
- /**
- * Parsing a DsfMITuple of the form:
- * {name="xxx",value="yyy"}
- * {name="xxx"}
- */
- public static MIArg getMIArg(MITuple tuple) {
- MIResult[] args = tuple.getMIResults();
- MIArg arg = null;
- if (args.length > 0) {
- // Name
- String aName = ""; //$NON-NLS-1$
- MIValue value = args[0].getMIValue();
- if (value != null && value instanceof MIConst) {
- aName = ((MIConst)value).getCString();
- } else {
- aName = ""; //$NON-NLS-1$
- }
+ /**
+ * Parsing a DsfMITuple of the form:
+ * {name="xxx",value="yyy"}
+ * {name="xxx"}
+ */
+ public static MIArg getMIArg(MITuple tuple) {
+ MIResult[] args = tuple.getMIResults();
+ MIArg arg = null;
+ if (args.length > 0) {
+ // Name
+ String aName = ""; //$NON-NLS-1$
+ MIValue value = args[0].getMIValue();
+ if (value != null && value instanceof MIConst) {
+ aName = ((MIConst) value).getCString();
+ } else {
+ aName = ""; //$NON-NLS-1$
+ }
- // Value
- String aValue = ""; //$NON-NLS-1$
- if (args.length == 2) {
- value = args[1].getMIValue();
- if (value != null && value instanceof MIConst) {
- aValue = ((MIConst)value).getCString();
- } else {
- aValue = ""; //$NON-NLS-1$
- }
- }
+ // Value
+ String aValue = ""; //$NON-NLS-1$
+ if (args.length == 2) {
+ value = args[1].getMIValue();
+ if (value != null && value instanceof MIConst) {
+ aValue = ((MIConst) value).getCString();
+ } else {
+ aValue = ""; //$NON-NLS-1$
+ }
+ }
- arg = new MIArg(aName, aValue);
- }
- return arg;
- }
+ arg = new MIArg(aName, aValue);
+ }
+ return arg;
+ }
- @Override
- public String toString() {
- return name + "=" + value; //$NON-NLS-1$
- }
+ @Override
+ public String toString() {
+ return name + "=" + value; //$NON-NLS-1$
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIAsyncRecord.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIAsyncRecord.java
index 5bc5a5c9483..54ce6418826 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIAsyncRecord.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIAsyncRecord.java
@@ -16,64 +16,64 @@
package org.eclipse.cdt.dsf.mi.service.command.output;
/**
- * base Abstract class for the OOB stream MI responses.
+ * base Abstract class for the OOB stream MI responses.
*/
public abstract class MIAsyncRecord extends MIOOBRecord {
- final static MIResult[] nullResults = new MIResult[0];
+ final static MIResult[] nullResults = new MIResult[0];
- MIResult[] results = null;
- String asynClass = ""; //$NON-NLS-1$
- int token = -1;
+ MIResult[] results = null;
+ String asynClass = ""; //$NON-NLS-1$
+ int token = -1;
- public int getToken() {
- return token;
- }
+ public int getToken() {
+ return token;
+ }
- public void setToken(int t) {
- token = t;
- }
+ public void setToken(int t) {
+ token = t;
+ }
- public String getAsyncClass() {
- return asynClass;
- }
+ public String getAsyncClass() {
+ return asynClass;
+ }
- public void setAsyncClass(String a) {
- asynClass = a;
- }
+ public void setAsyncClass(String a) {
+ asynClass = a;
+ }
- public MIResult[] getMIResults() {
- if (results == null) {
- return nullResults;
- }
- return results;
- }
+ public MIResult[] getMIResults() {
+ if (results == null) {
+ return nullResults;
+ }
+ return results;
+ }
- public void setMIResults(MIResult[] res) {
- results = res;
- }
+ public void setMIResults(MIResult[] res) {
+ results = res;
+ }
- @Override
- public String toString() {
- StringBuilder buffer = new StringBuilder();
- if (token > 0) {
- buffer.append(token);
- }
- if (this instanceof MIExecAsyncOutput) {
- buffer.append('*');
- } else if (this instanceof MIStatusAsyncOutput) {
- buffer.append('+');
- } else if (this instanceof MINotifyAsyncOutput) {
- buffer.append('=');
- }
- buffer.append(asynClass);
- if (results != null) {
- for (int i = 0; i < results.length; i++) {
- buffer.append(',');
- buffer.append(results[i].toString());
- }
- }
- buffer.append('\n');
- return buffer.toString();
- }
+ @Override
+ public String toString() {
+ StringBuilder buffer = new StringBuilder();
+ if (token > 0) {
+ buffer.append(token);
+ }
+ if (this instanceof MIExecAsyncOutput) {
+ buffer.append('*');
+ } else if (this instanceof MIStatusAsyncOutput) {
+ buffer.append('+');
+ } else if (this instanceof MINotifyAsyncOutput) {
+ buffer.append('=');
+ }
+ buffer.append(asynClass);
+ if (results != null) {
+ for (int i = 0; i < results.length; i++) {
+ buffer.append(',');
+ buffer.append(results[i].toString());
+ }
+ }
+ buffer.append('\n');
+ return buffer.toString();
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIBreakInsertInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIBreakInsertInfo.java
index ffb143c6eac..94bd7103a9b 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIBreakInsertInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIBreakInsertInfo.java
@@ -9,7 +9,7 @@
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
- * QNX Software Systems - Initial API and implementation
+ * QNX Software Systems - Initial API and implementation
* Wind River Systems - Modified for new DSF Reference Implementation
*******************************************************************************/
@@ -30,66 +30,65 @@ import java.util.List;
*/
public class MIBreakInsertInfo extends MIInfo {
- MIBreakpoint[] breakpoints;
+ MIBreakpoint[] breakpoints;
- public MIBreakInsertInfo(MIOutput record) {
- super(record);
- breakpoints = null;
- List<MIBreakpoint> aList = new ArrayList<MIBreakpoint>(1);
- if (isDone()) {
- MIResultRecord rr = record.getMIResultRecord();
- if (rr != null) {
- MIResult[] results = rr.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- MIValue val = results[i].getMIValue();
- MIBreakpoint bpt = null;
- if (var.equals("wpt")) { //$NON-NLS-1$
- if (val instanceof MITuple) {
- bpt = createMIBreakpoint((MITuple)val);
- bpt.setEnabled(true);
- bpt.setWriteWatchpoint(true);
- }
- } else if (var.equals("bkpt")) { //$NON-NLS-1$
- if (val instanceof MITuple) {
- bpt = createMIBreakpoint((MITuple)val);
- }
- } else if (var.equals("hw-awpt")) { //$NON-NLS-1$
- if (val instanceof MITuple) {
- bpt = createMIBreakpoint((MITuple)val);
- bpt.setAccessWatchpoint(true);
- bpt.setEnabled(true);
- }
- } else if (var.equals("hw-rwpt")) { //$NON-NLS-1$
- if (val instanceof MITuple) {
- bpt = createMIBreakpoint((MITuple)val);
- bpt.setReadWatchpoint(true);
- bpt.setEnabled(true);
- }
- }
- if (bpt != null) {
- aList.add(bpt);
- }
- }
- }
- }
- breakpoints = aList.toArray(new MIBreakpoint[aList.size()]);
- }
+ public MIBreakInsertInfo(MIOutput record) {
+ super(record);
+ breakpoints = null;
+ List<MIBreakpoint> aList = new ArrayList<MIBreakpoint>(1);
+ if (isDone()) {
+ MIResultRecord rr = record.getMIResultRecord();
+ if (rr != null) {
+ MIResult[] results = rr.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ MIValue val = results[i].getMIValue();
+ MIBreakpoint bpt = null;
+ if (var.equals("wpt")) { //$NON-NLS-1$
+ if (val instanceof MITuple) {
+ bpt = createMIBreakpoint((MITuple) val);
+ bpt.setEnabled(true);
+ bpt.setWriteWatchpoint(true);
+ }
+ } else if (var.equals("bkpt")) { //$NON-NLS-1$
+ if (val instanceof MITuple) {
+ bpt = createMIBreakpoint((MITuple) val);
+ }
+ } else if (var.equals("hw-awpt")) { //$NON-NLS-1$
+ if (val instanceof MITuple) {
+ bpt = createMIBreakpoint((MITuple) val);
+ bpt.setAccessWatchpoint(true);
+ bpt.setEnabled(true);
+ }
+ } else if (var.equals("hw-rwpt")) { //$NON-NLS-1$
+ if (val instanceof MITuple) {
+ bpt = createMIBreakpoint((MITuple) val);
+ bpt.setReadWatchpoint(true);
+ bpt.setEnabled(true);
+ }
+ }
+ if (bpt != null) {
+ aList.add(bpt);
+ }
+ }
+ }
+ }
+ breakpoints = aList.toArray(new MIBreakpoint[aList.size()]);
+ }
- public MIBreakpoint[] getMIBreakpoints() {
- return breakpoints;
- }
+ public MIBreakpoint[] getMIBreakpoints() {
+ return breakpoints;
+ }
-
- /**
- * Create a target specific MIBreakpoint
- *
- * @param value
- * tuple suitable for passing to MIBreakpoint constructor
- * @return new breakpoint
- * @since 5.3
- */
- protected MIBreakpoint createMIBreakpoint(MITuple tuple) {
- return new MIBreakpoint(tuple);
- }
+ /**
+ * Create a target specific MIBreakpoint
+ *
+ * @param value
+ * tuple suitable for passing to MIBreakpoint constructor
+ * @return new breakpoint
+ * @since 5.3
+ */
+ protected MIBreakpoint createMIBreakpoint(MITuple tuple) {
+ return new MIBreakpoint(tuple);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIBreakListInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIBreakListInfo.java
index 306d23a4b98..6052cda1d15 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIBreakListInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIBreakListInfo.java
@@ -17,8 +17,6 @@ package org.eclipse.cdt.dsf.mi.service.command.output;
import java.util.ArrayList;
import java.util.List;
-
-
/**
* A -break-list result-record is the form:
* <pre>
@@ -29,73 +27,73 @@ import java.util.List;
*/
public class MIBreakListInfo extends MIInfo {
- MIBreakpoint[] breakpoints;
+ MIBreakpoint[] breakpoints;
- public MIBreakListInfo(MIOutput rr) {
- super(rr);
- }
+ public MIBreakListInfo(MIOutput rr) {
+ super(rr);
+ }
- public MIBreakpoint[] getMIBreakpoints() {
- if (breakpoints == null) {
- parse();
- }
- return breakpoints;
- }
+ public MIBreakpoint[] getMIBreakpoints() {
+ if (breakpoints == null) {
+ parse();
+ }
+ return breakpoints;
+ }
- void parse() {
- List<MIBreakpoint> aList = new ArrayList<MIBreakpoint>(1);
- if (isDone()) {
- MIOutput out = getMIOutput();
- MIResultRecord rr = out.getMIResultRecord();
- if (rr != null) {
- MIResult[] results = rr.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- if (var.equals("BreakpointTable")) { //$NON-NLS-1$
- parseTable(results[i].getMIValue(), aList);
- }
- }
- }
- }
- breakpoints = aList.toArray(new MIBreakpoint[aList.size()]);
- }
+ void parse() {
+ List<MIBreakpoint> aList = new ArrayList<MIBreakpoint>(1);
+ if (isDone()) {
+ MIOutput out = getMIOutput();
+ MIResultRecord rr = out.getMIResultRecord();
+ if (rr != null) {
+ MIResult[] results = rr.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ if (var.equals("BreakpointTable")) { //$NON-NLS-1$
+ parseTable(results[i].getMIValue(), aList);
+ }
+ }
+ }
+ }
+ breakpoints = aList.toArray(new MIBreakpoint[aList.size()]);
+ }
- void parseTable(MIValue val, List<MIBreakpoint> aList) {
- if (val instanceof MITuple) {
- MIResult[] table = ((MITuple)val).getMIResults();
- for (int j = 0; j < table.length; j++) {
- String variable = table[j].getVariable();
- if (variable.equals("body")) { //$NON-NLS-1$
- parseBody(table[j].getMIValue(), aList);
- }
- }
- }
- }
+ void parseTable(MIValue val, List<MIBreakpoint> aList) {
+ if (val instanceof MITuple) {
+ MIResult[] table = ((MITuple) val).getMIResults();
+ for (int j = 0; j < table.length; j++) {
+ String variable = table[j].getVariable();
+ if (variable.equals("body")) { //$NON-NLS-1$
+ parseBody(table[j].getMIValue(), aList);
+ }
+ }
+ }
+ }
- void parseBody(MIValue body, List<MIBreakpoint> aList) {
- if (body instanceof MIList) {
- MIResult[] bkpts = ((MIList)body).getMIResults();
- for (int i = 0; i < bkpts.length; i++) {
- String b = bkpts[i].getVariable();
- if (b.equals("bkpt")) { //$NON-NLS-1$
- MIValue value = bkpts[i].getMIValue();
- if (value instanceof MITuple) {
- aList.add(createMIBreakpoint((MITuple)value));
- }
- }
- }
- }
- }
+ void parseBody(MIValue body, List<MIBreakpoint> aList) {
+ if (body instanceof MIList) {
+ MIResult[] bkpts = ((MIList) body).getMIResults();
+ for (int i = 0; i < bkpts.length; i++) {
+ String b = bkpts[i].getVariable();
+ if (b.equals("bkpt")) { //$NON-NLS-1$
+ MIValue value = bkpts[i].getMIValue();
+ if (value instanceof MITuple) {
+ aList.add(createMIBreakpoint((MITuple) value));
+ }
+ }
+ }
+ }
+ }
- /**
- * Create a target specific MIBreakpoint
- *
- * @param value
- * tuple suitable for passing to MIBreakpoint constructor
- * @return new breakpoint
- * @since 5.3
- */
- protected MIBreakpoint createMIBreakpoint(MITuple tuple) {
- return new MIBreakpoint(tuple);
- }
+ /**
+ * Create a target specific MIBreakpoint
+ *
+ * @param value
+ * tuple suitable for passing to MIBreakpoint constructor
+ * @return new breakpoint
+ * @since 5.3
+ */
+ protected MIBreakpoint createMIBreakpoint(MITuple tuple) {
+ return new MIBreakpoint(tuple);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIBreakpoint.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIBreakpoint.java
index 993ffd995bd..17c10c95475 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIBreakpoint.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIBreakpoint.java
@@ -30,7 +30,7 @@ import org.eclipse.cdt.dsf.mi.service.MIBreakpoints;
/**
* Contain info about the GDB/MI breakpoint.
- *
+ *
* (gdb)
* -break-insert main
* ^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0804846b",func="main",file="hello.c",line="4",times="0"}
@@ -61,12 +61,12 @@ import org.eclipse.cdt.dsf.mi.service.MIBreakpoints;
* bkpt={number="5",type="tracepoint",disp="keep",enabled="y",addr="0x0804846b",func="main",file="hello.c",line="4",thread="0",thread="0",times="0"}
* bkpt={number="1",type="tracepoint",disp="keep",enabled="y",addr="0x0041bca0",func="main",file="hello.c",line="4",times="0",pass="4",original-location="hello.c:4"},
* bkpt={number="5",type="fast tracepoint",disp="keep",enabled="y",addr="0x0804852d",func="testTracepoints()",file="TracepointTestApp.cc",fullname="/local/src/TracepointTestApp.cc",line="84",times="0",original-location="TracepointTestApp.cc:84"}
- *
+ *
* Pending breakpoint
* -break-insert -f NotLoadedLibrary.c:26
* &"No source file named NotLoadedLibrary.c.\n"
* ^done,bkpt={number="9",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="NotLoadedLibrary.c:26",times="0",original-location="NotLoadedLibrary.c:26"}
- *
+ *
* Note that any breakpoint that fails to install will be marked as pending when the -f option is used.
* <p>
* <b>Note on using constructor directly:</b></a> As this class can be extended by third-parties it is
@@ -75,61 +75,61 @@ import org.eclipse.cdt.dsf.mi.service.MIBreakpoints;
* For examples, see {@link MIBreakpoints#createMIBreakpoint(MITuple)} or
* {@link MIBreakInsertInfo#createMIBreakpoint(MITuple)}
*/
-public class MIBreakpoint {
-
- String number = ""; //$NON-NLS-1$
- String type = ""; //$NON-NLS-1$
- String disp = ""; //$NON-NLS-1$
- boolean enabled = false;
- String address = ""; //$NON-NLS-1$
- String func = ""; //$NON-NLS-1$
- String fullName = ""; //$NON-NLS-1$
- String file = ""; //$NON-NLS-1$
- int line = -1;
- String cond = ""; //$NON-NLS-1$
- int times = 0;
- String exp = ""; //$NON-NLS-1$
- String threadId = "0"; //$NON-NLS-1$
- int ignore = 0;
- String commands = ""; //$NON-NLS-1$
- String originalLocation = ""; //$NON-NLS-1$
-
- // For tracepoints
- int passcount = 0;
- // For dynamic printf
- String printfString;
-
- boolean isWpt = false;
- boolean isAWpt = false;
- boolean isRWpt = false;
- boolean isWWpt = false;
- boolean isHdw = false;
-
- // Indicate if we are dealing with a tracepoint.
- // (if its a fast or normal tracepoint can be known through the 'type' field)
- boolean isTpt = false;
-
- /** See {@link #isCatchpoint()} */
- boolean isCatchpoint;
+public class MIBreakpoint {
+
+ String number = ""; //$NON-NLS-1$
+ String type = ""; //$NON-NLS-1$
+ String disp = ""; //$NON-NLS-1$
+ boolean enabled = false;
+ String address = ""; //$NON-NLS-1$
+ String func = ""; //$NON-NLS-1$
+ String fullName = ""; //$NON-NLS-1$
+ String file = ""; //$NON-NLS-1$
+ int line = -1;
+ String cond = ""; //$NON-NLS-1$
+ int times = 0;
+ String exp = ""; //$NON-NLS-1$
+ String threadId = "0"; //$NON-NLS-1$
+ int ignore = 0;
+ String commands = ""; //$NON-NLS-1$
+ String originalLocation = ""; //$NON-NLS-1$
+
+ // For tracepoints
+ int passcount = 0;
+ // For dynamic printf
+ String printfString;
+
+ boolean isWpt = false;
+ boolean isAWpt = false;
+ boolean isRWpt = false;
+ boolean isWWpt = false;
+ boolean isHdw = false;
+
+ // Indicate if we are dealing with a tracepoint.
+ // (if its a fast or normal tracepoint can be known through the 'type' field)
+ boolean isTpt = false;
+
+ /** See {@link #isCatchpoint()} */
+ boolean isCatchpoint;
/** See {@link #getCatchpointType()} */
private String catchpointType;
-
- /** See {@link #isDynamicPrintf()} */
+
+ /** See {@link #isDynamicPrintf()} */
private boolean isDynPrintf;
-
- /**
+
+ /**
* A pending breakpoint is a breakpoint that did not install properly,
* but that will be kept in the hopes that it installs later, triggered by
* the loading of a library.
* This concept is only supported starting with GDB 6.8
*/
private boolean pending;
-
+
/**
* The list of groupIds to which this breakpoint applies.
* This field is only reported by MI starting with GDB 7.6.
- * null will be returned if this field is not present.
+ * null will be returned if this field is not present.
*/
private String[] groupIds;
@@ -148,41 +148,41 @@ public class MIBreakpoint {
* See {@link MIBreakpoint} class comment "Note on using constructor
* directly"
* <p>
- *
+ *
* @param other
* breakpoint to copy from
*/
public MIBreakpoint(MIBreakpoint other) {
- number = other.number;
- type = other.type;
- disp = other.disp;
- enabled = other.enabled;
- address = other.address;
- func = other.func;
- fullName = other.fullName;
- file = other.file;
- line = other.line;
- cond = other.cond;
- times = other.times;
- exp = other.exp;
- threadId = other.threadId;
- ignore = other.ignore;
- commands = other.commands;
- passcount= other.passcount;
- isWpt = other.isWpt;
- isAWpt = other.isAWpt;
- isRWpt = other.isRWpt;
- isWWpt = other.isWWpt;
- isHdw = other.isHdw;
- isTpt = other.isTpt;
- isCatchpoint = other.isCatchpoint;
- catchpointType = other.catchpointType;
- isDynPrintf = other.isDynPrintf;
- pending = other.pending;
- originalLocation = other.originalLocation;
- if (other.groupIds != null) {
- groupIds = Arrays.copyOf(other.groupIds, other.groupIds.length);
- }
+ number = other.number;
+ type = other.type;
+ disp = other.disp;
+ enabled = other.enabled;
+ address = other.address;
+ func = other.func;
+ fullName = other.fullName;
+ file = other.file;
+ line = other.line;
+ cond = other.cond;
+ times = other.times;
+ exp = other.exp;
+ threadId = other.threadId;
+ ignore = other.ignore;
+ commands = other.commands;
+ passcount = other.passcount;
+ isWpt = other.isWpt;
+ isAWpt = other.isAWpt;
+ isRWpt = other.isRWpt;
+ isWWpt = other.isWWpt;
+ isHdw = other.isHdw;
+ isTpt = other.isTpt;
+ isCatchpoint = other.isCatchpoint;
+ catchpointType = other.catchpointType;
+ isDynPrintf = other.isDynPrintf;
+ pending = other.pending;
+ originalLocation = other.originalLocation;
+ if (other.groupIds != null) {
+ groupIds = Arrays.copyOf(other.groupIds, other.groupIds.length);
+ }
}
/**
@@ -191,7 +191,7 @@ public class MIBreakpoint {
* See {@link MIBreakpoint} class comment "Note on using constructor
* directly"
* <p>
- *
+ *
* @param tuple
* data received from GDB
*/
@@ -202,7 +202,7 @@ public class MIBreakpoint {
/**
* This constructor is used for catchpoints. Catchpoints are not yet
* supported in MI, so we end up using CLI.
- *
+ *
* <p>
* Note that this poses at least one challenge for us. Normally, upon
* creating a breakpoint/watchpoint/tracepoint via mi, we get back a command
@@ -216,7 +216,7 @@ public class MIBreakpoint {
* construct at creation time, and the one we get by asking gdb for the
* breakpoint list). The most we can do is compare the breakpoint number.
* That for sure should be the same.
- *
+ *
* <p>
* The detail we get from querying the breakpoint list, BTW, won't even
* reveal that it's a catchpoint. gdb simply reports it as a breakpoint,
@@ -227,19 +227,19 @@ public class MIBreakpoint {
* that same breakpoint number, and a consumer of that MIBreakpoint won't be
* able to tell it's a catchpoint. Quite the mess. Wish gdb would treat
* catchpoints like first class citizens.
- *
+ *
* <p>
* See {@link MIBreakpoint} class comment "Note on using constructor directly"
- *
+ *
* @param cliResult
* the output from the CLI command. Example:
* "Catchpoint 1 (catch)"
* @since 3.0
*/
- public MIBreakpoint(String cliResult) {
- if (cliResult.startsWith("Catchpoint ")) { //$NON-NLS-1$
+ public MIBreakpoint(String cliResult) {
+ if (cliResult.startsWith("Catchpoint ")) { //$NON-NLS-1$
String bkptNumber = ""; //$NON-NLS-1$
-
+
StringTokenizer tokenizer = new StringTokenizer(cliResult);
for (int i = 0; tokenizer.hasMoreTokens(); i++) {
String sub = tokenizer.nextToken();
@@ -251,421 +251,421 @@ public class MIBreakpoint {
break;
case 2: // third token is the event type; drop the parenthesis
if (sub.startsWith("(")) { //$NON-NLS-1$
- sub = sub.substring(1, sub.length()-1);
+ sub = sub.substring(1, sub.length() - 1);
}
catchpointType = sub;
break;
}
}
-
+
number = bkptNumber;
isCatchpoint = true;
enabled = true;
- }
- else {
+ } else {
assert false : "unexpected CLI output: " + cliResult; //$NON-NLS-1$
}
- }
-
+ }
- ///////////////////////////////////////////////////////////////////////////
- // Properties getters
- ///////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////
+ // Properties getters
+ ///////////////////////////////////////////////////////////////////////////
/** @since 5.0 */
public String getNumber() {
- return number;
- }
+ return number;
+ }
- public String getType() {
- return type;
- }
+ public String getType() {
+ return type;
+ }
- public String getDisposition() {
- return disp;
- }
+ public String getDisposition() {
+ return disp;
+ }
- public boolean isEnabled() {
- return enabled;
- }
+ public boolean isEnabled() {
+ return enabled;
+ }
- public void setEnabled(boolean e) {
- enabled = e;
- }
+ public void setEnabled(boolean e) {
+ enabled = e;
+ }
- public String getAddress() {
- return address;
- }
+ public String getAddress() {
+ return address;
+ }
- public String getFunction() {
- return func;
- }
+ public String getFunction() {
+ return func;
+ }
- public String getFile() {
- return file;
- }
+ public String getFile() {
+ return file;
+ }
- public String getFullName() {
- return fullName;
- }
+ public String getFullName() {
+ return fullName;
+ }
- public int getLine() {
- return line;
- }
+ public int getLine() {
+ return line;
+ }
- public String getCondition() {
- return cond;
- }
+ public String getCondition() {
+ return cond;
+ }
- public void setCondition(String condition) {
- cond = condition;
- }
+ public void setCondition(String condition) {
+ cond = condition;
+ }
- public int getIgnoreCount() {
- return ignore;
- }
+ public int getIgnoreCount() {
+ return ignore;
+ }
- public void setIgnoreCount(int ignoreCount) {
- ignore = ignoreCount;
- }
+ public void setIgnoreCount(int ignoreCount) {
+ ignore = ignoreCount;
+ }
- public String getThreadId() {
- return threadId;
- }
+ public String getThreadId() {
+ return threadId;
+ }
- public int getTimes() {
- return times;
- }
+ public int getTimes() {
+ return times;
+ }
- public String getExpression() {
- return exp;
- }
+ public String getExpression() {
+ return exp;
+ }
- /**
+ /**
* @since 4.2
*/
- public String getOriginalLocation() {
- return originalLocation;
- }
+ public String getOriginalLocation() {
+ return originalLocation;
+ }
/**
* If isCatchpoint is true, then this indicates the type of catchpoint
* (event), as reported by gdb in its response to the CLI catch command.
* E.g., 'catch' or 'fork'
- *
+ *
* @since 3.0
*/
- public String getCatchpointType() {
- return catchpointType;
- }
-
- public boolean isTemporary() {
- return getDisposition().equals("del"); //$NON-NLS-1$
- }
-
- /**
- * Will return true if we are dealing with a hardware breakpoint.
- * Note that this method will return false for tracepoint, even
- * if it is a fast tracepoint.
- */
- public boolean isHardware() {
- return isHdw;
- }
+ public String getCatchpointType() {
+ return catchpointType;
+ }
+
+ public boolean isTemporary() {
+ return getDisposition().equals("del"); //$NON-NLS-1$
+ }
+
+ /**
+ * Will return true if we are dealing with a hardware breakpoint.
+ * Note that this method will return false for tracepoint, even
+ * if it is a fast tracepoint.
+ */
+ public boolean isHardware() {
+ return isHdw;
+ }
public void setHardware(boolean b) {
- isHdw = b;
+ isHdw = b;
}
- public boolean isWatchpoint() {
- return isWpt;
- }
+ public boolean isWatchpoint() {
+ return isWpt;
+ }
public void isWatchpoint(boolean b) {
isWpt = b;
}
- public boolean isAccessWatchpoint() {
- return isAWpt;
- }
+ public boolean isAccessWatchpoint() {
+ return isAWpt;
+ }
public void setAccessWatchpoint(boolean b) {
isWpt = b;
- isAWpt = b;
+ isAWpt = b;
}
- public boolean isReadWatchpoint() {
- return isRWpt;
- }
+ public boolean isReadWatchpoint() {
+ return isRWpt;
+ }
public void setReadWatchpoint(boolean b) {
isWpt = b;
isRWpt = b;
}
- public boolean isWriteWatchpoint() {
- return isWWpt;
- }
+ public boolean isWriteWatchpoint() {
+ return isWWpt;
+ }
public void setWriteWatchpoint(boolean b) {
isWpt = b;
isWWpt = b;
}
- /**
- * Return whether this breakpoint is actually a tracepoint.
- * This method will return true for both fast and normal tracepoints.
- * To know of fast vs normal tracepoint use {@link getType()} and look
- * for "tracepoint" or "fast tracepoint"
- *
+ /**
+ * Return whether this breakpoint is actually a tracepoint.
+ * This method will return true for both fast and normal tracepoints.
+ * To know of fast vs normal tracepoint use {@link getType()} and look
+ * for "tracepoint" or "fast tracepoint"
+ *
* @since 3.0
*/
- public boolean isTracepoint() {
- return isTpt;
- }
-
- /**
- * Indicates if we are dealing with a catchpoint.
- *
+ public boolean isTracepoint() {
+ return isTpt;
+ }
+
+ /**
+ * Indicates if we are dealing with a catchpoint.
+ *
* @since 3.0
*/
- public boolean isCatchpoint() {
- return isCatchpoint;
- }
+ public boolean isCatchpoint() {
+ return isCatchpoint;
+ }
- /**
- * Indicates if we are dealing with a dynamic printf.
- *
+ /**
+ * Indicates if we are dealing with a dynamic printf.
+ *
* @since 4.4
*/
- public boolean isDynamicPrintf() {
- return isDynPrintf;
- }
-
- /**
- * Returns the passcount of a tracepoint. Will return 0 if this
- * breakpoint is not a tracepoint.
- *
+ public boolean isDynamicPrintf() {
+ return isDynPrintf;
+ }
+
+ /**
+ * Returns the passcount of a tracepoint. Will return 0 if this
+ * breakpoint is not a tracepoint.
+ *
* @since 3.0
*/
- public int getPassCount() {
- return passcount;
- }
+ public int getPassCount() {
+ return passcount;
+ }
- /**
- * Set the passcount of a tracepoint. Will not do anything if
- * this breakpoint is not a tracepoint.
+ /**
+ * Set the passcount of a tracepoint. Will not do anything if
+ * this breakpoint is not a tracepoint.
* @since 3.0
*/
- public void setPassCount(int count) {
- if (isTpt == false) return;
- passcount = count;
- }
-
- /**
- * Return the commands associated with this breakpoint (or tracepoint)
- *
+ public void setPassCount(int count) {
+ if (isTpt == false)
+ return;
+ passcount = count;
+ }
+
+ /**
+ * Return the commands associated with this breakpoint (or tracepoint)
+ *
* @since 3.0
*/
- public String getCommands() {
- return commands;
- }
+ public String getCommands() {
+ return commands;
+ }
- /**
- * Sets the commands associated with this breakpoint (or tracepoint)
- *
+ /**
+ * Sets the commands associated with this breakpoint (or tracepoint)
+ *
* @since 3.0
*/
- public void setCommands(String cmds) {
- commands = cmds;
- }
-
- /**
- * Return the string the dynamic printf will print.
- * Returns null if this breakpoint is not a dynamic printf
- *
+ public void setCommands(String cmds) {
+ commands = cmds;
+ }
+
+ /**
+ * Return the string the dynamic printf will print.
+ * Returns null if this breakpoint is not a dynamic printf
+ *
* @since 4.4
*/
- public String getPrintfString() {
- if (!isDynamicPrintf()) return null;
-
- if (printfString == null) {
- // The string is burried inside the list of commands.
- // There should be only one command so we shouldn't need the delimiter but it does
- // not hurt to use it. This delimeter is inserted when we parse the commands
- // from the result obtained from GDB
- String[] commands = getCommands().split(TracepointActionManager.TRACEPOINT_ACTION_DELIMITER);
- final String printfToken = "printf"; //$NON-NLS-1$
- for (String cmd : commands) {
- int pos = cmd.indexOf(printfToken);
- if (pos != -1) {
- printfString = cmd.substring(pos + printfToken.length() + 1);
- }
- }
- // assert false : "Could not get printf string from gdb output"; //$NON-NLS-1$
- }
+ public String getPrintfString() {
+ if (!isDynamicPrintf())
+ return null;
+
+ if (printfString == null) {
+ // The string is burried inside the list of commands.
+ // There should be only one command so we shouldn't need the delimiter but it does
+ // not hurt to use it. This delimeter is inserted when we parse the commands
+ // from the result obtained from GDB
+ String[] commands = getCommands().split(TracepointActionManager.TRACEPOINT_ACTION_DELIMITER);
+ final String printfToken = "printf"; //$NON-NLS-1$
+ for (String cmd : commands) {
+ int pos = cmd.indexOf(printfToken);
+ if (pos != -1) {
+ printfString = cmd.substring(pos + printfToken.length() + 1);
+ }
+ }
+ // assert false : "Could not get printf string from gdb output"; //$NON-NLS-1$
+ }
return printfString;
- }
-
- /**
- * Returns wether this breakpoint is pending
- *
- * @since 4.0
- */
- public boolean isPending() {
- return pending;
- }
-
- /**
- * Returns the thread-groups to which this breakpoint applies.
- * Returns null if the data is not known.
- *
- * @since 4.2
- */
- public String[] getGroupIds() {
- return groupIds;
- }
-
- /**
- * Sets the list of thread-groups to which this breakpoint applies.
- *
- * @since 4.2
- */
- public void setGroupIds(String[] groups) {
- groupIds = groups;
- }
-
- // Parse the result string
- void parse(MITuple tuple) {
- MIResult[] results = tuple.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- MIValue value = results[i].getMIValue();
- String str = ""; //$NON-NLS-1$
- if (value != null && value instanceof MIConst) {
- str = ((MIConst)value).getCString();
- }
-
- if (var.equals("number")) { //$NON-NLS-1$
- number = str.trim();
- } else if (var.equals("type")) { //$NON-NLS-1$
+ }
+
+ /**
+ * Returns wether this breakpoint is pending
+ *
+ * @since 4.0
+ */
+ public boolean isPending() {
+ return pending;
+ }
+
+ /**
+ * Returns the thread-groups to which this breakpoint applies.
+ * Returns null if the data is not known.
+ *
+ * @since 4.2
+ */
+ public String[] getGroupIds() {
+ return groupIds;
+ }
+
+ /**
+ * Sets the list of thread-groups to which this breakpoint applies.
+ *
+ * @since 4.2
+ */
+ public void setGroupIds(String[] groups) {
+ groupIds = groups;
+ }
+
+ // Parse the result string
+ void parse(MITuple tuple) {
+ MIResult[] results = tuple.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ MIValue value = results[i].getMIValue();
+ String str = ""; //$NON-NLS-1$
+ if (value != null && value instanceof MIConst) {
+ str = ((MIConst) value).getCString();
+ }
+
+ if (var.equals("number")) { //$NON-NLS-1$
+ number = str.trim();
+ } else if (var.equals("type")) { //$NON-NLS-1$
// Note that catchpoints are reported by gdb as address
// breakpoints; there's really nothing we can go on to determine
// that it's actually a catchpoint (short of using a really ugly
// and fragile hack--looking at the 'what' field for specific values)
-
- type = str;
- //type="hw watchpoint"
- if (type.startsWith("hw")) { //$NON-NLS-1$
- isHdw = true;
+
+ type = str;
+ //type="hw watchpoint"
+ if (type.startsWith("hw")) { //$NON-NLS-1$
+ isHdw = true;
if (type.indexOf("watchpoint") != -1) { //$NON-NLS-1$
isWWpt = true;
isWpt = true;
}
- }
- //type="acc watchpoint"
- if (type.startsWith("acc")) { //$NON-NLS-1$
- isAWpt = true;
- isWpt = true;
- }
- //type="read watchpoint"
- if (type.startsWith("read")) { //$NON-NLS-1$
- isRWpt = true;
- isWpt = true;
- }
- if (type.startsWith("tracepoint") || //$NON-NLS-1$
- type.startsWith("fast tracepoint")) { //$NON-NLS-1$
- isTpt = true;
- }
- if (type.startsWith("catchpoint")) { //$NON-NLS-1$
- isCatchpoint = true;
- }
- if (type.startsWith("dprintf")) { //$NON-NLS-1$
- isDynPrintf = true;
- }
- // type="breakpoint"
- // default ok.
- } else if (var.equals("disp")) { //$NON-NLS-1$
- disp = str;
- } else if (var.equals("enabled")) { //$NON-NLS-1$
- enabled = str.equals("y"); //$NON-NLS-1$
- } else if (var.equals("addr")) { //$NON-NLS-1$
- address = str.trim();
- } else if (var.equals("func")) { //$NON-NLS-1$
- func = str;
- } else if (var.equals("file")) { //$NON-NLS-1$
- file = str;
- } else if (var.equals("fullname")) { //$NON-NLS-1$
- fullName = str;
- } else if (var.equals("thread")) { //$NON-NLS-1$
- threadId = str;
- } else if (var.equals("line")) { //$NON-NLS-1$
- try {
- line = Integer.parseInt(str.trim());
- } catch (NumberFormatException e) {
- }
- } else if (var.equals("times")) { //$NON-NLS-1$
- try {
- times = Integer.parseInt(str.trim());
- } catch (NumberFormatException e) {
- }
- } else if (var.equals("what") || var.equals("exp")) { //$NON-NLS-1$ //$NON-NLS-2$
- exp = str;
- } else if (var.equals("ignore")) { //$NON-NLS-1$
- try {
- ignore = Integer.parseInt(str.trim());
- } catch (NumberFormatException e) {
- }
- } else if (var.equals("pass")) { //$NON-NLS-1$
- try {
- passcount = Integer.parseInt(str.trim());
- } catch (NumberFormatException e) {
- }
- } else if (var.equals("cond")) { //$NON-NLS-1$
- cond = str;
- } else if (var.equals("pending")) { //$NON-NLS-1$
- // Only supported starting with GDB 6.8
- pending = true;
- } else if (var.equals("script")) { //$NON-NLS-1$
- if (value instanceof MITuple) {
- parseCommands((MITuple)value);
- }
- } else if (var.equals("thread-groups")) { //$NON-NLS-1$
- if (value instanceof MIList) {
- parseGroups((MIList)value);
- }
- } else if (var.equals("original-location")) { //$NON-NLS-1$
- originalLocation = str;
- }
- }
- }
-
- void parseCommands(MITuple tuple) {
- MIValue[] values = tuple.getMIValues();
- StringBuilder cmds = new StringBuilder();
- for (int i = 0; i < values.length; i++) {
- MIValue value = values[i];
- if (value != null && value instanceof MIConst) {
- if (i > 0) {
- // Insert a delimiter
- cmds.append(TracepointActionManager.TRACEPOINT_ACTION_DELIMITER);
- }
- cmds.append(((MIConst)value).getCString());
- }
- }
- setCommands(cmds.toString());
-
- }
-
- private void parseGroups(MIList list) {
+ }
+ //type="acc watchpoint"
+ if (type.startsWith("acc")) { //$NON-NLS-1$
+ isAWpt = true;
+ isWpt = true;
+ }
+ //type="read watchpoint"
+ if (type.startsWith("read")) { //$NON-NLS-1$
+ isRWpt = true;
+ isWpt = true;
+ }
+ if (type.startsWith("tracepoint") || //$NON-NLS-1$
+ type.startsWith("fast tracepoint")) { //$NON-NLS-1$
+ isTpt = true;
+ }
+ if (type.startsWith("catchpoint")) { //$NON-NLS-1$
+ isCatchpoint = true;
+ }
+ if (type.startsWith("dprintf")) { //$NON-NLS-1$
+ isDynPrintf = true;
+ }
+ // type="breakpoint"
+ // default ok.
+ } else if (var.equals("disp")) { //$NON-NLS-1$
+ disp = str;
+ } else if (var.equals("enabled")) { //$NON-NLS-1$
+ enabled = str.equals("y"); //$NON-NLS-1$
+ } else if (var.equals("addr")) { //$NON-NLS-1$
+ address = str.trim();
+ } else if (var.equals("func")) { //$NON-NLS-1$
+ func = str;
+ } else if (var.equals("file")) { //$NON-NLS-1$
+ file = str;
+ } else if (var.equals("fullname")) { //$NON-NLS-1$
+ fullName = str;
+ } else if (var.equals("thread")) { //$NON-NLS-1$
+ threadId = str;
+ } else if (var.equals("line")) { //$NON-NLS-1$
+ try {
+ line = Integer.parseInt(str.trim());
+ } catch (NumberFormatException e) {
+ }
+ } else if (var.equals("times")) { //$NON-NLS-1$
+ try {
+ times = Integer.parseInt(str.trim());
+ } catch (NumberFormatException e) {
+ }
+ } else if (var.equals("what") || var.equals("exp")) { //$NON-NLS-1$ //$NON-NLS-2$
+ exp = str;
+ } else if (var.equals("ignore")) { //$NON-NLS-1$
+ try {
+ ignore = Integer.parseInt(str.trim());
+ } catch (NumberFormatException e) {
+ }
+ } else if (var.equals("pass")) { //$NON-NLS-1$
+ try {
+ passcount = Integer.parseInt(str.trim());
+ } catch (NumberFormatException e) {
+ }
+ } else if (var.equals("cond")) { //$NON-NLS-1$
+ cond = str;
+ } else if (var.equals("pending")) { //$NON-NLS-1$
+ // Only supported starting with GDB 6.8
+ pending = true;
+ } else if (var.equals("script")) { //$NON-NLS-1$
+ if (value instanceof MITuple) {
+ parseCommands((MITuple) value);
+ }
+ } else if (var.equals("thread-groups")) { //$NON-NLS-1$
+ if (value instanceof MIList) {
+ parseGroups((MIList) value);
+ }
+ } else if (var.equals("original-location")) { //$NON-NLS-1$
+ originalLocation = str;
+ }
+ }
+ }
+
+ void parseCommands(MITuple tuple) {
+ MIValue[] values = tuple.getMIValues();
+ StringBuilder cmds = new StringBuilder();
+ for (int i = 0; i < values.length; i++) {
+ MIValue value = values[i];
+ if (value != null && value instanceof MIConst) {
+ if (i > 0) {
+ // Insert a delimiter
+ cmds.append(TracepointActionManager.TRACEPOINT_ACTION_DELIMITER);
+ }
+ cmds.append(((MIConst) value).getCString());
+ }
+ }
+ setCommands(cmds.toString());
+
+ }
+
+ private void parseGroups(MIList list) {
List<String> groups = new ArrayList<String>();
-
+
MIValue[] values = list.getMIValues();
for (int i = 0; i < values.length; i++) {
if (values[i] instanceof MIConst) {
- groups.add(((MIConst)values[i]).getCString());
+ groups.add(((MIConst) values[i]).getCString());
}
}
-
+
groupIds = groups.toArray(new String[groups.size()]);
- }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIConst.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIConst.java
index 836bfd532e2..08c09a2d746 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIConst.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIConst.java
@@ -22,31 +22,31 @@ package org.eclipse.cdt.dsf.mi.service.command.output;
* GDB/MI const value represents a ios-c string.
*/
public class MIConst extends MIValue {
-
- private String cstring = ""; //$NON-NLS-1$
-
- public String getCString() {
- return cstring;
- }
-
- public void setCString(String str) {
- cstring = str;
- }
-
- /**
- * Translates the C string value into a string which is suitable for display to a human.
- * @return The translated string.
- */
- public String getString() {
- return MIStringHandler.translateCString(cstring, true);
- }
-
- public static String getString(String str) {
- return MIStringHandler.translateCString(str, true);
- }
-
- @Override
- public String toString() {
- return getCString();
- }
+
+ private String cstring = ""; //$NON-NLS-1$
+
+ public String getCString() {
+ return cstring;
+ }
+
+ public void setCString(String str) {
+ cstring = str;
+ }
+
+ /**
+ * Translates the C string value into a string which is suitable for display to a human.
+ * @return The translated string.
+ */
+ public String getString() {
+ return MIStringHandler.translateCString(cstring, true);
+ }
+
+ public static String getString(String str) {
+ return MIStringHandler.translateCString(str, true);
+ }
+
+ @Override
+ public String toString() {
+ return getCString();
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDataDisassembleInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDataDisassembleInfo.java
index 7bf78fd94b1..0aab7da1ea8 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDataDisassembleInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDataDisassembleInfo.java
@@ -21,7 +21,7 @@ import java.util.List;
/**
* The parsed output of the data-disassemble command. The output format is
* determined by the mode field on the request.
- *
+ *
* -data-disassemble -s $pc -e "$pc + 20" -- 0
* ^done,asm_insns=[
* {address="0x000107c0",func-name="main",offset="4",inst="mov 2, %o0"},
@@ -29,7 +29,7 @@ import java.util.List;
* {address="0x000107c8",func-name="main",offset="12",inst="or %o2, 0x140, %o1\t! 0x11940 <_lib_version+8>"},
* {address="0x000107cc",func-name="main",offset="16",inst="sethi %hi(0x11800), %o2"},
* {address="0x000107d0",func-name="main",offset="20",inst="or %o2, 0x168, %o4\t! 0x11968 <_lib_version+48>"}]
- *
+ *
* -data-disassemble -f basics.c -l 32 -- 0
* ^done,asm_insns=[
* {address="0x000107bc",func-name="main",offset="0",inst="save %sp, -112, %sp"},
@@ -38,7 +38,7 @@ import java.util.List;
* [...]
* {address="0x0001081c",func-name="main",offset="96",inst="ret "},
* {address="0x00010820",func-name="main",offset="100",inst="restore "}]
- *
+ *
* -data-disassemble -f basics.c -l 32 -n 3 -- 1
* ^done,asm_insns=[
* src_and_asm_line={line="31",file="/dir1/dir2/basics.c",line_asm_insn=[
@@ -46,122 +46,121 @@ import java.util.List;
* src_and_asm_line={line="32",file="/dir1/dir2/basics.c",line_asm_insn=[
* {address="0x000107c0",func-name="main",offset="4",inst="mov 2, %o0"},
* {address="0x000107c4",func-name="main",offset="8",inst="sethi %hi(0x11800), %o2"}]}]
- *
+ *
*/
public class MIDataDisassembleInfo extends MIInfo {
- // The parsed information
- private boolean mixed;
- private MIMixedInstruction[] mixedCode;
- private MIInstruction[] assemblyCode;
-
- public MIDataDisassembleInfo(MIOutput record) {
- super(record);
- mixed = false;
- parse();
- }
-
- public boolean isMixed() {
- return mixed;
- }
-
- public MIInstruction[] getMIAssemblyCode() {
- return assemblyCode;
- }
-
- public MIMixedInstruction[] getMIMixedCode() {
- return mixedCode;
- }
-
- /**
- * Find the relevant tag in the output record ("asm_insns") and then
- * parse its value.
- */
- private void parse() {
- List<MIInstruction> asmList = new ArrayList<MIInstruction>();
- List<MIMixedInstruction> srcList = new ArrayList<MIMixedInstruction>();
-
- if (isDone()) {
- MIOutput out = getMIOutput();
- MIResultRecord rr = out.getMIResultRecord();
- if (rr != null) {
- MIResult[] results = rr.getMIResults();
- // Technically, there should be only one field (asm_insns), but just in case...
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- if (var.equals("asm_insns")) { //$NON-NLS-1$
- MIValue value = results[i].getMIValue();
- if (value instanceof MIList) {
- parseResult((MIList) value, srcList, asmList);
- }
- }
- }
- }
- }
-
- assemblyCode = asmList.toArray(new MIInstruction[asmList.size()]);
- mixedCode = srcList.toArray(new MIMixedInstruction[srcList.size()]);
- }
-
- /**
- * Parse the back-end result. Depending on the requested mode
- * ("-- 0" or "-- 1" on the request), the result has one of the
- * following forms:
- *
- * [1] Mode == 0 (assembly instructions only)
- * {address="0x000107c0",func-name="main",offset="4",inst="mov 2, %o0"},
- * {address="0x000107c4",func-name="main",offset="8",inst="sethi %hi(0x11800), %o2"},
- * ...,
- * {address="0x00010820",func-name="main",offset="100",inst="restore "}
- *
- * [2] Mode == 1 (Mixed source and assembly code)
- * src_and_asm_line={
- * line="31",file="/dir1/dir2/basics.c",
- * line_asm_insn=[
- * {address="0x000107c0",func-name="main",offset="4",inst="mov 2, %o0"},
- * {address="0x000107c4",func-name="main",offset="8",inst="sethi %hi(0x11800), %o2"},
- * ...,
- * {address="0x00010820",func-name="main",offset="100",inst="restore "}
- * ]
- * },
- * ...,
- * src_and_asm_line={
- * line="31",file="/dir1/dir2/basics.c",
- * line_asm_insn=[
- * ...,
- * ]
- * }
- */
- private void parseResult(MIList list,
- List<MIMixedInstruction> srcList, List<MIInstruction> asmList) {
-
- // Mixed mode (with source)
- MIResult[] results = list.getMIResults();
- if (results != null && results.length > 0) {
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- if (var.equals("src_and_asm_line")) { //$NON-NLS-1$
- MIValue value = results[i].getMIValue();
- if (value instanceof MITuple) {
- srcList.add(new MIMixedInstruction((MITuple) value));
- }
- }
- }
- mixed = true;
- }
-
- // Non-mixed mode
- MIValue[] values = list.getMIValues();
- if (values != null && values.length > 0) {
- for (int i = 0; i < values.length; i++) {
- if (values[i] instanceof MITuple) {
- asmList.add(new MIInstruction((MITuple) values[i]));
- }
- }
- mixed = false;
- }
-
- }
+ // The parsed information
+ private boolean mixed;
+ private MIMixedInstruction[] mixedCode;
+ private MIInstruction[] assemblyCode;
+
+ public MIDataDisassembleInfo(MIOutput record) {
+ super(record);
+ mixed = false;
+ parse();
+ }
+
+ public boolean isMixed() {
+ return mixed;
+ }
+
+ public MIInstruction[] getMIAssemblyCode() {
+ return assemblyCode;
+ }
+
+ public MIMixedInstruction[] getMIMixedCode() {
+ return mixedCode;
+ }
+
+ /**
+ * Find the relevant tag in the output record ("asm_insns") and then
+ * parse its value.
+ */
+ private void parse() {
+ List<MIInstruction> asmList = new ArrayList<MIInstruction>();
+ List<MIMixedInstruction> srcList = new ArrayList<MIMixedInstruction>();
+
+ if (isDone()) {
+ MIOutput out = getMIOutput();
+ MIResultRecord rr = out.getMIResultRecord();
+ if (rr != null) {
+ MIResult[] results = rr.getMIResults();
+ // Technically, there should be only one field (asm_insns), but just in case...
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ if (var.equals("asm_insns")) { //$NON-NLS-1$
+ MIValue value = results[i].getMIValue();
+ if (value instanceof MIList) {
+ parseResult((MIList) value, srcList, asmList);
+ }
+ }
+ }
+ }
+ }
+
+ assemblyCode = asmList.toArray(new MIInstruction[asmList.size()]);
+ mixedCode = srcList.toArray(new MIMixedInstruction[srcList.size()]);
+ }
+
+ /**
+ * Parse the back-end result. Depending on the requested mode
+ * ("-- 0" or "-- 1" on the request), the result has one of the
+ * following forms:
+ *
+ * [1] Mode == 0 (assembly instructions only)
+ * {address="0x000107c0",func-name="main",offset="4",inst="mov 2, %o0"},
+ * {address="0x000107c4",func-name="main",offset="8",inst="sethi %hi(0x11800), %o2"},
+ * ...,
+ * {address="0x00010820",func-name="main",offset="100",inst="restore "}
+ *
+ * [2] Mode == 1 (Mixed source and assembly code)
+ * src_and_asm_line={
+ * line="31",file="/dir1/dir2/basics.c",
+ * line_asm_insn=[
+ * {address="0x000107c0",func-name="main",offset="4",inst="mov 2, %o0"},
+ * {address="0x000107c4",func-name="main",offset="8",inst="sethi %hi(0x11800), %o2"},
+ * ...,
+ * {address="0x00010820",func-name="main",offset="100",inst="restore "}
+ * ]
+ * },
+ * ...,
+ * src_and_asm_line={
+ * line="31",file="/dir1/dir2/basics.c",
+ * line_asm_insn=[
+ * ...,
+ * ]
+ * }
+ */
+ private void parseResult(MIList list, List<MIMixedInstruction> srcList, List<MIInstruction> asmList) {
+
+ // Mixed mode (with source)
+ MIResult[] results = list.getMIResults();
+ if (results != null && results.length > 0) {
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ if (var.equals("src_and_asm_line")) { //$NON-NLS-1$
+ MIValue value = results[i].getMIValue();
+ if (value instanceof MITuple) {
+ srcList.add(new MIMixedInstruction((MITuple) value));
+ }
+ }
+ }
+ mixed = true;
+ }
+
+ // Non-mixed mode
+ MIValue[] values = list.getMIValues();
+ if (values != null && values.length > 0) {
+ for (int i = 0; i < values.length; i++) {
+ if (values[i] instanceof MITuple) {
+ asmList.add(new MIInstruction((MITuple) values[i]));
+ }
+ }
+ mixed = false;
+ }
+
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDataEvaluateExpressionInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDataEvaluateExpressionInfo.java
index 3fbc231c0ba..d31d1b31ef8 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDataEvaluateExpressionInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDataEvaluateExpressionInfo.java
@@ -22,24 +22,24 @@ package org.eclipse.cdt.dsf.mi.service.command.output;
*/
public class MIDataEvaluateExpressionInfo extends MIInfo {
- String fValue;
+ String fValue;
- public MIDataEvaluateExpressionInfo(MIOutput rr) {
- super(rr);
- fValue = ""; //$NON-NLS-1$
- if (isDone()) {
- MIOutput out = getMIOutput();
- MIResultRecord outr = out.getMIResultRecord();
- if (outr != null) {
- MIValue value = outr.getField("value"); //$NON-NLS-1$
- if (value instanceof MIConst) {
- fValue = ((MIConst)value).getString();
- }
- }
- }
- }
+ public MIDataEvaluateExpressionInfo(MIOutput rr) {
+ super(rr);
+ fValue = ""; //$NON-NLS-1$
+ if (isDone()) {
+ MIOutput out = getMIOutput();
+ MIResultRecord outr = out.getMIResultRecord();
+ if (outr != null) {
+ MIValue value = outr.getField("value"); //$NON-NLS-1$
+ if (value instanceof MIConst) {
+ fValue = ((MIConst) value).getString();
+ }
+ }
+ }
+ }
- public String getValue() {
- return fValue;
- }
+ public String getValue() {
+ return fValue;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDataListRegisterNamesInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDataListRegisterNamesInfo.java
index d02e19a5800..713a15ffe01 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDataListRegisterNamesInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDataListRegisterNamesInfo.java
@@ -23,60 +23,60 @@ import java.util.List;
*/
public class MIDataListRegisterNamesInfo extends MIInfo {
- String[] names;
- protected int realNameCount = 0;
+ String[] names;
+ protected int realNameCount = 0;
- public MIDataListRegisterNamesInfo(MIOutput rr) {
- super(rr);
- names = null;
- List<String> aList = new ArrayList<String>();
- if (isDone()) {
- MIOutput out = getMIOutput();
- MIResultRecord outr = out.getMIResultRecord();
- if (outr != null) {
- MIResult[] results = outr.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- if (var.equals("register-names")) { //$NON-NLS-1$
- MIValue value = results[i].getMIValue();
- if (value instanceof MIList) {
- parseRegisters((MIList) value, aList);
- }
- }
- }
- }
- }
- names = aList.toArray(new String[aList.size()]);
- }
+ public MIDataListRegisterNamesInfo(MIOutput rr) {
+ super(rr);
+ names = null;
+ List<String> aList = new ArrayList<String>();
+ if (isDone()) {
+ MIOutput out = getMIOutput();
+ MIResultRecord outr = out.getMIResultRecord();
+ if (outr != null) {
+ MIResult[] results = outr.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ if (var.equals("register-names")) { //$NON-NLS-1$
+ MIValue value = results[i].getMIValue();
+ if (value instanceof MIList) {
+ parseRegisters((MIList) value, aList);
+ }
+ }
+ }
+ }
+ }
+ names = aList.toArray(new String[aList.size()]);
+ }
- /*
- * Returns the register names.
- */
- public String[] getRegisterNames() {
-
- /*
- * The expectation is that we return an empty list. The
- * constructor quarantees this so we are good here.
- */
- return names;
- }
+ /*
+ * Returns the register names.
+ */
+ public String[] getRegisterNames() {
- private void parseRegisters(MIList list, List<String> aList) {
- MIValue[] values = list.getMIValues();
- for (int i = 0; i < values.length; i++) {
- if (values[i] instanceof MIConst) {
- String str = ((MIConst) values[i]).getCString();
+ /*
+ * The expectation is that we return an empty list. The
+ * constructor quarantees this so we are good here.
+ */
+ return names;
+ }
- /* this cannot filter nulls because index is critical in retreival
- * and index is assigned in the layers above. The MI spec allows
- * empty returns, for some register names. */
- if (str != null && !str.isEmpty()) {
- realNameCount++;
- aList.add(str);
- } else {
- aList.add(""); //$NON-NLS-1$
- }
- }
- }
- }
+ private void parseRegisters(MIList list, List<String> aList) {
+ MIValue[] values = list.getMIValues();
+ for (int i = 0; i < values.length; i++) {
+ if (values[i] instanceof MIConst) {
+ String str = ((MIConst) values[i]).getCString();
+
+ /* this cannot filter nulls because index is critical in retreival
+ * and index is assigned in the layers above. The MI spec allows
+ * empty returns, for some register names. */
+ if (str != null && !str.isEmpty()) {
+ realNameCount++;
+ aList.add(str);
+ } else {
+ aList.add(""); //$NON-NLS-1$
+ }
+ }
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDataListRegisterValuesInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDataListRegisterValuesInfo.java
index bae2353d60a..1c25c653efb 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDataListRegisterValuesInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDataListRegisterValuesInfo.java
@@ -27,81 +27,81 @@ import org.eclipse.cdt.dsf.mi.service.command.commands.MIDataListRegisterValues;
*/
public class MIDataListRegisterValuesInfo extends MIInfo {
- MIRegisterValue[] registers;
+ MIRegisterValue[] registers;
- public MIDataListRegisterValuesInfo(MIOutput rr) {
- super(rr);
- registers = null;
- if (isDone()) {
- MIOutput out = getMIOutput();
- MIResultRecord outr = out.getMIResultRecord();
- if (outr != null) {
- MIResult[] results = outr.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- if (var.equals("register-values")) { //$NON-NLS-1$
- MIValue value = results[i].getMIValue();
- if (value instanceof MIList) {
- registers = MIRegisterValue.getMIRegisterValues((MIList)value);
- }
- }
- }
- }
- }
- if (registers == null) {
- registers = new MIRegisterValue[0];
- }
- }
-
- /*
- * Returns the array of registers values.
- */
+ public MIDataListRegisterValuesInfo(MIOutput rr) {
+ super(rr);
+ registers = null;
+ if (isDone()) {
+ MIOutput out = getMIOutput();
+ MIResultRecord outr = out.getMIResultRecord();
+ if (outr != null) {
+ MIResult[] results = outr.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ if (var.equals("register-values")) { //$NON-NLS-1$
+ MIValue value = results[i].getMIValue();
+ if (value instanceof MIList) {
+ registers = MIRegisterValue.getMIRegisterValues((MIList) value);
+ }
+ }
+ }
+ }
+ }
+ if (registers == null) {
+ registers = new MIRegisterValue[0];
+ }
+ }
- public MIRegisterValue[] getMIRegisterValues() {
-
- /*
- * The expectation is that we return an empty list. The
- * constructor quarantees this so we are good here.
- */
- return registers;
- }
+ /*
+ * Returns the array of registers values.
+ */
- /**
- * Returns the desired subset of results. When this function is being called
- * the data here represents a coalesced request which is a superset of at
- * least two original requests. We are extracting the data associated with
- * the specified original request which we know is contained in this result.
- */
- @Override
- public <V extends ICommandResult> V getSubsetResult(ICommand<V> cmd) {
- if (cmd instanceof MIDataListRegisterValues) {
- MIDataListRegisterValues command = (MIDataListRegisterValues) cmd;
- List<MIRegisterValue> aList = new ArrayList<MIRegisterValue>();
- int[] wantedRegNos = command.getRegList();
-
- /*
- * Search through the larger answer set finding the ones we want.
- */
- for (MIRegisterValue regVal : registers) {
- for ( int curRegNo : wantedRegNos ) {
- if ( regVal.getNumber() == curRegNo ) {
- aList.add( regVal );
- }
- }
- }
-
- /*
- * Now construct a new complete answer.
- */
- MIRegisterValue[] finalRegSet = aList.toArray(new MIRegisterValue[aList.size()]);
- MIDataListRegisterValuesInfo finalSubset = new MIDataListRegisterValuesInfo( getMIOutput());
- finalSubset.registers = finalRegSet;
-
- @SuppressWarnings("unchecked")
- V vFinalSubset = (V)finalSubset;
- return vFinalSubset ;
- } else {
- return super.getSubsetResult(cmd);
- }
- }
+ public MIRegisterValue[] getMIRegisterValues() {
+
+ /*
+ * The expectation is that we return an empty list. The
+ * constructor quarantees this so we are good here.
+ */
+ return registers;
+ }
+
+ /**
+ * Returns the desired subset of results. When this function is being called
+ * the data here represents a coalesced request which is a superset of at
+ * least two original requests. We are extracting the data associated with
+ * the specified original request which we know is contained in this result.
+ */
+ @Override
+ public <V extends ICommandResult> V getSubsetResult(ICommand<V> cmd) {
+ if (cmd instanceof MIDataListRegisterValues) {
+ MIDataListRegisterValues command = (MIDataListRegisterValues) cmd;
+ List<MIRegisterValue> aList = new ArrayList<MIRegisterValue>();
+ int[] wantedRegNos = command.getRegList();
+
+ /*
+ * Search through the larger answer set finding the ones we want.
+ */
+ for (MIRegisterValue regVal : registers) {
+ for (int curRegNo : wantedRegNos) {
+ if (regVal.getNumber() == curRegNo) {
+ aList.add(regVal);
+ }
+ }
+ }
+
+ /*
+ * Now construct a new complete answer.
+ */
+ MIRegisterValue[] finalRegSet = aList.toArray(new MIRegisterValue[aList.size()]);
+ MIDataListRegisterValuesInfo finalSubset = new MIDataListRegisterValuesInfo(getMIOutput());
+ finalSubset.registers = finalRegSet;
+
+ @SuppressWarnings("unchecked")
+ V vFinalSubset = (V) finalSubset;
+ return vFinalSubset;
+ } else {
+ return super.getSubsetResult(cmd);
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDataReadMemoryBytesInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDataReadMemoryBytesInfo.java
index ed1ac4ed45a..9f8378edb5d 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDataReadMemoryBytesInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDataReadMemoryBytesInfo.java
@@ -10,16 +10,16 @@
*
* Contributors:
* Vladimir Prus (CodeSourcery) - Initial API and implementation
- * Alvaro Sanchez-Leon (Ericsson AB) - [Memory] Support 16 bit addressable size (Bug 426730)
+ * Alvaro Sanchez-Leon (Ericsson AB) - [Memory] Support 16 bit addressable size (Bug 426730)
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command.output;
import org.eclipse.debug.core.model.MemoryByte;
-/**
+/**
* Example output is:
- *
+ *
* (gdb)
* -data-read-memory-bytes &a 10
* ^done,memory=[{begin="0xbffff154",offset="0x00000000",
@@ -28,7 +28,7 @@ import org.eclipse.debug.core.model.MemoryByte;
* @since 4.0
*/
public class MIDataReadMemoryBytesInfo extends MIInfo {
-
+
/**
* Default Addressable size in octets
*/
@@ -39,7 +39,7 @@ public class MIDataReadMemoryBytesInfo extends MIInfo {
public MIDataReadMemoryBytesInfo(MIOutput output, int size) {
this(output, size, DEFAULT_WORD_SIZE);
}
-
+
/**
* @param count - Number of Addressable units
* @param word_size - Addressable size in octets
@@ -49,17 +49,16 @@ public class MIDataReadMemoryBytesInfo extends MIInfo {
super(output);
parse(count, word_size);
}
-
+
/**
* Return the memory block
*/
- public MemoryByte[] getMIMemoryBlock() {
- return fBlock;
+ public MemoryByte[] getMIMemoryBlock() {
+ return fBlock;
}
-
- private void parse(int count, int word_size)
- {
- fBlock = new MemoryByte[count*word_size];
+
+ private void parse(int count, int word_size) {
+ fBlock = new MemoryByte[count * word_size];
// Fill the block with invalid bytes, initially.
for (int i = 0; i < fBlock.length; i++)
fBlock[i] = new MemoryByte((byte) 0, (byte) 0);
@@ -69,7 +68,7 @@ public class MIDataReadMemoryBytesInfo extends MIInfo {
for (int i = 0; i < results.length; i++) {
if (results[i].getVariable().equals("memory")) //$NON-NLS-1$
- {
+ {
MIList v = (MIList) (results[i].getMIValue());
try {
for (int j = 0; j < v.getMIValues().length; ++j) {
@@ -80,8 +79,7 @@ public class MIDataReadMemoryBytesInfo extends MIInfo {
MIResult r = b.getMIResults()[k];
if (r.getVariable().equals("offset")) //$NON-NLS-1$
{
- String offset_s = ((MIConst) r.getMIValue())
- .getCString();
+ String offset_s = ((MIConst) r.getMIValue()).getCString();
offset = Integer.decode(offset_s);
} else if (r.getVariable().equals("contents")) //$NON-NLS-1$
{
@@ -89,17 +87,13 @@ public class MIDataReadMemoryBytesInfo extends MIInfo {
}
}
- if (offset*word_size + contents.length()/2 <= count*word_size)
+ if (offset * word_size + contents.length() / 2 <= count * word_size)
for (int k = 0; k < contents.length() / 2; ++k) {
- fBlock[offset*word_size + k] = new MemoryByte(
- (byte) Integer.parseInt(
- contents.substring(k * 2, k * 2 + 2),
- 16));
+ fBlock[offset * word_size + k] = new MemoryByte(
+ (byte) Integer.parseInt(contents.substring(k * 2, k * 2 + 2), 16));
}
}
- }
- catch(NumberFormatException e)
- {
+ } catch (NumberFormatException e) {
// Something went wrong. Stop processing this memory range.
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDataReadMemoryInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDataReadMemoryInfo.java
index e66da094519..453574a33de 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDataReadMemoryInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDataReadMemoryInfo.java
@@ -22,9 +22,9 @@ import java.math.BigInteger;
import org.eclipse.debug.core.model.MemoryByte;
/**
- *
+ *
* -data-read-memory result
- *
+ *
* (gdb)
* nn-data-read-memory [command parameters]
* nn^done,addr="ADDRESS",nr-bytes="NR_BYTES",total-bytes="TOTAL_BYTES",
@@ -35,12 +35,12 @@ import org.eclipse.debug.core.model.MemoryByte;
* {addr="addr3",data=["0x04","0x05", ...]},
* ...]
* (gdb)
- *
+ *
* where:
- *
+ *
* 'ADDRESS'
* Address (in hex) of the first byte fetched.
- *
+ *
* 'NR_BYTES'
* Number of bytes read.
*
@@ -61,7 +61,7 @@ import org.eclipse.debug.core.model.MemoryByte;
*
* 'MEMORY'
* Memory bytes retrieved, nr-rows of nr-columns words.
- *
+ *
*/
public class MIDataReadMemoryInfo extends MIInfo {
@@ -69,126 +69,126 @@ public class MIDataReadMemoryInfo extends MIInfo {
BigInteger fAddress = new BigInteger("0"); //$NON-NLS-1$
int fBytesRead;
int fBytesRequested;
- MemoryByte[] fMemoryBlock;
-
- /**
- * Constructor
- *
- * @param output
- */
- public MIDataReadMemoryInfo(MIOutput output) {
-
- super(output);
-
- fMemoryBlock = new MemoryByte[0];
- if (isDone()) {
- parseResult(1);
- }
- }
-
- /**
- * Constructor
- *
- * @param output
- */
- public MIDataReadMemoryInfo(MIOutput output, int word_size) {
-
- super(output);
-
- fMemoryBlock = new MemoryByte[0];
- if (isDone()) {
- parseResult(word_size);
- }
- }
-
- /**
- * Parse the back-end-result. The result is an array of the following form:
- *
- * [0] addr="address"
- * [1] nr-bytes="x"
- * [2] total-bytes="y"
- * [3] next-row="address2"
- * [4] prev-row="address3"
- * [5] next-page="address4"
- * [6] prev-page="address5"
- * [7] memory=[{addr="addr1",data=["0x00","0x01",...]}]
- *
- * At this point, we only have interest in "memory".
- */
- private void parseResult(int word_size) {
+ MemoryByte[] fMemoryBlock;
+
+ /**
+ * Constructor
+ *
+ * @param output
+ */
+ public MIDataReadMemoryInfo(MIOutput output) {
+
+ super(output);
+
+ fMemoryBlock = new MemoryByte[0];
+ if (isDone()) {
+ parseResult(1);
+ }
+ }
+
+ /**
+ * Constructor
+ *
+ * @param output
+ */
+ public MIDataReadMemoryInfo(MIOutput output, int word_size) {
+
+ super(output);
+
+ fMemoryBlock = new MemoryByte[0];
+ if (isDone()) {
+ parseResult(word_size);
+ }
+ }
+
+ /**
+ * Parse the back-end-result. The result is an array of the following form:
+ *
+ * [0] addr="address"
+ * [1] nr-bytes="x"
+ * [2] total-bytes="y"
+ * [3] next-row="address2"
+ * [4] prev-row="address3"
+ * [5] next-page="address4"
+ * [6] prev-page="address5"
+ * [7] memory=[{addr="addr1",data=["0x00","0x01",...]}]
+ *
+ * At this point, we only have interest in "memory".
+ */
+ private void parseResult(int word_size) {
// Get the GDB/MI result record
- MIOutput output = getMIOutput();
- MIResultRecord record = output.getMIResultRecord();
-
- // Parse the result record
- if (record != null) {
-
- // Parse the output results
- // Note: we assume that the result respects the output format
- // i.e. nothing missing, nothing out of order.
- MIResult[] results = record.getMIResults();
- for (int i = 0; i < results.length; i++) {
-
- // Get the variable name
- String var = results[i].getVariable();
-
- // Parse 'addr="address"', the address of the first byte to read
- if (var.equals("addr")) { //$NON-NLS-1$
- MIValue value = results[i].getMIValue();
- if (value instanceof MIConst) {
- String address = ((MIConst) value).getCString();
- fAddress = new BigInteger(address.substring(2), 16); // Strip the "0x"
- }
- }
-
- // Parse 'nr-bytes="x"', the number of bytes read
- if (var.equals("nr-bytes")) { //$NON-NLS-1$
- MIValue value = results[i].getMIValue();
- if (value instanceof MIConst) {
- String size = ((MIConst) value).getCString();
- fBytesRead = Integer.parseInt(size);
- }
- }
-
- // Parse '"total-bytes="y"', the number of bytes requested
- // Instantiate the corresponding output buffer with invalid bytes
- if (var.equals("total-bytes")) { //$NON-NLS-1$
- MIValue value = results[i].getMIValue();
- if (value instanceof MIConst) {
- String size = ((MIConst) value).getCString();
- fBytesRequested = Integer.parseInt(size);
- fMemoryBlock = new MemoryByte[fBytesRequested];
- for (int j = 0; j < fMemoryBlock.length; j++)
- fMemoryBlock[j] = new MemoryByte((byte) 0, (byte) 0);
- }
- }
-
- // Parse 'memory=[{addr="addr1",data=["0x00","0x01",...]}]'
- if (var.equals("memory")) { //$NON-NLS-1$
- MIValue value = results[i].getMIValue();
- if (value instanceof MIList) {
- parseMemoryLines((MIList) value, word_size);
- }
- }
- }
- }
- }
-
- /**
- * Parse the actual memory lines of the general form:
- *
- * [{addr="addr1",data=["0x00","0x01",...]}]
- * [{addr="addr2",data=["0x00","0x01",...]}]
- *
- * Since we haven't implemented coalescing yet, we conveniently simplify
- * the processing by assuming that the memory block address matches the
- * one of the request. Therefore, we only have to fill the memoryBlock[]
- * with the incoming bytes.
- *
- * This will have to be revisited as soon as we start considering
- * multiple (and possibly canceled) requests.
- */
+ MIOutput output = getMIOutput();
+ MIResultRecord record = output.getMIResultRecord();
+
+ // Parse the result record
+ if (record != null) {
+
+ // Parse the output results
+ // Note: we assume that the result respects the output format
+ // i.e. nothing missing, nothing out of order.
+ MIResult[] results = record.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+
+ // Get the variable name
+ String var = results[i].getVariable();
+
+ // Parse 'addr="address"', the address of the first byte to read
+ if (var.equals("addr")) { //$NON-NLS-1$
+ MIValue value = results[i].getMIValue();
+ if (value instanceof MIConst) {
+ String address = ((MIConst) value).getCString();
+ fAddress = new BigInteger(address.substring(2), 16); // Strip the "0x"
+ }
+ }
+
+ // Parse 'nr-bytes="x"', the number of bytes read
+ if (var.equals("nr-bytes")) { //$NON-NLS-1$
+ MIValue value = results[i].getMIValue();
+ if (value instanceof MIConst) {
+ String size = ((MIConst) value).getCString();
+ fBytesRead = Integer.parseInt(size);
+ }
+ }
+
+ // Parse '"total-bytes="y"', the number of bytes requested
+ // Instantiate the corresponding output buffer with invalid bytes
+ if (var.equals("total-bytes")) { //$NON-NLS-1$
+ MIValue value = results[i].getMIValue();
+ if (value instanceof MIConst) {
+ String size = ((MIConst) value).getCString();
+ fBytesRequested = Integer.parseInt(size);
+ fMemoryBlock = new MemoryByte[fBytesRequested];
+ for (int j = 0; j < fMemoryBlock.length; j++)
+ fMemoryBlock[j] = new MemoryByte((byte) 0, (byte) 0);
+ }
+ }
+
+ // Parse 'memory=[{addr="addr1",data=["0x00","0x01",...]}]'
+ if (var.equals("memory")) { //$NON-NLS-1$
+ MIValue value = results[i].getMIValue();
+ if (value instanceof MIList) {
+ parseMemoryLines((MIList) value, word_size);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Parse the actual memory lines of the general form:
+ *
+ * [{addr="addr1",data=["0x00","0x01",...]}]
+ * [{addr="addr2",data=["0x00","0x01",...]}]
+ *
+ * Since we haven't implemented coalescing yet, we conveniently simplify
+ * the processing by assuming that the memory block address matches the
+ * one of the request. Therefore, we only have to fill the memoryBlock[]
+ * with the incoming bytes.
+ *
+ * This will have to be revisited as soon as we start considering
+ * multiple (and possibly canceled) requests.
+ */
private void parseMemoryLines(MIList lines, int word_size) {
// Parse each line and append the results to the result block
@@ -207,7 +207,7 @@ public class MIDataReadMemoryInfo extends MIInfo {
MIValue addrValue = results[0].getMIValue();
if (addrValue instanceof MIConst) {
String address = ((MIConst) addrValue).getCString();
- BigInteger startAddress = new BigInteger(address.substring(2), 16); // Strip the "0x"
+ BigInteger startAddress = new BigInteger(address.substring(2), 16); // Strip the "0x"
offset = startAddress.subtract(fAddress).intValue();
}
@@ -226,7 +226,7 @@ public class MIDataReadMemoryInfo extends MIInfo {
try {
long word = Long.decode(str.trim()).longValue();
for (int k = 0; k < word_size; k++) {
- int bit_shift = (word_size - k - 1) * 8;
+ int bit_shift = (word_size - k - 1) * 8;
byteValues[j * word_size + k] = new MemoryByte((byte) ((word >> bit_shift) % 256));
}
} catch (NumberFormatException e) {
@@ -243,9 +243,9 @@ public class MIDataReadMemoryInfo extends MIInfo {
}
/**
- * Return the memory block
- */
- public MemoryByte[] getMIMemoryBlock() {
+ * Return the memory block
+ */
+ public MemoryByte[] getMIMemoryBlock() {
return fMemoryBlock;
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDataWriteMemoryInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDataWriteMemoryInfo.java
index 7dd9ff7cca6..5eca609f85c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDataWriteMemoryInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDataWriteMemoryInfo.java
@@ -17,22 +17,22 @@ package org.eclipse.cdt.dsf.mi.service.command.output;
/**
* -data-write-memory result
- *
+ *
* (gdb)
* nn-data-write-memory [command parameters]
* nn^done
- *
+ *
*/
public class MIDataWriteMemoryInfo extends MIInfo {
- /**
- * Constructor
- *
- * @param output
- */
- public MIDataWriteMemoryInfo(MIOutput output) {
+ /**
+ * Constructor
+ *
+ * @param output
+ */
+ public MIDataWriteMemoryInfo(MIOutput output) {
- super(output);
- }
+ super(output);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDisplayHint.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDisplayHint.java
index 06435d6a0ba..cb552012a6e 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDisplayHint.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIDisplayHint.java
@@ -16,79 +16,79 @@ package org.eclipse.cdt.dsf.mi.service.command.output;
/**
* Some utilities around the display hint provided by the python pretty printers
* via MI.
- *
+ *
* @since 4.0
*/
public class MIDisplayHint {
public static final MIDisplayHint NONE = new MIDisplayHint(GdbDisplayHint.GDB_DISPLAY_HINT_NONE, ""); //$NON-NLS-1$
-
+
/**
* The set of display hints that are of particular interest to DSF GDB.
*/
public enum GdbDisplayHint {
-
- /**
- * No hint given.
- */
- GDB_DISPLAY_HINT_NONE(null),
-
+
+ /**
+ * No hint given.
+ */
+ GDB_DISPLAY_HINT_NONE(null),
+
/**
* Display an expression or variable as string. Strings don't have children.
*/
- GDB_DISPLAY_HINT_STRING("string"), //$NON-NLS-1$
-
- /**
- * Display an expression or variable as array.
- */
- GDB_DISPLAY_HINT_ARRAY("array"), //$NON-NLS-1$
-
+ GDB_DISPLAY_HINT_STRING("string"), //$NON-NLS-1$
+
+ /**
+ * Display an expression or variable as array.
+ */
+ GDB_DISPLAY_HINT_ARRAY("array"), //$NON-NLS-1$
+
/**
* Display an expression or variable as map. This means each child with an
* odd index is a key, each child with an even index is the corresponding
* value.
*/
- GDB_DISPLAY_HINT_MAP("map"), //$NON-NLS-1$
-
- /**
- * A user defined hint. It has no further meaning to gdb.
- */
- GDB_DISPLAY_USER_DEFINED(null);
-
- private final String miToken;
-
- private GdbDisplayHint(String miToken) {
- this.miToken = miToken;
- }
-
+ GDB_DISPLAY_HINT_MAP("map"), //$NON-NLS-1$
+
+ /**
+ * A user defined hint. It has no further meaning to gdb.
+ */
+ GDB_DISPLAY_USER_DEFINED(null);
+
+ private final String miToken;
+
+ private GdbDisplayHint(String miToken) {
+ this.miToken = miToken;
+ }
+
/**
* @return The string that is used by MI to denote this display hint, if
* any.
*/
- public String getMIToken() {
- return miToken;
- }
+ public String getMIToken() {
+ return miToken;
+ }
}
-
+
private final GdbDisplayHint gdbHint;
-
+
private final String displayHint;
-
+
private MIDisplayHint(GdbDisplayHint gdbHint, String hint) {
this.gdbHint = gdbHint;
this.displayHint = hint;
}
-
+
/**
* Create the hint from the given string.
- *
+ *
* @param text The string representation to parse in order to initialize from.
*/
public MIDisplayHint(String text) {
gdbHint = parseDisplayHint(text);
displayHint = text.trim();
}
-
+
/**
* @return The display hint as returned by the pretty printer printer.
*/
@@ -102,37 +102,37 @@ public class MIDisplayHint {
public GdbDisplayHint getGdbDisplayHint() {
return gdbHint;
}
-
- /**
- * @return If <code>true</code>, the variable is definitely a collection,
- * if <code>false</code>, it still might be a collection.
- */
+
+ /**
+ * @return If <code>true</code>, the variable is definitely a collection,
+ * if <code>false</code>, it still might be a collection.
+ */
public boolean isCollectionHint() {
- switch(getGdbDisplayHint()) {
+ switch (getGdbDisplayHint()) {
case GDB_DISPLAY_HINT_ARRAY:
case GDB_DISPLAY_HINT_MAP:
return true;
}
-
+
return false;
}
-
+
/**
* @param text
* The snipped from the MI response.
* @return The decoded display hint predefined by gdb.
*/
private static GdbDisplayHint parseDisplayHint(String text) {
-
- String hint = text.trim();
-
- for (GdbDisplayHint gdbHint : GdbDisplayHint.values()) {
- String miToken = gdbHint.getMIToken();
- if (miToken != null && miToken.equals(hint)) {
- return gdbHint;
- }
+
+ String hint = text.trim();
+
+ for (GdbDisplayHint gdbHint : GdbDisplayHint.values()) {
+ String miToken = gdbHint.getMIToken();
+ if (miToken != null && miToken.equals(hint)) {
+ return gdbHint;
+ }
}
- return GdbDisplayHint.GDB_DISPLAY_USER_DEFINED;
+ return GdbDisplayHint.GDB_DISPLAY_USER_DEFINED;
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIExecAsyncOutput.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIExecAsyncOutput.java
index d1be576b328..9d45d576e4d 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIExecAsyncOutput.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIExecAsyncOutput.java
@@ -18,10 +18,10 @@ package org.eclipse.cdt.dsf.mi.service.command.output;
/**
* Represents an asynchronous OOB record from gdb that notifies the client of
* state changes on the target (stopped, started, etc).
- *
+ *
* <p>
* All such records are prefixed by *.
- *
+ *
* @see MIAsyncRecord
*/
public class MIExecAsyncOutput extends MIAsyncRecord {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIFrame.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIFrame.java
index 986201bdfae..4e0597c7850 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIFrame.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIFrame.java
@@ -20,99 +20,98 @@ package org.eclipse.cdt.dsf.mi.service.command.output;
*/
public class MIFrame {
- int level;
- String addr;
- String func = ""; //$NON-NLS-1$
- String file = ""; //$NON-NLS-1$
- // since gdb 6.4
- String fullname = ""; //$NON-NLS-1$
- int line;
- MIArg[] args = new MIArg[0];
+ int level;
+ String addr;
+ String func = ""; //$NON-NLS-1$
+ String file = ""; //$NON-NLS-1$
+ // since gdb 6.4
+ String fullname = ""; //$NON-NLS-1$
+ int line;
+ MIArg[] args = new MIArg[0];
- public MIFrame(MITuple tuple) {
- parse(tuple);
- }
+ public MIFrame(MITuple tuple) {
+ parse(tuple);
+ }
- public MIArg[] getArgs() {
- return args;
- }
+ public MIArg[] getArgs() {
+ return args;
+ }
- public String getFile() {
- String fname = getFullname();
- return ( fname.length() != 0 ) ? fname : file;
- }
+ public String getFile() {
+ String fname = getFullname();
+ return (fname.length() != 0) ? fname : file;
+ }
- public String getFullname() {
- return fullname;
- }
+ public String getFullname() {
+ return fullname;
+ }
- public String getFunction() {
- return func;
- }
+ public String getFunction() {
+ return func;
+ }
- public int getLine() {
- return line;
- }
+ public int getLine() {
+ return line;
+ }
- public String getAddress() {
- return addr;
- }
+ public String getAddress() {
+ return addr;
+ }
- public int getLevel() {
- return level;
- }
+ public int getLevel() {
+ return level;
+ }
- @Override
- public String toString() {
- StringBuilder buffer = new StringBuilder();
- buffer.append("level=\"").append(level).append('"'); //$NON-NLS-1$
- buffer.append(",addr=\"").append(addr).append('"'); //$NON-NLS-1$
- buffer.append(",func=\"").append(func).append('"'); //$NON-NLS-1$
- buffer.append(",file=\"").append(file).append('"'); //$NON-NLS-1$
- buffer.append(",fullname=\"").append(fullname).append('"'); //$NON-NLS-1$
- buffer.append(",line=\"").append(line).append('"'); //$NON-NLS-1$
- buffer.append(",args=["); //$NON-NLS-1$
- for (int i = 0; i < args.length; i++) {
- if (i != 0) {
- buffer.append(',');
- }
- buffer.append("{name=\"").append(args[i].getName()).append('"');//$NON-NLS-1$
- buffer.append(",value=\"").append(args[i].getValue()).append("\"}");//$NON-NLS-1$//$NON-NLS-2$
- }
- buffer.append(']');
- return buffer.toString();
- }
+ @Override
+ public String toString() {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append("level=\"").append(level).append('"'); //$NON-NLS-1$
+ buffer.append(",addr=\"").append(addr).append('"'); //$NON-NLS-1$
+ buffer.append(",func=\"").append(func).append('"'); //$NON-NLS-1$
+ buffer.append(",file=\"").append(file).append('"'); //$NON-NLS-1$
+ buffer.append(",fullname=\"").append(fullname).append('"'); //$NON-NLS-1$
+ buffer.append(",line=\"").append(line).append('"'); //$NON-NLS-1$
+ buffer.append(",args=["); //$NON-NLS-1$
+ for (int i = 0; i < args.length; i++) {
+ if (i != 0) {
+ buffer.append(',');
+ }
+ buffer.append("{name=\"").append(args[i].getName()).append('"');//$NON-NLS-1$
+ buffer.append(",value=\"").append(args[i].getValue()).append("\"}");//$NON-NLS-1$//$NON-NLS-2$
+ }
+ buffer.append(']');
+ return buffer.toString();
+ }
- void parse(MITuple tuple) {
- MIResult[] results = tuple.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- MIValue value = results[i].getMIValue();
- String str = ""; //$NON-NLS-1$
- if (value != null && value instanceof MIConst) {
- str = ((MIConst)value).getCString();
- }
+ void parse(MITuple tuple) {
+ MIResult[] results = tuple.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ MIValue value = results[i].getMIValue();
+ String str = ""; //$NON-NLS-1$
+ if (value != null && value instanceof MIConst) {
+ str = ((MIConst) value).getCString();
+ }
- if (var.equals("level")) { //$NON-NLS-1$
- try {
- level = Integer.parseInt(str.trim());
- } catch (NumberFormatException e) {
- }
- } else if (var.equals("addr")) { //$NON-NLS-1$
- try {
- addr = str.trim();
- if ( str.equals( "<unavailable>" ) ) //$NON-NLS-1$
- addr = ""; //$NON-NLS-1$
- } catch (NumberFormatException e) {
- }
- } else if (var.equals("func")) { //$NON-NLS-1$
- func = null;
- if ( str != null ) {
- str = str.trim();
- if ( str.equals( "??" ) ) //$NON-NLS-1$
- func = ""; //$NON-NLS-1$
- else
- {
+ if (var.equals("level")) { //$NON-NLS-1$
+ try {
+ level = Integer.parseInt(str.trim());
+ } catch (NumberFormatException e) {
+ }
+ } else if (var.equals("addr")) { //$NON-NLS-1$
+ try {
+ addr = str.trim();
+ if (str.equals("<unavailable>")) //$NON-NLS-1$
+ addr = ""; //$NON-NLS-1$
+ } catch (NumberFormatException e) {
+ }
+ } else if (var.equals("func")) { //$NON-NLS-1$
+ func = null;
+ if (str != null) {
+ str = str.trim();
+ if (str.equals("??")) //$NON-NLS-1$
+ func = ""; //$NON-NLS-1$
+ else {
func = str;
// In some situations gdb returns the function names that include parameter types.
// To make the presentation consistent truncate the parameters. PR 46592
@@ -125,37 +124,38 @@ public class MIFrame {
func = str.substring(0, end);
}
}
- }
- }
- } else if (var.equals("file")) { //$NON-NLS-1$
- file = str;
- } else if (var.equals("fullname")) { //$NON-NLS-1$
- fullname = str;
- } else if (var.equals("line")) { //$NON-NLS-1$
- try {
- line = Integer.parseInt(str.trim());
- } catch (NumberFormatException e) {
- }
- } else if (var.equals("args")) { //$NON-NLS-1$
- if (value instanceof MIList) {
- args = MIArg.getMIArgs((MIList)value);
- } else if (value instanceof MITuple) {
- args = MIArg.getMIArgs((MITuple)value);
- }
- }
- }
- }
+ }
+ }
+ } else if (var.equals("file")) { //$NON-NLS-1$
+ file = str;
+ } else if (var.equals("fullname")) { //$NON-NLS-1$
+ fullname = str;
+ } else if (var.equals("line")) { //$NON-NLS-1$
+ try {
+ line = Integer.parseInt(str.trim());
+ } catch (NumberFormatException e) {
+ }
+ } else if (var.equals("args")) { //$NON-NLS-1$
+ if (value instanceof MIList) {
+ args = MIArg.getMIArgs((MIList) value);
+ } else if (value instanceof MITuple) {
+ args = MIArg.getMIArgs((MITuple) value);
+ }
+ }
+ }
+ }
private int getMatchingBracketIndex(String str, int end) {
- int depth = 1;
- for (;end>=0;end--) {
- int c = str.charAt(end);
- if (c=='(') {
- depth--;
- if (depth==0) break;
- } else if (c==')')
- depth++;
- }
- return end;
- }
+ int depth = 1;
+ for (; end >= 0; end--) {
+ int c = str.charAt(end);
+ if (c == '(') {
+ depth--;
+ if (depth == 0)
+ break;
+ } else if (c == ')')
+ depth++;
+ }
+ return end;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIGDBShowExitCodeInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIGDBShowExitCodeInfo.java
index 5f747ad7172..75c69ab656b 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIGDBShowExitCodeInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIGDBShowExitCodeInfo.java
@@ -12,30 +12,30 @@
* QNX Software Systems - Initial API and implementation
* Wind River Systems - Modified for new DSF Reference Implementation
*******************************************************************************/
-
+
package org.eclipse.cdt.dsf.mi.service.command.output;
/**
* GDB/MI show parsing.
- * (gdb)
+ * (gdb)
* -data-evaluate-expression $_exitcode
* ^done,value="10"
* (gdb)
*/
public class MIGDBShowExitCodeInfo extends MIDataEvaluateExpressionInfo {
- public MIGDBShowExitCodeInfo(MIOutput o) {
- super(o);
- }
+ public MIGDBShowExitCodeInfo(MIOutput o) {
+ super(o);
+ }
- public int getCode() {
- int code = 0;
- String exp = getValue();
- try {
- code = Integer.parseInt(exp);
- } catch (NumberFormatException e) {
- }
- return code;
- }
+ public int getCode() {
+ int code = 0;
+ String exp = getValue();
+ try {
+ code = Integer.parseInt(exp);
+ } catch (NumberFormatException e) {
+ }
+ return code;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIGDBShowLanguageInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIGDBShowLanguageInfo.java
index b9443092ee4..3ff50b924f2 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIGDBShowLanguageInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIGDBShowLanguageInfo.java
@@ -28,7 +28,7 @@ package org.eclipse.cdt.dsf.mi.service.command.output;
* ^done,value="auto; currently c"
*
* the different returned values are:
- *
+ *
* (gdb) help set language
* Set the current source language.
* The currently understood settings are:
@@ -77,29 +77,29 @@ public class MIGDBShowLanguageInfo extends MIInfo {
}
protected void parse() {
- if (isDone()) {
- MIOutput out = getMIOutput();
- MIResultRecord outr = out.getMIResultRecord();
- if (outr != null) {
- MIResult[] results = outr.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- if (var.equals("value")) { //$NON-NLS-1$
- MIValue value = results[i].getMIValue();
- if (value instanceof MIConst) {
- fLanguage = ((MIConst)value).getString();
+ if (isDone()) {
+ MIOutput out = getMIOutput();
+ MIResultRecord outr = out.getMIResultRecord();
+ if (outr != null) {
+ MIResult[] results = outr.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ if (var.equals("value")) { //$NON-NLS-1$
+ MIValue value = results[i].getMIValue();
+ if (value instanceof MIConst) {
+ fLanguage = ((MIConst) value).getString();
- // Some versions of GDB (6.2-6.8) output "auto; currently c"
- // so we need to remove the semicolon part
- int semiColonIdx = fLanguage.indexOf(';');
- if (semiColonIdx != -1) {
- fLanguage = fLanguage.substring(0, semiColonIdx);
- }
- }
- }
- }
- }
- }
+ // Some versions of GDB (6.2-6.8) output "auto; currently c"
+ // so we need to remove the semicolon part
+ int semiColonIdx = fLanguage.indexOf(';');
+ if (semiColonIdx != -1) {
+ fLanguage = fLanguage.substring(0, semiColonIdx);
+ }
+ }
+ }
+ }
+ }
+ }
}
public String getLanguage() {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIGDBShowNewConsoleInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIGDBShowNewConsoleInfo.java
index bbc484785c3..a3b8eab7825 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIGDBShowNewConsoleInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIGDBShowNewConsoleInfo.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Kichwa Coders - initial API and implementation
*******************************************************************************/
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIGDBVersionInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIGDBVersionInfo.java
index 42f39ba1e74..208947ff3d1 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIGDBVersionInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIGDBVersionInfo.java
@@ -25,7 +25,7 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIStreamRecord;
* '-gdb-version' Show version information for gdb.
*
* sample output:
- *
+ *
* -gdb-version
* ~"GNU gdb (Ubuntu 7.7-0ubuntu3.1) 7.7\n"
* ~"Copyright (C) 2014 Free Software Foundation, Inc.\n"
@@ -44,7 +44,7 @@ public class MIGDBVersionInfo extends MIInfo {
private String fVersion;
private String fFullOutput;
-
+
public MIGDBVersionInfo(MIOutput record) {
super(record);
parse();
@@ -55,11 +55,11 @@ public class MIGDBVersionInfo extends MIInfo {
MIOutput out = getMIOutput();
MIOOBRecord[] records = out.getMIOOBRecords();
StringBuilder builder = new StringBuilder();
- for(MIOOBRecord rec : records) {
- if (rec instanceof MIConsoleStreamOutput) {
- MIStreamRecord o = (MIStreamRecord)rec;
- builder.append(o.getString());
- }
+ for (MIOOBRecord rec : records) {
+ if (rec instanceof MIConsoleStreamOutput) {
+ MIStreamRecord o = (MIStreamRecord) rec;
+ builder.append(o.getString());
+ }
}
fFullOutput = builder.toString();
fVersion = parseVersion(fFullOutput);
@@ -69,7 +69,7 @@ public class MIGDBVersionInfo extends MIInfo {
protected String parseVersion(String output) {
return LaunchUtils.getGDBVersionFromText(output);
}
-
+
public String getFullOutput() {
return fFullOutput;
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIInfo.java
index 849a74ea5cc..23d2e9b3383 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIInfo.java
@@ -23,82 +23,82 @@ import org.eclipse.cdt.dsf.debug.service.command.ICommandResult;
*/
public class MIInfo implements ICommandResult {
- private final MIOutput miOutput;
+ private final MIOutput miOutput;
- public MIInfo(MIOutput record) {
- miOutput = record;
- }
+ public MIInfo(MIOutput record) {
+ miOutput = record;
+ }
- public MIOutput getMIOutput () {
- return miOutput;
- }
+ public MIOutput getMIOutput() {
+ return miOutput;
+ }
- public boolean isDone() {
- return isResultClass(MIResultRecord.DONE);
- }
+ public boolean isDone() {
+ return isResultClass(MIResultRecord.DONE);
+ }
- public boolean isRunning() {
- return isResultClass(MIResultRecord.RUNNING);
- }
+ public boolean isRunning() {
+ return isResultClass(MIResultRecord.RUNNING);
+ }
- public boolean isConnected() {
- return isResultClass(MIResultRecord.CONNECTED);
- }
+ public boolean isConnected() {
+ return isResultClass(MIResultRecord.CONNECTED);
+ }
- public boolean isError() {
- return isResultClass(MIResultRecord.ERROR);
- }
+ public boolean isError() {
+ return isResultClass(MIResultRecord.ERROR);
+ }
- public boolean isExit() {
- return isResultClass(MIResultRecord.EXIT);
- }
+ public boolean isExit() {
+ return isResultClass(MIResultRecord.EXIT);
+ }
- @Override
- public String toString() {
- if (miOutput != null) {
- return miOutput.toString();
- }
- return ""; //$NON-NLS-1$
- }
+ @Override
+ public String toString() {
+ if (miOutput != null) {
+ return miOutput.toString();
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ boolean isResultClass(String rc) {
+ if (miOutput != null) {
+ MIResultRecord rr = miOutput.getMIResultRecord();
+ if (rr != null) {
+ String clazz = rr.getResultClass();
+ return clazz.equals(rc);
+ }
+ }
+ return false;
+ }
- boolean isResultClass(String rc) {
- if (miOutput != null) {
- MIResultRecord rr = miOutput.getMIResultRecord();
- if (rr != null) {
- String clazz = rr.getResultClass();
- return clazz.equals(rc);
- }
- }
- return false;
- }
+ public String getErrorMsg() {
+ if (miOutput != null) {
+ MIResultRecord rr = miOutput.getMIResultRecord();
+ if (rr != null) {
+ MIResult[] results = rr.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ if (var.equals("msg")) { //$NON-NLS-1$
+ MIValue value = results[i].getMIValue();
+ if (value instanceof MIConst) {
+ String s = ((MIConst) value).getCString();
+ return s;
+ }
+ }
+ }
+ }
+ }
+ return ""; //$NON-NLS-1$
+ }
- public String getErrorMsg() {
- if (miOutput != null) {
- MIResultRecord rr = miOutput.getMIResultRecord();
- if (rr != null) {
- MIResult[] results = rr.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- if (var.equals("msg")) { //$NON-NLS-1$
- MIValue value = results[i].getMIValue();
- if (value instanceof MIConst) {
- String s = ((MIConst)value).getCString();
- return s;
- }
- }
- }
- }
- }
- return ""; //$NON-NLS-1$
- }
-
- /**
- * Default implementation of this method returns null, which means that a subset
- * result canot be calculated for the given command. Deriving classes should
- * override this method as needed.
- */
+ /**
+ * Default implementation of this method returns null, which means that a subset
+ * result canot be calculated for the given command. Deriving classes should
+ * override this method as needed.
+ */
@Override
- public <V extends ICommandResult> V getSubsetResult(ICommand<V> command) {
- return null;
- }
+ public <V extends ICommandResult> V getSubsetResult(ICommand<V> command) {
+ return null;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIInfoOsInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIInfoOsInfo.java
index d79b19d24ee..a71ddde4f88 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIInfoOsInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIInfoOsInfo.java
@@ -81,32 +81,33 @@ public class MIInfoOsInfo extends MIInfo {
}
}
- public IResourcesInformation getResourcesInformation()
- {
+ public IResourcesInformation getResourcesInformation() {
return new IResourcesInformation() {
@Override
- public String[][] getContent() { return content; }
+ public String[][] getContent() {
+ return content;
+ }
@Override
- public String[] getColumnNames() { return columnNames; }
+ public String[] getColumnNames() {
+ return columnNames;
+ }
};
}
- public IResourceClass[] getResourceClasses()
- {
+ public IResourceClass[] getResourceClasses() {
return resourceClasses;
}
- private void parseResourceClasses()
- {
+ private void parseResourceClasses() {
List<IResourceClass> classes = new ArrayList<IResourceClass>();
- MITuple table = (MITuple)get(getMIOutput(), "OSDataTable"); //$NON-NLS-1$
+ MITuple table = (MITuple) get(getMIOutput(), "OSDataTable"); //$NON-NLS-1$
- MIList body = (MIList)get(table, "body"); //$NON-NLS-1$
- for (MIResult r: body.getMIResults()) {
- MITuple row = (MITuple)r.getMIValue();
+ MIList body = (MIList) get(table, "body"); //$NON-NLS-1$
+ for (MIResult r : body.getMIResults()) {
+ MITuple row = (MITuple) r.getMIValue();
final String id = getString(row.getMIResults()[0]);
final String description = getString(row.getMIResults()[2]);
@@ -114,10 +115,14 @@ public class MIInfoOsInfo extends MIInfo {
classes.add(new IResourceClass() {
@Override
- public String getId() { return id; }
+ public String getId() {
+ return id;
+ }
@Override
- public String getHumanDescription() { return description; }
+ public String getHumanDescription() {
+ return description;
+ }
});
}
@@ -125,23 +130,20 @@ public class MIInfoOsInfo extends MIInfo {
resourceClasses = classes.toArray(new IResourceClass[classes.size()]);
}
- private void parseResourcesInformation()
- {
+ private void parseResourcesInformation() {
MITuple table = (MITuple) get(getMIOutput(), "OSDataTable"); //$NON-NLS-1$
- MIList header = (MIList) get(table, "hdr"); //$NON-NLS-1$
+ MIList header = (MIList) get(table, "hdr"); //$NON-NLS-1$
columnNames = new String[header.getMIValues().length];
int i = 0;
for (MIValue v : header.getMIValues()) {
MITuple column = (MITuple) v;
- String columnName = ((MIConst) get(column, "colhdr")).getString(); //$NON-NLS-1$
+ String columnName = ((MIConst) get(column, "colhdr")).getString(); //$NON-NLS-1$
columnNames[i++] = Character.toUpperCase(columnName.charAt(0)) + columnName.substring(1);
}
-
- MIList body = (MIList) get(table, "body"); //$NON-NLS-1$
- if (body == null)
- {
+ MIList body = (MIList) get(table, "body"); //$NON-NLS-1$
+ if (body == null) {
content = new String[0][];
return;
}
@@ -153,8 +155,7 @@ public class MIInfoOsInfo extends MIInfo {
assert row.getMIResults().length == columnNames.length;
String[] rowStrings = new String[row.getMIResults().length];
int j = 0;
- for (MIResult r2 : row.getMIResults())
- {
+ for (MIResult r2 : row.getMIResults()) {
rowStrings[j] = ((MIConst) r2.getMIValue()).getString();
++j;
}
@@ -177,13 +178,11 @@ public class MIInfoOsInfo extends MIInfo {
return get(tuple.getMIResults(), name);
}
- private String getString(MIValue value)
- {
- return ((MIConst)value).getString();
+ private String getString(MIValue value) {
+ return ((MIConst) value).getString();
}
- private String getString(MIResult result)
- {
+ private String getString(MIResult result) {
return getString(result.getMIValue());
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIInstruction.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIInstruction.java
index ac4cc4411c3..56d00ec696c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIInstruction.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIInstruction.java
@@ -23,154 +23,154 @@ import org.eclipse.cdt.dsf.debug.service.AbstractInstruction;
public class MIInstruction extends AbstractInstruction {
- // The parsed information
- BigInteger address;
- String function = ""; //$NON-NLS-1$
- long offset;
- String opcode = ""; //$NON-NLS-1$
- String args = ""; //$NON-NLS-1$
- BigInteger rawOpcodes = null;
- Integer opcodeSize = null;
-
- public MIInstruction(MITuple tuple) {
- parse(tuple);
- }
+ // The parsed information
+ BigInteger address;
+ String function = ""; //$NON-NLS-1$
+ long offset;
+ String opcode = ""; //$NON-NLS-1$
+ String args = ""; //$NON-NLS-1$
+ BigInteger rawOpcodes = null;
+ Integer opcodeSize = null;
+
+ public MIInstruction(MITuple tuple) {
+ parse(tuple);
+ }
@Override
- public BigInteger getAdress() {
- return address;
- }
+ public BigInteger getAdress() {
+ return address;
+ }
@Override
- public String getFuntionName() {
- return function;
- }
+ public String getFuntionName() {
+ return function;
+ }
@Override
- public long getOffset() {
- return offset;
- }
+ public long getOffset() {
+ return offset;
+ }
@Override
- public String getInstruction() {
- return opcode + "\t" + args; //$NON-NLS-1$;
- }
+ public String getInstruction() {
+ return opcode + "\t" + args; //$NON-NLS-1$;
+ }
@Override
- public String getOpcode() {
- return opcode;
- }
+ public String getOpcode() {
+ return opcode;
+ }
@Override
- public String getArgs() {
- return args;
- }
-
+ public String getArgs() {
+ return args;
+ }
+
@Override
public BigInteger getRawOpcodes() {
return rawOpcodes;
}
- /**
- * Parse the assembly instruction result. Each instruction has the following
- * fields:
- * - Address
- * - Function name
- * - Offset
- * - Instruction
- *
- * {address="0x000107c0",func-name="main",offset="4",inst="mov 2, %o0"},
- * {address="0x000107c4",func-name="main",offset="8",inst="sethi %hi(0x11800), %o2"},
- * ...,
- * {address="0x00010820",func-name="main",offset="100",inst="restore "}
- *
- * An instruction may also contain:
- * - Opcode bytes
- *
- * {address="0x004016b9",func-name="main",offset="9",opcodes="e8 a2 05 00 00",
- * inst="call 0x401c60 <__main>"},
- * ...,
- *
- * In addition, the opcode and arguments are extracted form the assembly instruction.
- */
- private void parse(MITuple tuple) {
- MIResult[] results = tuple.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- MIValue value = results[i].getMIValue();
- String str = ""; //$NON-NLS-1$
-
- if (value instanceof MIConst) {
- str = ((MIConst)value).getCString();
- }
-
- if (var.equals("address")) { //$NON-NLS-1$
- try {
- address = decodeAddress(str.trim());
- } catch (NumberFormatException e) {
- }
- continue;
- }
-
- if (var.equals("func-name")) { //$NON-NLS-1$
- function = str;
- continue;
- }
-
- if (var.equals("offset")) { //$NON-NLS-1$
- try {
- offset = Long.decode(str.trim()).longValue();
- } catch (NumberFormatException e) {
- }
- continue;
- }
-
- if (var.equals("inst")) { //$NON-NLS-1$
- /* for the instruction, we do not want the C string but the
- translated string since the only thing we are doing is
- displaying it. */
- if (value instanceof MIConst) {
- str = ((MIConst) value).getString();
- }
- /* to avoid improper displaying of instructions we need to translate tabs */
- str = str.replace("\\t", "\t"); //$NON-NLS-1$ //$NON-NLS-2$
-
- char chars[] = str.toCharArray();
- int index = 0;
-
- // count the non-whitespace characters.
- while( (index < chars.length) && (chars[index] > '\u0020'))
- index++;
-
- opcode = str.substring( 0, index );
-
- // skip any whitespace characters
- while( index < chars.length && chars[index] >= '\u0000' && chars[index] <= '\u0020')
- index++;
-
- // guard no argument
- if( index < chars.length )
- args = str.substring( index );
-
- continue;
- }
-
- if (var.equals("opcodes")) { //$NON-NLS-1$
- try {
- rawOpcodes = decodeOpcodes(str);
- opcodeSize = Integer.valueOf(str.replace(" ", "").length() / 2); //$NON-NLS-1$//$NON-NLS-2$
- } catch (NumberFormatException e) {
- }
- continue;
- }
- }
-
- }
+ /**
+ * Parse the assembly instruction result. Each instruction has the following
+ * fields:
+ * - Address
+ * - Function name
+ * - Offset
+ * - Instruction
+ *
+ * {address="0x000107c0",func-name="main",offset="4",inst="mov 2, %o0"},
+ * {address="0x000107c4",func-name="main",offset="8",inst="sethi %hi(0x11800), %o2"},
+ * ...,
+ * {address="0x00010820",func-name="main",offset="100",inst="restore "}
+ *
+ * An instruction may also contain:
+ * - Opcode bytes
+ *
+ * {address="0x004016b9",func-name="main",offset="9",opcodes="e8 a2 05 00 00",
+ * inst="call 0x401c60 <__main>"},
+ * ...,
+ *
+ * In addition, the opcode and arguments are extracted form the assembly instruction.
+ */
+ private void parse(MITuple tuple) {
+ MIResult[] results = tuple.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ MIValue value = results[i].getMIValue();
+ String str = ""; //$NON-NLS-1$
+
+ if (value instanceof MIConst) {
+ str = ((MIConst) value).getCString();
+ }
+
+ if (var.equals("address")) { //$NON-NLS-1$
+ try {
+ address = decodeAddress(str.trim());
+ } catch (NumberFormatException e) {
+ }
+ continue;
+ }
+
+ if (var.equals("func-name")) { //$NON-NLS-1$
+ function = str;
+ continue;
+ }
+
+ if (var.equals("offset")) { //$NON-NLS-1$
+ try {
+ offset = Long.decode(str.trim()).longValue();
+ } catch (NumberFormatException e) {
+ }
+ continue;
+ }
+
+ if (var.equals("inst")) { //$NON-NLS-1$
+ /* for the instruction, we do not want the C string but the
+ translated string since the only thing we are doing is
+ displaying it. */
+ if (value instanceof MIConst) {
+ str = ((MIConst) value).getString();
+ }
+ /* to avoid improper displaying of instructions we need to translate tabs */
+ str = str.replace("\\t", "\t"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ char chars[] = str.toCharArray();
+ int index = 0;
+
+ // count the non-whitespace characters.
+ while ((index < chars.length) && (chars[index] > '\u0020'))
+ index++;
+
+ opcode = str.substring(0, index);
+
+ // skip any whitespace characters
+ while (index < chars.length && chars[index] >= '\u0000' && chars[index] <= '\u0020')
+ index++;
+
+ // guard no argument
+ if (index < chars.length)
+ args = str.substring(index);
+
+ continue;
+ }
+
+ if (var.equals("opcodes")) { //$NON-NLS-1$
+ try {
+ rawOpcodes = decodeOpcodes(str);
+ opcodeSize = Integer.valueOf(str.replace(" ", "").length() / 2); //$NON-NLS-1$//$NON-NLS-2$
+ } catch (NumberFormatException e) {
+ }
+ continue;
+ }
+ }
+
+ }
/**
* Decode given string representation of a non-negative integer. A
* hexadecimal encoded integer is expected to start with <code>0x</code>.
- *
+ *
* @param string
* decimal or hexadecimal representation of an non-negative integer
* @return address value as <code>BigInteger</code>
@@ -181,11 +181,11 @@ public class MIInstruction extends AbstractInstruction {
}
return new BigInteger(string);
}
-
+
/**
* Decode given string representation of a space separated hex encoded byte
* array
- *
+ *
* @param string
* space separated hexadecimal byte array
* @return opcode bytes as <code>BigInteger</code>
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIList.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIList.java
index 270f038926c..a74320bd934 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIList.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIList.java
@@ -20,45 +20,45 @@ package org.eclipse.cdt.dsf.mi.service.command.output;
*/
public class MIList extends MIValue {
- final static MIResult[] nullResults = new MIResult[0];
- final static MIValue[] nullValues = new MIValue[0];
+ final static MIResult[] nullResults = new MIResult[0];
+ final static MIValue[] nullValues = new MIValue[0];
- MIResult[] results = nullResults;
- MIValue[] values = nullValues;
+ MIResult[] results = nullResults;
+ MIValue[] values = nullValues;
- public MIResult[] getMIResults() {
- return results;
- }
+ public MIResult[] getMIResults() {
+ return results;
+ }
- public void setMIResults(MIResult[] res) {
- results = res;
- }
+ public void setMIResults(MIResult[] res) {
+ results = res;
+ }
- public MIValue[] getMIValues() {
- return values;
- }
+ public MIValue[] getMIValues() {
+ return values;
+ }
- public void setMIValues(MIValue[] vals) {
- values = vals;
- }
+ public void setMIValues(MIValue[] vals) {
+ values = vals;
+ }
- @Override
- public String toString() {
- StringBuilder buffer = new StringBuilder();
- buffer.append('[');
- for (int i = 0; i < results.length; i++) {
- if (i != 0) {
- buffer.append(',');
- }
- buffer.append(results[i].toString());
- }
- for (int i = 0; i < values.length; i++) {
- if (i != 0) {
- buffer.append(',');
- }
- buffer.append(values[i].toString());
- }
- buffer.append(']');
- return buffer.toString();
- }
+ @Override
+ public String toString() {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append('[');
+ for (int i = 0; i < results.length; i++) {
+ if (i != 0) {
+ buffer.append(',');
+ }
+ buffer.append(results[i].toString());
+ }
+ for (int i = 0; i < values.length; i++) {
+ if (i != 0) {
+ buffer.append(',');
+ }
+ buffer.append(values[i].toString());
+ }
+ buffer.append(']');
+ return buffer.toString();
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIListFeaturesInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIListFeaturesInfo.java
index e3af19e5d30..9bfcb387441 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIListFeaturesInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIListFeaturesInfo.java
@@ -16,9 +16,9 @@ package org.eclipse.cdt.dsf.mi.service.command.output;
import java.util.ArrayList;
import java.util.List;
-/**
+/**
* Example output is:
- *
+ *
* (gdb) -list-features
* ^done,result=["feature1","feature2"]
* @since 4.0
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIListThreadGroupsInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIListThreadGroupsInfo.java
index 7ab7917ae0c..7309ec5f2cc 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIListThreadGroupsInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIListThreadGroupsInfo.java
@@ -26,7 +26,7 @@ import org.eclipse.cdt.dsf.concurrent.Immutable;
/**
* GDB/MI thread group parsing.
- *
+ *
* The description field can be different depending on the target we are connected to.
*
* -list-thread-groups --available:
@@ -36,21 +36,21 @@ import org.eclipse.cdt.dsf.concurrent.Immutable;
* {id="166",type="process",description="name: JUnitProcess_PT, type 1094605, locked: N, system: N, state: Idle"}]
*
* {id="3602",type="process",description="/usr/sbin/dhcdbd --system",user="root"}
- *
- * -list-thread-groups:
+ *
+ * -list-thread-groups:
* ^done,groups=[{id="162",type="process",pid="162"}]
*
* -list-thread-groups GROUPID, in the case of a running thread or a stopped thread:
* ^done,threads=[{id="1",target-id="Thread 162.32942",details="JUnitProcess_PT (Ready) 1030373359 44441",frame={level="0",addr="0x00000000",func="??",args=[]},state="stopped"}]
* ^done,threads=[{id="1",target-id="Thread 162.32942",details="JUnitProcess_PT Idle 981333916 42692",state="running"}]
- *
- * As of GDB 7.1, a new 'core' output field has been added. This field is a list
- * of integers, each identifying a core that one thread of the group is running on.
+ *
+ * As of GDB 7.1, a new 'core' output field has been added. This field is a list
+ * of integers, each identifying a core that one thread of the group is running on.
* This field may be absent if such information is not available.
- *
+ *
* -list-thread-groups
* ^done,groups=[{id="12779",type="process",pid="12779",cores=["3"]}]
- *
+ *
* -list-thread-groups 12779
* ^done,threads=[{id="10",
* target-id="Thread 0xb3d58ba0 (LWP 12876)",
@@ -72,9 +72,9 @@ import org.eclipse.cdt.dsf.concurrent.Immutable;
* frame={level="0",addr="0x08048609",func="main",args=[],file="../src/NonStop.cpp",fullname="/local/runtime-TestDSF/NonStop/src/NonStop.cpp",line="44"},
* state="stopped",
* core="3"}]
- *
+ *
* As of GDB 7.1, the --recurse option has been added and causes a different output
- *
+ *
* -list-thread-groups --recurse 1
* ^done,groups=[{id="12779",
* type="process",
@@ -102,11 +102,11 @@ import org.eclipse.cdt.dsf.concurrent.Immutable;
* core="3"}
* ]
* }]
- *
+ *
* Example of outputs by version on Linux
- *
+ *
* GDB 7.0
- *
+ *
* (when no inferior is running)
* -list-thread-groups
* ^done,groups=[]
@@ -114,29 +114,29 @@ import org.eclipse.cdt.dsf.concurrent.Immutable;
* (with an inferior running)
* -list-thread-groups
* ^done,groups=[{id="19386",type="process",pid="19386"}]
- *
+ *
* -list-thread-groups 19386
* ^done,threads=[{id="1",target-id="process 19386",frame={level="0",addr="0x08048618",func="main",args=[],file="a.cc",fullname="/local/lmckhou/testing/a.cc",line="9"},state="stopped"}]
- *
- * -list-thread-groups --available
+ *
+ * -list-thread-groups --available
* ^done,groups=[{id="19371",type="process",description="gdb.7.0 -i mi testing/a.out",user="lmckhou"},{id="19386",type="process",description="/local/lmckhou/testing/a.out",user="lmckhou"},{id="19413",type="process",description="sleep 5",user="lmckhou"}]
- *
+ *
* GDB 7.1
- *
+ *
* (when no inferior is running)
* -list-thread-groups
* ^done,groups=[{id="0",type="process",pid="0"}]
- *
+ *
* (with an inferior running)
* -list-thread-groups
* ^done,groups=[{id="19424",type="process",pid="19424",cores=["3"]}]
- *
+ *
* -list-thread-groups 19424
* ^done,threads=[{id="1",target-id="process 19424",frame={level="0",addr="0x08048618",func="main",args=[],file="a.cc",fullname="/local/lmckhou/testing/a.cc",line="9"},state="stopped",core="3"}]
- *
+ *
* -list-thread-groups --available
* ^done,groups=[{id="19418",type="process",description="gdb.7.1 -i mi testing/a.out",user="lmckhou"},{id="19424",type="process",description="/local/lmckhou/testing/a.out",user="lmckhou"},{id="19438",type="process",description="sleep 5",user="lmckhou"}]
- *
+ *
* -list-thread-groups --recurse 1
* ^done,groups=[{id="i2",type="process",pid="11805",executable="/home/lmckhou/Consumer",cores=["0","1"],
* threads=[{id="6",target-id="Thread 0xb6516b70 (LWP 11811)",state="running",core="1"},
@@ -153,23 +153,23 @@ import org.eclipse.cdt.dsf.concurrent.Immutable;
* {id="1",target-id="Thread 0xb7d1bb30 (LWP 11793)",state="running",core="1"}]}]
*
* GDB 7.2
- *
+ *
* (when no inferior is running)
* -list-thread-groups
* ^done,groups=[{id="i1",type="process",executable="/local/lmckhou/testing/a.out"}]
- *
+ *
* (with an inferior running)
* -list-thread-groups
* ^done,groups=[{id="i1",type="process",pid="19451",executable="/local/lmckhou/testing/a.out",cores=["2"]}]
- *
+ *
* -list-thread-groups i1
* ^done,threads=[{id="1",target-id="process 19451",frame={level="0",addr="0x08048618",func="main",args=[],file="a.cc",fullname="/local/lmckhou/testing/a.cc",line="9"},state="stopped",core="2"}]
- *
+ *
* -list-thread-groups --available
* ^done,groups=[{id="19445",type="process",description="gdb.7.2 -i mi testing/a.out",user="lmckhou"},{id="19451",type="process",description="/local/lmckhou/testing/a.out",user="lmckhou"},{id="19462",type="process",description="sleep 5",user="lmckhou"}]
*
* GDB 7.9
- *
+ *
* -list-thread-groups
* ^done,groups=[{id="i1",type="process",exit-code="0",executable="/home/lmckhou/runtime-TestDSF/DSFTestApp/Debug/DSFTestApp"}]
*
@@ -180,40 +180,47 @@ import org.eclipse.cdt.dsf.concurrent.Immutable;
*/
public class MIListThreadGroupsInfo extends MIInfo {
-
+
/**
* @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IThreadGroupInfo {
String getGroupId();
+
String getPid();
+
String getName();
+
String getDesciption();
+
/**@since 4.0 */
String getUser();
+
/**@since 4.0 */
String getType();
+
/**@since 4.0 */
String[] getCores();
+
/**@since 4.0 */
String getExecutable();
-
- /**
+
+ /**
* @return the exit code of this thread group.
* null if not applicable or not available.
* @since 4.7
*/
Integer getExitCode();
}
-
+
/**
* @since 4.1
*/
public interface IThreadGroupInfo2 extends IThreadGroupInfo {
MIThread[] getThreads();
}
-
+
/** @since 4.4 */
@Immutable
protected static class ThreadGroupInfo implements IThreadGroupInfo2 {
@@ -228,93 +235,115 @@ public class MIListThreadGroupsInfo extends MIInfo {
final MIThread[] fThreadList;
final Integer fExitCode;
- public ThreadGroupInfo(String id, String description, String type, String pid,
- String user, String[] cores, String exec, MIThread[] threads) {
+ public ThreadGroupInfo(String id, String description, String type, String pid, String user, String[] cores,
+ String exec, MIThread[] threads) {
this(id, description, type, pid, user, cores, exec, threads, null);
}
/** @since 4.7 */
- public ThreadGroupInfo(String id, String description, String type, String pid,
- String user, String[] cores, String exec, MIThread[] threads, Integer exitCode) {
+ public ThreadGroupInfo(String id, String description, String type, String pid, String user, String[] cores,
+ String exec, MIThread[] threads, Integer exitCode) {
fGroupId = id;
fDescription = description;
fType = type;
fUser = user;
fPid = pid;
- fCores = cores;
-
+ fCores = cores;
+
fExecutable = exec;
-
+
fName = parseName(fDescription);
-
+
fThreadList = threads;
-
+
fExitCode = exitCode;
}
-
+
protected String parseName(String desc) {
String name = ""; //$NON-NLS-1$
// Find the string "name: " followed by the smallest set of characters that
// is followed by a comma, or by the end of the line.
Pattern pattern = Pattern.compile("name: (.*?)(, |$)", Pattern.MULTILINE); //$NON-NLS-1$
- Matcher matcher = pattern.matcher(desc);
- if (matcher.find()) {
- name = matcher.group(1);
- } else {
- // If we didn't get the form "name: " then we expect to have the form
- // "/usr/sbin/dhcdbd --system"
- // or (starting with GDB 7.4)
- // "[migration/0]" where the integer represents the core, if the process
- // has an instance of many cores
- // "[kacpid]" when the process only runs on one core
- // "[async/mgr]"
- // "[jbd2/dm-1-8]"
- // The brackets indicate that the startup parameters are not available
- // We handle this case by removing the brackets and the core indicator
- // since GDB already tells us the core separately.
- if (!desc.isEmpty() && desc.charAt(0) == '[') {
- // Remove brackets
- name = desc.substring(1, desc.length()-1);
-
- // Look for [name/coreNum] pattern to remove /coreNum
- pattern = Pattern.compile("(.+?)(/\\d+)", Pattern.MULTILINE); //$NON-NLS-1$
- matcher = pattern.matcher(name);
- if (matcher.find()) {
- // Found a pattern /coreNum, so ignore it
- name = matcher.group(1);
- }
- // else, no /coreNum pattern, so the name is correct already
- } else {
- name = desc.split("\\s", 2)[0]; //$NON-NLS-1$
- }
- }
+ Matcher matcher = pattern.matcher(desc);
+ if (matcher.find()) {
+ name = matcher.group(1);
+ } else {
+ // If we didn't get the form "name: " then we expect to have the form
+ // "/usr/sbin/dhcdbd --system"
+ // or (starting with GDB 7.4)
+ // "[migration/0]" where the integer represents the core, if the process
+ // has an instance of many cores
+ // "[kacpid]" when the process only runs on one core
+ // "[async/mgr]"
+ // "[jbd2/dm-1-8]"
+ // The brackets indicate that the startup parameters are not available
+ // We handle this case by removing the brackets and the core indicator
+ // since GDB already tells us the core separately.
+ if (!desc.isEmpty() && desc.charAt(0) == '[') {
+ // Remove brackets
+ name = desc.substring(1, desc.length() - 1);
+
+ // Look for [name/coreNum] pattern to remove /coreNum
+ pattern = Pattern.compile("(.+?)(/\\d+)", Pattern.MULTILINE); //$NON-NLS-1$
+ matcher = pattern.matcher(name);
+ if (matcher.find()) {
+ // Found a pattern /coreNum, so ignore it
+ name = matcher.group(1);
+ }
+ // else, no /coreNum pattern, so the name is correct already
+ } else {
+ name = desc.split("\\s", 2)[0]; //$NON-NLS-1$
+ }
+ }
return name;
}
-
+
@Override
- public String getGroupId() { return fGroupId; }
+ public String getGroupId() {
+ return fGroupId;
+ }
+
@Override
- public String getPid() { return fPid; }
+ public String getPid() {
+ return fPid;
+ }
@Override
- public String getName() { return fName; }
+ public String getName() {
+ return fName;
+ }
@Override
- public String getDesciption() { return fDescription; }
+ public String getDesciption() {
+ return fDescription;
+ }
+
@Override
- public String[] getCores() { return fCores; }
+ public String[] getCores() {
+ return fCores;
+ }
+
@Override
- public String getUser() { return fUser; }
+ public String getUser() {
+ return fUser;
+ }
@Override
- public String getType() { return fType; }
+ public String getType() {
+ return fType;
+ }
+
@Override
- public String getExecutable() { return fExecutable; }
+ public String getExecutable() {
+ return fExecutable;
+ }
@Override
- public MIThread[] getThreads() { return fThreadList; }
+ public MIThread[] getThreads() {
+ return fThreadList;
+ }
/** @since 4.7 */
@Override
@@ -322,32 +351,36 @@ public class MIListThreadGroupsInfo extends MIInfo {
return fExitCode;
}
}
-
-
+
private IThreadGroupInfo[] fGroupList;
private MIThreadInfoInfo fThreadInfo;
-
- public MIListThreadGroupsInfo(MIOutput out) {
- super(out);
- parse();
+
+ public MIListThreadGroupsInfo(MIOutput out) {
+ super(out);
+ parse();
+ }
+
+ public IThreadGroupInfo[] getGroupList() {
+ return fGroupList;
}
-
- public IThreadGroupInfo[] getGroupList() { return fGroupList; }
- public MIThreadInfoInfo getThreadInfo() { return fThreadInfo; }
-
+
+ public MIThreadInfoInfo getThreadInfo() {
+ return fThreadInfo;
+ }
+
/** @since 4.4 */
protected void parse() {
if (isDone()) {
MIOutput out = getMIOutput();
MIResultRecord rr = out.getMIResultRecord();
if (rr != null) {
- MIResult[] results = rr.getMIResults();
+ MIResult[] results = rr.getMIResults();
for (int i = 0; i < results.length; i++) {
String var = results[i].getVariable();
if (var.equals("groups")) { //$NON-NLS-1$
MIValue val = results[i].getMIValue();
if (val instanceof MIList) {
- parseGroups((MIList)val);
+ parseGroups((MIList) val);
}
} else if (var.equals("threads")) { //$NON-NLS-1$
// Re-use the MIThreadInfoInfo parsing
@@ -370,76 +403,76 @@ public class MIListThreadGroupsInfo extends MIInfo {
protected MIThreadInfoInfo createMIThreadInfoInfo(MIOutput output) {
return new MIThreadInfoInfo(output);
}
-
+
/** @since 4.4 */
protected void parseGroups(MIList list) {
MIValue[] values = list.getMIValues();
fGroupList = new IThreadGroupInfo[values.length];
for (int i = 0; i < values.length; i++) {
- MIResult[] results = ((MITuple)values[i]).getMIResults();
+ MIResult[] results = ((MITuple) values[i]).getMIResults();
String id, desc, type, pid, exec, user;
id = desc = type = pid = exec = user = "";//$NON-NLS-1$
MIThread[] threads = null;
Integer exitCode = null;
-
+
String[] cores = null;
-
+
for (MIResult result : results) {
String var = result.getVariable();
if (var.equals("id")) { //$NON-NLS-1$
MIValue value = result.getMIValue();
if (value instanceof MIConst) {
- String str = ((MIConst)value).getCString();
+ String str = ((MIConst) value).getCString();
id = str.trim();
}
} else if (var.equals("description")) { //$NON-NLS-1$
MIValue value = result.getMIValue();
if (value instanceof MIConst) {
- String str = ((MIConst)value).getCString();
+ String str = ((MIConst) value).getCString();
desc = str.trim();
}
} else if (var.equals("type")) { //$NON-NLS-1$
MIValue value = result.getMIValue();
if (value instanceof MIConst) {
- String str = ((MIConst)value).getCString();
+ String str = ((MIConst) value).getCString();
type = str.trim();
}
} else if (var.equals("pid")) { //$NON-NLS-1$
MIValue value = result.getMIValue();
if (value instanceof MIConst) {
- String str = ((MIConst)value).getCString();
+ String str = ((MIConst) value).getCString();
pid = str.trim();
}
- } else if (var.equals("user")) { //$NON-NLS-1$
+ } else if (var.equals("user")) { //$NON-NLS-1$
MIValue value = result.getMIValue();
if (value instanceof MIConst) {
- String str = ((MIConst)value).getCString();
+ String str = ((MIConst) value).getCString();
user = str.trim();
}
} else if (var.equals("cores")) { //$NON-NLS-1$
// Starting with GDB 7.1
MIValue value = result.getMIValue();
if (value instanceof MIList) {
- cores = parseCores((MIList)value);
+ cores = parseCores((MIList) value);
}
} else if (var.equals("executable")) { //$NON-NLS-1$
// Starting with GDB 7.2
MIValue value = result.getMIValue();
if (value instanceof MIConst) {
- String str = ((MIConst)value).getCString();
+ String str = ((MIConst) value).getCString();
exec = str.trim();
}
} else if (var.equals("threads")) { //$NON-NLS-1$
// Starting with GDB 7.1
MIValue value = result.getMIValue();
if (value instanceof MIList) {
- threads = parseThreads(((MIList)value));
+ threads = parseThreads(((MIList) value));
}
} else if (var.equals("exit-code")) { //$NON-NLS-1$
// Starting with GDB 7.9
MIValue value = result.getMIValue();
if (value instanceof MIConst) {
- String str = ((MIConst)value).getCString();
+ String str = ((MIConst) value).getCString();
try {
// Must use 'decode' as GDB returns the value in octal format
exitCode = Integer.decode(str.trim());
@@ -465,15 +498,15 @@ public class MIListThreadGroupsInfo extends MIInfo {
protected MIThread[] parseThreads(MIList value) {
return MIThreadInfoInfo.parseThreads(value);
}
-
+
/** @since 4.4 */
protected String[] parseCores(MIList list) {
List<String> cores = new ArrayList<String>();
-
+
MIValue[] values = list.getMIValues();
for (int i = 0; i < values.length; i++) {
if (values[i] instanceof MIConst) {
- cores.add(((MIConst)values[i]).getCString());
+ cores.add(((MIConst) values[i]).getCString());
}
}
return cores.toArray(new String[cores.size()]);
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIMixedInstruction.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIMixedInstruction.java
index 612c390f5f7..5f57239776c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIMixedInstruction.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIMixedInstruction.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* QNX Software Systems - Initial API and implementation
* Ericsson - Adapted for DSF
@@ -23,95 +23,95 @@ import org.eclipse.cdt.dsf.debug.service.IMixedInstruction;
public class MIMixedInstruction implements IMixedInstruction {
- // The parsed information
- private String fileName = ""; //$NON-NLS-1$
- private String fullName = ""; //$NON-NLS-1$
- private int lineNumber = 0;
- private MIInstruction[] assemblyCode;
+ // The parsed information
+ private String fileName = ""; //$NON-NLS-1$
+ private String fullName = ""; //$NON-NLS-1$
+ private int lineNumber = 0;
+ private MIInstruction[] assemblyCode;
- public MIMixedInstruction(MITuple tuple) {
- parse(tuple);
- }
+ public MIMixedInstruction(MITuple tuple) {
+ parse(tuple);
+ }
@Override
- public String getFileName() {
+ public String getFileName() {
String result = getFullName();
- return result.isEmpty() ? fileName : result;
- }
+ return result.isEmpty() ? fileName : result;
+ }
@Override
- public int getLineNumber() {
- return lineNumber;
- }
+ public int getLineNumber() {
+ return lineNumber;
+ }
@Override
- public IInstruction[] getInstructions() {
- return assemblyCode;
- }
-
- /**
- * Parse the mixed instruction result. It has the following 3 fields:
- *
- * line="31",
- * file="/dir1/dir2/basics.c",
- * line_asm_insn=[
- * {address="0x000107c0",func-name="main",offset="4",inst="mov 2, %o0"},
- * {address="0x000107c4",func-name="main",offset="8",inst="sethi %hi(0x11800), %o2"},
- * ...,
- * {address="0x00010820",func-name="main",offset="100",inst="restore "}
- * ]
- */
- private void parse(MITuple tuple) {
- List<MIInstruction> instructions = new ArrayList<MIInstruction>();
- MIResult[] results = tuple.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- MIValue value = results[i].getMIValue();
- String str = ""; //$NON-NLS-1$
-
- if (value != null && value instanceof MIConst) {
- str = ((MIConst) value).getCString();
- }
-
- if (var.equals("line")) { //$NON-NLS-1$
- try {
- lineNumber = Integer.parseInt(str.trim());
- } catch (NumberFormatException e) {
- }
- continue;
- }
-
- if (var.equals("file")) { //$NON-NLS-1$
- fileName = str;
- continue;
- }
-
- if (var.equals("fullname")) { //$NON-NLS-1$
- fullName = str;
- continue;
- }
-
- if (var.equals("line_asm_insn")) { //$NON-NLS-1$
- if (value instanceof MIList) {
- MIList list = (MIList) value;
- MIValue[] values = list.getMIValues();
- for (int j = 0; j < values.length; j++) {
- if (values[j] instanceof MITuple) {
- instructions.add(new MIInstruction((MITuple) values[j]));
- }
- }
- }
- }
- }
- assemblyCode = instructions.toArray(new MIInstruction[instructions.size()]);
-
- }
-
- /**
- * Get full source path as reported by gdb-mi "fullname" attribute.
+ public IInstruction[] getInstructions() {
+ return assemblyCode;
+ }
+
+ /**
+ * Parse the mixed instruction result. It has the following 3 fields:
+ *
+ * line="31",
+ * file="/dir1/dir2/basics.c",
+ * line_asm_insn=[
+ * {address="0x000107c0",func-name="main",offset="4",inst="mov 2, %o0"},
+ * {address="0x000107c4",func-name="main",offset="8",inst="sethi %hi(0x11800), %o2"},
+ * ...,
+ * {address="0x00010820",func-name="main",offset="100",inst="restore "}
+ * ]
+ */
+ private void parse(MITuple tuple) {
+ List<MIInstruction> instructions = new ArrayList<MIInstruction>();
+ MIResult[] results = tuple.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ MIValue value = results[i].getMIValue();
+ String str = ""; //$NON-NLS-1$
+
+ if (value != null && value instanceof MIConst) {
+ str = ((MIConst) value).getCString();
+ }
+
+ if (var.equals("line")) { //$NON-NLS-1$
+ try {
+ lineNumber = Integer.parseInt(str.trim());
+ } catch (NumberFormatException e) {
+ }
+ continue;
+ }
+
+ if (var.equals("file")) { //$NON-NLS-1$
+ fileName = str;
+ continue;
+ }
+
+ if (var.equals("fullname")) { //$NON-NLS-1$
+ fullName = str;
+ continue;
+ }
+
+ if (var.equals("line_asm_insn")) { //$NON-NLS-1$
+ if (value instanceof MIList) {
+ MIList list = (MIList) value;
+ MIValue[] values = list.getMIValues();
+ for (int j = 0; j < values.length; j++) {
+ if (values[j] instanceof MITuple) {
+ instructions.add(new MIInstruction((MITuple) values[j]));
+ }
+ }
+ }
+ }
+ }
+ assemblyCode = instructions.toArray(new MIInstruction[instructions.size()]);
+
+ }
+
+ /**
+ * Get full source path as reported by gdb-mi "fullname" attribute.
* @since 4.4
*/
- public String getFullName() {
- return fullName;
- }
+ public String getFullName() {
+ return fullName;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MINotifyAsyncOutput.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MINotifyAsyncOutput.java
index 850e1e33308..ed3026359cb 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MINotifyAsyncOutput.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MINotifyAsyncOutput.java
@@ -19,10 +19,10 @@ package org.eclipse.cdt.dsf.mi.service.command.output;
* Represents an asynchronous OOB record from gdb that provides supplementary,
* important information that is likely of interest to the client, e.g.,
* notification that a new breakpoint has been created.
- *
+ *
* <p>
* All such output is prefixed by `='.
- *
+ *
* @see MIAsyncRecord
*/
public class MINotifyAsyncOutput extends MIAsyncRecord {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIOutput.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIOutput.java
index b134952168d..50327d41082 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIOutput.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIOutput.java
@@ -11,7 +11,7 @@
* Contributors:
* QNX Software Systems - Initial API and implementation
* Wind River Systems - Modified for new DSF Reference Implementation
- * Ericsson - Modified for additional features in DSF Reference Implementation
+ * Ericsson - Modified for additional features in DSF Reference Implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command.output;
@@ -21,26 +21,26 @@ package org.eclipse.cdt.dsf.mi.service.command.output;
*/
public class MIOutput {
- private final MIResultRecord rr;
- private final MIOOBRecord[] oobs;
+ private final MIResultRecord rr;
+ private final MIOOBRecord[] oobs;
private MIStreamRecord[] streamRecords;
- public MIOutput() {
- this(null, (MIOOBRecord[])null);
- }
+ public MIOutput() {
+ this(null, (MIOOBRecord[]) null);
+ }
- /**
- * @param oob
- * @deprecated Use {@link #MIOutput(MIOOBRecord, MIStreamRecord[])}
- */
- @Deprecated
+ /**
+ * @param oob
+ * @deprecated Use {@link #MIOutput(MIOOBRecord, MIStreamRecord[])}
+ */
+ @Deprecated
public MIOutput(MIOOBRecord oob) {
- this(null, new MIOOBRecord[] { oob });
- }
+ this(null, new MIOOBRecord[] { oob });
+ }
/**
* Constructor used when handling a single out-of-band record
- *
+ *
* @param the
* out-of-bound record
* @param streamRecords
@@ -52,15 +52,15 @@ public class MIOutput {
* records. Must not be null; may be empty
* @since 3.0
*/
- public MIOutput(MIOOBRecord oob, MIStreamRecord[] streamRecords) {
- this(null, new MIOOBRecord[] { oob });
- this.streamRecords = streamRecords;
- assert streamRecords != null;
- }
+ public MIOutput(MIOOBRecord oob, MIStreamRecord[] streamRecords) {
+ this(null, new MIOOBRecord[] { oob });
+ this.streamRecords = streamRecords;
+ assert streamRecords != null;
+ }
/**
* Constructor used when handling a command result.
- *
+ *
* @param rr
* the result record
* @param oobs
@@ -69,24 +69,24 @@ public class MIOutput {
* a while since the last command (for practical reasons, there
* is a cap on the number of OOB records that are remembered).
* This will have the most recent records.
- *
+ *
*/
- public MIOutput(MIResultRecord rr, MIOOBRecord[] oobs) {
- this.rr = rr;
- this.oobs = oobs;
- }
-
- public MIResultRecord getMIResultRecord() {
- return rr;
- }
+ public MIOutput(MIResultRecord rr, MIOOBRecord[] oobs) {
+ this.rr = rr;
+ this.oobs = oobs;
+ }
+
+ public MIResultRecord getMIResultRecord() {
+ return rr;
+ }
- public MIOOBRecord[] getMIOOBRecords() {
- return oobs;
- }
+ public MIOOBRecord[] getMIOOBRecords() {
+ return oobs;
+ }
/**
* See param in {@link #MIOutput(MIOOBRecord, MIStreamRecord[])}
- *
+ *
* @return Only instances created for an OOB record will have stream
* records; may be an empty collection in that case, but not null.
* Instances created for a command result will return null from this
@@ -94,19 +94,19 @@ public class MIOutput {
* {@link #getMIOOBRecords()} in that case.
* @since 3.0
*/
- public MIStreamRecord[] getStreamRecords() {
- return streamRecords;
- }
+ public MIStreamRecord[] getStreamRecords() {
+ return streamRecords;
+ }
- @Override
- public String toString() {
- StringBuilder buffer = new StringBuilder();
- for (int i = 0; i < oobs.length; i++) {
- buffer.append(oobs[i].toString());
- }
- if (rr != null) {
- buffer.append(rr.toString());
- }
- return buffer.toString();
- }
+ @Override
+ public String toString() {
+ StringBuilder buffer = new StringBuilder();
+ for (int i = 0; i < oobs.length; i++) {
+ buffer.append(oobs[i].toString());
+ }
+ if (rr != null) {
+ buffer.append(rr.toString());
+ }
+ return buffer.toString();
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIParser.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIParser.java
index eb486c9b10a..7e0b3c5b48e 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIParser.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIParser.java
@@ -95,491 +95,493 @@ import java.util.List;
</pre>
*/
public class MIParser {
- public enum RecordType { ResultRecord, OOBRecord, PrimaryPrompt }
-
- public String primaryPrompt = "(gdb)"; //$NON-NLS-1$
- public String cliPrompt = primaryPrompt;
- public String secondaryPrompt = ">"; //$NON-NLS-1$
-
- public RecordType getRecordType(String line) {
- int i = 0;
- if (Character.isDigit(line.charAt(0))) {
- i = 1;
- while (i < line.length() && Character.isDigit(line.charAt(i))) {
- i++;
- }
- }
-
- if (i < line.length() && line.charAt(i) == '^') {
- return RecordType.ResultRecord;
- } else if (line.startsWith(primaryPrompt, i)) {
- return RecordType.PrimaryPrompt;
- //break; // Do nothing.
- } else {
- return RecordType.OOBRecord;
- }
- }
-
- /**
- *
- */
- public MIResultRecord parseMIResultRecord(String line) {
- StringBuffer buffer = new StringBuffer(line);
- // Fetch the Token/Id
- int id = parseToken(buffer);
- // Consume the '^'
- buffer.deleteCharAt(0);
-
- MIResultRecord rr = new MIResultRecord();
- rr.setToken(id);
- if (buffer.toString().startsWith(MIResultRecord.DONE)) {
- rr.setResultClass(MIResultRecord.DONE);
- buffer.delete(0, MIResultRecord.DONE.length());
- } else if (buffer.toString().startsWith(MIResultRecord.ERROR)) {
- rr.setResultClass(MIResultRecord.ERROR);
- buffer.delete(0, MIResultRecord.ERROR.length());
- } else if (buffer.toString().startsWith(MIResultRecord.EXIT)) {
- rr.setResultClass(MIResultRecord.EXIT);
- buffer.delete(0, MIResultRecord.EXIT.length());
- } else if (buffer.toString().startsWith(MIResultRecord.RUNNING)) {
- rr.setResultClass(MIResultRecord.RUNNING);
- buffer.delete(0, MIResultRecord.RUNNING.length());
- } else if (buffer.toString().startsWith(MIResultRecord.CONNECTED)) {
- rr.setResultClass(MIResultRecord.CONNECTED);
- buffer.delete(0, MIResultRecord.CONNECTED.length());
- } else {
- // Error throw an exception?
- }
-
- // Results are separated by commas.
- if (buffer.length() > 0 && buffer.charAt(0) == ',') {
- buffer.deleteCharAt(0);
- MIResult[] res = processMIResults(new FSB(buffer));
- rr.setMIResults(res);
- }
- return rr;
- }
-
- /**
- * Find OutOfBand Records depending on the starting token.
- */
- public MIOOBRecord parseMIOOBRecord(String line) {
- StringBuffer buffer = new StringBuffer(line);
- int id = parseToken(buffer);
- MIOOBRecord oob = null;
- char c = buffer.length() != 0 ? buffer.charAt(0) : 0;
- if (c == '*' || c == '+' || c == '=') {
- // Consume the first char
- buffer.deleteCharAt(0);
- MIAsyncRecord async = null;
- switch (c) {
- case '*' :
- async = new MIExecAsyncOutput();
- break;
-
- case '+' :
- async = new MIStatusAsyncOutput();
- break;
-
- case '=' :
- async = new MINotifyAsyncOutput();
- break;
- default :
- assert false;
- async = new MINotifyAsyncOutput();
- }
- async.setToken(id);
- // Extract the Async-Class
- int i = buffer.toString().indexOf(',');
- if (i != -1) {
- String asyncClass = buffer.substring(0, i);
- async.setAsyncClass(asyncClass);
- // Consume the async-class and the comma
- buffer.delete(0, i + 1);
- } else {
- async.setAsyncClass(buffer.toString().trim());
- buffer.setLength(0);
- }
- MIResult[] res = processMIResults(new FSB(buffer));
- async.setMIResults(res);
- oob = async;
- } else if (c == '~' || c == '@' || c == '&') {
- // Consume the first char
- buffer.deleteCharAt(0);
- MIStreamRecord stream = null;
- switch (c) {
- case '~' :
- stream = new MIConsoleStreamOutput();
- break;
-
- case '@' :
- stream = new MITargetStreamOutput();
- break;
-
- case '&' :
- stream = new MILogStreamOutput();
- break;
- default :
- assert false;
- stream = new MIConsoleStreamOutput();
- }
- // translateCString() assumes that the leading " is deleted
- if (buffer.length() > 0 && buffer.charAt(0) == '"') {
- buffer.deleteCharAt(0);
- }
- // Don't parse any backslashes - backslashes within stream records
- // aren't escaped.
- stream.setCString(translateCString(new FSB(buffer), false));
- oob = stream;
- } else {
- // Badly format MI line, just pass it to the user as target stream
- MIStreamRecord stream = new MITargetStreamOutput();
- stream.setCString(line + "\n"); //$NON-NLS-1$
- oob = stream;
- }
- return oob;
- }
-
- private int parseToken(StringBuffer buffer) {
- int id = -1;
- // Fetch the Token/Id
- if (Character.isDigit(buffer.charAt(0))) {
- int i = 1;
- while (i < buffer.length() && Character.isDigit(buffer.charAt(i))) {
- i++;
- }
- String numbers = buffer.substring(0, i);
- try {
- id = Integer.parseInt(numbers);
- } catch (NumberFormatException e) {
- }
- // Consume the token.
- buffer.delete(0, i);
- }
- return id;
- }
-
- /**
- * Assuming that the usual leading comma was consumed.
- * Extract the MI Result comma seperated responses.
- */
- private MIResult[] processMIResults(FSB buffer) {
- List<MIResult> aList = new ArrayList<MIResult>();
- MIResult result = processMIResult(buffer);
- if (result != null) {
- aList.add(result);
- }
- while (buffer.length() > 0 && buffer.charAt(0) == ',') {
- buffer.deleteCharAt(0);
- result = processMIResult(buffer);
- if (result != null) {
- aList.add(result);
- }
- }
- return aList.toArray(new MIResult[aList.size()]);
- }
-
- /**
- * Construct the DsfMIResult. Characters will be consume/delete
- * moving forward constructing the AST.
- */
- private MIResult processMIResult(FSB buffer) {
- MIResult result = new MIResult();
- int equal;
- if (buffer.length() > 0 && Character.isLetter(buffer.charAt(0)) && (equal = buffer.indexOf('=')) != -1) {
- // Result is a variable and value
- String variable = buffer.substring(0, equal);
- result.setVariable(variable);
- buffer.delete(0, equal + 1);
- MIValue value = processMIValue(buffer);
- result.setMIValue(value);
- } else {
- MIValue value = processMIValue(buffer);
- if (value != null) {
- // Result is a value only (bug 527419)
- result.setMIValue(value);
- } else {
- result.setVariable(buffer.toString());
- result.setMIValue(new MIConst()); // Empty string:???
- buffer.setLength(0);
- }
- }
- return result;
- }
-
- /**
- * Find a DsfMIValue implementation or return null.
- */
- private MIValue processMIValue(FSB buffer) {
- MIValue value = null;
- if (buffer.length() > 0) {
- if (buffer.charAt(0) == '{') {
- buffer.deleteCharAt(0);
- value = processMITuple(buffer);
- } else if (buffer.charAt(0) == '[') {
- buffer.deleteCharAt(0);
- value = processMIList(buffer);
- } else if (buffer.charAt(0) == '"') {
- buffer.deleteCharAt(0);
- MIConst cnst = new MIConst();
- // Parse backslashes - backslashes within result
- // and out of band records are escaped.
- cnst.setCString(translateCString(buffer, true));
- value = cnst;
- }
- }
- return value;
- }
-
- /**
- * Assuming the starting '{' was deleted form the StringBuffer,
- * go to the closing '}' consuming/deleting all the characters.
- * This is usually call by processMIvalue();
- */
- private MIValue processMITuple(FSB buffer) {
- MITuple tuple = new MITuple();
- List<MIValue> valueList = new ArrayList<MIValue>();
- List<MIResult> resultList = new ArrayList<MIResult>();
- // Catch closing '}'
- while (buffer.length() > 0 && buffer.charAt(0) != '}') {
- // Try for the DsfMIValue first
- MIValue value = processMIValue(buffer);
- if (value != null) {
- valueList.add(value);
- } else {
- MIResult result = processMIResult(buffer);
- if (result != null) {
- resultList.add(result);
- }
- }
- if (buffer.length() > 0 && buffer.charAt(0) == ',') {
- buffer.deleteCharAt(0);
- }
- }
- if (buffer.length() > 0 && buffer.charAt(0) == '}') {
- buffer.deleteCharAt(0);
- }
- MIValue[] values = valueList.toArray(new MIValue[valueList.size()]);
- MIResult[] res = resultList.toArray(new MIResult[resultList.size()]);
- tuple.setMIValues(values);
- tuple.setMIResults(res);
- return tuple;
- }
-
- /**
- * Assuming the leading '[' was deleted, find the closing
- * ']' consuming/delete chars from the StringBuffer.
- */
- private MIValue processMIList(FSB buffer) {
- MIList list = new MIList();
- List<MIValue> valueList = new ArrayList<MIValue>();
- List<MIResult> resultList = new ArrayList<MIResult>();
- // catch closing ']'
- while (buffer.length() > 0 && buffer.charAt(0) != ']') {
- // Try for the DsfMIValue first
- MIValue value = processMIValue(buffer);
- if (value != null) {
- valueList.add(value);
- } else {
- MIResult result = processMIResult(buffer);
- if (result != null) {
- resultList.add(result);
- }
- }
- if (buffer.length() > 0 && buffer.charAt(0) == ',') {
- buffer.deleteCharAt(0);
- }
- }
- if (buffer.length() > 0 && buffer.charAt(0) == ']') {
- buffer.deleteCharAt(0);
- }
- MIValue[] values = valueList.toArray(new MIValue[valueList.size()]);
- MIResult[] res = resultList.toArray(new MIResult[resultList.size()]);
- list.setMIValues(values);
- list.setMIResults(res);
- return list;
- }
-
- /**
- * MI C-String rather MIConst values are enclosed in double quotes
- * and any double quotes or backslashes in the string are escaped.
- * Assuming the starting double quote was removed. This method will
- * stop at the closing double quote, remove the extra backslash escaping
- * and return the string __without__ the enclosing double quotes. The
- * original string buffer will move forward.
- * @param buffer The string buffer to read from.
- * @param parseBackslashes Defines whether backslashes should be parsed.
- * This parameter is necessary to differentiate between records which
- * contain escaped backslashes and records which do not.
- * @return The translated C string.
- */
- private String translateCString(FSB buffer, boolean parseBackslashes) {
- boolean escape = false;
- boolean closingQuotes = false;
-
- StringBuffer sb = new StringBuffer();
-
- int index = 0;
- for (; index < buffer.length() && !closingQuotes; index++) {
- char c = buffer.charAt(index);
- if (c == '\\') {
- if (escape) {
- sb.append(c);
- if (!parseBackslashes) {
- sb.append(c);
- }
- escape = false;
- } else {
- escape = true;
- }
- } else if (c == '"') {
- if (escape) {
- sb.append(c);
- escape = false;
- } else {
- // Bail out.
- closingQuotes = true;
- }
- } else {
- if (escape) {
- sb.append('\\');
- }
- sb.append(c);
- escape = false;
- }
- }
- buffer.delete(0, index);
- return sb.toString();
- }
-
- /**
- * Tests if this string starts with the specified prefix beginning
- * a specified index.
- *
- * @param value the string.
- * @param prefix the prefix.
- * @return <code>true</code> if prefix starts value.
- */
- public boolean startsWith(StringBuffer value, String prefix) {
- int vlen = value.length();
- int plen = prefix.length();
-
- if (vlen < plen) {
- return false;
- }
- for (int i = 0; i < plen; i++) {
- if (value.charAt(i) != prefix.charAt(i)) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Fast String Buffer class. MIParser does a lot
- * of deleting off the front of a string, that's clearly
- * an order N operation for StringBuffer which makes
- * the MIParser an order N^2 operation. There are "issues"
- * with this for large arrays. Use of FSB rather than String
- * Buffer makes MIParser N rather than N^2 because FSB can
- * delete from the front in constant time.
- */
- public class FSB {
- StringBuffer buf;
- int pos;
- boolean shared;
-
- public FSB(StringBuffer buf) {
- this.buf = buf;
- pos = 0;
- shared = false;
- }
-
- public FSB(FSB fbuf) {
- pos = fbuf.pos;
- buf = fbuf.buf;
- shared = true;
- }
-
- public int length() {
- int res = buf.length() - pos;
- if (res < 0)
- return 0;
-
- return res;
- }
-
- public char charAt(int index) {
- return buf.charAt(index + pos);
- }
-
- private void resolveCopy() {
- if (shared) {
- buf = new StringBuffer(buf.toString());
- shared = false;
- }
- }
-
- public FSB deleteCharAt(int index) {
- if (index == 0) {
- pos++;
- } else {
- resolveCopy();
- buf = buf.deleteCharAt(pos + index);
- }
-
- return this;
- }
-
- public FSB delete(int start, int end) {
- if (start == 0) {
- pos = pos + end - start;
- } else {
- resolveCopy();
- buf.delete(start + pos, end + pos);
- }
-
- return this;
- }
-
- public void setLength(int a) {
- if (a == 0)
- pos = buf.length();
- else {
- // panic! fortunately we don't do this.
- }
- }
-
- public String substring(int start, int end) {
- return buf.substring(start + pos, end + pos);
- }
-
- @Override
- public String toString() {
- return buf.substring(pos, buf.length());
- }
-
- int indexOf(char c) {
- int len = buf.length();
- for (int i = pos; i < len; i++) {
- if (buf.charAt(i) == c)
- return i - pos;
- }
-
- return -1;
- }
-
- boolean startsWith(String s) {
- int len = Math.min(s.length(), length());
- if (len < s.length())
- return false;
-
- for (int i = 0; i < len; i++) {
- if (s.charAt(i) != buf.charAt(pos + i))
- return false;
- }
-
- return true;
- }
- }
+ public enum RecordType {
+ ResultRecord, OOBRecord, PrimaryPrompt
+ }
+
+ public String primaryPrompt = "(gdb)"; //$NON-NLS-1$
+ public String cliPrompt = primaryPrompt;
+ public String secondaryPrompt = ">"; //$NON-NLS-1$
+
+ public RecordType getRecordType(String line) {
+ int i = 0;
+ if (Character.isDigit(line.charAt(0))) {
+ i = 1;
+ while (i < line.length() && Character.isDigit(line.charAt(i))) {
+ i++;
+ }
+ }
+
+ if (i < line.length() && line.charAt(i) == '^') {
+ return RecordType.ResultRecord;
+ } else if (line.startsWith(primaryPrompt, i)) {
+ return RecordType.PrimaryPrompt;
+ //break; // Do nothing.
+ } else {
+ return RecordType.OOBRecord;
+ }
+ }
+
+ /**
+ *
+ */
+ public MIResultRecord parseMIResultRecord(String line) {
+ StringBuffer buffer = new StringBuffer(line);
+ // Fetch the Token/Id
+ int id = parseToken(buffer);
+ // Consume the '^'
+ buffer.deleteCharAt(0);
+
+ MIResultRecord rr = new MIResultRecord();
+ rr.setToken(id);
+ if (buffer.toString().startsWith(MIResultRecord.DONE)) {
+ rr.setResultClass(MIResultRecord.DONE);
+ buffer.delete(0, MIResultRecord.DONE.length());
+ } else if (buffer.toString().startsWith(MIResultRecord.ERROR)) {
+ rr.setResultClass(MIResultRecord.ERROR);
+ buffer.delete(0, MIResultRecord.ERROR.length());
+ } else if (buffer.toString().startsWith(MIResultRecord.EXIT)) {
+ rr.setResultClass(MIResultRecord.EXIT);
+ buffer.delete(0, MIResultRecord.EXIT.length());
+ } else if (buffer.toString().startsWith(MIResultRecord.RUNNING)) {
+ rr.setResultClass(MIResultRecord.RUNNING);
+ buffer.delete(0, MIResultRecord.RUNNING.length());
+ } else if (buffer.toString().startsWith(MIResultRecord.CONNECTED)) {
+ rr.setResultClass(MIResultRecord.CONNECTED);
+ buffer.delete(0, MIResultRecord.CONNECTED.length());
+ } else {
+ // Error throw an exception?
+ }
+
+ // Results are separated by commas.
+ if (buffer.length() > 0 && buffer.charAt(0) == ',') {
+ buffer.deleteCharAt(0);
+ MIResult[] res = processMIResults(new FSB(buffer));
+ rr.setMIResults(res);
+ }
+ return rr;
+ }
+
+ /**
+ * Find OutOfBand Records depending on the starting token.
+ */
+ public MIOOBRecord parseMIOOBRecord(String line) {
+ StringBuffer buffer = new StringBuffer(line);
+ int id = parseToken(buffer);
+ MIOOBRecord oob = null;
+ char c = buffer.length() != 0 ? buffer.charAt(0) : 0;
+ if (c == '*' || c == '+' || c == '=') {
+ // Consume the first char
+ buffer.deleteCharAt(0);
+ MIAsyncRecord async = null;
+ switch (c) {
+ case '*':
+ async = new MIExecAsyncOutput();
+ break;
+
+ case '+':
+ async = new MIStatusAsyncOutput();
+ break;
+
+ case '=':
+ async = new MINotifyAsyncOutput();
+ break;
+ default:
+ assert false;
+ async = new MINotifyAsyncOutput();
+ }
+ async.setToken(id);
+ // Extract the Async-Class
+ int i = buffer.toString().indexOf(',');
+ if (i != -1) {
+ String asyncClass = buffer.substring(0, i);
+ async.setAsyncClass(asyncClass);
+ // Consume the async-class and the comma
+ buffer.delete(0, i + 1);
+ } else {
+ async.setAsyncClass(buffer.toString().trim());
+ buffer.setLength(0);
+ }
+ MIResult[] res = processMIResults(new FSB(buffer));
+ async.setMIResults(res);
+ oob = async;
+ } else if (c == '~' || c == '@' || c == '&') {
+ // Consume the first char
+ buffer.deleteCharAt(0);
+ MIStreamRecord stream = null;
+ switch (c) {
+ case '~':
+ stream = new MIConsoleStreamOutput();
+ break;
+
+ case '@':
+ stream = new MITargetStreamOutput();
+ break;
+
+ case '&':
+ stream = new MILogStreamOutput();
+ break;
+ default:
+ assert false;
+ stream = new MIConsoleStreamOutput();
+ }
+ // translateCString() assumes that the leading " is deleted
+ if (buffer.length() > 0 && buffer.charAt(0) == '"') {
+ buffer.deleteCharAt(0);
+ }
+ // Don't parse any backslashes - backslashes within stream records
+ // aren't escaped.
+ stream.setCString(translateCString(new FSB(buffer), false));
+ oob = stream;
+ } else {
+ // Badly format MI line, just pass it to the user as target stream
+ MIStreamRecord stream = new MITargetStreamOutput();
+ stream.setCString(line + "\n"); //$NON-NLS-1$
+ oob = stream;
+ }
+ return oob;
+ }
+
+ private int parseToken(StringBuffer buffer) {
+ int id = -1;
+ // Fetch the Token/Id
+ if (Character.isDigit(buffer.charAt(0))) {
+ int i = 1;
+ while (i < buffer.length() && Character.isDigit(buffer.charAt(i))) {
+ i++;
+ }
+ String numbers = buffer.substring(0, i);
+ try {
+ id = Integer.parseInt(numbers);
+ } catch (NumberFormatException e) {
+ }
+ // Consume the token.
+ buffer.delete(0, i);
+ }
+ return id;
+ }
+
+ /**
+ * Assuming that the usual leading comma was consumed.
+ * Extract the MI Result comma seperated responses.
+ */
+ private MIResult[] processMIResults(FSB buffer) {
+ List<MIResult> aList = new ArrayList<MIResult>();
+ MIResult result = processMIResult(buffer);
+ if (result != null) {
+ aList.add(result);
+ }
+ while (buffer.length() > 0 && buffer.charAt(0) == ',') {
+ buffer.deleteCharAt(0);
+ result = processMIResult(buffer);
+ if (result != null) {
+ aList.add(result);
+ }
+ }
+ return aList.toArray(new MIResult[aList.size()]);
+ }
+
+ /**
+ * Construct the DsfMIResult. Characters will be consume/delete
+ * moving forward constructing the AST.
+ */
+ private MIResult processMIResult(FSB buffer) {
+ MIResult result = new MIResult();
+ int equal;
+ if (buffer.length() > 0 && Character.isLetter(buffer.charAt(0)) && (equal = buffer.indexOf('=')) != -1) {
+ // Result is a variable and value
+ String variable = buffer.substring(0, equal);
+ result.setVariable(variable);
+ buffer.delete(0, equal + 1);
+ MIValue value = processMIValue(buffer);
+ result.setMIValue(value);
+ } else {
+ MIValue value = processMIValue(buffer);
+ if (value != null) {
+ // Result is a value only (bug 527419)
+ result.setMIValue(value);
+ } else {
+ result.setVariable(buffer.toString());
+ result.setMIValue(new MIConst()); // Empty string:???
+ buffer.setLength(0);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Find a DsfMIValue implementation or return null.
+ */
+ private MIValue processMIValue(FSB buffer) {
+ MIValue value = null;
+ if (buffer.length() > 0) {
+ if (buffer.charAt(0) == '{') {
+ buffer.deleteCharAt(0);
+ value = processMITuple(buffer);
+ } else if (buffer.charAt(0) == '[') {
+ buffer.deleteCharAt(0);
+ value = processMIList(buffer);
+ } else if (buffer.charAt(0) == '"') {
+ buffer.deleteCharAt(0);
+ MIConst cnst = new MIConst();
+ // Parse backslashes - backslashes within result
+ // and out of band records are escaped.
+ cnst.setCString(translateCString(buffer, true));
+ value = cnst;
+ }
+ }
+ return value;
+ }
+
+ /**
+ * Assuming the starting '{' was deleted form the StringBuffer,
+ * go to the closing '}' consuming/deleting all the characters.
+ * This is usually call by processMIvalue();
+ */
+ private MIValue processMITuple(FSB buffer) {
+ MITuple tuple = new MITuple();
+ List<MIValue> valueList = new ArrayList<MIValue>();
+ List<MIResult> resultList = new ArrayList<MIResult>();
+ // Catch closing '}'
+ while (buffer.length() > 0 && buffer.charAt(0) != '}') {
+ // Try for the DsfMIValue first
+ MIValue value = processMIValue(buffer);
+ if (value != null) {
+ valueList.add(value);
+ } else {
+ MIResult result = processMIResult(buffer);
+ if (result != null) {
+ resultList.add(result);
+ }
+ }
+ if (buffer.length() > 0 && buffer.charAt(0) == ',') {
+ buffer.deleteCharAt(0);
+ }
+ }
+ if (buffer.length() > 0 && buffer.charAt(0) == '}') {
+ buffer.deleteCharAt(0);
+ }
+ MIValue[] values = valueList.toArray(new MIValue[valueList.size()]);
+ MIResult[] res = resultList.toArray(new MIResult[resultList.size()]);
+ tuple.setMIValues(values);
+ tuple.setMIResults(res);
+ return tuple;
+ }
+
+ /**
+ * Assuming the leading '[' was deleted, find the closing
+ * ']' consuming/delete chars from the StringBuffer.
+ */
+ private MIValue processMIList(FSB buffer) {
+ MIList list = new MIList();
+ List<MIValue> valueList = new ArrayList<MIValue>();
+ List<MIResult> resultList = new ArrayList<MIResult>();
+ // catch closing ']'
+ while (buffer.length() > 0 && buffer.charAt(0) != ']') {
+ // Try for the DsfMIValue first
+ MIValue value = processMIValue(buffer);
+ if (value != null) {
+ valueList.add(value);
+ } else {
+ MIResult result = processMIResult(buffer);
+ if (result != null) {
+ resultList.add(result);
+ }
+ }
+ if (buffer.length() > 0 && buffer.charAt(0) == ',') {
+ buffer.deleteCharAt(0);
+ }
+ }
+ if (buffer.length() > 0 && buffer.charAt(0) == ']') {
+ buffer.deleteCharAt(0);
+ }
+ MIValue[] values = valueList.toArray(new MIValue[valueList.size()]);
+ MIResult[] res = resultList.toArray(new MIResult[resultList.size()]);
+ list.setMIValues(values);
+ list.setMIResults(res);
+ return list;
+ }
+
+ /**
+ * MI C-String rather MIConst values are enclosed in double quotes
+ * and any double quotes or backslashes in the string are escaped.
+ * Assuming the starting double quote was removed. This method will
+ * stop at the closing double quote, remove the extra backslash escaping
+ * and return the string __without__ the enclosing double quotes. The
+ * original string buffer will move forward.
+ * @param buffer The string buffer to read from.
+ * @param parseBackslashes Defines whether backslashes should be parsed.
+ * This parameter is necessary to differentiate between records which
+ * contain escaped backslashes and records which do not.
+ * @return The translated C string.
+ */
+ private String translateCString(FSB buffer, boolean parseBackslashes) {
+ boolean escape = false;
+ boolean closingQuotes = false;
+
+ StringBuffer sb = new StringBuffer();
+
+ int index = 0;
+ for (; index < buffer.length() && !closingQuotes; index++) {
+ char c = buffer.charAt(index);
+ if (c == '\\') {
+ if (escape) {
+ sb.append(c);
+ if (!parseBackslashes) {
+ sb.append(c);
+ }
+ escape = false;
+ } else {
+ escape = true;
+ }
+ } else if (c == '"') {
+ if (escape) {
+ sb.append(c);
+ escape = false;
+ } else {
+ // Bail out.
+ closingQuotes = true;
+ }
+ } else {
+ if (escape) {
+ sb.append('\\');
+ }
+ sb.append(c);
+ escape = false;
+ }
+ }
+ buffer.delete(0, index);
+ return sb.toString();
+ }
+
+ /**
+ * Tests if this string starts with the specified prefix beginning
+ * a specified index.
+ *
+ * @param value the string.
+ * @param prefix the prefix.
+ * @return <code>true</code> if prefix starts value.
+ */
+ public boolean startsWith(StringBuffer value, String prefix) {
+ int vlen = value.length();
+ int plen = prefix.length();
+
+ if (vlen < plen) {
+ return false;
+ }
+ for (int i = 0; i < plen; i++) {
+ if (value.charAt(i) != prefix.charAt(i)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Fast String Buffer class. MIParser does a lot
+ * of deleting off the front of a string, that's clearly
+ * an order N operation for StringBuffer which makes
+ * the MIParser an order N^2 operation. There are "issues"
+ * with this for large arrays. Use of FSB rather than String
+ * Buffer makes MIParser N rather than N^2 because FSB can
+ * delete from the front in constant time.
+ */
+ public class FSB {
+ StringBuffer buf;
+ int pos;
+ boolean shared;
+
+ public FSB(StringBuffer buf) {
+ this.buf = buf;
+ pos = 0;
+ shared = false;
+ }
+
+ public FSB(FSB fbuf) {
+ pos = fbuf.pos;
+ buf = fbuf.buf;
+ shared = true;
+ }
+
+ public int length() {
+ int res = buf.length() - pos;
+ if (res < 0)
+ return 0;
+
+ return res;
+ }
+
+ public char charAt(int index) {
+ return buf.charAt(index + pos);
+ }
+
+ private void resolveCopy() {
+ if (shared) {
+ buf = new StringBuffer(buf.toString());
+ shared = false;
+ }
+ }
+
+ public FSB deleteCharAt(int index) {
+ if (index == 0) {
+ pos++;
+ } else {
+ resolveCopy();
+ buf = buf.deleteCharAt(pos + index);
+ }
+
+ return this;
+ }
+
+ public FSB delete(int start, int end) {
+ if (start == 0) {
+ pos = pos + end - start;
+ } else {
+ resolveCopy();
+ buf.delete(start + pos, end + pos);
+ }
+
+ return this;
+ }
+
+ public void setLength(int a) {
+ if (a == 0)
+ pos = buf.length();
+ else {
+ // panic! fortunately we don't do this.
+ }
+ }
+
+ public String substring(int start, int end) {
+ return buf.substring(start + pos, end + pos);
+ }
+
+ @Override
+ public String toString() {
+ return buf.substring(pos, buf.length());
+ }
+
+ int indexOf(char c) {
+ int len = buf.length();
+ for (int i = pos; i < len; i++) {
+ if (buf.charAt(i) == c)
+ return i - pos;
+ }
+
+ return -1;
+ }
+
+ boolean startsWith(String s) {
+ int len = Math.min(s.length(), length());
+ if (len < s.length())
+ return false;
+
+ for (int i = 0; i < len; i++) {
+ if (s.charAt(i) != buf.charAt(pos + i))
+ return false;
+ }
+
+ return true;
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIRegisterValue.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIRegisterValue.java
index fb154466447..f1ad6e91557 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIRegisterValue.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIRegisterValue.java
@@ -22,80 +22,80 @@ import java.util.List;
* GDB/MI register response parsing.
*/
public class MIRegisterValue {
- int number;
- String value;
+ int number;
+ String value;
- public MIRegisterValue(int n, String v) {
- number = n;
- value = v;
- }
+ public MIRegisterValue(int n, String v) {
+ number = n;
+ value = v;
+ }
- public int getNumber() {
- return number;
- }
+ public int getNumber() {
+ return number;
+ }
- public String getValue() {
- return value;
- }
+ public String getValue() {
+ return value;
+ }
- @Override
- public String toString() {
- StringBuilder buffer = new StringBuilder();
- buffer.append("number=\"").append(number).append('"'); //$NON-NLS-1$
- buffer.append(',').append("value=\"").append(value).append('"'); //$NON-NLS-1$
- return buffer.toString();
- }
+ @Override
+ public String toString() {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append("number=\"").append(number).append('"'); //$NON-NLS-1$
+ buffer.append(',').append("value=\"").append(value).append('"'); //$NON-NLS-1$
+ return buffer.toString();
+ }
- /**
- * Parsing a MIList of the form:
- * [{number="1",value="0xffff"},{number="xxx",value="yyy"},..]
- */
- public static MIRegisterValue[] getMIRegisterValues(MIList miList) {
- List<MIRegisterValue> aList = new ArrayList<MIRegisterValue>();
- MIValue[] values = miList.getMIValues();
- for (int i = 0; i < values.length; i++) {
- if (values[i] instanceof MITuple) {
- MIRegisterValue reg = getMIRegisterValue((MITuple)values[i]);
- if (reg != null) {
- aList.add(reg);
- }
- }
- }
- return (aList.toArray(new MIRegisterValue[aList.size()]));
- }
+ /**
+ * Parsing a MIList of the form:
+ * [{number="1",value="0xffff"},{number="xxx",value="yyy"},..]
+ */
+ public static MIRegisterValue[] getMIRegisterValues(MIList miList) {
+ List<MIRegisterValue> aList = new ArrayList<MIRegisterValue>();
+ MIValue[] values = miList.getMIValues();
+ for (int i = 0; i < values.length; i++) {
+ if (values[i] instanceof MITuple) {
+ MIRegisterValue reg = getMIRegisterValue((MITuple) values[i]);
+ if (reg != null) {
+ aList.add(reg);
+ }
+ }
+ }
+ return (aList.toArray(new MIRegisterValue[aList.size()]));
+ }
- /**
- * Parsing a MITuple of the form:
- * {number="xxx",value="yyy"}
- */
- public static MIRegisterValue getMIRegisterValue(MITuple tuple) {
- MIResult[] args = tuple.getMIResults();
- MIRegisterValue arg = null;
- if (args.length == 2) {
- // Name
- String aName = ""; //$NON-NLS-1$
- MIValue value = args[0].getMIValue();
- if (value != null && value instanceof MIConst) {
- aName = ((MIConst)value).getCString();
- } else {
- aName = ""; //$NON-NLS-1$
- }
+ /**
+ * Parsing a MITuple of the form:
+ * {number="xxx",value="yyy"}
+ */
+ public static MIRegisterValue getMIRegisterValue(MITuple tuple) {
+ MIResult[] args = tuple.getMIResults();
+ MIRegisterValue arg = null;
+ if (args.length == 2) {
+ // Name
+ String aName = ""; //$NON-NLS-1$
+ MIValue value = args[0].getMIValue();
+ if (value != null && value instanceof MIConst) {
+ aName = ((MIConst) value).getCString();
+ } else {
+ aName = ""; //$NON-NLS-1$
+ }
- // Value
- String aValue = ""; //$NON-NLS-1$
- value = args[1].getMIValue();
- if (value != null && value instanceof MIConst) {
- aValue = ((MIConst)value).getCString();
- } else {
- aValue = ""; //$NON-NLS-1$
- }
+ // Value
+ String aValue = ""; //$NON-NLS-1$
+ value = args[1].getMIValue();
+ if (value != null && value instanceof MIConst) {
+ aValue = ((MIConst) value).getCString();
+ } else {
+ aValue = ""; //$NON-NLS-1$
+ }
- try {
- int reg = Integer.parseInt(aName.trim());
- arg = new MIRegisterValue(reg, aValue.trim());
- } catch (NumberFormatException e) {
- }
- }
- return arg;
- }
+ try {
+ int reg = Integer.parseInt(aName.trim());
+ arg = new MIRegisterValue(reg, aValue.trim());
+ } catch (NumberFormatException e) {
+ }
+ }
+ return arg;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIResult.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIResult.java
index 4ec5315e10f..1dd0f52cbf8 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIResult.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIResult.java
@@ -19,38 +19,38 @@ package org.eclipse.cdt.dsf.mi.service.command.output;
* GDB/MI result sematic (Variable=Value)
*/
public class MIResult {
- String variable = ""; //$NON-NLS-1$
- MIValue value = null;
-
- public String getVariable() {
- return variable;
- }
-
- public void setVariable(String var) {
- variable = var;
- }
+ String variable = ""; //$NON-NLS-1$
+ MIValue value = null;
- public MIValue getMIValue() {
- return value;
- }
-
- public void setMIValue(MIValue val) {
- value = val;
- }
+ public String getVariable() {
+ return variable;
+ }
- @Override
- public String toString() {
- StringBuilder buffer = new StringBuilder();
- buffer.append(variable);
- if (value != null) {
- String v = value.toString();
- buffer.append('=');
- if (!v.isEmpty() && (v.charAt(0) == '[' || v.charAt(0) =='{')) {
- buffer.append(v);
- } else {
- buffer.append('"').append(v).append('"');
- }
- }
- return buffer.toString();
- }
+ public void setVariable(String var) {
+ variable = var;
+ }
+
+ public MIValue getMIValue() {
+ return value;
+ }
+
+ public void setMIValue(MIValue val) {
+ value = val;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append(variable);
+ if (value != null) {
+ String v = value.toString();
+ buffer.append('=');
+ if (!v.isEmpty() && (v.charAt(0) == '[' || v.charAt(0) == '{')) {
+ buffer.append(v);
+ } else {
+ buffer.append('"').append(v).append('"');
+ }
+ }
+ return buffer.toString();
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIResultRecord.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIResultRecord.java
index 68c436d4d2b..d64b7fed707 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIResultRecord.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIResultRecord.java
@@ -24,66 +24,66 @@ package org.eclipse.cdt.dsf.mi.service.command.output;
*/
public class MIResultRecord {
- public final static String DONE ="done"; //$NON-NLS-1$
- public final static String RUNNING ="running"; //$NON-NLS-1$
- public final static String CONNECTED ="connected"; //$NON-NLS-1$
- public final static String ERROR ="error"; //$NON-NLS-1$
- public final static String EXIT ="exit"; //$NON-NLS-1$
+ public final static String DONE = "done"; //$NON-NLS-1$
+ public final static String RUNNING = "running"; //$NON-NLS-1$
+ public final static String CONNECTED = "connected"; //$NON-NLS-1$
+ public final static String ERROR = "error"; //$NON-NLS-1$
+ public final static String EXIT = "exit"; //$NON-NLS-1$
- String resultClass = ""; //$NON-NLS-1$
- int token = -1;
- MITuple value = new MITuple();
+ String resultClass = ""; //$NON-NLS-1$
+ int token = -1;
+ MITuple value = new MITuple();
- public int getToken() {
- return token;
- }
+ public int getToken() {
+ return token;
+ }
- public void setToken(int t) {
- token = t;
- }
+ public void setToken(int t) {
+ token = t;
+ }
- /**
- */
- public String getResultClass() {
- return resultClass;
- }
+ /**
+ */
+ public String getResultClass() {
+ return resultClass;
+ }
- public void setResultClass(String type) {
- resultClass = type;
- }
+ public void setResultClass(String type) {
+ resultClass = type;
+ }
- /** Return all data fields of this record as MITuple
- * @since 4.6
+ /** Return all data fields of this record as MITuple
+ * @since 4.6
*/
- public MITuple getFields() {
- return value;
- }
+ public MITuple getFields() {
+ return value;
+ }
- public MIResult[] getMIResults() {
- return value.getMIResults();
- }
+ public MIResult[] getMIResults() {
+ return value.getMIResults();
+ }
- public void setMIResults(MIResult[] res) {
- value.setMIResults(res);
- }
+ public void setMIResults(MIResult[] res) {
+ value.setMIResults(res);
+ }
- /** Return the value of the named field in this record.
+ /** Return the value of the named field in this record.
* @since 4.6
*/
- public MIValue getField(String name) {
- return value.getField(name);
- }
+ public MIValue getField(String name) {
+ return value.getField(name);
+ }
- @Override
- public String toString() {
- StringBuilder buffer = new StringBuilder();
- if (token > 0) {
- buffer.append(token);
- }
- buffer.append('^').append(resultClass);
+ @Override
+ public String toString() {
+ StringBuilder buffer = new StringBuilder();
+ if (token > 0) {
+ buffer.append(token);
+ }
+ buffer.append('^').append(resultClass);
- if (value.getMIResults().length != 0)
- buffer.append(value.toString(",", "")); //$NON-NLS-1$ //$NON-NLS-2$
- return buffer.toString();
- }
+ if (value.getMIResults().length != 0)
+ buffer.append(value.toString(",", "")); //$NON-NLS-1$ //$NON-NLS-2$
+ return buffer.toString();
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStackInfoDepthInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStackInfoDepthInfo.java
index 94a5c0141ae..822ef76668f 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStackInfoDepthInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStackInfoDepthInfo.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - Initial Implementation
* Vladimir Prus (Mentor Graphics) - Use MITuple.getMIValue.
@@ -15,7 +15,6 @@
package org.eclipse.cdt.dsf.mi.service.command.output;
-
/**
* -stack-info-depth [max-depth]
* ^done,depth="12"
@@ -27,20 +26,20 @@ public class MIStackInfoDepthInfo extends MIInfo {
public MIStackInfoDepthInfo(MIOutput record) {
super(record);
- if (isDone()) {
- MIOutput out = getMIOutput();
- MIResultRecord rr = out.getMIResultRecord();
- if (rr != null) {
- MIValue value = rr.getField("depth"); //$NON-NLS-1$
- if (value instanceof MIConst) {
- String str = ((MIConst)value).getString();
- try {
- depth = Integer.parseInt(str.trim());
- } catch (NumberFormatException e) {
- }
- }
- }
- }
+ if (isDone()) {
+ MIOutput out = getMIOutput();
+ MIResultRecord rr = out.getMIResultRecord();
+ if (rr != null) {
+ MIValue value = rr.getField("depth"); //$NON-NLS-1$
+ if (value instanceof MIConst) {
+ String str = ((MIConst) value).getString();
+ try {
+ depth = Integer.parseInt(str.trim());
+ } catch (NumberFormatException e) {
+ }
+ }
+ }
+ }
}
public int getDepth() {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStackListArgumentsInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStackListArgumentsInfo.java
index b24dbbd719a..73f5766fc46 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStackListArgumentsInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStackListArgumentsInfo.java
@@ -18,65 +18,64 @@ package org.eclipse.cdt.dsf.mi.service.command.output;
import java.util.ArrayList;
import java.util.List;
-
/**
* GDB/MI stack list arguments parsing.
*/
public class MIStackListArgumentsInfo extends MIInfo {
- MIFrame[] frames;
+ MIFrame[] frames;
+
+ public MIStackListArgumentsInfo(MIOutput out) {
+ super(out);
+ frames = null;
+ List<MIFrame> aList = new ArrayList<MIFrame>(1);
+ if (isDone()) {
+ MIResultRecord rr = out.getMIResultRecord();
+ if (rr != null) {
+ MIResult[] results = rr.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ if (var.equals("stack-args")) { //$NON-NLS-1$
+ MIValue val = results[i].getMIValue();
+ if (val instanceof MIList) {
+ parseStack((MIList) val, aList);
+ } else if (val instanceof MITuple) {
+ parseStack((MITuple) val, aList);
+ }
+ }
+ }
+ }
+ }
+ frames = aList.toArray(new MIFrame[aList.size()]);
+ }
- public MIStackListArgumentsInfo(MIOutput out) {
- super(out);
- frames = null;
- List<MIFrame> aList = new ArrayList<MIFrame>(1);
- if (isDone()) {
- MIResultRecord rr = out.getMIResultRecord();
- if (rr != null) {
- MIResult[] results = rr.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- if (var.equals("stack-args")) { //$NON-NLS-1$
- MIValue val = results[i].getMIValue();
- if (val instanceof MIList) {
- parseStack((MIList)val, aList);
- } else if (val instanceof MITuple) {
- parseStack((MITuple)val, aList);
- }
- }
- }
- }
- }
- frames = aList.toArray(new MIFrame[aList.size()]);
- }
+ public MIFrame[] getMIFrames() {
+ return frames;
+ }
- public MIFrame[] getMIFrames() {
- return frames;
- }
+ private void parseStack(MIList miList, List<MIFrame> aList) {
+ MIResult[] results = miList.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ if (var.equals("frame")) { //$NON-NLS-1$
+ MIValue value = results[i].getMIValue();
+ if (value instanceof MITuple) {
+ aList.add(new MIFrame((MITuple) value));
+ }
+ }
+ }
+ }
- private void parseStack(MIList miList, List<MIFrame> aList) {
- MIResult[] results = miList.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- if (var.equals("frame")) { //$NON-NLS-1$
- MIValue value = results[i].getMIValue();
- if (value instanceof MITuple) {
- aList.add (new MIFrame((MITuple)value));
- }
- }
- }
- }
-
- private void parseStack(MITuple miTuple, List<MIFrame> aList) {
- MIResult[] results = miTuple.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- if (var.equals("frame")) { //$NON-NLS-1$
- MIValue value = results[i].getMIValue();
- if (value instanceof MITuple) {
- aList.add (new MIFrame((MITuple)value));
- }
- }
- }
- }
+ private void parseStack(MITuple miTuple, List<MIFrame> aList) {
+ MIResult[] results = miTuple.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ if (var.equals("frame")) { //$NON-NLS-1$
+ MIValue value = results[i].getMIValue();
+ if (value instanceof MITuple) {
+ aList.add(new MIFrame((MITuple) value));
+ }
+ }
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStackListFramesInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStackListFramesInfo.java
index 6def3e82ca5..6b7e2858ab6 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStackListFramesInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStackListFramesInfo.java
@@ -22,60 +22,60 @@ import java.util.List;
*/
public class MIStackListFramesInfo extends MIInfo {
- MIFrame[] frames;
+ MIFrame[] frames;
- public MIStackListFramesInfo(MIOutput out) {
- super(out);
- frames = null;
- List<MIFrame> aList = new ArrayList<MIFrame>(1);
- if (isDone()) {
- MIResultRecord rr = out.getMIResultRecord();
- if (rr != null) {
- MIResult[] results = rr.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- if (var.equals("stack")) { //$NON-NLS-1$
- MIValue val = results[i].getMIValue();
- if (val instanceof MIList) {
- parseStack((MIList)val, aList);
- } else if (val instanceof MITuple) {
- parseStack((MITuple)val, aList);
- }
- }
- }
- }
- }
- frames = aList.toArray(new MIFrame[aList.size()]);
- }
+ public MIStackListFramesInfo(MIOutput out) {
+ super(out);
+ frames = null;
+ List<MIFrame> aList = new ArrayList<MIFrame>(1);
+ if (isDone()) {
+ MIResultRecord rr = out.getMIResultRecord();
+ if (rr != null) {
+ MIResult[] results = rr.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ if (var.equals("stack")) { //$NON-NLS-1$
+ MIValue val = results[i].getMIValue();
+ if (val instanceof MIList) {
+ parseStack((MIList) val, aList);
+ } else if (val instanceof MITuple) {
+ parseStack((MITuple) val, aList);
+ }
+ }
+ }
+ }
+ }
+ frames = aList.toArray(new MIFrame[aList.size()]);
+ }
- public MIFrame[] getMIFrames() {
- return frames;
- }
+ public MIFrame[] getMIFrames() {
+ return frames;
+ }
- void parseStack(MIList miList, List<MIFrame> aList) {
- MIResult[] results = miList.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- if (var.equals("frame")) { //$NON-NLS-1$
- MIValue value = results[i].getMIValue();
- if (value instanceof MITuple) {
- aList.add (new MIFrame((MITuple)value));
- }
- }
- }
- }
+ void parseStack(MIList miList, List<MIFrame> aList) {
+ MIResult[] results = miList.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ if (var.equals("frame")) { //$NON-NLS-1$
+ MIValue value = results[i].getMIValue();
+ if (value instanceof MITuple) {
+ aList.add(new MIFrame((MITuple) value));
+ }
+ }
+ }
+ }
- // Old gdb use tuple instead of a list.
- void parseStack(MITuple tuple, List<MIFrame> aList) {
- MIResult[] results = tuple.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- if (var.equals("frame")) { //$NON-NLS-1$
- MIValue value = results[i].getMIValue();
- if (value instanceof MITuple) {
- aList.add (new MIFrame((MITuple)value));
- }
- }
- }
- }
+ // Old gdb use tuple instead of a list.
+ void parseStack(MITuple tuple, List<MIFrame> aList) {
+ MIResult[] results = tuple.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ if (var.equals("frame")) { //$NON-NLS-1$
+ MIValue value = results[i].getMIValue();
+ if (value instanceof MITuple) {
+ aList.add(new MIFrame((MITuple) value));
+ }
+ }
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStackListLocalsInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStackListLocalsInfo.java
index f9e50a0aa10..ec94b7bd733 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStackListLocalsInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStackListLocalsInfo.java
@@ -29,19 +29,19 @@ public class MIStackListLocalsInfo extends MIInfo {
public MIStackListLocalsInfo(MIOutput out) {
super(out);
- locals = null ;
+ locals = null;
if (isDone()) {
MIResultRecord rr = out.getMIResultRecord();
if (rr != null) {
- MIResult[] results = rr.getMIResults();
+ MIResult[] results = rr.getMIResults();
for (int i = 0; i < results.length; i++) {
String var = results[i].getVariable();
if (var.equals("locals")) { //$NON-NLS-1$
MIValue value = results[i].getMIValue();
if (value instanceof MIList) {
- locals = MIArg.getMIArgs((MIList)value);
+ locals = MIArg.getMIArgs((MIList) value);
} else if (value instanceof MITuple) {
- locals = MIArg.getMIArgs((MITuple)value);
+ locals = MIArg.getMIArgs((MITuple) value);
}
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStatusAsyncOutput.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStatusAsyncOutput.java
index 27a70c6e5da..d6befbd37ab 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStatusAsyncOutput.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStatusAsyncOutput.java
@@ -18,10 +18,10 @@ package org.eclipse.cdt.dsf.mi.service.command.output;
/**
* Represents an asynchronous OOB record from gdb that provides status on an
* ongoing time consuming operation.
- *
+ *
* <p>
* All such output is prefixed by `+'.
- *
+ *
* @see MIAsyncRecord
*/
public class MIStatusAsyncOutput extends MIAsyncRecord {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStreamRecord.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStreamRecord.java
index 970dd9663c1..93de777a260 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStreamRecord.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStreamRecord.java
@@ -21,26 +21,31 @@ package org.eclipse.cdt.dsf.mi.service.command.output;
*/
public abstract class MIStreamRecord extends MIOOBRecord {
- String cstring = ""; //$NON-NLS-1$
+ String cstring = ""; //$NON-NLS-1$
- public String getCString() {
- return cstring;
- }
+ public String getCString() {
+ return cstring;
+ }
- public void setCString(String str) {
- cstring = str;
- }
+ public void setCString(String str) {
+ cstring = str;
+ }
- public String getString () {
- // Return the translated C string without escaping any special characters.
- return MIStringHandler.translateCString(getCString(), false);
- }
+ public String getString() {
+ // Return the translated C string without escaping any special characters.
+ return MIStringHandler.translateCString(getCString(), false);
+ }
- @Override
- public String toString() {
- if (this instanceof MIConsoleStreamOutput) { return "~\"" + cstring + "\"\n"; } //$NON-NLS-1$ //$NON-NLS-2$
- else if (this instanceof MITargetStreamOutput) { return "@\"" + cstring + "\"\n"; } //$NON-NLS-1$ //$NON-NLS-2$
- else if (this instanceof MILogStreamOutput) { return "&\"" + cstring + "\"\n"; } //$NON-NLS-1$ //$NON-NLS-2$
- else { return "\"" + cstring + "\"\n"; } //$NON-NLS-1$ //$NON-NLS-2$
- }
+ @Override
+ public String toString() {
+ if (this instanceof MIConsoleStreamOutput) {
+ return "~\"" + cstring + "\"\n"; //$NON-NLS-1$//$NON-NLS-2$
+ } else if (this instanceof MITargetStreamOutput) {
+ return "@\"" + cstring + "\"\n"; //$NON-NLS-1$//$NON-NLS-2$
+ } else if (this instanceof MILogStreamOutput) {
+ return "&\"" + cstring + "\"\n"; //$NON-NLS-1$//$NON-NLS-2$
+ } else {
+ return "\"" + cstring + "\"\n"; //$NON-NLS-1$//$NON-NLS-2$
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStringHandler.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStringHandler.java
index 7812a5202d9..af9f9aef5a6 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStringHandler.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStringHandler.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Mathias Kunter - Initial Implementation (Bug 307311)
*******************************************************************************/
@@ -29,434 +29,424 @@ import java.util.Map.Entry;
* @since 4.1
*/
public class MIStringHandler {
-
- /**
- * A map of special characters which are used within escape notations to represent a
- * corresponding Unicode code point (i.e. character code).
- */
+
+ /**
+ * A map of special characters which are used within escape notations to represent a
+ * corresponding Unicode code point (i.e. character code).
+ */
// Use a LinkedHashMap to preserve order, so as to get 'e' and not 'E'
- private static Map<Character,Integer> fSpecialCharactersToCodePointMap = new LinkedHashMap<Character,Integer>();
- static {
- fSpecialCharactersToCodePointMap.put('a', 0x07); // Alert (bell) character
- fSpecialCharactersToCodePointMap.put('b', 0x08); // Backspace character
- fSpecialCharactersToCodePointMap.put('e', 0x1B); // GNU extension: Escape character
- fSpecialCharactersToCodePointMap.put('E', 0x1B); // same as 'e'
- fSpecialCharactersToCodePointMap.put('f', 0x0C); // Form feed character
- fSpecialCharactersToCodePointMap.put('n', 0x0A); // New line character
- fSpecialCharactersToCodePointMap.put('r', 0x0D); // Carriage return character
- fSpecialCharactersToCodePointMap.put('t', 0x09); // Horizontal tabulation character
- fSpecialCharactersToCodePointMap.put('v', 0x0B); // Vertical tabulation character
- fSpecialCharactersToCodePointMap.put('\'', 0x27); // Single quotation mark
- fSpecialCharactersToCodePointMap.put('"', 0x22); // Double quotation mark
- fSpecialCharactersToCodePointMap.put('\\', 0x5C); // Backslash
- fSpecialCharactersToCodePointMap.put('?', 0x3F); // Literal question mark
- }
-
- /**
- * An internal helper enumeration which holds the current status while parsing an escaped
- * text sequence.
- */
- private enum EscapeStatus {
- NONE,
- BEGIN,
- OCTAL_NUMBER,
- HEX_NUMBER,
- UNICODE_SHORT_NUMBER,
- UNICODE_LONG_NUMBER,
- VALID,
- INVALID
- }
-
- /**
- * An enumeration defining the escape sequences which should be parsed.
- */
- public enum ParseFlags {
- SPECIAL_CHARS,
- OCTAL_NUMBERS,
- HEX_NUMBERS,
- UNICODE_SHORT_NUMBERS,
- UNICODE_LONG_NUMBERS
- }
-
- /**
- * Translates the given C string into a string suitable for display. This includes handling
- * of escaped characters and different string encodings. This is necessary in order to correctly
- * deal with non-ASCII strings.
- * @param str The C string to translate.
- * @param escapeChars Defines whether non-printable characters should be escaped within
- * the translated string, or not.
- * @return The translated string.
- */
- public static String translateCString(String str, boolean escapeChars) {
- if (escapeChars) {
- // Don't parse the special character escape notations here. We can do this here because
- // we want to keep them in their escaped form anyway, and because the following string
- // transcoding process isn't affected by escaped special chars. By doing so we avoid
- // caring about some nasty details of the special character escaping process: for
- // example, single quotation marks are commonly only escaped within character constants,
- // while double quotation marks are commonly only escaped within string constants. By
- // not parsing the special character escape notations at all here, we just keep the
- // original special character escaping provided by the given MI string.
- str = parseString(str, EnumSet.complementOf(EnumSet.of(ParseFlags.SPECIAL_CHARS)));
- } else {
- // Parse all escaped characters.
- str = parseString(str);
- }
-
- // Transcode the string in order to handle non-ASCII strings correctly.
- str = transcodeString(str);
-
- if (escapeChars) {
- // Escape any non-printable characters again, as we want to be able to display them.
- // However, don't escape any printable special chars, as they haven't been parsed before.
- str = escapeString(str, false);
- } else {
- // No escaping necessary here. We however have to make sure that we use the correct line
- // separation character sequence.
- str = str.replace("\n", System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- return str;
- }
-
- /**
- * Returns whether the given character is a special character, or not.
- * @param c The character to test.
- * @return The test result.
- */
- public static boolean isSpecialChar(char c) {
- return fSpecialCharactersToCodePointMap.containsKey(c);
- }
-
- /**
- * Returns whether the given Unicode code point is a special code point, or not.
- * @param codePoint The Unicode code point to test.
- * @return The test result.
- */
- public static boolean isSpecialCodePoint(int codePoint) {
- return fSpecialCharactersToCodePointMap.containsValue(codePoint);
- }
-
- /**
- * Parses the given special character into an Unicode code point.
- * @param c The special character to parse.
- * @return The parsed Unicode code point.
- * @throws ParseException Thrown when the given character can't be parsed. This happens when it's
- * not a special character.
- */
- public static int parseSpecialChar(char c) throws ParseException {
- Integer codePoint = fSpecialCharactersToCodePointMap.get(c);
- if (codePoint != null) {
- return codePoint;
- }
- throw new ParseException("The given character '" + c + "' is not a special character.", 0); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Parses the given special Unicode code point into a character.
- * @param codePoint The special Unicode code point to parse.
- * @return The parsed character.
- * @throws ParseException Thrown when the given Unicode code point can't be parsed. This happens
- * when it's not a special code point.
- */
- public static char parseSpecialCodePoint(int codePoint) throws ParseException {
- for (Entry<Character, Integer> entry : fSpecialCharactersToCodePointMap.entrySet()) {
- if (entry.getValue().equals(codePoint)) {
- return entry.getKey();
- }
- }
- throw new ParseException("The given Unicode code point " + codePoint + " is not a special code point.", 0); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * This is an overloaded function. See the Javadoc of the other function overload for details.
- * @param str The string which should be parsed.
- * @return The parsed string.
- */
- public static String parseString(String str) {
- return parseString(str, EnumSet.allOf(ParseFlags.class));
- }
-
- /**
- * Parses any escaped characters and replaces them with their corresponding Unicode code points.
- * This function parses all escape notations which are supported by gcc and / or gdb. Those are:</br></br>
- *
- * <ul>
- * <li>Special char escape notations: \a, \b, \e, \E, \f, \n, \r, \t, \v, \', \", \\, and \?</li>
- *
- * <li>Octal escape notation: An initial backslash, followed by 1, 2, or 3 octal digits. Values
- * above 0xFF are ignored. Octal escape notations may not use more than 3 octal digits.</li>
- *
- * <li>Hexadecimal escape notation: An initial backslash, followed by an "x" and 1 or more
- * hexadecimal digits. Hexadecimal escape notations may not use more than 4 hexadecimal digits
- * (although gcc accepts hexadecimal escape notations of any arbitrary length).</li>
- *
- * <li>Short Unicode escape notation: An initial backslash, followed by an "u" and exactly 4
- * hexadecimal digits.</li>
- *
- * <li>Long Unicode escape notation: An initial backslash, followed by an "U" and exactly 8
- * hexadecimal digits.</li>
- * </ul>
- * @param str The string which should be parsed.
- * @param parseFlags The set of escape notations which should be parsed.
- * @return The parsed string.
- */
- public static String parseString(String str, EnumSet<ParseFlags> parseFlags) {
- StringBuilder buffer = new StringBuilder();
- StringBuilder escapeBuffer = new StringBuilder();
- EscapeStatus escStatus = EscapeStatus.NONE;
-
- for (int i = 0; i < str.length(); i++) {
- char c = str.charAt(i);
- boolean consumeChar = true;
- boolean isLastChar = i == str.length() - 1;
-
- if (escStatus == EscapeStatus.NONE) {
- if (c == '\\') {
- // Escaping begins. Reset the escape buffer.
- escapeBuffer.setLength(0);
- escapeBuffer.append(c);
- escStatus = EscapeStatus.BEGIN;
- }
- } else if (escStatus == EscapeStatus.BEGIN) {
- if (parseFlags.contains(ParseFlags.SPECIAL_CHARS) && isSpecialChar(c)) {
- try {
- buffer.appendCodePoint(parseSpecialChar(c));
- escStatus = EscapeStatus.VALID;
- } catch (ParseException e) {
- // This is just for completeness. We will actually never catch any ParseException here
- // since we already checked the character with isSpecialChar() before.
- escapeBuffer.append(c);
- escStatus = EscapeStatus.INVALID;
- }
- } else if (parseFlags.contains(ParseFlags.OCTAL_NUMBERS) && c >= '0' && c <= '7') {
- escStatus = EscapeStatus.OCTAL_NUMBER;
- // Don't consume this character right now - as this wouldn't work if it's the last character.
- consumeChar = false;
- } else if (parseFlags.contains(ParseFlags.HEX_NUMBERS) && c == 'x') {
- escStatus = EscapeStatus.HEX_NUMBER;
- } else if (parseFlags.contains(ParseFlags.UNICODE_SHORT_NUMBERS) && c == 'u') {
- escStatus = EscapeStatus.UNICODE_SHORT_NUMBER;
- } else if (parseFlags.contains(ParseFlags.UNICODE_LONG_NUMBERS) && c == 'U') {
- escStatus = EscapeStatus.UNICODE_LONG_NUMBER;
- } else {
- escStatus = EscapeStatus.INVALID;
- }
- if (consumeChar) {
- escapeBuffer.append(c);
- }
- } else if (escStatus == EscapeStatus.HEX_NUMBER) {
- // Only consume this character if it belongs to the escape sequence.
- consumeChar = (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F');
- if (consumeChar) {
- escapeBuffer.append(c);
- }
-
- if (!consumeChar || isLastChar || escapeBuffer.length() == 6) {
- // The escape sequence is terminated. Set the escape status to invalid until
- // we know that it's actually valid.
- escStatus = EscapeStatus.INVALID;
- if (escapeBuffer.length() > 2) {
- // Decode the hexadecimal number.
- try {
- int codePoint = Integer.parseInt(escapeBuffer.toString().substring(2), 16);
- if (codePoint <= 0x10FFFF) {
- buffer.appendCodePoint(codePoint);
- escStatus = EscapeStatus.VALID;
- }
- } catch (NumberFormatException e) {
- }
- }
- }
- } else if (escStatus == EscapeStatus.UNICODE_SHORT_NUMBER || escStatus == EscapeStatus.UNICODE_LONG_NUMBER) {
- // Only consume this character if it belongs to the escape sequence.
- consumeChar = (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F');
- if (consumeChar) {
- escapeBuffer.append(c);
- }
-
- int finalLength = escStatus == EscapeStatus.UNICODE_SHORT_NUMBER ? 6 : 10;
- if (escapeBuffer.length() == finalLength) {
- // The escape sequence is terminated. Set the escape status to invalid until
- // we know that it's actually valid. Decode the hexadecimal number.
- escStatus = EscapeStatus.INVALID;
- try {
- int codePoint = Integer.parseInt(escapeBuffer.toString().substring(2), 16);
- if (codePoint <= 0x10FFFF) {
- buffer.appendCodePoint(codePoint);
- escStatus = EscapeStatus.VALID;
- }
- } catch (NumberFormatException e) {
- }
- } else if (!consumeChar || isLastChar) {
- // The escape sequence is terminated and invalid.
- escStatus = EscapeStatus.INVALID;
- }
- } else if (escStatus == EscapeStatus.OCTAL_NUMBER) {
- // Only consume this character if it belongs to the escape sequence.
- consumeChar = c >= '0' && c <= '7';
- if (consumeChar) {
- escapeBuffer.append(c);
- }
-
- if (!consumeChar || isLastChar || escapeBuffer.length() == 4) {
- // The escape sequence is terminated. Set the escape status to invalid until
- // we know that it's actually valid.
- escStatus = EscapeStatus.INVALID;
- if (escapeBuffer.length() > 1) {
- // Decode the octal number.
- try {
- int codePoint = Integer.parseInt(escapeBuffer.toString().substring(1), 8);
- if (codePoint <= 0xFF) {
- buffer.appendCodePoint(codePoint);
- escStatus = EscapeStatus.VALID;
- }
- } catch (NumberFormatException e) {
- }
- }
- }
- }
-
- if (escStatus == EscapeStatus.NONE) {
- // Current character isn't escaped - copy it over to the destination buffer.
- buffer.append(c);
- } else if (escStatus == EscapeStatus.VALID) {
- escStatus = EscapeStatus.NONE;
- } else if (escStatus == EscapeStatus.INVALID) {
- buffer.append(escapeBuffer);
- escStatus = EscapeStatus.NONE;
- }
-
- if (!consumeChar) {
- // Don't consume the current character.
- i--;
- }
- }
-
- // Check for non-finished escape sequences at the end of the string.
- if (escStatus != EscapeStatus.NONE) {
- buffer.append(escapeBuffer);
- }
-
- // Convert the buffer into a string and return it.
- return buffer.toString();
- }
-
- /**
- * Transcodes the given string. This is done as follows:</br></br>
- * 1) The given string is encoded into a binary byte buffer.</br></br>
- * 2) It's tested whether this binary byte buffer seems to represent a string which is encoded as
- * either ASCII, Latin-1, or UTF-8. If this is the case, the binary byte buffer is decoded back into
- * a string and this string is returned. If the test is negative, the given string is returned without
- * modification because its encoding can't be reliably determined in this case.
- * The most important use case of this function is to transcode a string which is actually UTF-8 but has
- * been incorrectly decoded as Latin-1 instead.
- * @param str The string to transcode.
- * @return The transcoded string.
- */
- public static String transcodeString(String str) {
- // Try to transcode the string from Latin-1 to UTF-8 (ASCII doesn't need to be explicitly
- // considered here since Latin-1 is backwards compatible with ASCII). The transcoding will
- // almost certainly only succeed if the string actually *is* encoded in UTF-8. If the
- // transcoding fails, the string is simply left unchanged.
- try {
- // First, try to encode the string as Latin-1 in order to obtain the binary byte
- // representation of the string.
- CharsetEncoder latin1Encoder = Charset.forName("ISO-8859-1").newEncoder(); //$NON-NLS-1$
- ByteBuffer stringBytes = latin1Encoder.encode(CharBuffer.wrap(str.toCharArray()));
-
- // Next, try to decode the string as UTF-8. This will almost certainly only succeed
- // if the string actually *is* encoded in UTF-8. Note that if the decoding fails,
- // an exception is thrown before the str variable is assigned. The original string
- // is therefore left unchanged in this case.
- CharsetDecoder utf8Decoder = Charset.forName("UTF-8").newDecoder(); //$NON-NLS-1$
- str = utf8Decoder.decode(stringBytes).toString();
- } catch (Exception e) {
- }
-
- return str;
- }
-
- /**
- * Escapes any non-printable characters as well as the printable special characters single quotation
- * mark, double quotation mark, backslash, and literal question mark within the given string. Supports
- * the entire Unicode code space.
- * @param str The string which should be escaped.
- * @return The escaped string.
- */
- public static String escapeString(String str) {
- return escapeString(str, true);
- }
-
- /**
- * Escapes any non-printable characters within the given string. Supports the entire Unicode code space.
- * @param str The string which should be escaped.
- * @param escapePrintableSpecialChars Defines whether the printable special characters single
- * quotation mark, double quotation mark, backslash, and literal question mark should be
- * escaped as well, or not.
- * @return The escaped string.
- */
- public static String escapeString(String str, boolean escapePrintableSpecialChars) {
- StringBuilder buffer = new StringBuilder();
-
- for (int i = 0; i < str.length(); i++) {
- // Get the current character code point. Note that using the Java "char" data type isn't
- // sufficient here, as it can't handle all Unicode characters.
- int codePoint = str.codePointAt(i);
- if (Character.isSupplementaryCodePoint(codePoint)) {
- i++;
- }
-
- // Check the code point type of the character in order to determine whether it's
- // printable or not.
- int codePointType = Character.getType(codePoint);
- switch (codePointType) {
- case Character.LINE_SEPARATOR:
- case Character.PARAGRAPH_SEPARATOR:
- case Character.CONTROL:
- case Character.PRIVATE_USE:
- case Character.SURROGATE:
- case Character.UNASSIGNED:
- // Non-printable character.
- if (isSpecialCodePoint(codePoint)) {
- // Escape by using the special character escape notation.
- buffer.append('\\');
- try {
- buffer.append(parseSpecialCodePoint(codePoint));
- } catch (ParseException e) {
- buffer.appendCodePoint(codePoint);
- }
- } else if (codePoint == 0x00) {
- // Escape the null character separately - don't use leading zeros.
- buffer.append("\\0"); //$NON-NLS-1$
- } else if (codePoint <= 0xFF) {
- // Escape by using the octal escape notation.
- buffer.append(String.format("\\%03o", codePoint)); //$NON-NLS-1$
- } else if (codePoint <= 0xFFFF) {
- // Escape by using the short Unicode escape notation.
- buffer.append(String.format("\\u%04x", codePoint)); //$NON-NLS-1$
- } else {
- // Escape by using the long Unicode escape notation.
- buffer.append(String.format("\\U%08x", codePoint)); //$NON-NLS-1$
- }
- break;
- default:
- // Printable character.
- if (escapePrintableSpecialChars && isSpecialCodePoint(codePoint)) {
- // Escape by using the special character escape notation.
- buffer.append('\\');
- try {
- buffer.append(parseSpecialCodePoint(codePoint));
- } catch (ParseException e) {
- buffer.appendCodePoint(codePoint);
- }
- } else {
- // Don't escape.
- buffer.appendCodePoint(codePoint);
- }
- }
- }
-
- return buffer.toString();
- }
+ private static Map<Character, Integer> fSpecialCharactersToCodePointMap = new LinkedHashMap<Character, Integer>();
+ static {
+ fSpecialCharactersToCodePointMap.put('a', 0x07); // Alert (bell) character
+ fSpecialCharactersToCodePointMap.put('b', 0x08); // Backspace character
+ fSpecialCharactersToCodePointMap.put('e', 0x1B); // GNU extension: Escape character
+ fSpecialCharactersToCodePointMap.put('E', 0x1B); // same as 'e'
+ fSpecialCharactersToCodePointMap.put('f', 0x0C); // Form feed character
+ fSpecialCharactersToCodePointMap.put('n', 0x0A); // New line character
+ fSpecialCharactersToCodePointMap.put('r', 0x0D); // Carriage return character
+ fSpecialCharactersToCodePointMap.put('t', 0x09); // Horizontal tabulation character
+ fSpecialCharactersToCodePointMap.put('v', 0x0B); // Vertical tabulation character
+ fSpecialCharactersToCodePointMap.put('\'', 0x27); // Single quotation mark
+ fSpecialCharactersToCodePointMap.put('"', 0x22); // Double quotation mark
+ fSpecialCharactersToCodePointMap.put('\\', 0x5C); // Backslash
+ fSpecialCharactersToCodePointMap.put('?', 0x3F); // Literal question mark
+ }
+
+ /**
+ * An internal helper enumeration which holds the current status while parsing an escaped
+ * text sequence.
+ */
+ private enum EscapeStatus {
+ NONE, BEGIN, OCTAL_NUMBER, HEX_NUMBER, UNICODE_SHORT_NUMBER, UNICODE_LONG_NUMBER, VALID, INVALID
+ }
+
+ /**
+ * An enumeration defining the escape sequences which should be parsed.
+ */
+ public enum ParseFlags {
+ SPECIAL_CHARS, OCTAL_NUMBERS, HEX_NUMBERS, UNICODE_SHORT_NUMBERS, UNICODE_LONG_NUMBERS
+ }
+
+ /**
+ * Translates the given C string into a string suitable for display. This includes handling
+ * of escaped characters and different string encodings. This is necessary in order to correctly
+ * deal with non-ASCII strings.
+ * @param str The C string to translate.
+ * @param escapeChars Defines whether non-printable characters should be escaped within
+ * the translated string, or not.
+ * @return The translated string.
+ */
+ public static String translateCString(String str, boolean escapeChars) {
+ if (escapeChars) {
+ // Don't parse the special character escape notations here. We can do this here because
+ // we want to keep them in their escaped form anyway, and because the following string
+ // transcoding process isn't affected by escaped special chars. By doing so we avoid
+ // caring about some nasty details of the special character escaping process: for
+ // example, single quotation marks are commonly only escaped within character constants,
+ // while double quotation marks are commonly only escaped within string constants. By
+ // not parsing the special character escape notations at all here, we just keep the
+ // original special character escaping provided by the given MI string.
+ str = parseString(str, EnumSet.complementOf(EnumSet.of(ParseFlags.SPECIAL_CHARS)));
+ } else {
+ // Parse all escaped characters.
+ str = parseString(str);
+ }
+
+ // Transcode the string in order to handle non-ASCII strings correctly.
+ str = transcodeString(str);
+
+ if (escapeChars) {
+ // Escape any non-printable characters again, as we want to be able to display them.
+ // However, don't escape any printable special chars, as they haven't been parsed before.
+ str = escapeString(str, false);
+ } else {
+ // No escaping necessary here. We however have to make sure that we use the correct line
+ // separation character sequence.
+ str = str.replace("\n", System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+ return str;
+ }
+
+ /**
+ * Returns whether the given character is a special character, or not.
+ * @param c The character to test.
+ * @return The test result.
+ */
+ public static boolean isSpecialChar(char c) {
+ return fSpecialCharactersToCodePointMap.containsKey(c);
+ }
+
+ /**
+ * Returns whether the given Unicode code point is a special code point, or not.
+ * @param codePoint The Unicode code point to test.
+ * @return The test result.
+ */
+ public static boolean isSpecialCodePoint(int codePoint) {
+ return fSpecialCharactersToCodePointMap.containsValue(codePoint);
+ }
+
+ /**
+ * Parses the given special character into an Unicode code point.
+ * @param c The special character to parse.
+ * @return The parsed Unicode code point.
+ * @throws ParseException Thrown when the given character can't be parsed. This happens when it's
+ * not a special character.
+ */
+ public static int parseSpecialChar(char c) throws ParseException {
+ Integer codePoint = fSpecialCharactersToCodePointMap.get(c);
+ if (codePoint != null) {
+ return codePoint;
+ }
+ throw new ParseException("The given character '" + c + "' is not a special character.", 0); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * Parses the given special Unicode code point into a character.
+ * @param codePoint The special Unicode code point to parse.
+ * @return The parsed character.
+ * @throws ParseException Thrown when the given Unicode code point can't be parsed. This happens
+ * when it's not a special code point.
+ */
+ public static char parseSpecialCodePoint(int codePoint) throws ParseException {
+ for (Entry<Character, Integer> entry : fSpecialCharactersToCodePointMap.entrySet()) {
+ if (entry.getValue().equals(codePoint)) {
+ return entry.getKey();
+ }
+ }
+ throw new ParseException("The given Unicode code point " + codePoint + " is not a special code point.", 0); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * This is an overloaded function. See the Javadoc of the other function overload for details.
+ * @param str The string which should be parsed.
+ * @return The parsed string.
+ */
+ public static String parseString(String str) {
+ return parseString(str, EnumSet.allOf(ParseFlags.class));
+ }
+
+ /**
+ * Parses any escaped characters and replaces them with their corresponding Unicode code points.
+ * This function parses all escape notations which are supported by gcc and / or gdb. Those are:</br></br>
+ *
+ * <ul>
+ * <li>Special char escape notations: \a, \b, \e, \E, \f, \n, \r, \t, \v, \', \", \\, and \?</li>
+ *
+ * <li>Octal escape notation: An initial backslash, followed by 1, 2, or 3 octal digits. Values
+ * above 0xFF are ignored. Octal escape notations may not use more than 3 octal digits.</li>
+ *
+ * <li>Hexadecimal escape notation: An initial backslash, followed by an "x" and 1 or more
+ * hexadecimal digits. Hexadecimal escape notations may not use more than 4 hexadecimal digits
+ * (although gcc accepts hexadecimal escape notations of any arbitrary length).</li>
+ *
+ * <li>Short Unicode escape notation: An initial backslash, followed by an "u" and exactly 4
+ * hexadecimal digits.</li>
+ *
+ * <li>Long Unicode escape notation: An initial backslash, followed by an "U" and exactly 8
+ * hexadecimal digits.</li>
+ * </ul>
+ * @param str The string which should be parsed.
+ * @param parseFlags The set of escape notations which should be parsed.
+ * @return The parsed string.
+ */
+ public static String parseString(String str, EnumSet<ParseFlags> parseFlags) {
+ StringBuilder buffer = new StringBuilder();
+ StringBuilder escapeBuffer = new StringBuilder();
+ EscapeStatus escStatus = EscapeStatus.NONE;
+
+ for (int i = 0; i < str.length(); i++) {
+ char c = str.charAt(i);
+ boolean consumeChar = true;
+ boolean isLastChar = i == str.length() - 1;
+
+ if (escStatus == EscapeStatus.NONE) {
+ if (c == '\\') {
+ // Escaping begins. Reset the escape buffer.
+ escapeBuffer.setLength(0);
+ escapeBuffer.append(c);
+ escStatus = EscapeStatus.BEGIN;
+ }
+ } else if (escStatus == EscapeStatus.BEGIN) {
+ if (parseFlags.contains(ParseFlags.SPECIAL_CHARS) && isSpecialChar(c)) {
+ try {
+ buffer.appendCodePoint(parseSpecialChar(c));
+ escStatus = EscapeStatus.VALID;
+ } catch (ParseException e) {
+ // This is just for completeness. We will actually never catch any ParseException here
+ // since we already checked the character with isSpecialChar() before.
+ escapeBuffer.append(c);
+ escStatus = EscapeStatus.INVALID;
+ }
+ } else if (parseFlags.contains(ParseFlags.OCTAL_NUMBERS) && c >= '0' && c <= '7') {
+ escStatus = EscapeStatus.OCTAL_NUMBER;
+ // Don't consume this character right now - as this wouldn't work if it's the last character.
+ consumeChar = false;
+ } else if (parseFlags.contains(ParseFlags.HEX_NUMBERS) && c == 'x') {
+ escStatus = EscapeStatus.HEX_NUMBER;
+ } else if (parseFlags.contains(ParseFlags.UNICODE_SHORT_NUMBERS) && c == 'u') {
+ escStatus = EscapeStatus.UNICODE_SHORT_NUMBER;
+ } else if (parseFlags.contains(ParseFlags.UNICODE_LONG_NUMBERS) && c == 'U') {
+ escStatus = EscapeStatus.UNICODE_LONG_NUMBER;
+ } else {
+ escStatus = EscapeStatus.INVALID;
+ }
+ if (consumeChar) {
+ escapeBuffer.append(c);
+ }
+ } else if (escStatus == EscapeStatus.HEX_NUMBER) {
+ // Only consume this character if it belongs to the escape sequence.
+ consumeChar = (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F');
+ if (consumeChar) {
+ escapeBuffer.append(c);
+ }
+
+ if (!consumeChar || isLastChar || escapeBuffer.length() == 6) {
+ // The escape sequence is terminated. Set the escape status to invalid until
+ // we know that it's actually valid.
+ escStatus = EscapeStatus.INVALID;
+ if (escapeBuffer.length() > 2) {
+ // Decode the hexadecimal number.
+ try {
+ int codePoint = Integer.parseInt(escapeBuffer.toString().substring(2), 16);
+ if (codePoint <= 0x10FFFF) {
+ buffer.appendCodePoint(codePoint);
+ escStatus = EscapeStatus.VALID;
+ }
+ } catch (NumberFormatException e) {
+ }
+ }
+ }
+ } else if (escStatus == EscapeStatus.UNICODE_SHORT_NUMBER
+ || escStatus == EscapeStatus.UNICODE_LONG_NUMBER) {
+ // Only consume this character if it belongs to the escape sequence.
+ consumeChar = (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F');
+ if (consumeChar) {
+ escapeBuffer.append(c);
+ }
+
+ int finalLength = escStatus == EscapeStatus.UNICODE_SHORT_NUMBER ? 6 : 10;
+ if (escapeBuffer.length() == finalLength) {
+ // The escape sequence is terminated. Set the escape status to invalid until
+ // we know that it's actually valid. Decode the hexadecimal number.
+ escStatus = EscapeStatus.INVALID;
+ try {
+ int codePoint = Integer.parseInt(escapeBuffer.toString().substring(2), 16);
+ if (codePoint <= 0x10FFFF) {
+ buffer.appendCodePoint(codePoint);
+ escStatus = EscapeStatus.VALID;
+ }
+ } catch (NumberFormatException e) {
+ }
+ } else if (!consumeChar || isLastChar) {
+ // The escape sequence is terminated and invalid.
+ escStatus = EscapeStatus.INVALID;
+ }
+ } else if (escStatus == EscapeStatus.OCTAL_NUMBER) {
+ // Only consume this character if it belongs to the escape sequence.
+ consumeChar = c >= '0' && c <= '7';
+ if (consumeChar) {
+ escapeBuffer.append(c);
+ }
+
+ if (!consumeChar || isLastChar || escapeBuffer.length() == 4) {
+ // The escape sequence is terminated. Set the escape status to invalid until
+ // we know that it's actually valid.
+ escStatus = EscapeStatus.INVALID;
+ if (escapeBuffer.length() > 1) {
+ // Decode the octal number.
+ try {
+ int codePoint = Integer.parseInt(escapeBuffer.toString().substring(1), 8);
+ if (codePoint <= 0xFF) {
+ buffer.appendCodePoint(codePoint);
+ escStatus = EscapeStatus.VALID;
+ }
+ } catch (NumberFormatException e) {
+ }
+ }
+ }
+ }
+
+ if (escStatus == EscapeStatus.NONE) {
+ // Current character isn't escaped - copy it over to the destination buffer.
+ buffer.append(c);
+ } else if (escStatus == EscapeStatus.VALID) {
+ escStatus = EscapeStatus.NONE;
+ } else if (escStatus == EscapeStatus.INVALID) {
+ buffer.append(escapeBuffer);
+ escStatus = EscapeStatus.NONE;
+ }
+
+ if (!consumeChar) {
+ // Don't consume the current character.
+ i--;
+ }
+ }
+
+ // Check for non-finished escape sequences at the end of the string.
+ if (escStatus != EscapeStatus.NONE) {
+ buffer.append(escapeBuffer);
+ }
+
+ // Convert the buffer into a string and return it.
+ return buffer.toString();
+ }
+
+ /**
+ * Transcodes the given string. This is done as follows:</br></br>
+ * 1) The given string is encoded into a binary byte buffer.</br></br>
+ * 2) It's tested whether this binary byte buffer seems to represent a string which is encoded as
+ * either ASCII, Latin-1, or UTF-8. If this is the case, the binary byte buffer is decoded back into
+ * a string and this string is returned. If the test is negative, the given string is returned without
+ * modification because its encoding can't be reliably determined in this case.
+ * The most important use case of this function is to transcode a string which is actually UTF-8 but has
+ * been incorrectly decoded as Latin-1 instead.
+ * @param str The string to transcode.
+ * @return The transcoded string.
+ */
+ public static String transcodeString(String str) {
+ // Try to transcode the string from Latin-1 to UTF-8 (ASCII doesn't need to be explicitly
+ // considered here since Latin-1 is backwards compatible with ASCII). The transcoding will
+ // almost certainly only succeed if the string actually *is* encoded in UTF-8. If the
+ // transcoding fails, the string is simply left unchanged.
+ try {
+ // First, try to encode the string as Latin-1 in order to obtain the binary byte
+ // representation of the string.
+ CharsetEncoder latin1Encoder = Charset.forName("ISO-8859-1").newEncoder(); //$NON-NLS-1$
+ ByteBuffer stringBytes = latin1Encoder.encode(CharBuffer.wrap(str.toCharArray()));
+
+ // Next, try to decode the string as UTF-8. This will almost certainly only succeed
+ // if the string actually *is* encoded in UTF-8. Note that if the decoding fails,
+ // an exception is thrown before the str variable is assigned. The original string
+ // is therefore left unchanged in this case.
+ CharsetDecoder utf8Decoder = Charset.forName("UTF-8").newDecoder(); //$NON-NLS-1$
+ str = utf8Decoder.decode(stringBytes).toString();
+ } catch (Exception e) {
+ }
+
+ return str;
+ }
+
+ /**
+ * Escapes any non-printable characters as well as the printable special characters single quotation
+ * mark, double quotation mark, backslash, and literal question mark within the given string. Supports
+ * the entire Unicode code space.
+ * @param str The string which should be escaped.
+ * @return The escaped string.
+ */
+ public static String escapeString(String str) {
+ return escapeString(str, true);
+ }
+
+ /**
+ * Escapes any non-printable characters within the given string. Supports the entire Unicode code space.
+ * @param str The string which should be escaped.
+ * @param escapePrintableSpecialChars Defines whether the printable special characters single
+ * quotation mark, double quotation mark, backslash, and literal question mark should be
+ * escaped as well, or not.
+ * @return The escaped string.
+ */
+ public static String escapeString(String str, boolean escapePrintableSpecialChars) {
+ StringBuilder buffer = new StringBuilder();
+
+ for (int i = 0; i < str.length(); i++) {
+ // Get the current character code point. Note that using the Java "char" data type isn't
+ // sufficient here, as it can't handle all Unicode characters.
+ int codePoint = str.codePointAt(i);
+ if (Character.isSupplementaryCodePoint(codePoint)) {
+ i++;
+ }
+
+ // Check the code point type of the character in order to determine whether it's
+ // printable or not.
+ int codePointType = Character.getType(codePoint);
+ switch (codePointType) {
+ case Character.LINE_SEPARATOR:
+ case Character.PARAGRAPH_SEPARATOR:
+ case Character.CONTROL:
+ case Character.PRIVATE_USE:
+ case Character.SURROGATE:
+ case Character.UNASSIGNED:
+ // Non-printable character.
+ if (isSpecialCodePoint(codePoint)) {
+ // Escape by using the special character escape notation.
+ buffer.append('\\');
+ try {
+ buffer.append(parseSpecialCodePoint(codePoint));
+ } catch (ParseException e) {
+ buffer.appendCodePoint(codePoint);
+ }
+ } else if (codePoint == 0x00) {
+ // Escape the null character separately - don't use leading zeros.
+ buffer.append("\\0"); //$NON-NLS-1$
+ } else if (codePoint <= 0xFF) {
+ // Escape by using the octal escape notation.
+ buffer.append(String.format("\\%03o", codePoint)); //$NON-NLS-1$
+ } else if (codePoint <= 0xFFFF) {
+ // Escape by using the short Unicode escape notation.
+ buffer.append(String.format("\\u%04x", codePoint)); //$NON-NLS-1$
+ } else {
+ // Escape by using the long Unicode escape notation.
+ buffer.append(String.format("\\U%08x", codePoint)); //$NON-NLS-1$
+ }
+ break;
+ default:
+ // Printable character.
+ if (escapePrintableSpecialChars && isSpecialCodePoint(codePoint)) {
+ // Escape by using the special character escape notation.
+ buffer.append('\\');
+ try {
+ buffer.append(parseSpecialCodePoint(codePoint));
+ } catch (ParseException e) {
+ buffer.appendCodePoint(codePoint);
+ }
+ } else {
+ // Don't escape.
+ buffer.appendCodePoint(codePoint);
+ }
+ }
+ }
+
+ return buffer.toString();
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MITargetDownloadInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MITargetDownloadInfo.java
index 393486e65df..880e5c375da 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MITargetDownloadInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MITargetDownloadInfo.java
@@ -16,7 +16,7 @@ package org.eclipse.cdt.dsf.mi.service.command.output;
/**
* Parsing of GDB/MI "target-download"
- *
+ *
* Example:
* -target-download
* +download,{section=".text",section-size="6668",total-size="9880"}
@@ -63,76 +63,70 @@ package org.eclipse.cdt.dsf.mi.service.command.output;
* total-sent="9796",total-size="9880"}
* ^done,address="0x10004",load-size="9880",transfer-rate="6586",
* write-rate="429"
- *
+ *
* @since 3.0
*/
public class MITargetDownloadInfo extends MIInfo {
- private String fAddress = ""; //$NON-NLS-1$
- private long fLoadSize = 0;
- private long fTransferRate = 0;
- private long fWriteRate = 0;
-
- public MITargetDownloadInfo( MIOutput record ) {
- super( record );
- parse();
- }
+ private String fAddress = ""; //$NON-NLS-1$
+ private long fLoadSize = 0;
+ private long fTransferRate = 0;
+ private long fWriteRate = 0;
+
+ public MITargetDownloadInfo(MIOutput record) {
+ super(record);
+ parse();
+ }
+
+ public String getAddress() {
+ return fAddress;
+ }
+
+ public long getLoadSize() {
+ return fLoadSize;
+ }
+
+ public long getTransferRate() {
+ return fTransferRate;
+ }
+
+ public long getWriteRate() {
+ return fWriteRate;
+ }
- public String getAddress() {
- return fAddress;
- }
-
- public long getLoadSize() {
- return fLoadSize;
- }
-
- public long getTransferRate() {
- return fTransferRate;
- }
-
- public long getWriteRate() {
- return fWriteRate;
- }
-
- private void parse() {
- if ( isDone() ) {
- MIOutput out = getMIOutput();
- MIResultRecord rr = out.getMIResultRecord();
- if ( rr != null ) {
- MIResult[] results = rr.getMIResults();
- for( int i = 0; i < results.length; i++ ) {
- String var = results[i].getVariable();
- MIValue value = results[i].getMIValue();
- String str = ""; //$NON-NLS-1$
- if ( value != null && value instanceof MIConst ) {
- str = ((MIConst)value).getCString().trim();
- }
- if ( var.equals( "address" ) ) { //$NON-NLS-1$
- fAddress = str;
- }
- else if ( var.equals( "load-size" ) ) { //$NON-NLS-1$
- try {
- fLoadSize = Long.parseLong( str );
- }
- catch( NumberFormatException e ) {
- }
- }
- else if ( var.equals( "transfer-rate" ) ) { //$NON-NLS-1$
- try {
- fTransferRate = Long.parseLong( str );
- }
- catch( NumberFormatException e ) {
- }
- }
- else if ( var.equals( "write-rate" ) ) { //$NON-NLS-1$
- try {
- fWriteRate = Long.parseLong( str );
- }
- catch( NumberFormatException e ) {
- }
- }
- }
- }
- }
- }
+ private void parse() {
+ if (isDone()) {
+ MIOutput out = getMIOutput();
+ MIResultRecord rr = out.getMIResultRecord();
+ if (rr != null) {
+ MIResult[] results = rr.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ MIValue value = results[i].getMIValue();
+ String str = ""; //$NON-NLS-1$
+ if (value != null && value instanceof MIConst) {
+ str = ((MIConst) value).getCString().trim();
+ }
+ if (var.equals("address")) { //$NON-NLS-1$
+ fAddress = str;
+ } else if (var.equals("load-size")) { //$NON-NLS-1$
+ try {
+ fLoadSize = Long.parseLong(str);
+ } catch (NumberFormatException e) {
+ }
+ } else if (var.equals("transfer-rate")) { //$NON-NLS-1$
+ try {
+ fTransferRate = Long.parseLong(str);
+ } catch (NumberFormatException e) {
+ }
+ } else if (var.equals("write-rate")) { //$NON-NLS-1$
+ try {
+ fWriteRate = Long.parseLong(str);
+ } catch (NumberFormatException e) {
+ }
+ }
+ }
+ }
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIThread.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIThread.java
index 65200351cf8..54b2f327cb7 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIThread.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIThread.java
@@ -25,7 +25,7 @@ import org.eclipse.cdt.dsf.concurrent.Immutable;
/**
* GDB/MI Thread tuple parsing.
- *
+ *
* @since 1.1
*/
@Immutable
@@ -35,162 +35,180 @@ public class MIThread {
public final static String MI_THREAD_STATE_RUNNING = "running"; //$NON-NLS-1$
/** @since 4.1 */
public final static String MI_THREAD_STATE_STOPPED = "stopped"; //$NON-NLS-1$
-
- final private String fThreadId;
- final private String fTargetId;
- final private String fOsId;
- final private String fParentId;
- final private MIFrame fTopFrame;
- final private String fDetails;
- final private String fState;
- final private String fCore;
- final private String fName;
-
+
+ final private String fThreadId;
+ final private String fTargetId;
+ final private String fOsId;
+ final private String fParentId;
+ final private MIFrame fTopFrame;
+ final private String fDetails;
+ final private String fState;
+ final private String fCore;
+ final private String fName;
+
/** @since 4.4 */
- protected MIThread(String threadId, String targetId, String osId, String parentId,
- MIFrame topFrame, String details, String state, String core) {
+ protected MIThread(String threadId, String targetId, String osId, String parentId, MIFrame topFrame, String details,
+ String state, String core) {
this(threadId, targetId, osId, parentId, topFrame, details, state, core, null);
}
/** @since 4.6 */
- protected MIThread(String threadId, String targetId, String osId, String parentId,
- MIFrame topFrame, String details, String state, String core,
- String name) {
- fThreadId = threadId;
- fTargetId = targetId;
- fOsId = osId;
- fParentId = parentId;
- fTopFrame = topFrame;
- fDetails = details;
- fState = state;
- fCore = core;
- fName = name;
+ protected MIThread(String threadId, String targetId, String osId, String parentId, MIFrame topFrame, String details,
+ String state, String core, String name) {
+ fThreadId = threadId;
+ fTargetId = targetId;
+ fOsId = osId;
+ fParentId = parentId;
+ fTopFrame = topFrame;
+ fDetails = details;
+ fState = state;
+ fCore = core;
+ fName = name;
+ }
+
+ public String getThreadId() {
+ return fThreadId;
+ }
+
+ public String getTargetId() {
+ return fTargetId;
+ }
+
+ public String getOsId() {
+ return fOsId;
+ }
+
+ public String getParentId() {
+ return fParentId;
+ }
+
+ public MIFrame getTopFrame() {
+ return fTopFrame;
+ }
+
+ public String getDetails() {
+ return fDetails;
+ }
+
+ public String getState() {
+ return fState;
}
- public String getThreadId() { return fThreadId; }
- public String getTargetId() { return fTargetId; }
- public String getOsId() { return fOsId; }
- public String getParentId() { return fParentId; }
- public MIFrame getTopFrame() { return fTopFrame; }
- public String getDetails() { return fDetails; }
- public String getState() { return fState; }
/**
* Available since GDB 7.1
* @since 4.0
*/
- public String getCore() { return fCore; }
+ public String getCore() {
+ return fCore;
+ }
/** @since 4.6 */
- public String getName() { return fName; }
+ public String getName() {
+ return fName;
+ }
public static MIThread parse(MITuple tuple) {
- MIResult[] results = tuple.getMIResults();
-
- String threadId = null;
- String targetId = null;
- String osId = null;
- String parentId = null;
- MIFrame topFrame = null;
- String state = null;
- String details = null;
- String core = null;
- String name = null;
-
- for (MIResult result : results) {
- String var = result.getVariable();
- if (var.equals("id")) { //$NON-NLS-1$
- MIValue val = result.getMIValue();
- if (val instanceof MIConst) {
- threadId = ((MIConst) val).getCString().trim();
- }
- }
- else if (var.equals("target-id")) { //$NON-NLS-1$
- MIValue val = result.getMIValue();
- if (val instanceof MIConst) {
- targetId = ((MIConst) val).getCString().trim();
- osId = parseOsId(targetId);
- parentId = parseParentId(targetId);
- }
- }
- else if (var.equals("frame")) { //$NON-NLS-1$
- MITuple val = (MITuple)result.getMIValue();
- topFrame = new MIFrame(val);
- }
- else if (var.equals("state")) { //$NON-NLS-1$
- MIValue val = result.getMIValue();
- if (val instanceof MIConst) {
- state = ((MIConst) val).getCString().trim();
- }
- }
- else if (var.equals("details")) { //$NON-NLS-1$
- MIValue val = result.getMIValue();
- if (val instanceof MIConst) {
- details = ((MIConst) val).getCString().trim();
- }
- }
- else if (var.equals("core")) { //$NON-NLS-1$
- MIValue val = result.getMIValue();
- if (val instanceof MIConst) {
- core = ((MIConst) val).getCString().trim();
- }
- }
- else if (var.equals("name")) { //$NON-NLS-1$
- MIValue val = result.getMIValue();
- if (val instanceof MIConst) {
- name = ((MIConst) val).getCString().trim();
- }
- }
- }
-
- return new MIThread(threadId, targetId, osId, parentId, topFrame,
- details, state, core, name);
+ MIResult[] results = tuple.getMIResults();
+
+ String threadId = null;
+ String targetId = null;
+ String osId = null;
+ String parentId = null;
+ MIFrame topFrame = null;
+ String state = null;
+ String details = null;
+ String core = null;
+ String name = null;
+
+ for (MIResult result : results) {
+ String var = result.getVariable();
+ if (var.equals("id")) { //$NON-NLS-1$
+ MIValue val = result.getMIValue();
+ if (val instanceof MIConst) {
+ threadId = ((MIConst) val).getCString().trim();
+ }
+ } else if (var.equals("target-id")) { //$NON-NLS-1$
+ MIValue val = result.getMIValue();
+ if (val instanceof MIConst) {
+ targetId = ((MIConst) val).getCString().trim();
+ osId = parseOsId(targetId);
+ parentId = parseParentId(targetId);
+ }
+ } else if (var.equals("frame")) { //$NON-NLS-1$
+ MITuple val = (MITuple) result.getMIValue();
+ topFrame = new MIFrame(val);
+ } else if (var.equals("state")) { //$NON-NLS-1$
+ MIValue val = result.getMIValue();
+ if (val instanceof MIConst) {
+ state = ((MIConst) val).getCString().trim();
+ }
+ } else if (var.equals("details")) { //$NON-NLS-1$
+ MIValue val = result.getMIValue();
+ if (val instanceof MIConst) {
+ details = ((MIConst) val).getCString().trim();
+ }
+ } else if (var.equals("core")) { //$NON-NLS-1$
+ MIValue val = result.getMIValue();
+ if (val instanceof MIConst) {
+ core = ((MIConst) val).getCString().trim();
+ }
+ } else if (var.equals("name")) { //$NON-NLS-1$
+ MIValue val = result.getMIValue();
+ if (val instanceof MIConst) {
+ name = ((MIConst) val).getCString().trim();
+ }
+ }
+ }
+
+ return new MIThread(threadId, targetId, osId, parentId, topFrame, details, state, core, name);
}
-
- // Note that windows gdbs returns lower case "thread" , so the matcher needs to be case-insensitive.
- private static Pattern fgOsIdPattern1 = Pattern.compile("([Tt][Hh][Rr][Ee][Aa][Dd]\\s*)(0x[0-9a-fA-F]+|-?\\d+)(\\s*\\([Ll][Ww][Pp]\\s*)(\\d*)", 0); //$NON-NLS-1$
- private static Pattern fgOsIdPattern2 = Pattern.compile("[Tt][Hh][Rr][Ee][Aa][Dd]\\s*\\d+\\.(\\d+)", 0); //$NON-NLS-1$
- private static Pattern fgOsIdPattern3 = Pattern.compile("[Tt][Hh][Rr][Ee][Aa][Dd]\\s*(\\S+)", 0); //$NON-NLS-1$
- private static Pattern fgOsIdPattern4 = Pattern.compile("[Pp][Rr][Oo][Cc][Ee][Ss][Ss]\\s*(\\S+)", 0); //$NON-NLS-1$
-
- /**
+
+ // Note that windows gdbs returns lower case "thread" , so the matcher needs to be case-insensitive.
+ private static Pattern fgOsIdPattern1 = Pattern
+ .compile("([Tt][Hh][Rr][Ee][Aa][Dd]\\s*)(0x[0-9a-fA-F]+|-?\\d+)(\\s*\\([Ll][Ww][Pp]\\s*)(\\d*)", 0); //$NON-NLS-1$
+ private static Pattern fgOsIdPattern2 = Pattern.compile("[Tt][Hh][Rr][Ee][Aa][Dd]\\s*\\d+\\.(\\d+)", 0); //$NON-NLS-1$
+ private static Pattern fgOsIdPattern3 = Pattern.compile("[Tt][Hh][Rr][Ee][Aa][Dd]\\s*(\\S+)", 0); //$NON-NLS-1$
+ private static Pattern fgOsIdPattern4 = Pattern.compile("[Pp][Rr][Oo][Cc][Ee][Ss][Ss]\\s*(\\S+)", 0); //$NON-NLS-1$
+
+ /**
* @since 4.6
*/
- protected static String parseOsId(String str) {
- // General format:
- // "Thread 0xb7c8ab90 (LWP 7010)"
- // ^^^^
- // "Thread 162.32942"
- // ^^^^^
- // "thread abc123"
- //
- // "process 12345" => Linux without pthread. The process as one thread, the process thread.
- // ^^^^^^
- // PLEASE UPDATE MIThreadTests.java IF YOU TWEAK THIS CODE
-
- Matcher matcher = fgOsIdPattern1.matcher(str);
- if (matcher.find()) {
- return matcher.group(4);
- }
-
- matcher = fgOsIdPattern2.matcher(str);
- if (matcher.find()) {
- return matcher.group(1);
- }
-
- matcher = fgOsIdPattern3.matcher(str);
- if (matcher.find()) {
- return matcher.group(1);
- }
-
- matcher = fgOsIdPattern4.matcher(str);
- if (matcher.find()) {
- return matcher.group(1);
- }
-
- return null;
- }
-
- private static Pattern fgIdPattern = Pattern.compile("[Tt][Hh][Rr][Ee][Aa][Dd]\\s*(\\d+)\\.\\d+", 0); //$NON-NLS-1$
+ protected static String parseOsId(String str) {
+ // General format:
+ // "Thread 0xb7c8ab90 (LWP 7010)"
+ // ^^^^
+ // "Thread 162.32942"
+ // ^^^^^
+ // "thread abc123"
+ //
+ // "process 12345" => Linux without pthread. The process as one thread, the process thread.
+ // ^^^^^^
+ // PLEASE UPDATE MIThreadTests.java IF YOU TWEAK THIS CODE
+
+ Matcher matcher = fgOsIdPattern1.matcher(str);
+ if (matcher.find()) {
+ return matcher.group(4);
+ }
+
+ matcher = fgOsIdPattern2.matcher(str);
+ if (matcher.find()) {
+ return matcher.group(1);
+ }
+
+ matcher = fgOsIdPattern3.matcher(str);
+ if (matcher.find()) {
+ return matcher.group(1);
+ }
+
+ matcher = fgOsIdPattern4.matcher(str);
+ if (matcher.find()) {
+ return matcher.group(1);
+ }
+
+ return null;
+ }
+
+ private static Pattern fgIdPattern = Pattern.compile("[Tt][Hh][Rr][Ee][Aa][Dd]\\s*(\\d+)\\.\\d+", 0); //$NON-NLS-1$
/**
* This is used to parse the same ID fed to {@link #parseOsId(String)}. The
@@ -198,18 +216,18 @@ public class MIThread {
* "Thread pppp.tttt". If the ID is not in that format, we return null.
* @since 4.6
*/
- protected static String parseParentId(String str) {
- // General format:
- // "Thread 162.32942"
- // ^^^
- // PLEASE UPDATE MIThreadTests.java IF YOU TWEAK THIS CODE
-
- Matcher matcher = fgIdPattern.matcher(str);
- if (matcher.find()) {
- return matcher.group(1);
- }
-
- return null;
- }
+ protected static String parseParentId(String str) {
+ // General format:
+ // "Thread 162.32942"
+ // ^^^
+ // PLEASE UPDATE MIThreadTests.java IF YOU TWEAK THIS CODE
+
+ Matcher matcher = fgIdPattern.matcher(str);
+ if (matcher.find()) {
+ return matcher.group(1);
+ }
+
+ return null;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIThreadInfoInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIThreadInfoInfo.java
index 237951f6d0c..3470c933973 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIThreadInfoInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIThreadInfoInfo.java
@@ -18,12 +18,11 @@ package org.eclipse.cdt.dsf.mi.service.command.output;
import java.util.Arrays;
import java.util.Comparator;
-
/**
* GDB/MI thread list parsing.
- *
+ *
* Example 1:
- *
+ *
* -thread-info
* ^done,threads=[
* {id="2",target-id="Thread 0xb7c8ab90 (LWP 7010)",
@@ -35,10 +34,10 @@ import java.util.Comparator;
* file="my_test.cc",fullname="/home/francois/GDB/my_test.cc",line="39"},
* state="stopped"}
* ],current-thread-id="2"
- *
- *
+ *
+ *
* Example 2:
- *
+ *
* -thread-info 2
* ^done,threads=[
* {id="2",target-id="Thread 0xb7c8ab90 (LWP 7010)",
@@ -46,8 +45,8 @@ import java.util.Comparator;
* file="my_test.cc",fullname="/home/francois/GDB/my_test.cc",line="26"},
* state="stopped"}
* ]
- *
- *
+ *
+ *
* Example 3 (non-stop):
*
* -thread-info
@@ -58,16 +57,16 @@ import java.util.Comparator;
* file="my_test.cc",fullname="/home/francois/GDB/my_test.cc",line="39"},
* state="stopped"}
* ],current-thread-id="1"
- *
- *
+ *
+ *
* Example 4 (non-stop):
- *
+ *
* -thread-info 1
* ^done,threads=[{id="1",target-id="Thread 0xb7d6d6b0 (LWP 14494)",state="running"}]
*
*
* Example 5 (Dicos):
- *
+ *
* -thread-info 1
* ^done,threads=[
* {id="1",target-id="Thread 162.32942",details="JUnitProcess_PT (Ready) 175417582794 8572423",
@@ -75,10 +74,10 @@ import java.util.Comparator;
* file="/local/home/lmckhou/TSP/TADE/example/JUnitProcess_OU/src/ExpressionTestApp.cc",
* fullname="/local/home/lmckhou/TSP/TADE/example/JUnitProcess_OU/src/ExpressionTestApp.cc",line="279"},
* state="stopped"}]
- *
+ *
* With GDB 7.1, a new 'core' field is present to indicate which core the thread is on.
* The parsing of this new field is handled by {@link MIThread}
- *
+ *
* -thread-info
* ^done,threads=[
* {id="1",target-id="process 1307",
@@ -87,7 +86,7 @@ import java.util.Comparator;
* state="stopped",
* core="2"}],
* current-thread-id="1"
- *
+ *
* @since 1.1
*/
public class MIThreadInfoInfo extends MIInfo {
@@ -116,7 +115,7 @@ public class MIThreadInfoInfo extends MIInfo {
MIOutput out = getMIOutput();
MIResultRecord rr = out.getMIResultRecord();
if (rr != null) {
- MIResult[] results = rr.getMIResults();
+ MIResult[] results = rr.getMIResults();
for (int i = 0; i < results.length; i++) {
String var = results[i].getVariable();
if (var.equals("threads")) { //$NON-NLS-1$
@@ -124,8 +123,7 @@ public class MIThreadInfoInfo extends MIInfo {
if (val instanceof MIList) {
fThreadList = parseThreadsImpl((MIList) val);
}
- }
- else if (var.equals("current-thread-id")) { //$NON-NLS-1$
+ } else if (var.equals("current-thread-id")) { //$NON-NLS-1$
MIValue value = results[i].getMIValue();
if (value instanceof MIConst) {
fCurrentThread = ((MIConst) value).getCString().trim();
@@ -151,7 +149,7 @@ public class MIThreadInfoInfo extends MIInfo {
static MIThread[] parseThreads(MIList list) {
MIValue[] values = list.getMIValues();
MIThread[] threadList = new MIThread[values.length];
-
+
for (int i = 0; i < values.length; i++) {
threadList[i] = MIThread.parse((MITuple) values[i]);
}
@@ -161,8 +159,7 @@ public class MIThreadInfoInfo extends MIInfo {
public int compare(MIThread o1, MIThread o2) {
try {
return Integer.parseInt(o1.getThreadId()) - Integer.parseInt(o2.getThreadId());
- }
- catch(NumberFormatException e) {
+ } catch (NumberFormatException e) {
return 0;
}
}
@@ -170,4 +167,3 @@ public class MIThreadInfoInfo extends MIInfo {
return threadList;
}
}
-
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIThreadListIdsInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIThreadListIdsInfo.java
index 9f483fb66ea..4935c2ebdc1 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIThreadListIdsInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIThreadListIdsInfo.java
@@ -29,35 +29,34 @@ public class MIThreadListIdsInfo extends MIInfo {
}
/**
- * @since 1.1
- */
+ * @since 1.1
+ */
public String[] getStrThreadIds() {
if (strThreadIds == null) {
parse();
// Make sure the threads are in order for the debug view
// We need our own comparator to treat these strings as integers.
- Arrays.sort(strThreadIds,
- new Comparator<String>() {
- @Override
- public int compare(String o1, String o2) {
- int threadInt1;
- int threadInt2;
-
- try {
- threadInt1 = Integer.parseInt(o1);
- } catch (NumberFormatException e) {
- return 1;
- }
-
- try {
- threadInt2 = Integer.parseInt(o2);
- } catch (NumberFormatException e) {
- return -1;
- }
-
- return threadInt1 - threadInt2;
- }
- });
+ Arrays.sort(strThreadIds, new Comparator<String>() {
+ @Override
+ public int compare(String o1, String o2) {
+ int threadInt1;
+ int threadInt2;
+
+ try {
+ threadInt1 = Integer.parseInt(o1);
+ } catch (NumberFormatException e) {
+ return 1;
+ }
+
+ try {
+ threadInt2 = Integer.parseInt(o2);
+ } catch (NumberFormatException e) {
+ return -1;
+ }
+
+ return threadInt1 - threadInt2;
+ }
+ });
}
return strThreadIds;
}
@@ -67,13 +66,13 @@ public class MIThreadListIdsInfo extends MIInfo {
MIOutput out = getMIOutput();
MIResultRecord rr = out.getMIResultRecord();
if (rr != null) {
- MIResult[] results = rr.getMIResults();
+ MIResult[] results = rr.getMIResults();
for (int i = 0; i < results.length; i++) {
String var = results[i].getVariable();
if (var.equals("thread-ids")) { //$NON-NLS-1$
MIValue val = results[i].getMIValue();
if (val instanceof MITuple) {
- parseThreadIds((MITuple)val);
+ parseThreadIds((MITuple) val);
}
}
}
@@ -92,7 +91,7 @@ public class MIThreadListIdsInfo extends MIInfo {
if (var.equals("thread-id")) { //$NON-NLS-1$
MIValue value = results[i].getMIValue();
if (value instanceof MIConst) {
- strThreadIds[i] = ((MIConst)value).getCString().trim();
+ strThreadIds[i] = ((MIConst) value).getCString().trim();
}
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MITraceFindInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MITraceFindInfo.java
index d21e8df0890..d22c35bf079 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MITraceFindInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MITraceFindInfo.java
@@ -13,13 +13,12 @@
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command.output;
-
/**
* -trace-find result.
* @since 3.0
*/
public class MITraceFindInfo extends MIInfo {
-
+
private boolean fFound;
private MITraceRecord fTraceRecord;
@@ -41,13 +40,13 @@ public class MITraceFindInfo extends MIInfo {
MIOutput out = getMIOutput();
MIResultRecord rr = out.getMIResultRecord();
if (rr != null) {
- MIResult[] results = rr.getMIResults();
+ MIResult[] results = rr.getMIResults();
for (int i = 0; i < results.length; i++) {
String var = results[i].getVariable();
if (var.equals("found")) { //$NON-NLS-1$
MIValue val = results[i].getMIValue();
if (val instanceof MIConst) {
- fFound = ((MIConst)val).getString().equals("0") ? false : true; //$NON-NLS-1$
+ fFound = ((MIConst) val).getString().equals("0") ? false : true; //$NON-NLS-1$
if (fFound) {
fTraceRecord = new MITraceRecord(getMIOutput());
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MITraceListVariablesInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MITraceListVariablesInfo.java
index 8d6b3694962..2362560b7ed 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MITraceListVariablesInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MITraceListVariablesInfo.java
@@ -18,14 +18,14 @@ import java.util.List;
/**
* -trace-list-variables
- *
+ *
* ^done,trace-variables={nr_rows="1",nr_cols="3",
* hdr=[{width="15",alignment="-1",col_name="name",colhdr="Name"},
* {width="11",alignment="-1",col_name="initial",colhdr="Initial"},
* {width="11",alignment="-1",col_name="current",colhdr="Current"}],
* body=[variable={name="$trace_timestamp",initial="0"}
* variable={name="$foo",initial="10",current="15"}]}
- *
+ *
* @since 3.0
*/
public class MITraceListVariablesInfo extends MIInfo {
@@ -34,7 +34,7 @@ public class MITraceListVariablesInfo extends MIInfo {
private String fName;
private String fInitialValue;
private String fCurrentValue;
-
+
public String getName() {
return fName;
}
@@ -49,7 +49,7 @@ public class MITraceListVariablesInfo extends MIInfo {
}
private MITraceVariableInfo[] fVariables;
-
+
public MITraceListVariablesInfo(MIOutput out) {
super(out);
parse();
@@ -60,68 +60,68 @@ public class MITraceListVariablesInfo extends MIInfo {
}
private void parse() {
- List<MITraceVariableInfo> aList = new ArrayList<MITraceVariableInfo>(1);
- if (isDone()) {
- MIOutput out = getMIOutput();
- MIResultRecord rr = out.getMIResultRecord();
- if (rr != null) {
- MIResult[] results = rr.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- if (var.equals("trace-variables")) { //$NON-NLS-1$
- parseTable(results[i].getMIValue(), aList);
- }
- }
- }
- }
- fVariables = aList.toArray(new MITraceVariableInfo[aList.size()]);
+ List<MITraceVariableInfo> aList = new ArrayList<MITraceVariableInfo>(1);
+ if (isDone()) {
+ MIOutput out = getMIOutput();
+ MIResultRecord rr = out.getMIResultRecord();
+ if (rr != null) {
+ MIResult[] results = rr.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ if (var.equals("trace-variables")) { //$NON-NLS-1$
+ parseTable(results[i].getMIValue(), aList);
+ }
+ }
+ }
+ }
+ fVariables = aList.toArray(new MITraceVariableInfo[aList.size()]);
+ }
+
+ private void parseTable(MIValue val, List<MITraceVariableInfo> aList) {
+ if (val instanceof MITuple) {
+ MIResult[] table = ((MITuple) val).getMIResults();
+ for (int i = 0; i < table.length; i++) {
+ String variable = table[i].getVariable();
+ if (variable.equals("body")) { //$NON-NLS-1$
+ parseBody(table[i].getMIValue(), aList);
+ }
+ }
+ }
+ }
+
+ private void parseBody(MIValue body, List<MITraceVariableInfo> aList) {
+ if (body instanceof MIList) {
+ MIResult[] vars = ((MIList) body).getMIResults();
+ for (int i = 0; i < vars.length; i++) {
+ String variable = vars[i].getVariable();
+ if (variable.equals("variable")) { //$NON-NLS-1$
+ parseVariable(vars[i].getMIValue(), aList);
+ }
+ }
+ }
}
-
- private void parseTable(MIValue val, List<MITraceVariableInfo> aList) {
- if (val instanceof MITuple) {
- MIResult[] table = ((MITuple)val).getMIResults();
- for (int i = 0; i < table.length; i++) {
- String variable = table[i].getVariable();
- if (variable.equals("body")) { //$NON-NLS-1$
- parseBody(table[i].getMIValue(), aList);
- }
- }
- }
- }
-
- private void parseBody(MIValue body, List<MITraceVariableInfo> aList) {
- if (body instanceof MIList) {
- MIResult[] vars = ((MIList)body).getMIResults();
- for (int i = 0; i < vars.length; i++) {
- String variable = vars[i].getVariable();
- if (variable.equals("variable")) { //$NON-NLS-1$
- parseVariable(vars[i].getMIValue(), aList);
- }
- }
- }
- }
-
- private void parseVariable(MIValue variable, List<MITraceVariableInfo> aList) {
- if (variable instanceof MITuple) {
- MIResult[] results = ((MITuple)variable).getMIResults();
- MITraceVariableInfo info = new MITraceVariableInfo();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- MIValue value = results[i].getMIValue();
- String str = ""; //$NON-NLS-1$
- if (value != null && value instanceof MIConst) {
- str = ((MIConst)value).getCString();
- }
- if (var.equals("name")) { //$NON-NLS-1$
- info.fName = str;
- } else if (var.equals("initial")) { //$NON-NLS-1$
- info.fInitialValue = str;
- } else if (var.equals("current")) { //$NON-NLS-1$
- info.fCurrentValue = str;
- }
- }
- aList.add(info);
- }
- }
+ private void parseVariable(MIValue variable, List<MITraceVariableInfo> aList) {
+ if (variable instanceof MITuple) {
+ MIResult[] results = ((MITuple) variable).getMIResults();
+ MITraceVariableInfo info = new MITraceVariableInfo();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ MIValue value = results[i].getMIValue();
+ String str = ""; //$NON-NLS-1$
+ if (value != null && value instanceof MIConst) {
+ str = ((MIConst) value).getCString();
+ }
+
+ if (var.equals("name")) { //$NON-NLS-1$
+ info.fName = str;
+ } else if (var.equals("initial")) { //$NON-NLS-1$
+ info.fInitialValue = str;
+ } else if (var.equals("current")) { //$NON-NLS-1$
+ info.fCurrentValue = str;
+ }
+ }
+ aList.add(info);
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MITraceRecord.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MITraceRecord.java
index a87ff69d3e8..2bf5cf65f33 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MITraceRecord.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MITraceRecord.java
@@ -13,13 +13,12 @@
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command.output;
-
/**
* -trace-find result.
* @since 3.0
*/
public class MITraceRecord extends MIInfo {
-
+
private MIFrame fStackFrame = null;
private Integer fTracepoint = null;
private Integer fRecordIndex = null;
@@ -46,28 +45,30 @@ public class MITraceRecord extends MIInfo {
MIOutput out = getMIOutput();
MIResultRecord rr = out.getMIResultRecord();
if (rr != null) {
- MIResult[] results = rr.getMIResults();
+ MIResult[] results = rr.getMIResults();
for (int i = 0; i < results.length; i++) {
String var = results[i].getVariable();
if (var.equals("traceframe")) { //$NON-NLS-1$
MIValue val = results[i].getMIValue();
if (val instanceof MIConst) {
try {
- fRecordIndex = Integer.parseInt(((MIConst)val).getString());
- } catch (NumberFormatException e) {}
+ fRecordIndex = Integer.parseInt(((MIConst) val).getString());
+ } catch (NumberFormatException e) {
+ }
}
} else if (var.equals("tracepoint")) { //$NON-NLS-1$
MIValue val = results[i].getMIValue();
if (val instanceof MIConst) {
try {
- fTracepoint = Integer.parseInt(((MIConst)val).getString());
- } catch (NumberFormatException e) {}
+ fTracepoint = Integer.parseInt(((MIConst) val).getString());
+ } catch (NumberFormatException e) {
+ }
}
} else if (var.equals("frame")) { //$NON-NLS-1$
- MIValue value = results[i].getMIValue();
- if (value instanceof MITuple) {
- fStackFrame = new MIFrame((MITuple)value);
- }
+ MIValue value = results[i].getMIValue();
+ if (value instanceof MITuple) {
+ fStackFrame = new MIFrame((MITuple) value);
+ }
}
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MITraceStatusInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MITraceStatusInfo.java
index 65264435970..8215a2fdf8d 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MITraceStatusInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MITraceStatusInfo.java
@@ -18,11 +18,11 @@ import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl.STOP_REASON_ENUM;
/**
* -trace-status result.
- *
+ *
* ^done,supported="1",running="1",frames="0",buffer-size="5242880",buffer-free="5242880"
* ^done,supported="1",running="0",stop-reason="request",frames="0",buffer-size="5242880",buffer-free="5242880"
* ^done,supported="1",running="0",stop-reason="passcount",stopping-tracepoint="7",frames="3",buffer-size="5242880",buffer-free="5242862"
- *
+ *
* Field presence:
* With GDB 7.2:
* "supported"
@@ -109,7 +109,7 @@ public class MITraceStatusInfo extends MIInfo {
public STOP_REASON_ENUM getStopReason() {
return fStopReason;
}
-
+
/** @since 4.4 */
public String getStopErrorDescription() {
return fStopErrorDesc;
@@ -118,13 +118,13 @@ public class MITraceStatusInfo extends MIInfo {
public Integer getStopTracepoint() {
return fStoppingTracepoint;
}
-
+
/** @since 4.4 */
public String getUserName() {
return fUserName;
}
- /** @since 4.4 */
+ /** @since 4.4 */
public String getNotes() {
return fNotes;
}
@@ -148,35 +148,35 @@ public class MITraceStatusInfo extends MIInfo {
public boolean isCircularBuffer() {
return fIsCircularBuffer;
}
-
+
private void parse() {
if (isDone()) {
MIOutput out = getMIOutput();
MIResultRecord rr = out.getMIResultRecord();
if (rr != null) {
- MIResult[] results = rr.getMIResults();
+ MIResult[] results = rr.getMIResults();
for (int i = 0; i < results.length; i++) {
String var = results[i].getVariable();
if (var.equals("supported")) { //$NON-NLS-1$
MIValue val = results[i].getMIValue();
if (val instanceof MIConst) {
- fIsTracingSupported = ((MIConst)val).getString().equals("0") ? false : true; //$NON-NLS-1$
- fIsTracingFromFile = ((MIConst)val).getString().equals("file"); //$NON-NLS-1$
+ fIsTracingSupported = ((MIConst) val).getString().equals("0") ? false : true; //$NON-NLS-1$
+ fIsTracingFromFile = ((MIConst) val).getString().equals("file"); //$NON-NLS-1$
}
} else if (var.equals("trace-file")) { //$NON-NLS-1$
MIValue val = results[i].getMIValue();
if (val instanceof MIConst) {
- fTraceFile = ((MIConst)val).getString().trim();
+ fTraceFile = ((MIConst) val).getString().trim();
}
} else if (var.equals("running")) { //$NON-NLS-1$
MIValue val = results[i].getMIValue();
if (val instanceof MIConst) {
- fIsTracingActive = ((MIConst)val).getString().equals("0") ? false : true; //$NON-NLS-1$
+ fIsTracingActive = ((MIConst) val).getString().equals("0") ? false : true; //$NON-NLS-1$
}
} else if (var.equals("stop-reason")) { //$NON-NLS-1$
MIValue val = results[i].getMIValue();
if (val instanceof MIConst) {
- String reason = ((MIConst)val).getString().trim();
+ String reason = ((MIConst) val).getString().trim();
if (reason.equalsIgnoreCase("request")) { //$NON-NLS-1$
fStopReason = STOP_REASON_ENUM.REQUEST;
} else if (reason.equalsIgnoreCase("overflow")) { //$NON-NLS-1$
@@ -195,71 +195,76 @@ public class MITraceStatusInfo extends MIInfo {
MIValue val = results[i].getMIValue();
if (val instanceof MIConst) {
try {
- fStoppingTracepoint = Integer.parseInt(((MIConst)val).getString().trim());
- } catch (NumberFormatException e) {}
+ fStoppingTracepoint = Integer.parseInt(((MIConst) val).getString().trim());
+ } catch (NumberFormatException e) {
+ }
}
} else if (var.equals("error-description")) { //$NON-NLS-1$
MIValue val = results[i].getMIValue();
if (val instanceof MIConst) {
- fStopErrorDesc = ((MIConst)val).getString().trim();
+ fStopErrorDesc = ((MIConst) val).getString().trim();
}
} else if (var.equals("frames")) { //$NON-NLS-1$
MIValue val = results[i].getMIValue();
if (val instanceof MIConst) {
try {
- fNumberOfCollectedFrames = Integer.parseInt(((MIConst)val).getString().trim());
- } catch (NumberFormatException e) {}
+ fNumberOfCollectedFrames = Integer.parseInt(((MIConst) val).getString().trim());
+ } catch (NumberFormatException e) {
+ }
}
} else if (var.equals("frames-created")) { //$NON-NLS-1$
MIValue val = results[i].getMIValue();
if (val instanceof MIConst) {
try {
- fNumberOfCreatedFrames = Integer.parseInt(((MIConst)val).getString().trim());
- } catch (NumberFormatException e) {}
+ fNumberOfCreatedFrames = Integer.parseInt(((MIConst) val).getString().trim());
+ } catch (NumberFormatException e) {
+ }
}
} else if (var.equals("buffer-size")) { //$NON-NLS-1$
MIValue val = results[i].getMIValue();
if (val instanceof MIConst) {
try {
- fTotalBufferSize = Integer.parseInt(((MIConst)val).getString().trim());
- } catch (NumberFormatException e) {}
+ fTotalBufferSize = Integer.parseInt(((MIConst) val).getString().trim());
+ } catch (NumberFormatException e) {
+ }
}
} else if (var.equals("buffer-free")) { //$NON-NLS-1$
MIValue val = results[i].getMIValue();
if (val instanceof MIConst) {
try {
- fFreeBufferSize = Integer.parseInt(((MIConst)val).getString().trim());
- } catch (NumberFormatException e) {}
+ fFreeBufferSize = Integer.parseInt(((MIConst) val).getString().trim());
+ } catch (NumberFormatException e) {
+ }
}
} else if (var.equals("disconnected")) { //$NON-NLS-1$
MIValue val = results[i].getMIValue();
if (val instanceof MIConst) {
- fIsDisconnectedTracingEnabled = ((MIConst)val).getString().equals("0") ? false : true; //$NON-NLS-1$
+ fIsDisconnectedTracingEnabled = ((MIConst) val).getString().equals("0") ? false : true; //$NON-NLS-1$
}
} else if (var.equals("circular")) { //$NON-NLS-1$
MIValue val = results[i].getMIValue();
if (val instanceof MIConst) {
- fIsCircularBuffer = ((MIConst)val).getString().trim().equals("0") ? false : true; //$NON-NLS-1$
+ fIsCircularBuffer = ((MIConst) val).getString().trim().equals("0") ? false : true; //$NON-NLS-1$
}
} else if (var.equals("user-name")) { //$NON-NLS-1$
MIValue val = results[i].getMIValue();
if (val instanceof MIConst) {
- fUserName = ((MIConst)val).getString().trim();
+ fUserName = ((MIConst) val).getString().trim();
}
- } else if (var.equals("notes")) { //$NON-NLS-1$
+ } else if (var.equals("notes")) { //$NON-NLS-1$
MIValue val = results[i].getMIValue();
if (val instanceof MIConst) {
- fNotes = ((MIConst)val).getString();
+ fNotes = ((MIConst) val).getString();
}
- } else if (var.equals("start-time")) { //$NON-NLS-1$
+ } else if (var.equals("start-time")) { //$NON-NLS-1$
MIValue val = results[i].getMIValue();
if (val instanceof MIConst) {
- fStartTime = ((MIConst)val).getString().trim();
+ fStartTime = ((MIConst) val).getString().trim();
}
} else if (var.equals("stop-time")) { //$NON-NLS-1$
MIValue val = results[i].getMIValue();
if (val instanceof MIConst) {
- fStopTime = ((MIConst)val).getString().trim();
+ fStopTime = ((MIConst) val).getString().trim();
}
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MITraceStopInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MITraceStopInfo.java
index ebe76b77692..47be77b395a 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MITraceStopInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MITraceStopInfo.java
@@ -13,15 +13,14 @@
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command.output;
-
/**
* -trace-stop result.
- *
- * The result of this command has the same fields as -trace-status, except that the
+ *
+ * The result of this command has the same fields as -trace-status, except that the
* 'supported' and 'running' fields are not output.
- * The output is therefore a subset of the output of the -trace-status command.
+ * The output is therefore a subset of the output of the -trace-status command.
* The way MI fields are optional allows us to simply re-use the MITraceStatusInfo class
- *
+ *
* @since 3.0
*/
public class MITraceStopInfo extends MITraceStatusInfo {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MITuple.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MITuple.java
index 876e4a53e7b..148469c6cd7 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MITuple.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MITuple.java
@@ -24,69 +24,68 @@ import java.util.Map;
*/
public class MITuple extends MIValue {
- final private static MIResult[] NULL_RESULTS = new MIResult[0];
- final private static MIValue[] NULL_VALUES = new MIValue[0];
+ final private static MIResult[] NULL_RESULTS = new MIResult[0];
+ final private static MIValue[] NULL_VALUES = new MIValue[0];
- private MIResult[] results = NULL_RESULTS;
- private MIValue[] values = NULL_VALUES;
- private Map<String, MIValue> name2value;
+ private MIResult[] results = NULL_RESULTS;
+ private MIValue[] values = NULL_VALUES;
+ private Map<String, MIValue> name2value;
- public MIResult[] getMIResults() {
- return results;
- }
+ public MIResult[] getMIResults() {
+ return results;
+ }
- public void setMIResults(MIResult[] res) {
- results = res;
- name2value = null;
- }
+ public void setMIResults(MIResult[] res) {
+ results = res;
+ name2value = null;
+ }
- public MIValue[] getMIValues() {
- return values;
- }
+ public MIValue[] getMIValues() {
+ return values;
+ }
- /** Return the value of the specified field of this tuple.
- *
+ /** Return the value of the specified field of this tuple.
+ *
* @since 4.6
*/
- public MIValue getField(String name) {
- if (name2value == null) {
- name2value = new HashMap<String, MIValue>();
- for (MIResult r : results) {
- name2value.put(r.getVariable(), r.getMIValue());
- }
- }
- return name2value.get(name);
- }
+ public MIValue getField(String name) {
+ if (name2value == null) {
+ name2value = new HashMap<String, MIValue>();
+ for (MIResult r : results) {
+ name2value.put(r.getVariable(), r.getMIValue());
+ }
+ }
+ return name2value.get(name);
+ }
- public void setMIValues(MIValue[] vals) {
- values = vals;
- }
+ public void setMIValues(MIValue[] vals) {
+ values = vals;
+ }
- @Override
- public String toString() {
- return toString("{", "}"); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ @Override
+ public String toString() {
+ return toString("{", "}"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
- // Return comma-separated values, with start and end prepended and appended
- // Intentionally package private, should only be used by ourselves and
- // MIResultRecord.
- String toString(String start, String end)
- {
- StringBuilder buffer = new StringBuilder();
- buffer.append(start);
- for (int i = 0; i < results.length; i++) {
- if (i != 0) {
- buffer.append(',');
- }
- buffer.append(results[i].toString());
- }
- for (int i = 0; i < values.length; i++) {
- if (i != 0) {
- buffer.append(',');
- }
- buffer.append(values[i].toString());
- }
- buffer.append(end);
- return buffer.toString();
- }
+ // Return comma-separated values, with start and end prepended and appended
+ // Intentionally package private, should only be used by ourselves and
+ // MIResultRecord.
+ String toString(String start, String end) {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append(start);
+ for (int i = 0; i < results.length; i++) {
+ if (i != 0) {
+ buffer.append(',');
+ }
+ buffer.append(results[i].toString());
+ }
+ for (int i = 0; i < values.length; i++) {
+ if (i != 0) {
+ buffer.append(',');
+ }
+ buffer.append(values[i].toString());
+ }
+ buffer.append(end);
+ return buffer.toString();
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVar.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVar.java
index 0f8946267a3..be7ed2812de 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVar.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVar.java
@@ -17,27 +17,26 @@
package org.eclipse.cdt.dsf.mi.service.command.output;
-
/**
* GDB/MI var-list-children
* -var-list-children var2
* ^done,numchild="6",children={child={name="var2.0",exp="0",numchild="0",type="char"},child={name="var2.1",exp="1",numchild="0",type="char"},child={name="var2.2",exp="2",numchild="0",type="char"},child={name="var2.3",exp="3",numchild="0",type="char"},child={name="var2.4",exp="4",numchild="0",type="char"},child={name="var2.5",exp="5",numchild="0",type="char"}}
- *
- * -var-list-children var3
+ *
+ * -var-list-children var3
* ^done,numchild="3",displayhint="array",children=[child={name="var6.[0].[1]",exp="[1]",numchild="0",type="std::basic_string<char, std::char_traits<char>, std::allocator<char> >",thread-id="1"\
,displayhint="string",dynamic="1"},child={name="var6.[0].[2]",exp="[2]",numchild="0",type="std::basic_string<char, std::char_traits<char>, std::allocator<char> >",thread-id="1",displayhint="string",dy\
namic="1"},child={name="var6.[0].[3]",exp="[3]",numchild="0",type="std::basic_string<char, std::char_traits<char>, std::allocator<char> >",thread-id="1",displayhint="string",dynamic="1"}],has_more="0"\
*/
public class MIVar {
- MITuple raw;
+ MITuple raw;
- String name = ""; //$NON-NLS-1$
- String type = ""; //$NON-NLS-1$
- String value = ""; //$NON-NLS-1$
- String exp = ""; //$NON-NLS-1$
+ String name = ""; //$NON-NLS-1$
+ String type = ""; //$NON-NLS-1$
+ String value = ""; //$NON-NLS-1$
+ String exp = ""; //$NON-NLS-1$
private boolean isDynamic = false;
- int numchild;
+ int numchild;
private boolean hasMore = false;
private MIDisplayHint displayHint = MIDisplayHint.NONE;
@@ -45,14 +44,14 @@ public class MIVar {
* Construct from the raw MI tuple. This is the preferred constructor, since calling all others
* will require caller to reimplement all or parts of parsing.
*/
- public MIVar(MITuple tuple) {
- this.raw = tuple;
- parse(tuple);
- }
+ public MIVar(MITuple tuple) {
+ this.raw = tuple;
+ parse(tuple);
+ }
- public MIVar(String n, int num, String t) {
- this(n, false, num, false, t, MIDisplayHint.NONE);
- }
+ public MIVar(String n, int num, String t) {
+ this(n, false, num, false, t, MIDisplayHint.NONE);
+ }
/**
* @param n
@@ -64,12 +63,12 @@ public class MIVar {
* If isDynamic is true, whether there are more children
* available than just <code>num</code>.
* @param t
- *
+ *
* @since 4.0
*/
public MIVar(String n, boolean isDynamic, int num, boolean hasMore, String t) {
this(n, isDynamic, num, hasMore, t, MIDisplayHint.NONE);
- }
+ }
/**
* @param n
@@ -85,45 +84,44 @@ public class MIVar {
* @since 4.0
*/
public MIVar(String n, boolean isDynamic, int num, boolean hasMore, String t, MIDisplayHint displayHint) {
- name = n;
+ name = n;
this.isDynamic = isDynamic;
- numchild = num;
+ numchild = num;
this.hasMore = hasMore;
- type = t;
- this.displayHint = displayHint;
- }
+ type = t;
+ this.displayHint = displayHint;
+ }
- /** Return raw fields from MI.
+ /** Return raw fields from MI.
* @since 4.7
*/
- public MITuple getRawFields()
- {
- assert raw != null;
- return raw;
- }
-
- public String getVarName() {
- return name;
- }
-
- public String getType() {
- return type;
- }
-
- /**
- * @since 4.6
- */
- public String getValue() {
- return value;
- }
+ public MITuple getRawFields() {
+ assert raw != null;
+ return raw;
+ }
+
+ public String getVarName() {
+ return name;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * @since 4.6
+ */
+ public String getValue() {
+ return value;
+ }
/**
* @return Whether the value and children of this variable are provided
* by a pretty printer.
- *
+ *
* @since 4.0
*/
- public boolean isDynamic() {
+ public boolean isDynamic() {
return isDynamic;
}
@@ -131,68 +129,68 @@ public class MIVar {
* @return The number of children. If {@link #isDynamic()} returns true,
* the returned value only reflects the number of children currently
* fetched by gdb. Check {@link #hasMore()} in order to find out
- * whether the are more children.
+ * whether the are more children.
*/
- public int getNumChild() {
- return numchild;
- }
+ public int getNumChild() {
+ return numchild;
+ }
/**
* @return For dynamic varobjs ({@link #isDynamic() returns true} this
* method returns whether there are children in addition to the
* currently fetched, i.e. whether there are more children than
* {@link #getNumChild()} returns.
- *
+ *
* @since 4.0
*/
public boolean hasMore() {
return hasMore;
}
- public String getExp() {
- return exp;
- }
+ public String getExp() {
+ return exp;
+ }
/**
* @return Whether the underlying value conceptually represents a string,
* array, or map.
- *
+ *
* @since 4.0
*/
- public MIDisplayHint getDisplayHint() {
- return displayHint;
- }
-
- void parse(MITuple tuple) {
- MIResult[] results = tuple.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- MIValue value = results[i].getMIValue();
- String str = ""; //$NON-NLS-1$
- if (value != null && value instanceof MIConst) {
- str = ((MIConst)value).getString();
- }
-
- if (var.equals("numchild")) { //$NON-NLS-1$
- try {
- numchild = Integer.parseInt(str.trim());
- } catch (NumberFormatException e) {
- }
- } else if (var.equals("name")) { //$NON-NLS-1$
- name = str;
- } else if (var.equals("type")) { //$NON-NLS-1$
- type = str;
- } else if (var.equals("value")) { //$NON-NLS-1$
- this.value = str;
- } else if (var.equals("exp")) { //$NON-NLS-1$
- exp = str;
+ public MIDisplayHint getDisplayHint() {
+ return displayHint;
+ }
+
+ void parse(MITuple tuple) {
+ MIResult[] results = tuple.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ MIValue value = results[i].getMIValue();
+ String str = ""; //$NON-NLS-1$
+ if (value != null && value instanceof MIConst) {
+ str = ((MIConst) value).getString();
+ }
+
+ if (var.equals("numchild")) { //$NON-NLS-1$
+ try {
+ numchild = Integer.parseInt(str.trim());
+ } catch (NumberFormatException e) {
+ }
+ } else if (var.equals("name")) { //$NON-NLS-1$
+ name = str;
+ } else if (var.equals("type")) { //$NON-NLS-1$
+ type = str;
+ } else if (var.equals("value")) { //$NON-NLS-1$
+ this.value = str;
+ } else if (var.equals("exp")) { //$NON-NLS-1$
+ exp = str;
} else if (var.equals("dynamic") && str.trim().equals("1")) { //$NON-NLS-1$ //$NON-NLS-2$
isDynamic = true;
} else if (var.equals("has_more") && str.trim().equals("1")) { //$NON-NLS-1$ //$NON-NLS-2$
hasMore = true;
- } else if (var.equals("displayhint")) { //$NON-NLS-1$
- displayHint = new MIDisplayHint(str);
- }
- }
- }
+ } else if (var.equals("displayhint")) { //$NON-NLS-1$
+ displayHint = new MIDisplayHint(str);
+ }
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarAssignInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarAssignInfo.java
index 2c334ad7a8f..f662612ecbf 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarAssignInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarAssignInfo.java
@@ -15,34 +15,34 @@ package org.eclipse.cdt.dsf.mi.service.command.output;
/**
* GDB/MI var-assign
- *
+ *
* ^done,value="3"
*/
public class MIVarAssignInfo extends MIInfo {
- String value = ""; //$NON-NLS-1$
+ String value = ""; //$NON-NLS-1$
- public MIVarAssignInfo(MIOutput record) {
- super(record);
- if (isDone()) {
- MIOutput out = getMIOutput();
- MIResultRecord rr = out.getMIResultRecord();
- if (rr != null) {
- MIResult[] results = rr.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- if (var.equals("value")) { //$NON-NLS-1$
- MIValue val = results[i].getMIValue();
- if (val instanceof MIConst) {
- value = ((MIConst)val).getCString();
- }
- }
- }
- }
- }
- }
+ public MIVarAssignInfo(MIOutput record) {
+ super(record);
+ if (isDone()) {
+ MIOutput out = getMIOutput();
+ MIResultRecord rr = out.getMIResultRecord();
+ if (rr != null) {
+ MIResult[] results = rr.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ if (var.equals("value")) { //$NON-NLS-1$
+ MIValue val = results[i].getMIValue();
+ if (val instanceof MIConst) {
+ value = ((MIConst) val).getCString();
+ }
+ }
+ }
+ }
+ }
+ }
- public String getValue () {
- return value;
- }
+ public String getValue() {
+ return value;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarChange.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarChange.java
index f5f454795a1..2a3edccc811 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarChange.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarChange.java
@@ -15,7 +15,6 @@
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command.output;
-
/**
* GDB/MI var-update.
*/
@@ -31,7 +30,7 @@ public class MIVarChange {
private boolean hasMore = false;
private MIVar[] newChildren;
private MIDisplayHint displayHint = MIDisplayHint.NONE;
-
+
public MIVarChange(String n) {
name = n;
}
@@ -62,37 +61,37 @@ public class MIVarChange {
/**
* @return Whether the associated variable's value and children are provided
* by a pretty printer.
- *
+ *
* @since 4.0
*/
public boolean isDynamic() {
return isDynamic;
}
-
+
/**
* @return Whether the number of children changed since the last update.
- *
+ *
* @since 4.0
*/
public boolean numChildrenChanged() {
return (newNumChildren != -1);
}
-
+
/**
* Only call if {@link #numChildrenChanged()} returns true.
- *
+ *
* @return The new number of children the associated varobj now has already fetched.
- *
+ *
* @since 4.0
*/
public int getNewNumChildren() {
- assert(newNumChildren != -1);
+ assert (newNumChildren != -1);
return newNumChildren;
}
-
+
/**
* @return Whether there more children available than {@link #getNewNumChildren()}.
- *
+ *
* @since 4.0
*/
public boolean hasMore() {
@@ -101,22 +100,22 @@ public class MIVarChange {
/**
* @return The children added within the current update range.
- *
+ *
* @since 4.0
*/
public MIVar[] getNewChildren() {
return newChildren;
}
-
+
/**
* @return The new display hint
- *
+ *
* @since 4.0
*/
public MIDisplayHint getDisplayHint() {
return displayHint;
}
-
+
public void setValue(String v) {
value = v;
}
@@ -128,35 +127,35 @@ public class MIVarChange {
public void setChanged(boolean c) {
changed = c;
}
-
+
/**
* @since 4.1
*/
public void setNewType(String newType) {
this.newType = newType;
}
-
+
/**
* @since 4.0
*/
public void setDynamic(boolean isDynamic) {
this.isDynamic = isDynamic;
}
-
+
/**
* @since 4.0
*/
public void setNewNumChildren(int newNumChildren) {
this.newNumChildren = newNumChildren;
}
-
+
/**
* @since 4.0
*/
public void setHasMore(boolean hasMore) {
this.hasMore = hasMore;
}
-
+
/**
* @since 4.0
*/
@@ -166,7 +165,7 @@ public class MIVarChange {
/**
* @param hint
- *
+ *
* @since 4.0
*/
public void setDisplayHint(MIDisplayHint hint) {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarCreateInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarCreateInfo.java
index 6d02d38fb3c..e5f5b4949d9 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarCreateInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarCreateInfo.java
@@ -16,39 +16,37 @@
package org.eclipse.cdt.dsf.mi.service.command.output;
-
/**
* GDB/MI var-create.
* -var-create "-" * a
* ^done,name="var1",numchild="0",value="11",type="int"
* -var-create "-" * buf
* ^done,name="var1",numchild="6",value=[6]",type="char [6]"
- *
+ *
* Note that the value is returned in the output, as of GDB6.7
*/
public class MIVarCreateInfo extends MIInfo {
- private MIVar child;
-
- public MIVarCreateInfo(MIOutput record) {
- super(record);
- if (isDone()) {
- MIResultRecord rr = getMIOutput().getMIResultRecord();
- if (rr != null) {
- child = new MIVar(rr.getFields());
- }
- }
- }
-
- public String getType()
- {
- return child.getType();
- }
-
+ private MIVar child;
+
+ public MIVarCreateInfo(MIOutput record) {
+ super(record);
+ if (isDone()) {
+ MIResultRecord rr = getMIOutput().getMIResultRecord();
+ if (rr != null) {
+ child = new MIVar(rr.getFields());
+ }
+ }
+ }
+
+ public String getType() {
+ return child.getType();
+ }
+
/**
* @return Whether the created variable's value and children are provided
* by a pretty printer.
- *
+ *
* @since 4.0
*/
public boolean isDynamic() {
@@ -59,46 +57,43 @@ public class MIVarCreateInfo extends MIInfo {
* @return The number of children. If {@link #isDynamic()} returns true,
* the returned value only reflects the number of children currently
* fetched by gdb. Check {@link #hasMore()} in order to find out
- * whether the are more children.
+ * whether the are more children.
*/
- public int getNumChildren()
- {
- return child.getNumChild();
- }
-
+ public int getNumChildren() {
+ return child.getNumChild();
+ }
+
/**
* @return For dynamic varobjs ({@link #isDynamic() returns true} this
* method returns whether there are children in addition to the
* currently fetched, i.e. whether there are more children than
* {@link #getNumChildren()} returns.
- *
+ *
* @since 4.0
*/
public boolean hasMore() {
return child.hasMore();
}
- public String getName()
- {
- return child.getVarName();
- }
-
- public String getValue()
- {
- return child.getValue();
- }
-
+ public String getName() {
+ return child.getVarName();
+ }
+
+ public String getValue() {
+ return child.getValue();
+ }
+
/**
* @return Whether the underlying value conceptually represents a string,
* array, or map.
- *
+ *
* @since 4.0
*/
- public MIDisplayHint getDisplayHint() {
- return child.getDisplayHint();
- }
+ public MIDisplayHint getDisplayHint() {
+ return child.getDisplayHint();
+ }
- public MIVar getMIVar() {
- return child;
- }
+ public MIVar getMIVar() {
+ return child;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarDeleteInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarDeleteInfo.java
index 3b517c58be9..cc8e02c35ec 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarDeleteInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarDeleteInfo.java
@@ -20,34 +20,34 @@ package org.eclipse.cdt.dsf.mi.service.command.output;
*/
public class MIVarDeleteInfo extends MIInfo {
- int ndeleted;
+ int ndeleted;
- public MIVarDeleteInfo(MIOutput record) {
- super(record);
- ndeleted=0;
- if (isDone()) {
- MIOutput out = getMIOutput();
- MIResultRecord rr = out.getMIResultRecord();
- if (rr != null) {
- MIResult[] results = rr.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- if (var.equals("ndeleted")) { //$NON-NLS-1$
- MIValue value = results[i].getMIValue();
- if (value instanceof MIConst) {
- String str = ((MIConst)value).getString();
- try {
- ndeleted = Integer.parseInt(str.trim());
- } catch (NumberFormatException e) {
- }
- }
- }
- }
- }
- }
- }
+ public MIVarDeleteInfo(MIOutput record) {
+ super(record);
+ ndeleted = 0;
+ if (isDone()) {
+ MIOutput out = getMIOutput();
+ MIResultRecord rr = out.getMIResultRecord();
+ if (rr != null) {
+ MIResult[] results = rr.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ if (var.equals("ndeleted")) { //$NON-NLS-1$
+ MIValue value = results[i].getMIValue();
+ if (value instanceof MIConst) {
+ String str = ((MIConst) value).getString();
+ try {
+ ndeleted = Integer.parseInt(str.trim());
+ } catch (NumberFormatException e) {
+ }
+ }
+ }
+ }
+ }
+ }
+ }
- public int getNumberDeleted () {
- return ndeleted;
- }
+ public int getNumberDeleted() {
+ return ndeleted;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarEvaluateExpressionInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarEvaluateExpressionInfo.java
index 973608778b2..cb8cd1f6cbd 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarEvaluateExpressionInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarEvaluateExpressionInfo.java
@@ -20,29 +20,29 @@ package org.eclipse.cdt.dsf.mi.service.command.output;
*/
public class MIVarEvaluateExpressionInfo extends MIInfo {
- String value = ""; //$NON-NLS-1$
+ String value = ""; //$NON-NLS-1$
- public MIVarEvaluateExpressionInfo(MIOutput record) {
- super(record);
- if (isDone()) {
- MIOutput out = getMIOutput();
- MIResultRecord rr = out.getMIResultRecord();
- if (rr != null) {
- MIResult[] results = rr.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- if (var.equals("value")) { //$NON-NLS-1$
- MIValue val = results[i].getMIValue();
- if (val instanceof MIConst) {
- value = ((MIConst)val).getString();
- }
- }
- }
- }
- }
- }
+ public MIVarEvaluateExpressionInfo(MIOutput record) {
+ super(record);
+ if (isDone()) {
+ MIOutput out = getMIOutput();
+ MIResultRecord rr = out.getMIResultRecord();
+ if (rr != null) {
+ MIResult[] results = rr.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ if (var.equals("value")) { //$NON-NLS-1$
+ MIValue val = results[i].getMIValue();
+ if (val instanceof MIConst) {
+ value = ((MIConst) val).getString();
+ }
+ }
+ }
+ }
+ }
+ }
- public String getValue () {
- return value;
- }
+ public String getValue() {
+ return value;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarInfoExpressionInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarInfoExpressionInfo.java
index bdba9d130b1..4305735f902 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarInfoExpressionInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarInfoExpressionInfo.java
@@ -23,30 +23,30 @@ public class MIVarInfoExpressionInfo extends MIInfo {
public MIVarInfoExpressionInfo(MIOutput record) {
super(record);
- if (isDone()) {
- MIOutput out = getMIOutput();
- MIResultRecord rr = out.getMIResultRecord();
- if (rr != null) {
- MIResult[] results = rr.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- MIValue value = results[i].getMIValue();
- String str = ""; //$NON-NLS-1$
- if (value instanceof MIConst) {
- str = ((MIConst)value).getString();
- }
+ if (isDone()) {
+ MIOutput out = getMIOutput();
+ MIResultRecord rr = out.getMIResultRecord();
+ if (rr != null) {
+ MIResult[] results = rr.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ MIValue value = results[i].getMIValue();
+ String str = ""; //$NON-NLS-1$
+ if (value instanceof MIConst) {
+ str = ((MIConst) value).getString();
+ }
- if (var.equals("lang")) { //$NON-NLS-1$
- lang = str;
- } else if (var.equals("exp")) { //$NON-NLS-1$
- exp = str;
- }
- }
- }
- }
+ if (var.equals("lang")) { //$NON-NLS-1$
+ lang = str;
+ } else if (var.equals("exp")) { //$NON-NLS-1$
+ exp = str;
+ }
+ }
+ }
+ }
}
- public String getLanguage () {
+ public String getLanguage() {
return lang;
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarInfoNumChildrenInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarInfoNumChildrenInfo.java
index a981a9cd775..ddb2cec27b6 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarInfoNumChildrenInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarInfoNumChildrenInfo.java
@@ -15,10 +15,9 @@
package org.eclipse.cdt.dsf.mi.service.command.output;
-
/**
* GDB/MI var-info-num-children.
- *
+ *
* For dynamic variable objects, only the number children currently fetched
* by gdb is returned.
*/
@@ -28,27 +27,27 @@ public class MIVarInfoNumChildrenInfo extends MIInfo {
public MIVarInfoNumChildrenInfo(MIOutput record) {
super(record);
- if (isDone()) {
- MIOutput out = getMIOutput();
- MIResultRecord rr = out.getMIResultRecord();
- if (rr != null) {
- MIResult[] results = rr.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
+ if (isDone()) {
+ MIOutput out = getMIOutput();
+ MIResultRecord rr = out.getMIResultRecord();
+ if (rr != null) {
+ MIResult[] results = rr.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
- if (var.equals("numchild")) { //$NON-NLS-1$
- MIValue value = results[i].getMIValue();
- if (value instanceof MIConst) {
- String str = ((MIConst)value).getString();
- try {
- children = Integer.parseInt(str.trim());
- } catch (NumberFormatException e) {
- }
- }
- }
- }
- }
- }
+ if (var.equals("numchild")) { //$NON-NLS-1$
+ MIValue value = results[i].getMIValue();
+ if (value instanceof MIConst) {
+ String str = ((MIConst) value).getString();
+ try {
+ children = Integer.parseInt(str.trim());
+ } catch (NumberFormatException e) {
+ }
+ }
+ }
+ }
+ }
+ }
}
public int getChildNumber() {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarInfoPathExpressionInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarInfoPathExpressionInfo.java
index 8b9b04ab220..1c6419ecc9f 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarInfoPathExpressionInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarInfoPathExpressionInfo.java
@@ -15,7 +15,7 @@ package org.eclipse.cdt.dsf.mi.service.command.output;
/**
* GDB/MI var-info-path-expression.
- *
+ *
* (gdb) -var-info-path-expression C.Base.public.m_size
* ^done,path_expr=((Base)c).m_size)
*/
@@ -23,28 +23,28 @@ public class MIVarInfoPathExpressionInfo extends MIInfo {
String exp = ""; //$NON-NLS-1$
- public MIVarInfoPathExpressionInfo(MIOutput record) {
- super(record);
- if (isDone()) {
- MIOutput out = getMIOutput();
- MIResultRecord rr = out.getMIResultRecord();
- if (rr != null) {
- MIResult[] results = rr.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- if (var.equals("path_expr")) { //$NON-NLS-1$
- MIValue val = results[i].getMIValue();
- if (val instanceof MIConst) {
- exp = ((MIConst)val).getString();
- }
- }
- }
- }
- }
- }
- public String getFullExpression () {
+ public MIVarInfoPathExpressionInfo(MIOutput record) {
+ super(record);
+ if (isDone()) {
+ MIOutput out = getMIOutput();
+ MIResultRecord rr = out.getMIResultRecord();
+ if (rr != null) {
+ MIResult[] results = rr.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ if (var.equals("path_expr")) { //$NON-NLS-1$
+ MIValue val = results[i].getMIValue();
+ if (val instanceof MIConst) {
+ exp = ((MIConst) val).getString();
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public String getFullExpression() {
return exp;
}
}
-
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarInfoTypeInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarInfoTypeInfo.java
index f77d5d2e0df..8f41cad5ee4 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarInfoTypeInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarInfoTypeInfo.java
@@ -13,7 +13,6 @@
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command.output;
-
/**
* GDB/MI var-info-type
*/
@@ -23,22 +22,22 @@ public class MIVarInfoTypeInfo extends MIInfo {
public MIVarInfoTypeInfo(MIOutput record) {
super(record);
- if (isDone()) {
- MIOutput out = getMIOutput();
- MIResultRecord rr = out.getMIResultRecord();
- if (rr != null) {
- MIResult[] results = rr.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- if (var.equals("type")) { //$NON-NLS-1$
- MIValue value = results[i].getMIValue();
- if (value instanceof MIConst) {
- type = ((MIConst)value).getString();
- }
- }
- }
- }
- }
+ if (isDone()) {
+ MIOutput out = getMIOutput();
+ MIResultRecord rr = out.getMIResultRecord();
+ if (rr != null) {
+ MIResult[] results = rr.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ if (var.equals("type")) { //$NON-NLS-1$
+ MIValue value = results[i].getMIValue();
+ if (value instanceof MIConst) {
+ type = ((MIConst) value).getString();
+ }
+ }
+ }
+ }
+ }
}
public String getType() {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarListChildrenInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarListChildrenInfo.java
index 6a78a478a38..f0417d5deca 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarListChildrenInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarListChildrenInfo.java
@@ -28,29 +28,29 @@ public class MIVarListChildrenInfo extends MIInfo {
MIVar[] children;
int numchild;
private boolean hasMore = false;
-
+
public MIVarListChildrenInfo(MIOutput record) {
super(record);
- List<MIVar> aList = new ArrayList<MIVar>();
- if (isDone()) {
- MIOutput out = getMIOutput();
- MIResultRecord rr = out.getMIResultRecord();
- if (rr != null) {
- MIResult[] results = rr.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- MIValue value = results[i].getMIValue();
+ List<MIVar> aList = new ArrayList<MIVar>();
+ if (isDone()) {
+ MIOutput out = getMIOutput();
+ MIResultRecord rr = out.getMIResultRecord();
+ if (rr != null) {
+ MIResult[] results = rr.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ MIValue value = results[i].getMIValue();
- if (var.equals("numchild")) { //$NON-NLS-1$
- if (value instanceof MIConst) {
- String str = ((MIConst)value).getString();
- try {
- numchild = Integer.parseInt(str.trim());
- } catch (NumberFormatException e) {
- }
- }
- } else if (var.equals("children")) { //$NON-NLS-1$
- parseChildren(value, aList);
+ if (var.equals("numchild")) { //$NON-NLS-1$
+ if (value instanceof MIConst) {
+ String str = ((MIConst) value).getString();
+ try {
+ numchild = Integer.parseInt(str.trim());
+ } catch (NumberFormatException e) {
+ }
+ }
+ } else if (var.equals("children")) { //$NON-NLS-1$
+ parseChildren(value, aList);
} else if (var.equals("has_more")) { //$NON-NLS-1$
if (value instanceof MIConst) {
String str = ((MIConst) value).getString();
@@ -59,10 +59,10 @@ public class MIVarListChildrenInfo extends MIInfo {
}
}
}
- }
- }
- }
- children = aList.toArray(new MIVar[aList.size()]);
+ }
+ }
+ }
+ children = aList.toArray(new MIVar[aList.size()]);
}
public MIVar[] getMIVars() {
@@ -71,13 +71,13 @@ public class MIVarListChildrenInfo extends MIInfo {
/**
* @return Whether the are more children to fetch.
- *
+ *
* @since 4.0
*/
public boolean hasMore() {
return hasMore;
}
-
+
/*
* Some gdb MacOSX do not return a MITuple so we have
* to check for different format.
@@ -86,9 +86,9 @@ public class MIVarListChildrenInfo extends MIInfo {
private void parseChildren(MIValue val, List<MIVar> aList) {
MIResult[] results = null;
if (val instanceof MITuple) {
- results = ((MITuple)val).getMIResults();
+ results = ((MITuple) val).getMIResults();
} else if (val instanceof MIList) {
- results = ((MIList)val).getMIResults();
+ results = ((MIList) val).getMIResults();
}
if (results != null) {
for (int i = 0; i < results.length; i++) {
@@ -96,7 +96,7 @@ public class MIVarListChildrenInfo extends MIInfo {
if (var.equals("child")) { //$NON-NLS-1$
MIValue value = results[i].getMIValue();
if (value instanceof MITuple) {
- aList.add(new MIVar((MITuple)value));
+ aList.add(new MIVar((MITuple) value));
}
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarSetFormatInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarSetFormatInfo.java
index d1b75fc2371..141c37715b9 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarSetFormatInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarSetFormatInfo.java
@@ -18,29 +18,29 @@ package org.eclipse.cdt.dsf.mi.service.command.output;
*/
public class MIVarSetFormatInfo extends MIInfo {
- String value = null;
+ String value = null;
- public MIVarSetFormatInfo(MIOutput record) {
- super(record);
- if (isDone()) {
- MIOutput out = getMIOutput();
- MIResultRecord rr = out.getMIResultRecord();
- if (rr != null) {
- MIResult[] results = rr.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- if (var.equals("value")) { //$NON-NLS-1$
- MIValue val = results[i].getMIValue();
- if (val instanceof MIConst) {
- value = ((MIConst)val).getCString();
- }
- }
- }
- }
- }
- }
+ public MIVarSetFormatInfo(MIOutput record) {
+ super(record);
+ if (isDone()) {
+ MIOutput out = getMIOutput();
+ MIResultRecord rr = out.getMIResultRecord();
+ if (rr != null) {
+ MIResult[] results = rr.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ if (var.equals("value")) { //$NON-NLS-1$
+ MIValue val = results[i].getMIValue();
+ if (val instanceof MIConst) {
+ value = ((MIConst) val).getCString();
+ }
+ }
+ }
+ }
+ }
+ }
- public String getValue () {
- return value;
- }
+ public String getValue() {
+ return value;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarShowAttributesInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarShowAttributesInfo.java
index db889fdc226..1c121a23b76 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarShowAttributesInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarShowAttributesInfo.java
@@ -22,25 +22,25 @@ public class MIVarShowAttributesInfo extends MIInfo {
public MIVarShowAttributesInfo(MIOutput record) {
super(record);
- if (isDone()) {
- MIOutput out = getMIOutput();
- MIResultRecord rr = out.getMIResultRecord();
- if (rr != null) {
- MIResult[] results = rr.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- if (var.equals("attr")) { //$NON-NLS-1$
- MIValue value = results[i].getMIValue();
- if (value instanceof MIConst) {
- attr = ((MIConst)value).getString();
- }
- }
- }
- }
- }
+ if (isDone()) {
+ MIOutput out = getMIOutput();
+ MIResultRecord rr = out.getMIResultRecord();
+ if (rr != null) {
+ MIResult[] results = rr.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ if (var.equals("attr")) { //$NON-NLS-1$
+ MIValue value = results[i].getMIValue();
+ if (value instanceof MIConst) {
+ attr = ((MIConst) value).getString();
+ }
+ }
+ }
+ }
+ }
}
- public String getAttributes () {
+ public String getAttributes() {
return attr;
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarShowFormatInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarShowFormatInfo.java
index beb1d3ae8e4..4b7ac908afc 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarShowFormatInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarShowFormatInfo.java
@@ -15,7 +15,6 @@ package org.eclipse.cdt.dsf.mi.service.command.output;
import org.eclipse.cdt.dsf.mi.service.MIFormat;
-
/**
* GDB/MI var-show-format
*/
@@ -25,33 +24,33 @@ public class MIVarShowFormatInfo extends MIInfo {
public MIVarShowFormatInfo(MIOutput record) {
super(record);
- if (isDone()) {
- MIOutput out = getMIOutput();
- MIResultRecord rr = out.getMIResultRecord();
- if (rr != null) {
- MIResult[] results = rr.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- if (var.equals("name")) { //$NON-NLS-1$
- MIValue value = results[i].getMIValue();
- if (value instanceof MIConst) {
- String str = ((MIConst)value).getString();
- if ("binary".equals(str)) { //$NON-NLS-1$
- format = MIFormat.BINARY;
- } else if ("decimal".equals(str)) { //$NON-NLS-1$
- format = MIFormat.DECIMAL;
- } else if ("hexadecimal".equals(str)) { //$NON-NLS-1$
- format = MIFormat.HEXADECIMAL;
- } else if ("octal".equals(str)) { //$NON-NLS-1$
- format = MIFormat.OCTAL;
- } else if ("natural".equals(str)) { //$NON-NLS-1$
- format = MIFormat.NATURAL;
- }
- }
- }
- }
- }
- }
+ if (isDone()) {
+ MIOutput out = getMIOutput();
+ MIResultRecord rr = out.getMIResultRecord();
+ if (rr != null) {
+ MIResult[] results = rr.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ if (var.equals("name")) { //$NON-NLS-1$
+ MIValue value = results[i].getMIValue();
+ if (value instanceof MIConst) {
+ String str = ((MIConst) value).getString();
+ if ("binary".equals(str)) { //$NON-NLS-1$
+ format = MIFormat.BINARY;
+ } else if ("decimal".equals(str)) { //$NON-NLS-1$
+ format = MIFormat.DECIMAL;
+ } else if ("hexadecimal".equals(str)) { //$NON-NLS-1$
+ format = MIFormat.HEXADECIMAL;
+ } else if ("octal".equals(str)) { //$NON-NLS-1$
+ format = MIFormat.OCTAL;
+ } else if ("natural".equals(str)) { //$NON-NLS-1$
+ format = MIFormat.NATURAL;
+ }
+ }
+ }
+ }
+ }
+ }
}
public int getFormat() {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarUpdateInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarUpdateInfo.java
index cb0e3aeb8e1..a24e25510c6 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarUpdateInfo.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarUpdateInfo.java
@@ -29,26 +29,26 @@ public class MIVarUpdateInfo extends MIInfo {
public MIVarUpdateInfo(MIOutput record) {
super(record);
- List<MIVarChange> aList = new ArrayList<MIVarChange>();
- if (isDone()) {
- MIOutput out = getMIOutput();
- MIResultRecord rr = out.getMIResultRecord();
- if (rr != null) {
- MIResult[] results = rr.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- if (var.equals("changelist")) { //$NON-NLS-1$
- MIValue value = results[i].getMIValue();
- if (value instanceof MITuple) {
- parseChangeList((MITuple)value, aList);
- } else if (value instanceof MIList) {
- parseChangeList((MIList)value, aList);
- }
- }
- }
- }
- }
- changeList = aList.toArray(new MIVarChange[aList.size()]);
+ List<MIVarChange> aList = new ArrayList<MIVarChange>();
+ if (isDone()) {
+ MIOutput out = getMIOutput();
+ MIResultRecord rr = out.getMIResultRecord();
+ if (rr != null) {
+ MIResult[] results = rr.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ if (var.equals("changelist")) { //$NON-NLS-1$
+ MIValue value = results[i].getMIValue();
+ if (value instanceof MITuple) {
+ parseChangeList((MITuple) value, aList);
+ } else if (value instanceof MIList) {
+ parseChangeList((MIList) value, aList);
+ }
+ }
+ }
+ }
+ }
+ changeList = aList.toArray(new MIVarChange[aList.size()]);
}
public MIVarChange[] getMIVarChanges() {
@@ -63,13 +63,13 @@ public class MIVarUpdateInfo extends MIInfo {
MIValue[] values = miList.getMIValues();
for (int i = 0; i < values.length; ++i) {
if (values[i] instanceof MITuple) {
- parseChangeList((MITuple)values[i], aList);
+ parseChangeList((MITuple) values[i], aList);
} else if (values[i] instanceof MIList) {
- parseChangeList((MIList)values[i], aList);
+ parseChangeList((MIList) values[i], aList);
}
}
- }
-
+ }
+
/**
* @since 3.0
*/
@@ -80,13 +80,11 @@ public class MIVarUpdateInfo extends MIInfo {
String var = results[i].getVariable();
MIValue value = results[i].getMIValue();
if (value instanceof MITuple) {
- parseChangeList((MITuple)value, aList);
- }
- else
- {
+ parseChangeList((MITuple) value, aList);
+ } else {
String str = ""; //$NON-NLS-1$
if (value instanceof MIConst) {
- str = ((MIConst)value).getString();
+ str = ((MIConst) value).getString();
}
if (var.equals("name")) { //$NON-NLS-1$
change = new MIVarChange(str);
@@ -131,20 +129,20 @@ public class MIVarUpdateInfo extends MIInfo {
}
} else if (var.equals("displayhint")) { //$NON-NLS-1$
if (change != null) {
- change.setDisplayHint(new MIDisplayHint(str));
+ change.setDisplayHint(new MIDisplayHint(str));
}
}
}
}
}
-
+
private void parseNewChildren(MIValue value, List<MIVar> aList) {
if (value instanceof MIList) {
- MIValue[] children = ((MIList)value).getMIValues();
-
+ MIValue[] children = ((MIList) value).getMIValues();
+
for (MIValue child : children) {
if (child instanceof MITuple) {
- aList.add(new MIVar((MITuple)child));
+ aList.add(new MIVar((MITuple) child));
}
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/GDBExamplePlugin.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/GDBExamplePlugin.java
index 6799f1f18dd..5a3a721cedb 100644
--- a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/GDBExamplePlugin.java
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/GDBExamplePlugin.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Marc Khouzam (Ericsson) - initial API and implementation
*******************************************************************************/
@@ -26,8 +26,8 @@ public class GDBExamplePlugin extends AbstractUIPlugin {
// The shared instance
private static GDBExamplePlugin plugin;
-
- private static BundleContext fgBundleContext;
+
+ private static BundleContext fgBundleContext;
/**
* The constructor
@@ -36,8 +36,8 @@ public class GDBExamplePlugin extends AbstractUIPlugin {
}
@Override
- public void start(BundleContext context) throws Exception {
- fgBundleContext = context;
+ public void start(BundleContext context) throws Exception {
+ fgBundleContext = context;
super.start(context);
plugin = this;
}
@@ -47,13 +47,12 @@ public class GDBExamplePlugin extends AbstractUIPlugin {
* @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
*/
@Override
- public void stop(BundleContext context) throws Exception {
+ public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
- fgBundleContext = null;
+ fgBundleContext = null;
}
-
/**
* Returns the shared instance
*
@@ -63,8 +62,8 @@ public class GDBExamplePlugin extends AbstractUIPlugin {
return plugin;
}
- public static BundleContext getBundleContext() {
- return fgBundleContext;
- }
+ public static BundleContext getBundleContext() {
+ return fgBundleContext;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/GdbExtendedSessionAdapters.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/GdbExtendedSessionAdapters.java
index 25899f185e3..54ab112f1e2 100644
--- a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/GdbExtendedSessionAdapters.java
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/GdbExtendedSessionAdapters.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Marc Khouzam (Ericsson) - initial API and implementation
*******************************************************************************/
@@ -27,22 +27,22 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerInputProvi
@SuppressWarnings("restriction")
public class GdbExtendedSessionAdapters extends GdbSessionAdapters {
-
+
public GdbExtendedSessionAdapters(ILaunch launch, DsfSession session, Class<?>[] launchAdapterTypes) {
super(launch, session, launchAdapterTypes);
}
-
+
@SuppressWarnings("unchecked")
@Override
protected <T> T createModelAdapter(Class<T> adapterType, ILaunch launch, DsfSession session) {
- if (ITerminateHandler.class.equals(adapterType)) {
- return (T)new DsfExtendedTerminateCommand(session);
+ if (ITerminateHandler.class.equals(adapterType)) {
+ return (T) new DsfExtendedTerminateCommand(session);
}
if (IViewerInputProvider.class.equals(adapterType)) {
- return (T)new GdbExtendedViewModelAdapter(session, getSteppingController());
+ return (T) new GdbExtendedViewModelAdapter(session, getSteppingController());
}
if (IShowVersionHandler.class.equals(adapterType)) {
- return (T)new GdbShowVersionHandler(session);
+ return (T) new GdbShowVersionHandler(session);
}
return super.createModelAdapter(adapterType, launch, session);
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/actions/DsfExtendedTerminateCommand.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/actions/DsfExtendedTerminateCommand.java
index 95c6410036f..beb4d200b8c 100644
--- a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/actions/DsfExtendedTerminateCommand.java
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/actions/DsfExtendedTerminateCommand.java
@@ -23,7 +23,7 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
/**
- * This class extends the existing "Terminate" command by adding a popup
+ * This class extends the existing "Terminate" command by adding a popup
* confirmation before terminating the session.
*/
public class DsfExtendedTerminateCommand extends DsfTerminateCommand {
@@ -44,11 +44,9 @@ public class DsfExtendedTerminateCommand extends DsfTerminateCommand {
public void run() {
Shell shell = display.getActiveShell();
if (shell != null) {
- boolean confirmed = MessageDialog.openConfirm(
- shell,
- ActionMessages.DsfExtendedTerminateCommand_Confirm_Termination,
- ActionMessages.DsfExtendedTerminateCommand_Terminate_the_session
- );
+ boolean confirmed = MessageDialog.openConfirm(shell,
+ ActionMessages.DsfExtendedTerminateCommand_Confirm_Termination,
+ ActionMessages.DsfExtendedTerminateCommand_Terminate_the_session);
if (!confirmed) {
request.cancel();
return;
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/actions/GdbShowVersionHandler.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/actions/GdbShowVersionHandler.java
index a1abf35ae1b..e2bf3467443 100644
--- a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/actions/GdbShowVersionHandler.java
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/actions/GdbShowVersionHandler.java
@@ -114,7 +114,7 @@ public class GdbShowVersionHandler implements IShowVersionHandler {
str = "======= GDB version: " + getData() + " ======="; //$NON-NLS-1$ //$NON-NLS-2$
} else {
str = "Could not obtain GDB version. Error: " + //$NON-NLS-1$
- getStatus();
+ getStatus();
}
funcService.notify(context.get(), str, new RequestMonitor(fExecutor, null) {
@Override
@@ -135,7 +135,7 @@ public class GdbShowVersionHandler implements IShowVersionHandler {
* command may be issued again while it is still running, however with
* this particular command it is very fast so that is unlikely. In
* addition for this command no harm comes if it is issued twice.
- *
+ *
* Most commands return false here because they need to be reenabled by
* some operation. For example continue would only be reenabled by the
* state change in the backend to being suspended again.
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedFinalLaunchSequence.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedFinalLaunchSequence.java
index 744fed69cc9..53f47d0bc67 100644
--- a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedFinalLaunchSequence.java
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedFinalLaunchSequence.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Marc Khouzam (Ericsson) - initial API and implementation
*******************************************************************************/
@@ -37,7 +37,8 @@ public class GdbExtendedFinalLaunchSequence extends FinalLaunchSequence_7_12 {
private IGDBControl fControl;
private DsfServicesTracker fTracker;
- public GdbExtendedFinalLaunchSequence(DsfSession session, Map<String, Object> attributes, RequestMonitorWithProgress rm) {
+ public GdbExtendedFinalLaunchSequence(DsfSession session, Map<String, Object> attributes,
+ RequestMonitorWithProgress rm) {
super(session, attributes, rm);
}
@@ -49,7 +50,8 @@ public class GdbExtendedFinalLaunchSequence extends FinalLaunchSequence_7_12 {
List<String> orderList = new ArrayList<String>(Arrays.asList(super.getExecutionOrder(GROUP_TOP_LEVEL)));
// Now insert our init step right after the initialization of the base class.
- orderList.add(orderList.indexOf("stepInitializeFinalLaunchSequence_7_7") + 1, "stepInitializeExtendedFinalLaunchSequence"); //$NON-NLS-1$ //$NON-NLS-2$
+ orderList.add(orderList.indexOf("stepInitializeFinalLaunchSequence_7_7") + 1, //$NON-NLS-1$
+ "stepInitializeExtendedFinalLaunchSequence"); //$NON-NLS-1$
// As the first operation to do, show the user the version of GDB
orderList.add(orderList.indexOf("stepInitializeExtendedFinalLaunchSequence") + 1, "stepNotifyVersion"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -57,29 +59,31 @@ public class GdbExtendedFinalLaunchSequence extends FinalLaunchSequence_7_12 {
// Add the step to set pagination before the .gdbinit file is sourced
// that way the user can override this setting using .gdbinit.
orderList.add(orderList.indexOf("stepSourceGDBInitFile"), "stepSetPagination"); //$NON-NLS-1$ //$NON-NLS-2$
-
+
return orderList.toArray(new String[orderList.size()]);
}
return null;
}
-
+
@Execute
public void stepInitializeExtendedFinalLaunchSequence(RequestMonitor rm) {
fTracker = new DsfServicesTracker(GDBExamplePlugin.getBundleContext(), getSession().getId());
fControl = fTracker.getService(IGDBControl.class);
-
- if (fControl == null) {
- rm.done(new Status(IStatus.ERROR, GDBExamplePlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR, "Cannot obtain service", null)); //$NON-NLS-1$
+
+ if (fControl == null) {
+ rm.done(new Status(IStatus.ERROR, GDBExamplePlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR,
+ "Cannot obtain service", null)); //$NON-NLS-1$
return;
}
-
+
rm.done();
}
@RollBack("stepInitializeExtendedFinalLaunchSequence")
public void rollBackInitializeExtendedFinalLaunchSequence(RequestMonitor rm) {
- if (fTracker != null) fTracker.dispose();
+ if (fTracker != null)
+ fTracker.dispose();
fTracker = null;
rm.done();
}
@@ -87,28 +91,25 @@ public class GdbExtendedFinalLaunchSequence extends FinalLaunchSequence_7_12 {
@Execute
public void stepNotifyVersion(final RequestMonitor rm) {
final IGDBExtendedFunctions funcService = fTracker.getService(IGDBExtendedFunctions.class);
- funcService.getVersion(
- fControl.getContext(),
- new ImmediateDataRequestMonitor<String>(rm) {
- @Override
- protected void handleCompleted() {
- String str;
- if (isSuccess()) {
- str = "======= GDB version: " + getData() + " ======="; //$NON-NLS-1$ //$NON-NLS-2$
- } else {
- str = "Could not obtain GDB version. Error: " + //$NON-NLS-1$
- getStatus();
- }
- funcService.notify(fControl.getContext(), str, rm);
- }
- });
+ funcService.getVersion(fControl.getContext(), new ImmediateDataRequestMonitor<String>(rm) {
+ @Override
+ protected void handleCompleted() {
+ String str;
+ if (isSuccess()) {
+ str = "======= GDB version: " + getData() + " ======="; //$NON-NLS-1$ //$NON-NLS-2$
+ } else {
+ str = "Could not obtain GDB version. Error: " + //$NON-NLS-1$
+ getStatus();
+ }
+ funcService.notify(fControl.getContext(), str, rm);
+ }
+ });
}
@Execute
public void stepSetPagination(final RequestMonitor rm) {
// Make sure pagination is always off
- fControl.queueCommand(
- fControl.getCommandFactory().createMIGDBSetPagination(fControl.getContext(), false),
+ fControl.queueCommand(fControl.getCommandFactory().createMIGDBSetPagination(fControl.getContext(), false),
new ImmediateDataRequestMonitor<MIInfo>(rm) {
@Override
protected void handleCompleted() {
@@ -120,7 +121,8 @@ public class GdbExtendedFinalLaunchSequence extends FinalLaunchSequence_7_12 {
@Execute
public void stepCleanupExtendedFinalLaunchSequence(final RequestMonitor rm) {
- if (fTracker != null) fTracker.dispose();
+ if (fTracker != null)
+ fTracker.dispose();
fTracker = null;
rm.done();
}
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedLaunch.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedLaunch.java
index 937c9ffc137..91299859d52 100644
--- a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedLaunch.java
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedLaunch.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Marc Khouzam (Ericsson) - initial API and implementation
*******************************************************************************/
@@ -19,9 +19,8 @@ import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.model.ISourceLocator;
@ThreadSafe
-public class GdbExtendedLaunch extends GdbLaunch
-{
+public class GdbExtendedLaunch extends GdbLaunch {
public GdbExtendedLaunch(ILaunchConfiguration launchConfiguration, String mode, ISourceLocator locator) {
- super(launchConfiguration, mode, locator);
- }
+ super(launchConfiguration, mode, locator);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedLaunchDelegate.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedLaunchDelegate.java
index e671963dfd6..7c4b77cb259 100644
--- a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedLaunchDelegate.java
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedLaunchDelegate.java
@@ -11,7 +11,7 @@
* Contributors:
* Marc Khouzam (Ericsson) - Initial API and implementation
*******************************************************************************/
-package org.eclipse.cdt.examples.dsf.gdb.launch;
+package org.eclipse.cdt.examples.dsf.gdb.launch;
import org.eclipse.cdt.dsf.concurrent.Sequence;
import org.eclipse.cdt.dsf.debug.service.IDsfDebugServicesFactory;
@@ -25,23 +25,24 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.model.ISourceLocator;
-
+
public class GdbExtendedLaunchDelegate extends GdbLaunchDelegate {
public GdbExtendedLaunchDelegate() {
super();
}
- @Override
- protected GdbLaunch createGdbLaunch(ILaunchConfiguration configuration, String mode, ISourceLocator locator) throws CoreException {
- return new GdbExtendedLaunch(configuration, mode, locator);
- }
+ @Override
+ protected GdbLaunch createGdbLaunch(ILaunchConfiguration configuration, String mode, ISourceLocator locator)
+ throws CoreException {
+ return new GdbExtendedLaunch(configuration, mode, locator);
+ }
- @Override
- protected Sequence getServicesSequence(DsfSession session, ILaunch launch, IProgressMonitor rm) {
- return new GdbExtendedServicesLaunchSequence(session, (GdbLaunch)launch, rm);
- }
+ @Override
+ protected Sequence getServicesSequence(DsfSession session, ILaunch launch, IProgressMonitor rm) {
+ return new GdbExtendedServicesLaunchSequence(session, (GdbLaunch) launch, rm);
+ }
- @Override
+ @Override
protected IDsfDebugServicesFactory newServiceFactory(ILaunchConfiguration config, String version) {
return new GdbExtendedDebugServicesFactory(version, config);
}
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedServicesLaunchSequence.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedServicesLaunchSequence.java
index 80da620a427..de4231deff7 100644
--- a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedServicesLaunchSequence.java
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedServicesLaunchSequence.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Marc Khouzam (Ericsson) - initial API and implementation
*******************************************************************************/
@@ -38,7 +38,8 @@ public class GdbExtendedServicesLaunchSequence extends ServicesLaunchSequence {
moreSteps[steps.length] = new Step() {
@Override
public void execute(RequestMonitor requestMonitor) {
- fLaunch.getServiceFactory().createService(IGDBExtendedFunctions.class, fLaunch.getSession()).initialize(requestMonitor);
+ fLaunch.getServiceFactory().createService(IGDBExtendedFunctions.class, fLaunch.getSession())
+ .initialize(requestMonitor);
}
};
return moreSteps;
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GDBExtendedControl.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GDBExtendedControl.java
index 9d1c7c1c397..d129d8b9292 100644
--- a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GDBExtendedControl.java
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GDBExtendedControl.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Marc Khouzam (Ericsson) - initial API and implementation
*******************************************************************************/
@@ -25,25 +25,26 @@ import org.eclipse.debug.core.ILaunchConfiguration;
/**
* Class that extends GDBControl.
- *
+ *
* Note that by extending the GDBControl_HEAD class, we will always extend
* the latest version of the GDBControl service. The downside of this is
* that we will automatically bring in the latest version of the service
* even for the older GDB version that originally used GDBExtendedControl.
* This is because of how GDBExtendedControl is instantiated in
* GdbExtendedDebugServicesFactory.
- *
+ *
* As we want to focus on the latest version of GDB, this is still the simplest
* solution to use.
*
*/
public class GDBExtendedControl extends GDBControl_HEAD {
- public GDBExtendedControl(DsfSession session, ILaunchConfiguration config, CommandFactory factory) {
- super(session, config, factory);
- }
+ public GDBExtendedControl(DsfSession session, ILaunchConfiguration config, CommandFactory factory) {
+ super(session, config, factory);
+ }
- @Override
- protected Sequence getCompleteInitializationSequence(Map<String, Object> attributes, RequestMonitorWithProgress rm) {
+ @Override
+ protected Sequence getCompleteInitializationSequence(Map<String, Object> attributes,
+ RequestMonitorWithProgress rm) {
return new GdbExtendedFinalLaunchSequence(getSession(), attributes, rm);
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GDBExtendedService.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GDBExtendedService.java
index fa66f3e7af7..6a2f070a076 100644
--- a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GDBExtendedService.java
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GDBExtendedService.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Marc Khouzam (Ericsson) - initial API and implementation
*******************************************************************************/
@@ -38,45 +38,43 @@ import org.eclipse.debug.core.IStatusHandler;
import org.osgi.framework.BundleContext;
public class GDBExtendedService extends AbstractDsfService implements IGDBExtendedFunctions {
-
+
private IMICommandControl fCommandControl;
private CommandFactory fCommandFactory;
private CommandCache fVersionCache;
-
- public GDBExtendedService(DsfSession session) {
- super(session);
- }
-
- @Override
- public void initialize(final RequestMonitor rm) {
- super.initialize(new ImmediateRequestMonitor(rm) {
- @Override
- protected void handleSuccess() {
- doInitialize(rm);
+
+ public GDBExtendedService(DsfSession session) {
+ super(session);
+ }
+
+ @Override
+ public void initialize(final RequestMonitor rm) {
+ super.initialize(new ImmediateRequestMonitor(rm) {
+ @Override
+ protected void handleSuccess() {
+ doInitialize(rm);
}
});
}
-
+
private void doInitialize(RequestMonitor rm) {
fCommandControl = getServicesTracker().getService(IMICommandControl.class);
fCommandFactory = fCommandControl.getCommandFactory();
-
+
fVersionCache = new CommandCache(getSession(), fCommandControl);
fVersionCache.setContextAvailable(fCommandControl.getContext(), true);
- register(new String[] { IGDBExtendedFunctions.class.getName() },
- new Hashtable<String, String>());
-
+ register(new String[] { IGDBExtendedFunctions.class.getName() }, new Hashtable<String, String>());
+
rm.done();
}
-
@Override
public void shutdown(RequestMonitor rm) {
unregister();
super.shutdown(rm);
}
-
+
@Override
protected BundleContext getBundleContext() {
return GDBExamplePlugin.getBundleContext();
@@ -84,18 +82,13 @@ public class GDBExtendedService extends AbstractDsfService implements IGDBExtend
@Override
public void notify(ICommandControlDMContext ctx, String str, RequestMonitor rm) {
- IStatus status = new Status(
- IStatus.INFO,
- GdbPlugin.getUniqueIdentifier(),
- IGdbDebugConstants.STATUS_HANDLER_CODE,
- str,
- null);
+ IStatus status = new Status(IStatus.INFO, GdbPlugin.getUniqueIdentifier(),
+ IGdbDebugConstants.STATUS_HANDLER_CODE, str, null);
IStatusHandler statusHandler = DebugPlugin.getDefault().getStatusHandler(status);
if (statusHandler != null) {
try {
statusHandler.handleStatus(status, null);
- }
- catch(CoreException e) {
+ } catch (CoreException e) {
GDBExamplePlugin.getDefault().getLog().log(e.getStatus());
}
}
@@ -105,20 +98,19 @@ public class GDBExtendedService extends AbstractDsfService implements IGDBExtend
@Override
public void getVersion(ICommandControlDMContext ctx, final DataRequestMonitor<String> rm) {
if (fCommandFactory instanceof GdbExtendedCommandFactory_6_8) {
- GdbExtendedCommandFactory_6_8 factory = (GdbExtendedCommandFactory_6_8)fCommandFactory;
+ GdbExtendedCommandFactory_6_8 factory = (GdbExtendedCommandFactory_6_8) fCommandFactory;
// Use the cache to avoid having to go to GDB more than once for a value
// that does not change. No need to even clear the cache since the GDB version will never change.
- fVersionCache.execute(factory.createCLIGDBVersion(ctx),
+ fVersionCache.execute(factory.createCLIGDBVersion(ctx),
new ImmediateDataRequestMonitor<MIGDBVersionInfo>(rm) {
- @Override
- protected void handleSuccess() {
- rm.done(getData().getVersion());
- }
- });
+ @Override
+ protected void handleSuccess() {
+ rm.done(getData().getVersion());
+ }
+ });
} else {
- rm.done(new Status(IStatus.ERROR, GDBExamplePlugin.PLUGIN_ID,
- NOT_SUPPORTED, "Not supported", null)); //$NON-NLS-1$
+ rm.done(new Status(IStatus.ERROR, GDBExamplePlugin.PLUGIN_ID, NOT_SUPPORTED, "Not supported", null)); //$NON-NLS-1$
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GdbExtendedDebugServicesFactory.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GdbExtendedDebugServicesFactory.java
index 5a556bb7bdf..111f09908e6 100644
--- a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GdbExtendedDebugServicesFactory.java
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GdbExtendedDebugServicesFactory.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Marc Khouzam (Ericsson) - initial API and implementation
*******************************************************************************/
@@ -25,16 +25,16 @@ import org.eclipse.cdt.examples.dsf.gdb.service.command.GdbExtendedCommandFactor
import org.eclipse.debug.core.ILaunchConfiguration;
public class GdbExtendedDebugServicesFactory extends GdbDebugServicesFactory {
-
+
public GdbExtendedDebugServicesFactory(String version, ILaunchConfiguration config) {
super(version, config);
}
-
+
@Override
- @SuppressWarnings("unchecked")
- public <V> V createService(Class<V> clazz, DsfSession session, Object ... optionalArguments) {
+ @SuppressWarnings("unchecked")
+ public <V> V createService(Class<V> clazz, DsfSession session, Object... optionalArguments) {
if (IGDBExtendedFunctions.class.isAssignableFrom(clazz)) {
- return (V)createExtendedService(session);
+ return (V) createExtendedService(session);
}
return super.createService(clazz, session, optionalArguments);
}
@@ -58,7 +58,7 @@ public class GdbExtendedDebugServicesFactory extends GdbDebugServicesFactory {
}
return new GDBControl(session, config, new CommandFactory());
}
-
+
protected IGDBExtendedFunctions createExtendedService(DsfSession session) {
return new GDBExtendedService(session);
}
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/IGDBExtendedFunctions.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/IGDBExtendedFunctions.java
index 82e086cd1a3..b062fa61dcd 100644
--- a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/IGDBExtendedFunctions.java
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/IGDBExtendedFunctions.java
@@ -18,13 +18,12 @@ import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
import org.eclipse.cdt.dsf.service.IDsfService;
-
public interface IGDBExtendedFunctions extends IDsfService {
/**
* Request a notification to the user
*/
void notify(ICommandControlDMContext ctx, String str, RequestMonitor rm);
-
+
/**
* Get the version of the debugger
*/
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/command/GdbExtendedCommandFactory_6_8.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/command/GdbExtendedCommandFactory_6_8.java
index 4c6a28176b0..14dcfb85d4d 100644
--- a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/command/GdbExtendedCommandFactory_6_8.java
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/command/GdbExtendedCommandFactory_6_8.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Marc Khouzam (Ericsson) - initial API and implementation
*******************************************************************************/
@@ -23,16 +23,14 @@ import org.eclipse.cdt.examples.dsf.gdb.service.command.commands.CLIGDBVersion;
public class GdbExtendedCommandFactory_6_8 extends CommandFactory_6_8 {
@Override
- public ICommand<MIBreakInsertInfo> createMIDPrintfInsert(
- IBreakpointsTargetDMContext ctx, boolean isTemporary,
- String condition, int ignoreCount, int tid, boolean disabled,
- String location, String printfStr) {
+ public ICommand<MIBreakInsertInfo> createMIDPrintfInsert(IBreakpointsTargetDMContext ctx, boolean isTemporary,
+ String condition, int ignoreCount, int tid, boolean disabled, String location, String printfStr) {
// Prefix all dynamic printf with the [EX] tag
printfStr = printfStr.replaceFirst("^\"", "\"[EX] "); //$NON-NLS-1$ //$NON-NLS-2$
- return super.createMIDPrintfInsert(ctx, isTemporary, condition, ignoreCount,
- tid, disabled, location, printfStr);
+ return super.createMIDPrintfInsert(ctx, isTemporary, condition, ignoreCount, tid, disabled, location,
+ printfStr);
}
-
+
public ICommand<MIGDBVersionInfo> createCLIGDBVersion(ICommandControlDMContext ctx) {
return new CLIGDBVersion(ctx);
}
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/command/commands/CLIGDBVersion.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/command/commands/CLIGDBVersion.java
index 6d97f4f1bb7..c07e65894cd 100644
--- a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/command/commands/CLIGDBVersion.java
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/command/commands/CLIGDBVersion.java
@@ -23,14 +23,14 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
* We use -interpreter-exec console "show version" instead
* of -gdb-version to avoid having the output automatically printed
* to our console.
- *
+ *
*/
public class CLIGDBVersion extends MIInterpreterExecConsole<MIGDBVersionInfo> {
private static final String COMMAND = "show version"; //$NON-NLS-1$
-
+
public CLIGDBVersion(ICommandControlDMContext ctx) {
- super(ctx, COMMAND);
- }
+ super(ctx, COMMAND);
+ }
@Override
public MIInfo getResult(MIOutput out) {
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/ui/ExtendedTab.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/ui/ExtendedTab.java
index 124dc35a8e3..5b7152cf836 100644
--- a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/ui/ExtendedTab.java
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/ui/ExtendedTab.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Marc Khouzam (Ericsson) - initial API and implementation
*******************************************************************************/
@@ -33,7 +33,7 @@ public class ExtendedTab extends CLaunchConfigurationTab {
public String getName() {
return "Extra"; //$NON-NLS-1$
}
-
+
@Override
public String getId() {
return "org.eclipse.cdt.examples.dsf.gdb.extra"; //$NON-NLS-1$
@@ -43,7 +43,7 @@ public class ExtendedTab extends CLaunchConfigurationTab {
public Image getImage() {
return DebugUITools.getImage(IInternalDebugUIConstants.IMG_OBJS_COMMON_TAB);
}
-
+
@Override
public void createControl(Composite parent) {
Composite comp = new Composite(parent, SWT.NONE);
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/ui/console/GdbExtendedConsoleMessages.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/ui/console/GdbExtendedConsoleMessages.java
index 8634686a353..43eca126155 100644
--- a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/ui/console/GdbExtendedConsoleMessages.java
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/ui/console/GdbExtendedConsoleMessages.java
@@ -16,16 +16,16 @@ import org.eclipse.osgi.util.NLS;
* @noinstantiate This class is not intended to be instantiated by clients.
*/
public class GdbExtendedConsoleMessages extends NLS {
- public static String Request_Thread_Info;
- public static String Request_Thread_Info_Tip;
- public static String Set_Special_Background;
- public static String Set_Special_Background_Tip;
-
- static {
- // initialize resource bundle
- NLS.initializeMessages(GdbExtendedConsoleMessages.class.getName(), GdbExtendedConsoleMessages.class);
- }
+ public static String Request_Thread_Info;
+ public static String Request_Thread_Info_Tip;
+ public static String Set_Special_Background;
+ public static String Set_Special_Background_Tip;
- private GdbExtendedConsoleMessages() {
- }
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(GdbExtendedConsoleMessages.class.getName(), GdbExtendedConsoleMessages.class);
+ }
+
+ private GdbExtendedConsoleMessages() {
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/ui/console/GdbExtendedConsolePageParticipant.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/ui/console/GdbExtendedConsolePageParticipant.java
index 958b20ea71f..95a23399d92 100644
--- a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/ui/console/GdbExtendedConsolePageParticipant.java
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/ui/console/GdbExtendedConsolePageParticipant.java
@@ -44,7 +44,7 @@ public class GdbExtendedConsolePageParticipant implements IConsolePageParticipan
if (fConsole instanceof GdbBasicCliConsole) {
action = new GdbExtendedSpecialBackgroundToggle(fConsole);
} else if (fPage instanceof GdbFullCliConsolePage) {
- ITerminalViewControl terminalControl = ((GdbFullCliConsolePage)fPage).getTerminalViewControl();
+ ITerminalViewControl terminalControl = ((GdbFullCliConsolePage) fPage).getTerminalViewControl();
action = new GdbExtendedInfoThreadsAction(terminalControl);
}
toolBarManager.appendToGroup(IConsoleConstants.OUTPUT_GROUP, action);
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/ui/console/GdbExtendedInfoThreadsAction.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/ui/console/GdbExtendedInfoThreadsAction.java
index 94c0326b865..c4188003fb4 100644
--- a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/ui/console/GdbExtendedInfoThreadsAction.java
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/ui/console/GdbExtendedInfoThreadsAction.java
@@ -19,6 +19,7 @@ import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
public class GdbExtendedInfoThreadsAction extends Action {
private final ITerminalViewControl fTerminalCtrl;
+
public GdbExtendedInfoThreadsAction(ITerminalViewControl terminalControl) {
fTerminalCtrl = terminalControl;
if (fTerminalCtrl == null || fTerminalCtrl.isDisposed()) {
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/ui/console/GdbExtendedSpecialBackgroundToggle.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/ui/console/GdbExtendedSpecialBackgroundToggle.java
index 47d9db06439..64a7e255e6d 100644
--- a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/ui/console/GdbExtendedSpecialBackgroundToggle.java
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/ui/console/GdbExtendedSpecialBackgroundToggle.java
@@ -27,14 +27,14 @@ public class GdbExtendedSpecialBackgroundToggle extends Action {
private static final int SPECIAL_BACKGROUND_COLOR = SWT.COLOR_DARK_GREEN;
private TextConsole fConsole;
-
+
public GdbExtendedSpecialBackgroundToggle(IConsole console) {
if (console instanceof TextConsole) {
- fConsole = (TextConsole)console;
+ fConsole = (TextConsole) console;
} else {
setEnabled(false);
}
-
+
setText(GdbExtendedConsoleMessages.Set_Special_Background);
setToolTipText(GdbExtendedConsoleMessages.Set_Special_Background_Tip);
}
@@ -45,9 +45,8 @@ public class GdbExtendedSpecialBackgroundToggle extends Action {
Color background = fConsole.getBackground();
if (background.equals(Display.getDefault().getSystemColor(SPECIAL_BACKGROUND_COLOR))) {
boolean enabled = Platform.getPreferencesService().getBoolean(GdbPlugin.PLUGIN_ID,
- IGdbDebugPreferenceConstants.PREF_CONSOLE_INVERTED_COLORS,
- false, null);
-
+ IGdbDebugPreferenceConstants.PREF_CONSOLE_INVERTED_COLORS, false, null);
+
if (enabled) {
newColor = SWT.COLOR_BLACK;
} else {
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedLaunchVMProvider.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedLaunchVMProvider.java
index 9ac6ee8134d..bc494312127 100644
--- a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedLaunchVMProvider.java
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedLaunchVMProvider.java
@@ -26,28 +26,27 @@ import org.eclipse.cdt.dsf.ui.viewmodel.IVMNode;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
@SuppressWarnings("restriction")
-public class GdbExtendedLaunchVMProvider extends LaunchVMProvider
-{
+public class GdbExtendedLaunchVMProvider extends LaunchVMProvider {
@ThreadSafe
- public GdbExtendedLaunchVMProvider(AbstractVMAdapter adapter, IPresentationContext presentationContext, DsfSession session)
- {
- super(adapter, presentationContext, session);
- }
-
+ public GdbExtendedLaunchVMProvider(AbstractVMAdapter adapter, IPresentationContext presentationContext,
+ DsfSession session) {
+ super(adapter, presentationContext, session);
+ }
+
@Override
protected void createNodes() {
- IRootVMNode launchNode = new LaunchRootVMNode(this);
- setRootNode(launchNode);
+ IRootVMNode launchNode = new LaunchRootVMNode(this);
+ setRootNode(launchNode);
+
+ // Container node to contain all processes and threads
+ IVMNode containerNode = new ContainerVMNode(this, getSession());
+ IVMNode processesNode = new GdbStandardProcessVMNode(this);
+ addChildNodes(launchNode, new IVMNode[] { containerNode, processesNode });
+
+ IVMNode threadsNode = new GdbExtendedThreadVMNode(this, getSession());
+ addChildNodes(containerNode, new IVMNode[] { threadsNode });
- // Container node to contain all processes and threads
- IVMNode containerNode = new ContainerVMNode(this, getSession());
- IVMNode processesNode = new GdbStandardProcessVMNode(this);
- addChildNodes(launchNode, new IVMNode[] { containerNode, processesNode});
-
- IVMNode threadsNode = new GdbExtendedThreadVMNode(this, getSession());
- addChildNodes(containerNode, new IVMNode[] { threadsNode });
-
- IVMNode stackFramesNode = new StackFramesVMNode(this, getSession());
- addChildNodes(threadsNode, new IVMNode[] { stackFramesNode });
- }
+ IVMNode stackFramesNode = new StackFramesVMNode(this, getSession());
+ addChildNodes(threadsNode, new IVMNode[] { stackFramesNode });
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedThreadVMNode.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedThreadVMNode.java
index 9bf62014d2e..06ef21dfedb 100644
--- a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedThreadVMNode.java
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedThreadVMNode.java
@@ -36,140 +36,153 @@ import org.eclipse.debug.ui.IDebugUIConstants;
@SuppressWarnings("restriction")
public class GdbExtendedThreadVMNode extends ThreadVMNode {
- public GdbExtendedThreadVMNode(AbstractDMVMProvider provider, DsfSession session) {
- super(provider, session);
- }
+ public GdbExtendedThreadVMNode(AbstractDMVMProvider provider, DsfSession session) {
+ super(provider, session);
+ }
- @Override
- protected IElementLabelProvider createLabelProvider() {
- PropertiesBasedLabelProvider provider = new PropertiesBasedLabelProvider();
-
- provider.setColumnInfo(
- PropertiesBasedLabelProvider.ID_COLUMN_NO_COLUMNS,
- new LabelColumnInfo(new LabelAttribute[] {
- // Text is made of the thread name followed by its state and state change reason.
- new GdbExecutionContextLabelText(
- GdbExtendedVMMessages.ThreadVMNode_No_columns__text_format,
- new String[] {
- ExecutionContextLabelText.PROP_NAME_KNOWN,
- PROP_NAME,
- ExecutionContextLabelText.PROP_ID_KNOWN,
- ILaunchVMConstants.PROP_ID,
- IGdbLaunchVMConstants.PROP_OS_ID_KNOWN,
- IGdbLaunchVMConstants.PROP_OS_ID,
- IGdbLaunchVMConstants.PROP_CORES_ID_KNOWN,
- IGdbLaunchVMConstants.PROP_CORES_ID,
- ILaunchVMConstants.PROP_IS_SUSPENDED,
- ExecutionContextLabelText.PROP_STATE_CHANGE_REASON_KNOWN,
- ILaunchVMConstants.PROP_STATE_CHANGE_REASON,
- ExecutionContextLabelText.PROP_STATE_CHANGE_DETAILS_KNOWN,
- ILaunchVMConstants.PROP_STATE_CHANGE_DETAILS}),
- new LabelText(GdbExtendedVMMessages.ThreadVMNode_No_columns__Error__label, new String[0]),
- /* RUNNING THREAD - RED PIN */
- new LabelImage(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_THREAD_RUNNING_R_PINNED)) {
- { setPropertyNames(new String[] {
- ILaunchVMConstants.PROP_IS_SUSPENDED,
- IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
- IGdbLaunchVMConstants.PROP_PIN_COLOR }); }
+ @Override
+ protected IElementLabelProvider createLabelProvider() {
+ PropertiesBasedLabelProvider provider = new PropertiesBasedLabelProvider();
- @Override
- public boolean isEnabled(IStatus status, Map<String, Object> properties) {
- Boolean prop = (Boolean) properties.get(ILaunchVMConstants.PROP_IS_SUSPENDED);
- Boolean pin_prop = (Boolean) properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
- Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
- return (prop != null && pin_prop != null && pin_color_prop != null) ?
- !prop.booleanValue() && pin_prop.booleanValue() && pin_color_prop.equals(IPinElementColorDescriptor.RED) : false;
- };
- },
- /* RUNNING THREAD - GREEN PIN */
- new LabelImage(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_THREAD_RUNNING_G_PINNED)) {
- { setPropertyNames(new String[] {
- ILaunchVMConstants.PROP_IS_SUSPENDED,
- IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
- IGdbLaunchVMConstants.PROP_PIN_COLOR }); }
+ provider.setColumnInfo(PropertiesBasedLabelProvider.ID_COLUMN_NO_COLUMNS,
+ new LabelColumnInfo(new LabelAttribute[] {
+ // Text is made of the thread name followed by its state and state change reason.
+ new GdbExecutionContextLabelText(GdbExtendedVMMessages.ThreadVMNode_No_columns__text_format,
+ new String[] { ExecutionContextLabelText.PROP_NAME_KNOWN, PROP_NAME,
+ ExecutionContextLabelText.PROP_ID_KNOWN, ILaunchVMConstants.PROP_ID,
+ IGdbLaunchVMConstants.PROP_OS_ID_KNOWN, IGdbLaunchVMConstants.PROP_OS_ID,
+ IGdbLaunchVMConstants.PROP_CORES_ID_KNOWN, IGdbLaunchVMConstants.PROP_CORES_ID,
+ ILaunchVMConstants.PROP_IS_SUSPENDED,
+ ExecutionContextLabelText.PROP_STATE_CHANGE_REASON_KNOWN,
+ ILaunchVMConstants.PROP_STATE_CHANGE_REASON,
+ ExecutionContextLabelText.PROP_STATE_CHANGE_DETAILS_KNOWN,
+ ILaunchVMConstants.PROP_STATE_CHANGE_DETAILS }),
+ new LabelText(GdbExtendedVMMessages.ThreadVMNode_No_columns__Error__label, new String[0]),
+ /* RUNNING THREAD - RED PIN */
+ new LabelImage(
+ CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_THREAD_RUNNING_R_PINNED)) {
+ {
+ setPropertyNames(new String[] { ILaunchVMConstants.PROP_IS_SUSPENDED,
+ IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
+ IGdbLaunchVMConstants.PROP_PIN_COLOR });
+ }
- @Override
- public boolean isEnabled(IStatus status, Map<String, Object> properties) {
- Boolean prop = (Boolean) properties.get(ILaunchVMConstants.PROP_IS_SUSPENDED);
- Boolean pin_prop = (Boolean) properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
- Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
- return (prop != null && pin_prop != null && pin_color_prop != null) ?
- !prop.booleanValue() && pin_prop.booleanValue() && pin_color_prop.equals(IPinElementColorDescriptor.GREEN) : false;
- };
- },
- /* RUNNING THREAD - BLUE PIN */
- new LabelImage(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_THREAD_RUNNING_B_PINNED)) {
- { setPropertyNames(new String[] {
- ILaunchVMConstants.PROP_IS_SUSPENDED,
- IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
- IGdbLaunchVMConstants.PROP_PIN_COLOR }); }
+ @Override
+ public boolean isEnabled(IStatus status, Map<String, Object> properties) {
+ Boolean prop = (Boolean) properties.get(ILaunchVMConstants.PROP_IS_SUSPENDED);
+ Boolean pin_prop = (Boolean) properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
+ Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
+ return (prop != null && pin_prop != null && pin_color_prop != null)
+ ? !prop.booleanValue() && pin_prop.booleanValue()
+ && pin_color_prop.equals(IPinElementColorDescriptor.RED)
+ : false;
+ };
+ },
+ /* RUNNING THREAD - GREEN PIN */
+ new LabelImage(
+ CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_THREAD_RUNNING_G_PINNED)) {
+ {
+ setPropertyNames(new String[] { ILaunchVMConstants.PROP_IS_SUSPENDED,
+ IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
+ IGdbLaunchVMConstants.PROP_PIN_COLOR });
+ }
- @Override
- public boolean isEnabled(IStatus status, Map<String, Object> properties) {
- Boolean prop = (Boolean) properties.get(ILaunchVMConstants.PROP_IS_SUSPENDED);
- Boolean pin_prop = (Boolean) properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
- Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
- return (prop != null && pin_prop != null && pin_color_prop != null) ?
- !prop.booleanValue() && pin_prop.booleanValue() && pin_color_prop.equals(IPinElementColorDescriptor.BLUE) : false;
- };
- },
- /* RUNNING THREAD - NO PIN */
- new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_THREAD_RUNNING)) {
- { setPropertyNames(new String[] { ILaunchVMConstants.PROP_IS_SUSPENDED }); }
-
- @Override
- public boolean isEnabled(IStatus status, java.util.Map<String,Object> properties) {
- // prop has been seen to be null during session shutdown [313823]
- Boolean prop = (Boolean)properties.get(ILaunchVMConstants.PROP_IS_SUSPENDED);
- return (prop != null) ? !prop.booleanValue() : false;
- };
- },
- /* SUSPENDED THREAD - RED PIN */
- new LabelImage(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_THREAD_SUSPENDED_R_PINNED)) {
- { setPropertyNames(new String[] {
- IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
- IGdbLaunchVMConstants.PROP_PIN_COLOR }); }
-
- @Override
- public boolean isEnabled(IStatus status, Map<String, Object> properties) {
- Boolean pin_prop = (Boolean)properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
- Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
- return (pin_prop != null && pin_color_prop != null) ?
- pin_prop.booleanValue() && pin_color_prop.equals(IPinElementColorDescriptor.RED) : false;
- };
- },
- /* SUSPENDED THREAD - GREEN PIN */
- new LabelImage(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_THREAD_SUSPENDED_G_PINNED)) {
- { setPropertyNames(new String[] {
- IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
- IGdbLaunchVMConstants.PROP_PIN_COLOR }); }
-
- @Override
- public boolean isEnabled(IStatus status, Map<String, Object> properties) {
- Boolean pin_prop = (Boolean)properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
- Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
- return (pin_prop != null && pin_color_prop != null) ?
- pin_prop.booleanValue() && pin_color_prop.equals(IPinElementColorDescriptor.GREEN) : false;
- };
- },
- /* SUSPENDED THREAD - BLUE PIN */
- new LabelImage(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_THREAD_SUSPENDED_B_PINNED)) {
- { setPropertyNames(new String[] {
- IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
- IGdbLaunchVMConstants.PROP_PIN_COLOR }); }
-
- @Override
- public boolean isEnabled(IStatus status, Map<String, Object> properties) {
- Boolean pin_prop = (Boolean)properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
- Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
- return (pin_prop != null && pin_color_prop != null) ?
- pin_prop.booleanValue() && pin_color_prop.equals(IPinElementColorDescriptor.BLUE) : false;
- };
- },
- /* SUSPENDED THREAD - NO PIN */
- new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_THREAD_SUSPENDED)),
- }));
- return provider;
- }
+ @Override
+ public boolean isEnabled(IStatus status, Map<String, Object> properties) {
+ Boolean prop = (Boolean) properties.get(ILaunchVMConstants.PROP_IS_SUSPENDED);
+ Boolean pin_prop = (Boolean) properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
+ Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
+ return (prop != null && pin_prop != null && pin_color_prop != null)
+ ? !prop.booleanValue() && pin_prop.booleanValue()
+ && pin_color_prop.equals(IPinElementColorDescriptor.GREEN)
+ : false;
+ };
+ },
+ /* RUNNING THREAD - BLUE PIN */
+ new LabelImage(
+ CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_THREAD_RUNNING_B_PINNED)) {
+ {
+ setPropertyNames(new String[] { ILaunchVMConstants.PROP_IS_SUSPENDED,
+ IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
+ IGdbLaunchVMConstants.PROP_PIN_COLOR });
+ }
+
+ @Override
+ public boolean isEnabled(IStatus status, Map<String, Object> properties) {
+ Boolean prop = (Boolean) properties.get(ILaunchVMConstants.PROP_IS_SUSPENDED);
+ Boolean pin_prop = (Boolean) properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
+ Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
+ return (prop != null && pin_prop != null && pin_color_prop != null)
+ ? !prop.booleanValue() && pin_prop.booleanValue()
+ && pin_color_prop.equals(IPinElementColorDescriptor.BLUE)
+ : false;
+ };
+ },
+ /* RUNNING THREAD - NO PIN */
+ new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_THREAD_RUNNING)) {
+ {
+ setPropertyNames(new String[] { ILaunchVMConstants.PROP_IS_SUSPENDED });
+ }
+
+ @Override
+ public boolean isEnabled(IStatus status, java.util.Map<String, Object> properties) {
+ // prop has been seen to be null during session shutdown [313823]
+ Boolean prop = (Boolean) properties.get(ILaunchVMConstants.PROP_IS_SUSPENDED);
+ return (prop != null) ? !prop.booleanValue() : false;
+ };
+ },
+ /* SUSPENDED THREAD - RED PIN */
+ new LabelImage(
+ CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_THREAD_SUSPENDED_R_PINNED)) {
+ {
+ setPropertyNames(new String[] { IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
+ IGdbLaunchVMConstants.PROP_PIN_COLOR });
+ }
+
+ @Override
+ public boolean isEnabled(IStatus status, Map<String, Object> properties) {
+ Boolean pin_prop = (Boolean) properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
+ Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
+ return (pin_prop != null && pin_color_prop != null) ? pin_prop.booleanValue()
+ && pin_color_prop.equals(IPinElementColorDescriptor.RED) : false;
+ };
+ },
+ /* SUSPENDED THREAD - GREEN PIN */
+ new LabelImage(
+ CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_THREAD_SUSPENDED_G_PINNED)) {
+ {
+ setPropertyNames(new String[] { IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
+ IGdbLaunchVMConstants.PROP_PIN_COLOR });
+ }
+
+ @Override
+ public boolean isEnabled(IStatus status, Map<String, Object> properties) {
+ Boolean pin_prop = (Boolean) properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
+ Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
+ return (pin_prop != null && pin_color_prop != null) ? pin_prop.booleanValue()
+ && pin_color_prop.equals(IPinElementColorDescriptor.GREEN) : false;
+ };
+ },
+ /* SUSPENDED THREAD - BLUE PIN */
+ new LabelImage(
+ CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_THREAD_SUSPENDED_B_PINNED)) {
+ {
+ setPropertyNames(new String[] { IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
+ IGdbLaunchVMConstants.PROP_PIN_COLOR });
+ }
+
+ @Override
+ public boolean isEnabled(IStatus status, Map<String, Object> properties) {
+ Boolean pin_prop = (Boolean) properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
+ Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
+ return (pin_prop != null && pin_color_prop != null) ? pin_prop.booleanValue()
+ && pin_color_prop.equals(IPinElementColorDescriptor.BLUE) : false;
+ };
+ },
+ /* SUSPENDED THREAD - NO PIN */
+ new LabelImage(
+ DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_THREAD_SUSPENDED)), }));
+ return provider;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedVMMessages.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedVMMessages.java
index 2a66eca1075..862b0f5483f 100644
--- a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedVMMessages.java
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedVMMessages.java
@@ -19,18 +19,18 @@ import org.eclipse.osgi.util.NLS;
* @noinstantiate This class is not intended to be instantiated by clients.
*/
public class GdbExtendedVMMessages extends NLS {
- public static String ThreadVMNode_No_columns__text_format;
- public static String ThreadVMNode_No_columns__Error__label;
- public static String ContainerVMNode_No_columns__text_format;
- public static String ContainerVMNode_No_columns__Error__label;
- /** since 2.3 */
- public static String ContainerVMNode_filtered_running_threads;
-
- static {
- // initialize resource bundle
- NLS.initializeMessages(GdbExtendedVMMessages.class.getName(), GdbExtendedVMMessages.class);
- }
+ public static String ThreadVMNode_No_columns__text_format;
+ public static String ThreadVMNode_No_columns__Error__label;
+ public static String ContainerVMNode_No_columns__text_format;
+ public static String ContainerVMNode_No_columns__Error__label;
+ /** since 2.3 */
+ public static String ContainerVMNode_filtered_running_threads;
- private GdbExtendedVMMessages() {
- }
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(GdbExtendedVMMessages.class.getName(), GdbExtendedVMMessages.class);
+ }
+
+ private GdbExtendedVMMessages() {
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedViewModelAdapter.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedViewModelAdapter.java
index 8ca5ce0daec..7674495cdcc 100644
--- a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedViewModelAdapter.java
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedViewModelAdapter.java
@@ -23,23 +23,22 @@ import org.eclipse.debug.ui.IDebugUIConstants;
@SuppressWarnings("restriction")
@ThreadSafe
-public class GdbExtendedViewModelAdapter extends GdbViewModelAdapter
-{
- public GdbExtendedViewModelAdapter(DsfSession session, SteppingController controller) {
- super(session, controller);
- }
+public class GdbExtendedViewModelAdapter extends GdbViewModelAdapter {
+ public GdbExtendedViewModelAdapter(DsfSession session, SteppingController controller) {
+ super(session, controller);
+ }
- @Override
- public void dispose() {
- super.dispose();
- }
-
- @Override
- protected IVMProvider createViewModelProvider(IPresentationContext context) {
- if (IDebugUIConstants.ID_DEBUG_VIEW.equals(context.getId())) {
- return new GdbExtendedLaunchVMProvider(this, context, getSession());
- } else {
- return super.createViewModelProvider(context);
- }
- }
+ @Override
+ public void dispose() {
+ super.dispose();
+ }
+
+ @Override
+ protected IVMProvider createViewModelProvider(IPresentationContext context) {
+ if (IDebugUIConstants.ID_DEBUG_VIEW.equals(context.getId())) {
+ return new GdbExtendedLaunchVMProvider(this, context, getSession());
+ } else {
+ return super.createViewModelProvider(context);
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/ClassAccessor.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/ClassAccessor.java
index 8cbafefa035..66bf3548f3b 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/ClassAccessor.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/ClassAccessor.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -20,30 +20,30 @@ public class ClassAccessor {
public static class MIExpressionDMCAccessor {
private MIExpressionDMC miExprDmc;
-
+
public MIExpressionDMCAccessor(IExpressionDMContext dmc) {
miExprDmc = (MIExpressionDMC) dmc;
}
- @Override
- public boolean equals(Object other) {
- return miExprDmc.equals(other);
- }
-
- @Override
- public int hashCode() {
- return miExprDmc.hashCode();
- }
-
- @Override
- public String toString() {
- return miExprDmc.toString();
- }
-
- public String getExpression() {
- return miExprDmc.getExpression();
- }
-
+ @Override
+ public boolean equals(Object other) {
+ return miExprDmc.equals(other);
+ }
+
+ @Override
+ public int hashCode() {
+ return miExprDmc.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return miExprDmc.toString();
+ }
+
+ public String getExpression() {
+ return miExprDmc.getExpression();
+ }
+
public String getRelativeExpression() {
return miExprDmc.getRelativeExpression();
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/AsyncCompletionWaitor.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/AsyncCompletionWaitor.java
index 4640ec0d2fe..8ea6c23bfe5 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/AsyncCompletionWaitor.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/AsyncCompletionWaitor.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - Initial Implementation
*******************************************************************************/
@@ -19,43 +19,43 @@ import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Status;
public class AsyncCompletionWaitor {
-
+
/*
* Indicates we will wait forever. Otherwise the time specified
* is in milliseconds.
*/
public final static int WAIT_FOREVER = 0;
-
+
/*
* Private control space.
*/
- private IStatus fStatus;
- private Object fReturnInfo;
- private boolean fWaitFinished;
- private int fNumWaiting;
-
+ private IStatus fStatus;
+ private Object fReturnInfo;
+ private boolean fWaitFinished;
+ private int fNumWaiting;
+
/*
* Main constructor.
*/
public AsyncCompletionWaitor() {
- waitReset();
+ waitReset();
}
/**
* A timeout of WAIT_FOREVER indicates we wait until the operation is
* completed by a call to waitFinished. Or if we are interrupted with an
* exception.
- *
+ *
* @param timeout the maximum time to wait in milliseconds
- *
+ *
* @throws InterruptedException
*/
public synchronized void waitUntilDone(int timeout) throws InterruptedException {
- if (fWaitFinished) return;
+ if (fWaitFinished)
+ return;
wait(timeout);
}
-
/**
* Indicates that we are done with the operation and the code
@@ -68,19 +68,18 @@ public class AsyncCompletionWaitor {
public synchronized void waitFinished(IStatus status) {
if (fWaitFinished) {
- ((MultiStatus)fStatus).merge(
- new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "waitFinished called too many times!", null));
+ ((MultiStatus) fStatus).merge(
+ new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID, "waitFinished called too many times!", null));
}
-
- ((MultiStatus)fStatus).merge(status);
+
+ ((MultiStatus) fStatus).merge(status);
if (fNumWaiting == 0 || --fNumWaiting == 0) {
fWaitFinished = true;
notifyAll();
}
}
-
+
/**
* Resets the state so we allow ourselves to be reused instead
* of having to create a new wait object each time.
@@ -91,46 +90,45 @@ public class AsyncCompletionWaitor {
fReturnInfo = null;
fNumWaiting = 0;
}
-
+
public synchronized boolean isOK() {
- if ( fStatus == null ) {
+ if (fStatus == null) {
// We timed out
return false;
}
-
+
return fStatus.isOK();
}
-
+
public synchronized String getMessage() {
- if ( fStatus == null ) {
- return "Timed out"; //$NON-NLS-1$
+ if (fStatus == null) {
+ return "Timed out"; //$NON-NLS-1$
}
-
+
// Build a concatenation of all messages
String fullMessage = "";
IStatus[] children = fStatus.getChildren();
- for (int i=0; i<children.length; i++) {
+ for (int i = 0; i < children.length; i++) {
if (children[i].getMessage().length() > 0) {
- fullMessage += "\"" + children[i].getMessage() + "\", ";//$NON-NLS-1$//$NON-NLS-2$
+ fullMessage += "\"" + children[i].getMessage() + "\", ";//$NON-NLS-1$//$NON-NLS-2$
}
}
// Remove the trailing comma and space before returning (as long as they are there)
return fullMessage.length() <= 2 ? fullMessage : fullMessage.substring(0, fullMessage.length() - 2);
}
-
+
public synchronized void setReturnInfo(Object info) {
- fReturnInfo = info ;
+ fReturnInfo = info;
}
-
+
public synchronized Object getReturnInfo() {
return fReturnInfo;
}
-
+
public synchronized void increment() {
if (fWaitFinished) {
- ((MultiStatus)fStatus).merge(
- new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Can't increment an already finished waitor object. Waitor must be reset first.", null));
+ ((MultiStatus) fStatus).merge(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Can't increment an already finished waitor object. Waitor must be reset first.", null));
}
fNumWaiting++;
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BackgroundRunner.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BackgroundRunner.java
index e25a699c36b..f30435a707d 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BackgroundRunner.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BackgroundRunner.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - Initial Implementation
* Alvaro Sanchez-Leon (Ericsson) - Bug 437562 - Split the dsf-gdb tests to a plug-in and fragment pair
@@ -35,24 +35,25 @@ public class BackgroundRunner extends BlockJUnit4ClassRunner {
super(klass);
}
- final static QualifiedName BACKGROUND_TEST_EXECUTION_FINISHED = new QualifiedName(TestsPlugin.getDefault().getBundle().getSymbolicName(), "background_test_execution_finished"); //$NON-NLS-1$
-
+ final static QualifiedName BACKGROUND_TEST_EXECUTION_FINISHED = new QualifiedName(
+ TestsPlugin.getDefault().getBundle().getSymbolicName(), "background_test_execution_finished"); //$NON-NLS-1$
+
void invokeSuperRunImpl(RunNotifier notifier) {
super.run(notifier);
}
/*
- * This method overrides the one from TestClassRunner.
- * What we do here is start a background job which will call
+ * This method overrides the one from TestClassRunner.
+ * What we do here is start a background job which will call
* TestClassRunner.run; this enables us to release
* the main UI thread.
- *
+ *
* This has been adapted from the JUnits tests of TargetManagement
* (RSECoreTestCase and RSEWaitAndDispatchUtil)
*/
@Override
public void run(final RunNotifier notifier) {
-
+
// Start the test in a background thread
Job job = new Job("GDB/MI JUnit Test Case Execution Job") {
@Override
@@ -60,29 +61,30 @@ public class BackgroundRunner extends BlockJUnit4ClassRunner {
invokeSuperRunImpl(notifier);
monitor.done();
setProperty(BACKGROUND_TEST_EXECUTION_FINISHED, Boolean.TRUE);
-
+
// The job never fails. The test result is the real result.
return Status.OK_STATUS;
}
};
// The job is not complete yet
- job.setProperty(BACKGROUND_TEST_EXECUTION_FINISHED, Boolean.FALSE);
+ job.setProperty(BACKGROUND_TEST_EXECUTION_FINISHED, Boolean.FALSE);
// schedule the job to run immediatelly
job.schedule();
-
+
// wait till the job finishes executing
waitAndDispatch(0, new BackgroundTestExecutionJobWaiter(job));
}
-
+
public interface IInterruptCondition {
public boolean isTrue();
+
public void dispose();
}
private final static class BackgroundTestExecutionJobWaiter implements IInterruptCondition {
private final Job job;
-
+
public BackgroundTestExecutionJobWaiter(Job job) {
assert job != null;
this.job = job;
@@ -91,19 +93,19 @@ public class BackgroundRunner extends BlockJUnit4ClassRunner {
@Override
public boolean isTrue() {
// Interrupt the wait method if the job signaled that it has finished.
- return ((Boolean)job.getProperty(BACKGROUND_TEST_EXECUTION_FINISHED)).booleanValue();
+ return ((Boolean) job.getProperty(BACKGROUND_TEST_EXECUTION_FINISHED)).booleanValue();
}
-
+
@Override
- public void dispose() {
+ public void dispose() {
// nothing to do
}
}
public static boolean waitAndDispatch(long timeout, IInterruptCondition condition) {
assert timeout >= 0 && condition != null;
-
- boolean isTimedOut= false;
+
+ boolean isTimedOut = false;
if (timeout >= 0 && condition != null) {
long start = System.currentTimeMillis();
Display display = Display.findDisplay(Thread.currentThread());
@@ -112,8 +114,10 @@ public class BackgroundRunner extends BlockJUnit4ClassRunner {
// display event dispatching running.
long current = System.currentTimeMillis();
while (timeout == 0 || (current - start) < timeout) {
- if (condition.isTrue()) break;
- if (!display.readAndDispatch()) display.sleep();
+ if (condition.isTrue())
+ break;
+ if (!display.readAndDispatch())
+ display.sleep();
current = System.currentTimeMillis();
}
isTimedOut = (current - start) >= timeout && timeout > 0;
@@ -122,18 +126,23 @@ public class BackgroundRunner extends BlockJUnit4ClassRunner {
// just block the thread here
long current = System.currentTimeMillis();
while (timeout == 0 || (current - start) < timeout) {
- if (condition.isTrue()) break;
- try { Thread.sleep(50); } catch (InterruptedException e) { /* ignored on purpose */ }
+ if (condition.isTrue())
+ break;
+ try {
+ Thread.sleep(50);
+ } catch (InterruptedException e) {
+ /* ignored on purpose */ }
current = System.currentTimeMillis();
}
isTimedOut = (current - start) >= timeout && timeout > 0;
}
}
-
+
// Signal the interrupt condition that we are done here
// and it can cleanup whatever necessary.
- if (condition != null) condition.dispose();
-
+ if (condition != null)
+ condition.dispose();
+
return isTimedOut;
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseParametrizedTestCase.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseParametrizedTestCase.java
index 30c1c722ba2..5d79edeb42a 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseParametrizedTestCase.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseParametrizedTestCase.java
@@ -41,7 +41,9 @@ public abstract class BaseParametrizedTestCase extends BaseTestCase {
public static Collection<String> getVersions() {
return calculateVersions();
}
- @Parameter public String parameter;
+
+ @Parameter
+ public String parameter;
// other fields
private String gdbVersionPostfix; // this is how we want to invoke it
protected Boolean remote; // this is if we want remote tests (gdbserver) -- it is null until we have made the determination
@@ -100,9 +102,7 @@ public abstract class BaseParametrizedTestCase extends BaseTestCase {
String gdbVersion = getGdbVersion();
// cannot be that version
boolean match = LaunchUtils.compareVersions(checkVersion, gdbVersion) == 0;
- Assume.assumeTrue(
- "Skipped because gdb " + gdbVersion + " does not support this feature",
- !match);
+ Assume.assumeTrue("Skipped because gdb " + gdbVersion + " does not support this feature", !match);
}
public void assumeGdbVersionLowerThen(String checkVersion) {
@@ -134,10 +134,10 @@ public abstract class BaseParametrizedTestCase extends BaseTestCase {
if (gdbVersion == GDB_NOT_FOUND) {
return false;
}
-
+
if (checkVersion == null || checkVersion.isEmpty() || checkVersion.equals("default"))
return false;
-
+
if (checkVersion.equals(gdbVersion))
return true;
@@ -147,7 +147,7 @@ public abstract class BaseParametrizedTestCase extends BaseTestCase {
/**
* Assumption to make sure test only runs on remote test session.
- *
+ *
* This method is better than {@link #isRemoteSession()} as it can be called
* at any time and does not require launch attributes to be set-up
*/
@@ -159,7 +159,7 @@ public abstract class BaseParametrizedTestCase extends BaseTestCase {
/**
* Assumption to make sure test only runs on non-remote test session.
- *
+ *
* This method is better than {@link #isRemoteSession()} as it can be called
* at any time and does not require launch attributes to be set-up
*/
@@ -203,7 +203,7 @@ public abstract class BaseParametrizedTestCase extends BaseTestCase {
IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE);
}
}
-
+
@Override
protected void validateGdbVersion(GdbLaunch launch) throws CoreException {
{
@@ -212,15 +212,15 @@ public abstract class BaseParametrizedTestCase extends BaseTestCase {
// If the user has requested the default GDB, we accept whatever version runs.
return;
}
-
+
String actual = launch.getGDBVersion();
-
+
String[] expectedParts = expected.split("\\."); //$NON-NLS-1$
String[] actualParts = actual.split("\\."); //$NON-NLS-1$
-
+
String comparableActualString = actual;
- if (expectedParts.length == 2 // If the expected version does not care about the maintenance number
- && actualParts.length > 2) { // and the actual version has a maintenance number (and possibly more)
+ if (expectedParts.length == 2 // If the expected version does not care about the maintenance number
+ && actualParts.length > 2) { // and the actual version has a maintenance number (and possibly more)
// We should ignore the maintenance number.
// For example, if we expect 7.12, then the actual
// version we should accept can be 7.12 or 7.12.1 or 7.12.2, 7.12.50.20170214, etc.
@@ -228,9 +228,9 @@ public abstract class BaseParametrizedTestCase extends BaseTestCase {
int secondDot = actual.indexOf('.', firstDot + 1);
comparableActualString = actual.substring(0, secondDot);
}
-
- assertTrue("Unexpected GDB version. Expected " + expected + " actual " + actual,
- LaunchUtils.compareVersions(expected, comparableActualString) == 0);
+
+ assertTrue("Unexpected GDB version. Expected " + expected + " actual " + actual,
+ LaunchUtils.compareVersions(expected, comparableActualString) == 0);
}
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java
index 52cb80de48b..2ecca984887 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java
@@ -87,7 +87,7 @@ import org.junit.rules.Timeout;
*/
@SuppressWarnings("restriction")
public class BaseTestCase {
- /**
+ /**
* When used, the tests will use a GDB called 'gdb'. This uses
* whatever GDB is installed on the machine where the tests are run.
*/
@@ -103,18 +103,20 @@ public class BaseTestCase {
private final static int TEST_TIMEOUT = 5 * 60 * 1000; // 5 minutes in milliseconds
// Make the current test name available through testName.getMethodName()
- @Rule public TestName testName = new TestName();
+ @Rule
+ public TestName testName = new TestName();
// Add a timeout for each test, to make sure no test hangs
- @Rule public TestRule timeout = new Timeout(TEST_TIMEOUT, TimeUnit.MILLISECONDS);
+ @Rule
+ public TestRule timeout = new Timeout(TEST_TIMEOUT, TimeUnit.MILLISECONDS);
public static final String ATTR_DEBUG_SERVER_NAME = TestsPlugin.PLUGIN_ID + ".DEBUG_SERVER_NAME";
private static final String DEFAULT_EXEC_NAME = "GDBMIGenericTestApp.exe";
private static final String LAUNCH_CONFIGURATION_TYPE_ID = "org.eclipse.cdt.tests.dsf.gdb.TestLaunch";
- private static GdbLaunch fLaunch;
+ private static GdbLaunch fLaunch;
- // The set of attributes used for the launch of a single test.
+ // The set of attributes used for the launch of a single test.
private Map<String, Object> launchAttributes;
// The launch configuration generated from the launch attributes
@@ -139,7 +141,6 @@ public class BaseTestCase {
protected static String globalVersion;
protected static final String GDB_NOT_FOUND = "not found";
-
private HashMap<String, Integer> fTagLocations = new HashMap<>();
// Provides the possibility to override the Debug Services factory and
@@ -149,57 +150,62 @@ public class BaseTestCase {
/**
* Return the launch created when {@link #doLaunch()} was called.
*/
- public GdbLaunch getGDBLaunch() { return fLaunch; }
+ public GdbLaunch getGDBLaunch() {
+ return fLaunch;
+ }
public ILaunchConfiguration getLaunchConfiguration() {
return fLaunchConfiguration;
}
- public void setLaunchAttribute(String key, Object value) {
- launchAttributes.put(key, value);
- }
-
- public void removeLaunchAttribute(String key) {
- launchAttributes.remove(key);
- }
-
- public Object getLaunchAttribute(String key) {
- return launchAttributes.get(key);
- }
-
- public static void setGlobalLaunchAttribute(String key, Object value) {
- globalLaunchAttributes.put(key, value);
- }
-
- public static Object getGlobalLaunchAttribite(String key){
- return globalLaunchAttributes.get(key);
- }
-
- public static void removeGlobalLaunchAttribute(String key) {
- globalLaunchAttributes.remove(key);
- }
-
- public synchronized MIStoppedEvent getInitialStoppedEvent() { return fInitialStoppedEvent; }
-
- /**
- * Return whether this is a remote session.
- *
- * WARNING: This method must only be called after launch attributes are initialized.
- */
- public boolean isRemoteSession() {
+ public void setLaunchAttribute(String key, Object value) {
+ launchAttributes.put(key, value);
+ }
+
+ public void removeLaunchAttribute(String key) {
+ launchAttributes.remove(key);
+ }
+
+ public Object getLaunchAttribute(String key) {
+ return launchAttributes.get(key);
+ }
+
+ public static void setGlobalLaunchAttribute(String key, Object value) {
+ globalLaunchAttributes.put(key, value);
+ }
+
+ public static Object getGlobalLaunchAttribite(String key) {
+ return globalLaunchAttributes.get(key);
+ }
+
+ public static void removeGlobalLaunchAttribute(String key) {
+ globalLaunchAttributes.remove(key);
+ }
+
+ public synchronized MIStoppedEvent getInitialStoppedEvent() {
+ return fInitialStoppedEvent;
+ }
+
+ /**
+ * Return whether this is a remote session.
+ *
+ * WARNING: This method must only be called after launch attributes are initialized.
+ */
+ public boolean isRemoteSession() {
return launchAttributes.get(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE)
- .equals(IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE);
- }
+ .equals(IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE);
+ }
/**
* Validate that the gdb version launched is the one that was targeted.
* Will fail the test if the versions don't match.
- *
+ *
* @param launch The launch in which we can find the gdb version
*/
- protected void validateGdbVersion(GdbLaunch launch) throws Exception {};
-
- /**
+ protected void validateGdbVersion(GdbLaunch launch) throws Exception {
+ };
+
+ /**
* We listen for the target to stop at the main breakpoint. This listener is
* installed when the session is created and we uninstall ourselves when we
* get to the breakpoint state, as we have no further need to monitor events
@@ -310,7 +316,7 @@ public class BaseTestCase {
IBreakpoint[] breakpoints = manager.getBreakpoints();
manager.removeBreakpoints(breakpoints, true);
}
-
+
/**
* Make sure we are starting with a clean/known state. That means no
* existing launches.
@@ -331,7 +337,7 @@ public class BaseTestCase {
/**
* Make sure we are starting with a clean/known state. That means no
* existing launch configurations.
- *
+ *
* XXX: Bugs 512180 and 501906, limit this call to only those test that
* really need a clean state. This does not remove the race condition, but
* does improve it somewhat.
@@ -355,32 +361,32 @@ public class BaseTestCase {
}
protected void setLaunchAttributes() {
- // Clear all launch attributes before starting a new test
- launchAttributes = new HashMap<String, Object>();
+ // Clear all launch attributes before starting a new test
+ launchAttributes = new HashMap<String, Object>();
- launchAttributes.put(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EXEC_PATH + DEFAULT_EXEC_NAME);
+ launchAttributes.put(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EXEC_PATH + DEFAULT_EXEC_NAME);
launchAttributes.put(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, true);
- launchAttributes.put(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT);
+ launchAttributes.put(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL,
+ ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT);
launchAttributes.put(IGDBLaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit");
-
- launchAttributes.put(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN );
-
+ launchAttributes.put(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
+ ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
// Set these up in case we will be running Remote tests. They will be ignored if we don't
- launchAttributes.put(ATTR_DEBUG_SERVER_NAME, "gdbserver");
- launchAttributes.put(IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP, true);
- launchAttributes.put(IGDBLaunchConfigurationConstants.ATTR_HOST, "localhost");
- // Using a port of 0 here means gdbserver will allocate the port number
- launchAttributes.put(IGDBLaunchConfigurationConstants.ATTR_PORT, "0");
- launchAttributes.put(ITestConstants.LAUNCH_GDB_SERVER, true);
-
- initializeLaunchAttributes();
-
- // Set the global launch attributes
- launchAttributes.putAll(globalLaunchAttributes);
- }
+ launchAttributes.put(ATTR_DEBUG_SERVER_NAME, "gdbserver");
+ launchAttributes.put(IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP, true);
+ launchAttributes.put(IGDBLaunchConfigurationConstants.ATTR_HOST, "localhost");
+ // Using a port of 0 here means gdbserver will allocate the port number
+ launchAttributes.put(IGDBLaunchConfigurationConstants.ATTR_PORT, "0");
+ launchAttributes.put(ITestConstants.LAUNCH_GDB_SERVER, true);
+
+ initializeLaunchAttributes();
+
+ // Set the global launch attributes
+ launchAttributes.putAll(globalLaunchAttributes);
+ }
/**
* Override this method to initialize test specific launch attributes.
@@ -390,22 +396,22 @@ public class BaseTestCase {
* If it is undesired override {@link #setLaunchAttributes()} method instead
*/
protected void initializeLaunchAttributes() {
- setGdbVersion();
- }
-
- /**
- * Clear our knowledge of line tags. Must be called before
- * resolveLineTagLocations in {@link Intermittent} tests.
- * <p>
- * This is a workaround for Bug 508642. This may not seem necessary, since
- * the fTagLocations field is not static and a new instance of the test
- * class is created for each test. However, when a test marked as
- * {@link Intermittent} fails, the class instance is re-used, so the content
- * of the failed try leaks in the new try.
- */
- public void clearLineTags() {
- fTagLocations.clear();
- }
+ setGdbVersion();
+ }
+
+ /**
+ * Clear our knowledge of line tags. Must be called before
+ * resolveLineTagLocations in {@link Intermittent} tests.
+ * <p>
+ * This is a workaround for Bug 508642. This may not seem necessary, since
+ * the fTagLocations field is not static and a new instance of the test
+ * class is created for each test. However, when a test marked as
+ * {@link Intermittent} fails, the class instance is re-used, so the content
+ * of the failed try leaks in the new try.
+ */
+ public void clearLineTags() {
+ fTagLocations.clear();
+ }
/**
* Given a set of tags (strings) to find in sourceFile, populate the
@@ -416,10 +422,8 @@ public class BaseTestCase {
* @throws IOException If sourceFile is not found or can't be read.
* @throws RuntimeException If one or more tags are not found in sourceFile.
*/
- protected void resolveLineTagLocations(String sourceName,
- String... tags) throws IOException {
- try (BufferedReader reader =
- new BufferedReader(new FileReader(SOURCE_PATH + sourceName))) {
+ protected void resolveLineTagLocations(String sourceName, String... tags) throws IOException {
+ try (BufferedReader reader = new BufferedReader(new FileReader(SOURCE_PATH + sourceName))) {
Set<String> tagsToFind = new HashSet<>(Arrays.asList(tags));
String line;
@@ -427,8 +431,7 @@ public class BaseTestCase {
for (String tag : tagsToFind) {
if (line.contains(tag)) {
if (fTagLocations.containsKey(tag)) {
- throw new RuntimeException("Tag " + tag
- + " was found twice in " + sourceName);
+ throw new RuntimeException("Tag " + tag + " was found twice in " + sourceName);
}
fTagLocations.put(tag, lineNumber);
tagsToFind.remove(tag);
@@ -438,8 +441,7 @@ public class BaseTestCase {
}
/* Make sure all tags have been found */
if (!tagsToFind.isEmpty()) {
- throw new RuntimeException(
- "Tags " + tagsToFind + " were not found in " + sourceName);
+ throw new RuntimeException("Tags " + tagsToFind + " were not found in " + sourceName);
}
}
}
@@ -461,76 +463,77 @@ public class BaseTestCase {
return fTagLocations.get(tag);
}
- /**
- * Launch GDB. The launch attributes must have been set already.
- */
- protected void doLaunch() throws Exception {
- boolean remote = isRemoteSession();
+ /**
+ * Launch GDB. The launch attributes must have been set already.
+ */
+ protected void doLaunch() throws Exception {
+ boolean remote = isRemoteSession();
- if (GdbDebugOptions.DEBUG) {
- GdbDebugOptions.trace("===============================================================================================\n");
- }
+ if (GdbDebugOptions.DEBUG) {
+ GdbDebugOptions.trace(
+ "===============================================================================================\n");
+ }
- // Always print this output to help easily troubleshoot tests on Hudson
- // Don't end with a new line as we may add another printout in doInnerLaunch()
- // Also don't split the line to make it all nicely aligned
- GdbDebugOptions.trace(String.format("%s \"%s\" requesting %s%s",
- GdbPlugin.getDebugTime(), testName.getMethodName(), launchAttributes.get(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME), remote ? " with gdbserver." : ".")
- , -1);
+ // Always print this output to help easily troubleshoot tests on Hudson
+ // Don't end with a new line as we may add another printout in doInnerLaunch()
+ // Also don't split the line to make it all nicely aligned
+ GdbDebugOptions.trace(String.format("%s \"%s\" requesting %s%s", GdbPlugin.getDebugTime(),
+ testName.getMethodName(), launchAttributes.get(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME),
+ remote ? " with gdbserver." : "."), -1);
- if (GdbDebugOptions.DEBUG) {
- GdbDebugOptions.trace("\n===============================================================================================\n");
- }
+ if (GdbDebugOptions.DEBUG) {
+ GdbDebugOptions.trace(
+ "\n===============================================================================================\n");
+ }
launchGdbServer();
- ILaunchManager launchMgr = DebugPlugin.getDefault().getLaunchManager();
- String lcTypeId = getLaunchConfigurationTypeId();
- ILaunchConfigurationType lcType = launchMgr.getLaunchConfigurationType(lcTypeId);
- assert lcType != null;
-
- ILaunchConfigurationWorkingCopy lcWorkingCopy = lcType.newInstance(
- null,
- launchMgr.generateLaunchConfigurationName("Test Launch")); //$NON-NLS-1$
- assert lcWorkingCopy != null;
- lcWorkingCopy.setAttributes(launchAttributes);
-
- fLaunchConfiguration = lcWorkingCopy.doSave();
- fLaunch = doLaunchInner();
-
- validateGdbVersion(fLaunch);
-
- // If we started a gdbserver add it to the launch to make sure it is killed at the end
- if (gdbserverProc != null) {
- DebugPlugin.newProcess(fLaunch, gdbserverProc, "gdbserver");
- }
-
- // Now initialize our SyncUtility, since we have the launcher
- SyncUtil.initialize(fLaunch.getSession());
-
- }
-
- /**
- * Perform the actual launch. This is normally called by {@link #doLaunch()}, however
- * it can be called repeatedly after an initial doLaunch sets up the environment. Doing
- * so allows multiple launches on the same launch configuration to be created. When this
- * method is called directly, the returned launch is not tracked and it is up to the
- * individual test to cleanup the launch. If the launch is not cleaned up, subsequent
- * tests will fail due to checks in {@link #doBeforeTest()} that verify state is clean
- * and no launches are currently running.
- *
- * This method is blocking until the breakpoint at main in the program is reached.
- *
- * @return the new launch created
- */
+ ILaunchManager launchMgr = DebugPlugin.getDefault().getLaunchManager();
+ String lcTypeId = getLaunchConfigurationTypeId();
+ ILaunchConfigurationType lcType = launchMgr.getLaunchConfigurationType(lcTypeId);
+ assert lcType != null;
+
+ ILaunchConfigurationWorkingCopy lcWorkingCopy = lcType.newInstance(null,
+ launchMgr.generateLaunchConfigurationName("Test Launch")); //$NON-NLS-1$
+ assert lcWorkingCopy != null;
+ lcWorkingCopy.setAttributes(launchAttributes);
+
+ fLaunchConfiguration = lcWorkingCopy.doSave();
+ fLaunch = doLaunchInner();
+
+ validateGdbVersion(fLaunch);
+
+ // If we started a gdbserver add it to the launch to make sure it is killed at the end
+ if (gdbserverProc != null) {
+ DebugPlugin.newProcess(fLaunch, gdbserverProc, "gdbserver");
+ }
+
+ // Now initialize our SyncUtility, since we have the launcher
+ SyncUtil.initialize(fLaunch.getSession());
+
+ }
+
+ /**
+ * Perform the actual launch. This is normally called by {@link #doLaunch()}, however
+ * it can be called repeatedly after an initial doLaunch sets up the environment. Doing
+ * so allows multiple launches on the same launch configuration to be created. When this
+ * method is called directly, the returned launch is not tracked and it is up to the
+ * individual test to cleanup the launch. If the launch is not cleaned up, subsequent
+ * tests will fail due to checks in {@link #doBeforeTest()} that verify state is clean
+ * and no launches are currently running.
+ *
+ * This method is blocking until the breakpoint at main in the program is reached.
+ *
+ * @return the new launch created
+ */
protected GdbLaunch doLaunchInner() throws Exception {
assertNotNull("The launch configuration has not been created. Call doLaunch first.", fLaunchConfiguration);
-
- boolean postMortemLaunch = launchAttributes.get(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE)
- .equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE);
- SessionEventListener sessionEventListener = new SessionEventListener(fLaunchConfiguration);
- SessionStartedListener sessionStartedListener = new SessionStartedListener() {
+ boolean postMortemLaunch = launchAttributes.get(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE)
+ .equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE);
+
+ SessionEventListener sessionEventListener = new SessionEventListener(fLaunchConfiguration);
+ SessionStartedListener sessionStartedListener = new SessionStartedListener() {
@Override
public void sessionStarted(DsfSession session) {
sessionEventListener.setSession(session);
@@ -541,53 +544,54 @@ public class BaseTestCase {
// Launch the debug session. The session-started listener will be called
// before the launch() call returns (unless, of course, there was a
// problem launching and no session is created).
- DsfSession.addSessionStartedListener(sessionStartedListener);
- GdbLaunch launch = (GdbLaunch)fLaunchConfiguration.launch(ILaunchManager.DEBUG_MODE, new NullProgressMonitor());
- if (!GdbDebugOptions.DEBUG) {
- // Now that we have started the launch we can print the real GDB version
- // but not if DEBUG is on since we get the version anyway in that case.
- GdbDebugOptions.trace(String.format(" Launched gdb %s.\n", launch.getGDBVersion()));
- }
-
- DsfSession.removeSessionStartedListener(sessionStartedListener);
-
- try {
-
- // If we haven't hit main() yet,
- // wait for the program to hit the breakpoint at main() before
- // proceeding. All tests assume that stable initial state. Two
- // seconds is plenty; we typically get to that state in a few
- // hundred milliseconds with the tiny test programs we use.
- if (!postMortemLaunch) {
- sessionEventListener.waitUntilTargetSuspended();
- }
-
- // This should be a given if the above check passes
- if (!postMortemLaunch) {
- synchronized(this) {
- MIStoppedEvent initialStoppedEvent = sessionEventListener.getInitialStoppedEvent();
- Assert.assertNotNull(initialStoppedEvent);
+ DsfSession.addSessionStartedListener(sessionStartedListener);
+ GdbLaunch launch = (GdbLaunch) fLaunchConfiguration.launch(ILaunchManager.DEBUG_MODE,
+ new NullProgressMonitor());
+ if (!GdbDebugOptions.DEBUG) {
+ // Now that we have started the launch we can print the real GDB version
+ // but not if DEBUG is on since we get the version anyway in that case.
+ GdbDebugOptions.trace(String.format(" Launched gdb %s.\n", launch.getGDBVersion()));
+ }
+
+ DsfSession.removeSessionStartedListener(sessionStartedListener);
+
+ try {
+
+ // If we haven't hit main() yet,
+ // wait for the program to hit the breakpoint at main() before
+ // proceeding. All tests assume that stable initial state. Two
+ // seconds is plenty; we typically get to that state in a few
+ // hundred milliseconds with the tiny test programs we use.
+ if (!postMortemLaunch) {
+ sessionEventListener.waitUntilTargetSuspended();
+ }
+
+ // This should be a given if the above check passes
+ if (!postMortemLaunch) {
+ synchronized (this) {
+ MIStoppedEvent initialStoppedEvent = sessionEventListener.getInitialStoppedEvent();
+ Assert.assertNotNull(initialStoppedEvent);
if (fInitialStoppedEvent == null) {
// On the very first launch we do, save the initial stopped event
// XXX: If someone writes a test with an additional launch
// that needs this info, they should resolve this return value then
fInitialStoppedEvent = initialStoppedEvent;
}
- }
- }
-
- } catch (Exception e) {
- try {
- launch.terminate();
- assertLaunchTerminates(launch);
- } catch (Exception inner) {
- e.addSuppressed(inner);
- }
- throw e;
- }
-
+ }
+ }
+
+ } catch (Exception e) {
+ try {
+ launch.terminate();
+ assertLaunchTerminates(launch);
+ } catch (Exception inner) {
+ e.addSuppressed(inner);
+ }
+ throw e;
+ }
+
return launch;
- }
+ }
/**
* Assert that the launch terminates. Callers should have already
@@ -685,12 +689,12 @@ public class BaseTestCase {
* string that contains the major and minor version number, e.g.,
* "6.8", special constant "default" represent default gdb on the box (called as "gdb")
*/
- public static void setGdbProgramNamesLaunchAttributes(String version) {
- globalVersion = version;
- setGlobalLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, getProgramPath("gdb", version));
- setGlobalLaunchAttribute(ATTR_DEBUG_SERVER_NAME, getProgramPath("gdbserver", version));
- }
-
+ public static void setGdbProgramNamesLaunchAttributes(String version) {
+ globalVersion = version;
+ setGlobalLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, getProgramPath("gdb", version));
+ setGlobalLaunchAttribute(ATTR_DEBUG_SERVER_NAME, getProgramPath("gdbserver", version));
+ }
+
public static String getProgramPath(String main, String version) {
// See bugzilla 303811 for why we have to append ".exe" on Windows
boolean isWindows = runningOnWindows();
@@ -704,18 +708,18 @@ public class BaseTestCase {
return debugName;
}
- public static boolean supportsNonStop() {
- return !(runningOnWindows() || runningOnMac());
- }
+ public static boolean supportsNonStop() {
+ return !(runningOnWindows() || runningOnMac());
+ }
- protected void setGdbVersion() {
- // Leave empty for the base class
- }
+ protected void setGdbVersion() {
+ // Leave empty for the base class
+ }
- /**
- * This method will verify that the GDB binary is available, and if it is not, the test will
- * be ignored. This method should be called by a SuiteGdb that specifies a specific GDB version.
- */
+ /**
+ * This method will verify that the GDB binary is available, and if it is not, the test will
+ * be ignored. This method should be called by a SuiteGdb that specifies a specific GDB version.
+ */
public static void ignoreIfGDBMissing() {
String gdb = (String) globalLaunchAttributes.get(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME);
String version = getGdbVersion(gdb);
@@ -762,32 +766,33 @@ public class BaseTestCase {
}
}
- protected static boolean runningOnWindows() {
- return Platform.getOS().equals(Platform.OS_WIN32);
- }
+ protected static boolean runningOnWindows() {
+ return Platform.getOS().equals(Platform.OS_WIN32);
+ }
- protected static boolean runningOnMac() {
- return Platform.getOS().equals(Platform.OS_MACOSX);
- }
+ protected static boolean runningOnMac() {
+ return Platform.getOS().equals(Platform.OS_MACOSX);
+ }
@BeforeClass
- public static void setGlobalPreferences() {
+ public static void setGlobalPreferences() {
IEclipsePreferences node = InstanceScope.INSTANCE.getNode(DebugPlugin.getUniqueIdentifier());
// Disable status handlers
- fgStatusHandlersEnabled = Platform.getPreferencesService().getBoolean(DebugPlugin.getUniqueIdentifier(), IInternalDebugCoreConstants.PREF_ENABLE_STATUS_HANDLERS, true, null);
+ fgStatusHandlersEnabled = Platform.getPreferencesService().getBoolean(DebugPlugin.getUniqueIdentifier(),
+ IInternalDebugCoreConstants.PREF_ENABLE_STATUS_HANDLERS, true, null);
node.putBoolean(IInternalDebugCoreConstants.PREF_ENABLE_STATUS_HANDLERS, false);
- }
+ }
@AfterClass
public static void restoreGlobalPreferences() {
IEclipsePreferences node = InstanceScope.INSTANCE.getNode(DebugPlugin.getUniqueIdentifier());
node.putBoolean(IInternalDebugCoreConstants.PREF_ENABLE_STATUS_HANDLERS, fgStatusHandlersEnabled);
}
-
+
/**
* Wait until the given callable returns true, must be within timeout millis.
*/
- protected void waitUntil(String message, Callable<Boolean> callable, long millis) throws Exception {
+ protected void waitUntil(String message, Callable<Boolean> callable, long millis) throws Exception {
long endTime = System.currentTimeMillis() + millis;
while (!callable.call() && System.currentTimeMillis() < endTime) {
Thread.sleep(100);
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/MemoryByteBuffer.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/MemoryByteBuffer.java
index a03efbf1a4a..143657b0b1c 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/MemoryByteBuffer.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/MemoryByteBuffer.java
@@ -22,8 +22,7 @@ public class MemoryByteBuffer {
final private ByteBuffer fBuffer;
final private int fWordSize;
- public MemoryByteBuffer(MemoryByte[] memoryByteArr, ByteOrder bo,
- int wordSize) {
+ public MemoryByteBuffer(MemoryByte[] memoryByteArr, ByteOrder bo, int wordSize) {
assert (memoryByteArr != null);
fWordSize = wordSize;
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/OnceOnlySuite.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/OnceOnlySuite.java
index e3d8726ad98..ca2f1fd3fa1 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/OnceOnlySuite.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/OnceOnlySuite.java
@@ -19,7 +19,6 @@ import org.junit.runners.Suite;
import org.junit.runners.model.InitializationError;
import org.junit.runners.model.RunnerBuilder;
-
/**
* This custom suite runner ensures that a class runs only once, no matter how
* many times it appears in a suite. Redundant appearances are possible with
@@ -28,7 +27,7 @@ import org.junit.runners.model.RunnerBuilder;
* variation). However, in some cases, the redundant appearances are
* unintentional and unavoidable consequences of how the suites are defined and
* used. This runner caters to the latter scenario.
- *
+ *
* <p>
* Thanks to Bill Venners and David Saff for suggesting this solution on the
* junit mailing list. See <a
@@ -37,18 +36,18 @@ import org.junit.runners.model.RunnerBuilder;
*/
@SuppressWarnings("restriction")
public class OnceOnlySuite extends Suite {
- private static Set<Class<?>> alreadySeen = new HashSet<Class<?>>();
-
- public OnceOnlySuite(Class<?> testClass, final RunnerBuilder builder) throws InitializationError {
- super(testClass, new RunnerBuilder() {
- @Override
+ private static Set<Class<?>> alreadySeen = new HashSet<Class<?>>();
+
+ public OnceOnlySuite(Class<?> testClass, final RunnerBuilder builder) throws InitializationError {
+ super(testClass, new RunnerBuilder() {
+ @Override
public Runner runnerForClass(Class<?> testClass) throws Throwable {
- if (alreadySeen.contains(testClass)) {
- return new IgnoredClassRunner(testClass);
- }
- alreadySeen.add(testClass);
- return builder.runnerForClass(testClass);
- }
- });
- }
+ if (alreadySeen.contains(testClass)) {
+ return new IgnoredClassRunner(testClass);
+ }
+ alreadySeen.add(testClass);
+ return builder.runnerForClass(testClass);
+ }
+ });
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/ServiceEventWaitor.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/ServiceEventWaitor.java
index 8c8ac064ee0..f1bfeef0c02 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/ServiceEventWaitor.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/ServiceEventWaitor.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - Initial Implementation
* Marc Khouzam (Ericsson) - Add support to receive multiple events
@@ -31,10 +31,10 @@ import org.eclipse.core.runtime.Platform;
* This class provides a way to wait for an asynchronous ServerEvent
* to occur. The user of this class specifies which event is of
* interest . waitForEvent() can then be called to block until the event occurs or
- * the timeout elapses. It's important that this object be created <b>before</b>
- * executing the debugger operation that will cause the expected event to occur,
+ * the timeout elapses. It's important that this object be created <b>before</b>
+ * executing the debugger operation that will cause the expected event to occur,
* otherwise the caller stands to miss out on the event.
- *
+ *
* Note that if the event occurs after object construction but
* before waitForEvent() is called, waitForEvent() will return immediately
* since it will know the event has already occurred.
@@ -45,39 +45,40 @@ public class ServiceEventWaitor<V> {
* Indicates we will wait forever. Otherwise the time specified
* is in milliseconds.
*/
- public final static int WAIT_FOREVER = 0 ;
+ public final static int WAIT_FOREVER = 0;
/* The type of event to wait for */
private Class<V> fEventTypeClass;
private DsfSession fSession;
-
+
// Queue of events. This allows to receive multiple events and keep them.
- private List<V> fEventQueue = Collections.synchronizedList(new LinkedList<V>());
-
- /**
- * Trace option for wait metrics
- */
- private static final boolean LOG = TestsPlugin.DEBUG && Boolean.parseBoolean(Platform.getDebugOption("org.eclipse.cdt.tests.dsf.gdb/debug/waitMetrics")); //$NON-NLS-1$
+ private List<V> fEventQueue = Collections.synchronizedList(new LinkedList<V>());
+
+ /**
+ * Trace option for wait metrics
+ */
+ private static final boolean LOG = TestsPlugin.DEBUG
+ && Boolean.parseBoolean(Platform.getDebugOption("org.eclipse.cdt.tests.dsf.gdb/debug/waitMetrics")); //$NON-NLS-1$
/**
* Constructor
- *
+ *
* @param session
* the DSF session we'll wait for an event to happen on
* @param eventClass
* the event to expect
*/
- public ServiceEventWaitor(DsfSession session, Class<V> eventClass) {
+ public ServiceEventWaitor(DsfSession session, Class<V> eventClass) {
assert eventClass != null;
fSession = session;
fEventTypeClass = eventClass;
- Runnable runnable = new Runnable() {
- @Override
+ Runnable runnable = new Runnable() {
+ @Override
public void run() {
- fSession.addServiceEventListener(ServiceEventWaitor.this, null);
- }
- };
- try {
+ fSession.addServiceEventListener(ServiceEventWaitor.this, null);
+ }
+ };
+ try {
fSession.getExecutor().submit(runnable).get();
} catch (InterruptedException e) {
e.printStackTrace();
@@ -85,7 +86,7 @@ public class ServiceEventWaitor<V> {
e.printStackTrace();
}
}
-
+
@Override
protected void finalize() throws Throwable {
super.finalize();
@@ -106,7 +107,7 @@ public class ServiceEventWaitor<V> {
public synchronized List<V> waitForEvents(int period) {
long startMs = System.currentTimeMillis();
List<V> events = new ArrayList<V>();
-
+
//Timeout exception will exit the loop and return the resulting list of events
while (true) {
int timeRemaining = (int) (period - (System.currentTimeMillis() - startMs));
@@ -116,7 +117,7 @@ public class ServiceEventWaitor<V> {
sevent = waitForEvent(timeRemaining);
if (sevent != null) {
events.add(sevent);
- }
+ }
} catch (Exception e) {
break;
}
@@ -124,24 +125,23 @@ public class ServiceEventWaitor<V> {
break;
}
}
-
+
return events;
}
-
-
+
/*
* Block until 'timeout' or the expected event occurs. The expected event is
* specified at construction time.
- *
+ *
* @param timeout the maximum time to wait in milliseconds.
*/
public synchronized V waitForEvent(int timeout) throws Exception {
if (fEventTypeClass == null) {
throw new Exception("Event to wait for has not been specified!");
}
-
+
long startMs = System.currentTimeMillis();
-
+
if (fEventQueue.isEmpty()) {
wait(timeout);
if (fEventQueue.isEmpty()) {
@@ -150,10 +150,10 @@ public class ServiceEventWaitor<V> {
}
long stopMs = System.currentTimeMillis();
-
- // Turning on trace during development gives you the following
+
+ // Turning on trace during development gives you the following
// helpful analysis, which you can use to establish reasonable timeouts,
- // and detect poorly configured ones. The best way to use this it to
+ // and detect poorly configured ones. The best way to use this it to
// set breakpoints on the WARNING println calls.
if (LOG) {
final long duration = stopMs - startMs;
@@ -169,38 +169,38 @@ public class ServiceEventWaitor<V> {
System.out.println("\t" + frame);
}
if (!print && frame.toString().contains("ServiceEventWaitor.waitForEvent")) {
- // we're only interested in the call stack up to (and including) our caller
+ // we're only interested in the call stack up to (and including) our caller
print = true;
}
}
-
+
if (timeout != WAIT_FOREVER) {
if (duration == 0) {
if (timeout > 1000) {
- System.out.println("WARNING: Caller specified a timeout over a second but the operation was instantenous. The timeout is probably too loose.");
- }
- else if (timeout < 100) {
- System.out.println("WARNING: Caller specified a timeout less than 100 milliseconds. Even though the operation completed instantaneously, the timeout is probably too tight.");
+ System.out.println(
+ "WARNING: Caller specified a timeout over a second but the operation was instantenous. The timeout is probably too loose.");
+ } else if (timeout < 100) {
+ System.out.println(
+ "WARNING: Caller specified a timeout less than 100 milliseconds. Even though the operation completed instantaneously, the timeout is probably too tight.");
}
- }
- else {
- if (timeout/duration > 7.0 && timeout > 2000) {
+ } else {
+ if (timeout / duration > 7.0 && timeout > 2000) {
// don't bother for timeouts less than 2 seconds
- System.out.println("WARNING: Caller specified a timeout that was more than 7X what was necessary. The timeout is probably too loose.");
- }
- else if ((((float)(timeout - duration))/(float)duration) < 0.20) {
- System.out.println("WARNING: Caller specified a timeout that was less than 20% above actual time. The timeout is probably too tight.");
+ System.out.println(
+ "WARNING: Caller specified a timeout that was more than 7X what was necessary. The timeout is probably too loose.");
+ } else if ((((float) (timeout - duration)) / (float) duration) < 0.20) {
+ System.out.println(
+ "WARNING: Caller specified a timeout that was less than 20% above actual time. The timeout is probably too tight.");
}
}
- }
- else {
- System.out.println("WARNING: Caller requested to wait forever. It should probably specify some reasonable value.");
+ } else {
+ System.out.println(
+ "WARNING: Caller requested to wait forever. It should probably specify some reasonable value.");
}
}
-
+
V vevent = fEventQueue.remove(0);
-
return vevent;
}
@@ -208,10 +208,10 @@ public class ServiceEventWaitor<V> {
* Listen to all possible events by having the base class be the parameter.
* and then figure out if that event is the one we were waiting for.
*/
- @DsfServiceEventHandler
+ @DsfServiceEventHandler
public void eventDispatched(V event) {
if (fEventTypeClass.isAssignableFrom(event.getClass())) {
- synchronized(this) {
+ synchronized (this) {
fEventQueue.add(event);
notifyAll();
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/ServiceFactoriesManager.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/ServiceFactoriesManager.java
index e40f5b31c40..d1f3ce945fe 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/ServiceFactoriesManager.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/ServiceFactoriesManager.java
@@ -23,13 +23,13 @@ import org.eclipse.core.runtime.Status;
* This is a Debug Service Factories Manager which keeps track of the factories provided by specific test cases.
* This allow individual tests to override DSF-GDB Services which is sometimes needed to validate different
* code paths.
- *
+ *
* The test is in charge of providing a unique id for the given factory, however this class will trigger an
* exception if a duplicate id is detected.
- *
+ *
* This id can then be shared via launch attributes, since each individual test method has its
- * own launch configuration there is no possibility to override the launch attributes by other tests
- *
+ * own launch configuration there is no possibility to override the launch attributes by other tests
+ *
* Users can then retrieve/remove the registered factory via the unique factory id provided by the test
*/
public class ServiceFactoriesManager {
@@ -37,8 +37,7 @@ public class ServiceFactoriesManager {
private final Map<String, GdbDebugServicesFactory> fTestServiceFactoriesMap = new HashMap<>();
- public void addTestServicesFactory(String id, GdbDebugServicesFactory servicesFactory)
- throws CoreException {
+ public void addTestServicesFactory(String id, GdbDebugServicesFactory servicesFactory) throws CoreException {
if (fTestServiceFactoriesMap.containsKey(id)) {
throw new CoreException(new Status(IStatus.ERROR, TestsPlugin.getUniqueIdentifier(),
"A factory with this id already exists " + id));
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java
index dc0c88d2df5..1c1c7338e01 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java
@@ -121,8 +121,7 @@ public class SyncUtil {
@Override
public void run() {
- DsfServicesTracker tracker = new DsfServicesTracker(
- TestsPlugin.getBundleContext(), fSession.getId());
+ DsfServicesTracker tracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
fGdbControl = tracker.getService(IGDBControl.class);
fRunControl = tracker.getService(IMIRunControl.class);
@@ -140,13 +139,13 @@ public class SyncUtil {
}
public static MIStoppedEvent step(int numSteps, StepType stepType) throws Throwable {
- return step(numSteps,stepType, false);
+ return step(numSteps, stepType, false);
}
-
+
public static MIStoppedEvent step(int numSteps, StepType stepType, boolean reverse) throws Throwable {
- MIStoppedEvent retVal = null;
- for (int i=0; i<numSteps; i++) {
- retVal = step(stepType, reverse, DefaultTimeouts.get(ETimeout.step));
+ MIStoppedEvent retVal = null;
+ for (int i = 0; i < numSteps; i++) {
+ retVal = step(stepType, reverse, DefaultTimeouts.get(ETimeout.step));
}
return retVal;
}
@@ -156,23 +155,23 @@ public class SyncUtil {
}
public static MIStoppedEvent step(StepType stepType, boolean reverse, int massagedTimeout) throws Throwable {
- IContainerDMContext containerDmc = SyncUtil.getContainerContext();
+ IContainerDMContext containerDmc = SyncUtil.getContainerContext();
return step(containerDmc, stepType, reverse, massagedTimeout);
}
-
+
public static MIStoppedEvent step(IExecutionDMContext dmc, StepType stepType) throws Throwable {
- return step(dmc, stepType, DefaultTimeouts.get(ETimeout.step));
+ return step(dmc, stepType, DefaultTimeouts.get(ETimeout.step));
}
-
- public static MIStoppedEvent step(final IExecutionDMContext dmc, final StepType stepType, int massagedTimeout) throws Throwable {
+
+ public static MIStoppedEvent step(final IExecutionDMContext dmc, final StepType stepType, int massagedTimeout)
+ throws Throwable {
return step(dmc, stepType, false, massagedTimeout);
}
-
- public static MIStoppedEvent step(final IExecutionDMContext dmc, final StepType stepType, boolean reverse, int massagedTimeout) throws Throwable {
- final ServiceEventWaitor<MIStoppedEvent> eventWaitor =
- new ServiceEventWaitor<MIStoppedEvent>(
- fSession,
- MIStoppedEvent.class);
+
+ public static MIStoppedEvent step(final IExecutionDMContext dmc, final StepType stepType, boolean reverse,
+ int massagedTimeout) throws Throwable {
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<MIStoppedEvent>(fSession,
+ MIStoppedEvent.class);
if (!reverse) {
fRunControl.getExecutor().submit(new Runnable() {
@@ -180,7 +179,7 @@ public class SyncUtil {
public void run() {
// No need for a RequestMonitor since we will wait for the
// ServiceEvent telling us the program has been suspended again
- switch(stepType) {
+ switch (stepType) {
case STEP_INTO:
fGdbControl.queueCommand(fCommandFactory.createMIExecStep(dmc), null);
break;
@@ -188,7 +187,8 @@ public class SyncUtil {
fGdbControl.queueCommand(fCommandFactory.createMIExecNext(dmc), null);
break;
case STEP_RETURN:
- fGdbControl.queueCommand(fCommandFactory.createMIExecFinish(fStack.createFrameDMContext(dmc, 0)), null);
+ fGdbControl.queueCommand(
+ fCommandFactory.createMIExecFinish(fStack.createFrameDMContext(dmc, 0)), null);
break;
default:
fail("Unsupported step type; " + stepType.toString());
@@ -201,7 +201,7 @@ public class SyncUtil {
public void run() {
// No need for a RequestMonitor since we will wait for the
// ServiceEvent telling us the program has been suspended again
- switch(stepType) {
+ switch (stepType) {
case STEP_INTO:
fGdbControl.queueCommand(fCommandFactory.createMIExecReverseStep(dmc), null);
break;
@@ -209,13 +209,14 @@ public class SyncUtil {
fGdbControl.queueCommand(fCommandFactory.createMIExecReverseNext(dmc), null);
break;
case STEP_RETURN:
- fGdbControl.queueCommand(fCommandFactory.createMIExecUncall(fStack.createFrameDMContext(dmc, 0)), null);
+ fGdbControl.queueCommand(
+ fCommandFactory.createMIExecUncall(fStack.createFrameDMContext(dmc, 0)), null);
break;
default:
fail("Unsupported step type; " + stepType.toString());
}
}
- });
+ });
}
// Wait for the execution to suspend after the step
@@ -233,43 +234,43 @@ public class SyncUtil {
public static String addBreakpoint(String location, boolean temporary) throws Throwable {
return addBreakpoint(location, temporary, DefaultTimeouts.get(ETimeout.addBreakpoint));
}
-
+
private static String addBreakpoint(final String location, final boolean temporary, int massagedTimeout)
- throws Throwable {
+ throws Throwable {
+
+ IContainerDMContext containerDmc = SyncUtil.getContainerContext();
+ final IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(containerDmc,
+ IBreakpointsTargetDMContext.class);
- IContainerDMContext containerDmc = SyncUtil.getContainerContext();
- final IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(containerDmc, IBreakpointsTargetDMContext.class);
-
Query<MIBreakInsertInfo> query = new Query<MIBreakInsertInfo>() {
@Override
protected void execute(DataRequestMonitor<MIBreakInsertInfo> rm) {
fGdbControl.queueCommand(
- fCommandFactory.createMIBreakInsert(bpTargetDmc, temporary, false, null, 0, location, "0"),
- rm);
+ fCommandFactory.createMIBreakInsert(bpTargetDmc, temporary, false, null, 0, location, "0"), rm);
}
};
-
+
fGdbControl.getExecutor().execute(query);
MIBreakInsertInfo info = query.get(massagedTimeout, TimeUnit.MILLISECONDS);
- return info.getMIBreakpoints()[0].getNumber();
+ return info.getMIBreakpoints()[0].getNumber();
}
-
public static String[] getBreakpointList(int timeout) throws Throwable {
- IContainerDMContext containerDmc = SyncUtil.getContainerContext();
- final IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(containerDmc, IBreakpointsTargetDMContext.class);
+ IContainerDMContext containerDmc = SyncUtil.getContainerContext();
+ final IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(containerDmc,
+ IBreakpointsTargetDMContext.class);
- Query<MIBreakListInfo> query = new Query<MIBreakListInfo>() {
+ Query<MIBreakListInfo> query = new Query<MIBreakListInfo>() {
@Override
protected void execute(DataRequestMonitor<MIBreakListInfo> rm) {
fGdbControl.queueCommand(fCommandFactory.createMIBreakList(bpTargetDmc), rm);
}
};
-
+
fGdbControl.getExecutor().execute(query);
MIBreakListInfo info = query.get(TestsPlugin.massageTimeout(timeout), TimeUnit.MILLISECONDS);
MIBreakpoint[] breakpoints = info.getMIBreakpoints();
-
+
String[] result = new String[breakpoints.length];
for (int i = 0; i < breakpoints.length; i++) {
result[i] = breakpoints[i].getNumber();
@@ -277,20 +278,17 @@ public class SyncUtil {
return result;
}
- private static MIStoppedEvent resumeUntilStopped(final IExecutionDMContext dmc, int massagedTimeout) throws Throwable {
- final ServiceEventWaitor<MIStoppedEvent> eventWaitor =
- new ServiceEventWaitor<MIStoppedEvent>(
- fSession,
- MIStoppedEvent.class);
+ private static MIStoppedEvent resumeUntilStopped(final IExecutionDMContext dmc, int massagedTimeout)
+ throws Throwable {
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<MIStoppedEvent>(fSession,
+ MIStoppedEvent.class);
fRunControl.getExecutor().submit(new Runnable() {
@Override
public void run() {
// No need for a RequestMonitor since we will wait for the
// ServiceEvent telling us the program has been suspended again
- fGdbControl.queueCommand(
- fCommandFactory.createMIExecContinue(dmc),
- null);
+ fGdbControl.queueCommand(fCommandFactory.createMIExecContinue(dmc), null);
}
});
@@ -299,54 +297,49 @@ public class SyncUtil {
}
public static MIStoppedEvent resumeUntilStopped() throws Throwable {
- IContainerDMContext containerDmc = SyncUtil.getContainerContext();
- // Don't call resumeUtilStopped(int timeout) as this will duplicate the timeout massage
+ IContainerDMContext containerDmc = SyncUtil.getContainerContext();
+ // Don't call resumeUtilStopped(int timeout) as this will duplicate the timeout massage
return resumeUntilStopped(containerDmc, DefaultTimeouts.get(ETimeout.resumeUntilStopped));
}
public static MIStoppedEvent resumeUntilStopped(int timeout) throws Throwable {
- IContainerDMContext containerDmc = SyncUtil.getContainerContext();
+ IContainerDMContext containerDmc = SyncUtil.getContainerContext();
return resumeUntilStopped(containerDmc, TestsPlugin.massageTimeout(timeout));
}
public static MIRunningEvent resume(final IExecutionDMContext dmc, int massagedTimeout) throws Throwable {
- final ServiceEventWaitor<MIRunningEvent> eventWaitor =
- new ServiceEventWaitor<MIRunningEvent>(
- fSession,
- MIRunningEvent.class);
+ final ServiceEventWaitor<MIRunningEvent> eventWaitor = new ServiceEventWaitor<MIRunningEvent>(fSession,
+ MIRunningEvent.class);
fRunControl.getExecutor().submit(new Runnable() {
@Override
public void run() {
// No need for a RequestMonitor since we will wait for the
// ServiceEvent telling us the program has been resumed
- fGdbControl.queueCommand(
- fCommandFactory.createMIExecContinue(dmc),
- null);
+ fGdbControl.queueCommand(fCommandFactory.createMIExecContinue(dmc), null);
}
});
// Wait for the execution to start after the step
- return eventWaitor.waitForEvent(massagedTimeout);
+ return eventWaitor.waitForEvent(massagedTimeout);
}
- public static boolean canResume(final IExecutionDMContext execDmc) throws Throwable {
- Query<Boolean> query = new Query<Boolean>() {
+ public static boolean canResume(final IExecutionDMContext execDmc) throws Throwable {
+ Query<Boolean> query = new Query<Boolean>() {
@Override
protected void execute(final DataRequestMonitor<Boolean> rm) {
- fRunControl.canResume(execDmc,
- new ImmediateDataRequestMonitor<Boolean>(rm) {
- @Override
- protected void handleSuccess() {
- rm.done(getData());
- }
- });
+ fRunControl.canResume(execDmc, new ImmediateDataRequestMonitor<Boolean>(rm) {
+ @Override
+ protected void handleSuccess() {
+ rm.done(getData());
+ }
+ });
}
- };
+ };
- fRunControl.getExecutor().execute(query);
- boolean canResume = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
- return canResume;
+ fRunControl.getExecutor().execute(query);
+ boolean canResume = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ return canResume;
}
public static MIRunningEvent resume() throws Throwable {
@@ -354,7 +347,7 @@ public class SyncUtil {
}
public static MIRunningEvent resume(int massagedTimeout) throws Throwable {
- IContainerDMContext containerDmc = SyncUtil.getContainerContext();
+ IContainerDMContext containerDmc = SyncUtil.getContainerContext();
return resume(containerDmc, massagedTimeout);
}
@@ -363,19 +356,19 @@ public class SyncUtil {
}
public static void resumeAll(int massagedTimeout) throws Throwable {
- IMIExecutionDMContext[] threadDmcs = SyncUtil.getExecutionContexts();
- for (IMIExecutionDMContext thread : threadDmcs) {
- if (canResume(thread)) {
- resume(thread, massagedTimeout);
- }
- }
+ IMIExecutionDMContext[] threadDmcs = SyncUtil.getExecutionContexts();
+ for (IMIExecutionDMContext thread : threadDmcs) {
+ if (canResume(thread)) {
+ resume(thread, massagedTimeout);
+ }
+ }
}
public static MIStoppedEvent waitForStop() throws Throwable {
// Use a direct value to avoid double call to TestsPlugin.massageTimeout
return waitForStop(10000);
}
-
+
// This method is risky. If the command to resume/step execution
// is sent and the stopped event is received before we call this method
// here, then we will miss the stopped event.
@@ -385,30 +378,28 @@ public class SyncUtil {
// if there is a sleep in the code between the resume and the time
// it stops; this will give us plenty of time to call this method.
public static MIStoppedEvent waitForStop(int timeout) throws Throwable {
- final ServiceEventWaitor<MIStoppedEvent> eventWaitor =
- new ServiceEventWaitor<MIStoppedEvent>(
- fSession,
- MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<MIStoppedEvent>(fSession,
+ MIStoppedEvent.class);
// Wait for the execution to suspend
return eventWaitor.waitForEvent(TestsPlugin.massageTimeout(timeout));
}
-
+
public static MIStoppedEvent runToLocation(String location) throws Throwable {
return runToLocation(location, DefaultTimeouts.get(ETimeout.runToLocation));
}
-
+
public static MIStoppedEvent runToLocation(String location, int timeout) throws Throwable {
// Set a temporary breakpoint and run to it.
// Note that if there were other breakpoints set ahead of this one,
// they will stop execution earlier than planned
addBreakpoint(location, true, timeout);
- // Don't provide a timeout so we use the resume default timeout for this step
+ // Don't provide a timeout so we use the resume default timeout for this step
// if a timeout value is provided via DefaultTimeouts the value will be massaged twice
return resumeUntilStopped();
}
-
- public static IFrameDMContext getStackFrame(final IExecutionDMContext execCtx, final int level) throws Exception {
+
+ public static IFrameDMContext getStackFrame(final IExecutionDMContext execCtx, final int level) throws Exception {
Query<IFrameDMContext> query = new Query<IFrameDMContext>() {
@Override
protected void execute(final DataRequestMonitor<IFrameDMContext> rm) {
@@ -427,67 +418,66 @@ public class SyncUtil {
fSession.getExecutor().execute(query);
return query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
- }
-
- /**
+ }
+
+ /**
* Utility method to return a specific frame DM context.
*/
@ThreadSafeAndProhibitedFromDsfExecutor("fSession.getExecutor()")
public static IFrameDMContext getStackFrame(int threadIndex, final int level) throws Exception {
return getStackFrame(getExecutionContext(threadIndex), level);
- }
-
- public static Integer getStackDepth(final IExecutionDMContext execCtx) throws Throwable {
- return getStackDepth(execCtx, 0);
- }
-
- public static Integer getStackDepth(final IExecutionDMContext execCtx, final int maxDepth) throws Throwable {
- Query<Integer> query = new Query<Integer>() {
- @Override
- protected void execute(final DataRequestMonitor<Integer> rm) {
- fStack.getStackDepth(execCtx, maxDepth, rm);
- }
- };
-
- fSession.getExecutor().execute(query);
- return query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
- }
-
- public static IFrameDMData getFrameData(final IExecutionDMContext execCtx, final int level) throws Throwable {
- Query<IFrameDMData> query = new Query<IFrameDMData>() {
- @Override
- protected void execute(final DataRequestMonitor<IFrameDMData> rm) {
- fStack.getFrames(execCtx, level, level, new ImmediateDataRequestMonitor<IFrameDMContext[]>(rm) {
- @Override
- protected void handleSuccess() {
- IFrameDMContext[] frameDmcs = getData();
- assert frameDmcs != null;
- assert frameDmcs.length == 1;
- fStack.getFrameData(frameDmcs[0], rm);
- }
- });
- }
- };
-
- fSession.getExecutor().execute(query);
- return query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
- }
-
- public static IFrameDMData getFrameData(final int threadId, final int level) throws Throwable {
- return getFrameData(getExecutionContext(threadId), level);
- }
+ }
+
+ public static Integer getStackDepth(final IExecutionDMContext execCtx) throws Throwable {
+ return getStackDepth(execCtx, 0);
+ }
+
+ public static Integer getStackDepth(final IExecutionDMContext execCtx, final int maxDepth) throws Throwable {
+ Query<Integer> query = new Query<Integer>() {
+ @Override
+ protected void execute(final DataRequestMonitor<Integer> rm) {
+ fStack.getStackDepth(execCtx, maxDepth, rm);
+ }
+ };
+
+ fSession.getExecutor().execute(query);
+ return query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ }
+
+ public static IFrameDMData getFrameData(final IExecutionDMContext execCtx, final int level) throws Throwable {
+ Query<IFrameDMData> query = new Query<IFrameDMData>() {
+ @Override
+ protected void execute(final DataRequestMonitor<IFrameDMData> rm) {
+ fStack.getFrames(execCtx, level, level, new ImmediateDataRequestMonitor<IFrameDMContext[]>(rm) {
+ @Override
+ protected void handleSuccess() {
+ IFrameDMContext[] frameDmcs = getData();
+ assert frameDmcs != null;
+ assert frameDmcs.length == 1;
+ fStack.getFrameData(frameDmcs[0], rm);
+ }
+ });
+ }
+ };
+
+ fSession.getExecutor().execute(query);
+ return query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ }
+
+ public static IFrameDMData getFrameData(final int threadId, final int level) throws Throwable {
+ return getFrameData(getExecutionContext(threadId), level);
+ }
public static IThreadDMData getThreadData(final int threadId)
throws InterruptedException, ExecutionException, TimeoutException {
- final IProcessDMContext processContext = DMContexts.getAncestorOfType(
- SyncUtil.getContainerContext(), IProcessDMContext.class);
+ final IProcessDMContext processContext = DMContexts.getAncestorOfType(SyncUtil.getContainerContext(),
+ IProcessDMContext.class);
Query<IThreadDMData> query = new Query<IThreadDMData>() {
@Override
protected void execute(DataRequestMonitor<IThreadDMData> rm) {
- IThreadDMContext threadDmc = fProcessesService
- .createThreadContext(processContext,
- Integer.toString(threadId));
+ IThreadDMContext threadDmc = fProcessesService.createThreadContext(processContext,
+ Integer.toString(threadId));
fProcessesService.getExecutionData(threadDmc, rm);
}
@@ -497,16 +487,16 @@ public class SyncUtil {
return query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
}
- public static IExpressionDMContext createExpression(final IDMContext parentCtx, final String expression)
- throws Throwable {
- Callable<IExpressionDMContext> callable = new Callable<IExpressionDMContext>() {
- @Override
+ public static IExpressionDMContext createExpression(final IDMContext parentCtx, final String expression)
+ throws Throwable {
+ Callable<IExpressionDMContext> callable = new Callable<IExpressionDMContext>() {
+ @Override
public IExpressionDMContext call() throws Exception {
- return fExpressions.createExpression(parentCtx, expression);
- }
- };
- return fSession.getExecutor().submit(callable).get();
- }
+ return fExpressions.createExpression(parentCtx, expression);
+ }
+ };
+ return fSession.getExecutor().submit(callable).get();
+ }
public static IExpressionDMContext[] getSubExpressions(final IExpressionDMContext dmc)
throws InterruptedException, ExecutionException {
@@ -534,79 +524,67 @@ public class SyncUtil {
return subExpressions[0];
}
- public static String getExpressionValue(final IExpressionDMContext exprDmc, final String format)
- throws Throwable {
+ public static String getExpressionValue(final IExpressionDMContext exprDmc, final String format) throws Throwable {
Query<String> query = new Query<String>() {
@Override
protected void execute(final DataRequestMonitor<String> rm) {
FormattedValueDMContext valueDmc = fExpressions.getFormattedValueContext(exprDmc, format);
fExpressions.getFormattedExpressionValue(valueDmc,
new ImmediateDataRequestMonitor<FormattedValueDMData>(rm) {
- @Override
- protected void handleSuccess() {
- rm.done(getData().getFormattedValue());
- }
- });
+ @Override
+ protected void handleSuccess() {
+ rm.done(getData().getFormattedValue());
+ }
+ });
}
};
fSession.getExecutor().execute(query);
- return query.get();
+ return query.get();
}
-
- public static FormattedValueDMContext getFormattedValue(
- final IFormattedValues service, final IFormattedDataDMContext dmc, final String formatId) throws Throwable
- {
- Callable<FormattedValueDMContext> callable = new Callable<FormattedValueDMContext>() {
- @Override
+
+ public static FormattedValueDMContext getFormattedValue(final IFormattedValues service,
+ final IFormattedDataDMContext dmc, final String formatId) throws Throwable {
+ Callable<FormattedValueDMContext> callable = new Callable<FormattedValueDMContext>() {
+ @Override
public FormattedValueDMContext call() throws Exception {
- return service.getFormattedValueContext(dmc, formatId);
- }
- };
- return fSession.getExecutor().submit(callable).get();
- }
-
- public static IMIExecutionDMContext createExecutionContext(final IContainerDMContext parentCtx, final int threadId) throws Throwable {
- Callable<IMIExecutionDMContext> callable = new Callable<IMIExecutionDMContext>() {
- @Override
+ return service.getFormattedValueContext(dmc, formatId);
+ }
+ };
+ return fSession.getExecutor().submit(callable).get();
+ }
+
+ public static IMIExecutionDMContext createExecutionContext(final IContainerDMContext parentCtx, final int threadId)
+ throws Throwable {
+ Callable<IMIExecutionDMContext> callable = new Callable<IMIExecutionDMContext>() {
+ @Override
public IMIExecutionDMContext call() throws Exception {
- String threadIdStr = Integer.toString(threadId);
- IProcessDMContext processDmc = DMContexts.getAncestorOfType(parentCtx, IProcessDMContext.class);
- IThreadDMContext threadDmc = fProcessesService.createThreadContext(processDmc, threadIdStr);
- return fProcessesService.createExecutionContext(parentCtx, threadDmc, threadIdStr);
- }
- };
- return fSession.getExecutor().submit(callable).get();
- }
-
- static class DefaultTimeouts {
+ String threadIdStr = Integer.toString(threadId);
+ IProcessDMContext processDmc = DMContexts.getAncestorOfType(parentCtx, IProcessDMContext.class);
+ IThreadDMContext threadDmc = fProcessesService.createThreadContext(processDmc, threadIdStr);
+ return fProcessesService.createExecutionContext(parentCtx, threadDmc, threadIdStr);
+ }
+ };
+ return fSession.getExecutor().submit(callable).get();
+ }
+
+ static class DefaultTimeouts {
/**
* Overridable default timeout values. An override is specified using a
* system property that is "dsf.gdb.tests.timeout.default." plus the
* name of the enum below.
*/
- enum ETimeout {
- addBreakpoint,
- deleteBreakpoint,
- getBreakpointList,
- createExecutionContext,
- createExpression,
- getFormattedValue,
- getStackFrame,
- resume,
- resumeUntilStopped,
- runToLine,
- runToLocation,
- step,
- waitForStop
- }
+ enum ETimeout {
+ addBreakpoint, deleteBreakpoint, getBreakpointList, createExecutionContext, createExpression,
+ getFormattedValue, getStackFrame, resume, resumeUntilStopped, runToLine, runToLocation, step, waitForStop
+ }
/**
* Map of timeout enums to their <b>harcoded</b> default value )in
* milliseconds). These can be individually overridden with a system
* property.
- *
+ *
* <p>
* In practice, these operations are either very quick or the amount of
* time is hard to predict (depends on what the test is doing). For ones
@@ -614,270 +592,268 @@ public class SyncUtil {
* we allows 10 seconds, which is probably ample in most cases. Tests
* can provide larger values as needed in specific SyncUtil calls.
*/
- private static Map<ETimeout,Integer> sTimeouts = new HashMap<ETimeout, Integer>();
- static {
- sTimeouts.put(ETimeout.addBreakpoint, 1000);
- sTimeouts.put(ETimeout.deleteBreakpoint, 1000);
- sTimeouts.put(ETimeout.getBreakpointList, 1000);
- sTimeouts.put(ETimeout.createExecutionContext, 1000);
- sTimeouts.put(ETimeout.createExpression, 1000);
- sTimeouts.put(ETimeout.getFormattedValue, 1000);
- sTimeouts.put(ETimeout.getStackFrame, 1000);
- sTimeouts.put(ETimeout.resume, 1000);
- sTimeouts.put(ETimeout.resumeUntilStopped, 10000); // 10 seconds
- sTimeouts.put(ETimeout.runToLine, 10000); // 10 seconds
- sTimeouts.put(ETimeout.runToLocation, 10000); // 10 seconds
- sTimeouts.put(ETimeout.step, 1000);
- sTimeouts.put(ETimeout.waitForStop, 10000); // 10 seconds
- }
+ private static Map<ETimeout, Integer> sTimeouts = new HashMap<ETimeout, Integer>();
+ static {
+ sTimeouts.put(ETimeout.addBreakpoint, 1000);
+ sTimeouts.put(ETimeout.deleteBreakpoint, 1000);
+ sTimeouts.put(ETimeout.getBreakpointList, 1000);
+ sTimeouts.put(ETimeout.createExecutionContext, 1000);
+ sTimeouts.put(ETimeout.createExpression, 1000);
+ sTimeouts.put(ETimeout.getFormattedValue, 1000);
+ sTimeouts.put(ETimeout.getStackFrame, 1000);
+ sTimeouts.put(ETimeout.resume, 1000);
+ sTimeouts.put(ETimeout.resumeUntilStopped, 10000); // 10 seconds
+ sTimeouts.put(ETimeout.runToLine, 10000); // 10 seconds
+ sTimeouts.put(ETimeout.runToLocation, 10000); // 10 seconds
+ sTimeouts.put(ETimeout.step, 1000);
+ sTimeouts.put(ETimeout.waitForStop, 10000); // 10 seconds
+ }
/**
* Get the default timeout to use when the caller of a SyncUtil method
* doesn't specify one. We honor overrides specified via system
* properties, as well as apply the multiplier that can also be
* specified via a system property.
- *
+ *
* @param timeout
* the timeout enum
* @return the default value
*/
- static int get(ETimeout timeout) {
- int value = -1;
- final String propname = "dsf.gdb.tests.timeout.default." + timeout.toString();
- final String prop = System.getProperty(propname);
- if (prop != null) {
- try {
- value = Integer.valueOf(value);
- if (value < 0) {
- TestsPlugin.log(new Status(IStatus.ERROR, TestsPlugin.getUniqueIdentifier(), "\"" + propname + "\" property incorrectly specified. Should be an integer value or not specified at all.")); //$NON-NLS-1$
- value = -1;
- }
- }
- catch (NumberFormatException exc) {
- TestsPlugin.log(new Status(IStatus.ERROR, TestsPlugin.getUniqueIdentifier(), "\"" + propname + "\" property incorrectly specified. Should be an integer value or not specified at all.")); //$NON-NLS-1$
- value = -1;
- }
- }
-
- if (value == -1) {
- value = sTimeouts.get(timeout);
- }
- assert value >= 0;
- return TestsPlugin.massageTimeout(value);
- }
- }
+ static int get(ETimeout timeout) {
+ int value = -1;
+ final String propname = "dsf.gdb.tests.timeout.default." + timeout.toString();
+ final String prop = System.getProperty(propname);
+ if (prop != null) {
+ try {
+ value = Integer.valueOf(value);
+ if (value < 0) {
+ TestsPlugin.log(new Status(IStatus.ERROR, TestsPlugin.getUniqueIdentifier(), "\"" + propname //$NON-NLS-1$
+ + "\" property incorrectly specified. Should be an integer value or not specified at all."));
+ value = -1;
+ }
+ } catch (NumberFormatException exc) {
+ TestsPlugin.log(new Status(IStatus.ERROR, TestsPlugin.getUniqueIdentifier(), "\"" + propname //$NON-NLS-1$
+ + "\" property incorrectly specified. Should be an integer value or not specified at all."));
+ value = -1;
+ }
+ }
+
+ if (value == -1) {
+ value = sTimeouts.get(timeout);
+ }
+ assert value >= 0;
+ return TestsPlugin.massageTimeout(value);
+ }
+ }
/**
* Utility method to return the container DM context. This can be used only by
* tests that deal with a single heavyweight process. If more than one
- * process is available, this method will fail.
- *
+ * process is available, this method will fail.
+ *
* <p>
* This must NOT be called from the DSF executor.
- *
+ *
* @return the process context
* @throws InterruptedException
- * @throws TimeoutException
- * @throws ExecutionException
+ * @throws TimeoutException
+ * @throws ExecutionException
*/
@ThreadSafeAndProhibitedFromDsfExecutor("fSession.getExecutor()")
- public static IContainerDMContext getContainerContext() throws InterruptedException, ExecutionException, TimeoutException {
+ public static IContainerDMContext getContainerContext()
+ throws InterruptedException, ExecutionException, TimeoutException {
assert !fProcessesService.getExecutor().isInExecutorThread();
Query<IContainerDMContext> query = new Query<IContainerDMContext>() {
@Override
protected void execute(final DataRequestMonitor<IContainerDMContext> rm) {
- fProcessesService.getProcessesBeingDebugged(
- fGdbControl.getContext(),
- new ImmediateDataRequestMonitor<IDMContext[]>() {
- @Override
- protected void handleCompleted() {
- if (isSuccess()) {
- IDMContext[] contexts = getData();
- assertNotNull("invalid return value from service", contexts);
- assertEquals("unexpected number of processes", 1, contexts.length);
- IDMContext context = contexts[0];
- assertNotNull("unexpected process context type ", context);
- rm.done((IContainerDMContext)context);
- } else {
- rm.done(getStatus());
- }
- }
- });
+ fProcessesService.getProcessesBeingDebugged(fGdbControl.getContext(),
+ new ImmediateDataRequestMonitor<IDMContext[]>() {
+ @Override
+ protected void handleCompleted() {
+ if (isSuccess()) {
+ IDMContext[] contexts = getData();
+ assertNotNull("invalid return value from service", contexts);
+ assertEquals("unexpected number of processes", 1, contexts.length);
+ IDMContext context = contexts[0];
+ assertNotNull("unexpected process context type ", context);
+ rm.done((IContainerDMContext) context);
+ } else {
+ rm.done(getStatus());
+ }
+ }
+ });
}
};
-
+
fGdbControl.getExecutor().execute(query);
return query.get(TestsPlugin.massageTimeout(2000), TimeUnit.MILLISECONDS);
}
/**
* Utility method to return all thread execution contexts.
- * @throws TimeoutException
- * @throws ExecutionException
+ * @throws TimeoutException
+ * @throws ExecutionException
*/
@ThreadSafeAndProhibitedFromDsfExecutor("fSession.getExecutor()")
- public static IMIExecutionDMContext[] getExecutionContexts() throws InterruptedException, ExecutionException, TimeoutException {
+ public static IMIExecutionDMContext[] getExecutionContexts()
+ throws InterruptedException, ExecutionException, TimeoutException {
assert !fProcessesService.getExecutor().isInExecutorThread();
- final IContainerDMContext containerDmc = SyncUtil.getContainerContext();
+ final IContainerDMContext containerDmc = SyncUtil.getContainerContext();
Query<IMIExecutionDMContext[]> query = new Query<IMIExecutionDMContext[]>() {
@Override
protected void execute(final DataRequestMonitor<IMIExecutionDMContext[]> rm) {
- fProcessesService.getProcessesBeingDebugged(
- containerDmc,
- new ImmediateDataRequestMonitor<IDMContext[]>() {
- @Override
- protected void handleCompleted() {
- if (isSuccess()) {
- IDMContext[] threads = getData();
- assertNotNull("invalid return value from service", threads);
- rm.setData((IMIExecutionDMContext[])threads);
- } else {
- rm.setStatus(getStatus());
- }
- rm.done();
- }
- });
+ fProcessesService.getProcessesBeingDebugged(containerDmc,
+ new ImmediateDataRequestMonitor<IDMContext[]>() {
+ @Override
+ protected void handleCompleted() {
+ if (isSuccess()) {
+ IDMContext[] threads = getData();
+ assertNotNull("invalid return value from service", threads);
+ rm.setData((IMIExecutionDMContext[]) threads);
+ } else {
+ rm.setStatus(getStatus());
+ }
+ rm.done();
+ }
+ });
}
};
-
+
fGdbControl.getExecutor().execute(query);
return query.get(TestsPlugin.massageTimeout(2000), TimeUnit.MILLISECONDS);
}
/**
* Utility method to return a specific execution DM context.
- * @throws TimeoutException
- * @throws ExecutionException
+ * @throws TimeoutException
+ * @throws ExecutionException
*/
@ThreadSafeAndProhibitedFromDsfExecutor("fSession.getExecutor()")
- public static IMIExecutionDMContext getExecutionContext(int threadIndex) throws InterruptedException, ExecutionException, TimeoutException {
+ public static IMIExecutionDMContext getExecutionContext(int threadIndex)
+ throws InterruptedException, ExecutionException, TimeoutException {
IMIExecutionDMContext[] threads = getExecutionContexts();
assertTrue("unexpected number of threads", threadIndex < threads.length);
assertNotNull("unexpected thread context type ", threads[threadIndex]);
return threads[threadIndex];
}
- /**
- * Check if the restart operation is supported
+ /**
+ * Check if the restart operation is supported
*/
public static boolean canRestart() throws Exception {
final IContainerDMContext containerDmc = getContainerContext();
// Check if restart is allowed
- Query<Boolean> query = new Query<Boolean>() {
+ Query<Boolean> query = new Query<Boolean>() {
@Override
protected void execute(final DataRequestMonitor<Boolean> rm) {
- fProcessesService.canRestart(
- containerDmc,
- new ImmediateDataRequestMonitor<Boolean>(rm) {
- @Override
- protected void handleSuccess() {
- rm.setData(getData());
- rm.done();
- }
- });
-
+ fProcessesService.canRestart(containerDmc, new ImmediateDataRequestMonitor<Boolean>(rm) {
+ @Override
+ protected void handleSuccess() {
+ rm.setData(getData());
+ rm.done();
+ }
+ });
+
}
- };
+ };
- fGdbControl.getExecutor().execute(query);
- boolean canRestart = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
- return canRestart;
+ fGdbControl.getExecutor().execute(query);
+ boolean canRestart = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ return canRestart;
}
- /**
- * Restart the program.
- */
+ /**
+ * Restart the program.
+ */
public static MIStoppedEvent restart(final GdbLaunch launch) throws Exception {
final IContainerDMContext containerDmc = getContainerContext();
// If we are calling this method, the restart operation should be allowed
if (!canRestart()) {
- throw new CoreException(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID, "Unable to restart"));
- }
-
- // Now wait for the stopped event of the restart
- final ServiceEventWaitor<MIStoppedEvent> eventWaitor =
- new ServiceEventWaitor<MIStoppedEvent>(
- fSession,
- MIStoppedEvent.class);
-
- // Perform the restart
- Query<IContainerDMContext> query2 = new Query<IContainerDMContext>() {
+ throw new CoreException(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID, "Unable to restart"));
+ }
+
+ // Now wait for the stopped event of the restart
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<MIStoppedEvent>(fSession,
+ MIStoppedEvent.class);
+
+ // Perform the restart
+ Query<IContainerDMContext> query2 = new Query<IContainerDMContext>() {
@Override
protected void execute(final DataRequestMonitor<IContainerDMContext> rm) {
Map<String, Object> attributes = null;
try {
attributes = launch.getLaunchConfiguration().getAttributes();
- } catch (CoreException e) {}
+ } catch (CoreException e) {
+ }
fProcessesService.restart(containerDmc, attributes, rm);
}
- };
-
- fGdbControl.getExecutor().execute(query2);
- query2.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
-
-
- MIStoppedEvent event = eventWaitor.waitForEvent(DefaultTimeouts.get(ETimeout.waitForStop));
- if (event instanceof MISignalEvent) {
- // This is not the stopped event we were waiting for. Get the next one.
- event = eventWaitor.waitForEvent(DefaultTimeouts.get(ETimeout.waitForStop));
- }
- return event;
- }
-
- public static IVariableDMData[] getLocals(final IFrameDMContext frameDmc) throws Throwable {
- Query<IVariableDMData[]> query = new Query<IVariableDMData[]>() {
- @Override
- protected void execute(final DataRequestMonitor<IVariableDMData[]> rm) {
- fStack.getLocals(frameDmc, new ImmediateDataRequestMonitor<IVariableDMContext[]>() {
- @Override
- protected void handleCompleted() {
- if (isSuccess()) {
- IVariableDMContext[] varDmcs = getData();
- final List<IVariableDMData> localsDMData = new ArrayList<IVariableDMData>();
- final CountingRequestMonitor crm = new CountingRequestMonitor(ImmediateExecutor.getInstance(), rm) {
- @Override
- protected void handleSuccess() {
- rm.done(localsDMData.toArray(new IVariableDMData[localsDMData.size()]));
- };
- };
-
- for (IVariableDMContext varDmc : varDmcs) {
- fStack.getVariableData(varDmc,
- new ImmediateDataRequestMonitor<IVariableDMData>(crm) {
- @Override
- public void handleSuccess() {
- localsDMData.add(getData());
- crm.done();
- }
- });
- }
- crm.setDoneCount(varDmcs.length);
- } else {
- rm.done();
- }
- }
- });
- }
- };
-
- fSession.getExecutor().execute(query);
- IVariableDMData[] result = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
- return result;
- }
-
- /**
- * Get the registers directly from GDB (without using the registers service)
- * @param gdbVersion
- * @param context
- * @return
- * @throws Throwable
- */
+ };
+
+ fGdbControl.getExecutor().execute(query2);
+ query2.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+
+ MIStoppedEvent event = eventWaitor.waitForEvent(DefaultTimeouts.get(ETimeout.waitForStop));
+ if (event instanceof MISignalEvent) {
+ // This is not the stopped event we were waiting for. Get the next one.
+ event = eventWaitor.waitForEvent(DefaultTimeouts.get(ETimeout.waitForStop));
+ }
+ return event;
+ }
+
+ public static IVariableDMData[] getLocals(final IFrameDMContext frameDmc) throws Throwable {
+ Query<IVariableDMData[]> query = new Query<IVariableDMData[]>() {
+ @Override
+ protected void execute(final DataRequestMonitor<IVariableDMData[]> rm) {
+ fStack.getLocals(frameDmc, new ImmediateDataRequestMonitor<IVariableDMContext[]>() {
+ @Override
+ protected void handleCompleted() {
+ if (isSuccess()) {
+ IVariableDMContext[] varDmcs = getData();
+ final List<IVariableDMData> localsDMData = new ArrayList<IVariableDMData>();
+ final CountingRequestMonitor crm = new CountingRequestMonitor(
+ ImmediateExecutor.getInstance(), rm) {
+ @Override
+ protected void handleSuccess() {
+ rm.done(localsDMData.toArray(new IVariableDMData[localsDMData.size()]));
+ };
+ };
+
+ for (IVariableDMContext varDmc : varDmcs) {
+ fStack.getVariableData(varDmc, new ImmediateDataRequestMonitor<IVariableDMData>(crm) {
+ @Override
+ public void handleSuccess() {
+ localsDMData.add(getData());
+ crm.done();
+ }
+ });
+ }
+ crm.setDoneCount(varDmcs.length);
+ } else {
+ rm.done();
+ }
+ }
+ });
+ }
+ };
+
+ fSession.getExecutor().execute(query);
+ IVariableDMData[] result = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ return result;
+ }
+
+ /**
+ * Get the registers directly from GDB (without using the registers service)
+ * @param gdbVersion
+ * @param context
+ * @return
+ * @throws Throwable
+ */
public static List<String> getRegistersFromGdb(String gdbVersion, IDMContext context) throws Throwable {
if (!fRegisterNames.containsKey(gdbVersion)) {
// The tests must run on different machines, so the set of registers can change.
@@ -926,9 +902,8 @@ public class SyncUtil {
* @throws InterruptedException
* @throws ExecutionException
*/
- public static MemoryByte[] readMemory(final IMemoryDMContext dmc,
- final IAddress address, final long offset, final int wordSize,
- final int count) throws InterruptedException, ExecutionException {
+ public static MemoryByte[] readMemory(final IMemoryDMContext dmc, final IAddress address, final long offset,
+ final int wordSize, final int count) throws InterruptedException, ExecutionException {
Query<MemoryByte[]> query = new Query<MemoryByte[]>() {
@Override
protected void execute(DataRequestMonitor<MemoryByte[]> rm) {
@@ -953,15 +928,12 @@ public class SyncUtil {
* @throws InterruptedException
* @throws ExecutionException
*/
- public static void writeMemory(final IMemoryDMContext dmc,
- final IAddress address, final long offset, final int wordSize,
- final int count, final byte[] buffer) throws InterruptedException,
- ExecutionException {
+ public static void writeMemory(final IMemoryDMContext dmc, final IAddress address, final long offset,
+ final int wordSize, final int count, final byte[] buffer) throws InterruptedException, ExecutionException {
Query<Void> query = new Query<Void>() {
@Override
protected void execute(DataRequestMonitor<Void> rm) {
- fMemory.setMemory(dmc, address, offset, wordSize, count,
- buffer, rm);
+ fMemory.setMemory(dmc, address, offset, wordSize, count, buffer, rm);
}
};
@@ -982,15 +954,12 @@ public class SyncUtil {
* @throws InterruptedException
* @throws ExecutionException
*/
- public static void fillMemory(final IMemoryDMContext dmc,
- final IAddress address, final long offset, final int wordSize,
- final int count, final byte[] pattern) throws InterruptedException,
- ExecutionException {
+ public static void fillMemory(final IMemoryDMContext dmc, final IAddress address, final long offset,
+ final int wordSize, final int count, final byte[] pattern) throws InterruptedException, ExecutionException {
Query<Void> query = new Query<Void>() {
@Override
protected void execute(DataRequestMonitor<Void> rm) {
- fMemory.fillMemory(dmc, address, offset, wordSize, count,
- pattern, rm);
+ fMemory.fillMemory(dmc, address, offset, wordSize, count, pattern, rm);
}
};
@@ -1025,13 +994,12 @@ public class SyncUtil {
assert (fMemory instanceof IGDBMemory2);
final IGDBMemory2 memoryService = (IGDBMemory2) fMemory;
- return memoryService.isBigEndian(dmc) ? ByteOrder.BIG_ENDIAN
- : ByteOrder.LITTLE_ENDIAN;
+ return memoryService.isBigEndian(dmc) ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN;
}
/**
* Get the source using the {@link ISourceLookup} service.
- *
+ *
* Wrapper around
* {@link ISourceLookup#getSource(ISourceLookupDMContext, String, DataRequestMonitor)}
*/
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/launching/TestLaunchDelegate.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/launching/TestLaunchDelegate.java
index 4ecaaeb9f8a..898cc9d26e8 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/launching/TestLaunchDelegate.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/launching/TestLaunchDelegate.java
@@ -11,7 +11,7 @@
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
-package org.eclipse.cdt.tests.dsf.gdb.launching;
+package org.eclipse.cdt.tests.dsf.gdb.launching;
import org.eclipse.cdt.dsf.concurrent.ThreadSafe;
import org.eclipse.cdt.dsf.debug.service.IDsfDebugServicesFactory;
@@ -23,50 +23,51 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.debug.core.ILaunchConfiguration;
-
+
/**
* The launch configuration delegate for the DSF GDB JUnit tests.
*/
@ThreadSafe
-public class TestLaunchDelegate extends GdbLaunchDelegate
-{
+public class TestLaunchDelegate extends GdbLaunchDelegate {
@Override
- protected IProject[] getBuildOrder(ILaunchConfiguration configuration,
- String mode) throws CoreException {
+ protected IProject[] getBuildOrder(ILaunchConfiguration configuration, String mode) throws CoreException {
return null;
}
+
@Override
- protected IProject[] getProjectsForProblemSearch(
- ILaunchConfiguration configuration, String mode)
+ protected IProject[] getProjectsForProblemSearch(ILaunchConfiguration configuration, String mode)
throws CoreException {
return null;
}
-
- @Override
- public boolean buildForLaunch(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException {
- return false;
- }
- @Override
- public boolean preLaunchCheck(ILaunchConfiguration config, String mode, IProgressMonitor monitor) throws CoreException {
- // Don't override the base method to allow it to set the GdbProcessFactory
- // which LaunchConfigurationAndRestartTest.testExitCodeSet() depends on
- return super.preLaunchCheck(config, mode, monitor);
- }
-
- @Override
- public boolean finalLaunchCheck(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException {
- return true;
- }
-
- @Override
- protected IPath checkBinaryDetails(ILaunchConfiguration config) throws CoreException {
- // Now that GdbLaunchDelegate supports project-less debugging, we don't need to
- // override this method. In fact, we should not override it so that we test
- // that project-less debugging keeps on working.
- // See bug 343861
- return super.checkBinaryDetails(config);
- }
+ @Override
+ public boolean buildForLaunch(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor)
+ throws CoreException {
+ return false;
+ }
+
+ @Override
+ public boolean preLaunchCheck(ILaunchConfiguration config, String mode, IProgressMonitor monitor)
+ throws CoreException {
+ // Don't override the base method to allow it to set the GdbProcessFactory
+ // which LaunchConfigurationAndRestartTest.testExitCodeSet() depends on
+ return super.preLaunchCheck(config, mode, monitor);
+ }
+
+ @Override
+ public boolean finalLaunchCheck(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor)
+ throws CoreException {
+ return true;
+ }
+
+ @Override
+ protected IPath checkBinaryDetails(ILaunchConfiguration config) throws CoreException {
+ // Now that GdbLaunchDelegate supports project-less debugging, we don't need to
+ // override this method. In fact, we should not override it so that we test
+ // that project-less debugging keeps on working.
+ // See bug 343861
+ return super.checkBinaryDetails(config);
+ }
@Override
protected IDsfDebugServicesFactory newServiceFactory(ILaunchConfiguration config, String version) {
@@ -79,8 +80,7 @@ public class TestLaunchDelegate extends GdbLaunchDelegate
if (servicesFactoryId != null && servicesFactoryId.length() > 0) {
// A services factory has been registered, so lets resolve it and use it
- return BaseTestCase.getServiceFactoriesManager()
- .removeTestServicesFactory(servicesFactoryId);
+ return BaseTestCase.getServiceFactoriesManager().removeTestServicesFactory(servicesFactoryId);
}
// Use the original services factory
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/launching/TestsPlugin.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/launching/TestsPlugin.java
index 50e67fe560e..f82286615d8 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/launching/TestsPlugin.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/launching/TestsPlugin.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* Alvaro Sanchez-Leon (Ericsson) - Bug 437562 - Split the dsf-gdb tests to a plug-in and fragment pair
@@ -23,72 +23,73 @@ import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
import org.osgi.framework.BundleContext;
-
/**
* The main plugin class
*/
public class TestsPlugin extends Plugin {
- //The shared instance.
- private static TestsPlugin plugin;
- //Resource bundle.
- private ResourceBundle resourceBundle;
- private static BundleContext bundleContext;
-
- public static final String PLUGIN_ID = "org.eclipse.cdt.tests.dsf.gdb"; //$NON-NLS-1$
-
- /** Base tracing option for this plugin */
- public static final boolean DEBUG = Boolean.parseBoolean(Platform.getDebugOption("org.eclipse.cdt.tests.dsf.gdb/debug")); //$NON-NLS-1$
-
- /**
- * The constructor.
- */
- public TestsPlugin() {
- super();
- plugin = this;
- try {
- resourceBundle = ResourceBundle.getBundle("org.eclipse.cdt.tests.dsf.gdb.TestsPluginResources"); //$NON-NLS-1$
- }
- catch (MissingResourceException x) {
- resourceBundle = null;
- }
- }
-
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- bundleContext = context;
- }
- /**
- * This method is called when the plug-in is stopped
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- super.stop(context);
- }
- /**
- * Returns the shared instance.
- */
- public static TestsPlugin getDefault() {
- return plugin;
- }
-
- /**
- * Returns the plugin's resource bundle,
- */
- public ResourceBundle getResourceBundle() {
- return resourceBundle;
- }
-
- /**
- * Returns the plugin's bundle context,
- */
- public static BundleContext getBundleContext() {
- return bundleContext;
- }
+ //The shared instance.
+ private static TestsPlugin plugin;
+ //Resource bundle.
+ private ResourceBundle resourceBundle;
+ private static BundleContext bundleContext;
+
+ public static final String PLUGIN_ID = "org.eclipse.cdt.tests.dsf.gdb"; //$NON-NLS-1$
+
+ /** Base tracing option for this plugin */
+ public static final boolean DEBUG = Boolean
+ .parseBoolean(Platform.getDebugOption("org.eclipse.cdt.tests.dsf.gdb/debug")); //$NON-NLS-1$
+
+ /**
+ * The constructor.
+ */
+ public TestsPlugin() {
+ super();
+ plugin = this;
+ try {
+ resourceBundle = ResourceBundle.getBundle("org.eclipse.cdt.tests.dsf.gdb.TestsPluginResources"); //$NON-NLS-1$
+ } catch (MissingResourceException x) {
+ resourceBundle = null;
+ }
+ }
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ bundleContext = context;
+ }
+
+ /**
+ * This method is called when the plug-in is stopped
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance.
+ */
+ public static TestsPlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns the plugin's resource bundle,
+ */
+ public ResourceBundle getResourceBundle() {
+ return resourceBundle;
+ }
+
+ /**
+ * Returns the plugin's bundle context,
+ */
+ public static BundleContext getBundleContext() {
+ return bundleContext;
+ }
/**
* Logs the specified status with this plug-in's log.
- *
+ *
* @param status
* status to log
*/
@@ -96,24 +97,23 @@ public class TestsPlugin extends Plugin {
getDefault().getLog().log(status);
}
- /**
- * Convenience method which returns the unique identifier of this plugin.
- */
- public static String getUniqueIdentifier() {
- return getDefault().getBundle().getSymbolicName();
- }
-
+ /**
+ * Convenience method which returns the unique identifier of this plugin.
+ */
+ public static String getUniqueIdentifier() {
+ return getDefault().getBundle().getSymbolicName();
+ }
+
/**
* Logs an internal error with the specified throwable
- *
+ *
* @param e
* the exception to be logged
*/
- public static void log( Throwable e ) {
+ public static void log(Throwable e) {
log(new Status(IStatus.ERROR, getUniqueIdentifier(), "Internal Error", e)); //$NON-NLS-1$
}
-
/**
* Tests should use this utility when specifying a timeout value for a wait
* operation. This method checks for the existence of the property
@@ -122,7 +122,7 @@ public class TestsPlugin extends Plugin {
* would up the timeout value by 50%. This gives the executor of the tests
* the ability to widen the timeouts across the board for all operations to
* accommodate a slow machine.
- *
+ *
* @param timeoutMs
* the timeout, in milliseconds
* @return the adjusted value
@@ -132,13 +132,13 @@ public class TestsPlugin extends Plugin {
if (prop == null || prop.length() == 0) {
return timeoutMs;
}
-
+
try {
float multiplier = Float.valueOf(prop);
- return (int)(timeoutMs * multiplier);
- }
- catch (NumberFormatException exc) {
- log(new Status(IStatus.ERROR, getUniqueIdentifier(), "\"dsf.gdb.tests.timeout.multiplier\" property incorrectly specified. Should be a float value (e.g., \"1.5\") or not specified at all.")); //$NON-NLS-1$
+ return (int) (timeoutMs * multiplier);
+ } catch (NumberFormatException exc) {
+ log(new Status(IStatus.ERROR, getUniqueIdentifier(),
+ "\"dsf.gdb.tests.timeout.multiplier\" property incorrectly specified. Should be a float value (e.g., \"1.5\") or not specified at all.")); //$NON-NLS-1$
return timeoutMs;
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AllRemoteSuites.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AllRemoteSuites.java
index 0346cc4ebd7..22e82681942 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AllRemoteSuites.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AllRemoteSuites.java
@@ -26,7 +26,7 @@ import junit.framework.TestSuite;
@RunWith(AllTests.class)
public class AllRemoteSuites {
public static junit.framework.Test suite() {
- String gdbVersions = "gdbserver."+String.join(",gdbserver.", ITestConstants.ALL_SUPPORTED_VERSIONS);
+ String gdbVersions = "gdbserver." + String.join(",gdbserver.", ITestConstants.ALL_SUPPORTED_VERSIONS);
System.setProperty("cdt.tests.dsf.gdb.versions", gdbVersions);
TestSuite suite = new TestSuite();
suite.addTest(new JUnit4TestAdapter(SuiteGdb.class));
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AutomatedSuite.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AutomatedSuite.java
index 5ad5764888c..17830e46638 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AutomatedSuite.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AutomatedSuite.java
@@ -25,8 +25,6 @@ import org.junit.runners.Suite;
* -Dcdt.tests.dsf.gdb.versions=gdb.7.7,gdbserver.7.7,gdb.7.11
*/
@RunWith(Suite.class)
-@Suite.SuiteClasses({
- SuiteGdb.class,
-})
+@Suite.SuiteClasses({ SuiteGdb.class, })
public class AutomatedSuite {
} \ No newline at end of file
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/CommandLineArgsTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/CommandLineArgsTest.java
index b5fbc45f9d6..ed321d976e0 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/CommandLineArgsTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/CommandLineArgsTest.java
@@ -134,7 +134,7 @@ public class CommandLineArgsTest extends BaseParametrizedTestCase {
/**
* Check that the target program received the arguments as expected
- *
+ *
* @param expected
* arguments to check, e.g. check expected[0].equals(argv[1])
*/
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/CommandTimeoutTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/CommandTimeoutTest.java
index 2831582b8a7..63f7e196b64 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/CommandTimeoutTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/CommandTimeoutTest.java
@@ -46,44 +46,36 @@ public class CommandTimeoutTest extends BaseParametrizedTestCase {
private static boolean fgTimeoutEnabled = false;
private static int fgTimeout = IGdbDebugPreferenceConstants.COMMAND_TIMEOUT_VALUE_DEFAULT;
private static boolean fgAutoTerminate;
-
- @BeforeClass
+
+ @BeforeClass
public static void doBeforeClass() throws Exception {
// Save the original values of the timeout-related preferences
- fgTimeoutEnabled = Platform.getPreferencesService().getBoolean(
- GdbPlugin.PLUGIN_ID,
- IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT,
- false,
- null );
- fgTimeout = Platform.getPreferencesService().getInt(
- GdbPlugin.PLUGIN_ID,
- IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT_VALUE,
- IGdbDebugPreferenceConstants.COMMAND_TIMEOUT_VALUE_DEFAULT,
- null );
- fgAutoTerminate = Platform.getPreferencesService().getBoolean(
- GdbPlugin.PLUGIN_ID,
- IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB,
- true,
- null );
- }
-
- @Override
+ fgTimeoutEnabled = Platform.getPreferencesService().getBoolean(GdbPlugin.PLUGIN_ID,
+ IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT, false, null);
+ fgTimeout = Platform.getPreferencesService().getInt(GdbPlugin.PLUGIN_ID,
+ IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT_VALUE,
+ IGdbDebugPreferenceConstants.COMMAND_TIMEOUT_VALUE_DEFAULT, null);
+ fgAutoTerminate = Platform.getPreferencesService().getBoolean(GdbPlugin.PLUGIN_ID,
+ IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, true, null);
+ }
+
+ @Override
public void doBeforeTest() throws Exception {
removeTeminatedLaunchesBeforeTest();
setLaunchAttributes();
- // Can't run the launch right away because each test needs to first set some
- // parameters. The individual tests will be responsible for starting the launch.
- }
+ // Can't run the launch right away because each test needs to first set some
+ // parameters. The individual tests will be responsible for starting the launch.
+ }
@Override
public void doAfterTest() throws Exception {
// Don't call super here, as each test needs to deal with the launch in its own way
// Restore the different preferences we might have changed
- IEclipsePreferences node = InstanceScope.INSTANCE.getNode( GdbPlugin.PLUGIN_ID );
- node.putBoolean( IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT, fgTimeoutEnabled );
- node.putInt( IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT_VALUE, fgTimeout );
- node.putBoolean( IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, fgAutoTerminate );
+ IEclipsePreferences node = InstanceScope.INSTANCE.getNode(GdbPlugin.PLUGIN_ID);
+ node.putBoolean(IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT, fgTimeoutEnabled);
+ node.putInt(IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT_VALUE, fgTimeout);
+ node.putBoolean(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, fgAutoTerminate);
}
/**
@@ -93,50 +85,49 @@ public class CommandTimeoutTest extends BaseParametrizedTestCase {
@Test
public void commandTimedOutDuringSession() throws Exception {
// Enable timeout
- IEclipsePreferences node = InstanceScope.INSTANCE.getNode( GdbPlugin.PLUGIN_ID );
- node.putBoolean( IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT, true );
- node.putInt( IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT_VALUE, 2000 );
+ IEclipsePreferences node = InstanceScope.INSTANCE.getNode(GdbPlugin.PLUGIN_ID);
+ node.putBoolean(IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT, true);
+ node.putInt(IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT_VALUE, 2000);
// Note that sending a "target-select" command when a program is running will kill the program.
// If that triggers us to kill GDB, then our testcase won't have time to timeout.
// Therefore we set the preference to keep GDB alive even if the program is no longer running
- node.putBoolean( IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, false );
-
+ node.putBoolean(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, false);
+
doLaunch();
-
+
final DsfSession session = getGDBLaunch().getSession();
- ServiceEventWaitor<ICommandControlShutdownDMEvent> shutdownEventWaitor = new ServiceEventWaitor<ICommandControlShutdownDMEvent>(
- session,
- ICommandControlShutdownDMEvent.class);
+ ServiceEventWaitor<ICommandControlShutdownDMEvent> shutdownEventWaitor = new ServiceEventWaitor<ICommandControlShutdownDMEvent>(
+ session, ICommandControlShutdownDMEvent.class);
// Send the command that will timeout
Query<MIInfo> query = new Query<MIInfo>() {
@Override
- protected void execute( DataRequestMonitor<MIInfo> rm ) {
- DsfServicesTracker tracker = new DsfServicesTracker( TestsPlugin.getBundleContext(), session.getId() );
- ICommandControlService commandService = tracker.getService( ICommandControlService.class );
+ protected void execute(DataRequestMonitor<MIInfo> rm) {
+ DsfServicesTracker tracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), session.getId());
+ ICommandControlService commandService = tracker.getService(ICommandControlService.class);
tracker.dispose();
- commandService.queueCommand( new MITargetSelect( commandService.getContext(), "localhost", "1", false ), rm );
+ commandService.queueCommand(new MITargetSelect(commandService.getContext(), "localhost", "1", false),
+ rm);
}
};
try {
- session.getExecutor().execute( query );
+ session.getExecutor().execute(query);
query.get();
// Cleanup in case the query does not throw the expected exception
super.doAfterTest();
- Assert.fail( "Command is expected to timeout" );
+ Assert.fail("Command is expected to timeout");
+ } catch (Exception e) {
+ processException(e);
}
- catch( Exception e ) {
- processException( e );
- }
-
+
// Make sure we receive a shutdown event to confirm we have aborted the session
- shutdownEventWaitor.waitForEvent(TestsPlugin.massageTimeout(5000));
+ shutdownEventWaitor.waitForEvent(TestsPlugin.massageTimeout(5000));
- // It can take a moment from when the shutdown event is received to when
- // the launch is actually terminated. Make sure that the launch does
- // terminate itself.
- assertLaunchTerminates();
+ // It can take a moment from when the shutdown event is received to when
+ // the launch is actually terminated. Make sure that the launch does
+ // terminate itself.
+ assertLaunchTerminates();
}
/**
@@ -146,38 +137,37 @@ public class CommandTimeoutTest extends BaseParametrizedTestCase {
@Test
public void commandTimedOutDuringLaunch() {
// Enable timeout
- IEclipsePreferences node = InstanceScope.INSTANCE.getNode( GdbPlugin.PLUGIN_ID );
- node.putBoolean( IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT, true );
+ IEclipsePreferences node = InstanceScope.INSTANCE.getNode(GdbPlugin.PLUGIN_ID);
+ node.putBoolean(IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT, true);
// Timeout must be shorter than the launch's timeout of 2 seconds (see BaseTestCase.doLaunch())
- node.putInt( IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT_VALUE, 1000 );
+ node.putInt(IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT_VALUE, 1000);
- // Setup a remote launch so that it sends a "-target-remote" as part of the
+ // Setup a remote launch so that it sends a "-target-remote" as part of the
// launch steps...
- setLaunchAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
- IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE );
+ setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
+ IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE);
// ... but we won't start gdbserver, so the command will timeout
- setLaunchAttribute( ITestConstants.LAUNCH_GDB_SERVER, false);
-
+ setLaunchAttribute(ITestConstants.LAUNCH_GDB_SERVER, false);
+
try {
doLaunch();
-
+
// Cleanup in case the launch does not throw the expected exception
super.doAfterTest();
- Assert.fail( "Launch is expected to fail" );
- }
- catch( Exception e ) {
- processException( e );
+ Assert.fail("Launch is expected to fail");
+ } catch (Exception e) {
+ processException(e);
}
}
-
+
/**
- * Checks whether the given exception is an instance of {@link CoreException}
+ * Checks whether the given exception is an instance of {@link CoreException}
* with the status code 20100 which indicates that a gdb command has been timed out.
* 20100 comes from GDBControl.STATUS_CODE_COMMAND_TIMED_OUT which is private
*/
- private void processException( Exception e ) {
- Throwable t = getExceptionCause( e );
- if (t instanceof CoreException && ((CoreException)t).getStatus().getCode() == 20100) {
+ private void processException(Exception e) {
+ Throwable t = getExceptionCause(e);
+ if (t instanceof CoreException && ((CoreException) t).getStatus().getCode() == 20100) {
// this is the exception we are looking for
return;
}
@@ -186,9 +176,9 @@ public class CommandTimeoutTest extends BaseParametrizedTestCase {
private Throwable getExceptionCause(Throwable e) {
Throwable current = e;
- while ( true ) {
+ while (true) {
Throwable t = (current).getCause();
- if ( t == null )
+ if (t == null)
break;
current = t;
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBConsoleBreakpointsTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBConsoleBreakpointsTest.java
index 3d3e169fbfc..bdea8c196e0 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBConsoleBreakpointsTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBConsoleBreakpointsTest.java
@@ -79,7 +79,7 @@ import org.junit.runners.Parameterized;
* This test case verifies whether breakpoints or watchpoints set from GDB console
* are properly synchronized with platform breakpoints.
*/
-@SuppressWarnings( "restriction" )
+@SuppressWarnings("restriction")
@RunWith(Parameterized.class)
public class GDBConsoleBreakpointsTest extends BaseParametrizedTestCase {
@@ -108,7 +108,7 @@ public class GDBConsoleBreakpointsTest extends BaseParametrizedTestCase {
private DsfSession fSession;
private DsfServicesTracker fServicesTracker;
- protected IBreakpointsTargetDMContext fBreakpointsDmc;
+ protected IBreakpointsTargetDMContext fBreakpointsDmc;
private IGDBControl fCommandControl;
private IBreakpoints fBreakpointService;
private MIBreakpointsSynchronizer fBreakpointsSynchronizer;
@@ -119,34 +119,34 @@ public class GDBConsoleBreakpointsTest extends BaseParametrizedTestCase {
@Before
public void doBeforeTest() throws Exception {
deleteAllPlatformBreakpoints();
-
+
super.doBeforeTest();
-
+
Runnable runnable = new Runnable() {
- @Override
+ @Override
public void run() {
- fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
- Assert.assertTrue(fServicesTracker != null);
-
- fCommandControl = fServicesTracker.getService(IGDBControl.class);
- Assert.assertTrue(fCommandControl != null);
-
- fBreakpointService = fServicesTracker.getService(IBreakpoints.class);
- Assert.assertTrue(fBreakpointService != null);
-
- fBreakpointsSynchronizer = fServicesTracker.getService(MIBreakpointsSynchronizer.class);
- Assert.assertTrue(fBreakpointsSynchronizer != null);
-
- // Register to breakpoint events
- fSession.addServiceEventListener(GDBConsoleBreakpointsTest.this, null);
- }
- };
+ fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
+ Assert.assertTrue(fServicesTracker != null);
+
+ fCommandControl = fServicesTracker.getService(IGDBControl.class);
+ Assert.assertTrue(fCommandControl != null);
+
+ fBreakpointService = fServicesTracker.getService(IBreakpoints.class);
+ Assert.assertTrue(fBreakpointService != null);
+
+ fBreakpointsSynchronizer = fServicesTracker.getService(MIBreakpointsSynchronizer.class);
+ Assert.assertTrue(fBreakpointsSynchronizer != null);
+
+ // Register to breakpoint events
+ fSession.addServiceEventListener(GDBConsoleBreakpointsTest.this, null);
+ }
+ };
fSession = getGDBLaunch().getSession();
- fSession.getExecutor().submit(runnable).get();
+ fSession.getExecutor().submit(runnable).get();
- IContainerDMContext containerDmc = SyncUtil.getContainerContext();
- fBreakpointsDmc = DMContexts.getAncestorOfType(containerDmc, IBreakpointsTargetDMContext.class);
- Assert.assertTrue(fBreakpointsDmc != null);
+ IContainerDMContext containerDmc = SyncUtil.getContainerContext();
+ fBreakpointsDmc = DMContexts.getAncestorOfType(containerDmc, IBreakpointsTargetDMContext.class);
+ Assert.assertTrue(fBreakpointsDmc != null);
}
@Override
@@ -158,34 +158,29 @@ public class GDBConsoleBreakpointsTest extends BaseParametrizedTestCase {
}
fBreakpointEvents.clear();
- if (fServicesTracker != null) {
- fServicesTracker.dispose();
- fServicesTracker = null;
- }
-
- super.doAfterTest();
-
+ if (fServicesTracker != null) {
+ fServicesTracker.dispose();
+ fServicesTracker = null;
+ }
+
+ super.doAfterTest();
+
deleteAllPlatformBreakpoints();
}
@Test
public void testValidLineBreakpoints() throws Throwable {
- testConsoleBreakpoint(
- ICLineBreakpoint.class,
- getLocationBreakpointAttributes(ICLineBreakpoint.class, true));
+ testConsoleBreakpoint(ICLineBreakpoint.class, getLocationBreakpointAttributes(ICLineBreakpoint.class, true));
}
@Test
public void testInvalidLineBreakpoints() throws Throwable {
- testConsoleBreakpoint(
- ICLineBreakpoint.class,
- getLocationBreakpointAttributes(ICLineBreakpoint.class, false));
+ testConsoleBreakpoint(ICLineBreakpoint.class, getLocationBreakpointAttributes(ICLineBreakpoint.class, false));
}
@Test
public void testValidFunctionBreakpoints() throws Throwable {
- testConsoleBreakpoint(
- ICFunctionBreakpoint.class,
+ testConsoleBreakpoint(ICFunctionBreakpoint.class,
getLocationBreakpointAttributes(ICFunctionBreakpoint.class, true));
}
@@ -193,15 +188,12 @@ public class GDBConsoleBreakpointsTest extends BaseParametrizedTestCase {
public void testValidFunctionNameOnlyBreakpoints() throws Throwable {
Map<String, Object> breakpointAttributes = getLocationBreakpointAttributes(ICFunctionBreakpoint.class, true);
breakpointAttributes.remove(ATTR_FILE_NAME);
- testConsoleBreakpoint(
- ICFunctionBreakpoint.class,
- breakpointAttributes);
+ testConsoleBreakpoint(ICFunctionBreakpoint.class, breakpointAttributes);
}
@Test
public void testInvalidFunctionBreakpoints() throws Throwable {
- testConsoleBreakpoint(
- ICFunctionBreakpoint.class,
+ testConsoleBreakpoint(ICFunctionBreakpoint.class,
getLocationBreakpointAttributes(ICFunctionBreakpoint.class, false));
}
@@ -209,52 +201,42 @@ public class GDBConsoleBreakpointsTest extends BaseParametrizedTestCase {
public void testInvalidFunctionNameOnlyBreakpoints() throws Throwable {
Map<String, Object> breakpointAttributes = getLocationBreakpointAttributes(ICFunctionBreakpoint.class, false);
breakpointAttributes.remove(ATTR_FILE_NAME);
- testConsoleBreakpoint(
- ICFunctionBreakpoint.class,
- breakpointAttributes);
+ testConsoleBreakpoint(ICFunctionBreakpoint.class, breakpointAttributes);
}
@Test
public void testValidAddressBreakpoints() throws Throwable {
- testConsoleBreakpoint(
- ICAddressBreakpoint.class,
+ testConsoleBreakpoint(ICAddressBreakpoint.class,
getLocationBreakpointAttributes(ICAddressBreakpoint.class, true));
}
@Test
public void testAddressBreakpointsAtZeroAddress() throws Throwable {
- testConsoleBreakpoint(
- ICAddressBreakpoint.class,
+ testConsoleBreakpoint(ICAddressBreakpoint.class,
getLocationBreakpointAttributes(ICAddressBreakpoint.class, false));
}
@Test
public void testWriteWatchpoints() throws Throwable {
- testConsoleBreakpoint(
- ICWatchpoint.class,
- getWatchpointAttributes(ICWatchpoint.class, false, true));
+ testConsoleBreakpoint(ICWatchpoint.class, getWatchpointAttributes(ICWatchpoint.class, false, true));
}
@Test
public void testReadWatchpoints() throws Throwable {
- testConsoleBreakpoint(
- ICWatchpoint.class,
- getWatchpointAttributes(ICWatchpoint.class, true, false));
+ testConsoleBreakpoint(ICWatchpoint.class, getWatchpointAttributes(ICWatchpoint.class, true, false));
}
@Test
public void testAccessWatchpoints() throws Throwable {
- testConsoleBreakpoint(
- ICWatchpoint.class,
- getWatchpointAttributes(ICWatchpoint.class, true, true));
+ testConsoleBreakpoint(ICWatchpoint.class, getWatchpointAttributes(ICWatchpoint.class, true, true));
}
-
+
/**
* Shortcut to CDIDebugModel.createFunctionBreakpoint
*/
private static void createFunctionBreakpoint(String filename, String function) throws CoreException {
- CDIDebugModel.createFunctionBreakpoint(filename, ResourcesPlugin.getWorkspace().getRoot(), 0,
- function, -1, -1, -1, true, 0, "", true);
+ CDIDebugModel.createFunctionBreakpoint(filename, ResourcesPlugin.getWorkspace().getRoot(), 0, function, -1, -1,
+ -1, true, 0, "", true);
}
private List<IBreakpoint> getPlatformBreakpoints(Predicate<IBreakpoint> predicate) {
@@ -405,7 +387,6 @@ public class GDBConsoleBreakpointsTest extends BaseParametrizedTestCase {
assertEquals(0, getTargetBreakpoints().length);
}
-
/**
* Check that console inserted breakpoint with explicit file shares platform breakpoint
* with a file. This means that when the 1 platform breakpoint is deleted, both
@@ -496,10 +477,10 @@ public class GDBConsoleBreakpointsTest extends BaseParametrizedTestCase {
@DsfServiceEventHandler
public void eventDispatched(IBreakpointsChangedEvent e) {
- synchronized(this) {
- fBreakpointEvents.add(e);
- notifyAll();
- }
+ synchronized (this) {
+ fBreakpointEvents.add(e);
+ notifyAll();
+ }
}
/**
@@ -527,11 +508,12 @@ public class GDBConsoleBreakpointsTest extends BaseParametrizedTestCase {
}
}
- private void testConsoleBreakpointStandard(Class<? extends ICBreakpoint> type, Map<String, Object> attributes, Runnable flushCache) throws Throwable {
- // Set a console breakpoint and verify that
- // the corresponding platform breakpoint is created
+ private void testConsoleBreakpointStandard(Class<? extends ICBreakpoint> type, Map<String, Object> attributes,
+ Runnable flushCache) throws Throwable {
+ // Set a console breakpoint and verify that
+ // the corresponding platform breakpoint is created
// and its install count is 1 if the breakpoint is installed
- // and 0 if the breakpoint is pending.
+ // and 0 if the breakpoint is pending.
// Check for a duplicate target breakpoint.
setConsoleBreakpoint(type, attributes);
MIBreakpoint[] miBpts = getTargetBreakpoints();
@@ -541,51 +523,50 @@ public class GDBConsoleBreakpointsTest extends BaseParametrizedTestCase {
Assert.assertTrue(getPlatformBreakpointCount() == 1);
ICBreakpoint plBpt = findPlatformBreakpoint(type, attributes);
Assert.assertTrue(plBpt instanceof CBreakpoint);
- // We can't rely on IBreakpointsAddedEvent because it is fired
+ // We can't rely on IBreakpointsAddedEvent because it is fired
// before the install count is incremented.
if (!miBpts[0].isPending()) {
// If the target breakpoint is not pending wait
// until the install count becomes 1.
- waitForInstallCountChange((CBreakpoint)plBpt, 1);
- }
- else {
- // For pending breakpoints the install count is expected to remain
+ waitForInstallCountChange((CBreakpoint) plBpt, 1);
+ } else {
+ // For pending breakpoints the install count is expected to remain
// unchanged. Give it some time and verify that it is 0.
Thread.sleep(1000);
- Assert.assertTrue(((CBreakpoint)plBpt).getInstallCount() == 0);
+ Assert.assertTrue(((CBreakpoint) plBpt).getInstallCount() == 0);
}
- // Disable the console breakpoint and verify that
+ // Disable the console breakpoint and verify that
// the platform breakpoint is disabled.
enableConsoleBreakpoint(miBpts[0].getNumber(), false);
flushCache.run();
waitForBreakpointEvent(IBreakpointsUpdatedEvent.class);
Assert.assertTrue(!plBpt.isEnabled());
- // Enable the console breakpoint and verify that
+ // Enable the console breakpoint and verify that
// the platform breakpoint is enabled.
enableConsoleBreakpoint(miBpts[0].getNumber(), true);
flushCache.run();
waitForBreakpointEvent(IBreakpointsUpdatedEvent.class);
Assert.assertTrue(plBpt.isEnabled());
- // Set the condition of the console breakpoint and
- // verify that the platform breakpoint's condition
+ // Set the condition of the console breakpoint and
+ // verify that the platform breakpoint's condition
// is updated.
setConsoleBreakpointCondition(miBpts[0].getNumber(), "path==0");
flushCache.run();
waitForBreakpointEvent(IBreakpointsUpdatedEvent.class);
Assert.assertTrue(plBpt.getCondition().equals("path==0"));
- // Reset the condition of the console breakpoint and
- // verify that the platform breakpoint's condition
+ // Reset the condition of the console breakpoint and
+ // verify that the platform breakpoint's condition
// is updated.
setConsoleBreakpointCondition(miBpts[0].getNumber(), "");
flushCache.run();
waitForBreakpointEvent(IBreakpointsUpdatedEvent.class);
Assert.assertTrue(plBpt.getCondition().isEmpty());
- // Delete the console breakpoint and verify that
+ // Delete the console breakpoint and verify that
// the install count of the platform breakpoint is 0.
deleteConsoleBreakpoint(miBpts[0].getNumber());
flushCache.run();
@@ -593,18 +574,17 @@ public class GDBConsoleBreakpointsTest extends BaseParametrizedTestCase {
Assert.assertTrue(getPlatformBreakpointCount() == 1);
plBpt = findPlatformBreakpoint(type, attributes);
Assert.assertTrue(plBpt instanceof CBreakpoint);
- waitForInstallCountChange((CBreakpoint)plBpt, 0);
-
+ waitForInstallCountChange((CBreakpoint) plBpt, 0);
+
// Make sure the breakpoint does not get re-installed
// once it gets a notification that the platform bp changed
// (through its install count changing) Bug 433044
// Give it some time and verify that it is still 0.
- Thread.sleep(3000); // One second was not enough
- Assert.assertTrue("Install count no longer 0",
- ((CBreakpoint)plBpt).getInstallCount() == 0);
+ Thread.sleep(3000); // One second was not enough
+ Assert.assertTrue("Install count no longer 0", ((CBreakpoint) plBpt).getInstallCount() == 0);
- // Set the console breakpoint again and verify that
- // the install count of the platform breakpoint is 1
+ // Set the console breakpoint again and verify that
+ // the install count of the platform breakpoint is 1
// for installed breakpoints and 0 for pending breakpoints.
setConsoleBreakpoint(type, attributes);
miBpts = getTargetBreakpoints();
@@ -612,7 +592,7 @@ public class GDBConsoleBreakpointsTest extends BaseParametrizedTestCase {
flushCache.run();
waitForBreakpointEvent(IBreakpointsAddedEvent.class);
Assert.assertTrue(getPlatformBreakpointCount() == 1);
-
+
// Give a little delay to allow queued Executor operations
// to complete before deleting the breakpoint again.
// If we don't we may delete it so fast that the MIBreakpointsManager
@@ -623,19 +603,18 @@ public class GDBConsoleBreakpointsTest extends BaseParametrizedTestCase {
plBpt = findPlatformBreakpoint(type, attributes);
Assert.assertTrue(plBpt instanceof CBreakpoint);
if (!miBpts[0].isPending()) {
- waitForInstallCountChange((CBreakpoint)plBpt, 1);
- }
- else {
- // For pending breakpoints the install count is expected to remain
+ waitForInstallCountChange((CBreakpoint) plBpt, 1);
+ } else {
+ // For pending breakpoints the install count is expected to remain
// unchanged. Give it some time and verify that it is 0.
Thread.sleep(1000);
- Assert.assertTrue(((CBreakpoint)plBpt).getInstallCount() == 0);
+ Assert.assertTrue(((CBreakpoint) plBpt).getInstallCount() == 0);
}
- // Remove the platform breakpoint and verify that
+ // Remove the platform breakpoint and verify that
// the target breakpoint is deleted.
deletePlatformBreakpoint(plBpt);
-
+
// Don't fail right away if we don't get the breakpoint event
// as we can't tell the true cause.
// Let further checks happen to help figure things out.
@@ -646,25 +625,27 @@ public class GDBConsoleBreakpointsTest extends BaseParametrizedTestCase {
} catch (Exception e) {
failure += e.getMessage();
}
-
+
int platformBp = getPlatformBreakpointCount();
if (platformBp != 0) {
- if (!failure.isEmpty()) failure += ", ";
+ if (!failure.isEmpty())
+ failure += ", ";
failure += "Platform breakpoints remaining: " + platformBp;
}
-
+
miBpts = getTargetBreakpoints();
if (miBpts.length != 0) {
- if (!failure.isEmpty()) failure += ", ";
+ if (!failure.isEmpty())
+ failure += ", ";
failure += "Target breakpoints remaining: " + miBpts.length;
}
-
+
Assert.assertTrue(failure, failure.isEmpty());
}
- private void setConsoleLineBreakpoint(String fileName, int lineNumber) throws Throwable {
- queueConsoleCommand(String.format("break %s:%d", fileName, lineNumber));
- }
+ private void setConsoleLineBreakpoint(String fileName, int lineNumber) throws Throwable {
+ queueConsoleCommand(String.format("break %s:%d", fileName, lineNumber));
+ }
private void setConsoleFunctionBreakpoint(String fileName, String function) throws Throwable {
if (fileName == null) {
@@ -674,39 +655,38 @@ public class GDBConsoleBreakpointsTest extends BaseParametrizedTestCase {
}
}
- private void setConsoleAddressBreakpoint(String address) throws Throwable {
- queueConsoleCommand(String.format("break *%s", address));
- }
+ private void setConsoleAddressBreakpoint(String address) throws Throwable {
+ queueConsoleCommand(String.format("break *%s", address));
+ }
- private void setConsoleWatchpoint(String expression, boolean read, boolean write) throws Throwable {
- String command = (write) ? ((read) ? "awatch" : "watch") : "rwatch";
- queueConsoleCommand(String.format("%s %s", command, expression));
- }
+ private void setConsoleWatchpoint(String expression, boolean read, boolean write) throws Throwable {
+ String command = (write) ? ((read) ? "awatch" : "watch") : "rwatch";
+ queueConsoleCommand(String.format("%s %s", command, expression));
+ }
- private void deleteConsoleBreakpoint(String bpId) throws Throwable {
- queueConsoleCommand(String.format("delete %s", bpId));
- }
+ private void deleteConsoleBreakpoint(String bpId) throws Throwable {
+ queueConsoleCommand(String.format("delete %s", bpId));
+ }
- private void enableConsoleBreakpoint(String bpId, boolean enable) throws Throwable {
- String cmd = (enable) ? "enable" : "disable";
- queueConsoleCommand(String.format("%s %s", cmd, bpId));
- }
+ private void enableConsoleBreakpoint(String bpId, boolean enable) throws Throwable {
+ String cmd = (enable) ? "enable" : "disable";
+ queueConsoleCommand(String.format("%s %s", cmd, bpId));
+ }
- private void setConsoleBreakpointCondition(String bpId, String condition) throws Throwable {
- queueConsoleCommand(String.format("condition %s %s", bpId, condition));
- }
+ private void setConsoleBreakpointCondition(String bpId, String condition) throws Throwable {
+ queueConsoleCommand(String.format("condition %s %s", bpId, condition));
+ }
- private MIBreakpoint[] getTargetBreakpoints() throws Throwable {
- return getTargetBreakpoints(DEFAULT_TIMEOUT, DEFAULT_TIME_UNIT);
- }
+ private MIBreakpoint[] getTargetBreakpoints() throws Throwable {
+ return getTargetBreakpoints(DEFAULT_TIMEOUT, DEFAULT_TIME_UNIT);
+ }
- private MIBreakpoint[] getTargetBreakpoints(int timeout, TimeUnit unit) throws Throwable {
+ private MIBreakpoint[] getTargetBreakpoints(int timeout, TimeUnit unit) throws Throwable {
Query<MIBreakListInfo> query = new Query<MIBreakListInfo>() {
@Override
protected void execute(DataRequestMonitor<MIBreakListInfo> rm) {
- fCommandControl.queueCommand(
- fCommandControl.getCommandFactory().createMIBreakList(fBreakpointsDmc),
- rm);
+ fCommandControl.queueCommand(fCommandControl.getCommandFactory().createMIBreakList(fBreakpointsDmc),
+ rm);
}
};
fSession.getExecutor().execute(query);
@@ -733,196 +713,176 @@ public class GDBConsoleBreakpointsTest extends BaseParametrizedTestCase {
}
}
- private void queueConsoleCommand(String command) throws Throwable {
- queueConsoleCommand(command, DEFAULT_TIMEOUT, DEFAULT_TIME_UNIT);
- }
+ private void queueConsoleCommand(String command) throws Throwable {
+ queueConsoleCommand(command, DEFAULT_TIMEOUT, DEFAULT_TIME_UNIT);
+ }
- private void queueConsoleCommand(final String command, int timeout, TimeUnit unit) throws Throwable {
+ private void queueConsoleCommand(final String command, int timeout, TimeUnit unit) throws Throwable {
Query<MIInfo> query = new Query<MIInfo>() {
@Override
protected void execute(DataRequestMonitor<MIInfo> rm) {
- fCommandControl.queueCommand(
- fCommandControl.getCommandFactory().createMIInterpreterExecConsole(
- fCommandControl.getContext(),
- command),
- rm);
+ fCommandControl.queueCommand(fCommandControl.getCommandFactory()
+ .createMIInterpreterExecConsole(fCommandControl.getContext(), command), rm);
}
};
fSession.getExecutor().execute(query);
query.get(timeout, unit);
- }
-
- private ICLineBreakpoint findPlatformLineBreakpoint(String fileName, int lineNumber) throws Throwable {
- for(IBreakpoint b : DebugPlugin.getDefault().getBreakpointManager().getBreakpoints()) {
- if (b instanceof ICLineBreakpoint
- && fileName.equals(((ICLineBreakpoint)b).getSourceHandle())
- && lineNumber == ((ICLineBreakpoint)b).getLineNumber()) {
- return (ICLineBreakpoint)b;
- }
- }
- return null;
- }
-
- private ICFunctionBreakpoint findPlatformFunctionBreakpoint(String fileName, String function) throws Throwable {
- for(IBreakpoint b : DebugPlugin.getDefault().getBreakpointManager().getBreakpoints()) {
- if (b instanceof ICFunctionBreakpoint
- && Objects.equals(fileName, ((ICLineBreakpoint)b).getSourceHandle())
- && function.equals(((ICLineBreakpoint)b).getFunction())) {
- return (ICFunctionBreakpoint)b;
- }
- }
- return null;
- }
-
- private ICAddressBreakpoint findPlatformAddressBreakpoint(String address) throws Throwable {
- Addr64 a = new Addr64(address);
- for(IBreakpoint b : DebugPlugin.getDefault().getBreakpointManager().getBreakpoints()) {
- if (b instanceof ICAddressBreakpoint
- && a.toHexAddressString().equals(((ICAddressBreakpoint)b).getAddress())) {
- return (ICAddressBreakpoint)b;
- }
- }
- return null;
- }
-
- private ICWatchpoint findPlatformWatchpoint(String expression, boolean read, boolean write) throws Throwable {
- for(IBreakpoint b : DebugPlugin.getDefault().getBreakpointManager().getBreakpoints()) {
- if (b instanceof ICWatchpoint
- && ((ICWatchpoint)b).isReadType() == read
- && ((ICWatchpoint)b).isWriteType() == write) {
- return (ICWatchpoint)b;
- }
- }
- return null;
- }
-
- private void deletePlatformBreakpoint(final IBreakpoint plBpt) throws Throwable {
- new Job("") {
-
+ }
+
+ private ICLineBreakpoint findPlatformLineBreakpoint(String fileName, int lineNumber) throws Throwable {
+ for (IBreakpoint b : DebugPlugin.getDefault().getBreakpointManager().getBreakpoints()) {
+ if (b instanceof ICLineBreakpoint && fileName.equals(((ICLineBreakpoint) b).getSourceHandle())
+ && lineNumber == ((ICLineBreakpoint) b).getLineNumber()) {
+ return (ICLineBreakpoint) b;
+ }
+ }
+ return null;
+ }
+
+ private ICFunctionBreakpoint findPlatformFunctionBreakpoint(String fileName, String function) throws Throwable {
+ for (IBreakpoint b : DebugPlugin.getDefault().getBreakpointManager().getBreakpoints()) {
+ if (b instanceof ICFunctionBreakpoint && Objects.equals(fileName, ((ICLineBreakpoint) b).getSourceHandle())
+ && function.equals(((ICLineBreakpoint) b).getFunction())) {
+ return (ICFunctionBreakpoint) b;
+ }
+ }
+ return null;
+ }
+
+ private ICAddressBreakpoint findPlatformAddressBreakpoint(String address) throws Throwable {
+ Addr64 a = new Addr64(address);
+ for (IBreakpoint b : DebugPlugin.getDefault().getBreakpointManager().getBreakpoints()) {
+ if (b instanceof ICAddressBreakpoint
+ && a.toHexAddressString().equals(((ICAddressBreakpoint) b).getAddress())) {
+ return (ICAddressBreakpoint) b;
+ }
+ }
+ return null;
+ }
+
+ private ICWatchpoint findPlatformWatchpoint(String expression, boolean read, boolean write) throws Throwable {
+ for (IBreakpoint b : DebugPlugin.getDefault().getBreakpointManager().getBreakpoints()) {
+ if (b instanceof ICWatchpoint && ((ICWatchpoint) b).isReadType() == read
+ && ((ICWatchpoint) b).isWriteType() == write) {
+ return (ICWatchpoint) b;
+ }
+ }
+ return null;
+ }
+
+ private void deletePlatformBreakpoint(final IBreakpoint plBpt) throws Throwable {
+ new Job("") {
+
@Override
protected IStatus run(IProgressMonitor monitor) {
- IStatus result = Status.OK_STATUS;
+ IStatus result = Status.OK_STATUS;
try {
DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint(plBpt, true);
- }
- catch(CoreException e) {
+ } catch (CoreException e) {
result = e.getStatus();
}
return result;
}
}.schedule();
- }
+ }
- private int getPlatformBreakpointCount() {
- return DebugPlugin.getDefault().getBreakpointManager().getBreakpoints().length;
- }
+ private int getPlatformBreakpointCount() {
+ return DebugPlugin.getDefault().getBreakpointManager().getBreakpoints().length;
+ }
- private void waitForInstallCountChange(CBreakpoint plBpt, int expected) throws Throwable {
- waitForInstallCountChange(plBpt, expected, DEFAULT_TIMEOUT);
- }
+ private void waitForInstallCountChange(CBreakpoint plBpt, int expected) throws Throwable {
+ waitForInstallCountChange(plBpt, expected, DEFAULT_TIMEOUT);
+ }
- private void waitForInstallCountChange(CBreakpoint plBpt, int expected, long timeout) throws Throwable {
+ private void waitForInstallCountChange(CBreakpoint plBpt, int expected, long timeout) throws Throwable {
long startMs = System.currentTimeMillis();
- while(plBpt.getInstallCount() != expected) {
- synchronized(this) {
+ while (plBpt.getInstallCount() != expected) {
+ synchronized (this) {
try {
wait(30);
- }
- catch (InterruptedException ex) {
+ } catch (InterruptedException ex) {
}
if (System.currentTimeMillis() - startMs > timeout) {
throw new Exception("Timed out waiting for breakpoint's install count to change");
}
}
}
- }
+ }
- private synchronized boolean breakpointEventReceived(Class<? extends IBreakpointsChangedEvent> eventType) {
+ private synchronized boolean breakpointEventReceived(Class<? extends IBreakpointsChangedEvent> eventType) {
for (IBreakpointsChangedEvent e : fBreakpointEvents) {
if (eventType.isAssignableFrom(e.getClass())) {
return fBreakpointEvents.remove(e);
}
}
return false;
- }
-
- private Map<String, Object> getLocationBreakpointAttributes(Class<? extends ICBreakpoint> type, boolean valid) {
- Map<String, Object> map = new HashMap<String, Object>();
- if (ICFunctionBreakpoint.class.equals(type)) {
- map.put(ATTR_FILE_NAME, (valid) ? SOURCE_NAME_VALID : SOURCE_NAME_INVALID);
- map.put(ATTR_FUNCTION, (valid) ? FUNCTION_VALID : FUNCTION_INVALID);
- }
- else if (ICAddressBreakpoint.class.equals(type)) {
- // '0x0" is not invalid address
- map.put(ATTR_ADDRESS, (valid) ?
- getInitialStoppedEvent().getFrame().getAddress() :
- new Addr64("0x0").toHexAddressString());
- }
- else if (ICLineBreakpoint.class.equals(type)) {
- map.put(ATTR_FILE_NAME, (valid) ? SOURCE_NAME_VALID : SOURCE_NAME_INVALID);
- map.put(ATTR_LINE_NUMBER, (valid) ? LINE_NUMBER_VALID : LINE_NUMBER_INVALID);
- }
- return map;
- }
-
- public Map<String, Object> getWatchpointAttributes(Class<? extends ICWatchpoint> type, boolean read, boolean write) throws Throwable {
- Assert.assertTrue(read || write);
- Map<String, Object> map = new HashMap<String, Object>();
+ }
+
+ private Map<String, Object> getLocationBreakpointAttributes(Class<? extends ICBreakpoint> type, boolean valid) {
+ Map<String, Object> map = new HashMap<String, Object>();
+ if (ICFunctionBreakpoint.class.equals(type)) {
+ map.put(ATTR_FILE_NAME, (valid) ? SOURCE_NAME_VALID : SOURCE_NAME_INVALID);
+ map.put(ATTR_FUNCTION, (valid) ? FUNCTION_VALID : FUNCTION_INVALID);
+ } else if (ICAddressBreakpoint.class.equals(type)) {
+ // '0x0" is not invalid address
+ map.put(ATTR_ADDRESS, (valid) ? getInitialStoppedEvent().getFrame().getAddress()
+ : new Addr64("0x0").toHexAddressString());
+ } else if (ICLineBreakpoint.class.equals(type)) {
+ map.put(ATTR_FILE_NAME, (valid) ? SOURCE_NAME_VALID : SOURCE_NAME_INVALID);
+ map.put(ATTR_LINE_NUMBER, (valid) ? LINE_NUMBER_VALID : LINE_NUMBER_INVALID);
+ }
+ return map;
+ }
+
+ public Map<String, Object> getWatchpointAttributes(Class<? extends ICWatchpoint> type, boolean read, boolean write)
+ throws Throwable {
+ Assert.assertTrue(read || write);
+ Map<String, Object> map = new HashMap<String, Object>();
map.put(ATTR_EXPRESSION, EXPRESSION_VALID);
map.put(ATTR_READ, Boolean.valueOf(read));
map.put(ATTR_WRITE, Boolean.valueOf(write));
- return map;
- }
-
- private void setConsoleBreakpoint(Class<? extends ICBreakpoint> type, Map<String, Object> attributes) throws Throwable {
- if (ICFunctionBreakpoint.class.equals(type)) {
- setConsoleFunctionBreakpoint(
- (String)attributes.get(ATTR_FILE_NAME),
- (String)attributes.get(ATTR_FUNCTION));
- }
- else if (ICAddressBreakpoint.class.equals(type)) {
- setConsoleAddressBreakpoint((String)attributes.get(ATTR_ADDRESS));
- }
- else if (ICLineBreakpoint.class.equals(type)) {
- setConsoleLineBreakpoint(
- (String)attributes.get(ATTR_FILE_NAME),
- ((Integer)attributes.get(ATTR_LINE_NUMBER)).intValue());
- }
- else if (ICWatchpoint.class.equals(type)) {
- setConsoleWatchpoint(
- (String)attributes.get(ATTR_EXPRESSION),
- ((Boolean)attributes.get(ATTR_READ)).booleanValue(),
- ((Boolean)attributes.get(ATTR_WRITE)).booleanValue());
- }
- }
-
- private ICBreakpoint findPlatformBreakpoint(Class<? extends ICBreakpoint> type, Map<String, Object> attributes) throws Throwable {
- if (ICFunctionBreakpoint.class.equals(type)) {
- return findPlatformFunctionBreakpoint(
- (String)attributes.get(ATTR_FILE_NAME),
- (String)attributes.get(ATTR_FUNCTION));
- }
- else if (ICAddressBreakpoint.class.equals(type)) {
- return findPlatformAddressBreakpoint((String)attributes.get(ATTR_ADDRESS));
- }
- else if (ICLineBreakpoint.class.equals(type)) {
- return findPlatformLineBreakpoint(
- (String)attributes.get(ATTR_FILE_NAME),
- ((Integer)attributes.get(ATTR_LINE_NUMBER)).intValue());
- }
- else if (ICWatchpoint.class.equals(type)) {
- return findPlatformWatchpoint(
- (String)attributes.get(ATTR_EXPRESSION),
- ((Boolean)attributes.get(ATTR_READ)).booleanValue(),
- ((Boolean)attributes.get(ATTR_WRITE)).booleanValue());
- }
- throw new Exception(String.format("Invalid breakpoint type: %s", type.getName()));
- }
-
- private void deleteAllPlatformBreakpoints() throws Exception {
- IBreakpointManager bm = DebugPlugin.getDefault().getBreakpointManager();
- for (IBreakpoint b : bm.getBreakpoints()) {
- bm.removeBreakpoint(b, true);
- }
- }
+ return map;
+ }
+
+ private void setConsoleBreakpoint(Class<? extends ICBreakpoint> type, Map<String, Object> attributes)
+ throws Throwable {
+ if (ICFunctionBreakpoint.class.equals(type)) {
+ setConsoleFunctionBreakpoint((String) attributes.get(ATTR_FILE_NAME),
+ (String) attributes.get(ATTR_FUNCTION));
+ } else if (ICAddressBreakpoint.class.equals(type)) {
+ setConsoleAddressBreakpoint((String) attributes.get(ATTR_ADDRESS));
+ } else if (ICLineBreakpoint.class.equals(type)) {
+ setConsoleLineBreakpoint((String) attributes.get(ATTR_FILE_NAME),
+ ((Integer) attributes.get(ATTR_LINE_NUMBER)).intValue());
+ } else if (ICWatchpoint.class.equals(type)) {
+ setConsoleWatchpoint((String) attributes.get(ATTR_EXPRESSION),
+ ((Boolean) attributes.get(ATTR_READ)).booleanValue(),
+ ((Boolean) attributes.get(ATTR_WRITE)).booleanValue());
+ }
+ }
+
+ private ICBreakpoint findPlatformBreakpoint(Class<? extends ICBreakpoint> type, Map<String, Object> attributes)
+ throws Throwable {
+ if (ICFunctionBreakpoint.class.equals(type)) {
+ return findPlatformFunctionBreakpoint((String) attributes.get(ATTR_FILE_NAME),
+ (String) attributes.get(ATTR_FUNCTION));
+ } else if (ICAddressBreakpoint.class.equals(type)) {
+ return findPlatformAddressBreakpoint((String) attributes.get(ATTR_ADDRESS));
+ } else if (ICLineBreakpoint.class.equals(type)) {
+ return findPlatformLineBreakpoint((String) attributes.get(ATTR_FILE_NAME),
+ ((Integer) attributes.get(ATTR_LINE_NUMBER)).intValue());
+ } else if (ICWatchpoint.class.equals(type)) {
+ return findPlatformWatchpoint((String) attributes.get(ATTR_EXPRESSION),
+ ((Boolean) attributes.get(ATTR_READ)).booleanValue(),
+ ((Boolean) attributes.get(ATTR_WRITE)).booleanValue());
+ }
+ throw new Exception(String.format("Invalid breakpoint type: %s", type.getName()));
+ }
+
+ private void deleteAllPlatformBreakpoints() throws Exception {
+ IBreakpointManager bm = DebugPlugin.getDefault().getBreakpointManager();
+ for (IBreakpoint b : bm.getBreakpoints()) {
+ bm.removeBreakpoint(b, true);
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBConsoleSynchronizingTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBConsoleSynchronizingTest.java
index 655b5d29f4f..e9d67881067 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBConsoleSynchronizingTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBConsoleSynchronizingTest.java
@@ -77,72 +77,73 @@ public class GDBConsoleSynchronizingTest extends BaseParametrizedTestCase {
private List<IDMEvent<? extends IDMContext>> fEventsReceived = new ArrayList<IDMEvent<? extends IDMContext>>();
- @Override
- protected void setLaunchAttributes() {
- super.setLaunchAttributes();
- setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EXEC_PATH + EXEC_NAME);
- }
-
- @Override
- public void doBeforeTest() throws Exception {
- assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_6);
- super.doBeforeTest();
-
- fSession = getGDBLaunch().getSession();
- Runnable runnable = new Runnable() {
- @Override
+ @Override
+ protected void setLaunchAttributes() {
+ super.setLaunchAttributes();
+ setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EXEC_PATH + EXEC_NAME);
+ }
+
+ @Override
+ public void doBeforeTest() throws Exception {
+ assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_6);
+ super.doBeforeTest();
+
+ fSession = getGDBLaunch().getSession();
+ Runnable runnable = new Runnable() {
+ @Override
public void run() {
- fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
- Assert.assertTrue(fServicesTracker != null);
+ fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
+ Assert.assertTrue(fServicesTracker != null);
- fCommandControl = fServicesTracker.getService(IGDBControl.class);
- Assert.assertTrue(fCommandControl != null);
+ fCommandControl = fServicesTracker.getService(IGDBControl.class);
+ Assert.assertTrue(fCommandControl != null);
- fMemoryService = fServicesTracker.getService(IMemory.class);
- Assert.assertTrue(fMemoryService != null);
+ fMemoryService = fServicesTracker.getService(IMemory.class);
+ Assert.assertTrue(fMemoryService != null);
- fExprService = fServicesTracker.getService(IExpressions.class);
- Assert.assertTrue(fExprService != null);
+ fExprService = fServicesTracker.getService(IExpressions.class);
+ Assert.assertTrue(fExprService != null);
- fRunControl = fServicesTracker.getService(IRunControl.class);
- Assert.assertTrue(fRunControl != null);
+ fRunControl = fServicesTracker.getService(IRunControl.class);
+ Assert.assertTrue(fRunControl != null);
- // Register to breakpoint events
- fSession.addServiceEventListener(GDBConsoleSynchronizingTest.this, null);
- }
- };
- fSession.getExecutor().submit(runnable).get();
- }
+ // Register to breakpoint events
+ fSession.addServiceEventListener(GDBConsoleSynchronizingTest.this, null);
+ }
+ };
+ fSession.getExecutor().submit(runnable).get();
+ }
- @Override
- public void doAfterTest() throws Exception {
+ @Override
+ public void doAfterTest() throws Exception {
if (fSession != null) {
fSession.getExecutor().submit(() -> fSession.removeServiceEventListener(GDBConsoleSynchronizingTest.this))
.get();
}
- fEventsReceived.clear();
- if (fServicesTracker!=null) fServicesTracker.dispose();
- super.doAfterTest();
- }
+ fEventsReceived.clear();
+ if (fServicesTracker != null)
+ fServicesTracker.dispose();
+ super.doAfterTest();
+ }
//////////////////////////////////////////////////////////////////////////////////////
// Start of tests
//////////////////////////////////////////////////////////////////////////////////////
- /**
- * This test verifies that setting a variable from the console
- * using the set command will properly trigger a DSF event to
- * indicate the change. This test makes sure the value that
- * changes is in the memory cache also.
- */
+ /**
+ * This test verifies that setting a variable from the console
+ * using the set command will properly trigger a DSF event to
+ * indicate the change. This test makes sure the value that
+ * changes is in the memory cache also.
+ */
@Test
public void testSettingVariableWithSetWithMemory() throws Throwable {
- MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("testMemoryChanges");
+ MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("testMemoryChanges");
- final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
- final IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, "i");
+ final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ final IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, "i");
- // Read the memory that will change first, or else there will be no event for it
+ // Read the memory that will change first, or else there will be no event for it
Query<IExpressionDMAddress> query = new Query<IExpressionDMAddress>() {
@Override
protected void execute(final DataRequestMonitor<IExpressionDMAddress> rm) {
@@ -153,32 +154,32 @@ public class GDBConsoleSynchronizingTest extends BaseParametrizedTestCase {
fSession.getExecutor().execute(query);
IExpressionDMAddress data = query.get();
- IMemoryDMContext memoryDmc = DMContexts.getAncestorOfType(frameDmc, IMemoryDMContext.class);
- SyncUtil.readMemory(memoryDmc, data.getAddress(), 0, 1, NEW_VAR_SIZE);
+ IMemoryDMContext memoryDmc = DMContexts.getAncestorOfType(frameDmc, IMemoryDMContext.class);
+ SyncUtil.readMemory(memoryDmc, data.getAddress(), 0, 1, NEW_VAR_SIZE);
- fEventsReceived.clear();
+ fEventsReceived.clear();
- String newValue = NEW_VAR_VALUE;
- queueConsoleCommand("set variable i=" + newValue);
+ String newValue = NEW_VAR_VALUE;
+ queueConsoleCommand("set variable i=" + newValue);
- IMemoryChangedEvent memoryEvent = waitForEvent(IMemoryChangedEvent.class);
- assertEquals(1, memoryEvent.getAddresses().length);
- assertEquals(data.getAddress(), memoryEvent.getAddresses()[0]);
+ IMemoryChangedEvent memoryEvent = waitForEvent(IMemoryChangedEvent.class);
+ assertEquals(1, memoryEvent.getAddresses().length);
+ assertEquals(data.getAddress(), memoryEvent.getAddresses()[0]);
- // Now verify the memory service knows the new memory value
- MemoryByte[] memory = SyncUtil.readMemory(memoryDmc, data.getAddress(), 0, 1, NEW_VAR_SIZE);
- assertEquals(NEW_VAR_SIZE, memory.length);
- for (int i=0; i<NEW_VAR_SIZE; i++) {
- if (memory[0].isBigEndian()) {
- assertEquals(NEW_MEM[i], memory[i].getValue());
- } else {
- assertEquals(NEW_MEM[i], memory[NEW_VAR_SIZE-1-i].getValue());
- }
- }
+ // Now verify the memory service knows the new memory value
+ MemoryByte[] memory = SyncUtil.readMemory(memoryDmc, data.getAddress(), 0, 1, NEW_VAR_SIZE);
+ assertEquals(NEW_VAR_SIZE, memory.length);
+ for (int i = 0; i < NEW_VAR_SIZE; i++) {
+ if (memory[0].isBigEndian()) {
+ assertEquals(NEW_MEM[i], memory[i].getValue());
+ } else {
+ assertEquals(NEW_MEM[i], memory[NEW_VAR_SIZE - 1 - i].getValue());
+ }
+ }
- // Now verify the expressions service knows the new value
- String exprValue = SyncUtil.getExpressionValue(exprDmc, IFormattedValues.HEX_FORMAT);
- assertEquals(newValue, exprValue);
+ // Now verify the expressions service knows the new value
+ String exprValue = SyncUtil.getExpressionValue(exprDmc, IFormattedValues.HEX_FORMAT);
+ assertEquals(newValue, exprValue);
}
private void testSettingVariableWithCommon(String commandPrefix) throws Throwable {
@@ -211,11 +212,11 @@ public class GDBConsoleSynchronizingTest extends BaseParametrizedTestCase {
IMemoryDMContext memoryDmc = DMContexts.getAncestorOfType(frameDmc, IMemoryDMContext.class);
MemoryByte[] memory = SyncUtil.readMemory(memoryDmc, data.getAddress(), 0, 1, NEW_VAR_SIZE);
assertEquals(NEW_VAR_SIZE, memory.length);
- for (int i=0; i<NEW_VAR_SIZE; i++) {
+ for (int i = 0; i < NEW_VAR_SIZE; i++) {
if (memory[0].isBigEndian()) {
assertEquals(NEW_MEM[i], memory[i].getValue());
} else {
- assertEquals(NEW_MEM[i], memory[NEW_VAR_SIZE-1-i].getValue());
+ assertEquals(NEW_MEM[i], memory[NEW_VAR_SIZE - 1 - i].getValue());
}
}
@@ -224,39 +225,39 @@ public class GDBConsoleSynchronizingTest extends BaseParametrizedTestCase {
assertEquals(newValue, exprValue);
}
- /**
- * This test verifies that setting a variable from the console
- * using the set command will properly trigger a DSF event to
- * indicate the change, when the address is not in the memory cache.
- */
+ /**
+ * This test verifies that setting a variable from the console
+ * using the set command will properly trigger a DSF event to
+ * indicate the change, when the address is not in the memory cache.
+ */
@Test
public void testSettingVariableWithSet() throws Throwable {
testSettingVariableWithCommon("set variable i");
}
- /**
- * This test verifies that setting a variable from the console
- * using the print command will properly trigger a DSF event
- * to indicate the change.
- */
+ /**
+ * This test verifies that setting a variable from the console
+ * using the print command will properly trigger a DSF event
+ * to indicate the change.
+ */
@Test
public void testSettingVariableWithPrint() throws Throwable {
testSettingVariableWithCommon("print i");
}
/**
- * This test verifies that setting a memory location from the
- * console will properly trigger a DSF event to indicate the change.
- */
+ * This test verifies that setting a memory location from the
+ * console will properly trigger a DSF event to indicate the change.
+ */
@Test
public void testSettingMemory() throws Throwable {
- MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("testMemoryChanges");
+ MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("testMemoryChanges");
- final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
- final IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, "i");
+ final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ final IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, "i");
- // Read the memory that will change first, or else there will be no event for it
- Query<IExpressionDMAddress> query = new Query<IExpressionDMAddress>() {
+ // Read the memory that will change first, or else there will be no event for it
+ Query<IExpressionDMAddress> query = new Query<IExpressionDMAddress>() {
@Override
protected void execute(final DataRequestMonitor<IExpressionDMAddress> rm) {
fExprService.getExpressionAddressData(exprDmc, rm);
@@ -266,41 +267,41 @@ public class GDBConsoleSynchronizingTest extends BaseParametrizedTestCase {
fSession.getExecutor().execute(query);
IExpressionDMAddress data = query.get();
- fEventsReceived.clear();
-
- final String newValue = NEW_VAR_VALUE;
- queueConsoleCommand("set {int}&i=" + newValue);
-
- IMemoryChangedEvent memoryEvent = waitForEvent(IMemoryChangedEvent.class);
- assertEquals(1, memoryEvent.getAddresses().length);
- assertEquals(data.getAddress(), memoryEvent.getAddresses()[0]);
-
- // Now verify the memory service knows the new memory value
- IMemoryDMContext memoryDmc = DMContexts.getAncestorOfType(frameDmc, IMemoryDMContext.class);
- MemoryByte[] memory = SyncUtil.readMemory(memoryDmc, data.getAddress(), 0, 1, NEW_VAR_SIZE);
- assertEquals(NEW_VAR_SIZE, memory.length);
- for (int i=0; i<NEW_VAR_SIZE; i++) {
- if (memory[0].isBigEndian()) {
- assertEquals(NEW_MEM[i], memory[i].getValue());
- } else {
- assertEquals(NEW_MEM[i], memory[NEW_VAR_SIZE-1-i].getValue());
- }
- }
-
- // Now verify the expressions service knows the new value
- String exprValue = SyncUtil.getExpressionValue(exprDmc, IFormattedValues.HEX_FORMAT);
- assertEquals(newValue, exprValue);
+ fEventsReceived.clear();
+
+ final String newValue = NEW_VAR_VALUE;
+ queueConsoleCommand("set {int}&i=" + newValue);
+
+ IMemoryChangedEvent memoryEvent = waitForEvent(IMemoryChangedEvent.class);
+ assertEquals(1, memoryEvent.getAddresses().length);
+ assertEquals(data.getAddress(), memoryEvent.getAddresses()[0]);
+
+ // Now verify the memory service knows the new memory value
+ IMemoryDMContext memoryDmc = DMContexts.getAncestorOfType(frameDmc, IMemoryDMContext.class);
+ MemoryByte[] memory = SyncUtil.readMemory(memoryDmc, data.getAddress(), 0, 1, NEW_VAR_SIZE);
+ assertEquals(NEW_VAR_SIZE, memory.length);
+ for (int i = 0; i < NEW_VAR_SIZE; i++) {
+ if (memory[0].isBigEndian()) {
+ assertEquals(NEW_MEM[i], memory[i].getValue());
+ } else {
+ assertEquals(NEW_MEM[i], memory[NEW_VAR_SIZE - 1 - i].getValue());
+ }
+ }
+
+ // Now verify the expressions service knows the new value
+ String exprValue = SyncUtil.getExpressionValue(exprDmc, IFormattedValues.HEX_FORMAT);
+ assertEquals(newValue, exprValue);
}
/**
- * This test verifies that enabling reverse debugging from the
- * console will properly trigger a DSF event to indicate the change and
- * will be processed by the service.
- */
+ * This test verifies that enabling reverse debugging from the
+ * console will properly trigger a DSF event to indicate the change and
+ * will be processed by the service.
+ */
@Test
public void testEnableRecord() throws Throwable {
assertTrue("Reverse debugging is not supported", fRunControl instanceof IReverseRunControl);
- final IReverseRunControl reverseService = (IReverseRunControl)fRunControl;
+ final IReverseRunControl reverseService = (IReverseRunControl) fRunControl;
SyncUtil.runToLocation("testMemoryChanges");
@@ -316,16 +317,16 @@ public class GDBConsoleSynchronizingTest extends BaseParametrizedTestCase {
Boolean enabled = query.get();
assertTrue("Reverse debugging should not be enabled", !enabled);
- fEventsReceived.clear();
+ fEventsReceived.clear();
- queueConsoleCommand("record");
+ queueConsoleCommand("record");
- // Wait for the event
- IReverseModeChangedDMEvent event = waitForEvent(IReverseModeChangedDMEvent.class);
- assertEquals(true, event.isReverseModeEnabled());
+ // Wait for the event
+ IReverseModeChangedDMEvent event = waitForEvent(IReverseModeChangedDMEvent.class);
+ assertEquals(true, event.isReverseModeEnabled());
- // Check the service
- query = new Query<Boolean>() {
+ // Check the service
+ query = new Query<Boolean>() {
@Override
protected void execute(final DataRequestMonitor<Boolean> rm) {
reverseService.isReverseModeEnabled(fCommandControl.getContext(), rm);
@@ -337,14 +338,14 @@ public class GDBConsoleSynchronizingTest extends BaseParametrizedTestCase {
}
/**
- * This test verifies that disabling reverse debugging from the
- * console will properly trigger a DSF event to indicate the change and
- * will be processed by the service.
- */
+ * This test verifies that disabling reverse debugging from the
+ * console will properly trigger a DSF event to indicate the change and
+ * will be processed by the service.
+ */
@Test
public void testDisableRecord() throws Throwable {
assertTrue("Reverse debugging is not supported", fRunControl instanceof IReverseRunControl);
- final IReverseRunControl reverseService = (IReverseRunControl)fRunControl;
+ final IReverseRunControl reverseService = (IReverseRunControl) fRunControl;
SyncUtil.runToLocation("testMemoryChanges");
@@ -354,8 +355,7 @@ public class GDBConsoleSynchronizingTest extends BaseParametrizedTestCase {
Query<Boolean> query = new Query<Boolean>() {
@Override
protected void execute(final DataRequestMonitor<Boolean> rm) {
- reverseService.enableReverseMode(fCommandControl.getContext(), true,
- new ImmediateRequestMonitor(rm) {
+ reverseService.enableReverseMode(fCommandControl.getContext(), true, new ImmediateRequestMonitor(rm) {
@Override
protected void handleSuccess() {
reverseService.isReverseModeEnabled(fCommandControl.getContext(), rm);
@@ -368,19 +368,19 @@ public class GDBConsoleSynchronizingTest extends BaseParametrizedTestCase {
Boolean enabled = query.get();
assertTrue("Reverse debugging should be enabled", enabled);
- // Wait for the event to avoid confusing it with the next one
- IReverseModeChangedDMEvent event = waitForEvent(IReverseModeChangedDMEvent.class);
- assertEquals(true, event.isReverseModeEnabled());
+ // Wait for the event to avoid confusing it with the next one
+ IReverseModeChangedDMEvent event = waitForEvent(IReverseModeChangedDMEvent.class);
+ assertEquals(true, event.isReverseModeEnabled());
fEventsReceived.clear();
- queueConsoleCommand("record stop");
+ queueConsoleCommand("record stop");
- // Wait for the event
- event = waitForEvent(IReverseModeChangedDMEvent.class);
- assertEquals(false, event.isReverseModeEnabled());
+ // Wait for the event
+ event = waitForEvent(IReverseModeChangedDMEvent.class);
+ assertEquals(false, event.isReverseModeEnabled());
- // Check the service
- query = new Query<Boolean>() {
+ // Check the service
+ query = new Query<Boolean>() {
@Override
protected void execute(final DataRequestMonitor<Boolean> rm) {
reverseService.isReverseModeEnabled(fCommandControl.getContext(), rm);
@@ -395,46 +395,43 @@ public class GDBConsoleSynchronizingTest extends BaseParametrizedTestCase {
// End of tests
//////////////////////////////////////////////////////////////////////////////////////
- @DsfServiceEventHandler
+ @DsfServiceEventHandler
public void eventDispatched(IDMEvent<? extends IDMContext> e) {
- synchronized(this) {
- fEventsReceived.add(e);
- notifyAll();
- }
- }
+ synchronized (this) {
+ fEventsReceived.add(e);
+ notifyAll();
+ }
+ }
- private void queueConsoleCommand(String command) throws Throwable {
- queueConsoleCommand(command, DEFAULT_TIMEOUT, DEFAULT_TIME_UNIT);
- }
+ private void queueConsoleCommand(String command) throws Throwable {
+ queueConsoleCommand(command, DEFAULT_TIMEOUT, DEFAULT_TIME_UNIT);
+ }
- private void queueConsoleCommand(final String command, int timeout, TimeUnit unit) throws Throwable {
+ private void queueConsoleCommand(final String command, int timeout, TimeUnit unit) throws Throwable {
Query<MIInfo> query = new Query<MIInfo>() {
@Override
protected void execute(DataRequestMonitor<MIInfo> rm) {
- fCommandControl.queueCommand(
- fCommandControl.getCommandFactory().createMIInterpreterExecConsole(
- fCommandControl.getContext(),
- command),
- rm);
+ fCommandControl.queueCommand(fCommandControl.getCommandFactory()
+ .createMIInterpreterExecConsole(fCommandControl.getContext(), command), rm);
}
};
fSession.getExecutor().execute(query);
query.get(timeout, unit);
- }
+ }
- private <V extends IDMEvent<? extends IDMContext>> V waitForEvent(Class<V> eventType) throws Exception {
- return waitForEvent(eventType, DEFAULT_TIMEOUT);
- }
+ private <V extends IDMEvent<? extends IDMContext>> V waitForEvent(Class<V> eventType) throws Exception {
+ return waitForEvent(eventType, DEFAULT_TIMEOUT);
+ }
- @SuppressWarnings("unchecked")
- private <V extends IDMEvent<? extends IDMContext>> V waitForEvent(Class<V> eventType, int timeout) throws Exception {
- IDMEvent<?> event = getEvent(eventType);
- if (event == null) {
- synchronized(this) {
+ @SuppressWarnings("unchecked")
+ private <V extends IDMEvent<? extends IDMContext>> V waitForEvent(Class<V> eventType, int timeout)
+ throws Exception {
+ IDMEvent<?> event = getEvent(eventType);
+ if (event == null) {
+ synchronized (this) {
try {
wait(timeout);
- }
- catch (InterruptedException ex) {
+ } catch (InterruptedException ex) {
}
}
event = getEvent(eventType);
@@ -442,18 +439,18 @@ public class GDBConsoleSynchronizingTest extends BaseParametrizedTestCase {
throw new Exception(String.format("Timed out waiting for '%s' to occur.", eventType.getName()));
}
}
- return (V)event;
+ return (V) event;
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked")
private synchronized <V extends IDMEvent<? extends IDMContext>> V getEvent(Class<V> eventType) {
for (IDMEvent<?> e : fEventsReceived) {
if (eventType.isAssignableFrom(e.getClass())) {
fEventsReceived.remove(e);
- return (V)e;
+ return (V) e;
}
}
return null;
- }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBPatternMatchingExpressionsTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBPatternMatchingExpressionsTest.java
index f8b8962e475..1bd1b8242bf 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBPatternMatchingExpressionsTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBPatternMatchingExpressionsTest.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Marc Khouzam (Ericsson) - Initial Implementation
* Marc Khouzam (Ericsson) - Tests for Pattern Matching for variables (Bug 394408)
@@ -97,10 +97,10 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
public void doAfterTest() throws Exception {
super.doAfterTest();
fExpService = null;
- if (fServicesTracker != null) {
- fServicesTracker.dispose();
- fServicesTracker = null;
- }
+ if (fServicesTracker != null) {
+ fServicesTracker.dispose();
+ fServicesTracker = null;
+ }
}
//**************************************************************************************
@@ -113,8 +113,9 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
List<String> registersFromGdb = SyncUtil.getRegistersFromGdb(getGdbVersion(), SyncUtil.getContainerContext());
return registersFromGdb.stream().map(n -> "$" + n).collect(Collectors.toCollection(LinkedList::new));
}
-
- final static String[] fAllVariables = new String[] { "firstarg", "firstvar", "ptrvar", "secondarg", "secondvar", "var", "var2" };
+
+ final static String[] fAllVariables = new String[] { "firstarg", "firstvar", "ptrvar", "secondarg", "secondvar",
+ "var", "var2" };
protected void checkChildrenCount(final IExpressionDMContext parentDmc, final int expectedCount) throws Throwable {
Query<Integer> query = new Query<Integer>() {
@@ -130,62 +131,62 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
assertTrue(String.format("Expected %d but got %d", expectedCount, count), count == expectedCount);
}
- protected String getRegisterValue(final String regName, final IMIExecutionDMContext threadDmc) throws Exception {
+ protected String getRegisterValue(final String regName, final IMIExecutionDMContext threadDmc) throws Exception {
Query<String> query = new Query<String>() {
@Override
protected void execute(final DataRequestMonitor<String> rm) {
- fRegService.getRegisters(threadDmc,
- new ImmediateDataRequestMonitor<IRegisterDMContext[]>(rm) {
- @Override
- protected void handleSuccess() {
- assert getData() instanceof MIRegisterDMC[];
- for (MIRegisterDMC register : (MIRegisterDMC[])getData()) {
- if (register.getName().equals(regName)) {
- final FormattedValueDMContext valueDmc = fRegService.getFormattedValueContext(register, IFormattedValues.HEX_FORMAT);
- fRegService.getFormattedExpressionValue(valueDmc, new ImmediateDataRequestMonitor<FormattedValueDMData>(rm) {
+ fRegService.getRegisters(threadDmc, new ImmediateDataRequestMonitor<IRegisterDMContext[]>(rm) {
+ @Override
+ protected void handleSuccess() {
+ assert getData() instanceof MIRegisterDMC[];
+ for (MIRegisterDMC register : (MIRegisterDMC[]) getData()) {
+ if (register.getName().equals(regName)) {
+ final FormattedValueDMContext valueDmc = fRegService.getFormattedValueContext(register,
+ IFormattedValues.HEX_FORMAT);
+ fRegService.getFormattedExpressionValue(valueDmc,
+ new ImmediateDataRequestMonitor<FormattedValueDMData>(rm) {
@Override
protected void handleSuccess() {
rm.done(getData().getFormattedValue());
};
});
- return;
- }
- }
- // If we get here, we didn't find the register!
- assertTrue("Invalid register: " + regName, false);
+ return;
}
- });
+ }
+ // If we get here, we didn't find the register!
+ assertTrue("Invalid register: " + regName, false);
+ }
+ });
}
};
fSession.getExecutor().execute(query);
- return query.get();
+ return query.get();
}
- protected String getExpressionValue(final IExpressionDMContext exprDmc) throws Throwable
- {
+ protected String getExpressionValue(final IExpressionDMContext exprDmc) throws Throwable {
Query<String> query = new Query<String>() {
@Override
protected void execute(final DataRequestMonitor<String> rm) {
- final FormattedValueDMContext valueDmc =
- fExpService.getFormattedValueContext(exprDmc, IFormattedValues.HEX_FORMAT);
+ final FormattedValueDMContext valueDmc = fExpService.getFormattedValueContext(exprDmc,
+ IFormattedValues.HEX_FORMAT);
fExpService.getFormattedExpressionValue(valueDmc,
new ImmediateDataRequestMonitor<FormattedValueDMData>(rm) {
- @Override
- protected void handleSuccess() {
- rm.done(getData().getFormattedValue());
- }
- });
+ @Override
+ protected void handleSuccess() {
+ rm.done(getData().getFormattedValue());
+ }
+ });
}
};
fSession.getExecutor().execute(query);
- return query.get();
+ return query.get();
}
// This method tests IExpressions.getSubExpressions(IExpressionDMC, int, int, DRM);
- protected IExpressionDMContext[] checkChildren(final IExpressionDMContext parentDmc, final int startIndex, final int length,
- String[] expectedValues) throws Throwable {
+ protected IExpressionDMContext[] checkChildren(final IExpressionDMContext parentDmc, final int startIndex,
+ final int length, String[] expectedValues) throws Throwable {
Query<IExpressionDMContext[]> query = new Query<IExpressionDMContext[]>() {
@Override
@@ -195,7 +196,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
};
fSession.getExecutor().execute(query);
- IExpressionDMContext[] childDmcs = query.get();
+ IExpressionDMContext[] childDmcs = query.get();
String[] childExpressions = new String[childDmcs.length];
MIExpressionDMCAccessor[] childDmcsAccessor = new MIExpressionDMCAccessor[childDmcs.length];
@@ -205,7 +206,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
for (int i = 0; i < childExpressions.length; i++) {
childDmcsAccessor[i] = new MIExpressionDMCAccessor(childDmcs[i]);
childExpressions[i] = childDmcsAccessor[i].getRelativeExpression();
- }
+ }
assertTrue("Expected " + Arrays.toString(expectedValues) + " but got " + Arrays.toString(childExpressions),
expectedValues.length == childExpressions.length);
@@ -245,7 +246,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
* Test that we can access a single variable, without using groups or patterns
*/
@Test
- public void testSingleLocal() throws Throwable {
+ public void testSingleLocal() throws Throwable {
final String exprString = "secondvar";
SyncUtil.runToLocation("foo");
@@ -275,12 +276,12 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
checkChildren(exprDmc, -1, -1, children);
checkChildrenCount(exprDmc, children.length);
}
-
+
/**
* Test that we can match a single variable
*/
@Test
- public void testMatchSingleLocal() throws Throwable {
+ public void testMatchSingleLocal() throws Throwable {
final String exprString = "=secondvar";
final String[] children = new String[] { "secondvar" };
@@ -314,7 +315,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, exprString);
checkChildren(exprDmc, -1, -1, children);
checkChildrenCount(exprDmc, children.length);
-
+
exprDmc = SyncUtil.createExpression(frameDmc, exprString2);
checkChildren(exprDmc, -1, -1, children);
checkChildrenCount(exprDmc, children.length);
@@ -374,9 +375,11 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
// Starting in GDB 8.0 FS_BASE and GS_BASE are exposed
// See GDB commit 2735833: amd64-linux: expose system register FS_BASE and GS_BASE for Linux.
// Ubuntu is shipping pre-release GDB 8.0, which is versioned as 7.12.50.
- children = new String[] { "$fctrl", "$fioff", "$fiseg", "$fooff", "$fop", "$foseg", "$fs", "$fs_base", "$fstat", "$ftag" };
+ children = new String[] { "$fctrl", "$fioff", "$fiseg", "$fooff", "$fop", "$foseg", "$fs", "$fs_base",
+ "$fstat", "$ftag" };
} else {
- children = new String[] { "$fctrl", "$fioff", "$fiseg", "$fooff", "$fop", "$foseg", "$fs", "$fstat", "$ftag" };
+ children = new String[] { "$fctrl", "$fioff", "$fiseg", "$fooff", "$fop", "$foseg", "$fs", "$fstat",
+ "$ftag" };
}
SyncUtil.runToLocation("foo");
@@ -428,7 +431,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
checkChildren(exprDmc, -1, -1, children);
checkChildrenCount(exprDmc, children.length);
}
-
+
/**
* Test that variables can be dereferenced using '*'
* without conflicting with glob-expressions
@@ -436,7 +439,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
@Test
public void testDerefVar() throws Throwable {
final String exprString = "*ptrvar";
-
+
SyncUtil.runToLocation("foo");
MIStoppedEvent stoppedEvent = SyncUtil.step(5, StepType.STEP_OVER);
@@ -447,7 +450,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
assertEquals(getExpressionValue(exprDmc), "0x12");
}
-
+
/**
* Test that variables can be matched using '*' at the end
* not to be confused with multiplication
@@ -467,7 +470,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
checkChildren(exprDmc, -1, -1, children);
checkChildrenCount(exprDmc, children.length);
}
-
+
/**
* Test that variables can be multiplied using '*'
* without conflicting with glob-expressions
@@ -475,7 +478,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
@Test
public void testMultiplyVar() throws Throwable {
final String exprString = "var*0";
-
+
SyncUtil.runToLocation("foo");
MIStoppedEvent stoppedEvent = SyncUtil.step(5, StepType.STEP_OVER);
@@ -486,7 +489,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
assertEquals(getExpressionValue(exprDmc), "0x0");
}
-
+
/**
* Test that registers can be matched using '?'
*/
@@ -505,7 +508,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
checkChildren(exprDmc, -1, -1, children);
checkChildrenCount(exprDmc, children.length);
}
-
+
/**
* Test that conditional operator can be used for registers
*/
@@ -523,6 +526,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
assertEquals(getExpressionValue(exprDmc), "0x11");
}
+
/**
* Test that variables can be matched using '?'
*/
@@ -607,7 +611,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
@Test
public void testMatchRegWithNumberRange() throws Throwable {
final String exprString = "=$st[2-5]";
- final String[] children = new String[] { "$st2","$st3", "$st4","$st5" };
+ final String[] children = new String[] { "$st2", "$st3", "$st4", "$st5" };
SyncUtil.runToLocation("foo");
MIStoppedEvent stoppedEvent = SyncUtil.step(5, StepType.STEP_OVER);
@@ -659,7 +663,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
checkChildren(exprDmc, -1, -1, children);
checkChildrenCount(exprDmc, children.length);
}
-
+
/**
* Test that arrays can be matched using [] using a range of numbers.
* In this case, we want to show the user the range of array elements.
@@ -667,7 +671,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
@Test
public void testMatchArrayWithNumberRange() throws Throwable {
final String exprString = "=array[2-5]";
- final String[] children = new String[] { "array2", "array3", "array[2]","array[3]", "array[4]","array[5]" };
+ final String[] children = new String[] { "array2", "array3", "array[2]", "array[3]", "array[4]", "array[5]" };
SyncUtil.runToLocation("testArrayMatching");
MIStoppedEvent stoppedEvent = SyncUtil.step(6, StepType.STEP_OVER);
@@ -744,11 +748,8 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
@Test
public void testMatchArrayWithWildCardAndNumberRange() throws Throwable {
final String exprString = "=ar*[2-3]";
- final String[] children = new String[] {
- "array2", "array3",
- "arrayBool[2]", "arrayBool[3]",
- "arrayInt[2]", "arrayInt[3]",
- "array[2]", "array[3]" };
+ final String[] children = new String[] { "array2", "array3", "arrayBool[2]", "arrayBool[3]", "arrayInt[2]",
+ "arrayInt[3]", "array[2]", "array[3]" };
SyncUtil.runToLocation("testArrayMatching");
MIStoppedEvent stoppedEvent = SyncUtil.step(6, StepType.STEP_OVER);
@@ -760,14 +761,14 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
checkChildren(exprDmc, -1, -1, children);
checkChildrenCount(exprDmc, children.length);
}
-
+
/**
* Test that arrays can be matched using [] and a ?.
*/
@Test
public void testMatchArrayWithQuestionMarkAndNumberRange() throws Throwable {
final String exprString = "=ar?a?[2-4]";
- final String[] children = new String[] { "array2", "array3", "array[2]","array[3]", "array[4]" };
+ final String[] children = new String[] { "array2", "array3", "array[2]", "array[3]", "array[4]" };
SyncUtil.runToLocation("testArrayMatching");
MIStoppedEvent stoppedEvent = SyncUtil.step(6, StepType.STEP_OVER);
@@ -779,7 +780,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
checkChildren(exprDmc, -1, -1, children);
checkChildrenCount(exprDmc, children.length);
}
-
+
/**
* Test that we can match all arrays using [].
* In this case, we want to show the user the range of array elements.
@@ -787,11 +788,8 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
@Test
public void testMatchAllArraysAndNumberRange() throws Throwable {
final String exprString = "=*[2-3]";
- final String[] children = new String[] {
- "array2", "array3",
- "arrayBool[2]", "arrayBool[3]",
- "arrayInt[2]", "arrayInt[3]",
- "array[2]", "array[3]" };
+ final String[] children = new String[] { "array2", "array3", "arrayBool[2]", "arrayBool[3]", "arrayInt[2]",
+ "arrayInt[3]", "array[2]", "array[3]" };
SyncUtil.runToLocation("testArrayMatching");
MIStoppedEvent stoppedEvent = SyncUtil.step(6, StepType.STEP_OVER);
@@ -803,15 +801,14 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
checkChildren(exprDmc, -1, -1, children);
checkChildrenCount(exprDmc, children.length);
}
-
+
/**
* Test that we can match arrays using [] and comma-separated indices.
*/
@Test
public void testMatchArraysWithCommaSeparatedIndices() throws Throwable {
final String exprString = "=array[2,5,8]";
- final String[] children = new String[] {
- "array2", "array[2]", "array[5]", "array[8]" };
+ final String[] children = new String[] { "array2", "array[2]", "array[5]", "array[8]" };
SyncUtil.runToLocation("testArrayMatching");
MIStoppedEvent stoppedEvent = SyncUtil.step(6, StepType.STEP_OVER);
@@ -823,18 +820,15 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
checkChildren(exprDmc, -1, -1, children);
checkChildrenCount(exprDmc, children.length);
}
-
+
/**
* Test that we can match arrays using [] and comma-separated ranges.
*/
@Test
public void testMatchArraysWithCommaSeparatedNumberRanges() throws Throwable {
final String exprString = "=array[2-3, 5, 7-8]";
- final String[] children = new String[] {
- "array2", "array3",
- "array[2]", "array[3]",
- "array[5]",
- "array[7]", "array[8]" };
+ final String[] children = new String[] { "array2", "array3", "array[2]", "array[3]", "array[5]", "array[7]",
+ "array[8]" };
SyncUtil.runToLocation("testArrayMatching");
MIStoppedEvent stoppedEvent = SyncUtil.step(6, StepType.STEP_OVER);
@@ -846,7 +840,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
checkChildren(exprDmc, -1, -1, children);
checkChildrenCount(exprDmc, children.length);
}
-
+
/**
* Test that we can match arrays using [] and comma-separated ranges
* with an overlap.
@@ -854,8 +848,8 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
@Test
public void testMatchArraysWithCommaSeparatedOverlappingRanges() throws Throwable {
final String exprString = "=array[2-3, 5, 4-6]";
- final String[] children = new String[] {
- "array2", "array3", "array[2]", "array[3]", "array[4]", "array[5]", "array[6]" };
+ final String[] children = new String[] { "array2", "array3", "array[2]", "array[3]", "array[4]", "array[5]",
+ "array[6]" };
SyncUtil.runToLocation("testArrayMatching");
MIStoppedEvent stoppedEvent = SyncUtil.step(6, StepType.STEP_OVER);
@@ -867,7 +861,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
checkChildren(exprDmc, -1, -1, children);
checkChildrenCount(exprDmc, children.length);
}
-
+
/**
* Test that we can match arrays using [] and comma-separated ranges
* that are not sorted.
@@ -875,8 +869,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
@Test
public void testMatchArraysWithCommaSeparatedUnsortedRanges() throws Throwable {
final String exprString = "=array[5-6, 3, 0-1]";
- final String[] children = new String[] {
- "array3", "array[0]", "array[1]", "array[3]", "array[5]", "array[6]" };
+ final String[] children = new String[] { "array3", "array[0]", "array[1]", "array[3]", "array[5]", "array[6]" };
SyncUtil.runToLocation("testArrayMatching");
MIStoppedEvent stoppedEvent = SyncUtil.step(6, StepType.STEP_OVER);
@@ -888,7 +881,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
checkChildren(exprDmc, -1, -1, children);
checkChildrenCount(exprDmc, children.length);
}
-
+
/**
* Test that we can match arrays using [] and comma-separated ranges
* containing invalid ranges. Invalid ranges are not accepted by
@@ -899,8 +892,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
@Test
public void testMatchArraysWithCommaSeparatedInvalidRanges() throws Throwable {
final String exprString = "=array[2-3, 5, 6-4]";
- final String[] children = new String[] {
- "array[2]", "array[3]", "array[5]", "array[6-4]" };
+ final String[] children = new String[] { "array[2]", "array[3]", "array[5]", "array[6-4]" };
SyncUtil.runToLocation("testArrayMatching");
MIStoppedEvent stoppedEvent = SyncUtil.step(6, StepType.STEP_OVER);
@@ -912,7 +904,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
checkChildren(exprDmc, -1, -1, children);
checkChildrenCount(exprDmc, children.length);
}
-
+
/**
* Test that we properly handle a non-arrays when using []
*/
@@ -929,7 +921,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
checkChildrenCount(exprDmc, 0);
}
-
+
/**
* Test that arrays can be accessed using [] with a single letter range.
* In this case, since letters do not indicate an array index,
@@ -950,7 +942,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
checkChildren(exprDmc, -1, -1, children);
checkChildrenCount(exprDmc, children.length);
}
-
+
/**
* Test that arrays can be accessed using [] with a letter range.
* In this case, since letters do not indicate an array index,
@@ -971,7 +963,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
checkChildren(exprDmc, -1, -1, children);
checkChildrenCount(exprDmc, children.length);
}
-
+
/**
* Test that arrays can be accessed using [] with a letter range.
* In this case, since letters do not indicate an array index,
@@ -992,7 +984,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
checkChildren(exprDmc, -1, -1, children);
checkChildrenCount(exprDmc, children.length);
}
-
+
/**
* Test that arrays can be accessed using [] with an invalid range.
* In this case, the range is used as-is to create the expression.
@@ -1012,7 +1004,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
checkChildren(exprDmc, -1, -1, children);
checkChildrenCount(exprDmc, children.length);
}
-
+
/**
* Test that all registers and all locals can be matched at the same time
*/
@@ -1057,7 +1049,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
checkChildren(exprDmc, -1, -1, children);
checkChildrenCount(exprDmc, children.length);
}
-
+
/**
* Test that we can match a range
*/
@@ -1075,7 +1067,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
// Check four children starting at position 1
checkChildren(exprDmc, 1, 4, children);
}
-
+
/**
* Test that we can group a local with all registers
*/
@@ -1097,7 +1089,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
checkChildren(exprDmc, -1, -1, children);
checkChildrenCount(exprDmc, children.length);
}
-
+
/**
* Test that we can group a local with a pattern for variables
*/
@@ -1125,7 +1117,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
@Test
public void testUniqueWhenOverlapReg() throws Throwable {
final String exprString = "=$fioff; =$f?off; =$fo*";
- final String[] children = new String[] { "$fioff","$fooff","$fop","$foseg" };
+ final String[] children = new String[] { "$fioff", "$fooff", "$fop", "$foseg" };
SyncUtil.runToLocation("foo");
MIStoppedEvent stoppedEvent = SyncUtil.step(5, StepType.STEP_OVER);
@@ -1146,7 +1138,8 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
@Test
public void testUniqueWhenOverlapLocal() throws Throwable {
final String exprString = "firstvar;*;firstvar";
- final String[] children = new String[] { "firstvar", "firstarg", "ptrvar", "secondarg", "secondvar", "var", "var2" };
+ final String[] children = new String[] { "firstvar", "firstarg", "ptrvar", "secondarg", "secondvar", "var",
+ "var2" };
SyncUtil.runToLocation("foo");
MIStoppedEvent stoppedEvent = SyncUtil.step(5, StepType.STEP_OVER);
@@ -1187,7 +1180,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
final String exprString = "*";
List<String> list = Arrays.asList(fAllVariables);
Collections.sort(list);
- final String[] children = list.toArray(new String[list.size()]);
+ final String[] children = list.toArray(new String[list.size()]);
SyncUtil.runToLocation("foo");
MIStoppedEvent stoppedEvent = SyncUtil.step(5, StepType.STEP_OVER);
@@ -1226,7 +1219,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
checkChildren(exprDmc, -1, -1, children);
checkChildrenCount(exprDmc, children.length);
}
-
+
/**
* Test that pattern-matched arrays are sorted properly by index instead
* of completely alphabetically. An alphabetical sorting would cause the
@@ -1241,10 +1234,9 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
@Test
public void testArraySorting() throws Throwable {
final String exprString = "=array[1-11];=arrayInt[1-2,11,20-22]";
- final String[] children = new String[] {
- "array[1]","array[2]","array[3]","array[4]","array[5]","array[6]",
- "array[7]","array[8]","array[9]","array[10]","array[11]",
- "arrayInt[1]","arrayInt[2]","arrayInt[11]","arrayInt[20]","arrayInt[21]","arrayInt[22]"};
+ final String[] children = new String[] { "array[1]", "array[2]", "array[3]", "array[4]", "array[5]", "array[6]",
+ "array[7]", "array[8]", "array[9]", "array[10]", "array[11]", "arrayInt[1]", "arrayInt[2]",
+ "arrayInt[11]", "arrayInt[20]", "arrayInt[21]", "arrayInt[22]" };
SyncUtil.runToLocation("testArrayMatching");
MIStoppedEvent stoppedEvent = SyncUtil.step(6, StepType.STEP_OVER);
@@ -1259,24 +1251,24 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
}
// Cannot use comma separator because of templates (bug 393474)
-// /**
-// * Test that group-expression can use a comma as a separator
-// */
-// @Test
-// public void testCommaSeparation() throws Throwable {
-// final String exprString = "firstvar,$eax";
-// final String[] children = new String[] { "firstvar","$eax" };
-//
-// SyncUtil.runToLocation("foo");
-// MIStoppedEvent stoppedEvent = SyncUtil.step(5, StepType.STEP_OVER);
-//
-// IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
-//
-// final IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, exprString);
-//
-// checkChildren(exprDmc, -1, -1, children);
-// checkChildrenCount(exprDmc, children.length);
-// }
+ // /**
+ // * Test that group-expression can use a comma as a separator
+ // */
+ // @Test
+ // public void testCommaSeparation() throws Throwable {
+ // final String exprString = "firstvar,$eax";
+ // final String[] children = new String[] { "firstvar","$eax" };
+ //
+ // SyncUtil.runToLocation("foo");
+ // MIStoppedEvent stoppedEvent = SyncUtil.step(5, StepType.STEP_OVER);
+ //
+ // IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ //
+ // final IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, exprString);
+ //
+ // checkChildren(exprDmc, -1, -1, children);
+ // checkChildrenCount(exprDmc, children.length);
+ // }
/**
* Test that group-expression can use a semi-colon as a separator
@@ -1284,7 +1276,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
@Test
public void testSemiColonSeparation() throws Throwable {
final String exprString = "firstvar;$eax";
- final String[] children = new String[] { "firstvar","$eax" };
+ final String[] children = new String[] { "firstvar", "$eax" };
SyncUtil.runToLocation("foo");
MIStoppedEvent stoppedEvent = SyncUtil.step(5, StepType.STEP_OVER);
@@ -1297,7 +1289,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
checkChildrenCount(exprDmc, children.length);
}
-
+
/**
* Test that a valid expression that contains a comma will not be converted
* to a group expression (bug 393474)
@@ -1313,8 +1305,9 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
// This is a way to confirm that the test is valid for the above expression that
// is separated by a command.
final String exprStringSemiColon = exprStringComma.replace(',', ';');
-
- assertFalse("The two strings for this test should not be the same", exprStringComma.equals(exprStringSemiColon));
+
+ assertFalse("The two strings for this test should not be the same",
+ exprStringComma.equals(exprStringSemiColon));
MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("foo");
@@ -1322,7 +1315,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
final IExpressionDMContext exprDmcSemiColon = SyncUtil.createExpression(frameDmc, exprStringSemiColon);
final IExpressionDMContext exprDmcComma = SyncUtil.createExpression(frameDmc, exprStringComma);
-
+
try {
// This should get split into two children and not
// sent to GDB at all, so we should not see a failure,
@@ -1332,7 +1325,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
} catch (Exception e) {
assertFalse("Expected two children for when using a semi-colon", true);
}
-
+
try {
// Should throw an exception because this expression is not
// valid and since it does not get split into children,
@@ -1346,47 +1339,47 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
assertFalse("Should have seen an expression thrown", true);
}
-
+
// Cannot use comma separator because of templates (bug 393474)
-// /**
-// * Test that group-expression can use a comma and a semi-colon as a
-// * separator at the same time
-// */
-// @Test
-// public void testCommaAndSemiColonSeparation() throws Throwable {
-// final String exprString = "firstvar,$eax;$es";
-// final String[] children = new String[] { "firstvar","$eax","$es" };
-//
-// SyncUtil.runToLocation("foo");
-// MIStoppedEvent stoppedEvent = SyncUtil.step(5, StepType.STEP_OVER);
-//
-// IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
-//
-// final IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, exprString);
-//
-// checkChildren(exprDmc, -1, -1, children);
-// checkChildrenCount(exprDmc, children.length);
-// }
-
+ // /**
+ // * Test that group-expression can use a comma and a semi-colon as a
+ // * separator at the same time
+ // */
+ // @Test
+ // public void testCommaAndSemiColonSeparation() throws Throwable {
+ // final String exprString = "firstvar,$eax;$es";
+ // final String[] children = new String[] { "firstvar","$eax","$es" };
+ //
+ // SyncUtil.runToLocation("foo");
+ // MIStoppedEvent stoppedEvent = SyncUtil.step(5, StepType.STEP_OVER);
+ //
+ // IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ //
+ // final IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, exprString);
+ //
+ // checkChildren(exprDmc, -1, -1, children);
+ // checkChildrenCount(exprDmc, children.length);
+ // }
+
// Cannot use comma separator because of templates (bug 393474)
-// /**
-// * Test that group-expression can have empty terms with commas.
-// */
-// @Test
-// public void testGroupCommaEmptyTerm() throws Throwable {
-// final String exprString = ",,firstvar,,$eax,,";
-// final String[] children = new String[] { "firstvar","$eax" };
-//
-// SyncUtil.runToLocation("foo");
-// MIStoppedEvent stoppedEvent = SyncUtil.step(5, StepType.STEP_OVER);
-//
-// IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
-//
-// final IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, exprString);
-//
-// checkChildren(exprDmc, -1, -1, children);
-// checkChildrenCount(exprDmc, children.length);
-// }
+ // /**
+ // * Test that group-expression can have empty terms with commas.
+ // */
+ // @Test
+ // public void testGroupCommaEmptyTerm() throws Throwable {
+ // final String exprString = ",,firstvar,,$eax,,";
+ // final String[] children = new String[] { "firstvar","$eax" };
+ //
+ // SyncUtil.runToLocation("foo");
+ // MIStoppedEvent stoppedEvent = SyncUtil.step(5, StepType.STEP_OVER);
+ //
+ // IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ //
+ // final IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, exprString);
+ //
+ // checkChildren(exprDmc, -1, -1, children);
+ // checkChildrenCount(exprDmc, children.length);
+ // }
/**
* Test that group-expression can have empty terms with semi-colon.
@@ -1394,7 +1387,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
@Test
public void testGroupSemiColonEmptyTerm() throws Throwable {
final String exprString = ";;firstvar;;$eax;;";
- final String[] children = new String[] { "firstvar","$eax" };
+ final String[] children = new String[] { "firstvar", "$eax" };
SyncUtil.runToLocation("foo");
MIStoppedEvent stoppedEvent = SyncUtil.step(5, StepType.STEP_OVER);
@@ -1406,14 +1399,14 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
checkChildren(exprDmc, -1, -1, children);
checkChildrenCount(exprDmc, children.length);
}
-
+
/**
* Test that group-expression clean up extra spaces
*/
@Test
public void testExtraSpaces() throws Throwable {
final String exprString = " firstvar ; $eax ; ; =var? ; = second* ";
- final String[] children = new String[] { "firstvar","$eax","var2","secondarg","secondvar" };
+ final String[] children = new String[] { "firstvar", "$eax", "var2", "secondarg", "secondvar" };
SyncUtil.runToLocation("foo");
MIStoppedEvent stoppedEvent = SyncUtil.step(5, StepType.STEP_OVER);
@@ -1493,11 +1486,11 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
fSession.getExecutor().execute(query);
IExpressionDMAddress data = query.get();
-
+
assertTrue("The address data shoudl be of type IExpressionDMLocation", data instanceof IExpressionDMLocation);
assertEquals(IExpressions.IExpressionDMLocation.INVALID_ADDRESS, data.getAddress());
assertEquals(0, data.getSize());
- assertEquals("", ((IExpressionDMLocation)data).getLocation());
+ assertEquals("", ((IExpressionDMLocation) data).getLocation());
}
/**
@@ -1528,7 +1521,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
fSession.getExecutor().execute(query);
IExpressionDMContext[] childDmcs = query.get();
-
+
String[] childExpressions = new String[childDmcs.length];
MIExpressionDMCAccessor[] childDmcsAccessor = new MIExpressionDMCAccessor[childDmcs.length];
@@ -1537,7 +1530,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
for (int i = 0; i < childExpressions.length; i++) {
childDmcsAccessor[i] = new MIExpressionDMCAccessor(childDmcs[i]);
childExpressions[i] = childDmcsAccessor[i].getRelativeExpression();
- }
+ }
assertTrue("Expected " + Arrays.toString(children) + " but got " + Arrays.toString(childExpressions),
children.length == childExpressions.length);
@@ -1569,10 +1562,10 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
fSession.getExecutor().execute(query);
boolean canWrite = query.get();
-
+
assertFalse("Should not be able to modify the value of a group-expression", canWrite);
}
-
+
/**
* Test the only available format for the value of a group-expression is NATURAL
*/
@@ -1596,11 +1589,11 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
fSession.getExecutor().execute(query);
String[] formats = query.get();
-
+
assertEquals(1, formats.length);
assertEquals(IFormattedValues.NATURAL_FORMAT, formats[0]);
}
-
+
/**
* Test the different values returned by a group-expression
*/
@@ -1622,5 +1615,5 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
assertEquals("No matches", getExpressionValue(noMatchExprDmc));
assertEquals("1 unique match", getExpressionValue(singleMatchExprDmc));
assertEquals("2 unique matches", getExpressionValue(doubleMatchExprDmc));
- }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBProcessesTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBProcessesTest.java
index d726ab60e03..a4a0e76e1b3 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBProcessesTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBProcessesTest.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson AB - Initial implementation of Test cases
* Simon Marchi (Ericsson) - Check for thread name support, add thread name test.
@@ -59,15 +59,15 @@ public class GDBProcessesTest extends BaseParametrizedTestCase {
resolveLineTagLocations(SOURCE_NAME, MIRunControlTest.LINE_TAGS);
- fSession = getGDBLaunch().getSession();
- Runnable runnable = new Runnable() {
- @Override
+ fSession = getGDBLaunch().getSession();
+ Runnable runnable = new Runnable() {
+ @Override
public void run() {
- fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
- fProcService = fServicesTracker.getService(IMIProcesses.class);
- }
- };
- fSession.getExecutor().submit(runnable).get();
+ fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
+ fProcService = fServicesTracker.getService(IMIProcesses.class);
+ }
+ };
+ fSession.getExecutor().submit(runnable).get();
}
@Override
@@ -75,24 +75,24 @@ public class GDBProcessesTest extends BaseParametrizedTestCase {
super.doAfterTest();
fProcService = null;
- if (fServicesTracker!=null) fServicesTracker.dispose();
+ if (fServicesTracker != null)
+ fServicesTracker.dispose();
}
@Override
protected void setLaunchAttributes() {
super.setLaunchAttributes();
- setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME,
- EXEC_PATH + EXEC_NAME);
+ setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EXEC_PATH + EXEC_NAME);
}
@Test
- /*
- * Get the process data for the current program. Process is executable name in case of GDB back end
- */
+ /*
+ * Get the process data for the current program. Process is executable name in case of GDB back end
+ */
public void getProcessData() throws InterruptedException, ExecutionException, TimeoutException {
- final IProcessDMContext processContext = DMContexts.getAncestorOfType(
- SyncUtil.getContainerContext(), IProcessDMContext.class);
+ final IProcessDMContext processContext = DMContexts.getAncestorOfType(SyncUtil.getContainerContext(),
+ IProcessDMContext.class);
Query<IThreadDMData> query = new Query<IThreadDMData>() {
@Override
protected void execute(DataRequestMonitor<IThreadDMData> rm) {
@@ -107,8 +107,8 @@ public class GDBProcessesTest extends BaseParametrizedTestCase {
*/
IThreadDMData processData = query.get(TestsPlugin.massageTimeout(2000), TimeUnit.MILLISECONDS);
Assert.assertNotNull("No process data is returned for Process DMC", processData);
- Assert.assertTrue("Process data should be executable name " + EXEC_NAME +
- "but we got " + processData.getName(), processData.getName().contains(EXEC_NAME));
+ Assert.assertTrue("Process data should be executable name " + EXEC_NAME + "but we got " + processData.getName(),
+ processData.getName().contains(EXEC_NAME));
}
/*
@@ -143,8 +143,7 @@ public class GDBProcessesTest extends BaseParametrizedTestCase {
// Check the thread names. We did not change the main thread's name, so
// it should be the same as the executable name.
- final String names[] = { EXEC_NAME, "monday", "tuesday", "wednesday",
- "thursday", "friday" };
+ final String names[] = { EXEC_NAME, "monday", "tuesday", "wednesday", "thursday", "friday" };
// Check that we have correct data for PrintHello
for (int i = 1; i <= 6; i++) {
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBRemoteTracepointsTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBRemoteTracepointsTest.java
index 3215449650a..1c5aa1baa81 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBRemoteTracepointsTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBRemoteTracepointsTest.java
@@ -13,7 +13,6 @@
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.tests;
-
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -75,33 +74,28 @@ public class GDBRemoteTracepointsTest extends BaseParametrizedTestCase {
// private int fTotalTracingBufferSize = 0;
- protected static final String EXEC_NAME = "TracepointTestApp.exe";
- protected static final String SOURCE_NAME = "TracepointTestApp.cc";
+ protected static final String EXEC_NAME = "TracepointTestApp.exe";
+ protected static final String SOURCE_NAME = "TracepointTestApp.cc";
// Breakpoint tags in TracepointTestApp.cc
- public static final String[] LINE_TAGS = new String[] {
- "1_BYTE",
- "2_BYTE",
- "3_BYTE",
- "4_BYTE",
- "5_BYTE"
- };
-
- protected static final String NO_CONDITION = "";
- protected static final String NO_COMMANDS = "";
+ public static final String[] LINE_TAGS = new String[] { "1_BYTE", "2_BYTE", "3_BYTE", "4_BYTE", "5_BYTE" };
+
+ protected static final String NO_CONDITION = "";
+ protected static final String NO_COMMANDS = "";
// private static final int LAST_LINE_NUMBER = 94;
//
// private static final int TOTAL_FRAMES_TO_BE_COLLECTED = 1 + 1 + 10 + 1 + 10000;
- protected final static int[] PASS_COUNTS = {12, 2, 32, 6, 128, 0, 0, 0, 0, 0, 0, 0};
- protected final static String[] CONDITIONS = {"gIntVar == 543", "gBoolVar == false", "x == 3", "x > 4", "x > 2 && gIntVar == 12345"};
+ protected final static int[] PASS_COUNTS = { 12, 2, 32, 6, 128, 0, 0, 0, 0, 0, 0, 0 };
+ protected final static String[] CONDITIONS = { "gIntVar == 543", "gBoolVar == false", "x == 3", "x > 4",
+ "x > 2 && gIntVar == 12345" };
protected static CollectAction[] COLLECT_ACTIONS = new CollectAction[10];
protected static EvaluateAction[] EVAL_ACTIONS = new EvaluateAction[10];
// private static WhileSteppingAction[] STEPPING_ACTION_1 = new WhileSteppingAction[3];
@BeforeClass
- public static void initializeActions() {
+ public static void initializeActions() {
TracepointActionManager tracepointActionMgr = TracepointActionManager.getInstance();
int index = 0;
@@ -141,7 +135,7 @@ public class GDBRemoteTracepointsTest extends BaseParametrizedTestCase {
tracepointActionMgr.addAction(COLLECT_ACTIONS[index]);
index++;
- index=0;
+ index = 0;
EVAL_ACTIONS[index] = new EvaluateAction();
EVAL_ACTIONS[index].setEvalString("$count=$count+1");
EVAL_ACTIONS[index].setName("Eval increment count");
@@ -161,7 +155,7 @@ public class GDBRemoteTracepointsTest extends BaseParametrizedTestCase {
index++;
//TODO do while stepping actions
- index=0;
+ index = 0;
}
@@ -178,11 +172,10 @@ public class GDBRemoteTracepointsTest extends BaseParametrizedTestCase {
public void run() {
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
-
fBreakpointService = fServicesTracker.getService(IBreakpoints.class);
fGdbControl = fServicesTracker.getService(IGDBControl.class);
fCommandFactory = fGdbControl.getCommandFactory();
-
+
// fTraceService = fServicesTracker.getService(ITraceControl.class);
fSession.addServiceEventListener(GDBRemoteTracepointsTest.this, null);
@@ -197,7 +190,7 @@ public class GDBRemoteTracepointsTest extends BaseParametrizedTestCase {
IContainerDMContext containerDmc = SyncUtil.getContainerContext();
fBreakpointsDmc = DMContexts.getAncestorOfType(containerDmc, IBreakpointsTargetDMContext.class);
- assert(fBreakpointsDmc != null);
+ assert (fBreakpointsDmc != null);
// fTraceTargetDmc = DMContexts.getAncestorOfType(containerDmc, ITraceTargetDMContext.class);
}
@@ -228,14 +221,18 @@ public class GDBRemoteTracepointsTest extends BaseParametrizedTestCase {
// Below are utility methods.
// *********************************************************************
private static Boolean lock = true;
- enum Events {BP_ADDED, BP_UPDATED, BP_REMOVED, BP_HIT}
- final int BP_ADDED = Events.BP_ADDED.ordinal();
+
+ enum Events {
+ BP_ADDED, BP_UPDATED, BP_REMOVED, BP_HIT
+ }
+
+ final int BP_ADDED = Events.BP_ADDED.ordinal();
final int BP_UPDATED = Events.BP_UPDATED.ordinal();
final int BP_REMOVED = Events.BP_REMOVED.ordinal();
- final int BP_HIT = Events.BP_HIT.ordinal();
- private int[] fBreakpointEvents = new int[Events.values().length];
+ final int BP_HIT = Events.BP_HIT.ordinal();
+ private int[] fBreakpointEvents = new int[Events.values().length];
private boolean fBreakpointEvent;
- private int fBreakpointEventCount;
+ private int fBreakpointEventCount;
@DsfServiceEventHandler
public void eventDispatched(IBreakpointsAddedEvent e) {
@@ -305,97 +302,89 @@ public class GDBRemoteTracepointsTest extends BaseParametrizedTestCase {
// Breakpoint service methods (to use with tracepoints).
// *********************************************************************
- protected IBreakpointDMContext insertBreakpoint(final IBreakpointsTargetDMContext context, final Map<String,Object> attributes)
- throws Throwable
- {
- Query<IBreakpointDMContext> query = new Query<IBreakpointDMContext>() {
+ protected IBreakpointDMContext insertBreakpoint(final IBreakpointsTargetDMContext context,
+ final Map<String, Object> attributes) throws Throwable {
+ Query<IBreakpointDMContext> query = new Query<IBreakpointDMContext>() {
@Override
protected void execute(final DataRequestMonitor<IBreakpointDMContext> rm) {
fBreakpointService.insertBreakpoint(context, attributes, rm);
}
- };
-
- fBreakpointService.getExecutor().execute(query);
- try {
- return query.get(1, TimeUnit.SECONDS);
- } catch (ExecutionException e) {
- assert false : e.getCause().getMessage();
- }
- return null;
+ };
+
+ fBreakpointService.getExecutor().execute(query);
+ try {
+ return query.get(1, TimeUnit.SECONDS);
+ } catch (ExecutionException e) {
+ assert false : e.getCause().getMessage();
+ }
+ return null;
}
- protected void removeBreakpoint(final IBreakpointDMContext breakpoint)
- throws Throwable
- {
- Query<Object> query = new Query<Object>() {
+ protected void removeBreakpoint(final IBreakpointDMContext breakpoint) throws Throwable {
+ Query<Object> query = new Query<Object>() {
@Override
protected void execute(final DataRequestMonitor<Object> rm) {
fBreakpointService.removeBreakpoint(breakpoint, rm);
}
- };
-
- fBreakpointService.getExecutor().execute(query);
- try {
- query.get(1, TimeUnit.SECONDS);
- } catch (ExecutionException e) {
- assert false : e.getCause().getMessage();
- }
+ };
+
+ fBreakpointService.getExecutor().execute(query);
+ try {
+ query.get(1, TimeUnit.SECONDS);
+ } catch (ExecutionException e) {
+ assert false : e.getCause().getMessage();
+ }
}
protected void updateBreakpoint(final IBreakpointDMContext breakpoint, final Map<String, Object> delta)
- throws Throwable
- {
- Query<Object> query = new Query<Object>() {
+ throws Throwable {
+ Query<Object> query = new Query<Object>() {
@Override
protected void execute(DataRequestMonitor<Object> rm) {
fBreakpointService.updateBreakpoint(breakpoint, delta, rm);
}
- };
-
- fBreakpointService.getExecutor().execute(query);
- try {
- query.get(1, TimeUnit.SECONDS);
- } catch (ExecutionException e) {
- assert false : e.getCause().getMessage();
- }
+ };
+
+ fBreakpointService.getExecutor().execute(query);
+ try {
+ query.get(1, TimeUnit.SECONDS);
+ } catch (ExecutionException e) {
+ assert false : e.getCause().getMessage();
+ }
}
- protected IBreakpointDMData getBreakpoint(final IBreakpointDMContext breakpoint)
- throws Throwable
- {
- Query<IBreakpointDMData> query = new Query<IBreakpointDMData>() {
+ protected IBreakpointDMData getBreakpoint(final IBreakpointDMContext breakpoint) throws Throwable {
+ Query<IBreakpointDMData> query = new Query<IBreakpointDMData>() {
@Override
protected void execute(DataRequestMonitor<IBreakpointDMData> rm) {
fBreakpointService.getBreakpointDMData(breakpoint, rm);
}
- };
-
- fBreakpointService.getExecutor().execute(query);
- try {
- return query.get(1, TimeUnit.SECONDS);
- } catch (ExecutionException e) {
- assert false : e.getCause().getMessage();
- }
- return null;
+ };
+
+ fBreakpointService.getExecutor().execute(query);
+ try {
+ return query.get(1, TimeUnit.SECONDS);
+ } catch (ExecutionException e) {
+ assert false : e.getCause().getMessage();
+ }
+ return null;
}
- protected IBreakpointDMContext[] getBreakpoints(final IBreakpointsTargetDMContext context)
- throws Throwable
- {
- Query<IBreakpointDMContext[]> query = new Query<IBreakpointDMContext[]>() {
+ protected IBreakpointDMContext[] getBreakpoints(final IBreakpointsTargetDMContext context) throws Throwable {
+ Query<IBreakpointDMContext[]> query = new Query<IBreakpointDMContext[]>() {
@Override
protected void execute(DataRequestMonitor<IBreakpointDMContext[]> rm) {
fBreakpointService.getBreakpoints(context, rm);
}
- };
-
- fBreakpointService.getExecutor().execute(query);
- try {
- return query.get(1, TimeUnit.SECONDS);
- } catch (ExecutionException e) {
- assert false : e.getCause().getMessage();
- }
- return null;
+ };
+
+ fBreakpointService.getExecutor().execute(query);
+ try {
+ return query.get(1, TimeUnit.SECONDS);
+ } catch (ExecutionException e) {
+ assert false : e.getCause().getMessage();
+ }
+ return null;
}
// *********************************************************************
@@ -593,7 +582,8 @@ public class GDBRemoteTracepointsTest extends BaseParametrizedTestCase {
this(SOURCE_NAME, line, cond, pass, isEnabled, cmds, fast);
}
- public TracepointData(String file, int line, String cond, int pass, boolean isEnabled, String cmds, boolean fast) {
+ public TracepointData(String file, int line, String cond, int pass, boolean isEnabled, String cmds,
+ boolean fast) {
sourceFile = file;
lineNumber = line;
condition = cond;
@@ -610,75 +600,82 @@ public class GDBRemoteTracepointsTest extends BaseParametrizedTestCase {
// Fetch the tp list from the backend
IBreakpointDMContext[] tracepoints = getBreakpoints(fBreakpointsDmc);
- assertEquals("expected " + numTracepoints + " breakpoint(s), received "
- + tracepoints.length, numTracepoints, tracepoints.length);
+ assertEquals("expected " + numTracepoints + " breakpoint(s), received " + tracepoints.length, numTracepoints,
+ tracepoints.length);
- for (int i=0; i<numTracepoints; i++) {
+ for (int i = 0; i < numTracepoints; i++) {
TracepointData data = dataArray[i];
// Ensure that the tracepoints were correctly installed
MIBreakpointDMData tp = (MIBreakpointDMData) getBreakpoint(fTracepoints[i]);
- assertEquals("tracepoint "+i+" is not a tracepoint but a " + tp.getBreakpointType(),
+ assertEquals("tracepoint " + i + " is not a tracepoint but a " + tp.getBreakpointType(),
MIBreakpoints.TRACEPOINT, tp.getBreakpointType());
- assertEquals("tracepoint "+i+" should be a " + (data.isFastTp?"fast":"normal")+" tracepoint but is not",
- data.isFastTp, tp.getType().equals("fast tracepoint"));
- assertEquals("tracepoint "+i+" mismatch (wrong file name) got " + tp.getFileName(),
- data.sourceFile, tp.getFileName());
- assertEquals("tracepoint "+i+" mismatch (wrong line number) got " + tp.getLineNumber(),
- data.lineNumber, tp.getLineNumber());
- assertEquals("tracepoint "+i+" mismatch (wrong condition) got " + tp.getCondition(),
- data.condition, tp.getCondition());
- assertEquals("tracepoint "+i+" mismatch (wrong pass count) got " + tp.getPassCount(),
- data.passcount, tp.getPassCount());
- assertEquals("tracepoint "+i+" mismatch (wrong enablement) got " + tp.isEnabled(),
- data.enabled, tp.isEnabled());
- assertEquals("tracepoint "+i+" mismatch (wrong actions) got " + tp.getCommands(),
- data.commands, tp.getCommands());
-
- assertEquals("tracepoint "+i+" mismatch",
- getBreakpoint(tracepoints[i]), tp);
+ assertEquals("tracepoint " + i + " should be a " + (data.isFastTp ? "fast" : "normal")
+ + " tracepoint but is not", data.isFastTp, tp.getType().equals("fast tracepoint"));
+ assertEquals("tracepoint " + i + " mismatch (wrong file name) got " + tp.getFileName(), data.sourceFile,
+ tp.getFileName());
+ assertEquals("tracepoint " + i + " mismatch (wrong line number) got " + tp.getLineNumber(), data.lineNumber,
+ tp.getLineNumber());
+ assertEquals("tracepoint " + i + " mismatch (wrong condition) got " + tp.getCondition(), data.condition,
+ tp.getCondition());
+ assertEquals("tracepoint " + i + " mismatch (wrong pass count) got " + tp.getPassCount(), data.passcount,
+ tp.getPassCount());
+ assertEquals("tracepoint " + i + " mismatch (wrong enablement) got " + tp.isEnabled(), data.enabled,
+ tp.isEnabled());
+ assertEquals("tracepoint " + i + " mismatch (wrong actions) got " + tp.getCommands(), data.commands,
+ tp.getCommands());
+
+ assertEquals("tracepoint " + i + " mismatch", getBreakpoint(tracepoints[i]), tp);
}
}
protected void checkTracepoints(boolean useCond, boolean useCount, boolean enabled, boolean useActions)
throws Throwable {
TracepointData[] dataArray = new TracepointData[] {
- new TracepointData(getLineForTag("1_BYTE"), useCond ? CONDITIONS[0] : NO_CONDITION, useCount ? PASS_COUNTS[0] : 0, enabled, useActions ? COLLECT_ACTIONS[0].toString() : NO_COMMANDS, false),
- new TracepointData(getLineForTag("2_BYTE"), useCond ? CONDITIONS[1] : NO_CONDITION, useCount ? PASS_COUNTS[1] : 0, enabled, useActions ? COLLECT_ACTIONS[1].toString() : NO_COMMANDS, false),
- new TracepointData(getLineForTag("3_BYTE"), useCond ? CONDITIONS[2] : NO_CONDITION, useCount ? PASS_COUNTS[2] : 0, enabled, useActions ? COLLECT_ACTIONS[2].toString() : NO_COMMANDS, false),
- new TracepointData(getLineForTag("4_BYTE"), useCond ? CONDITIONS[3] : NO_CONDITION, useCount ? PASS_COUNTS[3] : 0, enabled, useActions ? COLLECT_ACTIONS[3].toString() : NO_COMMANDS, acceptsFastTpOnFourBytes()),
- new TracepointData(getLineForTag("5_BYTE"), useCond ? CONDITIONS[4] : NO_CONDITION, useCount ? PASS_COUNTS[4] : 0, enabled, useActions ? COLLECT_ACTIONS[4].toString() : NO_COMMANDS, fastTracepointsSupported()),
- };
+ new TracepointData(getLineForTag("1_BYTE"), useCond ? CONDITIONS[0] : NO_CONDITION,
+ useCount ? PASS_COUNTS[0] : 0, enabled,
+ useActions ? COLLECT_ACTIONS[0].toString() : NO_COMMANDS, false),
+ new TracepointData(getLineForTag("2_BYTE"), useCond ? CONDITIONS[1] : NO_CONDITION,
+ useCount ? PASS_COUNTS[1] : 0, enabled,
+ useActions ? COLLECT_ACTIONS[1].toString() : NO_COMMANDS, false),
+ new TracepointData(getLineForTag("3_BYTE"), useCond ? CONDITIONS[2] : NO_CONDITION,
+ useCount ? PASS_COUNTS[2] : 0, enabled,
+ useActions ? COLLECT_ACTIONS[2].toString() : NO_COMMANDS, false),
+ new TracepointData(getLineForTag("4_BYTE"), useCond ? CONDITIONS[3] : NO_CONDITION,
+ useCount ? PASS_COUNTS[3] : 0, enabled,
+ useActions ? COLLECT_ACTIONS[3].toString() : NO_COMMANDS, acceptsFastTpOnFourBytes()),
+ new TracepointData(getLineForTag("5_BYTE"), useCond ? CONDITIONS[4] : NO_CONDITION,
+ useCount ? PASS_COUNTS[4] : 0, enabled,
+ useActions ? COLLECT_ACTIONS[4].toString() : NO_COMMANDS, fastTracepointsSupported()), };
checkTracepoints(dataArray);
}
protected void createTracepoints(boolean useCond, boolean useCount, boolean enabled, boolean useActions)
- throws Throwable
- {
+ throws Throwable {
Map<String, Object> attributes = null;
- int[] lineNumbers = {
- getLineForTag("1_BYTE"),
- getLineForTag("2_BYTE"),
- getLineForTag("3_BYTE"),
- getLineForTag("4_BYTE"),
- getLineForTag("5_BYTE") };
+ int[] lineNumbers = { getLineForTag("1_BYTE"), getLineForTag("2_BYTE"), getLineForTag("3_BYTE"),
+ getLineForTag("4_BYTE"), getLineForTag("5_BYTE") };
for (int i = 0; i < lineNumbers.length; i++) {
attributes = new HashMap<String, Object>();
attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT);
attributes.put(MIBreakpoints.FILE_NAME, SOURCE_NAME);
attributes.put(MIBreakpoints.LINE_NUMBER, lineNumbers[i]);
- if (!enabled) attributes.put(MIBreakpoints.IS_ENABLED, enabled);
- if (useCount) attributes.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[i]);
- if (useCond) attributes.put(MIBreakpoints.CONDITION, CONDITIONS[i]);
- if (useActions) attributes.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[i].getName());
+ if (!enabled)
+ attributes.put(MIBreakpoints.IS_ENABLED, enabled);
+ if (useCount)
+ attributes.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[i]);
+ if (useCond)
+ attributes.put(MIBreakpoints.CONDITION, CONDITIONS[i]);
+ if (useActions)
+ attributes.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[i].getName());
fTracepoints[i] = insertBreakpoint(fBreakpointsDmc, attributes);
waitForBreakpointEvent();
- assertEquals("Incorrect number of breakpoint events", 1, fBreakpointEventCount);
+ assertEquals("Incorrect number of breakpoint events", 1, fBreakpointEventCount);
assertEquals("Incorrect number of breakpoint added events", 1, getBreakpointEventCount(BP_ADDED));
clearEventCounters();
}
@@ -744,7 +741,8 @@ public class GDBRemoteTracepointsTest extends BaseParametrizedTestCase {
}
assertEquals("Some byte length were not seen", new HashSet<Integer>(Arrays.asList(1, 2, 3, 4, 5)), passed);
} catch (AssertionError | Exception e) {
- throw new AssertionError("Failed to verify instruction lengths. Output from GDB's disassemble:\n" + miInfo.toString(), e);
+ throw new AssertionError(
+ "Failed to verify instruction lengths. Output from GDB's disassemble:\n" + miInfo.toString(), e);
}
}
@@ -769,14 +767,15 @@ public class GDBRemoteTracepointsTest extends BaseParametrizedTestCase {
createTracepoints();
// Delete all tracepoints
for (IBreakpointDMContext tp : fTracepoints) {
- if (tp == null) break;
+ if (tp == null)
+ break;
removeBreakpoint(tp);
}
// Fetch the bp list from the backend
IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc);
- assertTrue("BreakpointService problem: expected " + 0 + " breakpoints, received "
- + breakpoints.length, breakpoints.length == 0);
+ assertTrue("BreakpointService problem: expected " + 0 + " breakpoints, received " + breakpoints.length,
+ breakpoints.length == 0);
}
/**
@@ -790,7 +789,8 @@ public class GDBRemoteTracepointsTest extends BaseParametrizedTestCase {
delta.put(MIBreakpoints.IS_ENABLED, false);
// Disable all tracepoints
for (IBreakpointDMContext tp : fTracepoints) {
- if (tp == null) break;
+ if (tp == null)
+ break;
updateBreakpoint(tp, delta);
}
@@ -808,7 +808,8 @@ public class GDBRemoteTracepointsTest extends BaseParametrizedTestCase {
delta.put(MIBreakpoints.IS_ENABLED, true);
// Enable all tracepoints
for (IBreakpointDMContext tp : fTracepoints) {
- if (tp == null) break;
+ if (tp == null)
+ break;
updateBreakpoint(tp, delta);
}
@@ -824,9 +825,11 @@ public class GDBRemoteTracepointsTest extends BaseParametrizedTestCase {
Map<String, Object> delta = new HashMap<String, Object>();
// Set passcount for all tracepoints
- for (int i=0; i<fTracepoints.length; i++) {
- if (fTracepoints[i] == null) break;
- if (PASS_COUNTS[i] == 0) continue;
+ for (int i = 0; i < fTracepoints.length; i++) {
+ if (fTracepoints[i] == null)
+ break;
+ if (PASS_COUNTS[i] == 0)
+ continue;
delta.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[i]);
updateBreakpoint(fTracepoints[i], delta);
}
@@ -843,9 +846,11 @@ public class GDBRemoteTracepointsTest extends BaseParametrizedTestCase {
Map<String, Object> delta = new HashMap<String, Object>();
// Set conditions for all tracepoints
- for (int i=0; i<fTracepoints.length; i++) {
- if (fTracepoints[i] == null) break;
- if (CONDITIONS[i].equals(NO_CONDITION)) continue;
+ for (int i = 0; i < fTracepoints.length; i++) {
+ if (fTracepoints[i] == null)
+ break;
+ if (CONDITIONS[i].equals(NO_CONDITION))
+ continue;
delta.put(MIBreakpoints.CONDITION, CONDITIONS[i]);
updateBreakpoint(fTracepoints[i], delta);
}
@@ -862,9 +867,11 @@ public class GDBRemoteTracepointsTest extends BaseParametrizedTestCase {
Map<String, Object> delta = new HashMap<String, Object>();
// Set conditions for all tracepoints
- for (int i=0; i<fTracepoints.length; i++) {
- if (fTracepoints[i] == null) break;
- if (COLLECT_ACTIONS[i].equals(NO_COMMANDS)) continue;
+ for (int i = 0; i < fTracepoints.length; i++) {
+ if (fTracepoints[i] == null)
+ break;
+ if (COLLECT_ACTIONS[i].equals(NO_COMMANDS))
+ continue;
delta.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[i].getName());
updateBreakpoint(fTracepoints[i], delta);
}
@@ -910,38 +917,36 @@ public class GDBRemoteTracepointsTest extends BaseParametrizedTestCase {
@Test
public void createTracepointWithMultipleCommands() throws Throwable {
- String commandsNames1 = COLLECT_ACTIONS[0].getName() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER +
- COLLECT_ACTIONS[1].getName() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER +
- COLLECT_ACTIONS[3].getName();
- String commandsResult1 = COLLECT_ACTIONS[0].toString() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER +
- COLLECT_ACTIONS[1].toString() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER +
- COLLECT_ACTIONS[3].toString();
-
- String commandsNames2 = COLLECT_ACTIONS[2].getName() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER +
- COLLECT_ACTIONS[2].getName() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER +
- COLLECT_ACTIONS[1].getName();
- String commandsResult2 = COLLECT_ACTIONS[2].toString() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER +
- COLLECT_ACTIONS[2].toString() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER +
- COLLECT_ACTIONS[1].toString();
-
- String commandsNames3 = COLLECT_ACTIONS[4].getName() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER +
- COLLECT_ACTIONS[0].getName() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER +
- COLLECT_ACTIONS[1].getName();
- String commandsResult3 = COLLECT_ACTIONS[4].toString() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER +
- COLLECT_ACTIONS[0].toString() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER +
- COLLECT_ACTIONS[1].toString();
-
- String cmdNames[] = new String[] { commandsNames1, COLLECT_ACTIONS[0].getName(), commandsNames2, COLLECT_ACTIONS[2].getName(), commandsNames3 };
- String cmdResults[] = new String[] { commandsResult1, COLLECT_ACTIONS[0].toString(), commandsResult2, COLLECT_ACTIONS[2].toString(), commandsResult3};
+ String commandsNames1 = COLLECT_ACTIONS[0].getName() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER
+ + COLLECT_ACTIONS[1].getName() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER
+ + COLLECT_ACTIONS[3].getName();
+ String commandsResult1 = COLLECT_ACTIONS[0].toString() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER
+ + COLLECT_ACTIONS[1].toString() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER
+ + COLLECT_ACTIONS[3].toString();
+
+ String commandsNames2 = COLLECT_ACTIONS[2].getName() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER
+ + COLLECT_ACTIONS[2].getName() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER
+ + COLLECT_ACTIONS[1].getName();
+ String commandsResult2 = COLLECT_ACTIONS[2].toString() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER
+ + COLLECT_ACTIONS[2].toString() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER
+ + COLLECT_ACTIONS[1].toString();
+
+ String commandsNames3 = COLLECT_ACTIONS[4].getName() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER
+ + COLLECT_ACTIONS[0].getName() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER
+ + COLLECT_ACTIONS[1].getName();
+ String commandsResult3 = COLLECT_ACTIONS[4].toString() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER
+ + COLLECT_ACTIONS[0].toString() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER
+ + COLLECT_ACTIONS[1].toString();
+
+ String cmdNames[] = new String[] { commandsNames1, COLLECT_ACTIONS[0].getName(), commandsNames2,
+ COLLECT_ACTIONS[2].getName(), commandsNames3 };
+ String cmdResults[] = new String[] { commandsResult1, COLLECT_ACTIONS[0].toString(), commandsResult2,
+ COLLECT_ACTIONS[2].toString(), commandsResult3 };
Map<String, Object> attributes = null;
- int[] lineNumbers = {
- getLineForTag("1_BYTE"),
- getLineForTag("2_BYTE"),
- getLineForTag("3_BYTE"),
- getLineForTag("4_BYTE"),
- getLineForTag("5_BYTE") };
+ int[] lineNumbers = { getLineForTag("1_BYTE"), getLineForTag("2_BYTE"), getLineForTag("3_BYTE"),
+ getLineForTag("4_BYTE"), getLineForTag("5_BYTE") };
for (int i = 0; i < lineNumbers.length; i++) {
attributes = new HashMap<String, Object>();
@@ -953,7 +958,7 @@ public class GDBRemoteTracepointsTest extends BaseParametrizedTestCase {
fTracepoints[i] = insertBreakpoint(fBreakpointsDmc, attributes);
waitForBreakpointEvent();
- assertEquals("Incorrect number of breakpoint events", 1, fBreakpointEventCount);
+ assertEquals("Incorrect number of breakpoint events", 1, fBreakpointEventCount);
assertEquals("Incorrect number of breakpoint added events", 1, getBreakpointEventCount(BP_ADDED));
clearEventCounters();
}
@@ -962,11 +967,12 @@ public class GDBRemoteTracepointsTest extends BaseParametrizedTestCase {
new TracepointData(getLineForTag("1_BYTE"), NO_CONDITION, 0, true, cmdResults[0], false),
new TracepointData(getLineForTag("2_BYTE"), NO_CONDITION, 0, true, cmdResults[1], false),
new TracepointData(getLineForTag("3_BYTE"), NO_CONDITION, 0, true, cmdResults[2], false),
- new TracepointData(getLineForTag("4_BYTE"), NO_CONDITION, 0, true, cmdResults[3], acceptsFastTpOnFourBytes()),
- new TracepointData(getLineForTag("5_BYTE"), NO_CONDITION, 0, true, cmdResults[4], fastTracepointsSupported()),
- };
+ new TracepointData(getLineForTag("4_BYTE"), NO_CONDITION, 0, true, cmdResults[3],
+ acceptsFastTpOnFourBytes()),
+ new TracepointData(getLineForTag("5_BYTE"), NO_CONDITION, 0, true, cmdResults[4],
+ fastTracepointsSupported()), };
- checkTracepoints(dataArray);
+ checkTracepoints(dataArray);
}
/**
@@ -1197,17 +1203,18 @@ public class GDBRemoteTracepointsTest extends BaseParametrizedTestCase {
protected boolean acceptsFastTpOnFourBytes() {
String gdbVersion = getGdbVersion();
boolean isLower = LaunchUtils.compareVersions(ITestConstants.SUFFIX_GDB_7_4, gdbVersion) > 0;
- if (isLower) return false;
+ if (isLower)
+ return false;
// With GDB 7.4, fast tracepoints only need an
// instruction of 4 bytes or more when on a 32bit architecture, instead of 5.
- if (Platform.getOS().equals(Platform.ARCH_X86)) {
- return true;
- }
- return false;
+ if (Platform.getOS().equals(Platform.ARCH_X86)) {
+ return true;
+ }
+ return false;
}
protected boolean fastTracepointsSupported() {
- return LaunchUtils.compareVersions(getGdbVersion(), ITestConstants.SUFFIX_GDB_7_2) >= 0;
+ return LaunchUtils.compareVersions(getGdbVersion(), ITestConstants.SUFFIX_GDB_7_2) >= 0;
}
/**
@@ -1244,12 +1251,13 @@ public class GDBRemoteTracepointsTest extends BaseParametrizedTestCase {
updateBreakpoint(fTracepoints[4], delta);
TracepointData[] dataArray = new TracepointData[] {
- new TracepointData(getLineForTag("1_BYTE"), NO_CONDITION, 0, true, action1.toString(), false),
- new TracepointData(getLineForTag("2_BYTE"), NO_CONDITION, 0, true, action2.toString(), false),
- new TracepointData(getLineForTag("3_BYTE"), NO_CONDITION, 0, true, action1.toString(), false),
- new TracepointData(getLineForTag("4_BYTE"), NO_CONDITION, 0, true, action1.toString(), acceptsFastTpOnFourBytes()),
- new TracepointData(getLineForTag("5_BYTE"), NO_CONDITION, 0, true, action2.toString(), fastTracepointsSupported()),
- };
+ new TracepointData(getLineForTag("1_BYTE"), NO_CONDITION, 0, true, action1.toString(), false),
+ new TracepointData(getLineForTag("2_BYTE"), NO_CONDITION, 0, true, action2.toString(), false),
+ new TracepointData(getLineForTag("3_BYTE"), NO_CONDITION, 0, true, action1.toString(), false),
+ new TracepointData(getLineForTag("4_BYTE"), NO_CONDITION, 0, true, action1.toString(),
+ acceptsFastTpOnFourBytes()),
+ new TracepointData(getLineForTag("5_BYTE"), NO_CONDITION, 0, true, action2.toString(),
+ fastTracepointsSupported()), };
checkTracepoints(dataArray);
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBTestTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBTestTest.java
index cbe3ba0a71d..11eb18207ce 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBTestTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBTestTest.java
@@ -46,24 +46,24 @@ public class GDBTestTest extends BaseParametrizedTestCase {
public void testLaunch() {
assertFalse("Launch should be running", getGDBLaunch().isTerminated());
}
-
+
/**
- * Test that test infrastructure allows multiple launches on same launch config.
+ * Test that test infrastructure allows multiple launches on same launch config.
*/
@Test
public void testMultipleLaunch() throws Exception {
Assume.assumeFalse("Test framework only supports multiple launches for non-remote", remote);
-
+
// get the launch that was created automatically
GdbLaunch autoLaunched = getGDBLaunch();
-
+
autoLaunched.terminate();
waitUntil("Launch did not terminate", () -> autoLaunched.isTerminated());
-
+
// launch an additional launch
GdbLaunch secondLaunch = doLaunchInner();
assertFalse("Second launch should be running", secondLaunch.isTerminated());
-
+
secondLaunch.terminate();
waitUntil("Second launch did not terminate", () -> secondLaunch.isTerminated());
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/ITestConstants.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/ITestConstants.java
index baaaf2cd045..c1439818630 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/ITestConstants.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/ITestConstants.java
@@ -39,38 +39,24 @@ public class ITestConstants {
public static String[] ALL_SUPPORTED_VERSIONS = new String[] {
// add new versions here
- ITestConstants.SUFFIX_GDB_8_2,
- ITestConstants.SUFFIX_GDB_8_1,
- ITestConstants.SUFFIX_GDB_8_0,
- ITestConstants.SUFFIX_GDB_7_12,
- ITestConstants.SUFFIX_GDB_7_11,
- ITestConstants.SUFFIX_GDB_7_10,
- ITestConstants.SUFFIX_GDB_7_9,
- ITestConstants.SUFFIX_GDB_7_8,
- ITestConstants.SUFFIX_GDB_7_7,
- ITestConstants.SUFFIX_GDB_7_6,
- ITestConstants.SUFFIX_GDB_7_5,
- ITestConstants.SUFFIX_GDB_7_4,
- ITestConstants.SUFFIX_GDB_7_3,
- ITestConstants.SUFFIX_GDB_7_2,
- ITestConstants.SUFFIX_GDB_7_1,
- };
-
- public static String[] ALL_UNSUPPORTED_VERSIONS = new String[] {
- ITestConstants.SUFFIX_GDB_7_0,
- ITestConstants.SUFFIX_GDB_6_8,
- ITestConstants.SUFFIX_GDB_6_7,
- ITestConstants.SUFFIX_GDB_6_6,
- };
-
+ ITestConstants.SUFFIX_GDB_8_2, ITestConstants.SUFFIX_GDB_8_1, ITestConstants.SUFFIX_GDB_8_0,
+ ITestConstants.SUFFIX_GDB_7_12, ITestConstants.SUFFIX_GDB_7_11, ITestConstants.SUFFIX_GDB_7_10,
+ ITestConstants.SUFFIX_GDB_7_9, ITestConstants.SUFFIX_GDB_7_8, ITestConstants.SUFFIX_GDB_7_7,
+ ITestConstants.SUFFIX_GDB_7_6, ITestConstants.SUFFIX_GDB_7_5, ITestConstants.SUFFIX_GDB_7_4,
+ ITestConstants.SUFFIX_GDB_7_3, ITestConstants.SUFFIX_GDB_7_2, ITestConstants.SUFFIX_GDB_7_1, };
+
+ public static String[] ALL_UNSUPPORTED_VERSIONS = new String[] { ITestConstants.SUFFIX_GDB_7_0,
+ ITestConstants.SUFFIX_GDB_6_8, ITestConstants.SUFFIX_GDB_6_7, ITestConstants.SUFFIX_GDB_6_6, };
+
public static String[] ALL_KNOWN_VERSIONS;
static {
// Initialize all known version based on the other arrays to avoid code duplication
ALL_KNOWN_VERSIONS = new String[ALL_SUPPORTED_VERSIONS.length + ALL_UNSUPPORTED_VERSIONS.length];
System.arraycopy(ALL_SUPPORTED_VERSIONS, 0, ALL_KNOWN_VERSIONS, 0, ALL_SUPPORTED_VERSIONS.length);
- System.arraycopy(ALL_UNSUPPORTED_VERSIONS, 0, ALL_KNOWN_VERSIONS, ALL_SUPPORTED_VERSIONS.length, ALL_UNSUPPORTED_VERSIONS.length);
+ System.arraycopy(ALL_UNSUPPORTED_VERSIONS, 0, ALL_KNOWN_VERSIONS, ALL_SUPPORTED_VERSIONS.length,
+ ALL_UNSUPPORTED_VERSIONS.length);
};
-
+
// Attribute that allows a test to request not to start gdbserver even if the session is a remote one
public static final String LAUNCH_GDB_SERVER = TestsPlugin.PLUGIN_ID + ".launchGdbServer";
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/LaunchConfigurationAndRestartTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/LaunchConfigurationAndRestartTest.java
index 4146f67d7ff..1d35a5374a3 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/LaunchConfigurationAndRestartTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/LaunchConfigurationAndRestartTest.java
@@ -77,10 +77,7 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase
protected static final String EXEC_NAME = "LaunchConfigurationAndRestartTestApp.exe";
protected static final String SOURCE_NAME = "LaunchConfigurationAndRestartTestApp.cc";
- protected static final String[] LINE_TAGS = new String[] {
- "FIRST_LINE_IN_MAIN",
- "LAST_LINE_IN_MAIN",
- };
+ protected static final String[] LINE_TAGS = new String[] { "FIRST_LINE_IN_MAIN", "LAST_LINE_IN_MAIN", };
protected int FIRST_LINE_IN_MAIN;
protected int LAST_LINE_IN_MAIN;
@@ -89,20 +86,20 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase
private static final int TEST_EXIT_CODE = 36;
protected DsfSession fSession;
- protected DsfServicesTracker fServicesTracker;
- protected IExpressions fExpService;
- protected IGDBControl fGdbControl;
-
- // Indicates if a restart operation should be done
- // This allows us to re-use tests for restarts tests
- protected boolean fRestart;
-
- @Override
+ protected DsfServicesTracker fServicesTracker;
+ protected IExpressions fExpService;
+ protected IGDBControl fGdbControl;
+
+ // Indicates if a restart operation should be done
+ // This allows us to re-use tests for restarts tests
+ protected boolean fRestart;
+
+ @Override
public void doBeforeTest() throws Exception {
assumeLocalSession();
removeTeminatedLaunchesBeforeTest();
setLaunchAttributes();
- // Can't run the launch right away because each test needs to first set some
+ // Can't run the launch right away because each test needs to first set some
// parameters. The individual tests will be responsible for starting the launch.
// Looks up line tags in source file(s).
@@ -114,514 +111,502 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase
}
@Override
- protected void setLaunchAttributes() {
- super.setLaunchAttributes();
-
- // Set the binary
- setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EXEC_PATH + EXEC_NAME);
- }
-
- // This method cannot be tagged as @Before, because the launch is not
- // running yet. We have to call this manually after all the proper
- // parameters have been set for the launch
- @Override
+ protected void setLaunchAttributes() {
+ super.setLaunchAttributes();
+
+ // Set the binary
+ setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EXEC_PATH + EXEC_NAME);
+ }
+
+ // This method cannot be tagged as @Before, because the launch is not
+ // running yet. We have to call this manually after all the proper
+ // parameters have been set for the launch
+ @Override
protected void doLaunch() throws Exception {
- // perform the launch
- super.doLaunch();
-
- fSession = getGDBLaunch().getSession();
- Runnable runnable = new Runnable() {
- @Override
+ // perform the launch
+ super.doLaunch();
+
+ fSession = getGDBLaunch().getSession();
+ Runnable runnable = new Runnable() {
+ @Override
public void run() {
- fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
-
- fExpService = fServicesTracker.getService(IExpressions.class);
- fGdbControl = fServicesTracker.getService(IGDBControl.class);
- }
- };
- fSession.getExecutor().submit(runnable).get();
-
- // Restart the program if we are testing such a case
- if (fRestart) {
- synchronized (this) {
+ fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
+
+ fExpService = fServicesTracker.getService(IExpressions.class);
+ fGdbControl = fServicesTracker.getService(IGDBControl.class);
+ }
+ };
+ fSession.getExecutor().submit(runnable).get();
+
+ // Restart the program if we are testing such a case
+ if (fRestart) {
+ synchronized (this) {
wait(1000); // XXX: horrible hack, what are we waiting for?
}
- fRestart = false;
+ fRestart = false;
SyncUtil.restart(getGDBLaunch());
- }
- }
+ }
+ }
@Override
public void doAfterTest() throws Exception {
super.doAfterTest();
-
- if (fServicesTracker != null) fServicesTracker.dispose();
- }
-
- // *********************************************************************
- // Below are the tests for the launch configuration.
- // *********************************************************************
-
- /**
- * This test will tell the launch to set the working directory to data/launch/bin/
- * and will verify that we can find the file LaunchConfigurationAndRestartTestApp.cpp.
- * This will confirm that GDB has been properly configured with the working dir.
- */
- @Test
- public void testSettingWorkingDirectory() throws Throwable {
+
+ if (fServicesTracker != null)
+ fServicesTracker.dispose();
+ }
+
+ // *********************************************************************
+ // Below are the tests for the launch configuration.
+ // *********************************************************************
+
+ /**
+ * This test will tell the launch to set the working directory to data/launch/bin/
+ * and will verify that we can find the file LaunchConfigurationAndRestartTestApp.cpp.
+ * This will confirm that GDB has been properly configured with the working dir.
+ */
+ @Test
+ public void testSettingWorkingDirectory() throws Throwable {
String dir = new File(EXEC_PATH).getAbsolutePath();
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, dir);
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, dir + "/" + EXEC_NAME);
- doLaunch();
-
- Query<MIInfo> query = new Query<MIInfo>() {
- @Override
- protected void execute(DataRequestMonitor<MIInfo> rm) {
- fGdbControl.queueCommand(
- fGdbControl.getCommandFactory().createMIFileExecFile(
- fGdbControl.getContext(), EXEC_NAME),
- rm);
- }
- };
- {
- fExpService.getExecutor().execute(query);
- query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
- }
- }
-
+ doLaunch();
+
+ Query<MIInfo> query = new Query<MIInfo>() {
+ @Override
+ protected void execute(DataRequestMonitor<MIInfo> rm) {
+ fGdbControl.queueCommand(
+ fGdbControl.getCommandFactory().createMIFileExecFile(fGdbControl.getContext(), EXEC_NAME), rm);
+ }
+ };
+ {
+ fExpService.getExecutor().execute(query);
+ query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ }
+ }
+
/**
* This test will verify that a launch will fail if the gdbinit file
* does not exist and is not called ".gdbinit".
*/
- @Test
- public void testSourceInvalidGdbInit() throws Throwable {
- setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_GDB_INIT,
- "gdbinitThatDoesNotExist");
- try {
- doLaunch();
- } catch (CoreException e) {
- // Success of the test
- return;
- }
-
- fail("Launch seems to have succeeded even though the gdbinit file did not exist");
- }
+ @Test
+ public void testSourceInvalidGdbInit() throws Throwable {
+ setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_GDB_INIT, "gdbinitThatDoesNotExist");
+ try {
+ doLaunch();
+ } catch (CoreException e) {
+ // Success of the test
+ return;
+ }
+
+ fail("Launch seems to have succeeded even though the gdbinit file did not exist");
+ }
/**
* This test will verify that a launch does not fail if the gdbinit file
* is called ".gdbinit" and does not exist
*/
- @Test
- public void testSourceDefaultGdbInit() throws Throwable {
- setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_GDB_INIT,
- ".gdbinit");
- try {
- doLaunch();
- } catch (CoreException e) {
- throw new AssertionError("Launch has failed even though the gdbinit file has the default name of .gdbinit", e);
- }
- }
-
- /**
- * This test will tell the launch to use data/launch/src/launchConfigTestGdbinit
- * as the gdbinit file. We then verify the that the content was properly read.
- * launchConfigTestGdbinit will simply set some arguments for the program to read;
- * the arguments are "1 2 3 4 5 6".
- *
- * This test is disabled for gdb.7.1 because gdb inserts an extraneous \n that messes up
- * the launch sequence (more particularly, the byte length detection):
- *
- * 17-interpreter-exec console "p/x (char)-1"
- * ~"\n"
- * ~"$1 = 0xff\n"
- * 17^done
- */
- @Test
-
- public void testSourceGdbInit() throws Throwable {
- assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_2);
- setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_GDB_INIT,
- "data/launch/src/launchConfigTestGdbinit");
- doLaunch();
-
- MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
-
- // Check that argc is correct
- final IExpressionDMContext argcDmc = SyncUtil.createExpression(stoppedEvent.getDMContext(), "argc");
- Query<FormattedValueDMData> query = new Query<FormattedValueDMData>() {
- @Override
- protected void execute(DataRequestMonitor<FormattedValueDMData> rm) {
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(argcDmc, MIExpressions.DETAILS_FORMAT), rm);
- }
- };
- {
- fExpService.getExecutor().execute(query);
- FormattedValueDMData value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
-
- // Argc should be 7: the program name and the six arguments
- assertTrue("Expected 7 but got " + value.getFormattedValue(),
- value.getFormattedValue().trim().equals("7"));
- }
-
- // Check that argv is also correct. For simplicity we only check the last argument
- final IExpressionDMContext argvDmc = SyncUtil.createExpression(stoppedEvent.getDMContext(), "argv[argc-1]");
- Query<FormattedValueDMData> query2 = new Query<FormattedValueDMData>() {
- @Override
- protected void execute(DataRequestMonitor<FormattedValueDMData> rm) {
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(argvDmc, MIExpressions.DETAILS_FORMAT), rm);
- }
- };
- {
- fExpService.getExecutor().execute(query2);
- FormattedValueDMData value = query2.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
- assertTrue("Expected \"6\" but got " + value.getFormattedValue(),
- value.getFormattedValue().trim().endsWith("\"6\""));
- }
- }
-
- /**
- * Repeat the test testSourceGdbInit, but after a restart.
- */
- @Test
- public void testSourceGdbInitRestart() throws Throwable {
- assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_2);
- fRestart = true;
- testSourceGdbInit();
- }
-
- /**
- * This test will tell the launch to clear the environment variables. We will
- * then check that the variable $HOME cannot be found by the program.
- */
- @Test
- public void testClearingEnvironment() throws Throwable {
- setLaunchAttribute(ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES, false);
- doLaunch();
-
- SyncUtil.runToLocation("envTest");
- MIStoppedEvent stoppedEvent = SyncUtil.step(2, StepType.STEP_OVER);
-
- // The program has stored the content of $HOME into a variable called 'home'.
- // Let's verify this variable is 0x0 which means $HOME does not exist.
- final IExpressionDMContext exprDmc = SyncUtil.createExpression(stoppedEvent.getDMContext(), "home");
- Query<FormattedValueDMData> query = new Query<FormattedValueDMData>() {
+ @Test
+ public void testSourceDefaultGdbInit() throws Throwable {
+ setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit");
+ try {
+ doLaunch();
+ } catch (CoreException e) {
+ throw new AssertionError("Launch has failed even though the gdbinit file has the default name of .gdbinit",
+ e);
+ }
+ }
+
+ /**
+ * This test will tell the launch to use data/launch/src/launchConfigTestGdbinit
+ * as the gdbinit file. We then verify the that the content was properly read.
+ * launchConfigTestGdbinit will simply set some arguments for the program to read;
+ * the arguments are "1 2 3 4 5 6".
+ *
+ * This test is disabled for gdb.7.1 because gdb inserts an extraneous \n that messes up
+ * the launch sequence (more particularly, the byte length detection):
+ *
+ * 17-interpreter-exec console "p/x (char)-1"
+ * ~"\n"
+ * ~"$1 = 0xff\n"
+ * 17^done
+ */
+ @Test
+
+ public void testSourceGdbInit() throws Throwable {
+ assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_2);
+ setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_GDB_INIT, "data/launch/src/launchConfigTestGdbinit");
+ doLaunch();
+
+ MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
+
+ // Check that argc is correct
+ final IExpressionDMContext argcDmc = SyncUtil.createExpression(stoppedEvent.getDMContext(), "argc");
+ Query<FormattedValueDMData> query = new Query<FormattedValueDMData>() {
@Override
protected void execute(DataRequestMonitor<FormattedValueDMData> rm) {
fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(exprDmc, MIExpressions.DETAILS_FORMAT), rm);
+ fExpService.getFormattedValueContext(argcDmc, MIExpressions.DETAILS_FORMAT), rm);
}
- };
- {
- fExpService.getExecutor().execute(query);
- FormattedValueDMData value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
- assertTrue("Expected 0x0 but got " + value.getFormattedValue(),
- value.getFormattedValue().equals("0x0"));
- }
- }
-
- /**
- * Repeat the test testClearingEnvironment, but after a restart.
- */
- @Test
- public void testClearingEnvironmentRestart() throws Throwable {
- fRestart = true;
- testClearingEnvironment();
- }
-
- /**
- * This test will tell the launch to set a new environment variable LAUNCHTEST.
- * We will then check that this new variable can be read by the program.
- */
- @Test
- public void testSettingEnvironment() throws Throwable {
- setLaunchAttribute(ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES, true);
-
- Map<String, String> map = new HashMap<String, String>(1);
- map.put("LAUNCHTEST", "IS SET");
- setLaunchAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, map);
- doLaunch();
-
- SyncUtil.runToLocation("envTest");
- MIStoppedEvent stoppedEvent = SyncUtil.step(2, StepType.STEP_OVER);
-
- // The program has stored the content of $LAUNCHTEST into a variable called 'launchTest'.
- // Let's verify this variable is set to "IS SET".
- final IExpressionDMContext exprDmc = SyncUtil.createExpression(stoppedEvent.getDMContext(), "launchTest");
- Query<FormattedValueDMData> query = new Query<FormattedValueDMData>() {
- @Override
- protected void execute(DataRequestMonitor<FormattedValueDMData> rm) {
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(exprDmc, MIExpressions.DETAILS_FORMAT), rm);
- }
- };
- {
- fExpService.getExecutor().execute(query);
- FormattedValueDMData value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
- assertTrue("Expected a string ending with \"IS SET\" but got " + value.getFormattedValue(),
- value.getFormattedValue().trim().endsWith("\"IS SET\""));
- }
-
- // Check that the normal environment is there by checking that $HOME (which is stored in 'home" exists.
- final IExpressionDMContext exprDmc2 = SyncUtil.createExpression(stoppedEvent.getDMContext(), "home");
- Query<FormattedValueDMData> query2 = new Query<FormattedValueDMData>() {
+ };
+ {
+ fExpService.getExecutor().execute(query);
+ FormattedValueDMData value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+
+ // Argc should be 7: the program name and the six arguments
+ assertTrue("Expected 7 but got " + value.getFormattedValue(), value.getFormattedValue().trim().equals("7"));
+ }
+
+ // Check that argv is also correct. For simplicity we only check the last argument
+ final IExpressionDMContext argvDmc = SyncUtil.createExpression(stoppedEvent.getDMContext(), "argv[argc-1]");
+ Query<FormattedValueDMData> query2 = new Query<FormattedValueDMData>() {
@Override
protected void execute(DataRequestMonitor<FormattedValueDMData> rm) {
fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(exprDmc2, MIExpressions.DETAILS_FORMAT), rm);
+ fExpService.getFormattedValueContext(argvDmc, MIExpressions.DETAILS_FORMAT), rm);
}
- };
- {
- fExpService.getExecutor().execute(query2);
- FormattedValueDMData value = query2.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
- assertFalse("Expected something else than 0x0",
- value.getFormattedValue().equals("0x0"));
- }
-
- }
-
- /**
- * Repeat the test testSettingEnvironment, but after a restart.
- */
- @Test
- public void testSettingEnvironmentRestart() throws Throwable {
- fRestart = true;
- testSettingEnvironment();
- }
-
- /**
- * This test will tell the launch to clear the environment variables and then
- * set a new environment variable LAUNCHTEST. We will then check that the variable
- * $HOME cannot be found by the program and that the new variable LAUNCHTEST can be
- * read by the program.
- */
- @Test
- public void testClearingAndSettingEnvironment() throws Throwable {
- setLaunchAttribute(ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES, false);
-
- Map<String, String> map = new HashMap<String, String>(1);
- map.put("LAUNCHTEST", "IS SET");
- setLaunchAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, map);
- doLaunch();
-
- SyncUtil.runToLocation("envTest");
- MIStoppedEvent stoppedEvent = SyncUtil.step(2, StepType.STEP_OVER);
-
- // The program has stored the content of $LAUNCHTEST into a variable called 'launchTest'.
- // Let's verify this variable is set to "IS SET".
- final IExpressionDMContext exprDmc = SyncUtil.createExpression(stoppedEvent.getDMContext(), "launchTest");
- Query<FormattedValueDMData> query = new Query<FormattedValueDMData>() {
- @Override
- protected void execute(DataRequestMonitor<FormattedValueDMData> rm) {
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(exprDmc, MIExpressions.DETAILS_FORMAT), rm);
- }
- };
- {
- fExpService.getExecutor().execute(query);
- FormattedValueDMData value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
- assertTrue("Expected a string ending with \"IS SET\" but got " + value.getFormattedValue(),
- value.getFormattedValue().trim().endsWith("\"IS SET\""));
- }
-
- // The program has stored the content of $HOME into a variable called 'home'.
- // Let's verify this variable is 0x0 which means it does not exist.
- final IExpressionDMContext exprDmc2 = SyncUtil.createExpression(stoppedEvent.getDMContext(), "home");
- Query<FormattedValueDMData> query2 = new Query<FormattedValueDMData>() {
+ };
+ {
+ fExpService.getExecutor().execute(query2);
+ FormattedValueDMData value = query2.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ assertTrue("Expected \"6\" but got " + value.getFormattedValue(),
+ value.getFormattedValue().trim().endsWith("\"6\""));
+ }
+ }
+
+ /**
+ * Repeat the test testSourceGdbInit, but after a restart.
+ */
+ @Test
+ public void testSourceGdbInitRestart() throws Throwable {
+ assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_2);
+ fRestart = true;
+ testSourceGdbInit();
+ }
+
+ /**
+ * This test will tell the launch to clear the environment variables. We will
+ * then check that the variable $HOME cannot be found by the program.
+ */
+ @Test
+ public void testClearingEnvironment() throws Throwable {
+ setLaunchAttribute(ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES, false);
+ doLaunch();
+
+ SyncUtil.runToLocation("envTest");
+ MIStoppedEvent stoppedEvent = SyncUtil.step(2, StepType.STEP_OVER);
+
+ // The program has stored the content of $HOME into a variable called 'home'.
+ // Let's verify this variable is 0x0 which means $HOME does not exist.
+ final IExpressionDMContext exprDmc = SyncUtil.createExpression(stoppedEvent.getDMContext(), "home");
+ Query<FormattedValueDMData> query = new Query<FormattedValueDMData>() {
@Override
protected void execute(DataRequestMonitor<FormattedValueDMData> rm) {
fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(exprDmc2, MIExpressions.DETAILS_FORMAT), rm);
+ fExpService.getFormattedValueContext(exprDmc, MIExpressions.DETAILS_FORMAT), rm);
}
- };
- {
- fExpService.getExecutor().execute(query2);
- FormattedValueDMData value = query2.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
- assertTrue("Expected 0x0 but got " + value.getFormattedValue(),
- value.getFormattedValue().equals("0x0"));
- }
- }
-
- /**
- * Repeat the test testClearingAndSettingEnvironment, but after a restart.
- */
- @Test
- public void testClearingAndSettingEnvironmentRestart() throws Throwable {
- fRestart = true;
- testClearingAndSettingEnvironment();
- }
-
- /**
- * This test will tell the launch to set some arguments for the program. We will
- * then check that the program has the same arguments.
- *
- * NOTE: The main setting arguments tests are in {@link CommandLineArgsTest}, this
- * test remains here to test interaction of command line arguments are restarting.
- * See {@link #testSettingArgumentsRestart()}
- */
- @Test
- public void testSettingArguments() throws Throwable {
- setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, "1 2 3\n4 5 6");
- doLaunch();
-
- MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
-
- // Check that argc is correct
- final IExpressionDMContext argcDmc = SyncUtil.createExpression(stoppedEvent.getDMContext(), "argc");
- Query<FormattedValueDMData> query = new Query<FormattedValueDMData>() {
- @Override
- protected void execute(DataRequestMonitor<FormattedValueDMData> rm) {
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(argcDmc, MIExpressions.DETAILS_FORMAT), rm);
- }
- };
- {
- fExpService.getExecutor().execute(query);
- FormattedValueDMData value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
-
- // Argc should be 7: the program name and the six arguments
- assertTrue("Expected 7 but got " + value.getFormattedValue(),
- value.getFormattedValue().trim().equals("7"));
- }
-
- // Check that argv is also correct. For simplicity we only check the last argument
- final IExpressionDMContext argvDmc = SyncUtil.createExpression(stoppedEvent.getDMContext(), "argv[argc-1]");
- Query<FormattedValueDMData> query2 = new Query<FormattedValueDMData>() {
- @Override
- protected void execute(DataRequestMonitor<FormattedValueDMData> rm) {
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(argvDmc, MIExpressions.DETAILS_FORMAT), rm);
- }
- };
- {
- fExpService.getExecutor().execute(query2);
- FormattedValueDMData value = query2.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
- assertTrue("Expected \"6\" but got " + value.getFormattedValue(),
- value.getFormattedValue().trim().endsWith("\"6\""));
- }
- }
-
- /**
- * Repeat the test testSettingArguments, but after a restart.
- */
- @Test
- public void testSettingArgumentsRestart() throws Throwable {
- fRestart = true;
- testSettingArguments();
- }
-
- /**
- * This test will tell the launch to "stop on main" at method main(), which we will verify.
- */
- @Test
- public void testStopAtMain() throws Throwable {
- setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, true);
- setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, "main");
- doLaunch();
-
- MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
- assertTrue("Expected to stop at main:27 but got " +
- stoppedEvent.getFrame().getFunction() + ":" +
- Integer.toString(stoppedEvent.getFrame().getLine()),
- stoppedEvent.getFrame().getFunction().equals("main") &&
- stoppedEvent.getFrame().getLine() == 27);
- }
-
- /**
- * Repeat the test testStopAtMain, but after a restart.
- */
- @Test
- public void testStopAtMainRestart() throws Throwable {
- fRestart = true;
- testStopAtMain();
- }
-
- /**
- * This test will tell the launch to "stop on main" at method stopAtOther(),
- * which we will then verify.
- */
- @Test
- public void testStopAtOther() throws Throwable {
- setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, true);
- setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, "stopAtOther");
- doLaunch();
-
- MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
- assertTrue("Expected to stop at stopAtOther but got " +
- stoppedEvent.getFrame().getFunction() + ":",
- stoppedEvent.getFrame().getFunction().equals("stopAtOther"));
- }
-
- /**
- * Repeat the test testStopAtOther, but after a restart.
- */
- @Test
- public void testStopAtOtherRestart() throws Throwable {
- fRestart = true;
- testStopAtOther();
- }
-
-
- /**
- * This test will set a breakpoint at some place in the program and will tell
- * the launch to NOT "stop on main". We will verify that the first stop is
- * at the breakpoint that we set.
- */
- @Ignore
- @Test
- public void testNoStopAtMain() throws Throwable {
- setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, false);
- // Set this one as well to make sure it gets ignored
- setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, "main");
-
- // We need to set the breakpoint before the launch is started, but the only way to do that is
- // to set it in the platorm. Ok, but how do I get an IResource that points to my binary?
- // The current workspace is the JUnit runtime workspace instead of the workspace containing
- // the JUnit tests.
-
- IFile fakeFile = null;
- CDIDebugModel.createLineBreakpoint(EXEC_PATH + EXEC_NAME, fakeFile, ICBreakpointType.REGULAR, LAST_LINE_IN_MAIN + 1, true, 0, "", true); //$NON-NLS-1$
- doLaunch();
-
- MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
- assertTrue("Expected to stop at envTest but got " +
- stoppedEvent.getFrame().getFunction() + ":",
- stoppedEvent.getFrame().getFunction().equals("envTest"));
- }
-
- /**
- * Repeat the test testNoStopAtMain, but after a restart.
- */
- @Ignore
- @Test
- public void testNoStopAtMainRestart() throws Throwable {
- fRestart = true;
- testNoStopAtMain();
- }
-
- /**
- * Test that the exit code is available after the inferior as run to
- * completion so that the console can use it.
- */
- @Test
- public void testExitCodeSet() throws Throwable {
- assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_3);
- doLaunch();
-
- ServiceEventWaitor<ICommandControlShutdownDMEvent> shutdownEventWaitor = new ServiceEventWaitor<ICommandControlShutdownDMEvent>(
- getGDBLaunch().getSession(),
- ICommandControlShutdownDMEvent.class);
-
- // The target is currently stopped. We resume to get it running
- // and wait for a shutdown event to say execution has completed
- SyncUtil.resume();
-
- shutdownEventWaitor.waitForEvent(TestsPlugin.massageTimeout(1000));
-
-
- IProcess[] launchProcesses = getGDBLaunch().getProcesses();;
+ };
+ {
+ fExpService.getExecutor().execute(query);
+ FormattedValueDMData value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ assertTrue("Expected 0x0 but got " + value.getFormattedValue(), value.getFormattedValue().equals("0x0"));
+ }
+ }
+
+ /**
+ * Repeat the test testClearingEnvironment, but after a restart.
+ */
+ @Test
+ public void testClearingEnvironmentRestart() throws Throwable {
+ fRestart = true;
+ testClearingEnvironment();
+ }
+
+ /**
+ * This test will tell the launch to set a new environment variable LAUNCHTEST.
+ * We will then check that this new variable can be read by the program.
+ */
+ @Test
+ public void testSettingEnvironment() throws Throwable {
+ setLaunchAttribute(ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES, true);
+
+ Map<String, String> map = new HashMap<String, String>(1);
+ map.put("LAUNCHTEST", "IS SET");
+ setLaunchAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, map);
+ doLaunch();
+
+ SyncUtil.runToLocation("envTest");
+ MIStoppedEvent stoppedEvent = SyncUtil.step(2, StepType.STEP_OVER);
+
+ // The program has stored the content of $LAUNCHTEST into a variable called 'launchTest'.
+ // Let's verify this variable is set to "IS SET".
+ final IExpressionDMContext exprDmc = SyncUtil.createExpression(stoppedEvent.getDMContext(), "launchTest");
+ Query<FormattedValueDMData> query = new Query<FormattedValueDMData>() {
+ @Override
+ protected void execute(DataRequestMonitor<FormattedValueDMData> rm) {
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, MIExpressions.DETAILS_FORMAT), rm);
+ }
+ };
+ {
+ fExpService.getExecutor().execute(query);
+ FormattedValueDMData value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ assertTrue("Expected a string ending with \"IS SET\" but got " + value.getFormattedValue(),
+ value.getFormattedValue().trim().endsWith("\"IS SET\""));
+ }
+
+ // Check that the normal environment is there by checking that $HOME (which is stored in 'home" exists.
+ final IExpressionDMContext exprDmc2 = SyncUtil.createExpression(stoppedEvent.getDMContext(), "home");
+ Query<FormattedValueDMData> query2 = new Query<FormattedValueDMData>() {
+ @Override
+ protected void execute(DataRequestMonitor<FormattedValueDMData> rm) {
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc2, MIExpressions.DETAILS_FORMAT), rm);
+ }
+ };
+ {
+ fExpService.getExecutor().execute(query2);
+ FormattedValueDMData value = query2.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ assertFalse("Expected something else than 0x0", value.getFormattedValue().equals("0x0"));
+ }
+
+ }
+
+ /**
+ * Repeat the test testSettingEnvironment, but after a restart.
+ */
+ @Test
+ public void testSettingEnvironmentRestart() throws Throwable {
+ fRestart = true;
+ testSettingEnvironment();
+ }
+
+ /**
+ * This test will tell the launch to clear the environment variables and then
+ * set a new environment variable LAUNCHTEST. We will then check that the variable
+ * $HOME cannot be found by the program and that the new variable LAUNCHTEST can be
+ * read by the program.
+ */
+ @Test
+ public void testClearingAndSettingEnvironment() throws Throwable {
+ setLaunchAttribute(ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES, false);
+
+ Map<String, String> map = new HashMap<String, String>(1);
+ map.put("LAUNCHTEST", "IS SET");
+ setLaunchAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, map);
+ doLaunch();
+
+ SyncUtil.runToLocation("envTest");
+ MIStoppedEvent stoppedEvent = SyncUtil.step(2, StepType.STEP_OVER);
+
+ // The program has stored the content of $LAUNCHTEST into a variable called 'launchTest'.
+ // Let's verify this variable is set to "IS SET".
+ final IExpressionDMContext exprDmc = SyncUtil.createExpression(stoppedEvent.getDMContext(), "launchTest");
+ Query<FormattedValueDMData> query = new Query<FormattedValueDMData>() {
+ @Override
+ protected void execute(DataRequestMonitor<FormattedValueDMData> rm) {
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, MIExpressions.DETAILS_FORMAT), rm);
+ }
+ };
+ {
+ fExpService.getExecutor().execute(query);
+ FormattedValueDMData value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ assertTrue("Expected a string ending with \"IS SET\" but got " + value.getFormattedValue(),
+ value.getFormattedValue().trim().endsWith("\"IS SET\""));
+ }
+
+ // The program has stored the content of $HOME into a variable called 'home'.
+ // Let's verify this variable is 0x0 which means it does not exist.
+ final IExpressionDMContext exprDmc2 = SyncUtil.createExpression(stoppedEvent.getDMContext(), "home");
+ Query<FormattedValueDMData> query2 = new Query<FormattedValueDMData>() {
+ @Override
+ protected void execute(DataRequestMonitor<FormattedValueDMData> rm) {
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc2, MIExpressions.DETAILS_FORMAT), rm);
+ }
+ };
+ {
+ fExpService.getExecutor().execute(query2);
+ FormattedValueDMData value = query2.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ assertTrue("Expected 0x0 but got " + value.getFormattedValue(), value.getFormattedValue().equals("0x0"));
+ }
+ }
+
+ /**
+ * Repeat the test testClearingAndSettingEnvironment, but after a restart.
+ */
+ @Test
+ public void testClearingAndSettingEnvironmentRestart() throws Throwable {
+ fRestart = true;
+ testClearingAndSettingEnvironment();
+ }
+
+ /**
+ * This test will tell the launch to set some arguments for the program. We will
+ * then check that the program has the same arguments.
+ *
+ * NOTE: The main setting arguments tests are in {@link CommandLineArgsTest}, this
+ * test remains here to test interaction of command line arguments are restarting.
+ * See {@link #testSettingArgumentsRestart()}
+ */
+ @Test
+ public void testSettingArguments() throws Throwable {
+ setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, "1 2 3\n4 5 6");
+ doLaunch();
+
+ MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
+
+ // Check that argc is correct
+ final IExpressionDMContext argcDmc = SyncUtil.createExpression(stoppedEvent.getDMContext(), "argc");
+ Query<FormattedValueDMData> query = new Query<FormattedValueDMData>() {
+ @Override
+ protected void execute(DataRequestMonitor<FormattedValueDMData> rm) {
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(argcDmc, MIExpressions.DETAILS_FORMAT), rm);
+ }
+ };
+ {
+ fExpService.getExecutor().execute(query);
+ FormattedValueDMData value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+
+ // Argc should be 7: the program name and the six arguments
+ assertTrue("Expected 7 but got " + value.getFormattedValue(), value.getFormattedValue().trim().equals("7"));
+ }
+
+ // Check that argv is also correct. For simplicity we only check the last argument
+ final IExpressionDMContext argvDmc = SyncUtil.createExpression(stoppedEvent.getDMContext(), "argv[argc-1]");
+ Query<FormattedValueDMData> query2 = new Query<FormattedValueDMData>() {
+ @Override
+ protected void execute(DataRequestMonitor<FormattedValueDMData> rm) {
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(argvDmc, MIExpressions.DETAILS_FORMAT), rm);
+ }
+ };
+ {
+ fExpService.getExecutor().execute(query2);
+ FormattedValueDMData value = query2.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ assertTrue("Expected \"6\" but got " + value.getFormattedValue(),
+ value.getFormattedValue().trim().endsWith("\"6\""));
+ }
+ }
+
+ /**
+ * Repeat the test testSettingArguments, but after a restart.
+ */
+ @Test
+ public void testSettingArgumentsRestart() throws Throwable {
+ fRestart = true;
+ testSettingArguments();
+ }
+
+ /**
+ * This test will tell the launch to "stop on main" at method main(), which we will verify.
+ */
+ @Test
+ public void testStopAtMain() throws Throwable {
+ setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, true);
+ setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, "main");
+ doLaunch();
+
+ MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
+ assertTrue(
+ "Expected to stop at main:27 but got " + stoppedEvent.getFrame().getFunction() + ":"
+ + Integer.toString(stoppedEvent.getFrame().getLine()),
+ stoppedEvent.getFrame().getFunction().equals("main") && stoppedEvent.getFrame().getLine() == 27);
+ }
+
+ /**
+ * Repeat the test testStopAtMain, but after a restart.
+ */
+ @Test
+ public void testStopAtMainRestart() throws Throwable {
+ fRestart = true;
+ testStopAtMain();
+ }
+
+ /**
+ * This test will tell the launch to "stop on main" at method stopAtOther(),
+ * which we will then verify.
+ */
+ @Test
+ public void testStopAtOther() throws Throwable {
+ setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, true);
+ setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, "stopAtOther");
+ doLaunch();
+
+ MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
+ assertTrue("Expected to stop at stopAtOther but got " + stoppedEvent.getFrame().getFunction() + ":",
+ stoppedEvent.getFrame().getFunction().equals("stopAtOther"));
+ }
+
+ /**
+ * Repeat the test testStopAtOther, but after a restart.
+ */
+ @Test
+ public void testStopAtOtherRestart() throws Throwable {
+ fRestart = true;
+ testStopAtOther();
+ }
+
+ /**
+ * This test will set a breakpoint at some place in the program and will tell
+ * the launch to NOT "stop on main". We will verify that the first stop is
+ * at the breakpoint that we set.
+ */
+ @Ignore
+ @Test
+ public void testNoStopAtMain() throws Throwable {
+ setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, false);
+ // Set this one as well to make sure it gets ignored
+ setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, "main");
+
+ // We need to set the breakpoint before the launch is started, but the only way to do that is
+ // to set it in the platorm. Ok, but how do I get an IResource that points to my binary?
+ // The current workspace is the JUnit runtime workspace instead of the workspace containing
+ // the JUnit tests.
+
+ IFile fakeFile = null;
+ CDIDebugModel.createLineBreakpoint(EXEC_PATH + EXEC_NAME, fakeFile, ICBreakpointType.REGULAR,
+ LAST_LINE_IN_MAIN + 1, true, 0, "", true); //$NON-NLS-1$
+ doLaunch();
+
+ MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
+ assertTrue("Expected to stop at envTest but got " + stoppedEvent.getFrame().getFunction() + ":",
+ stoppedEvent.getFrame().getFunction().equals("envTest"));
+ }
+
+ /**
+ * Repeat the test testNoStopAtMain, but after a restart.
+ */
+ @Ignore
+ @Test
+ public void testNoStopAtMainRestart() throws Throwable {
+ fRestart = true;
+ testNoStopAtMain();
+ }
+
+ /**
+ * Test that the exit code is available after the inferior as run to
+ * completion so that the console can use it.
+ */
+ @Test
+ public void testExitCodeSet() throws Throwable {
+ assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_3);
+ doLaunch();
+
+ ServiceEventWaitor<ICommandControlShutdownDMEvent> shutdownEventWaitor = new ServiceEventWaitor<ICommandControlShutdownDMEvent>(
+ getGDBLaunch().getSession(), ICommandControlShutdownDMEvent.class);
+
+ // The target is currently stopped. We resume to get it running
+ // and wait for a shutdown event to say execution has completed
+ SyncUtil.resume();
+
+ shutdownEventWaitor.waitForEvent(TestsPlugin.massageTimeout(1000));
+
+ IProcess[] launchProcesses = getGDBLaunch().getProcesses();
+ ;
for (IProcess proc : launchProcesses) {
if (proc instanceof InferiorRuntimeProcess) {
assertThat(proc.getAttribute(IGdbDebugConstants.INFERIOR_EXITED_ATTR), is(notNullValue()));
@@ -631,7 +616,7 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase
while (count++ < 100 && !proc.isTerminated()) {
try {
synchronized (proc) {
- proc.wait(10);
+ proc.wait(10);
}
} catch (InterruptedException ie) {
}
@@ -643,282 +628,266 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase
}
}
assert false;
- }
-
-
+ }
+
/**
* This test will confirm that we have turned on "pending breakpoints"
* The pending breakpoint setting only affects CLI commands so we have
* to test with one. We don't have classes to set breakpoints using CLI,
* but we do for tracepoints, which is the same for this test.
- *
+ *
* The pending breakpoint feature only works with tracepoints starting
* with GDB 7.0.
- *
+ *
* We could run this test before 7.0 but we would have to use a breakpoint
* set using CLI commands.
*/
- @Test
- public void testPendingBreakpointSetting() throws Throwable {
- assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_0);
- doLaunch();
- MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
-
- final IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(stoppedEvent.getDMContext(),
- IBreakpointsTargetDMContext.class);
- Query<MIBreakListInfo> query = new Query<MIBreakListInfo>() {
- @Override
- protected void execute(final DataRequestMonitor<MIBreakListInfo> rm) {
- fGdbControl.queueCommand(
- fGdbControl.getCommandFactory().createCLITrace(bpTargetDmc, "invalid", ""),
- new ImmediateDataRequestMonitor<CLITraceInfo>(rm) {
- @Override
- protected void handleSuccess() {
- fGdbControl.queueCommand(
- fGdbControl.getCommandFactory().createMIBreakList(bpTargetDmc),
- new ImmediateDataRequestMonitor<MIBreakListInfo>(rm) {
- @Override
- protected void handleSuccess() {
- rm.setData(getData());
- rm.done();
- }
- });
- }
- });
- }
- };
- {
- fExpService.getExecutor().execute(query);
- MIBreakListInfo value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
- MIBreakpoint[] bps = value.getMIBreakpoints();
- assertTrue("Expected 1 breakpoint but got " + bps.length,
- bps.length == 1);
- assertTrue("Expending a <PENDING> breakpoint but got one at " + bps[0].getAddress(),
- bps[0].getAddress().equals("<PENDING>"));
- }
- }
-
- /**
- * This test will tell the launch to "stop on main" at method main() with reverse
- * debugging enabled. We will verify that the launch stops at main() and that
- * reverse debugging is enabled.
- *
- * In this test, the execution crosses getenv() while recording is enabled. gdb 7.0
- * and 7.1 have trouble with that. We disable the test for those, and enable it for
- * 7.2 and upwards.
- */
- @Test
- public void testStopAtMainWithReverse() throws Throwable {
- assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_2);
- setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, true);
- setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, "main");
- setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE, true);
- doLaunch();
-
- MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
- // Make sure we stopped at the first line of main
- assertTrue("Expected to stop at main:" + FIRST_LINE_IN_MAIN + " but got " +
- stoppedEvent.getFrame().getFunction() + ":" +
- Integer.toString(stoppedEvent.getFrame().getLine()),
- stoppedEvent.getFrame().getFunction().equals("main") &&
- stoppedEvent.getFrame().getLine() == FIRST_LINE_IN_MAIN);
-
- // Step a couple of times and check where we are
- final int NUM_STEPS = 3;
- stoppedEvent = SyncUtil.step(NUM_STEPS, StepType.STEP_OVER);
- assertTrue("Expected to stop at main:" + (FIRST_LINE_IN_MAIN+NUM_STEPS) + " but got " +
- stoppedEvent.getFrame().getFunction() + ":" +
- Integer.toString(stoppedEvent.getFrame().getLine()),
- stoppedEvent.getFrame().getFunction().equals("main") &&
- stoppedEvent.getFrame().getLine() == FIRST_LINE_IN_MAIN+NUM_STEPS);
-
- // Now step backwards to make sure reverse was enabled
-
- final ServiceEventWaitor<MIStoppedEvent> eventWaitor =
- new ServiceEventWaitor<MIStoppedEvent>(
- fSession,
- MIStoppedEvent.class);
-
- final int REVERSE_NUM_STEPS = 2;
- final IExecutionDMContext execDmc = stoppedEvent.getDMContext();
- Query<MIInfo> query = new Query<MIInfo>() {
- @Override
- protected void execute(DataRequestMonitor<MIInfo> rm) {
- fGdbControl.queueCommand(
- fGdbControl.getCommandFactory().createMIExecReverseNext(execDmc, REVERSE_NUM_STEPS),
- rm);
- }
- };
- {
- fGdbControl.getExecutor().execute(query);
- query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
- }
-
- stoppedEvent = eventWaitor.waitForEvent(TestsPlugin.massageTimeout(1000));
-
- assertTrue("Expected to stop at main:" + (FIRST_LINE_IN_MAIN+NUM_STEPS-REVERSE_NUM_STEPS) + " but got " +
- stoppedEvent.getFrame().getFunction() + ":" +
- Integer.toString(stoppedEvent.getFrame().getLine()),
- stoppedEvent.getFrame().getFunction().equals("main") &&
- stoppedEvent.getFrame().getLine() == FIRST_LINE_IN_MAIN+NUM_STEPS-REVERSE_NUM_STEPS);
- }
-
- /**
- * Repeat the test testStopAtMainWithReverse, but after a restart.
- */
- @Test
- public void testStopAtMainWithReverseRestart() throws Throwable {
- assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_2);
- fRestart = true;
- testStopAtMainWithReverse();
- }
-
- /**
- * This test will tell the launch to "stop on main" at method stopAtOther(),
- * with reverse debugging enabled. We will then verify that the launch is properly
- * stopped at stopAtOther() and that it can go backwards until main() (this will
- * confirm that reverse debugging was enabled at the very start).
- *
- * In this test, the execution crosses getenv() while recording is enabled. gdb 7.0
- * and 7.1 have trouble with that. We disable the test for those, and enable it for
- * 7.2 and upwards.
- */
@Test
- public void testStopAtOtherWithReverse() throws Throwable {
+ public void testPendingBreakpointSetting() throws Throwable {
+ assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_0);
+ doLaunch();
+ MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
+
+ final IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(stoppedEvent.getDMContext(),
+ IBreakpointsTargetDMContext.class);
+ Query<MIBreakListInfo> query = new Query<MIBreakListInfo>() {
+ @Override
+ protected void execute(final DataRequestMonitor<MIBreakListInfo> rm) {
+ fGdbControl.queueCommand(fGdbControl.getCommandFactory().createCLITrace(bpTargetDmc, "invalid", ""),
+ new ImmediateDataRequestMonitor<CLITraceInfo>(rm) {
+ @Override
+ protected void handleSuccess() {
+ fGdbControl.queueCommand(fGdbControl.getCommandFactory().createMIBreakList(bpTargetDmc),
+ new ImmediateDataRequestMonitor<MIBreakListInfo>(rm) {
+ @Override
+ protected void handleSuccess() {
+ rm.setData(getData());
+ rm.done();
+ }
+ });
+ }
+ });
+ }
+ };
+ {
+ fExpService.getExecutor().execute(query);
+ MIBreakListInfo value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ MIBreakpoint[] bps = value.getMIBreakpoints();
+ assertTrue("Expected 1 breakpoint but got " + bps.length, bps.length == 1);
+ assertTrue("Expending a <PENDING> breakpoint but got one at " + bps[0].getAddress(),
+ bps[0].getAddress().equals("<PENDING>"));
+ }
+ }
+
+ /**
+ * This test will tell the launch to "stop on main" at method main() with reverse
+ * debugging enabled. We will verify that the launch stops at main() and that
+ * reverse debugging is enabled.
+ *
+ * In this test, the execution crosses getenv() while recording is enabled. gdb 7.0
+ * and 7.1 have trouble with that. We disable the test for those, and enable it for
+ * 7.2 and upwards.
+ */
+ @Test
+ public void testStopAtMainWithReverse() throws Throwable {
+ assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_2);
+ setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, true);
+ setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, "main");
+ setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE, true);
+ doLaunch();
+
+ MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
+ // Make sure we stopped at the first line of main
+ assertTrue(
+ "Expected to stop at main:" + FIRST_LINE_IN_MAIN + " but got " + stoppedEvent.getFrame().getFunction()
+ + ":" + Integer.toString(stoppedEvent.getFrame().getLine()),
+ stoppedEvent.getFrame().getFunction().equals("main")
+ && stoppedEvent.getFrame().getLine() == FIRST_LINE_IN_MAIN);
+
+ // Step a couple of times and check where we are
+ final int NUM_STEPS = 3;
+ stoppedEvent = SyncUtil.step(NUM_STEPS, StepType.STEP_OVER);
+ assertTrue("Expected to stop at main:" + (FIRST_LINE_IN_MAIN + NUM_STEPS) + " but got "
+ + stoppedEvent.getFrame().getFunction() + ":" + Integer.toString(stoppedEvent.getFrame().getLine()),
+ stoppedEvent.getFrame().getFunction().equals("main")
+ && stoppedEvent.getFrame().getLine() == FIRST_LINE_IN_MAIN + NUM_STEPS);
+
+ // Now step backwards to make sure reverse was enabled
+
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<MIStoppedEvent>(fSession,
+ MIStoppedEvent.class);
+
+ final int REVERSE_NUM_STEPS = 2;
+ final IExecutionDMContext execDmc = stoppedEvent.getDMContext();
+ Query<MIInfo> query = new Query<MIInfo>() {
+ @Override
+ protected void execute(DataRequestMonitor<MIInfo> rm) {
+ fGdbControl.queueCommand(
+ fGdbControl.getCommandFactory().createMIExecReverseNext(execDmc, REVERSE_NUM_STEPS), rm);
+ }
+ };
+ {
+ fGdbControl.getExecutor().execute(query);
+ query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ }
+
+ stoppedEvent = eventWaitor.waitForEvent(TestsPlugin.massageTimeout(1000));
+
+ assertTrue("Expected to stop at main:" + (FIRST_LINE_IN_MAIN + NUM_STEPS - REVERSE_NUM_STEPS) + " but got "
+ + stoppedEvent.getFrame().getFunction() + ":" + Integer.toString(stoppedEvent.getFrame().getLine()),
+ stoppedEvent.getFrame().getFunction().equals("main")
+ && stoppedEvent.getFrame().getLine() == FIRST_LINE_IN_MAIN + NUM_STEPS - REVERSE_NUM_STEPS);
+ }
+
+ /**
+ * Repeat the test testStopAtMainWithReverse, but after a restart.
+ */
+ @Test
+ public void testStopAtMainWithReverseRestart() throws Throwable {
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_2);
- setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, true);
- setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, "stopAtOther");
- setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE, true);
- doLaunch();
-
- MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
-
- // The initial stopped event is not the last stopped event.
- // With reverse we have to stop the program, turn on reverse and start it again.
- // Let's get the frame where we really are stopped right now.
- final IExecutionDMContext execDmc = stoppedEvent.getDMContext();
- IFrameDMData frame = SyncUtil.getFrameData(execDmc, 0);
-
- // Make sure we stopped at the first line of main
- assertTrue("Expected to stop at stopAtOther but got " +
- frame.getFunction(),
- frame.getFunction().equals("stopAtOther"));
-
- // Now step backwards all the way to the start to make sure reverse was enabled from the very start
- final ServiceEventWaitor<MIStoppedEvent> eventWaitor =
- new ServiceEventWaitor<MIStoppedEvent>(
- fSession,
- MIStoppedEvent.class);
-
- final int REVERSE_NUM_STEPS = 3;
- Query<MIInfo> query2 = new Query<MIInfo>() {
- @Override
- protected void execute(DataRequestMonitor<MIInfo> rm) {
- fGdbControl.queueCommand(
- fGdbControl.getCommandFactory().createMIExecReverseNext(execDmc, REVERSE_NUM_STEPS),
- rm);
- }
- };
- {
- fGdbControl.getExecutor().execute(query2);
- query2.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
- }
-
- stoppedEvent = eventWaitor.waitForEvent(TestsPlugin.massageTimeout(1000));
-
- assertTrue("Expected to stop at main:" + (FIRST_LINE_IN_MAIN) + " but got " +
- stoppedEvent.getFrame().getFunction() + ":" +
- Integer.toString(stoppedEvent.getFrame().getLine()),
- stoppedEvent.getFrame().getFunction().equals("main") &&
- stoppedEvent.getFrame().getLine() == FIRST_LINE_IN_MAIN);
- }
-
- /**
- * Repeat the test testStopAtOtherWithReverse, but after a restart.
- */
- @Test
- @Ignore("Fails. Investigate what it needs to wait for.")
- public void testStopAtOtherWithReverseRestart() throws Throwable {
- assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_2);
- fRestart = true;
- testStopAtOtherWithReverse();
- }
- /**
- * This test will set a breakpoint at the last line of the program and will tell
- * the launch to NOT "stop on main", with reverse debugging enabled. We will
- * verify that the first stop is at the last line of the program but that the program
- * can run backwards until main() (this will confirm that reverse debugging was
- * enabled at the very start).
- */
+ fRestart = true;
+ testStopAtMainWithReverse();
+ }
+
+ /**
+ * This test will tell the launch to "stop on main" at method stopAtOther(),
+ * with reverse debugging enabled. We will then verify that the launch is properly
+ * stopped at stopAtOther() and that it can go backwards until main() (this will
+ * confirm that reverse debugging was enabled at the very start).
+ *
+ * In this test, the execution crosses getenv() while recording is enabled. gdb 7.0
+ * and 7.1 have trouble with that. We disable the test for those, and enable it for
+ * 7.2 and upwards.
+ */
+ @Test
+ public void testStopAtOtherWithReverse() throws Throwable {
+ assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_2);
+ setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, true);
+ setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, "stopAtOther");
+ setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE, true);
+ doLaunch();
+
+ MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
+
+ // The initial stopped event is not the last stopped event.
+ // With reverse we have to stop the program, turn on reverse and start it again.
+ // Let's get the frame where we really are stopped right now.
+ final IExecutionDMContext execDmc = stoppedEvent.getDMContext();
+ IFrameDMData frame = SyncUtil.getFrameData(execDmc, 0);
+
+ // Make sure we stopped at the first line of main
+ assertTrue("Expected to stop at stopAtOther but got " + frame.getFunction(),
+ frame.getFunction().equals("stopAtOther"));
+
+ // Now step backwards all the way to the start to make sure reverse was enabled from the very start
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<MIStoppedEvent>(fSession,
+ MIStoppedEvent.class);
+
+ final int REVERSE_NUM_STEPS = 3;
+ Query<MIInfo> query2 = new Query<MIInfo>() {
+ @Override
+ protected void execute(DataRequestMonitor<MIInfo> rm) {
+ fGdbControl.queueCommand(
+ fGdbControl.getCommandFactory().createMIExecReverseNext(execDmc, REVERSE_NUM_STEPS), rm);
+ }
+ };
+ {
+ fGdbControl.getExecutor().execute(query2);
+ query2.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ }
+
+ stoppedEvent = eventWaitor.waitForEvent(TestsPlugin.massageTimeout(1000));
+
+ assertTrue(
+ "Expected to stop at main:" + (FIRST_LINE_IN_MAIN) + " but got " + stoppedEvent.getFrame().getFunction()
+ + ":" + Integer.toString(stoppedEvent.getFrame().getLine()),
+ stoppedEvent.getFrame().getFunction().equals("main")
+ && stoppedEvent.getFrame().getLine() == FIRST_LINE_IN_MAIN);
+ }
+
+ /**
+ * Repeat the test testStopAtOtherWithReverse, but after a restart.
+ */
+ @Test
+ @Ignore("Fails. Investigate what it needs to wait for.")
+ public void testStopAtOtherWithReverseRestart() throws Throwable {
+ assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_2);
+ fRestart = true;
+ testStopAtOtherWithReverse();
+ }
+
+ /**
+ * This test will set a breakpoint at the last line of the program and will tell
+ * the launch to NOT "stop on main", with reverse debugging enabled. We will
+ * verify that the first stop is at the last line of the program but that the program
+ * can run backwards until main() (this will confirm that reverse debugging was
+ * enabled at the very start).
+ */
@Test
@Ignore("TODO: this is not working because it does not insert the breakpoint propertly")
- public void testNoStopAtMainWithReverse() throws Throwable {
- assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_2);
- setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, false);
- // Set this one as well to make sure it gets ignored
- setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, "main");
- setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE, true);
-
- // MUST SET BREAKPOINT AT LAST LINE BUT BEFORE LAUNCH IS STARTED
- // MUST SET BREAKPOINT AT LAST LINE BUT BEFORE LAUNCH IS STARTED
- // MUST SET BREAKPOINT AT LAST LINE BUT BEFORE LAUNCH IS STARTED
- // see testNoStopAtMain()
-
- doLaunch();
-
- MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
-
- // The initial stopped event is not the last stopped event.
- // With reverse we have to stop the program, turn on reverse and start it again.
- // Let's get the frame where we really are stopped right now.
- final IExecutionDMContext execDmc = stoppedEvent.getDMContext();
- IFrameDMData frame = SyncUtil.getFrameData(execDmc, 0);
-
- // Make sure we stopped at the first line of main
- assertTrue("Expected to stop at main:" + LAST_LINE_IN_MAIN + " but got " +
- frame.getFunction() + ":" +
- Integer.toString(frame.getLine()),
- frame.getFunction().equals("main") &&
- frame.getLine() == LAST_LINE_IN_MAIN);
-
- // Now step backwards all the way to the start to make sure reverse was enabled from the very start
- final ServiceEventWaitor<MIStoppedEvent> eventWaitor =
- new ServiceEventWaitor<MIStoppedEvent>(
- fSession,
- MIStoppedEvent.class);
-
- final int REVERSE_NUM_STEPS = 3;
- Query<MIInfo> query2 = new Query<MIInfo>() {
- @Override
- protected void execute(DataRequestMonitor<MIInfo> rm) {
- fGdbControl.queueCommand(
- fGdbControl.getCommandFactory().createMIExecReverseNext(execDmc, REVERSE_NUM_STEPS),
- rm);
- }
- };
- {
- fGdbControl.getExecutor().execute(query2);
- query2.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
- }
-
- stoppedEvent = eventWaitor.waitForEvent(TestsPlugin.massageTimeout(1000));
-
- assertTrue("Expected to stop at main:" + (FIRST_LINE_IN_MAIN) + " but got " +
- stoppedEvent.getFrame().getFunction() + ":" +
- Integer.toString(stoppedEvent.getFrame().getLine()),
- stoppedEvent.getFrame().getFunction().equals("main") &&
- stoppedEvent.getFrame().getLine() == FIRST_LINE_IN_MAIN);
- }
-
- /**
- * Repeat the test testNoStopAtMainWithReverse, but after a restart.
- * TODO: remove ignore when parent test is fixed
- */
- @Test
- @Ignore
- public void testNoStopAtMainWithReverseRestart() throws Throwable {
- assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_2);
- fRestart = true;
- testNoStopAtMainWithReverse();
- }
+ public void testNoStopAtMainWithReverse() throws Throwable {
+ assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_2);
+ setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, false);
+ // Set this one as well to make sure it gets ignored
+ setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, "main");
+ setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE, true);
+
+ // MUST SET BREAKPOINT AT LAST LINE BUT BEFORE LAUNCH IS STARTED
+ // MUST SET BREAKPOINT AT LAST LINE BUT BEFORE LAUNCH IS STARTED
+ // MUST SET BREAKPOINT AT LAST LINE BUT BEFORE LAUNCH IS STARTED
+ // see testNoStopAtMain()
+
+ doLaunch();
+
+ MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
+
+ // The initial stopped event is not the last stopped event.
+ // With reverse we have to stop the program, turn on reverse and start it again.
+ // Let's get the frame where we really are stopped right now.
+ final IExecutionDMContext execDmc = stoppedEvent.getDMContext();
+ IFrameDMData frame = SyncUtil.getFrameData(execDmc, 0);
+
+ // Make sure we stopped at the first line of main
+ assertTrue(
+ "Expected to stop at main:" + LAST_LINE_IN_MAIN + " but got " + frame.getFunction() + ":"
+ + Integer.toString(frame.getLine()),
+ frame.getFunction().equals("main") && frame.getLine() == LAST_LINE_IN_MAIN);
+
+ // Now step backwards all the way to the start to make sure reverse was enabled from the very start
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<MIStoppedEvent>(fSession,
+ MIStoppedEvent.class);
+
+ final int REVERSE_NUM_STEPS = 3;
+ Query<MIInfo> query2 = new Query<MIInfo>() {
+ @Override
+ protected void execute(DataRequestMonitor<MIInfo> rm) {
+ fGdbControl.queueCommand(
+ fGdbControl.getCommandFactory().createMIExecReverseNext(execDmc, REVERSE_NUM_STEPS), rm);
+ }
+ };
+ {
+ fGdbControl.getExecutor().execute(query2);
+ query2.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ }
+
+ stoppedEvent = eventWaitor.waitForEvent(TestsPlugin.massageTimeout(1000));
+
+ assertTrue(
+ "Expected to stop at main:" + (FIRST_LINE_IN_MAIN) + " but got " + stoppedEvent.getFrame().getFunction()
+ + ":" + Integer.toString(stoppedEvent.getFrame().getLine()),
+ stoppedEvent.getFrame().getFunction().equals("main")
+ && stoppedEvent.getFrame().getLine() == FIRST_LINE_IN_MAIN);
+ }
+
+ /**
+ * Repeat the test testNoStopAtMainWithReverse, but after a restart.
+ * TODO: remove ignore when parent test is fixed
+ */
+ @Test
+ @Ignore
+ public void testNoStopAtMainWithReverseRestart() throws Throwable {
+ assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_2);
+ fRestart = true;
+ testNoStopAtMainWithReverse();
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIBreakpointsTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIBreakpointsTest.java
index 09171b8f208..b287e4d6073 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIBreakpointsTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIBreakpointsTest.java
@@ -90,7 +90,7 @@ import org.junit.runners.model.Statement;
* Refer to the JUnit4 documentation for an explanation of the annotations.
*/
@RunWith(Parameterized.class)
-public class MIBreakpointsTest extends BaseParametrizedTestCase {
+public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Global constants
public static final String PLUGIN_ID = "org.eclipse.cdt.debug.core"; //$NON-NLS-1$
public static final String SOURCE_PROJECT = "MIBreakpointsTest";
@@ -112,6 +112,7 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
protected enum Events {
BP_ADDED, BP_UPDATED, BP_REMOVED, BP_HIT, WP_HIT, WP_OOS
}
+
protected final int BP_ADDED = Events.BP_ADDED.ordinal();
protected final int BP_UPDATED = Events.BP_UPDATED.ordinal();
protected final int BP_REMOVED = Events.BP_REMOVED.ordinal();
@@ -139,14 +140,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
protected final String WRITE_TAG = MIBreakpoints.WRITE;
// Target application 'special' locations
- private static final String[] LINE_TAGS = new String[] {
- "LINE_NUMBER_1",
- "LINE_NUMBER_2",
- "LINE_NUMBER_3",
- "LINE_NUMBER_4",
- "LINE_NUMBER_5",
- "LINE_NUMBER_6",
- };
+ private static final String[] LINE_TAGS = new String[] { "LINE_NUMBER_1", "LINE_NUMBER_2", "LINE_NUMBER_3",
+ "LINE_NUMBER_4", "LINE_NUMBER_5", "LINE_NUMBER_6", };
private int LINE_NUMBER_1;
private int LINE_NUMBER_2;
@@ -232,7 +227,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// cleanup cannot assume sane state since it runs even test is failed or skipped
if (fSession != null) {
// Clear the references (not strictly necessary)
- fSession.getExecutor().submit(()->fRunControl.getSession().removeServiceEventListener(MIBreakpointsTest.this)).get();
+ fSession.getExecutor()
+ .submit(() -> fRunControl.getSession().removeServiceEventListener(MIBreakpointsTest.this)).get();
}
fBreakpointService = null;
fRunControl = null;
@@ -356,21 +352,20 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
*/
private void waitForBreakpointEvent(final int count, final int timeout) throws Exception {
try {
- Timeout.builder().withTimeout(timeout, TimeUnit.MILLISECONDS).build().apply(
- new Statement() {
- @Override
- public void evaluate() throws Throwable {
- synchronized (lock) {
- while (fBreakpointEventCount < count) {
- try {
- lock.wait(timeout);
- } catch (InterruptedException ex) {
- break;
- }
- }
+ Timeout.builder().withTimeout(timeout, TimeUnit.MILLISECONDS).build().apply(new Statement() {
+ @Override
+ public void evaluate() throws Throwable {
+ synchronized (lock) {
+ while (fBreakpointEventCount < count) {
+ try {
+ lock.wait(timeout);
+ } catch (InterruptedException ex) {
+ break;
}
}
- }, null).evaluate();
+ }
+ }
+ }, null).evaluate();
} catch (TimeoutException e) {
throw new Exception("Timed out waiting for " + count + " breakpoint events to occur. Only "
+ fBreakpointEventCount + " occurred.", e);
@@ -410,8 +405,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
private BigInteger evaluateExpression(IDMContext ctx, String expression) throws Throwable {
// Get a stack context (temporary - should be an MIcontainerDMC)
final IExpressionDMContext expressionDMC = SyncUtil.createExpression(ctx, expression);
- final FormattedValueDMContext formattedValueDMC = SyncUtil.getFormattedValue(fExpressionService,
- expressionDMC, IFormattedValues.DECIMAL_FORMAT);
+ final FormattedValueDMContext formattedValueDMC = SyncUtil.getFormattedValue(fExpressionService, expressionDMC,
+ IFormattedValues.DECIMAL_FORMAT);
Query<FormattedValueDMData> query = new Query<FormattedValueDMData>() {
@Override
@@ -498,8 +493,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -523,8 +518,7 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
* ------------------------------------------------------------------------
*/
protected IBreakpointDMContext insertBreakpoint(final IBreakpointsTargetDMContext context,
- final Map<String, Object> attributes)
- throws InterruptedException, ExecutionException, TimeoutException {
+ final Map<String, Object> attributes) throws InterruptedException, ExecutionException, TimeoutException {
Query<IBreakpointDMContext> query = new Query<IBreakpointDMContext>() {
@Override
protected void execute(DataRequestMonitor<IBreakpointDMContext> rm) {
@@ -550,8 +544,7 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
* a string expected to be found in the exception message
* @throws TimeoutException When the query to the service times out.
*/
- private void insertInvalidBreakpoint(
- final IBreakpointsTargetDMContext context,
+ private void insertInvalidBreakpoint(final IBreakpointsTargetDMContext context,
final Map<String, Object> attributes, String expectedMessage)
throws InterruptedException, TimeoutException {
boolean exceptionThrown = false;
@@ -625,8 +618,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
* @param delta the delta properties
* ------------------------------------------------------------------------
*/
- private void updateBreakpoint(final IBreakpointDMContext breakpoint,
- final Map<String, Object> delta) throws InterruptedException, ExecutionException, TimeoutException {
+ private void updateBreakpoint(final IBreakpointDMContext breakpoint, final Map<String, Object> delta)
+ throws InterruptedException, ExecutionException, TimeoutException {
Query<Void> query = new Query<Void>() {
@Override
protected void execute(DataRequestMonitor<Void> rm) {
@@ -652,9 +645,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
* a string expected to be found in the exception message
* @throws TimeoutException When the query to the service times out.
*/
- private void updateInvalidBreakpoint(final IBreakpointDMContext breakpoint,
- final Map<String, Object> delta, String expectedMessage)
- throws InterruptedException, TimeoutException {
+ private void updateInvalidBreakpoint(final IBreakpointDMContext breakpoint, final Map<String, Object> delta,
+ String expectedMessage) throws InterruptedException, TimeoutException {
boolean exceptionThrown = false;
try {
@@ -679,21 +671,20 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
* @param enabled Whether this breakpoint is enabled.
* @param pending Whether this breakpoint is pending.
*/
- private void validateBreakpoint(MIBreakpointDMData breakpoint,
- String filename, int lineNumber, String condition, int ignoreCount,
- boolean enabled, boolean pending) {
- assertThat("BreakpointService problem: breakpoint mismatch (wrong file name)",
- breakpoint.getFileName(), equalTo(filename));
- assertThat("BreakpointService problem: breakpoint mismatch (wrong line number)",
- breakpoint.getLineNumber(), equalTo(lineNumber));
- assertThat("BreakpointService problem: breakpoint mismatch (wrong condition)",
- breakpoint.getCondition(), equalTo(condition));
- assertThat("BreakpointService problem: breakpoint mismatch (wrong ignore count)",
- breakpoint.getIgnoreCount(), equalTo(ignoreCount));
- assertThat("BreakpointService problem: breakpoint mismatch (wrong enabled)",
- breakpoint.isEnabled(), equalTo(enabled));
- assertThat("BreakpointService problem: breakpoint mismatch (wrong pending)",
- breakpoint.isPending(), equalTo(pending));
+ private void validateBreakpoint(MIBreakpointDMData breakpoint, String filename, int lineNumber, String condition,
+ int ignoreCount, boolean enabled, boolean pending) {
+ assertThat("BreakpointService problem: breakpoint mismatch (wrong file name)", breakpoint.getFileName(),
+ equalTo(filename));
+ assertThat("BreakpointService problem: breakpoint mismatch (wrong line number)", breakpoint.getLineNumber(),
+ equalTo(lineNumber));
+ assertThat("BreakpointService problem: breakpoint mismatch (wrong condition)", breakpoint.getCondition(),
+ equalTo(condition));
+ assertThat("BreakpointService problem: breakpoint mismatch (wrong ignore count)", breakpoint.getIgnoreCount(),
+ equalTo(ignoreCount));
+ assertThat("BreakpointService problem: breakpoint mismatch (wrong enabled)", breakpoint.isEnabled(),
+ equalTo(enabled));
+ assertThat("BreakpointService problem: breakpoint mismatch (wrong pending)", breakpoint.isPending(),
+ equalTo(pending));
}
/**
@@ -708,21 +699,20 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
* @param enabled Whether this breakpoint is enabled.
* @param pending Whether this breakpoint is pending.
*/
- private void validateBreakpoint(MIBreakpointDMData breakpoint,
- String filename, String functionName, String condition,
- int ignoreCount, boolean enabled, boolean pending) {
- assertThat("BreakpointService problem: breakpoint mismatch (wrong file name)",
- breakpoint.getFileName(), equalTo(filename));
- assertThat("BreakpointService problem: breakpoint mismatch (wrong function name)",
- breakpoint.getFunctionName(), equalTo(functionName));
- assertThat("BreakpointService problem: breakpoint mismatch (wrong condition)",
- breakpoint.getCondition(), equalTo(condition));
- assertThat("BreakpointService problem: breakpoint mismatch (wrong ignore count)",
- breakpoint.getIgnoreCount(), equalTo(ignoreCount));
- assertThat("BreakpointService problem: breakpoint mismatch (wrong enabled)",
- breakpoint.isEnabled(), equalTo(enabled));
- assertThat("BreakpointService problem: breakpoint mismatch (wrong pending)",
- breakpoint.isPending(), equalTo(pending));
+ private void validateBreakpoint(MIBreakpointDMData breakpoint, String filename, String functionName,
+ String condition, int ignoreCount, boolean enabled, boolean pending) {
+ assertThat("BreakpointService problem: breakpoint mismatch (wrong file name)", breakpoint.getFileName(),
+ equalTo(filename));
+ assertThat("BreakpointService problem: breakpoint mismatch (wrong function name)", breakpoint.getFunctionName(),
+ equalTo(functionName));
+ assertThat("BreakpointService problem: breakpoint mismatch (wrong condition)", breakpoint.getCondition(),
+ equalTo(condition));
+ assertThat("BreakpointService problem: breakpoint mismatch (wrong ignore count)", breakpoint.getIgnoreCount(),
+ equalTo(ignoreCount));
+ assertThat("BreakpointService problem: breakpoint mismatch (wrong enabled)", breakpoint.isEnabled(),
+ equalTo(enabled));
+ assertThat("BreakpointService problem: breakpoint mismatch (wrong pending)", breakpoint.isPending(),
+ equalTo(pending));
}
/**
@@ -736,19 +726,18 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
* @param enabled Whether this breakpoint is enabled.
* @param pending Whether this breakpoint is pending.
*/
- private void validateBreakpoint(MIBreakpointDMData breakpoint,
- BigInteger address, String condition, int ignoreCount,
- boolean enabled, boolean pending) {
+ private void validateBreakpoint(MIBreakpointDMData breakpoint, BigInteger address, String condition,
+ int ignoreCount, boolean enabled, boolean pending) {
assertThat("BreakpointService problem: breakpoint mismatch (wrong address)",
breakpoint.getAddresses()[0].getValue(), equalTo(address));
- assertThat("BreakpointService problem: breakpoint mismatch (wrong condition)",
- breakpoint.getCondition(), equalTo(condition));
- assertThat("BreakpointService problem: breakpoint mismatch (wrong ignore count)",
- breakpoint.getIgnoreCount(), equalTo(ignoreCount));
- assertThat("BreakpointService problem: breakpoint mismatch (wrong enabled)",
- breakpoint.isEnabled(), equalTo(enabled));
- assertThat("BreakpointService problem: breakpoint mismatch (wrong pending)",
- breakpoint.isPending(), equalTo(pending));
+ assertThat("BreakpointService problem: breakpoint mismatch (wrong condition)", breakpoint.getCondition(),
+ equalTo(condition));
+ assertThat("BreakpointService problem: breakpoint mismatch (wrong ignore count)", breakpoint.getIgnoreCount(),
+ equalTo(ignoreCount));
+ assertThat("BreakpointService problem: breakpoint mismatch (wrong enabled)", breakpoint.isEnabled(),
+ equalTo(enabled));
+ assertThat("BreakpointService problem: breakpoint mismatch (wrong pending)", breakpoint.isPending(),
+ equalTo(pending));
}
/**
@@ -762,24 +751,22 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
* @param enabled Whether this watchpoint is enabled.
* @param pending Whether this watchpoint is pending.
*/
- private void validateWatchpoint(MIBreakpointDMData watchpoint,
- String expression, boolean read, boolean write, boolean access,
- boolean enabled, boolean pending) {
- assertThat("BreakpointService problem: breakpoint mismatch (wrong expression)",
- watchpoint.getExpression(), equalTo(expression));
- assertThat("BreakpointService problem: breakpoint mismatch (wrong read state)",
- watchpoint.isReadWatchpoint(), equalTo(read));
- assertThat("BreakpointService problem: breakpoint mismatch (wrong write state)",
- watchpoint.isWriteWatchpoint(), equalTo(write));
+ private void validateWatchpoint(MIBreakpointDMData watchpoint, String expression, boolean read, boolean write,
+ boolean access, boolean enabled, boolean pending) {
+ assertThat("BreakpointService problem: breakpoint mismatch (wrong expression)", watchpoint.getExpression(),
+ equalTo(expression));
+ assertThat("BreakpointService problem: breakpoint mismatch (wrong read state)", watchpoint.isReadWatchpoint(),
+ equalTo(read));
+ assertThat("BreakpointService problem: breakpoint mismatch (wrong write state)", watchpoint.isWriteWatchpoint(),
+ equalTo(write));
assertThat("BreakpointService problem: breakpoint mismatch (wrong access state)",
watchpoint.isAccessWatchpoint(), equalTo(access));
- assertThat("BreakpointService problem: breakpoint mismatch (wrong enabled)",
- watchpoint.isEnabled(), equalTo(enabled));
- assertThat("BreakpointService problem: breakpoint mismatch (wrong pending)",
- watchpoint.isPending(), equalTo(pending));
+ assertThat("BreakpointService problem: breakpoint mismatch (wrong enabled)", watchpoint.isEnabled(),
+ equalTo(enabled));
+ assertThat("BreakpointService problem: breakpoint mismatch (wrong pending)", watchpoint.isPending(),
+ equalTo(pending));
}
-
// ========================================================================
// Test Cases
// ------------------------------------------------------------------------
@@ -822,8 +809,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
insertInvalidBreakpoint(null, breakpoint, UNKNOWN_EXECUTION_CONTEXT);
// Ensure that no BreakpointEvent was received
- assertTrue("BreakpointEvent problem: expected " + 0 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 0);
+ assertTrue("BreakpointEvent problem: expected " + 0 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 0);
}
// ------------------------------------------------------------------------
@@ -842,8 +829,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
insertInvalidBreakpoint(fBreakpointsDmc, breakpoint, BREAKPOINT_INSERTION_FAILURE);
// Ensure that no BreakpointEvent was received
- assertTrue("BreakpointEvent problem: expected " + 0 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 0);
+ assertTrue("BreakpointEvent problem: expected " + 0 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 0);
}
// ------------------------------------------------------------------------
@@ -862,8 +849,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
insertInvalidBreakpoint(fBreakpointsDmc, breakpoint, BREAKPOINT_INSERTION_FAILURE);
// Ensure that no BreakpointEvent was received
- assertTrue("BreakpointEvent problem: expected " + 0 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 0);
+ assertTrue("BreakpointEvent problem: expected " + 0 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 0);
}
// ------------------------------------------------------------------------
@@ -882,8 +869,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
insertInvalidBreakpoint(fBreakpointsDmc, breakpoint, BREAKPOINT_INSERTION_FAILURE);
// Ensure that no BreakpointEvent was received
- assertTrue("BreakpointEvent problem: expected " + 0 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 0);
+ assertTrue("BreakpointEvent problem: expected " + 0 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 0);
}
// ------------------------------------------------------------------------
@@ -900,8 +887,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
insertInvalidBreakpoint(fBreakpointsDmc, breakpoint, BREAKPOINT_INSERTION_FAILURE);
// Ensure that no BreakpointEvent was received
- assertTrue("BreakpointEvent problem: expected " + 0 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 0);
+ assertTrue("BreakpointEvent problem: expected " + 0 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 0);
}
// ------------------------------------------------------------------------
@@ -920,8 +907,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, breakpoint);
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -932,11 +919,10 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure the BreakpointService holds only the right breakpoints
IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc);
- assertTrue("BreakpointService problem: expected " + 1 + " breakpoint(s), received "
- + breakpoints.length, breakpoints.length == 1);
+ assertTrue("BreakpointService problem: expected " + 1 + " breakpoint(s), received " + breakpoints.length,
+ breakpoints.length == 1);
MIBreakpointDMData breakpoint2 = (MIBreakpointDMData) getBreakpoint(breakpoints[0]);
- assertTrue("BreakpointService problem: breakpoint mismatch",
- breakpoint1.equals(breakpoint2));
+ assertTrue("BreakpointService problem: breakpoint mismatch", breakpoint1.equals(breakpoint2));
}
// ------------------------------------------------------------------------
@@ -956,8 +942,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -968,11 +954,10 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure the BreakpointService holds only the right breakpoints
IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc);
- assertTrue("BreakpointService problem: expected " + 1 + " breakpoint(s), received "
- + breakpoints.length, breakpoints.length == 1);
+ assertTrue("BreakpointService problem: expected " + 1 + " breakpoint(s), received " + breakpoints.length,
+ breakpoints.length == 1);
MIBreakpointDMData breakpoint2 = (MIBreakpointDMData) getBreakpoint(breakpoints[0]);
- assertTrue("BreakpointService problem: breakpoint mismatch",
- breakpoint1.equals(breakpoint2));
+ assertTrue("BreakpointService problem: breakpoint mismatch", breakpoint1.equals(breakpoint2));
}
// ------------------------------------------------------------------------
@@ -993,8 +978,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -1005,11 +990,10 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure the BreakpointService holds only the right breakpoints
IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc);
- assertTrue("BreakpointService problem: expected " + 1 + " breakpoint(s), received "
- + breakpoints.length, breakpoints.length == 1);
+ assertTrue("BreakpointService problem: expected " + 1 + " breakpoint(s), received " + breakpoints.length,
+ breakpoints.length == 1);
MIBreakpointDMData breakpoint2 = (MIBreakpointDMData) getBreakpoint(breakpoints[0]);
- assertTrue("BreakpointService problem: breakpoint mismatch",
- breakpoint1.equals(breakpoint2));
+ assertTrue("BreakpointService problem: breakpoint mismatch", breakpoint1.equals(breakpoint2));
}
// ------------------------------------------------------------------------
@@ -1029,8 +1013,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -1041,11 +1025,10 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure the BreakpointService holds only the right breakpoints
IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc);
- assertTrue("BreakpointService problem: expected " + 1 + " breakpoint(s), received "
- + breakpoints.length, breakpoints.length == 1);
+ assertTrue("BreakpointService problem: expected " + 1 + " breakpoint(s), received " + breakpoints.length,
+ breakpoints.length == 1);
MIBreakpointDMData breakpoint2 = (MIBreakpointDMData) getBreakpoint(breakpoints[0]);
- assertTrue("BreakpointService problem: breakpoint mismatch",
- breakpoint1.equals(breakpoint2));
+ assertTrue("BreakpointService problem: breakpoint mismatch", breakpoint1.equals(breakpoint2));
}
// ------------------------------------------------------------------------
@@ -1066,8 +1049,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -1078,11 +1061,10 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure the BreakpointService holds only the right breakpoints
IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc);
- assertTrue("BreakpointService problem: expected " + 1 + " breakpoint(s), received "
- + breakpoints.length, breakpoints.length == 1);
+ assertTrue("BreakpointService problem: expected " + 1 + " breakpoint(s), received " + breakpoints.length,
+ breakpoints.length == 1);
MIBreakpointDMData breakpoint2 = (MIBreakpointDMData) getBreakpoint(breakpoints[0]);
- assertTrue("BreakpointService problem: breakpoint mismatch",
- breakpoint1.equals(breakpoint2));
+ assertTrue("BreakpointService problem: breakpoint mismatch", breakpoint1.equals(breakpoint2));
}
// ------------------------------------------------------------------------
@@ -1103,8 +1085,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -1115,11 +1097,10 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure the BreakpointService holds only the right breakpoints
IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc);
- assertTrue("BreakpointService problem: expected " + 1 + " breakpoint(s), received "
- + breakpoints.length, breakpoints.length == 1);
+ assertTrue("BreakpointService problem: expected " + 1 + " breakpoint(s), received " + breakpoints.length,
+ breakpoints.length == 1);
MIBreakpointDMData breakpoint2 = (MIBreakpointDMData) getBreakpoint(breakpoints[0]);
- assertTrue("BreakpointService problem: breakpoint mismatch",
- breakpoint1.equals(breakpoint2));
+ assertTrue("BreakpointService problem: breakpoint mismatch", breakpoint1.equals(breakpoint2));
}
// ------------------------------------------------------------------------
@@ -1139,8 +1120,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -1159,8 +1140,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -1171,8 +1152,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure the BreakpointService holds only the right breakpoints
IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc);
- assertTrue("BreakpointService problem: expected " + 2 + " breakpoint(s), received "
- + breakpoints.length, breakpoints.length == 2);
+ assertTrue("BreakpointService problem: expected " + 2 + " breakpoint(s), received " + breakpoints.length,
+ breakpoints.length == 2);
MIBreakpointDMData svc_bp1 = (MIBreakpointDMData) getBreakpoint(breakpoints[0]);
MIBreakpointDMData svc_bp2 = (MIBreakpointDMData) getBreakpoint(breakpoints[1]);
// The breakpoint references are not necessarily retrieved in the order the
@@ -1205,8 +1186,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -1220,8 +1201,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -1232,8 +1213,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure the BreakpointService holds only the right breakpoints
IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc);
- assertTrue("BreakpointService problem: expected " + 2 + " breakpoint(s), received "
- + breakpoints.length, breakpoints.length == 2);
+ assertTrue("BreakpointService problem: expected " + 2 + " breakpoint(s), received " + breakpoints.length,
+ breakpoints.length == 2);
MIBreakpointDMData svc_bp1 = (MIBreakpointDMData) getBreakpoint(breakpoints[0]);
MIBreakpointDMData svc_bp2 = (MIBreakpointDMData) getBreakpoint(breakpoints[1]);
// The breakpoint references are not necessarily retrieved in the order the
@@ -1283,16 +1264,15 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref);
validateBreakpoint(breakpoint1, SOURCE_NAME, LINE_NUMBER_5, NO_CONDITION, 0, true, false);
- assertTrue("BreakpointEvent problem: expected " + 2 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 2);
+ assertTrue("BreakpointEvent problem: expected " + 2 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 2);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_HIT event(s), received "
+ getBreakpointEventCount(BP_HIT), getBreakpointEventCount(BP_HIT) == 1);
- assertTrue("BreakpointService problem: breakpoint mismatch",
- fBreakpointRef.equals(breakpoint1.getNumber()));
+ assertTrue("BreakpointService problem: breakpoint mismatch", fBreakpointRef.equals(breakpoint1.getNumber()));
clearEventCounters();
- assertTrue("Did not stop because of breakpoint, but stopped because of: " +
- event.getClass().getCanonicalName(), event instanceof MIBreakpointHitEvent);
+ assertTrue("Did not stop because of breakpoint, but stopped because of: " + event.getClass().getCanonicalName(),
+ event instanceof MIBreakpointHitEvent);
assertTrue("Did not stop because of the correct breakpoint at line " + LINE_NUMBER_5,
((MIBreakpointHitEvent) event).getNumber().equals(ref.getReference()));
}
@@ -1339,16 +1319,15 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref);
validateBreakpoint(breakpoint1, SOURCE_NAME, LINE_NUMBER_5, NO_CONDITION, 0, true, false);
- assertTrue("BreakpointEvent problem: expected " + 2 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 2);
+ assertTrue("BreakpointEvent problem: expected " + 2 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 2);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_HIT event(s), received "
+ getBreakpointEventCount(BP_HIT), getBreakpointEventCount(BP_HIT) == 1);
- assertTrue("BreakpointService problem: breakpoint mismatch",
- fBreakpointRef.equals(breakpoint1.getNumber()));
+ assertTrue("BreakpointService problem: breakpoint mismatch", fBreakpointRef.equals(breakpoint1.getNumber()));
clearEventCounters();
- assertTrue("Did not stop because of breakpoint, but stopped because of: " +
- event.getClass().getCanonicalName(), event instanceof MIBreakpointHitEvent);
+ assertTrue("Did not stop because of breakpoint, but stopped because of: " + event.getClass().getCanonicalName(),
+ event instanceof MIBreakpointHitEvent);
assertTrue("Did not stop because of the correct breakpoint at line " + LINE_NUMBER_5,
((MIBreakpointHitEvent) event).getNumber().equals(ref.getReference()));
}
@@ -1373,8 +1352,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -1385,11 +1364,10 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure the BreakpointService holds only the right watchpoints
IBreakpointDMContext[] watchpoints = getBreakpoints(fBreakpointsDmc);
- assertTrue("BreakpointService problem: expected " + 1 + " watchpoints(s), received "
- + watchpoints.length, watchpoints.length == 1);
+ assertTrue("BreakpointService problem: expected " + 1 + " watchpoints(s), received " + watchpoints.length,
+ watchpoints.length == 1);
MIBreakpointDMData watchpoint2 = (MIBreakpointDMData) getBreakpoint(watchpoints[0]);
- assertTrue("BreakpointService problem: breakpoint mismatch",
- watchpoint1.equals(watchpoint2));
+ assertTrue("BreakpointService problem: breakpoint mismatch", watchpoint1.equals(watchpoint2));
}
// ------------------------------------------------------------------------
@@ -1409,8 +1387,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -1421,11 +1399,10 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure the BreakpointService holds only the right watchpoints
IBreakpointDMContext[] watchpoints = getBreakpoints(fBreakpointsDmc);
- assertTrue("BreakpointService problem: expected " + 1 + " watchpoints(s), received "
- + watchpoints.length, watchpoints.length == 1);
+ assertTrue("BreakpointService problem: expected " + 1 + " watchpoints(s), received " + watchpoints.length,
+ watchpoints.length == 1);
MIBreakpointDMData watchpoint2 = (MIBreakpointDMData) getBreakpoint(watchpoints[0]);
- assertTrue("BreakpointService problem: breakpoint mismatch",
- watchpoint1.equals(watchpoint2));
+ assertTrue("BreakpointService problem: breakpoint mismatch", watchpoint1.equals(watchpoint2));
}
// ------------------------------------------------------------------------
@@ -1446,8 +1423,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -1458,11 +1435,10 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure the BreakpointService holds only the right watchpoints
IBreakpointDMContext[] watchpoints = getBreakpoints(fBreakpointsDmc);
- assertTrue("BreakpointService problem: expected " + 1 + " watchpoints(s), received "
- + watchpoints.length, watchpoints.length == 1);
+ assertTrue("BreakpointService problem: expected " + 1 + " watchpoints(s), received " + watchpoints.length,
+ watchpoints.length == 1);
MIBreakpointDMData watchpoint2 = (MIBreakpointDMData) getBreakpoint(watchpoints[0]);
- assertTrue("BreakpointService problem: breakpoint mismatch",
- watchpoint1.equals(watchpoint2));
+ assertTrue("BreakpointService problem: breakpoint mismatch", watchpoint1.equals(watchpoint2));
}
// ------------------------------------------------------------------------
@@ -1495,8 +1471,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
MIStoppedEvent event = SyncUtil.waitForStop(3000);
waitForBreakpointEvent(2);
// Ensure that right BreakpointEvents were received
- assertTrue("BreakpointEvent problem: expected " + 2 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 2);
+ assertTrue("BreakpointEvent problem: expected " + 2 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 2);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_HIT event(s), received "
@@ -1509,13 +1485,12 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure the BreakpointService holds only the right watchpoints
IBreakpointDMContext[] watchpoints = getBreakpoints(fBreakpointsDmc);
- assertTrue("BreakpointService problem: expected " + 1 + " watchpoints(s), received "
- + watchpoints.length, watchpoints.length == 1);
+ assertTrue("BreakpointService problem: expected " + 1 + " watchpoints(s), received " + watchpoints.length,
+ watchpoints.length == 1);
MIBreakpointDMData watchpoint2 = (MIBreakpointDMData) getBreakpoint(watchpoints[0]);
- assertTrue("BreakpointService problem: breakpoint mismatch",
- watchpoint1.equals(watchpoint2));
- assertTrue("Did not stop because of watchpoint, but stopped because of: " +
- event.getClass().getCanonicalName(), event instanceof MIWatchpointTriggerEvent);
+ assertTrue("BreakpointService problem: breakpoint mismatch", watchpoint1.equals(watchpoint2));
+ assertTrue("Did not stop because of watchpoint, but stopped because of: " + event.getClass().getCanonicalName(),
+ event instanceof MIWatchpointTriggerEvent);
assertTrue("Did not stop because of the watchpoint",
((MIWatchpointTriggerEvent) event).getNumber().equals(watchpoint1.getReference()));
}
@@ -1540,8 +1515,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -1550,15 +1525,15 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_REMOVED event(s), received "
+ getBreakpointEventCount(BP_REMOVED), getBreakpointEventCount(BP_REMOVED) == 1);
clearEventCounters();
// Ensure the breakpoint was effectively removed
IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc);
- assertTrue("BreakpointService problem: expected " + 0 + " breakpoint(s), received "
- + breakpoints.length, breakpoints.length == 0);
+ assertTrue("BreakpointService problem: expected " + 0 + " breakpoint(s), received " + breakpoints.length,
+ breakpoints.length == 0);
}
// ------------------------------------------------------------------------
@@ -1575,8 +1550,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
removeInvalidBreakpoint(invalid_ref, UNKNOWN_BREAKPOINT);
// Ensure that right BreakpointEvents were received
- assertTrue("BreakpointEvent problem: expected " + 0 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 0);
+ assertTrue("BreakpointEvent problem: expected " + 0 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 0);
// Create a line breakpoint
Map<String, Object> breakpoint = new HashMap<String, Object>();
breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG);
@@ -1588,47 +1563,47 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
// Ensure the breakpoint list is OK
IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc);
- assertTrue("BreakpointService problem: expected " + 1 + " breakpoint(s), received "
- + breakpoints.length, breakpoints.length == 1);
+ assertTrue("BreakpointService problem: expected " + 1 + " breakpoint(s), received " + breakpoints.length,
+ breakpoints.length == 1);
// Remove the installed breakpoint
removeBreakpoint(ref);
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_REMOVED event(s), received "
+ getBreakpointEventCount(BP_REMOVED), getBreakpointEventCount(BP_REMOVED) == 1);
clearEventCounters();
// Ensure the breakpoint list is OK
breakpoints = getBreakpoints(fBreakpointsDmc);
- assertTrue("BreakpointService problem: expected " + 0 + " breakpoint(s), received "
- + breakpoints.length, breakpoints.length == 0);
+ assertTrue("BreakpointService problem: expected " + 0 + " breakpoint(s), received " + breakpoints.length,
+ breakpoints.length == 0);
// Remove the un-installed breakpoint
removeInvalidBreakpoint(saved_ref, UNKNOWN_BREAKPOINT);
// Ensure that right BreakpointEvents were received
- assertTrue("BreakpointEvent problem: expected " + 0 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 0);
+ assertTrue("BreakpointEvent problem: expected " + 0 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 0);
// Ensure the breakpoint list is OK
breakpoints = getBreakpoints(fBreakpointsDmc);
- assertTrue("BreakpointService problem: expected " + 0 + " breakpoint(s), received "
- + breakpoints.length, breakpoints.length == 0);
+ assertTrue("BreakpointService problem: expected " + 0 + " breakpoint(s), received " + breakpoints.length,
+ breakpoints.length == 0);
// Re-install the breakpoint
ref = insertBreakpoint(fBreakpointsDmc, breakpoint);
MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref);
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -1637,15 +1612,14 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
removeInvalidBreakpoint(saved_ref, UNKNOWN_BREAKPOINT);
// Ensure that right BreakpointEvents were received
- assertTrue("BreakpointEvent problem: expected " + 0 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 0);
+ assertTrue("BreakpointEvent problem: expected " + 0 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 0);
// Ensure that the existing breakpoint is unaffected
breakpoints = getBreakpoints(fBreakpointsDmc);
- assertTrue("BreakpointService problem: expected " + 1 + " breakpoint(s), received "
- + breakpoints.length, breakpoints.length == 1);
+ assertTrue("BreakpointService problem: expected " + 1 + " breakpoint(s), received " + breakpoints.length,
+ breakpoints.length == 1);
MIBreakpointDMData breakpoint2 = (MIBreakpointDMData) getBreakpoint(breakpoints[0]);
- assertTrue("BreakpointService problem: breakpoint mismatch",
- breakpoint1.equals(breakpoint2));
+ assertTrue("BreakpointService problem: breakpoint mismatch", breakpoint1.equals(breakpoint2));
}
// ------------------------------------------------------------------------
@@ -1674,8 +1648,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
clearEventCounters();
// Get the list of breakpoints
IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc);
- assertTrue("BreakpointService problem: expected " + 4 + " breakpoint(s), received "
- + breakpoints.length, breakpoints.length == 4);
+ assertTrue("BreakpointService problem: expected " + 4 + " breakpoint(s), received " + breakpoints.length,
+ breakpoints.length == 4);
// Remove the breakpoint one at a time in the following order: 1, 3, 2, 4
int[] indices = { 0, 2, 1, 3 };
int breakpoints_left = 4;
@@ -1742,13 +1716,12 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
MIStoppedEvent event = SyncUtil.waitForStop(3000);
waitForBreakpointEvent(4);
// Ensure the correct BreakpointEvent was received
- assertTrue("BreakpointEvent problem: expected " + 4 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 4);
+ assertTrue("BreakpointEvent problem: expected " + 4 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 4);
assertTrue("BreakpointEvent problem: expected " + 2 + " BREAKPOINT_HIT event(s), received "
+ getBreakpointEventCount(BP_HIT), getBreakpointEventCount(BP_HIT) == 1);
clearEventCounters();
- assertTrue("Did not stop on a breakpoint!",
- event instanceof MIBreakpointHitEvent);
+ assertTrue("Did not stop on a breakpoint!", event instanceof MIBreakpointHitEvent);
assertTrue("Did not stop because of the correct breakpoint at line " + LINE_NUMBER_5,
((MIBreakpointHitEvent) event).getNumber().equals(ref1.getReference()));
}
@@ -1775,8 +1748,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
updateInvalidBreakpoint(invalid_ref, properties, UNKNOWN_BREAKPOINT);
// Ensure that no BreakpointEvent was received
- assertTrue("BreakpointEvent problem: expected " + 0 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 0);
+ assertTrue("BreakpointEvent problem: expected " + 0 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 0);
}
// ------------------------------------------------------------------------
@@ -1796,8 +1769,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -1808,8 +1781,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_UPDATED event(s), received "
+ getBreakpointEventCount(BP_UPDATED), getBreakpointEventCount(BP_UPDATED) == 1);
clearEventCounters();
@@ -1837,8 +1810,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -1849,8 +1822,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_UPDATED event(s), received "
+ getBreakpointEventCount(BP_UPDATED), getBreakpointEventCount(BP_UPDATED) == 1);
clearEventCounters();
@@ -1878,8 +1851,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -1890,8 +1863,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_UPDATED event(s), received "
+ getBreakpointEventCount(BP_UPDATED), getBreakpointEventCount(BP_UPDATED) == 1);
clearEventCounters();
@@ -1928,8 +1901,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -1945,8 +1918,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
MIStoppedEvent event = SyncUtil.waitForStop(3000);
waitForBreakpointEvent(2);
// Ensure that right BreakpointEvents were received
- assertTrue("BreakpointEvent problem: expected " + 2 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 2);
+ assertTrue("BreakpointEvent problem: expected " + 2 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 2);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_UPDATED event(s), received "
+ getBreakpointEventCount(BP_UPDATED), getBreakpointEventCount(BP_UPDATED) == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_HIT event(s), received "
@@ -1956,8 +1929,7 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
MIBreakpointDMData breakpoint2 = (MIBreakpointDMData) getBreakpoint(ref);
assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong condition)",
breakpoint2.getCondition().equals(CONDITION_5));
- assertTrue("Did not stop on our modified breakpoint!",
- event instanceof MIBreakpointHitEvent);
+ assertTrue("Did not stop on our modified breakpoint!", event instanceof MIBreakpointHitEvent);
assertTrue("Did not stop because of the correct breakpoint at line " + LINE_NUMBER_5,
((MIBreakpointHitEvent) event).getNumber().equals(breakpoint2.getReference()));
}
@@ -1981,8 +1953,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -1993,8 +1965,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_UPDATED event(s), received "
+ getBreakpointEventCount(BP_UPDATED), getBreakpointEventCount(BP_UPDATED) == 1);
clearEventCounters();
@@ -2024,8 +1996,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -2036,8 +2008,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_UPDATED event(s), received "
+ getBreakpointEventCount(BP_UPDATED), getBreakpointEventCount(BP_UPDATED) == 1);
clearEventCounters();
@@ -2067,8 +2039,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT events, received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT events, received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event, received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -2079,8 +2051,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_UPDATED event(s), received "
+ getBreakpointEventCount(BP_UPDATED), getBreakpointEventCount(BP_UPDATED) == 1);
clearEventCounters();
@@ -2107,8 +2079,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -2119,8 +2091,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_UPDATED event(s), received "
+ getBreakpointEventCount(BP_UPDATED), getBreakpointEventCount(BP_UPDATED) == 1);
clearEventCounters();
@@ -2148,8 +2120,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -2160,15 +2132,14 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_UPDATED event(s), received "
+ getBreakpointEventCount(BP_UPDATED), getBreakpointEventCount(BP_UPDATED) == 1);
clearEventCounters();
// Verify the state of the breakpoint
MIBreakpointDMData breakpoint2 = (MIBreakpointDMData) getBreakpoint(ref);
- assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong count)",
- breakpoint2.getIgnoreCount() == 0);
+ assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong count)", breakpoint2.getIgnoreCount() == 0);
}
// ------------------------------------------------------------------------
@@ -2189,8 +2160,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -2201,8 +2172,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_UPDATED event(s), received "
+ getBreakpointEventCount(BP_UPDATED), getBreakpointEventCount(BP_UPDATED) == 1);
clearEventCounters();
@@ -2239,8 +2210,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -2256,8 +2227,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
MIStoppedEvent event = SyncUtil.waitForStop(3000);
waitForBreakpointEvent(2);
// Ensure that right BreakpointEvents were received
- assertTrue("BreakpointEvent problem: expected " + 2 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 2);
+ assertTrue("BreakpointEvent problem: expected " + 2 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 2);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_UPDATED event(s), received "
+ getBreakpointEventCount(BP_UPDATED), getBreakpointEventCount(BP_UPDATED) == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_HIT event(s), received "
@@ -2265,10 +2236,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
clearEventCounters();
// Verify the state of the breakpoint
MIBreakpointDMData breakpoint2 = (MIBreakpointDMData) getBreakpoint(ref);
- assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong count)",
- breakpoint2.getIgnoreCount() == 0);
- assertTrue("Did not stop on our modified breakpoint!",
- event instanceof MIBreakpointHitEvent);
+ assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong count)", breakpoint2.getIgnoreCount() == 0);
+ assertTrue("Did not stop on our modified breakpoint!", event instanceof MIBreakpointHitEvent);
assertTrue("Did not stop because of the correct breakpoint at line " + LINE_NUMBER_5,
((MIBreakpointHitEvent) event).getNumber().equals(breakpoint2.getReference()));
}
@@ -2298,8 +2267,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(2);
- assertTrue("BreakpointEvent problem: expected " + 2 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 2);
+ assertTrue("BreakpointEvent problem: expected " + 2 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 2);
assertTrue("BreakpointEvent problem: expected " + 2 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 2);
clearEventCounters();
@@ -2315,8 +2284,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_UPDATED event(s), received "
+ getBreakpointEventCount(BP_UPDATED), getBreakpointEventCount(BP_UPDATED) == 1);
clearEventCounters();
@@ -2329,12 +2298,11 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
SyncUtil.resumeUntilStopped(1000);
// Ensure the BreakpointEvent was received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_HIT event(s), received "
+ getBreakpointEventCount(BP_HIT), getBreakpointEventCount(BP_HIT) == 1);
- assertTrue("BreakpointService problem: breakpoint mismatch",
- fBreakpointRef.equals(breakpoint2.getNumber()));
+ assertTrue("BreakpointService problem: breakpoint mismatch", fBreakpointRef.equals(breakpoint2.getNumber()));
clearEventCounters();
}
@@ -2368,8 +2336,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(2);
- assertTrue("BreakpointEvent problem: expected " + 2 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 2);
+ assertTrue("BreakpointEvent problem: expected " + 2 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 2);
assertTrue("BreakpointEvent problem: expected " + 2 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 2);
clearEventCounters();
@@ -2389,8 +2357,7 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_HIT event(s), received "
+ getBreakpointEventCount(BP_HIT), getBreakpointEventCount(BP_HIT) == 1);
clearEventCounters();
- assertTrue("Did not stop on a breakpoint!",
- event instanceof MIBreakpointHitEvent);
+ assertTrue("Did not stop on a breakpoint!", event instanceof MIBreakpointHitEvent);
assertTrue("Did not stop because of the correct breakpoint at line " + LINE_NUMBER_5,
((MIBreakpointHitEvent) event).getNumber().equals(ref1.getReference()));
}
@@ -2421,8 +2388,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(2);
- assertTrue("BreakpointEvent problem: expected " + 2 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 2);
+ assertTrue("BreakpointEvent problem: expected " + 2 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 2);
assertTrue("BreakpointEvent problem: expected " + 2 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 2);
clearEventCounters();
@@ -2438,8 +2405,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_UPDATED event(s), received "
+ getBreakpointEventCount(BP_UPDATED), getBreakpointEventCount(BP_UPDATED) == 1);
clearEventCounters();
@@ -2452,12 +2419,11 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
SyncUtil.resumeUntilStopped(1000);
// Ensure the BreakpointEvent was received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_HIT event(s), received "
+ getBreakpointEventCount(BP_HIT), getBreakpointEventCount(BP_HIT) == 1);
- assertTrue("BreakpointService problem: breakpoint mismatch",
- fBreakpointRef.equals(breakpoint2.getNumber()));
+ assertTrue("BreakpointService problem: breakpoint mismatch", fBreakpointRef.equals(breakpoint2.getNumber()));
clearEventCounters();
// Enable the first breakpoint
delta = new HashMap<String, Object>();
@@ -2466,8 +2432,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_UPDATED event(s), received "
+ getBreakpointEventCount(BP_UPDATED), getBreakpointEventCount(BP_UPDATED) == 1);
clearEventCounters();
@@ -2480,12 +2446,11 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
SyncUtil.resumeUntilStopped(1000);
// Ensure the BreakpointEvent was received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_HIT event(s), received "
+ getBreakpointEventCount(BP_HIT), getBreakpointEventCount(BP_HIT) == 1);
- assertTrue("BreakpointService problem: breakpoint mismatch",
- fBreakpointRef.equals(breakpoint1.getNumber()));
+ assertTrue("BreakpointService problem: breakpoint mismatch", fBreakpointRef.equals(breakpoint1.getNumber()));
clearEventCounters();
}
@@ -2516,8 +2481,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -2533,16 +2498,15 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
MIStoppedEvent event = SyncUtil.waitForStop(3000);
waitForBreakpointEvent(2);
// Ensure that right BreakpointEvents were received
- assertTrue("BreakpointEvent problem: expected " + 2 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 2);
+ assertTrue("BreakpointEvent problem: expected " + 2 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 2);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_UPDATED event(s), received "
+ getBreakpointEventCount(BP_UPDATED), getBreakpointEventCount(BP_UPDATED) == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_HIT event(s), received "
+ getBreakpointEventCount(BP_HIT), getBreakpointEventCount(BP_HIT) == 1);
clearEventCounters();
MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref);
- assertTrue("Did not stop on our enabled breakpoint!",
- event instanceof MIBreakpointHitEvent);
+ assertTrue("Did not stop on our enabled breakpoint!", event instanceof MIBreakpointHitEvent);
assertTrue("Did not stop because of the correct breakpoint at line " + LINE_NUMBER_5,
((MIBreakpointHitEvent) event).getNumber().equals(breakpoint1.getReference()));
}
@@ -2551,11 +2515,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
Query<MIInfo> query = new Query<MIInfo>() {
@Override
protected void execute(DataRequestMonitor<MIInfo> rm) {
- fCommandControl.queueCommand(
- fCommandControl.getCommandFactory().createMIInterpreterExecConsole(
- fCommandControl.getContext(),
- command),
- rm);
+ fCommandControl.queueCommand(fCommandControl.getCommandFactory()
+ .createMIInterpreterExecConsole(fCommandControl.getContext(), command), rm);
}
};
fSession.getExecutor().execute(query);
@@ -2581,8 +2542,7 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_4);
// Restart is not supported for a remote session
if (isRemoteSession()) {
- Assert.assertFalse("Restart operation should not be allowed for a remote session",
- SyncUtil.canRestart());
+ Assert.assertFalse("Restart operation should not be allowed for a remote session", SyncUtil.canRestart());
return;
}
try {
@@ -2604,8 +2564,7 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
SyncUtil.resume();
// Wait for breakpoint to hit and for the expected number of breakpoint events to have occurred
MIStoppedEvent event = SyncUtil.waitForStop(3000);
- assertTrue("Did not stop on our enabled breakpoint!",
- event instanceof MIBreakpointHitEvent);
+ assertTrue("Did not stop on our enabled breakpoint!", event instanceof MIBreakpointHitEvent);
MIBreakpointDMData bpData = (MIBreakpointDMData) getBreakpoint(bps[0]);
assertTrue("Did not stop because of the correct breakpoint at line " + LINE_NUMBER_5,
((MIBreakpointHitEvent) event).getNumber().equals(bpData.getReference()));
@@ -2636,8 +2595,7 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
SyncUtil.resume();
// Wait for breakpoint to hit and for the expected number of breakpoint events to have occurred
event = SyncUtil.waitForStop(3000);
- assertTrue("Did not stop on our enabled breakpoint!",
- event instanceof MIBreakpointHitEvent);
+ assertTrue("Did not stop on our enabled breakpoint!", event instanceof MIBreakpointHitEvent);
bpData = (MIBreakpointDMData) getBreakpoint(bps[0]);
assertTrue("Did not stop because of the correct breakpoint at line " + LINE_NUMBER_5,
((MIBreakpointHitEvent) event).getNumber().equals(bpData.getReference()));
@@ -2672,8 +2630,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -2682,14 +2640,12 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure the correct BreakpointEvent was received
waitForBreakpointEvent(1);
MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_HIT event(s), received "
+ getBreakpointEventCount(BP_HIT), getBreakpointEventCount(BP_HIT) == 1);
- assertTrue("BreakpointService problem: breakpoint mismatch",
- fBreakpointRef.equals(breakpoint1.getNumber()));
- assertTrue("BreakpointService problem: breakpoint mismatch (pending)",
- !breakpoint1.isPending());
+ assertTrue("BreakpointService problem: breakpoint mismatch", fBreakpointRef.equals(breakpoint1.getNumber()));
+ assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !breakpoint1.isPending());
clearEventCounters();
}
@@ -2709,8 +2665,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -2719,14 +2675,12 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure the correct BreakpointEvent was received
waitForBreakpointEvent(1);
MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_HIT event(s), received "
+ getBreakpointEventCount(BP_HIT), getBreakpointEventCount(BP_HIT) == 1);
- assertTrue("BreakpointService problem: breakpoint mismatch",
- fBreakpointRef.equals(breakpoint1.getNumber()));
- assertTrue("BreakpointService problem: breakpoint mismatch (pending)",
- !breakpoint1.isPending());
+ assertTrue("BreakpointService problem: breakpoint mismatch", fBreakpointRef.equals(breakpoint1.getNumber()));
+ assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !breakpoint1.isPending());
clearEventCounters();
}
@@ -2749,8 +2703,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -2760,14 +2714,12 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure the correct BreakpointEvent was received
waitForBreakpointEvent(1);
MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_HIT event(s), received "
+ getBreakpointEventCount(BP_HIT), getBreakpointEventCount(BP_HIT) == 1);
- assertTrue("BreakpointService problem: breakpoint mismatch",
- fBreakpointRef.equals(breakpoint1.getNumber()));
- assertTrue("BreakpointService problem: breakpoint mismatch (pending)",
- !breakpoint1.isPending());
+ assertTrue("BreakpointService problem: breakpoint mismatch", fBreakpointRef.equals(breakpoint1.getNumber()));
+ assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !breakpoint1.isPending());
clearEventCounters();
// Verify that the condition is met
int i = evaluateExpression(frameDmc, "i").intValue();
@@ -2792,8 +2744,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -2804,8 +2756,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_UPDATED event(s), received "
+ getBreakpointEventCount(BP_UPDATED), getBreakpointEventCount(BP_UPDATED) == 1);
clearEventCounters();
@@ -2815,14 +2767,12 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure the correct BreakpointEvent was received
waitForBreakpointEvent(1);
MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_HIT event(s), received "
+ getBreakpointEventCount(BP_HIT), getBreakpointEventCount(BP_HIT) == 1);
- assertTrue("BreakpointService problem: breakpoint mismatch",
- fBreakpointRef.equals(breakpoint1.getNumber()));
- assertTrue("BreakpointService problem: breakpoint mismatch (pending)",
- !breakpoint1.isPending());
+ assertTrue("BreakpointService problem: breakpoint mismatch", fBreakpointRef.equals(breakpoint1.getNumber()));
+ assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !breakpoint1.isPending());
clearEventCounters();
// Verify that the condition is met
int i = evaluateExpression(frameDmc, "i").intValue();
@@ -2848,8 +2798,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -2859,14 +2809,12 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure the correct BreakpointEvent was received
waitForBreakpointEvent(1);
MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_HIT event(s), received "
+ getBreakpointEventCount(BP_HIT), getBreakpointEventCount(BP_HIT) == 1);
- assertTrue("BreakpointService problem: breakpoint mismatch",
- fBreakpointRef.equals(breakpoint1.getNumber()));
- assertTrue("BreakpointService problem: breakpoint mismatch (pending)",
- !breakpoint1.isPending());
+ assertTrue("BreakpointService problem: breakpoint mismatch", fBreakpointRef.equals(breakpoint1.getNumber()));
+ assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !breakpoint1.isPending());
clearEventCounters();
// Verify that the condition is met
int i = evaluateExpression(frameDmc, "i").intValue();
@@ -2891,8 +2839,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -2903,8 +2851,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_UPDATED event(s), received "
+ getBreakpointEventCount(BP_UPDATED), getBreakpointEventCount(BP_UPDATED) == 1);
clearEventCounters();
@@ -2914,14 +2862,12 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure the correct BreakpointEvent was received
waitForBreakpointEvent(1);
MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_HIT event(s), received "
+ getBreakpointEventCount(BP_HIT), getBreakpointEventCount(BP_HIT) == 1);
- assertTrue("BreakpointService problem: breakpoint mismatch",
- fBreakpointRef.equals(breakpoint1.getNumber()));
- assertTrue("BreakpointService problem: breakpoint mismatch (pending)",
- !breakpoint1.isPending());
+ assertTrue("BreakpointService problem: breakpoint mismatch", fBreakpointRef.equals(breakpoint1.getNumber()));
+ assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !breakpoint1.isPending());
clearEventCounters();
// Verify that the condition is met
int i = evaluateExpression(frameDmc, "i").intValue();
@@ -2945,8 +2891,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -2956,14 +2902,12 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure the correct BreakpointEvent was received
waitForBreakpointEvent(1);
MIBreakpointDMData watchpoint1 = (MIBreakpointDMData) getBreakpoint(ref);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " WATCHPOINT_HIT event(s), received "
+ getBreakpointEventCount(WP_HIT), getBreakpointEventCount(WP_HIT) == 1);
- assertTrue("BreakpointService problem: watchpoint mismatch",
- fBreakpointRef.equals(watchpoint1.getNumber()));
- assertTrue("BreakpointService problem: breakpoint mismatch (pending)",
- !watchpoint1.isPending());
+ assertTrue("BreakpointService problem: watchpoint mismatch", fBreakpointRef.equals(watchpoint1.getNumber()));
+ assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !watchpoint1.isPending());
clearEventCounters();
// Verify that the condition is met
int i = evaluateExpression(frameDmc, "i").intValue();
@@ -2987,8 +2931,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -2998,14 +2942,12 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure the correct BreakpointEvent was received
waitForBreakpointEvent(1);
MIBreakpointDMData watchpoint1 = (MIBreakpointDMData) getBreakpoint(ref);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " WATCHPOINT_HIT event(s), received "
+ getBreakpointEventCount(WP_HIT), getBreakpointEventCount(WP_HIT) == 1);
- assertTrue("BreakpointService problem: watchpoint mismatch",
- fBreakpointRef.equals(watchpoint1.getNumber()));
- assertTrue("BreakpointService problem: breakpoint mismatch (pending)",
- !watchpoint1.isPending());
+ assertTrue("BreakpointService problem: watchpoint mismatch", fBreakpointRef.equals(watchpoint1.getNumber()));
+ assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !watchpoint1.isPending());
clearEventCounters();
// Verify that the condition is met
int i = evaluateExpression(frameDmc, "i").intValue();
@@ -3030,8 +2972,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -3041,14 +2983,12 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure the correct BreakpointEvent was received
waitForBreakpointEvent(1);
MIBreakpointDMData watchpoint1 = (MIBreakpointDMData) getBreakpoint(ref);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " WATCHPOINT_HIT event(s), received "
+ getBreakpointEventCount(WP_HIT), getBreakpointEventCount(WP_HIT) == 1);
- assertTrue("BreakpointService problem: watchpoint mismatch",
- fBreakpointRef.equals(watchpoint1.getNumber()));
- assertTrue("BreakpointService problem: breakpoint mismatch (pending)",
- !watchpoint1.isPending());
+ assertTrue("BreakpointService problem: watchpoint mismatch", fBreakpointRef.equals(watchpoint1.getNumber()));
+ assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !watchpoint1.isPending());
clearEventCounters();
// Verify that the condition is met
int i = evaluateExpression(frameDmc, "i").intValue();
@@ -3074,8 +3014,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -3086,8 +3026,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_UPDATED event(s), received "
+ getBreakpointEventCount(BP_UPDATED), getBreakpointEventCount(BP_UPDATED) == 1);
clearEventCounters();
@@ -3097,14 +3037,12 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure the correct BreakpointEvent was received
waitForBreakpointEvent(1);
MIBreakpointDMData watchpoint1 = (MIBreakpointDMData) getBreakpoint(ref);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " WATCHPOINT_HIT event(s), received "
+ getBreakpointEventCount(WP_HIT), getBreakpointEventCount(WP_HIT) == 1);
- assertTrue("BreakpointService problem: watchpoint mismatch",
- fBreakpointRef.equals(watchpoint1.getNumber()));
- assertTrue("BreakpointService problem: breakpoint mismatch (pending)",
- !watchpoint1.isPending());
+ assertTrue("BreakpointService problem: watchpoint mismatch", fBreakpointRef.equals(watchpoint1.getNumber()));
+ assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !watchpoint1.isPending());
clearEventCounters();
// Verify that the condition is met
int j = evaluateExpression(frameDmc, EXPRESSION_2).intValue();
@@ -3134,8 +3072,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -3146,8 +3084,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_UPDATED event(s), received "
+ getBreakpointEventCount(BP_UPDATED), getBreakpointEventCount(BP_UPDATED) == 1);
clearEventCounters();
@@ -3157,19 +3095,16 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure the correct BreakpointEvent was received
waitForBreakpointEvent(1);
MIBreakpointDMData watchpoint1 = (MIBreakpointDMData) getBreakpoint(ref);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " WATCHPOINT_HIT event(s), received "
+ getBreakpointEventCount(WP_HIT), getBreakpointEventCount(WP_HIT) == 1);
- assertTrue("BreakpointService problem: watchpoint mismatch",
- fBreakpointRef.equals(watchpoint1.getNumber()));
- assertTrue("BreakpointService problem: breakpoint mismatch (pending)",
- !watchpoint1.isPending());
+ assertTrue("BreakpointService problem: watchpoint mismatch", fBreakpointRef.equals(watchpoint1.getNumber()));
+ assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !watchpoint1.isPending());
clearEventCounters();
// Verify that the condition is met
int j = evaluateExpression(frameDmc, EXPRESSION_2).intValue();
- assertTrue("Watchpoint problem: " + EXPRESSION_2 + " was " + j + " instead of " + 20,
- j == 20);
+ assertTrue("Watchpoint problem: " + EXPRESSION_2 + " was " + j + " instead of " + 20, j == 20);
}
// ------------------------------------------------------------------------
@@ -3195,8 +3130,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -3205,14 +3140,12 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure the correct BreakpointEvent was received
waitForBreakpointEvent(1);
MIBreakpointDMData watchpoint1 = (MIBreakpointDMData) getBreakpoint(ref);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " WATCHPOINT_HIT event(s), received "
+ getBreakpointEventCount(WP_OOS), getBreakpointEventCount(WP_OOS) == 1);
- assertTrue("BreakpointService problem: watchpoint mismatch",
- fBreakpointRef.equals(watchpoint1.getNumber()));
- assertTrue("BreakpointService problem: breakpoint mismatch (pending)",
- !watchpoint1.isPending());
+ assertTrue("BreakpointService problem: watchpoint mismatch", fBreakpointRef.equals(watchpoint1.getNumber()));
+ assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !watchpoint1.isPending());
clearEventCounters();
// Ensure the watchpoint is gone
getBreakpoints(fBreakpointsDmc);
@@ -3242,8 +3175,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, breakpoint);
// Ensure that no BreakpointEvent was received
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
MIBreakpointDMData bpData = (MIBreakpointDMData) getBreakpoint(ref);
assertTrue("Breakpoint should be pending", bpData.isPending());
@@ -3269,8 +3202,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -3285,18 +3218,15 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
breakpoint1.getCondition().equals(NO_CONDITION));
assertTrue("BreakpointService problem: breakpoint mismatch (wrong ignore count)",
breakpoint1.getIgnoreCount() == 0);
- assertTrue("BreakpointService problem: breakpoint mismatch (wrong state)",
- breakpoint1.isEnabled());
- assertTrue("BreakpointService problem: breakpoint mismatch (not pending)",
- breakpoint1.isPending());
+ assertTrue("BreakpointService problem: breakpoint mismatch (wrong state)", breakpoint1.isEnabled());
+ assertTrue("BreakpointService problem: breakpoint mismatch (not pending)", breakpoint1.isPending());
// Ensure the BreakpointService holds only the right breakpoints
IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc);
- assertTrue("BreakpointService problem: expected " + 1 + " breakpoint(s), received "
- + breakpoints.length, breakpoints.length == 1);
+ assertTrue("BreakpointService problem: expected " + 1 + " breakpoint(s), received " + breakpoints.length,
+ breakpoints.length == 1);
MIBreakpointDMData breakpoint2 = (MIBreakpointDMData) getBreakpoint(breakpoints[0]);
- assertTrue("BreakpointService problem: breakpoint mismatch",
- breakpoint1.equals(breakpoint2));
+ assertTrue("BreakpointService problem: breakpoint mismatch", breakpoint1.equals(breakpoint2));
}
/**
@@ -3319,8 +3249,8 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// Ensure that right BreakpointEvents were received
waitForBreakpointEvent(1);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
clearEventCounters();
@@ -3335,16 +3265,14 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
breakpoint1.getCondition().equals(NO_CONDITION));
assertTrue("BreakpointService problem: breakpoint mismatch (wrong ignore count)",
breakpoint1.getIgnoreCount() == 0);
- assertTrue("BreakpointService problem: breakpoint mismatch (not pending)",
- breakpoint1.isPending());
+ assertTrue("BreakpointService problem: breakpoint mismatch (not pending)", breakpoint1.isPending());
// Ensure the BreakpointService holds only the right breakpoints
IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc);
- assertTrue("BreakpointService problem: expected " + 1 + " breakpoint(s), received "
- + breakpoints.length, breakpoints.length == 1);
+ assertTrue("BreakpointService problem: expected " + 1 + " breakpoint(s), received " + breakpoints.length,
+ breakpoints.length == 1);
MIBreakpointDMData breakpoint2 = (MIBreakpointDMData) getBreakpoint(breakpoints[0]);
- assertTrue("BreakpointService problem: breakpoint mismatch",
- breakpoint1.equals(breakpoint2));
+ assertTrue("BreakpointService problem: breakpoint mismatch", breakpoint1.equals(breakpoint2));
}
/**
@@ -3360,9 +3288,9 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
// target in a suspended state. Unfortunately, there is nothing
// practical CDT can do to address this issue except wait for the gdb
// folks to resolve it. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=304096#c27
- if (runningOnWindows()) {
- return;
- }
+ if (runningOnWindows()) {
+ return;
+ }
// Create an invalid line breakpoint
Map<String, Object> breakpoint = new HashMap<String, Object>();
@@ -3377,16 +3305,14 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
MIBreakpointDMContext ref = (MIBreakpointDMContext) insertBreakpoint(fBreakpointsDmc, breakpoint);
waitForBreakpointEvent(1);
- // Ensure the correct BreakpointEvent was received
+ // Ensure the correct BreakpointEvent was received
MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref);
- assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
- + fBreakpointEventCount, fBreakpointEventCount == 1);
+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount,
+ fBreakpointEventCount == 1);
assertTrue("BreakpointEvent problem: expected " + 0 + " BREAKPOINT_HIT event(s), received "
+ getBreakpointEventCount(BP_HIT), getBreakpointEventCount(BP_HIT) == 0);
- assertTrue("BreakpointService problem: breakpoint mismatch",
- fBreakpointRef.equals(breakpoint1.getNumber()));
- assertTrue("BreakpointService problem: breakpoint mismatch (not pending)",
- breakpoint1.isPending());
+ assertTrue("BreakpointService problem: breakpoint mismatch", fBreakpointRef.equals(breakpoint1.getNumber()));
+ assertTrue("BreakpointService problem: breakpoint mismatch (not pending)", breakpoint1.isPending());
clearEventCounters();
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MICatchpointsTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MICatchpointsTest.java
index c0bc6cc4d99..2ab9794c660 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MICatchpointsTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MICatchpointsTest.java
@@ -85,117 +85,117 @@ import org.junit.runners.Parameterized;
@RunWith(Parameterized.class)
public class MICatchpointsTest extends BaseParametrizedTestCase {
- private static final String EXEC_NAME = "CatchpointTestApp.exe"; //$NON-NLS-1$
- private static final String SOURCE_NAME = "CatchpointTestApp.cc"; //$NON-NLS-1$
+ private static final String EXEC_NAME = "CatchpointTestApp.exe"; //$NON-NLS-1$
+ private static final String SOURCE_NAME = "CatchpointTestApp.cc"; //$NON-NLS-1$
- private int LINE_NUMBER_SLEEP_CALL;
-
- private static final String[] LINE_TAGS = {
- "LINE_NUMBER_SLEEP_CALL",
- };
+ private int LINE_NUMBER_SLEEP_CALL;
- // Asynchronous Completion
- private final AsyncCompletionWaitor fWait = new AsyncCompletionWaitor();
+ private static final String[] LINE_TAGS = { "LINE_NUMBER_SLEEP_CALL", };
- // Services references
- private DsfSession fSession;
+ // Asynchronous Completion
+ private final AsyncCompletionWaitor fWait = new AsyncCompletionWaitor();
+
+ // Services references
+ private DsfSession fSession;
private IBreakpointsTargetDMContext fBreakpointsDmc;
- private DsfServicesTracker fServicesTracker;
- private MIRunControl fRunControl;
- private IBreakpoints fBreakpointService;
- private IExpressions fExpressionService;
-
- // Event Management
- private static Boolean fEventHandlerLock = true;
- private enum Events { BP_ADDED, BP_UPDATED, BP_REMOVED, BP_HIT }
- private final int BP_ADDED = Events.BP_ADDED.ordinal();
- private final int BP_UPDATED = Events.BP_UPDATED.ordinal();
- private final int BP_REMOVED = Events.BP_REMOVED.ordinal();
- private final int BP_HIT = Events.BP_HIT.ordinal();
-
- /** number of times a breakpoint event was received, broken down by event type */
- private int[] fBreakpointEvents = new int[Events.values().length];
-
- /** total number of breakpoint events received */
- private int totalBreakpointEventsCount() {
- synchronized (fEventHandlerLock) {
- int total = 0;
- for (int count : fBreakpointEvents) {
- total += count;
- }
- return total;
- }
- }
-
-
- /**
- * The gdb breakpoint number associated with the most recent breakpoint event
- */
- private String fBreakpointRef;
-
- // NOTE: The back-end can reformat the condition. In order for the
- // comparison to work, better specify the condition as the back-end
- // would have it.
- private final String CONDITION_VAR = "g_i";
- private final String CONDITION_NONE = "";
- private final String CONDITION_1 = CONDITION_VAR + " == 2";
- private final String CONDITION_2 = CONDITION_VAR + " == 4";
- private final String CONDITION_NEVER_MET = CONDITION_VAR + " == 10000";
- private final String CONDITION_ALWAYS_MET = CONDITION_VAR + " >= 0";
-
- // Error messages
- private final String UNKNOWN_EXECUTION_CONTEXT = "Unknown execution context";
- private final String UNKNOWN_BREAKPOINT = "Unknown breakpoint";
-
- // ========================================================================
- // Housekeeping stuff
- // ========================================================================
-
- @Override
+ private DsfServicesTracker fServicesTracker;
+ private MIRunControl fRunControl;
+ private IBreakpoints fBreakpointService;
+ private IExpressions fExpressionService;
+
+ // Event Management
+ private static Boolean fEventHandlerLock = true;
+
+ private enum Events {
+ BP_ADDED, BP_UPDATED, BP_REMOVED, BP_HIT
+ }
+
+ private final int BP_ADDED = Events.BP_ADDED.ordinal();
+ private final int BP_UPDATED = Events.BP_UPDATED.ordinal();
+ private final int BP_REMOVED = Events.BP_REMOVED.ordinal();
+ private final int BP_HIT = Events.BP_HIT.ordinal();
+
+ /** number of times a breakpoint event was received, broken down by event type */
+ private int[] fBreakpointEvents = new int[Events.values().length];
+
+ /** total number of breakpoint events received */
+ private int totalBreakpointEventsCount() {
+ synchronized (fEventHandlerLock) {
+ int total = 0;
+ for (int count : fBreakpointEvents) {
+ total += count;
+ }
+ return total;
+ }
+ }
+
+ /**
+ * The gdb breakpoint number associated with the most recent breakpoint event
+ */
+ private String fBreakpointRef;
+
+ // NOTE: The back-end can reformat the condition. In order for the
+ // comparison to work, better specify the condition as the back-end
+ // would have it.
+ private final String CONDITION_VAR = "g_i";
+ private final String CONDITION_NONE = "";
+ private final String CONDITION_1 = CONDITION_VAR + " == 2";
+ private final String CONDITION_2 = CONDITION_VAR + " == 4";
+ private final String CONDITION_NEVER_MET = CONDITION_VAR + " == 10000";
+ private final String CONDITION_ALWAYS_MET = CONDITION_VAR + " >= 0";
+
+ // Error messages
+ private final String UNKNOWN_EXECUTION_CONTEXT = "Unknown execution context";
+ private final String UNKNOWN_BREAKPOINT = "Unknown breakpoint";
+
+ // ========================================================================
+ // Housekeeping stuff
+ // ========================================================================
+
+ @Override
public void doBeforeTest() throws Exception {
super.doBeforeTest();
- // Get a reference to the breakpoint service
- fSession = getGDBLaunch().getSession();
- Runnable runnable = new Runnable() {
- @Override
+ // Get a reference to the breakpoint service
+ fSession = getGDBLaunch().getSession();
+ Runnable runnable = new Runnable() {
+ @Override
public void run() {
- fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
- assertNotNull(fServicesTracker);
+ fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
+ assertNotNull(fServicesTracker);
- fRunControl = fServicesTracker.getService(MIRunControl.class);
- assertNotNull(fRunControl);
+ fRunControl = fServicesTracker.getService(MIRunControl.class);
+ assertNotNull(fRunControl);
- fBreakpointService = fServicesTracker.getService(IBreakpoints.class);
- assertNotNull(fBreakpointService);
+ fBreakpointService = fServicesTracker.getService(IBreakpoints.class);
+ assertNotNull(fBreakpointService);
- fExpressionService = fServicesTracker.getService(IExpressions.class);
- assertNotNull(fExpressionService);
+ fExpressionService = fServicesTracker.getService(IExpressions.class);
+ assertNotNull(fExpressionService);
+ // Register to receive breakpoint events
+ fRunControl.getSession().addServiceEventListener(MICatchpointsTest.this, null);
- // Register to receive breakpoint events
- fRunControl.getSession().addServiceEventListener(MICatchpointsTest.this, null);
-
- clearEventCounters();
- }
- };
- fSession.getExecutor().submit(runnable).get();
+ clearEventCounters();
+ }
+ };
+ fSession.getExecutor().submit(runnable).get();
- IContainerDMContext containerDmc = SyncUtil.getContainerContext();
- fBreakpointsDmc = DMContexts.getAncestorOfType(containerDmc, IBreakpointsTargetDMContext.class);
- assertNotNull(fBreakpointsDmc);
+ IContainerDMContext containerDmc = SyncUtil.getContainerContext();
+ fBreakpointsDmc = DMContexts.getAncestorOfType(containerDmc, IBreakpointsTargetDMContext.class);
+ assertNotNull(fBreakpointsDmc);
- resolveLineTagLocations(SOURCE_NAME, LINE_TAGS);
- LINE_NUMBER_SLEEP_CALL = getLineForTag("LINE_NUMBER_SLEEP_CALL");
- }
+ resolveLineTagLocations(SOURCE_NAME, LINE_TAGS);
+ LINE_NUMBER_SLEEP_CALL = getLineForTag("LINE_NUMBER_SLEEP_CALL");
+ }
- @Override
- protected void setLaunchAttributes() {
- super.setLaunchAttributes();
+ @Override
+ protected void setLaunchAttributes() {
+ super.setLaunchAttributes();
- // Select the binary to run the tests against
- setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EXEC_PATH + EXEC_NAME);
- }
+ // Select the binary to run the tests against
+ setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EXEC_PATH + EXEC_NAME);
+ }
@Override
public void doAfterTest() throws Exception {
@@ -218,56 +218,60 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
clearEventCounters();
}
- // ========================================================================
- // Event Management Functions
- // ========================================================================
-
- /* -----------------------------------------------------------------------
- * eventDispatched
- * ------------------------------------------------------------------------
- * Processes BreakpointHitEvent.
- * ------------------------------------------------------------------------
- * @param e The BreakpointEvent
- * ------------------------------------------------------------------------
- */
- @DsfServiceEventHandler
+ // ========================================================================
+ // Event Management Functions
+ // ========================================================================
+
+ /* -----------------------------------------------------------------------
+ * eventDispatched
+ * ------------------------------------------------------------------------
+ * Processes BreakpointHitEvent.
+ * ------------------------------------------------------------------------
+ * @param e The BreakpointEvent
+ * ------------------------------------------------------------------------
+ */
+ @DsfServiceEventHandler
public void eventDispatched(IBreakpointsAddedEvent e) {
- synchronized (fEventHandlerLock) {
- fBreakpointEvents[BP_ADDED]++;
- fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference();
- if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got bp added event (#" + fBreakpointRef + ")\n");
- fEventHandlerLock.notifyAll();
- }
+ synchronized (fEventHandlerLock) {
+ fBreakpointEvents[BP_ADDED]++;
+ fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference();
+ if (GdbDebugOptions.DEBUG)
+ GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got bp added event (#" + fBreakpointRef + ")\n");
+ fEventHandlerLock.notifyAll();
+ }
}
- @DsfServiceEventHandler
+ @DsfServiceEventHandler
public void eventDispatched(IBreakpointsUpdatedEvent e) {
- synchronized (fEventHandlerLock) {
- fBreakpointEvents[BP_UPDATED]++;
- fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference();
- if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got bp updated event (#" + fBreakpointRef + ")\n");
- fEventHandlerLock.notifyAll();
- }
+ synchronized (fEventHandlerLock) {
+ fBreakpointEvents[BP_UPDATED]++;
+ fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference();
+ if (GdbDebugOptions.DEBUG)
+ GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got bp updated event (#" + fBreakpointRef + ")\n");
+ fEventHandlerLock.notifyAll();
+ }
}
- @DsfServiceEventHandler
+ @DsfServiceEventHandler
public void eventDispatched(IBreakpointsRemovedEvent e) {
- synchronized (fEventHandlerLock) {
- fBreakpointEvents[BP_REMOVED]++;
- fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference();
- if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got bp removed event (#" + fBreakpointRef + ")\n");
- fEventHandlerLock.notifyAll();
- }
+ synchronized (fEventHandlerLock) {
+ fBreakpointEvents[BP_REMOVED]++;
+ fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference();
+ if (GdbDebugOptions.DEBUG)
+ GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got bp removed event (#" + fBreakpointRef + ")\n");
+ fEventHandlerLock.notifyAll();
+ }
}
- @DsfServiceEventHandler
+ @DsfServiceEventHandler
public void eventDispatched(MIBreakpointHitEvent e) {
- synchronized (fEventHandlerLock) {
- fBreakpointEvents[BP_HIT]++;
- fBreakpointRef = e.getNumber();
- if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got bp hit event (#" + fBreakpointRef + ")\n");
- fEventHandlerLock.notifyAll();
- }
+ synchronized (fEventHandlerLock) {
+ fBreakpointEvents[BP_HIT]++;
+ fBreakpointRef = e.getNumber();
+ if (GdbDebugOptions.DEBUG)
+ GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got bp hit event (#" + fBreakpointRef + ")\n");
+ fEventHandlerLock.notifyAll();
+ }
}
// Clears the counters
@@ -282,9 +286,9 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
// Get the breakpoint hit count
private int getBreakpointEventCount(int event) {
int count = 0;
- synchronized (fEventHandlerLock) {
- count = fBreakpointEvents[event];
- }
+ synchronized (fEventHandlerLock) {
+ count = fBreakpointEvents[event];
+ }
return count;
}
@@ -310,7 +314,8 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
} catch (InterruptedException ex) {
}
if (System.currentTimeMillis() - startMs > timeout) {
- throw new Exception("Timed out waiting for " + count + " breakpoint events to occur. Only " + receivedCount + " occurred.");
+ throw new Exception("Timed out waiting for " + count + " breakpoint events to occur. Only "
+ + receivedCount + " occurred.");
}
}
}
@@ -323,32 +328,32 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
waitForBreakpointEvent(count, TestsPlugin.massageTimeout(2000));
}
- // ========================================================================
- // Helper Functions
- // ========================================================================
-
- /* ------------------------------------------------------------------------
- * evaluateExpression
- * ------------------------------------------------------------------------
- * Invokes the ExpressionService to evaluate an expression. In theory,
- * we shouldn't rely on another service to test this one but we need a
- * way to access a variable from the test application in order verify
- * that the memory operations (read/write) are working properly.
- * ------------------------------------------------------------------------
- * @param expression Expression to resolve @return Resolved expression
- * @throws InterruptedException
- * ------------------------------------------------------------------------
- */
- private BigInteger evaluateExpression(IDMContext ctx, String expression) throws Throwable {
-
- // Get a stack context (temporary - should be an MIcontainerDMC)
+ // ========================================================================
+ // Helper Functions
+ // ========================================================================
+
+ /* ------------------------------------------------------------------------
+ * evaluateExpression
+ * ------------------------------------------------------------------------
+ * Invokes the ExpressionService to evaluate an expression. In theory,
+ * we shouldn't rely on another service to test this one but we need a
+ * way to access a variable from the test application in order verify
+ * that the memory operations (read/write) are working properly.
+ * ------------------------------------------------------------------------
+ * @param expression Expression to resolve @return Resolved expression
+ * @throws InterruptedException
+ * ------------------------------------------------------------------------
+ */
+ private BigInteger evaluateExpression(IDMContext ctx, String expression) throws Throwable {
+
+ // Get a stack context (temporary - should be an MIcontainerDMC)
final IExpressionDMContext expressionDMC = SyncUtil.createExpression(ctx, expression);
- final FormattedValueDMContext formattedValueDMC = SyncUtil.getFormattedValue(fExpressionService,
- expressionDMC, IFormattedValues.DECIMAL_FORMAT);
+ final FormattedValueDMContext formattedValueDMC = SyncUtil.getFormattedValue(fExpressionService, expressionDMC,
+ IFormattedValues.DECIMAL_FORMAT);
// Create the DataRequestMonitor which will store the operation result in the wait object
- final DataRequestMonitor<FormattedValueDMData> drm =
- new DataRequestMonitor<FormattedValueDMData>(fSession.getExecutor(), null) {
+ final DataRequestMonitor<FormattedValueDMData> drm = new DataRequestMonitor<FormattedValueDMData>(
+ fSession.getExecutor(), null) {
@Override
protected void handleCompleted() {
if (isSuccess()) {
@@ -377,222 +382,216 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
if (returnInfo instanceof FormattedValueDMData)
result = ((FormattedValueDMData) returnInfo).getFormattedValue();
return new BigInteger(result);
- }
-
- /* ------------------------------------------------------------------------
- * getBreakpoints
- * ------------------------------------------------------------------------
- * Retrieves the installed breakpoints list
- * ------------------------------------------------------------------------
- * Typical usage:
- * IBreakpointDMContext[] breakpoints = getBreakpoints(context);
- * ------------------------------------------------------------------------
- * @param context the execution context
- * ------------------------------------------------------------------------
- */
- private IBreakpointDMContext[] getBreakpoints(final IBreakpointsTargetDMContext context) throws InterruptedException
- {
- // Clear the completion waiter
+ }
+
+ /* ------------------------------------------------------------------------
+ * getBreakpoints
+ * ------------------------------------------------------------------------
+ * Retrieves the installed breakpoints list
+ * ------------------------------------------------------------------------
+ * Typical usage:
+ * IBreakpointDMContext[] breakpoints = getBreakpoints(context);
+ * ------------------------------------------------------------------------
+ * @param context the execution context
+ * ------------------------------------------------------------------------
+ */
+ private IBreakpointDMContext[] getBreakpoints(final IBreakpointsTargetDMContext context)
+ throws InterruptedException {
+ // Clear the completion waiter
fWait.waitReset();
- // Set the Request Monitor
- final DataRequestMonitor<IBreakpointDMContext[]> drm =
- new DataRequestMonitor<IBreakpointDMContext[]>(fBreakpointService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- fWait.waitFinished(getStatus());
- }
- };
-
- // Issue the breakpoint request
- fWait.waitReset();
- fBreakpointService.getExecutor().submit(new Runnable() {
- @Override
+ // Set the Request Monitor
+ final DataRequestMonitor<IBreakpointDMContext[]> drm = new DataRequestMonitor<IBreakpointDMContext[]>(
+ fBreakpointService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ fWait.waitFinished(getStatus());
+ }
+ };
+
+ // Issue the breakpoint request
+ fWait.waitReset();
+ fBreakpointService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- fBreakpointService.getBreakpoints(context, drm);
- }
- });
-
- // Wait for completion
- fWait.waitUntilDone(TestsPlugin.massageTimeout(5000));
- assertTrue(fWait.getMessage(), fWait.isOK());
-
- // Return the string formatted by the back-end
- return drm.getData();
- }
-
- /* ------------------------------------------------------------------------
- * getBreakpoint
- * ------------------------------------------------------------------------
- * Retrieves the installed breakpoint
- * ------------------------------------------------------------------------
- * Typical usage:
- * IBreakpointDMContext breakpoint = ...;
- * IBreakpointDMData bp = getBreakpoint(breakpoint);
- * ------------------------------------------------------------------------
- * @param breakpoint the breakpoint to retrieve
- * ------------------------------------------------------------------------
- */
- private IBreakpointDMData getBreakpoint(final IBreakpointDMContext breakpoint) throws InterruptedException
- {
- // Clear the completion waiter
+ fBreakpointService.getBreakpoints(context, drm);
+ }
+ });
+
+ // Wait for completion
+ fWait.waitUntilDone(TestsPlugin.massageTimeout(5000));
+ assertTrue(fWait.getMessage(), fWait.isOK());
+
+ // Return the string formatted by the back-end
+ return drm.getData();
+ }
+
+ /* ------------------------------------------------------------------------
+ * getBreakpoint
+ * ------------------------------------------------------------------------
+ * Retrieves the installed breakpoint
+ * ------------------------------------------------------------------------
+ * Typical usage:
+ * IBreakpointDMContext breakpoint = ...;
+ * IBreakpointDMData bp = getBreakpoint(breakpoint);
+ * ------------------------------------------------------------------------
+ * @param breakpoint the breakpoint to retrieve
+ * ------------------------------------------------------------------------
+ */
+ private IBreakpointDMData getBreakpoint(final IBreakpointDMContext breakpoint) throws InterruptedException {
+ // Clear the completion waiter
fWait.waitReset();
- // Set the Request Monitor
- final DataRequestMonitor<IBreakpointDMData> drm =
- new DataRequestMonitor<IBreakpointDMData>(fBreakpointService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- fWait.waitFinished(getStatus());
- }
- };
-
- // Issue the breakpoint request
- fWait.waitReset();
- fBreakpointService.getExecutor().submit(new Runnable() {
- @Override
+ // Set the Request Monitor
+ final DataRequestMonitor<IBreakpointDMData> drm = new DataRequestMonitor<IBreakpointDMData>(
+ fBreakpointService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ fWait.waitFinished(getStatus());
+ }
+ };
+
+ // Issue the breakpoint request
+ fWait.waitReset();
+ fBreakpointService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- fBreakpointService.getBreakpointDMData(breakpoint, drm);
- }
- });
-
- // Wait for completion
- fWait.waitUntilDone(TestsPlugin.massageTimeout(5000));
- assertTrue(fWait.getMessage(), fWait.isOK());
-
- // Return the string formatted by the back-end
- return drm.getData();
- }
-
- /* ------------------------------------------------------------------------
- * insertBreakpoint
- * ------------------------------------------------------------------------
- * Issues an add breakpoint request.
- * ------------------------------------------------------------------------
- * Typical usage:
- * bp = insertBreakpoint(context, attributes);
- * assertTrue(fWait.getMessage(), fWait.isOK());
- * ------------------------------------------------------------------------
- * @param context the execution context
- * @param attributes the breakpoint attributes
- * ------------------------------------------------------------------------
- */
- private IBreakpointDMContext insertBreakpoint(final IBreakpointsTargetDMContext context,
- final Map<String,Object> attributes) throws InterruptedException
- {
- // Clear the completion waiter
+ fBreakpointService.getBreakpointDMData(breakpoint, drm);
+ }
+ });
+
+ // Wait for completion
+ fWait.waitUntilDone(TestsPlugin.massageTimeout(5000));
+ assertTrue(fWait.getMessage(), fWait.isOK());
+
+ // Return the string formatted by the back-end
+ return drm.getData();
+ }
+
+ /* ------------------------------------------------------------------------
+ * insertBreakpoint
+ * ------------------------------------------------------------------------
+ * Issues an add breakpoint request.
+ * ------------------------------------------------------------------------
+ * Typical usage:
+ * bp = insertBreakpoint(context, attributes);
+ * assertTrue(fWait.getMessage(), fWait.isOK());
+ * ------------------------------------------------------------------------
+ * @param context the execution context
+ * @param attributes the breakpoint attributes
+ * ------------------------------------------------------------------------
+ */
+ private IBreakpointDMContext insertBreakpoint(final IBreakpointsTargetDMContext context,
+ final Map<String, Object> attributes) throws InterruptedException {
+ // Clear the completion waiter
fWait.waitReset();
// Set the Request Monitor
- final DataRequestMonitor<IBreakpointDMContext> drm =
- new DataRequestMonitor<IBreakpointDMContext>(fBreakpointService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- fWait.waitFinished(getStatus());
- }
- };
-
- // Issue the remove breakpoint request
- fBreakpointService.getExecutor().submit(new Runnable() {
- @Override
+ final DataRequestMonitor<IBreakpointDMContext> drm = new DataRequestMonitor<IBreakpointDMContext>(
+ fBreakpointService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ fWait.waitFinished(getStatus());
+ }
+ };
+
+ // Issue the remove breakpoint request
+ fBreakpointService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- fBreakpointService.insertBreakpoint(context, attributes, drm);
- }
- });
-
- // Wait for the result and return the breakpoint id
- fWait.waitUntilDone(TestsPlugin.massageTimeout(5000));
- return drm.getData();
- }
-
- /* ------------------------------------------------------------------------
- * removeBreakpoint
- * ------------------------------------------------------------------------
- * Issues a remove breakpoint request.
- * ------------------------------------------------------------------------
- * Typical usage:
- * IBreakpointDMContext breakpoint = ...;
- * removeBreakpoint(context, breakpoint);
- * assertTrue(fWait.getMessage(), fWait.isOK());
- * ------------------------------------------------------------------------
- * @param breakpoint the breakpoint to remove
- * ------------------------------------------------------------------------
- */
- private void removeBreakpoint(final IBreakpointDMContext breakpoint) throws InterruptedException
- {
- // Clear the completion waiter
+ fBreakpointService.insertBreakpoint(context, attributes, drm);
+ }
+ });
+
+ // Wait for the result and return the breakpoint id
+ fWait.waitUntilDone(TestsPlugin.massageTimeout(5000));
+ return drm.getData();
+ }
+
+ /* ------------------------------------------------------------------------
+ * removeBreakpoint
+ * ------------------------------------------------------------------------
+ * Issues a remove breakpoint request.
+ * ------------------------------------------------------------------------
+ * Typical usage:
+ * IBreakpointDMContext breakpoint = ...;
+ * removeBreakpoint(context, breakpoint);
+ * assertTrue(fWait.getMessage(), fWait.isOK());
+ * ------------------------------------------------------------------------
+ * @param breakpoint the breakpoint to remove
+ * ------------------------------------------------------------------------
+ */
+ private void removeBreakpoint(final IBreakpointDMContext breakpoint) throws InterruptedException {
+ // Clear the completion waiter
fWait.waitReset();
- // Set the Request Monitor
- final RequestMonitor rm =
- new RequestMonitor(fBreakpointService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- fWait.waitFinished(getStatus());
- }
- };
-
- // Issue the add breakpoint request
- fBreakpointService.getExecutor().submit(new Runnable() {
- @Override
+ // Set the Request Monitor
+ final RequestMonitor rm = new RequestMonitor(fBreakpointService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ fWait.waitFinished(getStatus());
+ }
+ };
+
+ // Issue the add breakpoint request
+ fBreakpointService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- fBreakpointService.removeBreakpoint(breakpoint, rm);
- }
- });
-
- // Wait for the result
- fWait.waitUntilDone(TestsPlugin.massageTimeout(5000));
- }
-
- /* ------------------------------------------------------------------------
- * updateBreakpoint
- * ------------------------------------------------------------------------
- * Issues an update breakpoint request.
- * ------------------------------------------------------------------------
- * Typical usage:
- * updateBreakpoint(context, breakpoint, properties);
- * assertTrue(fWait.getMessage(), fWait.isOK());
- * ------------------------------------------------------------------------
- * @param breakpoint the breakpoint to update
- * @param delta the delta properties
- * ------------------------------------------------------------------------
- */
- private void updateBreakpoint(final IBreakpointDMContext breakpoint,
- final Map<String, Object> delta) throws InterruptedException
- {
- // Clear the completion waiter
+ fBreakpointService.removeBreakpoint(breakpoint, rm);
+ }
+ });
+
+ // Wait for the result
+ fWait.waitUntilDone(TestsPlugin.massageTimeout(5000));
+ }
+
+ /* ------------------------------------------------------------------------
+ * updateBreakpoint
+ * ------------------------------------------------------------------------
+ * Issues an update breakpoint request.
+ * ------------------------------------------------------------------------
+ * Typical usage:
+ * updateBreakpoint(context, breakpoint, properties);
+ * assertTrue(fWait.getMessage(), fWait.isOK());
+ * ------------------------------------------------------------------------
+ * @param breakpoint the breakpoint to update
+ * @param delta the delta properties
+ * ------------------------------------------------------------------------
+ */
+ private void updateBreakpoint(final IBreakpointDMContext breakpoint, final Map<String, Object> delta)
+ throws InterruptedException {
+ // Clear the completion waiter
fWait.waitReset();
- // Set the Request Monitor
- final RequestMonitor rm =
- new RequestMonitor(fBreakpointService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- fWait.waitFinished(getStatus());
- }
- };
-
- // Issue the update breakpoint request
- fBreakpointService.getExecutor().submit(new Runnable() {
- @Override
+ // Set the Request Monitor
+ final RequestMonitor rm = new RequestMonitor(fBreakpointService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ fWait.waitFinished(getStatus());
+ }
+ };
+
+ // Issue the update breakpoint request
+ fBreakpointService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- fBreakpointService.updateBreakpoint(breakpoint, delta, rm);
- }
- });
+ fBreakpointService.updateBreakpoint(breakpoint, delta, rm);
+ }
+ });
- // Wait for the result
- fWait.waitUntilDone(TestsPlugin.massageTimeout(5000));
- }
+ // Wait for the result
+ fWait.waitUntilDone(TestsPlugin.massageTimeout(5000));
+ }
- // ========================================================================
- // Test Cases
- // ========================================================================
+ // ========================================================================
+ // Test Cases
+ // ========================================================================
///////////////////////////////////////////////////////////////////////////
- // Add Catchpoint tests
- ///////////////////////////////////////////////////////////////////////////
+ // Add Catchpoint tests
+ ///////////////////////////////////////////////////////////////////////////
- @Test
+ @Test
public void insertCatchpoint_InvalidContext() throws Throwable {
// Attempt to create a catchpoint with an invalid execution context (should fail)
@@ -604,12 +603,12 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
// Ensure it failed
String expected = UNKNOWN_EXECUTION_CONTEXT;
assertFalse(fWait.getMessage(), fWait.isOK());
- assertTrue("Wrong error message: expected message to contain: '" + expected + "', received '" + fWait.getMessage() + "'",
- fWait.getMessage().contains(expected));
+ assertTrue("Wrong error message: expected message to contain: '" + expected + "', received '"
+ + fWait.getMessage() + "'", fWait.getMessage().contains(expected));
// Ensure that no breakpoint events were received
assertEquals("Unexpected number of breakpoint events", 0, totalBreakpointEventsCount());
- }
+ }
// Long story. There's really no way for the user to set a disabled
// catchpoint/breakpoint/tracepoint, so this test is invalid. If a
@@ -622,48 +621,48 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
// change the implementation to use the new gdb capability to create a
// disabled breakpoint. When we do, this test will become relevant.
// @Test
-// public void insertCatchpoint_Disabled() throws Throwable {
-// // Create a catchpoint
-// Map<String, Object> breakpoint = new HashMap<String, Object>();
-// breakpoint.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.CATCHPOINT);
-// breakpoint.put(MIBreakpoints.CATCHPOINT_TYPE, "throw");
-// breakpoint.put(MIBreakpoints.IS_ENABLED, false);
-//
-// // Perform the test
-// IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, breakpoint);
-// assertTrue(fWait.getMessage(), fWait.isOK());
-//
-// // Ensure that right BreakpointEvents were received
-// waitForBreakpointEvent(1);
-// int count = totalBreakpointEventsCount();
-// assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
-// + count, count == 1);
-// assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
-// + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
-// clearEventCounters();
-//
-// // Ensure that the breakpoint was correctly installed
-// MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref);
-// assertTrue("BreakpointService problem: breakpoint mismatch (wrong condition)",
-// breakpoint1.getCondition().equals(NO_CONDITION));
-// assertTrue("BreakpointService problem: breakpoint mismatch (wrong ignore count)",
-// breakpoint1.getIgnoreCount() == 0);
-// assertTrue("BreakpointService problem: breakpoint mismatch (wrong state)",
-// !breakpoint1.isEnabled());
-//
-// // Ensure the BreakpointService holds only the right breakpoints
-// IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc);
-// assertTrue("BreakpointService problem: expected " + 1 + " breakpoint(s), received "
-// + breakpoints.length, breakpoints.length == 1);
-// MIBreakpointDMData breakpoint2 = (MIBreakpointDMData) getBreakpoint(breakpoints[0]);
-// assertEquals(breakpoint1.getNumber(), breakpoint2.getNumber());
-// assertFalse(breakpoint2.isEnabled());
-// }
+ // public void insertCatchpoint_Disabled() throws Throwable {
+ // // Create a catchpoint
+ // Map<String, Object> breakpoint = new HashMap<String, Object>();
+ // breakpoint.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.CATCHPOINT);
+ // breakpoint.put(MIBreakpoints.CATCHPOINT_TYPE, "throw");
+ // breakpoint.put(MIBreakpoints.IS_ENABLED, false);
+ //
+ // // Perform the test
+ // IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, breakpoint);
+ // assertTrue(fWait.getMessage(), fWait.isOK());
+ //
+ // // Ensure that right BreakpointEvents were received
+ // waitForBreakpointEvent(1);
+ // int count = totalBreakpointEventsCount();
+ // assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
+ // + count, count == 1);
+ // assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
+ // + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
+ // clearEventCounters();
+ //
+ // // Ensure that the breakpoint was correctly installed
+ // MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref);
+ // assertTrue("BreakpointService problem: breakpoint mismatch (wrong condition)",
+ // breakpoint1.getCondition().equals(NO_CONDITION));
+ // assertTrue("BreakpointService problem: breakpoint mismatch (wrong ignore count)",
+ // breakpoint1.getIgnoreCount() == 0);
+ // assertTrue("BreakpointService problem: breakpoint mismatch (wrong state)",
+ // !breakpoint1.isEnabled());
+ //
+ // // Ensure the BreakpointService holds only the right breakpoints
+ // IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc);
+ // assertTrue("BreakpointService problem: expected " + 1 + " breakpoint(s), received "
+ // + breakpoints.length, breakpoints.length == 1);
+ // MIBreakpointDMData breakpoint2 = (MIBreakpointDMData) getBreakpoint(breakpoints[0]);
+ // assertEquals(breakpoint1.getNumber(), breakpoint2.getNumber());
+ // assertFalse(breakpoint2.isEnabled());
+ // }
@Test
public void insertCatchpoint_Simple() throws Throwable {
IBreakpointDMContext ref = setCatchpoint("throw", null, null);
- resumeAndExpectBkptHit(((MIBreakpointDMData)getBreakpoint(ref)).getNumber(), 0);
+ resumeAndExpectBkptHit(((MIBreakpointDMData) getBreakpoint(ref)).getNumber(), 0);
}
/**
@@ -674,7 +673,7 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
@Test
public void insertCatchpoint_Condition() throws Throwable {
IBreakpointDMContext ref = setCatchpoint("throw", CONDITION_1, null);
- resumeAndExpectBkptHit(((MIBreakpointDMData)getBreakpoint(ref)).getNumber(), 2);
+ resumeAndExpectBkptHit(((MIBreakpointDMData) getBreakpoint(ref)).getNumber(), 2);
}
/**
@@ -685,8 +684,8 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
@Test
public void insertCatchpoint_IgnoreCnt() throws Throwable {
IBreakpointDMContext ref = setCatchpoint("throw", null, 3);
- resumeAndExpectBkptHit(((MIBreakpointDMData)getBreakpoint(ref)).getNumber(), 3);
- }
+ resumeAndExpectBkptHit(((MIBreakpointDMData) getBreakpoint(ref)).getNumber(), 3);
+ }
/**
* Set two different catchpoints and ensure they are set correctly in the back-end.
@@ -713,8 +712,7 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
// breakpoints were initially set...
if (bkpt1_svc.getNumber().equals(bkpt1_set.getNumber())) {
assertEquals(bkpt2_svc.getNumber(), bkpt2_set.getNumber());
- }
- else {
+ } else {
assertEquals(bkpt1_svc.getNumber(), bkpt2_set.getNumber());
assertEquals(bkpt2_svc.getNumber(), bkpt1_set.getNumber());
}
@@ -745,8 +743,7 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
// breakpoints were initially set...
if (bkpt1_svc.getNumber().equals(bkpt1_set.getNumber())) {
assertEquals(bkpt2_svc.getNumber(), bkpt2_set.getNumber());
- }
- else {
+ } else {
assertEquals(bkpt1_svc.getNumber(), bkpt2_set.getNumber());
assertEquals(bkpt2_svc.getNumber(), bkpt1_set.getNumber());
}
@@ -763,9 +760,9 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
// target in a suspended state. Unfortunately, there is nothing
// practical CDT can do to address this issue except wait for the gdb
// folks to resolve it. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=304096#c27
- if (runningOnWindows()) {
- return;
- }
+ if (runningOnWindows()) {
+ return;
+ }
// Run the program. It will make a two second sleep() call, during which time...
SyncUtil.resume();
@@ -792,8 +789,8 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
assertEquals("Unexpected number of breakpoint-hit events", 1, getBreakpointEventCount(BP_HIT));
clearEventCounters();
- assertTrue("Did not stop because of catchpoint, but stopped because of: " +
- event.getClass().getCanonicalName(), event instanceof MIBreakpointHitEvent);
+ assertTrue("Did not stop because of catchpoint, but stopped because of: " + event.getClass().getCanonicalName(),
+ event instanceof MIBreakpointHitEvent);
}
/**
@@ -920,7 +917,8 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
// Ensure the breakpoint service sees what we expect
IBreakpointDMContext[] remaining_breakpoints = getBreakpoints(fBreakpointsDmc);
- assertEquals("Breakpoints service reports unexpected number of breakpoints", --breakpoints_left, remaining_breakpoints.length);
+ assertEquals("Breakpoints service reports unexpected number of breakpoints", --breakpoints_left,
+ remaining_breakpoints.length);
for (int j = 0; j < breakpoints_left; j++) {
assertTrue("BreakpointService problem: removed breakpoint still present (" + removeThisBreakpoint + ")",
!remaining_breakpoints[j].equals(removeThisBreakpoint));
@@ -960,9 +958,9 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
// target in a suspended state. Unfortunately, there is nothing
// practical CDT can do to address this issue except wait for the gdb
// folks to resolve it. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=304096#c27
- if (runningOnWindows()) {
- return;
- }
+ if (runningOnWindows()) {
+ return;
+ }
// Set a line breakpoint at the sleep() call. We need to get the program
// past the initial loop that throws and catches C++ exceptions.
@@ -989,10 +987,12 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
// events to have occurred
MIStoppedEvent event = SyncUtil.waitForStop(3000);
waitForBreakpointEvent(2);
- assertTrue("stopped event is of an unexpected type: " + event.getClass().getName(), event instanceof MIBreakpointHitEvent);
- MIBreakpointHitEvent bkptHitEvent = (MIBreakpointHitEvent)event;
+ assertTrue("stopped event is of an unexpected type: " + event.getClass().getName(),
+ event instanceof MIBreakpointHitEvent);
+ MIBreakpointHitEvent bkptHitEvent = (MIBreakpointHitEvent) event;
MIBreakpointDMData bkptNotRemoved = (MIBreakpointDMData) getBreakpoint(removeThrow ? refCatch : refThrow);
- assertEquals("Target stopped as expected, but the responsible breakpoint was not the expected one", bkptNotRemoved.getNumber(), bkptHitEvent.getNumber());
+ assertEquals("Target stopped as expected, but the responsible breakpoint was not the expected one",
+ bkptNotRemoved.getNumber(), bkptHitEvent.getNumber());
// If we removed the catch exception, we don't know at this point that
// it won't get hit; we're stopped at the throw catchpoint. So resume
@@ -1009,7 +1009,6 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
// Catchpoint Update tests
///////////////////////////////////////////////////////////////////////////
-
/**
* Add a catchpoint with no condition then modify the condition.
*/
@@ -1115,9 +1114,9 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
// target in a suspended state. Unfortunately, there is nothing
// practical CDT can do to address this issue except wait for the gdb
// folks to resolve it. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=304096#c27
- if (runningOnWindows()) {
- return;
- }
+ if (runningOnWindows()) {
+ return;
+ }
// Set a line breakpoint at the sleep() call.
IBreakpointDMContext refLineBkpt = setLineBreakpoint(LINE_NUMBER_SLEEP_CALL);
@@ -1134,7 +1133,8 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
assertEquals("Unexpected number of breakpoint events", 1, totalBreakpointEventsCount());
assertEquals("Unexpected number of breakpoint-added events", 1, getBreakpointEventCount(BP_HIT));
MIBreakpointDMData lineBkpt = (MIBreakpointDMData) getBreakpoint(refLineBkpt);
- assertEquals("Target stopped as expected, but the responsible breakpoint was not the expected one", lineBkpt.getNumber(), fBreakpointRef);
+ assertEquals("Target stopped as expected, but the responsible breakpoint was not the expected one",
+ lineBkpt.getNumber(), fBreakpointRef);
clearEventCounters();
// Resume the program. It will make a one second sleep() call, during which time...
@@ -1148,10 +1148,12 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
// Wait for breakpoint to hit and for the expected number of breakpoint events to have occurred
MIStoppedEvent event = SyncUtil.waitForStop(3000);
waitForBreakpointEvent(2);
- assertTrue("stopped event is of an unexpected type: " + event.getClass().getName(), event instanceof MIBreakpointHitEvent);
- MIBreakpointHitEvent bkptHitEvent = (MIBreakpointHitEvent)event;
+ assertTrue("stopped event is of an unexpected type: " + event.getClass().getName(),
+ event instanceof MIBreakpointHitEvent);
+ MIBreakpointHitEvent bkptHitEvent = (MIBreakpointHitEvent) event;
MIBreakpointDMData bkptUpdated = (MIBreakpointDMData) getBreakpoint(modifyThrow ? refThrow : refCatch);
- assertEquals("Target stopped as expected, but the responsible breakpoint was not the expected one", bkptUpdated.getNumber(), bkptHitEvent.getNumber());
+ assertEquals("Target stopped as expected, but the responsible breakpoint was not the expected one",
+ bkptUpdated.getNumber(), bkptHitEvent.getNumber());
}
@Test
@@ -1232,14 +1234,15 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
// Ensure the breakpoint service sees what we expect
IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc);
assertEquals("Breakpoints service reports unexpected number of breakpoints", 2, breakpoints.length);
- String throwCatchpointNumber = ((MIBreakpointDMData)getBreakpoint(refThrow)).getNumber();
+ String throwCatchpointNumber = ((MIBreakpointDMData) getBreakpoint(refThrow)).getNumber();
for (IBreakpointDMContext bkpt : breakpoints) {
MIBreakpointDMData bkpt_svc = (MIBreakpointDMData) getBreakpoint(bkpt);
- assertEquals("Incorrect breakpoint condition", !throwCatchpointNumber.equals(bkpt_svc.getNumber()), bkpt_svc.isEnabled());
+ assertEquals("Incorrect breakpoint condition", !throwCatchpointNumber.equals(bkpt_svc.getNumber()),
+ bkpt_svc.isEnabled());
}
// Resume the target. Should miss the throw catchpoint and stop at the catch one
- String catchCatchpointNumber = ((MIBreakpointDMData)getBreakpoint(refCatch)).getNumber();
+ String catchCatchpointNumber = ((MIBreakpointDMData) getBreakpoint(refCatch)).getNumber();
resumeAndExpectBkptHit(catchCatchpointNumber, null);
// Ee-enable the throw catchpoint
@@ -1264,9 +1267,11 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
@Test
public void catchpointConversions() throws Throwable {
assertEquals("catch", GdbCatchpoints.eventToGdbCatchpointKeyword(IEventBreakpointConstants.EVENT_TYPE_CATCH));
- assertEquals("syscall", GdbCatchpoints.eventToGdbCatchpointKeyword(IEventBreakpointConstants.EVENT_TYPE_SYSCALL));
+ assertEquals("syscall",
+ GdbCatchpoints.eventToGdbCatchpointKeyword(IEventBreakpointConstants.EVENT_TYPE_SYSCALL));
assertEquals(IEventBreakpointConstants.EVENT_TYPE_CATCH, GdbCatchpoints.gdbCatchpointKeywordToEvent("catch"));
- assertEquals(IEventBreakpointConstants.EVENT_TYPE_SYSCALL, GdbCatchpoints.gdbCatchpointKeywordToEvent("syscall"));
+ assertEquals(IEventBreakpointConstants.EVENT_TYPE_SYSCALL,
+ GdbCatchpoints.gdbCatchpointKeywordToEvent("syscall"));
assertNull(GdbCatchpoints.gdbCatchpointKeywordToEvent("signa"));
assertNull(GdbCatchpoints.gdbCatchpointKeywordToEvent("signals"));
}
@@ -1297,8 +1302,10 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
assertEquals("Unexpected number of breakpoint-added events", 1, getBreakpointEventCount(BP_ADDED));
// Ensure the breakpoint service sees what we expect
- List<IBreakpointDMContext> bkptsAfter = new LinkedList<IBreakpointDMContext>(Arrays.asList(getBreakpoints(fBreakpointsDmc)));
- assertEquals("Breakpoints service reports unexpected number of breakpoints", bkptsBefore.length + 1, bkptsAfter.size());
+ List<IBreakpointDMContext> bkptsAfter = new LinkedList<IBreakpointDMContext>(
+ Arrays.asList(getBreakpoints(fBreakpointsDmc)));
+ assertEquals("Breakpoints service reports unexpected number of breakpoints", bkptsBefore.length + 1,
+ bkptsAfter.size());
ListIterator<IBreakpointDMContext> iter = bkptsAfter.listIterator();
while (iter.hasNext()) {
@@ -1354,8 +1361,10 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
// Ensure the breakpoint service sees what we expect. Ask the breakpoint
// service for the list of breakpoint against and make sure it differs
// only by the newly added one
- List<IBreakpointDMContext> bkptsAfter = new LinkedList<IBreakpointDMContext>(Arrays.asList(getBreakpoints(fBreakpointsDmc)));
- assertEquals("Breakpoints service reports unexpected number of breakpoints", bkptsBefore.length + 1, bkptsAfter.size());
+ List<IBreakpointDMContext> bkptsAfter = new LinkedList<IBreakpointDMContext>(
+ Arrays.asList(getBreakpoints(fBreakpointsDmc)));
+ assertEquals("Breakpoints service reports unexpected number of breakpoints", bkptsBefore.length + 1,
+ bkptsAfter.size());
ListIterator<IBreakpointDMContext> iter = bkptsAfter.listIterator();
while (iter.hasNext()) {
IBreakpointDMContext bkptAfter = iter.next();
@@ -1374,8 +1383,10 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
MIBreakpointDMData bkpt_svc = (MIBreakpointDMData) getBreakpoint(bkptsAfter.get(0));
assertEquals(bkpt_set.getNumber(), bkpt_svc.getNumber());
- assertEquals("Incorrect breakpoint condition", condition != null ? condition : CONDITION_NONE, bkpt_svc.getCondition());
- assertEquals("Incorrect breakpoint ignore count", ignoreCount != null ? ignoreCount : 0, bkpt_svc.getIgnoreCount());
+ assertEquals("Incorrect breakpoint condition", condition != null ? condition : CONDITION_NONE,
+ bkpt_svc.getCondition());
+ assertEquals("Incorrect breakpoint ignore count", ignoreCount != null ? ignoreCount : 0,
+ bkpt_svc.getIgnoreCount());
return refCatchpoint;
}
@@ -1403,11 +1414,13 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
assertEquals("Unexpected type of breakpoint event", 1, getBreakpointEventCount(BP_HIT));
// Ensure the target stopped because of the throw catchpoint
- assertEquals("Target stopped as expected, but the responsible breakpoint was not the expected one", bkptNumber, fBreakpointRef);
+ assertEquals("Target stopped as expected, but the responsible breakpoint was not the expected one", bkptNumber,
+ fBreakpointRef);
if (expectedVarValue != null) {
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(event.getDMContext(), 0);
- assertEquals("program variable has unexpected value", expectedVarValue.intValue(), evaluateExpression(frameDmc, CONDITION_VAR).intValue());
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(event.getDMContext(), 0);
+ assertEquals("program variable has unexpected value", expectedVarValue.intValue(),
+ evaluateExpression(frameDmc, CONDITION_VAR).intValue());
}
return event;
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIDisassemblyTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIDisassemblyTest.java
index 27c4e043a24..4cbb4467fc2 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIDisassemblyTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIDisassemblyTest.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - Initial Implementation
*******************************************************************************/
@@ -50,135 +50,131 @@ import org.junit.runners.Parameterized;
/*
* This is the Disassembly Service test suite.
- *
+ *
* It is meant to be a regression suite to be executed automatically against
* the DSF nightly builds.
- *
+ *
* It is also meant to be augmented with a proper test case(s) every time a
* feature is added or in the event (unlikely :-) that a bug is found in the
* Disassembly Service.
- *
+ *
* Refer to the JUnit4 documentation for an explanation of the annotations.
*/
@RunWith(Parameterized.class)
public class MIDisassemblyTest extends BaseParametrizedTestCase {
- private static final String EXEC_NAME = "MemoryTestApp.exe";
- private static final String SOURCE_NAME = "MemoryTestApp.cc";
- private static final String INVALID_SOURCE_NAME = "invalid_filename";
+ private static final String EXEC_NAME = "MemoryTestApp.exe";
+ private static final String SOURCE_NAME = "MemoryTestApp.cc";
+ private static final String INVALID_SOURCE_NAME = "invalid_filename";
- protected static final String[] LINE_TAGS = {
- "LINE_NUMBER",
- };
+ protected static final String[] LINE_TAGS = { "LINE_NUMBER", };
protected int LINE_NUMBER;
- private DsfSession fSession;
- private DsfServicesTracker fServicesTracker;
- private IDisassemblyDMContext fDisassemblyDmc;
- private MIDisassembly fDisassembly;
- private IExpressions fExpressionService;
+ private DsfSession fSession;
+ private DsfServicesTracker fServicesTracker;
+ private IDisassemblyDMContext fDisassemblyDmc;
+ private MIDisassembly fDisassembly;
+ private IExpressions fExpressionService;
@Rule
final public ExpectedException expectedException = ExpectedException.none();
- // ========================================================================
- // Housekeeping stuff
- // ========================================================================
+ // ========================================================================
+ // Housekeeping stuff
+ // ========================================================================
- @Override
+ @Override
public void doBeforeTest() throws Exception {
super.doBeforeTest();
-
- fSession = getGDBLaunch().getSession();
- Runnable runnable = new Runnable() {
- @Override
+
+ fSession = getGDBLaunch().getSession();
+ Runnable runnable = new Runnable() {
+ @Override
public void run() {
- // Get a reference to the memory service
- fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
- assert(fServicesTracker != null);
-
- fDisassembly = fServicesTracker.getService(MIDisassembly.class);
- assert(fDisassembly != null);
-
- fExpressionService = fServicesTracker.getService(IExpressions.class);
- assert(fExpressionService != null);
- }
- };
- fSession.getExecutor().submit(runnable).get();
-
- IContainerDMContext containerDmc = SyncUtil.getContainerContext();
- fDisassemblyDmc = DMContexts.getAncestorOfType(containerDmc, IDisassemblyDMContext.class);
- assert(fDisassemblyDmc != null);
-
- resolveLineTagLocations(SOURCE_NAME, LINE_TAGS);
- LINE_NUMBER = getLineForTag("LINE_NUMBER");
- }
-
- @Override
- protected void setLaunchAttributes() {
- super.setLaunchAttributes();
-
- // Select the binary to run the tests against
- setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EXEC_PATH + EXEC_NAME);
- }
-
+ // Get a reference to the memory service
+ fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
+ assert (fServicesTracker != null);
+
+ fDisassembly = fServicesTracker.getService(MIDisassembly.class);
+ assert (fDisassembly != null);
+
+ fExpressionService = fServicesTracker.getService(IExpressions.class);
+ assert (fExpressionService != null);
+ }
+ };
+ fSession.getExecutor().submit(runnable).get();
+
+ IContainerDMContext containerDmc = SyncUtil.getContainerContext();
+ fDisassemblyDmc = DMContexts.getAncestorOfType(containerDmc, IDisassemblyDMContext.class);
+ assert (fDisassemblyDmc != null);
+
+ resolveLineTagLocations(SOURCE_NAME, LINE_TAGS);
+ LINE_NUMBER = getLineForTag("LINE_NUMBER");
+ }
+
+ @Override
+ protected void setLaunchAttributes() {
+ super.setLaunchAttributes();
+
+ // Select the binary to run the tests against
+ setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EXEC_PATH + EXEC_NAME);
+ }
+
@Override
public void doAfterTest() throws Exception {
super.doAfterTest();
-
- fExpressionService = null;
- fDisassembly = null;
- if (fServicesTracker != null) {
- fServicesTracker.dispose();
- fServicesTracker = null;
- }
- }
-
- // ========================================================================
- // Helper Functions
- // ========================================================================
-
- /* ------------------------------------------------------------------------
- * evaluateExpression
- * ------------------------------------------------------------------------
- * Invokes the ExpressionService to evaluate an expression. In theory, we
- * shouldn't rely on another service to test this one but we need a way to
- * access a variable from the test application in order verify that the
- * memory operations (read/write) are working properly.
- * ------------------------------------------------------------------------
- * @param expression Expression to resolve
- * @return Resolved expression
- * @throws InterruptedException
- * ------------------------------------------------------------------------
- */
- private IAddress evaluateExpression(String expression) throws Throwable
- {
- MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
- IFrameDMContext ctx = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
- IExpressionDMContext expressionDMC = SyncUtil.createExpression(ctx, expression);
+
+ fExpressionService = null;
+ fDisassembly = null;
+ if (fServicesTracker != null) {
+ fServicesTracker.dispose();
+ fServicesTracker = null;
+ }
+ }
+
+ // ========================================================================
+ // Helper Functions
+ // ========================================================================
+
+ /* ------------------------------------------------------------------------
+ * evaluateExpression
+ * ------------------------------------------------------------------------
+ * Invokes the ExpressionService to evaluate an expression. In theory, we
+ * shouldn't rely on another service to test this one but we need a way to
+ * access a variable from the test application in order verify that the
+ * memory operations (read/write) are working properly.
+ * ------------------------------------------------------------------------
+ * @param expression Expression to resolve
+ * @return Resolved expression
+ * @throws InterruptedException
+ * ------------------------------------------------------------------------
+ */
+ private IAddress evaluateExpression(String expression) throws Throwable {
+ MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
+ IFrameDMContext ctx = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ IExpressionDMContext expressionDMC = SyncUtil.createExpression(ctx, expression);
return new Addr64(SyncUtil.getExpressionValue(expressionDMC, IFormattedValues.HEX_FORMAT));
- }
-
- /* ------------------------------------------------------------------------
- * getInstruction
- * ------------------------------------------------------------------------
- * Issues a disassembly request. The result is stored in fWait.
- * ------------------------------------------------------------------------
- * Typical usage:
- * getInstruction(dmc, start, end);
- * fWait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- * assertTrue(fWait.getMessage(), fWait.isOK());
- * ------------------------------------------------------------------------
- * @param dmc the data model context
- * @param start the start address (null == $pc)
- * @param end the end address
- * @throws InterruptedException
- * ------------------------------------------------------------------------
- */
- private IInstruction[] getInstruction(final IDisassemblyDMContext dmc,
- final BigInteger startAddress, final BigInteger endAddress)
- throws InterruptedException, ExecutionException {
+ }
+
+ /* ------------------------------------------------------------------------
+ * getInstruction
+ * ------------------------------------------------------------------------
+ * Issues a disassembly request. The result is stored in fWait.
+ * ------------------------------------------------------------------------
+ * Typical usage:
+ * getInstruction(dmc, start, end);
+ * fWait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ * assertTrue(fWait.getMessage(), fWait.isOK());
+ * ------------------------------------------------------------------------
+ * @param dmc the data model context
+ * @param start the start address (null == $pc)
+ * @param end the end address
+ * @throws InterruptedException
+ * ------------------------------------------------------------------------
+ */
+ private IInstruction[] getInstruction(final IDisassemblyDMContext dmc, final BigInteger startAddress,
+ final BigInteger endAddress) throws InterruptedException, ExecutionException {
Query<IInstruction[]> query = new Query<IInstruction[]>() {
@Override
@@ -192,26 +188,25 @@ public class MIDisassemblyTest extends BaseParametrizedTestCase {
return query.get();
}
- /* ------------------------------------------------------------------------
- * getInstruction
- * ------------------------------------------------------------------------
- * Issues a disassembly request. The result is stored in fWait.
- * ------------------------------------------------------------------------
- * Typical usage:
- * getInstruction(dmc, start, end);
- * fWait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- * assertTrue(fWait.getMessage(), fWait.isOK());
- * ------------------------------------------------------------------------
- * @param dmc the data model context
- * @param fucntion the function
- * @param linenum the line
- * @param count the instruction count
- * @throws InterruptedException
- * ------------------------------------------------------------------------
- */
- private IInstruction[] getInstruction(final IDisassemblyDMContext dmc,
- final String function, final int linenum, final int count)
- throws InterruptedException, ExecutionException {
+ /* ------------------------------------------------------------------------
+ * getInstruction
+ * ------------------------------------------------------------------------
+ * Issues a disassembly request. The result is stored in fWait.
+ * ------------------------------------------------------------------------
+ * Typical usage:
+ * getInstruction(dmc, start, end);
+ * fWait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ * assertTrue(fWait.getMessage(), fWait.isOK());
+ * ------------------------------------------------------------------------
+ * @param dmc the data model context
+ * @param fucntion the function
+ * @param linenum the line
+ * @param count the instruction count
+ * @throws InterruptedException
+ * ------------------------------------------------------------------------
+ */
+ private IInstruction[] getInstruction(final IDisassemblyDMContext dmc, final String function, final int linenum,
+ final int count) throws InterruptedException, ExecutionException {
Query<IInstruction[]> query = new Query<IInstruction[]>() {
@Override
@@ -225,32 +220,29 @@ public class MIDisassemblyTest extends BaseParametrizedTestCase {
return query.get();
}
- /* ------------------------------------------------------------------------
- * getMixedInstruction
- * ------------------------------------------------------------------------
- * Issues a disassembly request. The result is stored in fWait.
- * ------------------------------------------------------------------------
- * Typical usage:
- * getInstruction(dmc, start, end);
- * fWait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- * assertTrue(fWait.getMessage(), fWait.isOK());
- * ------------------------------------------------------------------------
- * @param dmc the data model context
- * @param start the start address (null == $pc)
- * @param end the end address
- * @throws InterruptedException
- * ------------------------------------------------------------------------
- */
- private IMixedInstruction[] getMixedInstruction(
- final IDisassemblyDMContext dmc, final BigInteger startAddress,
- final BigInteger endAddress) throws InterruptedException,
- ExecutionException {
+ /* ------------------------------------------------------------------------
+ * getMixedInstruction
+ * ------------------------------------------------------------------------
+ * Issues a disassembly request. The result is stored in fWait.
+ * ------------------------------------------------------------------------
+ * Typical usage:
+ * getInstruction(dmc, start, end);
+ * fWait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ * assertTrue(fWait.getMessage(), fWait.isOK());
+ * ------------------------------------------------------------------------
+ * @param dmc the data model context
+ * @param start the start address (null == $pc)
+ * @param end the end address
+ * @throws InterruptedException
+ * ------------------------------------------------------------------------
+ */
+ private IMixedInstruction[] getMixedInstruction(final IDisassemblyDMContext dmc, final BigInteger startAddress,
+ final BigInteger endAddress) throws InterruptedException, ExecutionException {
Query<IMixedInstruction[]> query = new Query<IMixedInstruction[]>() {
@Override
protected void execute(DataRequestMonitor<IMixedInstruction[]> rm) {
- fDisassembly.getMixedInstructions(dmc, startAddress,
- endAddress, rm);
+ fDisassembly.getMixedInstructions(dmc, startAddress, endAddress, rm);
}
};
@@ -259,33 +251,29 @@ public class MIDisassemblyTest extends BaseParametrizedTestCase {
return query.get();
}
-
- /* ------------------------------------------------------------------------
- * getMixedInstruction
- * ------------------------------------------------------------------------
- * Issues a disassembly request. The result is stored in fWait.
- * ------------------------------------------------------------------------
- * Typical usage:
- * getInstruction(dmc, start, end);
- * fWait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- * assertTrue(fWait.getMessage(), fWait.isOK());
- * ------------------------------------------------------------------------
- * @param dmc the data model context
- * @param start the start address (null == $pc)
- * @param end the end address
- * @throws InterruptedException
- * ------------------------------------------------------------------------
- */
- private IMixedInstruction[] getMixedInstruction(
- final IDisassemblyDMContext dmc, final String function,
- final int linenum, final int count) throws InterruptedException,
- ExecutionException {
+ /* ------------------------------------------------------------------------
+ * getMixedInstruction
+ * ------------------------------------------------------------------------
+ * Issues a disassembly request. The result is stored in fWait.
+ * ------------------------------------------------------------------------
+ * Typical usage:
+ * getInstruction(dmc, start, end);
+ * fWait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ * assertTrue(fWait.getMessage(), fWait.isOK());
+ * ------------------------------------------------------------------------
+ * @param dmc the data model context
+ * @param start the start address (null == $pc)
+ * @param end the end address
+ * @throws InterruptedException
+ * ------------------------------------------------------------------------
+ */
+ private IMixedInstruction[] getMixedInstruction(final IDisassemblyDMContext dmc, final String function,
+ final int linenum, final int count) throws InterruptedException, ExecutionException {
Query<IMixedInstruction[]> query = new Query<IMixedInstruction[]>() {
@Override
protected void execute(DataRequestMonitor<IMixedInstruction[]> rm) {
- fDisassembly.getMixedInstructions(dmc, function, linenum,
- count, rm);
+ fDisassembly.getMixedInstructions(dmc, function, linenum, count, rm);
}
};
@@ -294,213 +282,213 @@ public class MIDisassemblyTest extends BaseParametrizedTestCase {
return query.get();
}
- // ========================================================================
- // Test Cases
- // ------------------------------------------------------------------------
- // Templates:
- // ------------------------------------------------------------------------
- // @ Test
- // public void basicTest() {
- // // First test to run
- // assertTrue("", true);
- // }
- // ------------------------------------------------------------------------
- // @ Test(timeout=5000)
- // public void timeoutTest() {
- // // Second test to run, which will timeout if not finished on time
- // assertTrue("", true);
- // }
- // ------------------------------------------------------------------------
- // @ Test(expected=FileNotFoundException.class)
- // public void exceptionTest() throws FileNotFoundException {
- // // Third test to run which expects an exception
- // throw new FileNotFoundException("Just testing");
- // }
- // ========================================================================
-
- ///////////////////////////////////////////////////////////////////////////
- // getMemory tests
- ///////////////////////////////////////////////////////////////////////////
-
- // ------------------------------------------------------------------------
- // readWithNullContext
- // ------------------------------------------------------------------------
- @Test(timeout=20000)
- public void readWithNullContext() throws Throwable {
-
- // Setup call parameters
- BigInteger startAddress = null;
- BigInteger endAddress = null;
-
- expectedException.expect(ExecutionException.class);
- expectedException.expectMessage("Unknown context type");
-
- // Perform the test
- getInstruction(null, startAddress, endAddress);
- }
-
- // ------------------------------------------------------------------------
- // readWithInvalidAddress
- // ------------------------------------------------------------------------
- @Test(timeout=20000)
- public void readWithInvalidAddress() throws Throwable {
-
- // Setup call parameters
- BigInteger startAddress = BigInteger.ZERO;
- BigInteger endAddress = null;
-
- expectedException.expect(ExecutionException.class);
- expectedException.expectMessage("Cannot access memory at address");
-
- // Perform the test
- getInstruction(fDisassemblyDmc, startAddress, endAddress);
- }
-
- // ------------------------------------------------------------------------
- // readWithNullAddress
- // ------------------------------------------------------------------------
- @Test(timeout=20000)
- public void readWithNullAddress() throws Throwable {
-
- // Setup call parameters
- BigInteger startAddress = null;
- BigInteger endAddress = null;
-
- // Perform the test
- IInstruction[] result = getInstruction(fDisassemblyDmc, startAddress, endAddress);
-
- // Verify the result
- assertThat(result.length, is(not(0)));
- }
-
- // ------------------------------------------------------------------------
- // readWithValidAddress
- // ------------------------------------------------------------------------
- @Test(timeout=20000)
- public void readWithValidAddress() throws Throwable {
-
- // Setup call parameters
- Addr64 main = (Addr64) evaluateExpression("&main");
- BigInteger startAddress = main.getValue();
- BigInteger endAddress = null;
-
- // Perform the test
- IInstruction[] result = getInstruction(fDisassemblyDmc, startAddress, endAddress);
-
- // Verify the result
- assertThat(result.length, is(not(0)));
- }
-
- // ------------------------------------------------------------------------
- // readWithInvalidFilename
- // ------------------------------------------------------------------------
- @Test(timeout=20000)
- public void readWithInvalidFilename() throws Throwable {
-
- // Setup call parameters
- String filename = INVALID_SOURCE_NAME;
- int linenum = 1;
- int count = -1;
-
- expectedException.expect(ExecutionException.class);
- expectedException.expectMessage("Invalid filename");
-
- // Perform the test
- getInstruction(fDisassemblyDmc, filename, linenum, count);
- }
-
- // ------------------------------------------------------------------------
- // readWithInvalidLineNumber
- // ------------------------------------------------------------------------
- @Test(timeout=20000)
- public void readWithInvalidLineNumber() throws Throwable {
-
- // Setup call parameters
- String filename = SOURCE_NAME;
- int linenum = -1;
- int count = -1;
-
- expectedException.expect(ExecutionException.class);
- expectedException.expectMessage("Invalid line number");
-
- // Perform the test
- getInstruction(fDisassemblyDmc, filename, linenum, count);
- }
-
- // ------------------------------------------------------------------------
- // readWithValidFilename
- // ------------------------------------------------------------------------
- @Test(timeout=20000)
- public void readWithValidFilename() throws Throwable {
-
- // Setup call parameters
- String filename = SOURCE_NAME;
- int linenum = LINE_NUMBER;
- int count = -1;
-
- // Perform the test
- IInstruction[] result = getInstruction(fDisassemblyDmc, filename, linenum, count);
-
- // Verify the result
- assertThat(result.length, is(not(0)));
- }
-
- // ------------------------------------------------------------------------
- // readWithLineCount
- // ------------------------------------------------------------------------
- @Test(timeout=20000)
- public void readWithLineCount() throws Throwable {
-
- // Setup call parameters
- String filename = SOURCE_NAME;
- int linenum = LINE_NUMBER;
- int count = 5;
-
- // Perform the test
- IInstruction[] result = getInstruction(fDisassemblyDmc, filename, linenum, count);
-
- // Verify the result
- assertThat(result.length, is(count));
- }
-
- // ------------------------------------------------------------------------
- // readMixedWithValidAddress
- // ------------------------------------------------------------------------
- @Test(timeout=20000)
- public void readMixedWithValidAddress() throws Throwable {
-
- // Setup call parameters
- Addr64 main = (Addr64) evaluateExpression("&main");
- BigInteger startAddress = main.getValue();
- BigInteger endAddress = null;
-
- // Perform the test
- IMixedInstruction[] result = getMixedInstruction(fDisassemblyDmc, startAddress, endAddress);
-
- // Verify the result
- assertThat(result.length, is(not(0)));
- }
-
- // ------------------------------------------------------------------------
- // readMixedWithLineCount
- // ------------------------------------------------------------------------
- @Test(timeout=20000)
- public void readMixedWithLineCount() throws Throwable {
-
- // Setup call parameters
- String filename = SOURCE_NAME;
- int linenum = LINE_NUMBER;
- int count = 5;
-
- // Perform the test
- IMixedInstruction[] result = getMixedInstruction(fDisassemblyDmc, filename, linenum, count);
-
- // Verify the result
- int total = 0;
- for (IMixedInstruction mixed : result) {
- IInstruction[] inst = mixed.getInstructions();
- total += inst.length;
- }
- assertThat(total, is(count));
- }
+ // ========================================================================
+ // Test Cases
+ // ------------------------------------------------------------------------
+ // Templates:
+ // ------------------------------------------------------------------------
+ // @ Test
+ // public void basicTest() {
+ // // First test to run
+ // assertTrue("", true);
+ // }
+ // ------------------------------------------------------------------------
+ // @ Test(timeout=5000)
+ // public void timeoutTest() {
+ // // Second test to run, which will timeout if not finished on time
+ // assertTrue("", true);
+ // }
+ // ------------------------------------------------------------------------
+ // @ Test(expected=FileNotFoundException.class)
+ // public void exceptionTest() throws FileNotFoundException {
+ // // Third test to run which expects an exception
+ // throw new FileNotFoundException("Just testing");
+ // }
+ // ========================================================================
+
+ ///////////////////////////////////////////////////////////////////////////
+ // getMemory tests
+ ///////////////////////////////////////////////////////////////////////////
+
+ // ------------------------------------------------------------------------
+ // readWithNullContext
+ // ------------------------------------------------------------------------
+ @Test(timeout = 20000)
+ public void readWithNullContext() throws Throwable {
+
+ // Setup call parameters
+ BigInteger startAddress = null;
+ BigInteger endAddress = null;
+
+ expectedException.expect(ExecutionException.class);
+ expectedException.expectMessage("Unknown context type");
+
+ // Perform the test
+ getInstruction(null, startAddress, endAddress);
+ }
+
+ // ------------------------------------------------------------------------
+ // readWithInvalidAddress
+ // ------------------------------------------------------------------------
+ @Test(timeout = 20000)
+ public void readWithInvalidAddress() throws Throwable {
+
+ // Setup call parameters
+ BigInteger startAddress = BigInteger.ZERO;
+ BigInteger endAddress = null;
+
+ expectedException.expect(ExecutionException.class);
+ expectedException.expectMessage("Cannot access memory at address");
+
+ // Perform the test
+ getInstruction(fDisassemblyDmc, startAddress, endAddress);
+ }
+
+ // ------------------------------------------------------------------------
+ // readWithNullAddress
+ // ------------------------------------------------------------------------
+ @Test(timeout = 20000)
+ public void readWithNullAddress() throws Throwable {
+
+ // Setup call parameters
+ BigInteger startAddress = null;
+ BigInteger endAddress = null;
+
+ // Perform the test
+ IInstruction[] result = getInstruction(fDisassemblyDmc, startAddress, endAddress);
+
+ // Verify the result
+ assertThat(result.length, is(not(0)));
+ }
+
+ // ------------------------------------------------------------------------
+ // readWithValidAddress
+ // ------------------------------------------------------------------------
+ @Test(timeout = 20000)
+ public void readWithValidAddress() throws Throwable {
+
+ // Setup call parameters
+ Addr64 main = (Addr64) evaluateExpression("&main");
+ BigInteger startAddress = main.getValue();
+ BigInteger endAddress = null;
+
+ // Perform the test
+ IInstruction[] result = getInstruction(fDisassemblyDmc, startAddress, endAddress);
+
+ // Verify the result
+ assertThat(result.length, is(not(0)));
+ }
+
+ // ------------------------------------------------------------------------
+ // readWithInvalidFilename
+ // ------------------------------------------------------------------------
+ @Test(timeout = 20000)
+ public void readWithInvalidFilename() throws Throwable {
+
+ // Setup call parameters
+ String filename = INVALID_SOURCE_NAME;
+ int linenum = 1;
+ int count = -1;
+
+ expectedException.expect(ExecutionException.class);
+ expectedException.expectMessage("Invalid filename");
+
+ // Perform the test
+ getInstruction(fDisassemblyDmc, filename, linenum, count);
+ }
+
+ // ------------------------------------------------------------------------
+ // readWithInvalidLineNumber
+ // ------------------------------------------------------------------------
+ @Test(timeout = 20000)
+ public void readWithInvalidLineNumber() throws Throwable {
+
+ // Setup call parameters
+ String filename = SOURCE_NAME;
+ int linenum = -1;
+ int count = -1;
+
+ expectedException.expect(ExecutionException.class);
+ expectedException.expectMessage("Invalid line number");
+
+ // Perform the test
+ getInstruction(fDisassemblyDmc, filename, linenum, count);
+ }
+
+ // ------------------------------------------------------------------------
+ // readWithValidFilename
+ // ------------------------------------------------------------------------
+ @Test(timeout = 20000)
+ public void readWithValidFilename() throws Throwable {
+
+ // Setup call parameters
+ String filename = SOURCE_NAME;
+ int linenum = LINE_NUMBER;
+ int count = -1;
+
+ // Perform the test
+ IInstruction[] result = getInstruction(fDisassemblyDmc, filename, linenum, count);
+
+ // Verify the result
+ assertThat(result.length, is(not(0)));
+ }
+
+ // ------------------------------------------------------------------------
+ // readWithLineCount
+ // ------------------------------------------------------------------------
+ @Test(timeout = 20000)
+ public void readWithLineCount() throws Throwable {
+
+ // Setup call parameters
+ String filename = SOURCE_NAME;
+ int linenum = LINE_NUMBER;
+ int count = 5;
+
+ // Perform the test
+ IInstruction[] result = getInstruction(fDisassemblyDmc, filename, linenum, count);
+
+ // Verify the result
+ assertThat(result.length, is(count));
+ }
+
+ // ------------------------------------------------------------------------
+ // readMixedWithValidAddress
+ // ------------------------------------------------------------------------
+ @Test(timeout = 20000)
+ public void readMixedWithValidAddress() throws Throwable {
+
+ // Setup call parameters
+ Addr64 main = (Addr64) evaluateExpression("&main");
+ BigInteger startAddress = main.getValue();
+ BigInteger endAddress = null;
+
+ // Perform the test
+ IMixedInstruction[] result = getMixedInstruction(fDisassemblyDmc, startAddress, endAddress);
+
+ // Verify the result
+ assertThat(result.length, is(not(0)));
+ }
+
+ // ------------------------------------------------------------------------
+ // readMixedWithLineCount
+ // ------------------------------------------------------------------------
+ @Test(timeout = 20000)
+ public void readMixedWithLineCount() throws Throwable {
+
+ // Setup call parameters
+ String filename = SOURCE_NAME;
+ int linenum = LINE_NUMBER;
+ int count = 5;
+
+ // Perform the test
+ IMixedInstruction[] result = getMixedInstruction(fDisassemblyDmc, filename, linenum, count);
+
+ // Verify the result
+ int total = 0;
+ for (IMixedInstruction mixed : result) {
+ IInstruction[] inst = mixed.getInstructions();
+ total += inst.length;
+ }
+ assertThat(total, is(count));
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIExpressionsTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIExpressionsTest.java
index 441d71c8320..c9151a40fdd 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIExpressionsTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIExpressionsTest.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - Initial Implementation
* Simon Marchi (Ericsson) - Move some tests from AsyncCompletionWaitor to Query
@@ -75,290 +75,290 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
private static final String EXEC_NAME = "ExpressionTestApp.exe";
private static final String SOURCE_NAME = "ExpressionTestApp.cc";
- private DsfSession fSession;
+ private DsfSession fSession;
+
+ private DsfServicesTracker fServicesTracker;
- private DsfServicesTracker fServicesTracker;
+ protected IExpressions fExpService;
- protected IExpressions fExpService;
+ private int fExprChangedEventCount = 0;
- private int fExprChangedEventCount = 0;
+ private IExpressionDMContext fExprChangedCtx = null;
- private IExpressionDMContext fExprChangedCtx = null;
-
- private IExpressionDMContext globalExpressionCtx1 = null;
- private IExpressionDMContext globalExpressionCtx2 = null;
+ private IExpressionDMContext globalExpressionCtx1 = null;
+ private IExpressionDMContext globalExpressionCtx2 = null;
- @Override
- protected void setLaunchAttributes() {
- super.setLaunchAttributes();
-
- setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EXEC_PATH + EXEC_NAME);
- }
+ @Override
+ protected void setLaunchAttributes() {
+ super.setLaunchAttributes();
+
+ setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EXEC_PATH + EXEC_NAME);
+ }
/* Line tags in the source file. */
- private static final String[] LINE_TAGS = new String[] {
- "testUpdateOfPointer_1",
- "testUpdateOfPointer_2",
- "testUpdateOfPointerTypedef_1",
- "testUpdateOfPointerTypedef_2",
- };
+ private static final String[] LINE_TAGS = new String[] { "testUpdateOfPointer_1", "testUpdateOfPointer_2",
+ "testUpdateOfPointerTypedef_1", "testUpdateOfPointerTypedef_2", };
- @Override
- public void doBeforeTest() throws Exception {
- super.doBeforeTest();
+ @Override
+ public void doBeforeTest() throws Exception {
+ super.doBeforeTest();
/* Resolve line tags in source file. */
resolveLineTagLocations(SOURCE_NAME, LINE_TAGS);
- fSession = getGDBLaunch().getSession();
- Runnable runnable = new Runnable() {
- @Override
+ fSession = getGDBLaunch().getSession();
+ Runnable runnable = new Runnable() {
+ @Override
public void run() {
- fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
-
- fExpService = fServicesTracker.getService(IExpressions.class);
- fSession.addServiceEventListener(MIExpressionsTest.this, null);
- clearExprChangedData();
- }
- };
- fSession.getExecutor().submit(runnable).get();
- }
-
- @Override
- public void doAfterTest() throws Exception {
- super.doAfterTest();
+ fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
+
+ fExpService = fServicesTracker.getService(IExpressions.class);
+ fSession.addServiceEventListener(MIExpressionsTest.this, null);
+ clearExprChangedData();
+ }
+ };
+ fSession.getExecutor().submit(runnable).get();
+ }
+
+ @Override
+ public void doAfterTest() throws Exception {
+ super.doAfterTest();
if (fSession != null) {
- fSession.getExecutor().submit(()->fSession.removeServiceEventListener(MIExpressionsTest.this)).get();
+ fSession.getExecutor().submit(() -> fSession.removeServiceEventListener(MIExpressionsTest.this)).get();
}
fExpService = null;
- if (fServicesTracker != null) {
+ if (fServicesTracker != null) {
fServicesTracker.dispose();
}
- }
-
- // Handles ExpressionChangedEvent
- @DsfServiceEventHandler
- public void eventDispatched(IExpressionChangedDMEvent e) {
- fExprChangedEventCount++;
- fExprChangedCtx = e.getDMContext();
- }
-
- // Clears the counters
- private void clearExprChangedData() {
- fExprChangedEventCount = 0;
- fExprChangedCtx = null;
- }
-
- // Returns the total number of events received
- private int getExprChangedCount() {
- return fExprChangedEventCount;
- }
-
- private IExpressionDMContext getExprChangedContext() {
- return fExprChangedCtx;
- }
-
- // *********************************************************************
- // Below are the tests for the expression service.
- // *********************************************************************
-
- /**
- * Test that we can correctly evaluate integer expressions.
- */
- @Test
- public void testLiteralIntegerExpressions() throws Throwable {
- MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("testLocals");
-
- // Create a map of expressions and their expected values.
- Map<String, String[]> tests = new HashMap<String, String[]>();
-
- tests.put("0 + 0 - 0", new String[] { "0x0", "0", "0", "0", "0", "0" });
- tests.put("3 + 4", new String[] { "0x7", "07", "111", "7", "7", "7" });
- tests.put("3 + 4 * 5", new String[] { "0x17", "027", "10111", "23", "23", "23" });
- tests.put("5 * 3 + 4", new String[] { "0x13", "023", "10011", "19", "19", "19" });
- tests.put("5 * (3 + 4)", new String[] { "0x23", "043", "100011", "35", "35", "35" });
- tests.put("10 - 15", new String[] { "0xFFFFFFFB", "037777777773", "11111111111111111111111111111011", "-5",
- "-5", "-5" });
- tests.put("10 + -15", new String[] { "0xFFFFFFFB", "037777777773", "11111111111111111111111111111011", "-5",
- "-5", "-5" });
-
- executeExpressionSubTests(tests, SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0));
- }
-
- /**
- * Test that we can correctly evaluate floating-point expressions.
- */
- @Test
- public void testLiteralFloatingPointExpressions() throws Throwable {
- MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("testLocals");
-
- // Create a map of expressions and their expected values.
- Map<String, String[]> tests = new HashMap<String, String[]>();
-
- tests.put("3.14159 + 1.1111", new String[] { "0x4", "04", "100", "4", "4.2526", "4.2526" });
- tests.put("100.0 / 3.0", new String[] { "0x21", "041", "100001", "33", "33.3333", "33.3333" });
- tests.put("-100.0 / 3.0", new String[] { "0xffffffffffffffdf", "01777777777777777777737",
- "1111111111111111111111111111111111111111111111111111111111011111", "-33", "-33.3333", "-33.3333" });
- tests.put("-100.0 / -3.0", new String[] { "0x21", "041", "100001", "33", "33.3333", "33.3333" });
- executeExpressionSubTests(tests, false, SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0));
-
- tests.clear();
- tests.put("100.0 / 0.5", new String[] { "0xc8", "0310", "11001000", "200", "200", "200" });
- executeExpressionSubTests(tests, true, SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0));
-
- }
-
- /**
- * Test that we can correctly evaluate C expressions involving local
- * variables.
- */
- @Test
- public void testLocalVariables() throws Throwable {
- // Run to the point where all local variables are initialized
- SyncUtil.runToLocation("testLocals");
- MIStoppedEvent stoppedEvent = SyncUtil.step(16, StepType.STEP_OVER);
-
- // Create a map of expressions to expected values.
- Map<String, String[]> tests1 = new HashMap<String, String[]>();
-
- tests1.put("lIntVar", new String[] { "0x3039", "030071", "11000000111001", "12345", "12345", "12345" });
- tests1.put("lDoubleVar", new String[] { "0x3039", "030071", "11000000111001", "12345", "12345.123449999999", "12345.123449999999" });
- tests1.put("lCharVar", new String[] { "0x6d", "0155", "1101101", "109", "109 'm'", "109 'm'" });
- tests1.put("lBoolVar", new String[] { "0x0", "0", "0", "0", "false", "false" });
-
- tests1.put("lIntArray[1]", new String[] { "0x3039", "030071", "11000000111001", "12345", "12345", "12345" });
- tests1.put("lDoubleArray[1]", new String[] { "0x3039", "030071", "11000000111001", "12345", "12345.123449999999", "12345.123449999999" });
- tests1.put("lCharArray[1]", new String[] { "0x6d", "0155", "1101101", "109", "109 'm'", "109 'm'" });
- tests1.put("lBoolArray[1]", new String[] { "0x0", "0", "0", "0", "false", "false" });
-
- tests1.put("*lIntPtr", new String[] { "0x3039", "030071", "11000000111001", "12345", "12345", "12345" });
- tests1.put("*lDoublePtr", new String[] { "0x3039", "030071", "11000000111001", "12345", "12345.123449999999", "12345.123449999999" });
- tests1.put("*lCharPtr", new String[] { "0x6d", "0155", "1101101", "109", "109 'm'", "109 'm'" });
- tests1.put("*lBoolPtr", new String[] { "0x0", "0", "0", "0", "false", "false" });
-
- tests1.put("lIntPtr2", new String[] { "0x1", "01", "1", "1", "0x1", "0x1" });
- tests1.put("lDoublePtr2", new String[] { "0x2345", "021505", "10001101000101", "9029", "0x2345", "0x2345" });
- // GDB says a char* is out of bounds, but not the other pointers???
- // tests1.put("CharPtr2", new String[] { "0x1234", "011064",
- // "1001000110100", "4660", "0x1234" });
- tests1.put("lBoolPtr2", new String[] { "0x123ABCDE", "02216536336", "10010001110101011110011011110", "305839326", "0x123ABCDE", "0x123ABCDE" });
-
- executeExpressionSubTests(tests1, SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0));
-
- // Step into the method and stop until all new local variables are
- // initialized
- SyncUtil.step(StepType.STEP_INTO);
- stoppedEvent = SyncUtil.step(5, StepType.STEP_OVER);
-
- // Create a map of expressions to expected values.
- Map<String, String[]> tests2 = new HashMap<String, String[]>();
-
- tests2.put("lIntVar", new String[] { "0x1a85", "015205", "1101010000101", "6789", "6789", "6789" });
- tests2.put("lDoubleArray[1]",
- new String[] { "0x1a85", "015205", "1101010000101", "6789", "6789.6788999999999", "6789.6788999999999" });
- tests2.put("lCharVar", new String[] { "0x69", "0151", "1101001", "105", "105 'i'", "105 'i'" });
- tests2.put("*lCharPtr", new String[] { "0x69", "0151", "1101001", "105", "105 'i'", "105 'i'" });
- tests2.put("lBoolPtr2", new String[] { "0xABCDE123", "025363360443", "10101011110011011110000100100011",
- "2882396451", "0xABCDE123","0xABCDE123" });
-
- // check variables at current stack frame
- executeExpressionSubTests(tests2, SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0));
- // check previous stack frame
- executeExpressionSubTests(tests1, SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 1));
-
- // Now return from the method and check that we see the
- // original variables. We must use the right context to restore the right stack frame
- stoppedEvent = SyncUtil.step(stoppedEvent.getDMContext(), StepType.STEP_RETURN);
-
- executeExpressionSubTests(tests1, SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0));
- }
-
- /**
- * This tests verifies that we can deal with variables in a subblock hiding
- * variables with the same name in the outer block.
- */
- @Ignore("Sublocks do not work with GDB")
- @Test
- public void testSubBlock() throws Throwable {
- SyncUtil.runToLocation("testSubblock");
- MIStoppedEvent stoppedEvent = SyncUtil.step(2, StepType.STEP_OVER);
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
-
- Map<String, String[]> tests = new HashMap<String, String[]>();
-
- tests.put("a", new String[] { "0x8", "010", "1000", "8", "8", "8" });
- tests.put("b", new String[] { "0x1", "01", "1", "1", "1", "1" });
-
- executeExpressionSubTests(tests, frameDmc);
-
- // Now enter a subblock with the same variable names
- SyncUtil.step(2, StepType.STEP_OVER);
-
- tests = new HashMap<String, String[]>();
-
- tests.put("a", new String[] { "0xc", "014", "1100", "12", "12", "12" });
- tests.put("b", new String[] { "0x1", "01", "1", "1", "1", "1" });
-
- executeExpressionSubTests(tests, frameDmc);
-
- // Now step to change the b variable
- SyncUtil.step(1, StepType.STEP_OVER);
-
- tests = new HashMap<String, String[]>();
-
- tests.put("a", new String[] { "0xc", "014", "1100", "12", "12", "12" });
- tests.put("b", new String[] { "0xc", "014", "1100", "12", "12", "12" });
-
- executeExpressionSubTests(tests, frameDmc);
-
- // Now exit the sub-block and check that we see the original a but the
- // same b
- SyncUtil.step(1, StepType.STEP_OVER);
-
- tests = new HashMap<String, String[]>();
-
- tests.put("a", new String[] { "0x8", "010", "1000", "8", "8", "8" });
- tests.put("b", new String[] { "0xc", "014", "1100", "12", "12", "12" });
-
- executeExpressionSubTests(tests, frameDmc);
- }
-
- /**
- * This tests verifies that we can obtain children properly.
- */
- @Test
- public void testChildren() throws Throwable {
- assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_6_7);
+ }
+
+ // Handles ExpressionChangedEvent
+ @DsfServiceEventHandler
+ public void eventDispatched(IExpressionChangedDMEvent e) {
+ fExprChangedEventCount++;
+ fExprChangedCtx = e.getDMContext();
+ }
+
+ // Clears the counters
+ private void clearExprChangedData() {
+ fExprChangedEventCount = 0;
+ fExprChangedCtx = null;
+ }
+
+ // Returns the total number of events received
+ private int getExprChangedCount() {
+ return fExprChangedEventCount;
+ }
+
+ private IExpressionDMContext getExprChangedContext() {
+ return fExprChangedCtx;
+ }
+
+ // *********************************************************************
+ // Below are the tests for the expression service.
+ // *********************************************************************
+
+ /**
+ * Test that we can correctly evaluate integer expressions.
+ */
+ @Test
+ public void testLiteralIntegerExpressions() throws Throwable {
+ MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("testLocals");
+
+ // Create a map of expressions and their expected values.
+ Map<String, String[]> tests = new HashMap<String, String[]>();
+
+ tests.put("0 + 0 - 0", new String[] { "0x0", "0", "0", "0", "0", "0" });
+ tests.put("3 + 4", new String[] { "0x7", "07", "111", "7", "7", "7" });
+ tests.put("3 + 4 * 5", new String[] { "0x17", "027", "10111", "23", "23", "23" });
+ tests.put("5 * 3 + 4", new String[] { "0x13", "023", "10011", "19", "19", "19" });
+ tests.put("5 * (3 + 4)", new String[] { "0x23", "043", "100011", "35", "35", "35" });
+ tests.put("10 - 15",
+ new String[] { "0xFFFFFFFB", "037777777773", "11111111111111111111111111111011", "-5", "-5", "-5" });
+ tests.put("10 + -15",
+ new String[] { "0xFFFFFFFB", "037777777773", "11111111111111111111111111111011", "-5", "-5", "-5" });
+
+ executeExpressionSubTests(tests, SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0));
+ }
+
+ /**
+ * Test that we can correctly evaluate floating-point expressions.
+ */
+ @Test
+ public void testLiteralFloatingPointExpressions() throws Throwable {
+ MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("testLocals");
+
+ // Create a map of expressions and their expected values.
+ Map<String, String[]> tests = new HashMap<String, String[]>();
+
+ tests.put("3.14159 + 1.1111", new String[] { "0x4", "04", "100", "4", "4.2526", "4.2526" });
+ tests.put("100.0 / 3.0", new String[] { "0x21", "041", "100001", "33", "33.3333", "33.3333" });
+ tests.put("-100.0 / 3.0", new String[] { "0xffffffffffffffdf", "01777777777777777777737",
+ "1111111111111111111111111111111111111111111111111111111111011111", "-33", "-33.3333", "-33.3333" });
+ tests.put("-100.0 / -3.0", new String[] { "0x21", "041", "100001", "33", "33.3333", "33.3333" });
+ executeExpressionSubTests(tests, false, SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0));
+
+ tests.clear();
+ tests.put("100.0 / 0.5", new String[] { "0xc8", "0310", "11001000", "200", "200", "200" });
+ executeExpressionSubTests(tests, true, SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0));
+
+ }
+
+ /**
+ * Test that we can correctly evaluate C expressions involving local
+ * variables.
+ */
+ @Test
+ public void testLocalVariables() throws Throwable {
+ // Run to the point where all local variables are initialized
+ SyncUtil.runToLocation("testLocals");
+ MIStoppedEvent stoppedEvent = SyncUtil.step(16, StepType.STEP_OVER);
+
+ // Create a map of expressions to expected values.
+ Map<String, String[]> tests1 = new HashMap<String, String[]>();
+
+ tests1.put("lIntVar", new String[] { "0x3039", "030071", "11000000111001", "12345", "12345", "12345" });
+ tests1.put("lDoubleVar", new String[] { "0x3039", "030071", "11000000111001", "12345", "12345.123449999999",
+ "12345.123449999999" });
+ tests1.put("lCharVar", new String[] { "0x6d", "0155", "1101101", "109", "109 'm'", "109 'm'" });
+ tests1.put("lBoolVar", new String[] { "0x0", "0", "0", "0", "false", "false" });
+
+ tests1.put("lIntArray[1]", new String[] { "0x3039", "030071", "11000000111001", "12345", "12345", "12345" });
+ tests1.put("lDoubleArray[1]", new String[] { "0x3039", "030071", "11000000111001", "12345",
+ "12345.123449999999", "12345.123449999999" });
+ tests1.put("lCharArray[1]", new String[] { "0x6d", "0155", "1101101", "109", "109 'm'", "109 'm'" });
+ tests1.put("lBoolArray[1]", new String[] { "0x0", "0", "0", "0", "false", "false" });
+
+ tests1.put("*lIntPtr", new String[] { "0x3039", "030071", "11000000111001", "12345", "12345", "12345" });
+ tests1.put("*lDoublePtr", new String[] { "0x3039", "030071", "11000000111001", "12345", "12345.123449999999",
+ "12345.123449999999" });
+ tests1.put("*lCharPtr", new String[] { "0x6d", "0155", "1101101", "109", "109 'm'", "109 'm'" });
+ tests1.put("*lBoolPtr", new String[] { "0x0", "0", "0", "0", "false", "false" });
+
+ tests1.put("lIntPtr2", new String[] { "0x1", "01", "1", "1", "0x1", "0x1" });
+ tests1.put("lDoublePtr2", new String[] { "0x2345", "021505", "10001101000101", "9029", "0x2345", "0x2345" });
+ // GDB says a char* is out of bounds, but not the other pointers???
+ // tests1.put("CharPtr2", new String[] { "0x1234", "011064",
+ // "1001000110100", "4660", "0x1234" });
+ tests1.put("lBoolPtr2", new String[] { "0x123ABCDE", "02216536336", "10010001110101011110011011110",
+ "305839326", "0x123ABCDE", "0x123ABCDE" });
+
+ executeExpressionSubTests(tests1, SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0));
+
+ // Step into the method and stop until all new local variables are
+ // initialized
+ SyncUtil.step(StepType.STEP_INTO);
+ stoppedEvent = SyncUtil.step(5, StepType.STEP_OVER);
+
+ // Create a map of expressions to expected values.
+ Map<String, String[]> tests2 = new HashMap<String, String[]>();
+
+ tests2.put("lIntVar", new String[] { "0x1a85", "015205", "1101010000101", "6789", "6789", "6789" });
+ tests2.put("lDoubleArray[1]", new String[] { "0x1a85", "015205", "1101010000101", "6789", "6789.6788999999999",
+ "6789.6788999999999" });
+ tests2.put("lCharVar", new String[] { "0x69", "0151", "1101001", "105", "105 'i'", "105 'i'" });
+ tests2.put("*lCharPtr", new String[] { "0x69", "0151", "1101001", "105", "105 'i'", "105 'i'" });
+ tests2.put("lBoolPtr2", new String[] { "0xABCDE123", "025363360443", "10101011110011011110000100100011",
+ "2882396451", "0xABCDE123", "0xABCDE123" });
+
+ // check variables at current stack frame
+ executeExpressionSubTests(tests2, SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0));
+ // check previous stack frame
+ executeExpressionSubTests(tests1, SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 1));
+
+ // Now return from the method and check that we see the
+ // original variables. We must use the right context to restore the right stack frame
+ stoppedEvent = SyncUtil.step(stoppedEvent.getDMContext(), StepType.STEP_RETURN);
+
+ executeExpressionSubTests(tests1, SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0));
+ }
+
+ /**
+ * This tests verifies that we can deal with variables in a subblock hiding
+ * variables with the same name in the outer block.
+ */
+ @Ignore("Sublocks do not work with GDB")
+ @Test
+ public void testSubBlock() throws Throwable {
+ SyncUtil.runToLocation("testSubblock");
+ MIStoppedEvent stoppedEvent = SyncUtil.step(2, StepType.STEP_OVER);
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+
+ Map<String, String[]> tests = new HashMap<String, String[]>();
+
+ tests.put("a", new String[] { "0x8", "010", "1000", "8", "8", "8" });
+ tests.put("b", new String[] { "0x1", "01", "1", "1", "1", "1" });
+
+ executeExpressionSubTests(tests, frameDmc);
+
+ // Now enter a subblock with the same variable names
+ SyncUtil.step(2, StepType.STEP_OVER);
+
+ tests = new HashMap<String, String[]>();
+
+ tests.put("a", new String[] { "0xc", "014", "1100", "12", "12", "12" });
+ tests.put("b", new String[] { "0x1", "01", "1", "1", "1", "1" });
+
+ executeExpressionSubTests(tests, frameDmc);
+
+ // Now step to change the b variable
+ SyncUtil.step(1, StepType.STEP_OVER);
+
+ tests = new HashMap<String, String[]>();
- // Get the children of some variables
- MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("testChildren");
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
- IExpressionDMContext exprDMC = SyncUtil.createExpression(frameDmc, "f");
- doTestChildren(exprDMC);
-
- // Now do a step and get the children again, to test the internal cache
- SyncUtil.step(1, StepType.STEP_OVER);
- doTestChildren(exprDMC);
- }
-
- /**
- * This test makes sure we get the right number of children.
- */
- @Test
- public void testChildrenCount() throws Throwable {
- // Next we test that we can retrieve children count while reading the
- // value and vice-versa
+ tests.put("a", new String[] { "0xc", "014", "1100", "12", "12", "12" });
+ tests.put("b", new String[] { "0xc", "014", "1100", "12", "12", "12" });
- SyncUtil.runToLocation("testChildren");
- MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
+ executeExpressionSubTests(tests, frameDmc);
- final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ // Now exit the sub-block and check that we see the original a but the
+ // same b
+ SyncUtil.step(1, StepType.STEP_OVER);
+
+ tests = new HashMap<String, String[]>();
+
+ tests.put("a", new String[] { "0x8", "010", "1000", "8", "8", "8" });
+ tests.put("b", new String[] { "0xc", "014", "1100", "12", "12", "12" });
+
+ executeExpressionSubTests(tests, frameDmc);
+ }
+
+ /**
+ * This tests verifies that we can obtain children properly.
+ */
+ @Test
+ public void testChildren() throws Throwable {
+ assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_6_7);
+
+ // Get the children of some variables
+ MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("testChildren");
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ IExpressionDMContext exprDMC = SyncUtil.createExpression(frameDmc, "f");
+ doTestChildren(exprDMC);
+
+ // Now do a step and get the children again, to test the internal cache
+ SyncUtil.step(1, StepType.STEP_OVER);
+ doTestChildren(exprDMC);
+ }
- // First we get the expected value of the array pointer.
- final IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, "f");
+ /**
+ * This test makes sure we get the right number of children.
+ */
+ @Test
+ public void testChildrenCount() throws Throwable {
+ // Next we test that we can retrieve children count while reading the
+ // value and vice-versa
+
+ SyncUtil.runToLocation("testChildren");
+ MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
+
+ final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
- assertChildrenCount(exprDmc, 5);
- }
+ // First we get the expected value of the array pointer.
+ final IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, "f");
+
+ assertChildrenCount(exprDmc, 5);
+ }
/**
* This test makes sure we get can tell if an expression has children based
@@ -369,12 +369,10 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
SyncUtil.runToLocation("testChildren");
MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
- final IFrameDMContext frameDmc = SyncUtil.getStackFrame(
- stoppedEvent.getDMContext(), 0);
+ final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
// First we get the expected value of the array pointer.
- final IExpressionDMContext exprDmc = SyncUtil.createExpression(
- frameDmc, "f");
+ final IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, "f");
Query<IExpressionDMData> query = new Query<IExpressionDMData>() {
@Override
@@ -392,28 +390,28 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
}
- /**
- * This test makes sure we properly deal with a GDB display bug.
- * See bug 320277
- *
- * The following code causes a bug in GDB:
- *
- * class Base {};
- * class BaseTest: public Base {
- * public:
- * BaseTest() {} // Removing this lines removes GDB's bug
- * void test() { return; }
- * };
- *
- * We see the bug with the following commands:
- * -var-create - * this
- * -var-list-children var1
- * -var-info-path-expression var1.BaseTest
- * -data-evaluate-expression "(*(Base*) this)"
- *
- * which we can reproduce by creating the children of this
- * and asking for the DETAILS_FORMAT of the var1.BaseTest child.
- */
+ /**
+ * This test makes sure we properly deal with a GDB display bug.
+ * See bug 320277
+ *
+ * The following code causes a bug in GDB:
+ *
+ * class Base {};
+ * class BaseTest: public Base {
+ * public:
+ * BaseTest() {} // Removing this lines removes GDB's bug
+ * void test() { return; }
+ * };
+ *
+ * We see the bug with the following commands:
+ * -var-create - * this
+ * -var-list-children var1
+ * -var-info-path-expression var1.BaseTest
+ * -data-evaluate-expression "(*(Base*) this)"
+ *
+ * which we can reproduce by creating the children of this
+ * and asking for the DETAILS_FORMAT of the var1.BaseTest child.
+ */
@Test
public void testBaseChildrenBug() throws Throwable {
@@ -428,7 +426,8 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
Query<FormattedValueDMData> query = new Query<FormattedValueDMData>() {
@Override
protected void execute(DataRequestMonitor<FormattedValueDMData> rm) {
- FormattedValueDMContext dmc = fExpService.getFormattedValueContext(children[0], MIExpressions.DETAILS_FORMAT);
+ FormattedValueDMContext dmc = fExpService.getFormattedValueContext(children[0],
+ MIExpressions.DETAILS_FORMAT);
fExpService.getFormattedExpressionValue(dmc, rm);
}
};
@@ -442,7 +441,8 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
query = new Query<FormattedValueDMData>() {
@Override
protected void execute(DataRequestMonitor<FormattedValueDMData> rm) {
- FormattedValueDMContext dmc = fExpService.getFormattedValueContext(children[1], MIExpressions.DETAILS_FORMAT);
+ FormattedValueDMContext dmc = fExpService.getFormattedValueContext(children[1],
+ MIExpressions.DETAILS_FORMAT);
fExpService.getFormattedExpressionValue(dmc, rm);
}
};
@@ -540,8 +540,8 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
*/
private void writeAndCheck(final IExpressionDMContext exprDmc, final String newValueFormatted, final String format,
final String newValueInDecimal) throws Throwable {
- ServiceEventWaitor<IExpressionChangedDMEvent> eventWaitor = new ServiceEventWaitor<>(
- fSession, IExpressionChangedDMEvent.class);
+ ServiceEventWaitor<IExpressionChangedDMEvent> eventWaitor = new ServiceEventWaitor<>(fSession,
+ IExpressionChangedDMEvent.class);
// Write the new value using its formatted value
Query<Void> writeQuery = new Query<Void>() {
@@ -574,1514 +574,1579 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
assertThat(actualDecimalValue.toLowerCase(), is(newValueInDecimal.toLowerCase()));
}
- /**
- * This tests verifies that we handle invalid formats properly for a write.
- */
- @Test
- public void testWriteErrorFormat() throws Throwable {
- SyncUtil.runToLocation("testWrite");
- MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
-
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
- IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, "a[1]");
-
- writeAndCheckError(exprDmc, "goodbye", IFormattedValues.DECIMAL_FORMAT);
- writeAndCheckError(exprDmc, "abggg", IFormattedValues.HEX_FORMAT);
- writeAndCheckError(exprDmc, "99", IFormattedValues.OCTAL_FORMAT);
- writeAndCheckError(exprDmc, "234", IFormattedValues.BINARY_FORMAT);
- writeAndCheckError(exprDmc, "hello", IFormattedValues.NATURAL_FORMAT);
- writeAndCheckError(exprDmc, "1", "ThisFormatDoesNotExist");
-
- IExpressionDMContext notWritableExprDmc = SyncUtil.createExpression(frameDmc, "10+5");
- writeAndCheckError(notWritableExprDmc, "1", IFormattedValues.NATURAL_FORMAT);
- }
-
- /*
- * This method does a write that should use an invalid value or format, and
- * verifies that the operation fails
- */
- private void writeAndCheckError(final IExpressionDMContext exprDmc, final String invalidValueFormatted,
- final String format) throws Throwable {
-
- final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
-
- // Write the new value using its formatted value
- fExpService.getExecutor().submit(new Runnable() {
- @Override
+ /**
+ * This tests verifies that we handle invalid formats properly for a write.
+ */
+ @Test
+ public void testWriteErrorFormat() throws Throwable {
+ SyncUtil.runToLocation("testWrite");
+ MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
+
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, "a[1]");
+
+ writeAndCheckError(exprDmc, "goodbye", IFormattedValues.DECIMAL_FORMAT);
+ writeAndCheckError(exprDmc, "abggg", IFormattedValues.HEX_FORMAT);
+ writeAndCheckError(exprDmc, "99", IFormattedValues.OCTAL_FORMAT);
+ writeAndCheckError(exprDmc, "234", IFormattedValues.BINARY_FORMAT);
+ writeAndCheckError(exprDmc, "hello", IFormattedValues.NATURAL_FORMAT);
+ writeAndCheckError(exprDmc, "1", "ThisFormatDoesNotExist");
+
+ IExpressionDMContext notWritableExprDmc = SyncUtil.createExpression(frameDmc, "10+5");
+ writeAndCheckError(notWritableExprDmc, "1", IFormattedValues.NATURAL_FORMAT);
+ }
+
+ /*
+ * This method does a write that should use an invalid value or format, and
+ * verifies that the operation fails
+ */
+ private void writeAndCheckError(final IExpressionDMContext exprDmc, final String invalidValueFormatted,
+ final String format) throws Throwable {
+
+ final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
+
+ // Write the new value using its formatted value
+ fExpService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- fExpService.writeExpression(exprDmc, invalidValueFormatted, format, new RequestMonitor(fExpService
- .getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- wait.waitFinished(getStatus());
- }
- });
- }
- });
-
- wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- assertTrue("Got an OK status for an error test case. Should not be able to write value "
- + invalidValueFormatted + " in " + format, !wait.isOK());
-
- assertTrue("ExprChangedEvent problem: expected 0, received " + getExprChangedCount(),
- getExprChangedCount() == 0);
- }
-
- /**
- * This test tries multiple format reads during the same executor cycle, to
- * make sure the internal MI commands are sequenced properly.
- */
- @Test
- public void testConcurrentReads() throws Throwable {
- // Next we test that we can read the value more than once
- // of the same variable object at the exact same time
-
- SyncUtil.runToLocation("testConcurrent");
- MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
-
- final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
-
-
- final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
-
- fExpService.getExecutor().submit(new Runnable() {
- @Override
+ fExpService.writeExpression(exprDmc, invalidValueFormatted, format,
+ new RequestMonitor(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ wait.waitFinished(getStatus());
+ }
+ });
+ }
+ });
+
+ wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ assertTrue("Got an OK status for an error test case. Should not be able to write value "
+ + invalidValueFormatted + " in " + format, !wait.isOK());
+
+ assertTrue("ExprChangedEvent problem: expected 0, received " + getExprChangedCount(),
+ getExprChangedCount() == 0);
+ }
+
+ /**
+ * This test tries multiple format reads during the same executor cycle, to
+ * make sure the internal MI commands are sequenced properly.
+ */
+ @Test
+ public void testConcurrentReads() throws Throwable {
+ // Next we test that we can read the value more than once
+ // of the same variable object at the exact same time
+
+ SyncUtil.runToLocation("testConcurrent");
+ MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
+
+ final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+
+ final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
+
+ fExpService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- IExpressionDMContext exprDmc = fExpService.createExpression(frameDmc, "a[0]");
-
- wait.increment();
- fExpService.getFormattedExpressionValue(fExpService.getFormattedValueContext(exprDmc,
- IFormattedValues.NATURAL_FORMAT), new DataRequestMonitor<FormattedValueDMData>(fExpService
- .getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- if (getData().getFormattedValue().equals("28")) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating natural format", null));
- }
- }
- }
- });
-
- wait.increment();
- fExpService.getFormattedExpressionValue(fExpService.getFormattedValueContext(exprDmc,
- IFormattedValues.HEX_FORMAT), new DataRequestMonitor<FormattedValueDMData>(fExpService
- .getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- if (getData().getFormattedValue().equalsIgnoreCase("0x1c")) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating hex format", null));
- }
- }
- }
- });
- }
- });
-
- wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- assertTrue(wait.getMessage(), wait.isOK());
-
- assertTrue("ExprChangedEvent problem: expected 0, received " + getExprChangedCount(),
- getExprChangedCount() == 0);
-
- }
-
- /**
- * This test tries reads and listChildren during the same executor cycle, to
- * make sure the internal MI commands are sequenced properly.
- */
- @Test
- public void testConcurrentReadChildren() throws Throwable {
- // Next we test that we can retrieve children while reading the value
- // and vice-versa
-
- SyncUtil.runToLocation("testConcurrent");
- MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
-
- final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
-
- final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
-
- // First we get the expected value of the array pointer.
- final IExpressionDMContext addrDmc = SyncUtil.createExpression(frameDmc, "&a");
-
- fExpService.getExecutor().submit(new Runnable() {
- @Override
+ IExpressionDMContext exprDmc = fExpService.createExpression(frameDmc, "a[0]");
+
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals("28")) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating natural format", null));
+ }
+ }
+ }
+ });
+
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.HEX_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equalsIgnoreCase("0x1c")) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating hex format", null));
+ }
+ }
+ }
+ });
+ }
+ });
+
+ wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ assertTrue(wait.getMessage(), wait.isOK());
+
+ assertTrue("ExprChangedEvent problem: expected 0, received " + getExprChangedCount(),
+ getExprChangedCount() == 0);
+
+ }
+
+ /**
+ * This test tries reads and listChildren during the same executor cycle, to
+ * make sure the internal MI commands are sequenced properly.
+ */
+ @Test
+ public void testConcurrentReadChildren() throws Throwable {
+ // Next we test that we can retrieve children while reading the value
+ // and vice-versa
+
+ SyncUtil.runToLocation("testConcurrent");
+ MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
+
+ final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+
+ final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
+
+ // First we get the expected value of the array pointer.
+ final IExpressionDMContext addrDmc = SyncUtil.createExpression(frameDmc, "&a");
+
+ fExpService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(addrDmc, IFormattedValues.NATURAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (isSuccess()) {
- wait.setReturnInfo(getData());
- }
-
- wait.waitFinished(getStatus());
- }
- });
- }
- });
-
- wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- assertTrue(wait.getMessage(), wait.isOK());
-
- final String actualAddrStr = ((FormattedValueDMData) wait.getReturnInfo()).getFormattedValue();
-
- wait.waitReset();
-
- // Now perform the test
- fExpService.getExecutor().submit(new Runnable() {
- @Override
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(addrDmc, IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (isSuccess()) {
+ wait.setReturnInfo(getData());
+ }
+
+ wait.waitFinished(getStatus());
+ }
+ });
+ }
+ });
+
+ wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ assertTrue(wait.getMessage(), wait.isOK());
+
+ final String actualAddrStr = ((FormattedValueDMData) wait.getReturnInfo()).getFormattedValue();
+
+ wait.waitReset();
+
+ // Now perform the test
+ fExpService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- IExpressionDMContext exprDmc = fExpService.createExpression(frameDmc, "a");
-
- wait.increment();
- fExpService.getFormattedExpressionValue(fExpService.getFormattedValueContext(exprDmc,
- IFormattedValues.NATURAL_FORMAT), new DataRequestMonitor<FormattedValueDMData>(fExpService
- .getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- if (getData().getFormattedValue().equals(actualAddrStr)) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating natural format", null));
- }
- }
- }
- });
-
- wait.increment();
- fExpService.getSubExpressions(exprDmc, new DataRequestMonitor<IExpressionDMContext[]>(
- fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- IExpressionDMContext[] children = getData();
- int failedIndex = -1;
- for (int i = 0; i < 2; i++) {
- if (!children[i].getExpression().equals("a[" + i + "]")) {
- failedIndex = i;
- }
- }
-
- if (failedIndex != -1) {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed getting child number: " + failedIndex, null));
- } else {
- wait.waitFinished();
- }
- }
- }
- });
-
- // Use different format to avoid triggering the cache
- wait.increment();
- fExpService.getFormattedExpressionValue(fExpService.getFormattedValueContext(exprDmc,
- IFormattedValues.HEX_FORMAT), new DataRequestMonitor<FormattedValueDMData>(fExpService
- .getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- if (getData().getFormattedValue().equals(actualAddrStr)) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating hex format", null));
- }
- }
- }
- });
- }
- });
-
- wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- assertTrue(wait.getMessage(), wait.isOK());
-
- assertTrue("ExprChangedEvent problem: expected 0, received " + getExprChangedCount(),
- getExprChangedCount() == 0);
- }
-
- /**
- * This test tries reads and getChildrenCount during the same executor
- * cycle, to make sure the internal MI commands are sequenced properly.
- */
- @Test
- public void testConcurrentReadChildrenCount() throws Throwable {
- // Next we test that we can retrieve children count while reading the
- // value and vice-versa
-
- SyncUtil.runToLocation("testConcurrent");
- MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
-
- final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
-
- final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
-
- // First we get the expected value of the array pointer.
- final IExpressionDMContext addrDmc = SyncUtil.createExpression(frameDmc, "&a");
-
- fExpService.getExecutor().submit(new Runnable() {
- @Override
+ IExpressionDMContext exprDmc = fExpService.createExpression(frameDmc, "a");
+
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals(actualAddrStr)) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating natural format", null));
+ }
+ }
+ }
+ });
+
+ wait.increment();
+ fExpService.getSubExpressions(exprDmc,
+ new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ IExpressionDMContext[] children = getData();
+ int failedIndex = -1;
+ for (int i = 0; i < 2; i++) {
+ if (!children[i].getExpression().equals("a[" + i + "]")) {
+ failedIndex = i;
+ }
+ }
+
+ if (failedIndex != -1) {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed getting child number: " + failedIndex, null));
+ } else {
+ wait.waitFinished();
+ }
+ }
+ }
+ });
+
+ // Use different format to avoid triggering the cache
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.HEX_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals(actualAddrStr)) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating hex format", null));
+ }
+ }
+ }
+ });
+ }
+ });
+
+ wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ assertTrue(wait.getMessage(), wait.isOK());
+
+ assertTrue("ExprChangedEvent problem: expected 0, received " + getExprChangedCount(),
+ getExprChangedCount() == 0);
+ }
+
+ /**
+ * This test tries reads and getChildrenCount during the same executor
+ * cycle, to make sure the internal MI commands are sequenced properly.
+ */
+ @Test
+ public void testConcurrentReadChildrenCount() throws Throwable {
+ // Next we test that we can retrieve children count while reading the
+ // value and vice-versa
+
+ SyncUtil.runToLocation("testConcurrent");
+ MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
+
+ final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+
+ final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
+
+ // First we get the expected value of the array pointer.
+ final IExpressionDMContext addrDmc = SyncUtil.createExpression(frameDmc, "&a");
+
+ fExpService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(addrDmc, IFormattedValues.NATURAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (isSuccess()) {
- wait.setReturnInfo(getData());
- }
-
- wait.waitFinished(getStatus());
- }
- });
- }
- });
-
- wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- assertTrue(wait.getMessage(), wait.isOK());
-
- final String actualAddrStr = ((FormattedValueDMData) wait.getReturnInfo()).getFormattedValue();
-
- wait.waitReset();
-
- fExpService.getExecutor().submit(new Runnable() {
- @Override
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(addrDmc, IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (isSuccess()) {
+ wait.setReturnInfo(getData());
+ }
+
+ wait.waitFinished(getStatus());
+ }
+ });
+ }
+ });
+
+ wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ assertTrue(wait.getMessage(), wait.isOK());
+
+ final String actualAddrStr = ((FormattedValueDMData) wait.getReturnInfo()).getFormattedValue();
+
+ wait.waitReset();
+
+ fExpService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- wait.increment();
- IExpressionDMContext exprDmc = fExpService.createExpression(frameDmc, "a");
-
- fExpService.getFormattedExpressionValue(fExpService.getFormattedValueContext(exprDmc,
- IFormattedValues.NATURAL_FORMAT), new DataRequestMonitor<FormattedValueDMData>(fExpService
- .getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- if (getData().getFormattedValue().equals(actualAddrStr)) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating natural format", null));
- }
- }
- }
- });
-
- wait.increment();
- fExpService.getSubExpressionCount(exprDmc, new DataRequestMonitor<Integer>(fExpService.getExecutor(),
- null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- int count = getData();
- if (count != 2) {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed getting count for children. Got" + count + "instead of 2", null));
- } else {
- wait.waitFinished();
- }
- }
- }
- });
-
- // Use different format to avoid triggering the cache
- wait.increment();
- fExpService.getFormattedExpressionValue(fExpService.getFormattedValueContext(exprDmc,
- IFormattedValues.HEX_FORMAT), new DataRequestMonitor<FormattedValueDMData>(fExpService
- .getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- if (getData().getFormattedValue().equals(actualAddrStr)) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating hex format", null));
- }
- }
- }
- });
- }
- });
-
- wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- assertTrue(wait.getMessage(), wait.isOK());
-
- assertTrue("ExprChangedEvent problem: expected 0, received " + getExprChangedCount(),
- getExprChangedCount() == 0);
- }
-
- /**
- * This test tries reads and writes during the same executor cycle, to make
- * sure the internal MI commands are sequenced properly.
- */
- @Test
- public void testConcurrentReadWrite() throws Throwable {
- // Next we test that we can deal with a write request and read request
- // at
- // the same time and vice-versa
-
- SyncUtil.runToLocation("testConcurrent");
- MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
-
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
-
- final IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, "a[1]");
-
- final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
-
- fExpService.getExecutor().submit(new Runnable() {
- @Override
+ wait.increment();
+ IExpressionDMContext exprDmc = fExpService.createExpression(frameDmc, "a");
+
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals(actualAddrStr)) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating natural format", null));
+ }
+ }
+ }
+ });
+
+ wait.increment();
+ fExpService.getSubExpressionCount(exprDmc,
+ new DataRequestMonitor<Integer>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ int count = getData();
+ if (count != 2) {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed getting count for children. Got" + count + "instead of 2",
+ null));
+ } else {
+ wait.waitFinished();
+ }
+ }
+ }
+ });
+
+ // Use different format to avoid triggering the cache
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.HEX_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals(actualAddrStr)) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating hex format", null));
+ }
+ }
+ }
+ });
+ }
+ });
+
+ wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ assertTrue(wait.getMessage(), wait.isOK());
+
+ assertTrue("ExprChangedEvent problem: expected 0, received " + getExprChangedCount(),
+ getExprChangedCount() == 0);
+ }
+
+ /**
+ * This test tries reads and writes during the same executor cycle, to make
+ * sure the internal MI commands are sequenced properly.
+ */
+ @Test
+ public void testConcurrentReadWrite() throws Throwable {
+ // Next we test that we can deal with a write request and read request
+ // at
+ // the same time and vice-versa
+
+ SyncUtil.runToLocation("testConcurrent");
+ MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
+
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+
+ final IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, "a[1]");
+
+ final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
+
+ fExpService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- wait.increment();
- fExpService.getFormattedExpressionValue(fExpService.getFormattedValueContext(exprDmc,
- IFormattedValues.NATURAL_FORMAT), new DataRequestMonitor<FormattedValueDMData>(fExpService
- .getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- if (getData().getFormattedValue().equals("32")) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating natural format, got " + getData().getFormattedValue()
- + " instead of 32", null));
- }
- }
- }
- });
-
- wait.increment();
- fExpService.writeExpression(exprDmc, "56", IFormattedValues.NATURAL_FORMAT, new RequestMonitor(
- fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- wait.waitFinished();
- }
- }
- });
-
- // Use different format to avoid triggering the cache
- wait.increment();
- fExpService.getFormattedExpressionValue(fExpService.getFormattedValueContext(exprDmc,
- IFormattedValues.HEX_FORMAT), new DataRequestMonitor<FormattedValueDMData>(fExpService
- .getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- if (getData().getFormattedValue().equals("0x38")) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating hex format, got " + getData().getFormattedValue()
- + " instead of 0x38", null));
- }
- }
- }
- });
- }
- });
-
- wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- assertTrue(wait.getMessage(), wait.isOK());
-
- assertTrue("ExprChangedEvent problem: expected 1, received " + getExprChangedCount(),
- getExprChangedCount() == 1);
- exprDmc.equals(getExprChangedContext());
- clearExprChangedData();
- }
-
- /**
- * This test tries many different operations during the same executor cycle,
- * to make sure the internal MI commands are sequenced properly.
- */
- @Test
- public void testConcurrentReadWriteChildren() throws Throwable {
- // Finally, we go nuts and request two reads, while requesting
- // a get children and get children count.
- // Note that we don't request a write, because a write is allowed to
- // go through at any time and we don't exactly know when it will
- // change the value we are reading.
-
- SyncUtil.runToLocation("testConcurrent");
- MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
-
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
-
- final IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, "a[1]");
-
- final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
-
- fExpService.getExecutor().submit(new Runnable() {
- @Override
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals("32")) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(
+ new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating natural format, got "
+ + getData().getFormattedValue() + " instead of 32",
+ null));
+ }
+ }
+ }
+ });
+
+ wait.increment();
+ fExpService.writeExpression(exprDmc, "56", IFormattedValues.NATURAL_FORMAT,
+ new RequestMonitor(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ wait.waitFinished();
+ }
+ }
+ });
+
+ // Use different format to avoid triggering the cache
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.HEX_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals("0x38")) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(
+ new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating hex format, got "
+ + getData().getFormattedValue() + " instead of 0x38",
+ null));
+ }
+ }
+ }
+ });
+ }
+ });
+
+ wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ assertTrue(wait.getMessage(), wait.isOK());
+
+ assertTrue("ExprChangedEvent problem: expected 1, received " + getExprChangedCount(),
+ getExprChangedCount() == 1);
+ exprDmc.equals(getExprChangedContext());
+ clearExprChangedData();
+ }
+
+ /**
+ * This test tries many different operations during the same executor cycle,
+ * to make sure the internal MI commands are sequenced properly.
+ */
+ @Test
+ public void testConcurrentReadWriteChildren() throws Throwable {
+ // Finally, we go nuts and request two reads, while requesting
+ // a get children and get children count.
+ // Note that we don't request a write, because a write is allowed to
+ // go through at any time and we don't exactly know when it will
+ // change the value we are reading.
+
+ SyncUtil.runToLocation("testConcurrent");
+ MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
+
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+
+ final IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, "a[1]");
+
+ final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
+
+ fExpService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- wait.increment();
- fExpService.getFormattedExpressionValue(fExpService.getFormattedValueContext(exprDmc,
- IFormattedValues.NATURAL_FORMAT), new DataRequestMonitor<FormattedValueDMData>(fExpService
- .getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- if (getData().getFormattedValue().equals("32")) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating natural format, got " + getData().getFormattedValue()
- + " instead of 32", null));
- }
- }
- }
- });
-
- wait.increment();
- fExpService.getFormattedExpressionValue(fExpService.getFormattedValueContext(exprDmc,
- IFormattedValues.HEX_FORMAT), new DataRequestMonitor<FormattedValueDMData>(fExpService
- .getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- if (getData().getFormattedValue().equals("0x20")) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating hex format, got " + getData().getFormattedValue()
- + " instead of 0x20", null));
- }
- }
- }
- });
-
- wait.increment();
- fExpService.getSubExpressionCount(exprDmc, new DataRequestMonitor<Integer>(fExpService.getExecutor(),
- null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- if (getData() != 0) {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed getting child count; expecting 0 got " + getData(), null));
- } else {
- wait.waitFinished();
- }
- }
- }
- });
-
- wait.increment();
- fExpService.getSubExpressions(exprDmc, new DataRequestMonitor<IExpressionDMContext[]>(
- fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- if (getData().length != 0) {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed getting children; expecting 0 got " + getData().length, null));
- } else {
- wait.waitFinished();
- }
- }
- }
- });
-
- // Must use a different format or else the cache will be triggered
- wait.increment();
- fExpService.getFormattedExpressionValue(fExpService.getFormattedValueContext(exprDmc,
- IFormattedValues.OCTAL_FORMAT), new DataRequestMonitor<FormattedValueDMData>(fExpService
- .getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- if (getData().getFormattedValue().equals("040")) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating hex format, got " + getData().getFormattedValue()
- + " instead of 040", null));
- }
- }
- }
- });
- }
- });
-
- wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- assertTrue(wait.getMessage(), wait.isOK());
-
- assertTrue("ExprChangedEvent problem: expected 0, received " + getExprChangedCount(),
- getExprChangedCount() == 0);
- exprDmc.equals(getExprChangedContext());
- clearExprChangedData();
- }
-
- /**
- * This test verifies that the ExpressionService caches the evaluation of an
- * expression in a specific format. It verifies this by: 1- reading a
- * variable 2- writing to that variable 3- reading the variable in a new
- * format and seeing the new value 4- reading the variable in the same
- * format as step 1 and seeing the old value cached Note that all above
- * steps must be done within the same Runnable submitted to the executor.
- * This allows the cache to be triggered before it is invalidated by a write
- * command, since the write command will need an new executor cycle to send
- * an MI command to the back-end
- */
- @Test
- public void testWriteCache() throws Throwable {
- // Test the cache by changing a value but triggering a read before the
- // write clears the cache
-
- SyncUtil.runToLocation("testConcurrent");
- MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
-
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
-
- final IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, "a[1]");
-
- final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
-
- fExpService.getExecutor().submit(new Runnable() {
- @Override
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals("32")) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(
+ new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating natural format, got "
+ + getData().getFormattedValue() + " instead of 32",
+ null));
+ }
+ }
+ }
+ });
+
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.HEX_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals("0x20")) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(
+ new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating hex format, got "
+ + getData().getFormattedValue() + " instead of 0x20",
+ null));
+ }
+ }
+ }
+ });
+
+ wait.increment();
+ fExpService.getSubExpressionCount(exprDmc,
+ new DataRequestMonitor<Integer>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData() != 0) {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed getting child count; expecting 0 got " + getData(), null));
+ } else {
+ wait.waitFinished();
+ }
+ }
+ }
+ });
+
+ wait.increment();
+ fExpService.getSubExpressions(exprDmc,
+ new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().length != 0) {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed getting children; expecting 0 got " + getData().length, null));
+ } else {
+ wait.waitFinished();
+ }
+ }
+ }
+ });
+
+ // Must use a different format or else the cache will be triggered
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.OCTAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals("040")) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(
+ new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating hex format, got "
+ + getData().getFormattedValue() + " instead of 040",
+ null));
+ }
+ }
+ }
+ });
+ }
+ });
+
+ wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ assertTrue(wait.getMessage(), wait.isOK());
+
+ assertTrue("ExprChangedEvent problem: expected 0, received " + getExprChangedCount(),
+ getExprChangedCount() == 0);
+ exprDmc.equals(getExprChangedContext());
+ clearExprChangedData();
+ }
+
+ /**
+ * This test verifies that the ExpressionService caches the evaluation of an
+ * expression in a specific format. It verifies this by: 1- reading a
+ * variable 2- writing to that variable 3- reading the variable in a new
+ * format and seeing the new value 4- reading the variable in the same
+ * format as step 1 and seeing the old value cached Note that all above
+ * steps must be done within the same Runnable submitted to the executor.
+ * This allows the cache to be triggered before it is invalidated by a write
+ * command, since the write command will need an new executor cycle to send
+ * an MI command to the back-end
+ */
+ @Test
+ public void testWriteCache() throws Throwable {
+ // Test the cache by changing a value but triggering a read before the
+ // write clears the cache
+
+ SyncUtil.runToLocation("testConcurrent");
+ MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
+
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+
+ final IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, "a[1]");
+
+ final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
+
+ fExpService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- wait.increment();
- fExpService.getFormattedExpressionValue(fExpService.getFormattedValueContext(exprDmc,
- IFormattedValues.NATURAL_FORMAT), new DataRequestMonitor<FormattedValueDMData>(fExpService
- .getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- if (getData().getFormattedValue().equals("32")) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating natural format, got " + getData().getFormattedValue()
- + " instead of 32", null));
- }
- }
- }
- });
-
- wait.increment();
- fExpService.writeExpression(exprDmc, "56", IFormattedValues.NATURAL_FORMAT, new RequestMonitor(
- fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- wait.waitFinished();
- }
- }
- });
-
- // Must use a different format or else the cache will be
- // triggered
- // This will prove that the write has changed the backend
- wait.increment();
- fExpService.getFormattedExpressionValue(fExpService.getFormattedValueContext(exprDmc,
- IFormattedValues.OCTAL_FORMAT), new DataRequestMonitor<FormattedValueDMData>(fExpService
- .getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- if (getData().getFormattedValue().equals("070")) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating hex format, got " + getData().getFormattedValue()
- + " instead of 070", null));
- }
- }
- }
- });
-
- // Test that the cache is triggered, giving us the old value
- // This happens because we are calling this operation on the
- // same executor run call.
- // NOTE that this is not a problem, because the writeExpression
- // will eventually
- // reset the cache (we'll test this below).
- wait.increment();
- fExpService.getFormattedExpressionValue(fExpService.getFormattedValueContext(exprDmc,
- IFormattedValues.NATURAL_FORMAT), new DataRequestMonitor<FormattedValueDMData>(fExpService
- .getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- if (getData().getFormattedValue().equals("32")) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating natural format, got " + getData().getFormattedValue()
- + " instead of 32", null));
- }
- }
- }
- });
- }
- });
-
- wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- assertTrue(wait.getMessage(), wait.isOK());
-
- // Now that we know the writeExpressions completed and the cache was
- // reset, do a similar
- // request as above to see that the cache has indeed been reset
- wait.waitReset();
- fExpService.getExecutor().submit(new Runnable() {
- @Override
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals("32")) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(
+ new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating natural format, got "
+ + getData().getFormattedValue() + " instead of 32",
+ null));
+ }
+ }
+ }
+ });
+
+ wait.increment();
+ fExpService.writeExpression(exprDmc, "56", IFormattedValues.NATURAL_FORMAT,
+ new RequestMonitor(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ wait.waitFinished();
+ }
+ }
+ });
+
+ // Must use a different format or else the cache will be
+ // triggered
+ // This will prove that the write has changed the backend
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.OCTAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals("070")) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(
+ new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating hex format, got "
+ + getData().getFormattedValue() + " instead of 070",
+ null));
+ }
+ }
+ }
+ });
+
+ // Test that the cache is triggered, giving us the old value
+ // This happens because we are calling this operation on the
+ // same executor run call.
+ // NOTE that this is not a problem, because the writeExpression
+ // will eventually
+ // reset the cache (we'll test this below).
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals("32")) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(
+ new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating natural format, got "
+ + getData().getFormattedValue() + " instead of 32",
+ null));
+ }
+ }
+ }
+ });
+ }
+ });
+
+ wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ assertTrue(wait.getMessage(), wait.isOK());
+
+ // Now that we know the writeExpressions completed and the cache was
+ // reset, do a similar
+ // request as above to see that the cache has indeed been reset
+ wait.waitReset();
+ fExpService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- wait.increment();
- fExpService.getFormattedExpressionValue(fExpService.getFormattedValueContext(exprDmc,
- IFormattedValues.NATURAL_FORMAT), new DataRequestMonitor<FormattedValueDMData>(fExpService
- .getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- if (getData().getFormattedValue().equals("56")) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating natural format, got " + getData().getFormattedValue()
- + " instead of 56", null));
- }
- }
- }
- });
- }
- });
-
- wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- assertTrue(wait.getMessage(), wait.isOK());
-
- assertTrue("ExprChangedEvent problem: expected 1, received " + getExprChangedCount(),
- getExprChangedCount() == 1);
- exprDmc.equals(getExprChangedContext());
- clearExprChangedData();
- }
-
- /**
- * Test that we can correctly retrieve the address and type size of an
- * expression
- */
- @Test
- public void testExprAddress() throws Throwable {
-
- SyncUtil.runToLocation("testAddress");
- MIStoppedEvent stoppedEvent = SyncUtil.step(2, StepType.STEP_OVER);
-
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
-
- final IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, "a");
-
- final IExpressionDMContext exprDmc2 = SyncUtil.createExpression(frameDmc, "a_ptr");
-
- final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
-
- // First get the address of 'a' through 'a_ptr'
- fExpService.getExecutor().submit(new Runnable() {
- @Override
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals("56")) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(
+ new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating natural format, got "
+ + getData().getFormattedValue() + " instead of 56",
+ null));
+ }
+ }
+ }
+ });
+ }
+ });
+
+ wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ assertTrue(wait.getMessage(), wait.isOK());
+
+ assertTrue("ExprChangedEvent problem: expected 1, received " + getExprChangedCount(),
+ getExprChangedCount() == 1);
+ exprDmc.equals(getExprChangedContext());
+ clearExprChangedData();
+ }
+
+ /**
+ * Test that we can correctly retrieve the address and type size of an
+ * expression
+ */
+ @Test
+ public void testExprAddress() throws Throwable {
+
+ SyncUtil.runToLocation("testAddress");
+ MIStoppedEvent stoppedEvent = SyncUtil.step(2, StepType.STEP_OVER);
+
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+
+ final IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, "a");
+
+ final IExpressionDMContext exprDmc2 = SyncUtil.createExpression(frameDmc, "a_ptr");
+
+ final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
+
+ // First get the address of 'a' through 'a_ptr'
+ fExpService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- fExpService.getFormattedExpressionValue(fExpService.getFormattedValueContext(exprDmc2,
- IFormattedValues.NATURAL_FORMAT), new DataRequestMonitor<FormattedValueDMData>(fExpService
- .getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (isSuccess()) {
- wait.setReturnInfo(getData());
- }
-
- wait.waitFinished(getStatus());
- }
- });
- }
- });
-
- wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- assertTrue(wait.getMessage(), wait.isOK());
-
- String actualAddrStr = ((FormattedValueDMData) wait.getReturnInfo()).getFormattedValue();
- wait.waitReset();
-
- // Now check the address through our getAddressData
- checkAddressData(exprDmc, actualAddrStr, 4);
-
- assertTrue("ExprChangedEvent problem: expected 0, received " + getExprChangedCount(),
- getExprChangedCount() == 0);
- }
-
-
- /**
- * Test that we can correctly evaluate C expressions involving global
- * variables.
- *
- * @return void
- */
- @Test
- public void testGlobalVariables() throws Throwable {
-
- // Step to a stack level of 2 to be able to test differen stack frames
- MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("locals2");
-
- // Create a map of expressions to expected values.
- Map<String, String[]> tests = new HashMap<String, String[]>();
-
- // Global variables
- tests.put("gIntVar", new String[] { "0x21F", "01037", "1000011111", "543", "543", "543" });
- tests.put("gDoubleVar", new String[] { "0x21F", "01037", "1000011111", "543", "543.54300000000001", "543.54300000000001" });
- tests.put("gCharVar", new String[] { "0x67", "0147", "1100111", "103", "103 'g'", "103 'g'" });
- tests.put("gBoolVar", new String[] { "0x0", "0", "0", "0", "false", "false" });
-
- tests.put("gIntArray[1]", new String[] { "0x28E", "01216", "1010001110", "654", "654", "654" });
- tests.put("gDoubleArray[1]", new String[] { "0x28E", "01216", "1010001110", "654", "654.32100000000003", "654.32100000000003" });
- tests.put("gCharArray[1]", new String[] { "0x64", "0144", "1100100", "100", "100 'd'", "100 'd'" });
- tests.put("gBoolArray[1]", new String[] { "0x0", "0", "0", "0", "false", "false" });
-
- tests.put("*gIntPtr", new String[] { "0x21F", "01037", "1000011111", "543", "543", "543" });
- tests.put("*gDoublePtr", new String[] { "0x21F", "01037", "1000011111", "543", "543.54300000000001", "543.54300000000001" });
- tests.put("*gCharPtr", new String[] { "0x67", "0147", "1100111", "103", "103 'g'", "103 'g'" });
- tests.put("*gBoolPtr", new String[] { "0x0", "0", "0", "0", "false", "false" });
-
- tests.put("gIntPtr2", new String[] { "0x8", "010", "1000", "8", "0x8" , "0x8" });
- tests.put("gDoublePtr2", new String[] { "0x5432", "052062", "101010000110010", "21554", "0x5432", "0x5432" });
- // GDB says a char* is out of bounds, but not the other pointers???
- // tests.put("gCharPtr2", new String[] { "0x4321", "041441",
- // "100001100100001", "17185", "0x4321" });
- tests.put("gBoolPtr2", new String[] { "0x12ABCDEF", "02252746757", "10010101010111100110111101111",
- "313249263", "0x12ABCDEF", "0x12ABCDEF" });
-
- // Try different stack frames
- executeExpressionSubTests(tests, SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0));
- executeExpressionSubTests(tests, SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 1));
- executeExpressionSubTests(tests, SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 2));
- }
-
- /**
- * This test verifies that the ExpressionService can handle having a
- * variable with the same name in two different methods but at the same
- * stack depth.
- */
- @Test
- public void testNamingSameDepth() throws Throwable {
- SyncUtil.runToLocation("testName1");
- MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
-
- Map<String, String[]> tests = new HashMap<String, String[]>();
- tests.put("a", new String[] { "0x1", "01", "1", "1", "1", "1" });
- executeExpressionSubTests(tests, frameDmc);
-
- SyncUtil.runToLocation("testName2");
- stoppedEvent = SyncUtil.step(1, StepType.STEP_INTO);
- frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
- tests = new HashMap<String, String[]>();
- tests.put("a", new String[] { "0x2", "02", "10", "2", "2", "2" });
- executeExpressionSubTests(tests, frameDmc);
-
- SyncUtil.runToLocation("testName1");
- stoppedEvent = SyncUtil.step(1, StepType.STEP_INTO);
- frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
- tests = new HashMap<String, String[]>();
- tests.put("a", new String[] { "0x3", "03", "11", "3", "3", "3" });
- executeExpressionSubTests(tests, frameDmc);
- }
-
- /**
- * This test verifies that the ExpressionService can handle having a
- * variable with the same name in two methods that also have the same name
- */
- @Test
- public void testNamingSameMethod() throws Throwable {
- SyncUtil.runToLocation("testSameName");
- MIStoppedEvent stoppedEvent = SyncUtil.step(2, StepType.STEP_INTO);
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
-
- Map<String, String[]> tests = new HashMap<String, String[]>();
- tests.put("a", new String[] { "0x1", "01", "1", "1", "1" , "1" });
- executeExpressionSubTests(tests, frameDmc);
-
- SyncUtil.step(StepType.STEP_RETURN);
- stoppedEvent = SyncUtil.step(2, StepType.STEP_INTO);
- frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
- tests = new HashMap<String, String[]>();
- tests.put("a", new String[] { "0x2", "02", "10", "2", "2", "2" });
- executeExpressionSubTests(tests, frameDmc);
-
- SyncUtil.step(StepType.STEP_RETURN);
- stoppedEvent = SyncUtil.step(2, StepType.STEP_INTO);
- frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
- tests = new HashMap<String, String[]>();
- tests.put("a", new String[] { "0x3", "03", "11", "3", "3", "3" });
- executeExpressionSubTests(tests, frameDmc);
- }
-
- /**
- * This test makes sure that if a request for expression values are made with
- * a thread selected, the top-most stack frame is used for evaluation
- */
- @Test
- public void testThreadContext() throws Throwable {
-
- // Step to a stack level of 2 to be able to test differen stack frames
- SyncUtil.runToLocation("locals2");
- MIStoppedEvent stoppedEvent = SyncUtil.step(StepType.STEP_OVER);
-
- // Create a map of expressions to expected values.
- Map<String, String[]> tests = new HashMap<String, String[]>();
-
- // First make sure we have a different value on the other stack frame and that we select
- // a frame that is not the top frame
- tests.put("lIntVar", new String[] { "0x3039", "030071", "11000000111001", "12345", "12345", "12345" });
- executeExpressionSubTests(tests, SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 1));
-
- // Now check that we get the same values as the top stack when selecting the thread only
- tests = new HashMap<String, String[]>();
- tests.put("lIntVar", new String[] { "0x1a85", "015205", "1101010000101", "6789", "6789" , "6789" });
- executeExpressionSubTests(tests, stoppedEvent.getDMContext());
- }
-
- /**
- * This test verifies that the ExpressionService can handle having a
- * child variable with the same name in two methods that also have the same name
- */
- @Test
- public void testChildNamingSameMethod() throws Throwable {
- SyncUtil.runToLocation("testSameName");
- MIStoppedEvent stoppedEvent = SyncUtil.step(4, StepType.STEP_INTO);
- final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
-
- final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
-
- fExpService.getExecutor().submit(new Runnable() {
- @Override
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc2, IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (isSuccess()) {
+ wait.setReturnInfo(getData());
+ }
+
+ wait.waitFinished(getStatus());
+ }
+ });
+ }
+ });
+
+ wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ assertTrue(wait.getMessage(), wait.isOK());
+
+ String actualAddrStr = ((FormattedValueDMData) wait.getReturnInfo()).getFormattedValue();
+ wait.waitReset();
+
+ // Now check the address through our getAddressData
+ checkAddressData(exprDmc, actualAddrStr, 4);
+
+ assertTrue("ExprChangedEvent problem: expected 0, received " + getExprChangedCount(),
+ getExprChangedCount() == 0);
+ }
+
+ /**
+ * Test that we can correctly evaluate C expressions involving global
+ * variables.
+ *
+ * @return void
+ */
+ @Test
+ public void testGlobalVariables() throws Throwable {
+
+ // Step to a stack level of 2 to be able to test differen stack frames
+ MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("locals2");
+
+ // Create a map of expressions to expected values.
+ Map<String, String[]> tests = new HashMap<String, String[]>();
+
+ // Global variables
+ tests.put("gIntVar", new String[] { "0x21F", "01037", "1000011111", "543", "543", "543" });
+ tests.put("gDoubleVar",
+ new String[] { "0x21F", "01037", "1000011111", "543", "543.54300000000001", "543.54300000000001" });
+ tests.put("gCharVar", new String[] { "0x67", "0147", "1100111", "103", "103 'g'", "103 'g'" });
+ tests.put("gBoolVar", new String[] { "0x0", "0", "0", "0", "false", "false" });
+
+ tests.put("gIntArray[1]", new String[] { "0x28E", "01216", "1010001110", "654", "654", "654" });
+ tests.put("gDoubleArray[1]",
+ new String[] { "0x28E", "01216", "1010001110", "654", "654.32100000000003", "654.32100000000003" });
+ tests.put("gCharArray[1]", new String[] { "0x64", "0144", "1100100", "100", "100 'd'", "100 'd'" });
+ tests.put("gBoolArray[1]", new String[] { "0x0", "0", "0", "0", "false", "false" });
+
+ tests.put("*gIntPtr", new String[] { "0x21F", "01037", "1000011111", "543", "543", "543" });
+ tests.put("*gDoublePtr",
+ new String[] { "0x21F", "01037", "1000011111", "543", "543.54300000000001", "543.54300000000001" });
+ tests.put("*gCharPtr", new String[] { "0x67", "0147", "1100111", "103", "103 'g'", "103 'g'" });
+ tests.put("*gBoolPtr", new String[] { "0x0", "0", "0", "0", "false", "false" });
+
+ tests.put("gIntPtr2", new String[] { "0x8", "010", "1000", "8", "0x8", "0x8" });
+ tests.put("gDoublePtr2", new String[] { "0x5432", "052062", "101010000110010", "21554", "0x5432", "0x5432" });
+ // GDB says a char* is out of bounds, but not the other pointers???
+ // tests.put("gCharPtr2", new String[] { "0x4321", "041441",
+ // "100001100100001", "17185", "0x4321" });
+ tests.put("gBoolPtr2", new String[] { "0x12ABCDEF", "02252746757", "10010101010111100110111101111", "313249263",
+ "0x12ABCDEF", "0x12ABCDEF" });
+
+ // Try different stack frames
+ executeExpressionSubTests(tests, SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0));
+ executeExpressionSubTests(tests, SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 1));
+ executeExpressionSubTests(tests, SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 2));
+ }
+
+ /**
+ * This test verifies that the ExpressionService can handle having a
+ * variable with the same name in two different methods but at the same
+ * stack depth.
+ */
+ @Test
+ public void testNamingSameDepth() throws Throwable {
+ SyncUtil.runToLocation("testName1");
+ MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+
+ Map<String, String[]> tests = new HashMap<String, String[]>();
+ tests.put("a", new String[] { "0x1", "01", "1", "1", "1", "1" });
+ executeExpressionSubTests(tests, frameDmc);
+
+ SyncUtil.runToLocation("testName2");
+ stoppedEvent = SyncUtil.step(1, StepType.STEP_INTO);
+ frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ tests = new HashMap<String, String[]>();
+ tests.put("a", new String[] { "0x2", "02", "10", "2", "2", "2" });
+ executeExpressionSubTests(tests, frameDmc);
+
+ SyncUtil.runToLocation("testName1");
+ stoppedEvent = SyncUtil.step(1, StepType.STEP_INTO);
+ frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ tests = new HashMap<String, String[]>();
+ tests.put("a", new String[] { "0x3", "03", "11", "3", "3", "3" });
+ executeExpressionSubTests(tests, frameDmc);
+ }
+
+ /**
+ * This test verifies that the ExpressionService can handle having a
+ * variable with the same name in two methods that also have the same name
+ */
+ @Test
+ public void testNamingSameMethod() throws Throwable {
+ SyncUtil.runToLocation("testSameName");
+ MIStoppedEvent stoppedEvent = SyncUtil.step(2, StepType.STEP_INTO);
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+
+ Map<String, String[]> tests = new HashMap<String, String[]>();
+ tests.put("a", new String[] { "0x1", "01", "1", "1", "1", "1" });
+ executeExpressionSubTests(tests, frameDmc);
+
+ SyncUtil.step(StepType.STEP_RETURN);
+ stoppedEvent = SyncUtil.step(2, StepType.STEP_INTO);
+ frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ tests = new HashMap<String, String[]>();
+ tests.put("a", new String[] { "0x2", "02", "10", "2", "2", "2" });
+ executeExpressionSubTests(tests, frameDmc);
+
+ SyncUtil.step(StepType.STEP_RETURN);
+ stoppedEvent = SyncUtil.step(2, StepType.STEP_INTO);
+ frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ tests = new HashMap<String, String[]>();
+ tests.put("a", new String[] { "0x3", "03", "11", "3", "3", "3" });
+ executeExpressionSubTests(tests, frameDmc);
+ }
+
+ /**
+ * This test makes sure that if a request for expression values are made with
+ * a thread selected, the top-most stack frame is used for evaluation
+ */
+ @Test
+ public void testThreadContext() throws Throwable {
+
+ // Step to a stack level of 2 to be able to test differen stack frames
+ SyncUtil.runToLocation("locals2");
+ MIStoppedEvent stoppedEvent = SyncUtil.step(StepType.STEP_OVER);
+
+ // Create a map of expressions to expected values.
+ Map<String, String[]> tests = new HashMap<String, String[]>();
+
+ // First make sure we have a different value on the other stack frame and that we select
+ // a frame that is not the top frame
+ tests.put("lIntVar", new String[] { "0x3039", "030071", "11000000111001", "12345", "12345", "12345" });
+ executeExpressionSubTests(tests, SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 1));
+
+ // Now check that we get the same values as the top stack when selecting the thread only
+ tests = new HashMap<String, String[]>();
+ tests.put("lIntVar", new String[] { "0x1a85", "015205", "1101010000101", "6789", "6789", "6789" });
+ executeExpressionSubTests(tests, stoppedEvent.getDMContext());
+ }
+
+ /**
+ * This test verifies that the ExpressionService can handle having a
+ * child variable with the same name in two methods that also have the same name
+ */
+ @Test
+ public void testChildNamingSameMethod() throws Throwable {
+ SyncUtil.runToLocation("testSameName");
+ MIStoppedEvent stoppedEvent = SyncUtil.step(4, StepType.STEP_INTO);
+ final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+
+ final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
+
+ fExpService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- // First create the var object and all its children
- IExpressionDMContext parentDmc = fExpService.createExpression(frameDmc, "z");
-
- fExpService.getSubExpressions(
- parentDmc,
- new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().length != 2) {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed getting children; expecting 2 got " + getData().length, null));
- } else {
+ // First create the var object and all its children
+ IExpressionDMContext parentDmc = fExpService.createExpression(frameDmc, "z");
+
+ fExpService.getSubExpressions(parentDmc,
+ new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().length != 2) {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed getting children; expecting 2 got " + getData().length, null));
+ } else {
// now get the value of the child
- final String valueStr = "1";
- final IExpressionDMContext child = getData()[0];
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(child, IFormattedValues.NATURAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().getFormattedValue().equals(valueStr)) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating " + child.getExpression() + ", got " + getData().getFormattedValue()
- + " instead of " + valueStr, null));
- }
- }
-
- });
- }
-
-
- }
- });
- }
- });
-
- wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- assertTrue(wait.getMessage(), wait.isOK());
- wait.waitReset();
-
- SyncUtil.step(StepType.STEP_RETURN);
- stoppedEvent = SyncUtil.step(4, StepType.STEP_INTO);
- final IFrameDMContext frameDmc2 = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
- fExpService.getExecutor().submit(new Runnable() {
- @Override
+ final String valueStr = "1";
+ final IExpressionDMContext child = getData()[0];
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(child,
+ IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(),
+ null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().getFormattedValue().equals(valueStr)) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(new Status(IStatus.ERROR,
+ TestsPlugin.PLUGIN_ID,
+ "Failed evaluating " + child.getExpression() + ", got "
+ + getData().getFormattedValue() + " instead of "
+ + valueStr,
+ null));
+ }
+ }
+
+ });
+ }
+
+ }
+ });
+ }
+ });
+
+ wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ assertTrue(wait.getMessage(), wait.isOK());
+ wait.waitReset();
+
+ SyncUtil.step(StepType.STEP_RETURN);
+ stoppedEvent = SyncUtil.step(4, StepType.STEP_INTO);
+ final IFrameDMContext frameDmc2 = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ fExpService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- // First create the var object and all its children
- IExpressionDMContext parentDmc = fExpService.createExpression(frameDmc2, "z");
-
- fExpService.getSubExpressions(
- parentDmc,
- new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().length != 2) {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed getting children; expecting 2 got " + getData().length, null));
- } else {
+ // First create the var object and all its children
+ IExpressionDMContext parentDmc = fExpService.createExpression(frameDmc2, "z");
+
+ fExpService.getSubExpressions(parentDmc,
+ new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().length != 2) {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed getting children; expecting 2 got " + getData().length, null));
+ } else {
// now get the value of the child
- final String valueStr = "2";
- final IExpressionDMContext child = getData()[0];
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(child, IFormattedValues.NATURAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().getFormattedValue().equals(valueStr)) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating " + child.getExpression() + ", got " + getData().getFormattedValue()
- + " instead of " + valueStr, null));
- }
- }
-
- });
- }
-
-
- }
- });
- }
- });
-
- wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- assertTrue(wait.getMessage(), wait.isOK());
- wait.waitReset();
-
- SyncUtil.step(StepType.STEP_RETURN);
- stoppedEvent = SyncUtil.step(4, StepType.STEP_INTO);
- final IFrameDMContext frameDmc3 = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
- fExpService.getExecutor().submit(new Runnable() {
- @Override
+ final String valueStr = "2";
+ final IExpressionDMContext child = getData()[0];
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(child,
+ IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(),
+ null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().getFormattedValue().equals(valueStr)) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(new Status(IStatus.ERROR,
+ TestsPlugin.PLUGIN_ID,
+ "Failed evaluating " + child.getExpression() + ", got "
+ + getData().getFormattedValue() + " instead of "
+ + valueStr,
+ null));
+ }
+ }
+
+ });
+ }
+
+ }
+ });
+ }
+ });
+
+ wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ assertTrue(wait.getMessage(), wait.isOK());
+ wait.waitReset();
+
+ SyncUtil.step(StepType.STEP_RETURN);
+ stoppedEvent = SyncUtil.step(4, StepType.STEP_INTO);
+ final IFrameDMContext frameDmc3 = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ fExpService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- // First create the var object and all its children
- IExpressionDMContext parentDmc = fExpService.createExpression(frameDmc3, "z");
-
- fExpService.getSubExpressions(
- parentDmc,
- new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().length != 2) {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed getting children; expecting 2 got " + getData().length, null));
- } else {
+ // First create the var object and all its children
+ IExpressionDMContext parentDmc = fExpService.createExpression(frameDmc3, "z");
+
+ fExpService.getSubExpressions(parentDmc,
+ new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().length != 2) {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed getting children; expecting 2 got " + getData().length, null));
+ } else {
// now get the value of the child
- final String valueStr = "3";
- final IExpressionDMContext child = getData()[0];
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(child, IFormattedValues.NATURAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().getFormattedValue().equals(valueStr)) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating " + child.getExpression() + ", got " + getData().getFormattedValue()
- + " instead of " + valueStr, null));
- }
- }
-
- });
- }
-
-
- }
- });
- }
- });
-
- wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- assertTrue(wait.getMessage(), wait.isOK());
- wait.waitReset();
-
- }
-
- /**
- * This test verifies that the ExpressionService properly updates
- * children variables, when we do not update the parent explicitly
- */
- @Test
- public void testUpdatingChildren() throws Throwable {
- SyncUtil.runToLocation("testUpdateChildren");
- MIStoppedEvent stoppedEvent = SyncUtil.step(2, StepType.STEP_OVER);
- final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
- doUpdateTest(frameDmc, 0);
-
- // Re-run the test to test out-of-scope update again
- SyncUtil.step(StepType.STEP_RETURN);
- stoppedEvent = SyncUtil.step(3, StepType.STEP_INTO);
- final IFrameDMContext frameDmc2 = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
- doUpdateTest(frameDmc2, 100);
-
- // Re-run the test within a different method test out-of-scope updates
- SyncUtil.step(StepType.STEP_RETURN);
- stoppedEvent = SyncUtil.step(3, StepType.STEP_INTO);
- final IFrameDMContext frameDmc3 = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
- doUpdateTest(frameDmc3, 200);
-
- }
-
-
- public void doUpdateTest(final IFrameDMContext frameDmc, final int baseValue) throws Throwable {
- final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
-
- fExpService.getExecutor().submit(new Runnable() {
- @Override
+ final String valueStr = "3";
+ final IExpressionDMContext child = getData()[0];
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(child,
+ IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(),
+ null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().getFormattedValue().equals(valueStr)) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(new Status(IStatus.ERROR,
+ TestsPlugin.PLUGIN_ID,
+ "Failed evaluating " + child.getExpression() + ", got "
+ + getData().getFormattedValue() + " instead of "
+ + valueStr,
+ null));
+ }
+ }
+
+ });
+ }
+
+ }
+ });
+ }
+ });
+
+ wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ assertTrue(wait.getMessage(), wait.isOK());
+ wait.waitReset();
+
+ }
+
+ /**
+ * This test verifies that the ExpressionService properly updates
+ * children variables, when we do not update the parent explicitly
+ */
+ @Test
+ public void testUpdatingChildren() throws Throwable {
+ SyncUtil.runToLocation("testUpdateChildren");
+ MIStoppedEvent stoppedEvent = SyncUtil.step(2, StepType.STEP_OVER);
+ final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ doUpdateTest(frameDmc, 0);
+
+ // Re-run the test to test out-of-scope update again
+ SyncUtil.step(StepType.STEP_RETURN);
+ stoppedEvent = SyncUtil.step(3, StepType.STEP_INTO);
+ final IFrameDMContext frameDmc2 = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ doUpdateTest(frameDmc2, 100);
+
+ // Re-run the test within a different method test out-of-scope updates
+ SyncUtil.step(StepType.STEP_RETURN);
+ stoppedEvent = SyncUtil.step(3, StepType.STEP_INTO);
+ final IFrameDMContext frameDmc3 = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ doUpdateTest(frameDmc3, 200);
+
+ }
+
+ public void doUpdateTest(final IFrameDMContext frameDmc, final int baseValue) throws Throwable {
+ final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
+
+ fExpService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- // First create the var object and all its children
- IExpressionDMContext parentDmc = fExpService.createExpression(frameDmc, "a");
-
- fExpService.getSubExpressions(
- parentDmc,
- new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().length != 1) {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed getting children; expecting 1 got " + getData().length, null));
- } else {
- // Now list the children of this child
- fExpService.getSubExpressions(
- getData()[0],
- new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- final IExpressionDMContext[] childDmcs = getData();
-
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (childDmcs.length != 2) {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed getting children; expecting 2 got " + childDmcs.length, null));
- } else {
- // now get the value of the two children
- for (int i =0; i<2; i++) {
- final String valueStr = Integer.toString(baseValue + i + 10);
- final int finali = i;
-
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(childDmcs[i], IFormattedValues.NATURAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().getFormattedValue().equals(valueStr)) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating " + childDmcs[finali].getExpression() + ", got " + getData().getFormattedValue()
- + " instead of " + valueStr, null));
- }
- }
-
- });
- }
- }
- }
- });
- }
-
-
- }
- });
- }
- });
-
- wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- assertTrue(wait.getMessage(), wait.isOK());
- wait.waitReset();
-
- // Now step to change the value of a.z.x and a.z.y and verify the changed values.
- // This will confirm that the parent "a" will have been properly updated
- // It is a better test to do it for two children because it tests concurrent update requests
- MIStoppedEvent stoppedEvent = SyncUtil.step(2, StepType.STEP_OVER);
- final IFrameDMContext frameDmc2 = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
-
- fExpService.getExecutor().submit(new Runnable() {
- @Override
+ // First create the var object and all its children
+ IExpressionDMContext parentDmc = fExpService.createExpression(frameDmc, "a");
+
+ fExpService.getSubExpressions(parentDmc,
+ new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().length != 1) {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed getting children; expecting 1 got " + getData().length, null));
+ } else {
+ // Now list the children of this child
+ fExpService.getSubExpressions(getData()[0],
+ new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(),
+ null) {
+ @Override
+ protected void handleCompleted() {
+ final IExpressionDMContext[] childDmcs = getData();
+
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (childDmcs.length != 2) {
+ wait.waitFinished(
+ new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed getting children; expecting 2 got "
+ + childDmcs.length,
+ null));
+ } else {
+ // now get the value of the two children
+ for (int i = 0; i < 2; i++) {
+ final String valueStr = Integer
+ .toString(baseValue + i + 10);
+ final int finali = i;
+
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(childDmcs[i],
+ IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(
+ fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().getFormattedValue()
+ .equals(valueStr)) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(new Status(
+ IStatus.ERROR,
+ TestsPlugin.PLUGIN_ID,
+ "Failed evaluating "
+ + childDmcs[finali]
+ .getExpression()
+ + ", got "
+ + getData()
+ .getFormattedValue()
+ + " instead of "
+ + valueStr,
+ null));
+ }
+ }
+
+ });
+ }
+ }
+ }
+ });
+ }
+
+ }
+ });
+ }
+ });
+
+ wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ assertTrue(wait.getMessage(), wait.isOK());
+ wait.waitReset();
+
+ // Now step to change the value of a.z.x and a.z.y and verify the changed values.
+ // This will confirm that the parent "a" will have been properly updated
+ // It is a better test to do it for two children because it tests concurrent update requests
+ MIStoppedEvent stoppedEvent = SyncUtil.step(2, StepType.STEP_OVER);
+ final IFrameDMContext frameDmc2 = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+
+ fExpService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- // First create the var object and all its children
- IExpressionDMContext parentDmc = fExpService.createExpression(frameDmc2, "a");
-
- fExpService.getSubExpressions(
- parentDmc,
- new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().length != 1) {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed getting children; expecting 1 got " + getData().length, null));
- } else {
- // Now list the children of this child
- fExpService.getSubExpressions(
- getData()[0],
- new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- final IExpressionDMContext[] childDmcs = getData();
-
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (childDmcs.length != 2) {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed getting children; expecting 2 got " + childDmcs.length, null));
- } else {
- // now get the value of the two children
- for (int i =0; i<2; i++) {
- final String valueStr = Integer.toString(baseValue + i + 20);
- final int finali = i;
-
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(childDmcs[i], IFormattedValues.NATURAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().getFormattedValue().equals(valueStr)) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating " + childDmcs[finali].getExpression() + ", got " + getData().getFormattedValue()
- + " instead of " + valueStr, null));
- }
- }
-
- });
- }
- }
- }
- });
- }
-
-
- }
- });
- }
- });
-
- wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- assertTrue(wait.getMessage(), wait.isOK());
- wait.waitReset();
- }
-
- /**
- * This test creates a variable object with children (not an array) and then gets these children
- * to be deleted because of a large number of other variable objects being created.
- * We then check that the expression service can handle a request for one of those deleted children,
- * which has a complex path.
- */
- @Test
- public void testDeleteChildren() throws Throwable {
- assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_6_7);
- assumeGdbVersionLowerThen(ITestConstants.SUFFIX_GDB_7_3);
-
- SyncUtil.runToLocation("testDeleteChildren");
- MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
- final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
-
- final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
-
- fExpService.getExecutor().submit(new Runnable() {
- @Override
+ // First create the var object and all its children
+ IExpressionDMContext parentDmc = fExpService.createExpression(frameDmc2, "a");
+
+ fExpService.getSubExpressions(parentDmc,
+ new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().length != 1) {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed getting children; expecting 1 got " + getData().length, null));
+ } else {
+ // Now list the children of this child
+ fExpService.getSubExpressions(getData()[0],
+ new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(),
+ null) {
+ @Override
+ protected void handleCompleted() {
+ final IExpressionDMContext[] childDmcs = getData();
+
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (childDmcs.length != 2) {
+ wait.waitFinished(
+ new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed getting children; expecting 2 got "
+ + childDmcs.length,
+ null));
+ } else {
+ // now get the value of the two children
+ for (int i = 0; i < 2; i++) {
+ final String valueStr = Integer
+ .toString(baseValue + i + 20);
+ final int finali = i;
+
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(childDmcs[i],
+ IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(
+ fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().getFormattedValue()
+ .equals(valueStr)) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(new Status(
+ IStatus.ERROR,
+ TestsPlugin.PLUGIN_ID,
+ "Failed evaluating "
+ + childDmcs[finali]
+ .getExpression()
+ + ", got "
+ + getData()
+ .getFormattedValue()
+ + " instead of "
+ + valueStr,
+ null));
+ }
+ }
+
+ });
+ }
+ }
+ }
+ });
+ }
+
+ }
+ });
+ }
+ });
+
+ wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ assertTrue(wait.getMessage(), wait.isOK());
+ wait.waitReset();
+ }
+
+ /**
+ * This test creates a variable object with children (not an array) and then gets these children
+ * to be deleted because of a large number of other variable objects being created.
+ * We then check that the expression service can handle a request for one of those deleted children,
+ * which has a complex path.
+ */
+ @Test
+ public void testDeleteChildren() throws Throwable {
+ assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_6_7);
+ assumeGdbVersionLowerThen(ITestConstants.SUFFIX_GDB_7_3);
+
+ SyncUtil.runToLocation("testDeleteChildren");
+ MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
+ final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+
+ final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
+
+ fExpService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- // First create the var object and all its children
- IExpressionDMContext parentDmc = fExpService.createExpression(frameDmc, "f");
-
- fExpService.getSubExpressions(
- parentDmc,
- new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- if (getData().length != 5) {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed getting children; expecting 5 got " + getData().length, null));
- } else {
- String childStr = "((bar) f)";
- if (!getData()[0].getExpression().equals(childStr)) {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Got child " + getData()[0].getExpression() + " instead of " + childStr, null));
- } else {
- // Now list the children of the first element
- fExpService.getSubExpressions(
- getData()[0],
- new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- if (getData().length != 2) {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed getting children; expecting 2 got " + getData().length, null));
- } else {
- String childStr = "((((bar) f)).d)";
- if (!getData()[0].getExpression().equals(childStr)) {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Got child " + getData()[0].getExpression() + " instead of " + childStr, null));
- } else {
- wait.setReturnInfo(getData()[0]);
- wait.waitFinished();
- }
- }
- }
- }
- });
- }
- }
- }
- }
- });
- }
- });
-
- wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- assertTrue(wait.getMessage(), wait.isOK());
- final IExpressionDMContext deletedChildDmc = (IExpressionDMContext)wait.getReturnInfo();
-
- wait.waitReset();
-
- fExpService.getExecutor().submit(new Runnable() {
- @Override
+ // First create the var object and all its children
+ IExpressionDMContext parentDmc = fExpService.createExpression(frameDmc, "f");
+
+ fExpService.getSubExpressions(parentDmc,
+ new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().length != 5) {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed getting children; expecting 5 got " + getData().length, null));
+ } else {
+ String childStr = "((bar) f)";
+ if (!getData()[0].getExpression().equals(childStr)) {
+ wait.waitFinished(new Status(
+ IStatus.ERROR, TestsPlugin.PLUGIN_ID, "Got child "
+ + getData()[0].getExpression() + " instead of " + childStr,
+ null));
+ } else {
+ // Now list the children of the first element
+ fExpService.getSubExpressions(getData()[0],
+ new DataRequestMonitor<IExpressionDMContext[]>(
+ fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().length != 2) {
+ wait.waitFinished(new Status(IStatus.ERROR,
+ TestsPlugin.PLUGIN_ID,
+ "Failed getting children; expecting 2 got "
+ + getData().length,
+ null));
+ } else {
+ String childStr = "((((bar) f)).d)";
+ if (!getData()[0].getExpression()
+ .equals(childStr)) {
+ wait.waitFinished(new Status(IStatus.ERROR,
+ TestsPlugin.PLUGIN_ID,
+ "Got child "
+ + getData()[0].getExpression()
+ + " instead of " + childStr,
+ null));
+ } else {
+ wait.setReturnInfo(getData()[0]);
+ wait.waitFinished();
+ }
+ }
+ }
+ }
+ });
+ }
+ }
+ }
+ }
+ });
+ }
+ });
+
+ wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ assertTrue(wait.getMessage(), wait.isOK());
+ final IExpressionDMContext deletedChildDmc = (IExpressionDMContext) wait.getReturnInfo();
+
+ wait.waitReset();
+
+ fExpService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- // Now create more than 1000 expressions to trigger the deletion of the children
- // that were created above
- for (int i=0; i<1100; i++) {
- IExpressionDMContext dmc = fExpService.createExpression(frameDmc, "a[" + i + "]");
-
- wait.increment();
- fExpService.getExpressionData(
- dmc,
- new DataRequestMonitor<IExpressionDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- wait.waitFinished();
- }
- }
- });
- }
- }
- });
-
- wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- assertTrue(wait.getMessage(), wait.isOK());
- wait.waitReset();
-
- fExpService.getExecutor().submit(new Runnable() {
- @Override
+ // Now create more than 1000 expressions to trigger the deletion of the children
+ // that were created above
+ for (int i = 0; i < 1100; i++) {
+ IExpressionDMContext dmc = fExpService.createExpression(frameDmc, "a[" + i + "]");
+
+ wait.increment();
+ fExpService.getExpressionData(dmc,
+ new DataRequestMonitor<IExpressionDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ wait.waitFinished();
+ }
+ }
+ });
+ }
+ }
+ });
+
+ wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ assertTrue(wait.getMessage(), wait.isOK());
+ wait.waitReset();
+
+ fExpService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- // Evaluate the expression of a child that we know is deleted to make sure
- // the expression service can handle that
- fExpService.getExpressionData(
- deletedChildDmc,
- new DataRequestMonitor<IExpressionDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- wait.waitFinished();
- }
- }
- });
- }
- });
-
- wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- assertTrue(wait.getMessage(), wait.isOK());
- wait.waitReset();
-
- }
-
- /**
+ // Evaluate the expression of a child that we know is deleted to make sure
+ // the expression service can handle that
+ fExpService.getExpressionData(deletedChildDmc,
+ new DataRequestMonitor<IExpressionDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ wait.waitFinished();
+ }
+ }
+ });
+ }
+ });
+
+ wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ assertTrue(wait.getMessage(), wait.isOK());
+ wait.waitReset();
+
+ }
+
+ /**
* GDB 6.7 has a bug which will cause var-update not to show
* the new value of 'a' if we switch the format to binary,
* since binary of 3 is 11 which is the same as the old value
* in natural format. Our expression service should work around this.
- *
+ *
* int main() {
* int a = 11;
* a = 3;
* return 0;
* }
- */
- @Test
- public void testUpdateGDBBug() throws Throwable {
- SyncUtil.runToLocation("testUpdateGDBBug");
- MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
- final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
-
- final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
-
- fExpService.getExecutor().submit(new Runnable() {
- @Override
+ */
+ @Test
+ public void testUpdateGDBBug() throws Throwable {
+ SyncUtil.runToLocation("testUpdateGDBBug");
+ MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
+ final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+
+ final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
+
+ fExpService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- // First create the var object and all its children
- IExpressionDMContext exprDmc = fExpService.createExpression(frameDmc, "a");
-
- // This call will create the variable object in natural format and then change
- // it to binary to fetch the value
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(exprDmc, IFormattedValues.BINARY_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- if (getData().getFormattedValue().equals("1011")) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating binary format, expected 1011 but got " +
- getData().getFormattedValue(), null));
- }
- }
- }
- });
- }
- });
-
- wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- assertTrue(wait.getMessage(), wait.isOK());
- wait.waitReset();
-
- // Now step to change the value of "a" and ask for it again
- stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
- final IFrameDMContext frameDmc2 = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
-
- fExpService.getExecutor().submit(new Runnable() {
- @Override
+ // First create the var object and all its children
+ IExpressionDMContext exprDmc = fExpService.createExpression(frameDmc, "a");
+
+ // This call will create the variable object in natural format and then change
+ // it to binary to fetch the value
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.BINARY_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals("1011")) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating binary format, expected 1011 but got "
+ + getData().getFormattedValue(),
+ null));
+ }
+ }
+ }
+ });
+ }
+ });
+
+ wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ assertTrue(wait.getMessage(), wait.isOK());
+ wait.waitReset();
+
+ // Now step to change the value of "a" and ask for it again
+ stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
+ final IFrameDMContext frameDmc2 = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+
+ fExpService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- // First create the var object and all its children
- IExpressionDMContext exprDmc = fExpService.createExpression(frameDmc2, "a");
-
- // This call will create the variable object in natural format and then change
- // it to binary to fetch the value
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(exprDmc, IFormattedValues.BINARY_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- if (getData().getFormattedValue().equals("11")) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating binary format, expected 11 but got " +
- getData().getFormattedValue(), null));
- }
- }
- }
- });
- }
- });
-
- wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- assertTrue(wait.getMessage(), wait.isOK());
- wait.waitReset();
- }
-
- /**
+ // First create the var object and all its children
+ IExpressionDMContext exprDmc = fExpService.createExpression(frameDmc2, "a");
+
+ // This call will create the variable object in natural format and then change
+ // it to binary to fetch the value
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.BINARY_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals("11")) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating binary format, expected 11 but got "
+ + getData().getFormattedValue(),
+ null));
+ }
+ }
+ }
+ });
+ }
+ });
+
+ wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ assertTrue(wait.getMessage(), wait.isOK());
+ wait.waitReset();
+ }
+
+ /**
* var-update will not show a change if eval-expression is the same
* in the current format. This is a problem for us because we don't
* know if another format changed:
- *
+ *
* int main() {
* double a = 1.99;
* a = 1.11;
* }
- *
+ *
* If a is displayed in anything but natural, both values of a are the same
* and we won't know it changed in the natural format.
- *
+ *
* The test below is in case GDB fixes var-update to keep track of the last
* printed value through eval-expression. Until they do that, we do not have
* a problem because of our caching: where, if we change formats since the last
@@ -2090,181 +2155,191 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
* So, the -var-update will show a change because of the new current format.
* But if GDB has eval-expression reset their stored printed_value, this test
* will fail and we'll know we have to fix something.
- */
- @Test
- public void testUpdateIssue() throws Throwable {
- SyncUtil.runToLocation("testUpdateIssue");
- MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
- final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
-
- final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
-
- fExpService.getExecutor().submit(new Runnable() {
- @Override
+ */
+ @Test
+ public void testUpdateIssue() throws Throwable {
+ SyncUtil.runToLocation("testUpdateIssue");
+ MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
+ final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+
+ final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
+
+ fExpService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- // First create the var object and all its children
- IExpressionDMContext exprDmc = fExpService.createExpression(frameDmc, "a");
-
- // check that we have the proper value
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(exprDmc, IFormattedValues.NATURAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- if (getData().getFormattedValue().equals("1.99")) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating a, expected 1.99 but got " +
- getData().getFormattedValue(), null));
- }
- }
- }
- });
-
- // ask for hex to set the format to hex
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(exprDmc, IFormattedValues.HEX_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- if (getData().getFormattedValue().equals("0x1")) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating a, expected 0x1 but got " +
- getData().getFormattedValue(), null));
- }
- }
- }
- });
- }
- });
-
- wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- assertTrue(wait.getMessage(), wait.isOK());
- wait.waitReset();
-
- // Now step to change the value of "a" and ask for it again but in the natural format
- stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
- final IFrameDMContext frameDmc2 = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
-
- fExpService.getExecutor().submit(new Runnable() {
- @Override
+ // First create the var object and all its children
+ IExpressionDMContext exprDmc = fExpService.createExpression(frameDmc, "a");
+
+ // check that we have the proper value
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals("1.99")) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating a, expected 1.99 but got "
+ + getData().getFormattedValue(),
+ null));
+ }
+ }
+ }
+ });
+
+ // ask for hex to set the format to hex
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.HEX_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals("0x1")) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating a, expected 0x1 but got "
+ + getData().getFormattedValue(),
+ null));
+ }
+ }
+ }
+ });
+ }
+ });
+
+ wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ assertTrue(wait.getMessage(), wait.isOK());
+ wait.waitReset();
+
+ // Now step to change the value of "a" and ask for it again but in the natural format
+ stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
+ final IFrameDMContext frameDmc2 = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+
+ fExpService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- // First create the var object and all its children
- IExpressionDMContext exprDmc = fExpService.createExpression(frameDmc2, "a");
-
- // trigger the var-update in the last format (hex)
- // then request the actual value in natural which should not be taken from the cache
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(exprDmc, IFormattedValues.NATURAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- if (getData().getFormattedValue().equals("1.22")) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating natural format, expected 1.22 but got " +
- getData().getFormattedValue(), null));
- }
- }
- }
- });
- }
- });
-
- wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- assertTrue(wait.getMessage(), wait.isOK());
- wait.waitReset();
- }
-
- /**
+ // First create the var object and all its children
+ IExpressionDMContext exprDmc = fExpService.createExpression(frameDmc2, "a");
+
+ // trigger the var-update in the last format (hex)
+ // then request the actual value in natural which should not be taken from the cache
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(exprDmc, IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals("1.22")) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating natural format, expected 1.22 but got "
+ + getData().getFormattedValue(),
+ null));
+ }
+ }
+ }
+ });
+ }
+ });
+
+ wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ assertTrue(wait.getMessage(), wait.isOK());
+ wait.waitReset();
+ }
+
+ /**
* var-update will not show a change if eval-expression is the same
* in the current format. This is a problem for us because we don't
* know if another format changed:
- *
+ *
* int main() {
* struct {
* double d;
* } z;
- *
+ *
* z.d = 1.0;
* z.d = 1.22;
* }
- *
+ *
* If a is displayed in anything but natural, both values of a are the same
* and we won't know it changed in the natural format.
* This test uses a child to increase the value of the test.
* Also, it avoids the cache saving us since we start with the 1.0 value
* which is the same in natural and decimal
- */
- @Test
- public void testUpdateIssue2() throws Throwable {
- SyncUtil.runToLocation("testUpdateIssue2");
- MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
- final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
-
- final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
-
- fExpService.getExecutor().submit(new Runnable() {
- @Override
+ */
+ @Test
+ public void testUpdateIssue2() throws Throwable {
+ SyncUtil.runToLocation("testUpdateIssue2");
+ MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
+ final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+
+ final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
+
+ fExpService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
-
- IExpressionDMContext parentDmc = fExpService.createExpression(frameDmc, "z");
-
- fExpService.getSubExpressions(
- parentDmc,
- new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().length != 1) {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed getting children; expecting 1 got " + getData().length, null));
- } else {
- // check that we have the proper value
- // This will cache the value 1 in the natural format cache
- final String valueStr = "1";
- globalExpressionCtx1 = getData()[0];
-
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(globalExpressionCtx1, IFormattedValues.NATURAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().getFormattedValue().equals(valueStr)) {
+
+ IExpressionDMContext parentDmc = fExpService.createExpression(frameDmc, "z");
+
+ fExpService.getSubExpressions(parentDmc,
+ new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().length != 1) {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed getting children; expecting 1 got " + getData().length, null));
+ } else {
+ // check that we have the proper value
+ // This will cache the value 1 in the natural format cache
+ final String valueStr = "1";
+ globalExpressionCtx1 = getData()[0];
+
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(globalExpressionCtx1,
+ IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(),
+ null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().getFormattedValue().equals(valueStr)) {
wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating " + globalExpressionCtx1.getExpression() + ", got " + getData().getFormattedValue()
- + " instead of " + valueStr, null));
- }
- }
- });
-
- // ask for decimal to set the format to decimal
- wait.increment();
+ } else {
+ wait.waitFinished(new Status(IStatus.ERROR,
+ TestsPlugin.PLUGIN_ID,
+ "Failed evaluating "
+ + globalExpressionCtx1.getExpression()
+ + ", got " + getData().getFormattedValue()
+ + " instead of " + valueStr,
+ null));
+ }
+ }
+ });
+
+ // ask for decimal to set the format to decimal
+ wait.increment();
fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(globalExpressionCtx1, IFormattedValues.DECIMAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ fExpService.getFormattedValueContext(globalExpressionCtx1,
+ IFormattedValues.DECIMAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(),
+ null) {
@Override
protected void handleCompleted() {
if (!isSuccess()) {
@@ -2273,330 +2348,350 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
if (getData().getFormattedValue().equals(valueStr)) {
wait.waitFinished();
} else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating " + globalExpressionCtx1.getExpression() + ", got " + getData().getFormattedValue()
- + " instead of " + valueStr, null));
+ wait.waitFinished(new Status(IStatus.ERROR,
+ TestsPlugin.PLUGIN_ID,
+ "Failed evaluating "
+ + globalExpressionCtx1.getExpression()
+ + ", got " + getData().getFormattedValue()
+ + " instead of " + valueStr,
+ null));
}
}
}
});
- }
- }
- });
- }
- });
-
- wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- assertTrue(wait.getMessage(), wait.isOK());
- wait.waitReset();
-
- // Now step to change the value of "a" in natural but it remains the same in decimal
- SyncUtil.step(1, StepType.STEP_OVER);
-
- fExpService.getExecutor().submit(new Runnable() {
- @Override
+ }
+ }
+ });
+ }
+ });
+
+ wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ assertTrue(wait.getMessage(), wait.isOK());
+ wait.waitReset();
+
+ // Now step to change the value of "a" in natural but it remains the same in decimal
+ SyncUtil.step(1, StepType.STEP_OVER);
+
+ fExpService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- // trigger the var-update in the last format (decimal)
- // then request the actual value in natural which should not be taken from the cache
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(globalExpressionCtx1, IFormattedValues.NATURAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- if (getData().getFormattedValue().equals("1.22")) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating natural format, expected 1.22 but got " +
- getData().getFormattedValue(), null));
- }
- }
- }
- });
- }
- });
-
- wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- assertTrue(wait.getMessage(), wait.isOK());
- wait.waitReset();
- }
-
- /**
- * This test verifies the state handling of a child variable object
- * to make sure that our locking scheme works even though we must deal
- * with an update call, internally
- */
- @Test
- public void testConcurrentReadAndUpdateChild() throws Throwable {
- SyncUtil.runToLocation("testConcurrentReadAndUpdateChild");
- MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
- final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
-
- final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
-
- // Ask for one value to create the var object
- fExpService.getExecutor().submit(new Runnable() {
- @Override
+ // trigger the var-update in the last format (decimal)
+ // then request the actual value in natural which should not be taken from the cache
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(globalExpressionCtx1, IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ if (getData().getFormattedValue().equals("1.22")) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating natural format, expected 1.22 but got "
+ + getData().getFormattedValue(),
+ null));
+ }
+ }
+ }
+ });
+ }
+ });
+
+ wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ assertTrue(wait.getMessage(), wait.isOK());
+ wait.waitReset();
+ }
+
+ /**
+ * This test verifies the state handling of a child variable object
+ * to make sure that our locking scheme works even though we must deal
+ * with an update call, internally
+ */
+ @Test
+ public void testConcurrentReadAndUpdateChild() throws Throwable {
+ SyncUtil.runToLocation("testConcurrentReadAndUpdateChild");
+ MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
+ final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+
+ final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
+
+ // Ask for one value to create the var object
+ fExpService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- // First create the var object and all its children
- IExpressionDMContext parentDmc = fExpService.createExpression(frameDmc, "z");
-
- wait.increment();
- fExpService.getSubExpressions(
- parentDmc,
- new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().length != 1) {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed getting children; expecting 1 got " + getData().length, null));
- } else {
+ // First create the var object and all its children
+ IExpressionDMContext parentDmc = fExpService.createExpression(frameDmc, "z");
+
+ wait.increment();
+ fExpService.getSubExpressions(parentDmc,
+ new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().length != 1) {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed getting children; expecting 1 got " + getData().length, null));
+ } else {
// now get the value of the child
- final String valueStr = "01";
- globalExpressionCtx1 = getData()[0];
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(globalExpressionCtx1, IFormattedValues.OCTAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().getFormattedValue().equals(valueStr)) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating " + globalExpressionCtx1.getExpression() + ", got " + getData().getFormattedValue()
- + " instead of " + valueStr, null));
- }
- }
- });
- }
- }
- });
- }
- });
-
- wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- assertTrue(wait.getMessage(), wait.isOK());
- wait.waitReset();
-
- // Now do two reads in two different formats
- // We need to make sure that the locking properly works although we are calling
- // the internal update method, which does affect the state of the object
- fExpService.getExecutor().submit(new Runnable() {
- @Override
+ final String valueStr = "01";
+ globalExpressionCtx1 = getData()[0];
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(globalExpressionCtx1,
+ IFormattedValues.OCTAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(),
+ null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().getFormattedValue().equals(valueStr)) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(new Status(IStatus.ERROR,
+ TestsPlugin.PLUGIN_ID,
+ "Failed evaluating "
+ + globalExpressionCtx1.getExpression()
+ + ", got " + getData().getFormattedValue()
+ + " instead of " + valueStr,
+ null));
+ }
+ }
+ });
+ }
+ }
+ });
+ }
+ });
+
+ wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ assertTrue(wait.getMessage(), wait.isOK());
+ wait.waitReset();
+
+ // Now do two reads in two different formats
+ // We need to make sure that the locking properly works although we are calling
+ // the internal update method, which does affect the state of the object
+ fExpService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(globalExpressionCtx1, IFormattedValues.BINARY_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(globalExpressionCtx1, IFormattedValues.BINARY_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
final String valueStr = "1";
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().getFormattedValue().equals(valueStr)) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating " + globalExpressionCtx1.getExpression() + ", got " + getData().getFormattedValue()
- + " instead of " + valueStr, null));
- }
- }
- });
-
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(globalExpressionCtx1, IFormattedValues.HEX_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().getFormattedValue().equals(valueStr)) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating " + globalExpressionCtx1.getExpression() + ", got "
+ + getData().getFormattedValue() + " instead of " + valueStr,
+ null));
+ }
+ }
+ });
+
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(globalExpressionCtx1, IFormattedValues.HEX_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
final String valueStr = "0x1";
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().getFormattedValue().equals(valueStr)) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating " + globalExpressionCtx1.getExpression() + ", got " + getData().getFormattedValue()
- + " instead of " + valueStr, null));
- }
- }
-
- });
- }
- });
-
- wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- assertTrue(wait.getMessage(), wait.isOK());
- wait.waitReset();
- }
-
- /**
- * This test verifies some of the logic of dealing with out-of-scope variables.
- * This particular scenario is that we create a parent with a child and then
- * have them go out of scope. Then we request the child which will update the parent
- * and mark it as out-of-scope and recreate the child. The parent is not re-created.
- * We then ask twice for the parent which is already known to be out-of-scope and we need
- * to make sure that the parent is re-created once and only once.
- * We had a bug where we would enter an infinite loop in this case.
- */
- @Test
- public void testConcurrentUpdateOutOfScopeChildThenParent() throws Throwable {
- SyncUtil.runToLocation("testConcurrentUpdateOutOfScopeChildThenParent");
- MIStoppedEvent stoppedEvent = SyncUtil.step(2, StepType.STEP_INTO);
-
- final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
-
- final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
-
- fExpService.getExecutor().submit(new Runnable() {
- @Override
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().getFormattedValue().equals(valueStr)) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating " + globalExpressionCtx1.getExpression() + ", got "
+ + getData().getFormattedValue() + " instead of " + valueStr,
+ null));
+ }
+ }
+
+ });
+ }
+ });
+
+ wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ assertTrue(wait.getMessage(), wait.isOK());
+ wait.waitReset();
+ }
+
+ /**
+ * This test verifies some of the logic of dealing with out-of-scope variables.
+ * This particular scenario is that we create a parent with a child and then
+ * have them go out of scope. Then we request the child which will update the parent
+ * and mark it as out-of-scope and recreate the child. The parent is not re-created.
+ * We then ask twice for the parent which is already known to be out-of-scope and we need
+ * to make sure that the parent is re-created once and only once.
+ * We had a bug where we would enter an infinite loop in this case.
+ */
+ @Test
+ public void testConcurrentUpdateOutOfScopeChildThenParent() throws Throwable {
+ SyncUtil.runToLocation("testConcurrentUpdateOutOfScopeChildThenParent");
+ MIStoppedEvent stoppedEvent = SyncUtil.step(2, StepType.STEP_INTO);
+
+ final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+
+ final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
+
+ fExpService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- // First create the var object and its child
- globalExpressionCtx1 = fExpService.createExpression(frameDmc, "z");
-
- wait.increment();
- fExpService.getSubExpressions(
- globalExpressionCtx1,
- new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().length != 1) {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed getting children; expecting 1 got " + getData().length, null));
- } else {
+ // First create the var object and its child
+ globalExpressionCtx1 = fExpService.createExpression(frameDmc, "z");
+
+ wait.increment();
+ fExpService.getSubExpressions(globalExpressionCtx1,
+ new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().length != 1) {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed getting children; expecting 1 got " + getData().length, null));
+ } else {
// now get the value of the child
- final String valueStr = "1";
- globalExpressionCtx2 = getData()[0];
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(globalExpressionCtx2, IFormattedValues.NATURAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().getFormattedValue().equals(valueStr)) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating " + globalExpressionCtx2.getExpression() + ", got " + getData().getFormattedValue()
- + " instead of " + valueStr, null));
- }
- }
- });
- }
- }
- });
- }
- });
-
- wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
- assertTrue(wait.getMessage(), wait.isOK());
- wait.waitReset();
-
- SyncUtil.step(StepType.STEP_RETURN);
- stoppedEvent = SyncUtil.step(2, StepType.STEP_INTO);
-
- // Now step to another method to make the previous variable objects out-of-scope
- // then first request the child and then the parent. We want to test this order
- fExpService.getExecutor().submit(new Runnable() {
- @Override
+ final String valueStr = "1";
+ globalExpressionCtx2 = getData()[0];
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(globalExpressionCtx2,
+ IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(),
+ null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().getFormattedValue().equals(valueStr)) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(new Status(IStatus.ERROR,
+ TestsPlugin.PLUGIN_ID,
+ "Failed evaluating "
+ + globalExpressionCtx2.getExpression()
+ + ", got " + getData().getFormattedValue()
+ + " instead of " + valueStr,
+ null));
+ }
+ }
+ });
+ }
+ }
+ });
+ }
+ });
+
+ wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
+ assertTrue(wait.getMessage(), wait.isOK());
+ wait.waitReset();
+
+ SyncUtil.step(StepType.STEP_RETURN);
+ stoppedEvent = SyncUtil.step(2, StepType.STEP_INTO);
+
+ // Now step to another method to make the previous variable objects out-of-scope
+ // then first request the child and then the parent. We want to test this order
+ fExpService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(globalExpressionCtx2, IFormattedValues.NATURAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(globalExpressionCtx2, IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
final String valueStr = "2";
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().getFormattedValue().equals(valueStr)) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating " + globalExpressionCtx2.getExpression() + ", got " + getData().getFormattedValue()
- + " instead of " + valueStr, null));
- }
- }
- });
- }
- });
-
- wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
- assertTrue(wait.getMessage(), wait.isOK());
- wait.waitReset();
-
- fExpService.getExecutor().submit(new Runnable() {
- @Override
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().getFormattedValue().equals(valueStr)) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating " + globalExpressionCtx2.getExpression() + ", got "
+ + getData().getFormattedValue() + " instead of " + valueStr,
+ null));
+ }
+ }
+ });
+ }
+ });
+
+ wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
+ assertTrue(wait.getMessage(), wait.isOK());
+ wait.waitReset();
+
+ fExpService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(globalExpressionCtx1, IFormattedValues.NATURAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(globalExpressionCtx1, IFormattedValues.NATURAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
final String valueStr = "{...}";
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().getFormattedValue().equals(valueStr)) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating " + globalExpressionCtx1.getExpression() + ", got " + getData().getFormattedValue()
- + " instead of " + valueStr, null));
- }
- }
- });
-
- // Ask a second time but in a different format, to avoid the cache
- wait.increment();
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(globalExpressionCtx1, IFormattedValues.DECIMAL_FORMAT),
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().getFormattedValue().equals(valueStr)) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating " + globalExpressionCtx1.getExpression() + ", got "
+ + getData().getFormattedValue() + " instead of " + valueStr,
+ null));
+ }
+ }
+ });
+
+ // Ask a second time but in a different format, to avoid the cache
+ wait.increment();
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(globalExpressionCtx1, IFormattedValues.DECIMAL_FORMAT),
+ new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
final String valueStr = "{...}";
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData().getFormattedValue().equals(valueStr)) {
- wait.waitFinished();
- } else {
- wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed evaluating " + globalExpressionCtx1.getExpression() + ", got " + getData().getFormattedValue()
- + " instead of " + valueStr, null));
- }
- }
- });
-
- }
- });
-
- wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
- assertTrue(wait.getMessage(), wait.isOK());
- wait.waitReset();
-
- //TODO although this test passes, the variable z is created twice, without being
- // deleted in GDB. We should fix this
- }
-
- /**
- * This test verifies that we properly update a pointer and its child since they can both
- * change and be reported by var-update
- */
- @Test
- public void testUpdateOfPointer() throws Throwable {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData().getFormattedValue().equals(valueStr)) {
+ wait.waitFinished();
+ } else {
+ wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Failed evaluating " + globalExpressionCtx1.getExpression() + ", got "
+ + getData().getFormattedValue() + " instead of " + valueStr,
+ null));
+ }
+ }
+ });
+
+ }
+ });
+
+ wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
+ assertTrue(wait.getMessage(), wait.isOK());
+ wait.waitReset();
+
+ //TODO although this test passes, the variable z is created twice, without being
+ // deleted in GDB. We should fix this
+ }
+
+ /**
+ * This test verifies that we properly update a pointer and its child since they can both
+ * change and be reported by var-update
+ */
+ @Test
+ public void testUpdateOfPointer() throws Throwable {
/* Places we're going to run to. */
String tag1 = String.format("%s:%d", SOURCE_NAME, getLineForTag("testUpdateOfPointer_1"));
String tag2 = String.format("%s:%d", SOURCE_NAME, getLineForTag("testUpdateOfPointer_2"));
@@ -2638,16 +2733,16 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
/* Get the value pointed by the pointer field. */
pointeeActualValue = SyncUtil.getExpressionValue(pointeeDmc, IFormattedValues.NATURAL_FORMAT);
assertThat(pointeeActualValue, is("3"));
- }
+ }
- /**
+ /**
* This test is similar to {@link #testUpdateOfPointer()
* testUpdateOfPointer}, but uses a pointer declared using a typedef. We
* test both a pointer that is a root varobj (a variable) and a pointer that
* is a child varobj (field in a structure).
*/
- @Test
- public void testUpdateOfPointerTypedef() throws Throwable {
+ @Test
+ public void testUpdateOfPointerTypedef() throws Throwable {
/* Places we're going to run to. */
String tag1 = String.format("%s:%d", SOURCE_NAME, getLineForTag("testUpdateOfPointerTypedef_1"));
String tag2 = String.format("%s:%d", SOURCE_NAME, getLineForTag("testUpdateOfPointerTypedef_2"));
@@ -2671,8 +2766,10 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
String pointerFieldValue1 = SyncUtil.getExpressionValue(pointerFieldDmc, IFormattedValues.NATURAL_FORMAT);
/* Verify the pointed values. */
- String pointerVarTargetValue = SyncUtil.getExpressionValue(pointerVarTargetDmc, IFormattedValues.NATURAL_FORMAT);
- String pointerFieldTargetValue = SyncUtil.getExpressionValue(pointerFieldTargetDmc, IFormattedValues.NATURAL_FORMAT);
+ String pointerVarTargetValue = SyncUtil.getExpressionValue(pointerVarTargetDmc,
+ IFormattedValues.NATURAL_FORMAT);
+ String pointerFieldTargetValue = SyncUtil.getExpressionValue(pointerFieldTargetDmc,
+ IFormattedValues.NATURAL_FORMAT);
assertThat(pointerVarTargetValue, is("1"));
assertThat(pointerFieldTargetValue, is("2"));
@@ -2690,134 +2787,134 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
pointerFieldTargetValue = SyncUtil.getExpressionValue(pointerFieldTargetDmc, IFormattedValues.NATURAL_FORMAT);
assertThat(pointerVarTargetValue, is("3"));
assertThat(pointerFieldTargetValue, is("4"));
- }
+ }
- /**
- * This test verifies that we properly return if we can write to different expressions
- */
- @Test
- public void testCanWrite() throws Throwable {
- MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("testCanWrite");
- final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ /**
+ * This test verifies that we properly return if we can write to different expressions
+ */
+ @Test
+ public void testCanWrite() throws Throwable {
+ MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("testCanWrite");
+ final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
- final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
+ final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
- fExpService.getExecutor().submit(new Runnable() {
- @Override
+ fExpService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- final int exprCount = 5;
- final IExpressionDMContext dmcs[] = new IExpressionDMContext[exprCount];
- final boolean expectedValues[] = new boolean[exprCount];
-
- int exprIndex = 0;
- dmcs[exprIndex] = fExpService.createExpression(frameDmc, "a");
- expectedValues[exprIndex] = true;
- exprIndex++;
- dmcs[exprIndex] = fExpService.createExpression(frameDmc, "b");
- expectedValues[exprIndex] = true;
- exprIndex++;
- dmcs[exprIndex] = fExpService.createExpression(frameDmc, "c");
- expectedValues[exprIndex] = false;
- exprIndex++;
- dmcs[exprIndex] = fExpService.createExpression(frameDmc, "d");
- expectedValues[exprIndex] = false;
- exprIndex++;
- dmcs[exprIndex] = fExpService.createExpression(frameDmc, "d[1]");
- expectedValues[exprIndex] = true;
- exprIndex++;
-
- for (int index = 0; index < exprCount; index++) {
- final int finalIndex = index;
- wait.increment();
- fExpService.canWriteExpression(
- dmcs[finalIndex],
- new DataRequestMonitor<Boolean>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData() == expectedValues[finalIndex]) {
+ final int exprCount = 5;
+ final IExpressionDMContext dmcs[] = new IExpressionDMContext[exprCount];
+ final boolean expectedValues[] = new boolean[exprCount];
+
+ int exprIndex = 0;
+ dmcs[exprIndex] = fExpService.createExpression(frameDmc, "a");
+ expectedValues[exprIndex] = true;
+ exprIndex++;
+ dmcs[exprIndex] = fExpService.createExpression(frameDmc, "b");
+ expectedValues[exprIndex] = true;
+ exprIndex++;
+ dmcs[exprIndex] = fExpService.createExpression(frameDmc, "c");
+ expectedValues[exprIndex] = false;
+ exprIndex++;
+ dmcs[exprIndex] = fExpService.createExpression(frameDmc, "d");
+ expectedValues[exprIndex] = false;
+ exprIndex++;
+ dmcs[exprIndex] = fExpService.createExpression(frameDmc, "d[1]");
+ expectedValues[exprIndex] = true;
+ exprIndex++;
+
+ for (int index = 0; index < exprCount; index++) {
+ final int finalIndex = index;
+ wait.increment();
+ fExpService.canWriteExpression(dmcs[finalIndex],
+ new DataRequestMonitor<Boolean>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData() == expectedValues[finalIndex]) {
wait.waitFinished();
} else {
wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed establishing proper canWrite for " + dmcs[finalIndex].getExpression() +
- ", got " + getData() + " instead of " + expectedValues[finalIndex], null));
+ "Failed establishing proper canWrite for "
+ + dmcs[finalIndex].getExpression() + ", got " + getData()
+ + " instead of " + expectedValues[finalIndex],
+ null));
}
+ }
+ });
+ }
+ }
+ });
- }
- });
- }
- }
- });
-
- wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- assertTrue(wait.getMessage(), wait.isOK());
- wait.waitReset();
- }
+ wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ assertTrue(wait.getMessage(), wait.isOK());
+ wait.waitReset();
+ }
- /**
- * This test verifies that we properly return if we can write to an expression
- * that is an L-Value or a Constant
- */
- @Test
- public void testCanWriteLValue() throws Throwable {
- assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_6_8);
- MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("testCanWrite"); // Re-use test
- final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ /**
+ * This test verifies that we properly return if we can write to an expression
+ * that is an L-Value or a Constant
+ */
+ @Test
+ public void testCanWriteLValue() throws Throwable {
+ assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_6_8);
+ MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("testCanWrite"); // Re-use test
+ final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
- final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
+ final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
- fExpService.getExecutor().submit(new Runnable() {
- @Override
+ fExpService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- final int exprCount = 2;
- final IExpressionDMContext dmcs[] = new IExpressionDMContext[exprCount];
- final boolean expectedValues[] = new boolean[exprCount];
-
- int exprIndex = 0;
- dmcs[exprIndex] = fExpService.createExpression(frameDmc, "&a");
- expectedValues[exprIndex] = false;
- exprIndex++;
- dmcs[exprIndex] = fExpService.createExpression(frameDmc, "1");
- expectedValues[exprIndex] = false;
- exprIndex++;
-
- for (int index = 0; index < exprCount; index++) {
- final int finalIndex = index;
- wait.increment();
- fExpService.canWriteExpression(
- dmcs[finalIndex],
- new DataRequestMonitor<Boolean>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else if (getData() == expectedValues[finalIndex]) {
+ final int exprCount = 2;
+ final IExpressionDMContext dmcs[] = new IExpressionDMContext[exprCount];
+ final boolean expectedValues[] = new boolean[exprCount];
+
+ int exprIndex = 0;
+ dmcs[exprIndex] = fExpService.createExpression(frameDmc, "&a");
+ expectedValues[exprIndex] = false;
+ exprIndex++;
+ dmcs[exprIndex] = fExpService.createExpression(frameDmc, "1");
+ expectedValues[exprIndex] = false;
+ exprIndex++;
+
+ for (int index = 0; index < exprCount; index++) {
+ final int finalIndex = index;
+ wait.increment();
+ fExpService.canWriteExpression(dmcs[finalIndex],
+ new DataRequestMonitor<Boolean>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else if (getData() == expectedValues[finalIndex]) {
wait.waitFinished();
} else {
wait.waitFinished(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Failed establishing proper canWrite for " + dmcs[finalIndex].getExpression() +
- ", got " + getData() + " instead of " + expectedValues[finalIndex], null));
+ "Failed establishing proper canWrite for "
+ + dmcs[finalIndex].getExpression() + ", got " + getData()
+ + " instead of " + expectedValues[finalIndex],
+ null));
}
+ }
+ });
+ }
+ }
+ });
- }
- });
- }
- }
- });
-
- wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- assertTrue(wait.getMessage(), wait.isOK());
- wait.waitReset();
- }
+ wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ assertTrue(wait.getMessage(), wait.isOK());
+ wait.waitReset();
+ }
/**
* Executes a group of sub-tests.
- *
+ *
* @param tests
* A Map in which the key is an expression to evaluate and the
* value is an array of expected values, one for each of the
@@ -2835,1010 +2932,1019 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
* if, e.g., the gdb expression resolves to "1.23456789", but the
* caller only supplied "1.2345".
*/
- private void executeExpressionSubTests(final Map<String, String[]> tests, final boolean exact, IDMContext dmc)
- throws Throwable
- {
-
- // Now evaluate each of the above expressions and compare the actual
- // value against
- // the expected value.
- for (final String expressionToEvaluate : tests.keySet()) {
-
- // Get an IExpressionDMContext object representing the expression to
- // be evaluated.
- final IExpressionDMContext exprDMC = SyncUtil.createExpression(dmc, expressionToEvaluate);
-
- final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
-
- // Get the list of available format IDs for this expression and for
- // each one,
- // get the value of the expression
- fExpService.getExecutor().submit(new Runnable() {
- @Override
+ private void executeExpressionSubTests(final Map<String, String[]> tests, final boolean exact, IDMContext dmc)
+ throws Throwable {
+
+ // Now evaluate each of the above expressions and compare the actual
+ // value against
+ // the expected value.
+ for (final String expressionToEvaluate : tests.keySet()) {
+
+ // Get an IExpressionDMContext object representing the expression to
+ // be evaluated.
+ final IExpressionDMContext exprDMC = SyncUtil.createExpression(dmc, expressionToEvaluate);
+
+ final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
+
+ // Get the list of available format IDs for this expression and for
+ // each one,
+ // get the value of the expression
+ fExpService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- fExpService.getAvailableFormats(exprDMC, new DataRequestMonitor<String[]>(
- fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- final String[] formatIds = getData();
-
- // Now run the current sub-test using each of
- // the formats available for the type of
- // the expression in the sub-test.
-
- for (final String formatId : formatIds) {
- // Get a FormattedValueCMContext object for
- // the expression-formatID pair.
- final FormattedValueDMContext valueDmc = fExpService.getFormattedValueContext(
- exprDMC, formatId);
-
- // Increment the number of completed
- // requests to wait for, since we will send
- // multiple concurrent requests
- wait.increment();
-
- // Evaluate the expression represented by
- // the FormattedValueDMContext object
- // This actually evaluates the expression.
- fExpService.getFormattedExpressionValue(valueDmc,
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
-
- // Get the
- // FormattedValueDMData
- // object from the waiter.
- FormattedValueDMData exprValueDMData = getData();
-
- final String[] expectedValues = tests.get(expressionToEvaluate);
-
- // Check the value of the expression for correctness.
- String actualValue = exprValueDMData.getFormattedValue();
- String expectedValue;
-
- if (formatId.equals(IFormattedValues.HEX_FORMAT))
- expectedValue = expectedValues[0];
- else if (formatId.equals(IFormattedValues.OCTAL_FORMAT))
- expectedValue = expectedValues[1];
- else if (formatId.equals(IFormattedValues.BINARY_FORMAT))
- expectedValue = expectedValues[2];
- else if (formatId.equals(IFormattedValues.DECIMAL_FORMAT))
- expectedValue = expectedValues[3];
- else if (formatId.equals(IFormattedValues.NATURAL_FORMAT))
- expectedValue = expectedValues[4];
- else if (formatId.equals(MIExpressions.DETAILS_FORMAT))
- expectedValue = expectedValues[5];
- else
- expectedValue = "[Unrecognized format ID: " + formatId + "]";
-
- if ((exact == false) &&
- (formatId.equals(IFormattedValues.NATURAL_FORMAT) || formatId.equals(MIExpressions.DETAILS_FORMAT)) &&
- (expectedValue.length() < actualValue.length())) {
- actualValue = actualValue.substring(0, expectedValue.length());
- }
-
- if (actualValue.equalsIgnoreCase(expectedValue)) {
- wait.waitFinished();
- } else {
- String errorMsg = "Failed to correctly evalutate '"
- + expressionToEvaluate + "': expected '" + expectedValue
- + "', got '" + actualValue + "'";
- wait.waitFinished(new Status(IStatus.ERROR,
- TestsPlugin.PLUGIN_ID, errorMsg, null));
- }
- }
- }
- });
- }
- }
- }
- });
- }
- });
- wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- assertTrue(wait.getMessage(), wait.isOK());
- assertTrue("ExprChangedEvent problem: expected 0, received " + getExprChangedCount(),
- getExprChangedCount() == 0);
- }
- }
-
- private void executeExpressionSubTests(final Map<String, String[]> tests, IDMContext dmc) throws Throwable {
- executeExpressionSubTests(tests, true, dmc);
- }
-
- private boolean addressesEqual(IExpressionDMAddress addrToTest, String addrStr, int size) {
- IAddress addr;
- if (addrStr.length() <= 10) {
- addr = new Addr32(addrStr);
- } else {
- addr = new Addr64(addrStr);
- }
- return addrToTest.getAddress().equals(addr) && addrToTest.getSize() == size;
- }
-
- private void checkAddressData(final IExpressionDMContext dmc, String actualAddrStr, int actualAddrSize) throws Throwable {
-
- final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
-
- fExpService.getExecutor().submit(new Runnable() {
- @Override
+ fExpService.getAvailableFormats(exprDMC,
+ new DataRequestMonitor<String[]>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ final String[] formatIds = getData();
+
+ // Now run the current sub-test using each of
+ // the formats available for the type of
+ // the expression in the sub-test.
+
+ for (final String formatId : formatIds) {
+ // Get a FormattedValueCMContext object for
+ // the expression-formatID pair.
+ final FormattedValueDMContext valueDmc = fExpService
+ .getFormattedValueContext(exprDMC, formatId);
+
+ // Increment the number of completed
+ // requests to wait for, since we will send
+ // multiple concurrent requests
+ wait.increment();
+
+ // Evaluate the expression represented by
+ // the FormattedValueDMContext object
+ // This actually evaluates the expression.
+ fExpService.getFormattedExpressionValue(valueDmc,
+ new DataRequestMonitor<FormattedValueDMData>(
+ fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+
+ // Get the
+ // FormattedValueDMData
+ // object from the waiter.
+ FormattedValueDMData exprValueDMData = getData();
+
+ final String[] expectedValues = tests
+ .get(expressionToEvaluate);
+
+ // Check the value of the expression for correctness.
+ String actualValue = exprValueDMData
+ .getFormattedValue();
+ String expectedValue;
+
+ if (formatId.equals(IFormattedValues.HEX_FORMAT))
+ expectedValue = expectedValues[0];
+ else if (formatId.equals(IFormattedValues.OCTAL_FORMAT))
+ expectedValue = expectedValues[1];
+ else if (formatId
+ .equals(IFormattedValues.BINARY_FORMAT))
+ expectedValue = expectedValues[2];
+ else if (formatId
+ .equals(IFormattedValues.DECIMAL_FORMAT))
+ expectedValue = expectedValues[3];
+ else if (formatId
+ .equals(IFormattedValues.NATURAL_FORMAT))
+ expectedValue = expectedValues[4];
+ else if (formatId.equals(MIExpressions.DETAILS_FORMAT))
+ expectedValue = expectedValues[5];
+ else
+ expectedValue = "[Unrecognized format ID: "
+ + formatId + "]";
+
+ if ((exact == false)
+ && (formatId
+ .equals(IFormattedValues.NATURAL_FORMAT)
+ || formatId.equals(
+ MIExpressions.DETAILS_FORMAT))
+ && (expectedValue.length() < actualValue
+ .length())) {
+ actualValue = actualValue.substring(0,
+ expectedValue.length());
+ }
+
+ if (actualValue.equalsIgnoreCase(expectedValue)) {
+ wait.waitFinished();
+ } else {
+ String errorMsg = "Failed to correctly evalutate '"
+ + expressionToEvaluate + "': expected '"
+ + expectedValue + "', got '" + actualValue
+ + "'";
+ wait.waitFinished(new Status(IStatus.ERROR,
+ TestsPlugin.PLUGIN_ID, errorMsg, null));
+ }
+ }
+ }
+ });
+ }
+ }
+ }
+ });
+ }
+ });
+ wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ assertTrue(wait.getMessage(), wait.isOK());
+ assertTrue("ExprChangedEvent problem: expected 0, received " + getExprChangedCount(),
+ getExprChangedCount() == 0);
+ }
+ }
+
+ private void executeExpressionSubTests(final Map<String, String[]> tests, IDMContext dmc) throws Throwable {
+ executeExpressionSubTests(tests, true, dmc);
+ }
+
+ private boolean addressesEqual(IExpressionDMAddress addrToTest, String addrStr, int size) {
+ IAddress addr;
+ if (addrStr.length() <= 10) {
+ addr = new Addr32(addrStr);
+ } else {
+ addr = new Addr64(addrStr);
+ }
+ return addrToTest.getAddress().equals(addr) && addrToTest.getSize() == size;
+ }
+
+ private void checkAddressData(final IExpressionDMContext dmc, String actualAddrStr, int actualAddrSize)
+ throws Throwable {
+
+ final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
+
+ fExpService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- fExpService.getExpressionAddressData(dmc, new DataRequestMonitor<IExpressionDMAddress>(fExpService
- .getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (isSuccess()) {
- wait.setReturnInfo(getData());
- }
-
- wait.waitFinished(getStatus());
- }
- });
- }
- });
-
- wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- assertTrue(wait.getMessage(), wait.isOK());
-
- IExpressionDMAddress addr = (IExpressionDMAddress)wait.getReturnInfo();
-
- assertTrue("Unable to get address", addr != null);
- if (addr != null) {
- assertTrue("Received wrong address of " + addr.toString() + " instead of (" +
- actualAddrStr + ", " + actualAddrSize + ")",
- addressesEqual(addr, actualAddrStr, actualAddrSize));
- }
- }
-
- private void doTestChildren(IExpressionDMContext exprDMC) throws Throwable
- {
- IExpressionDMContext[] children =
- getChildren(exprDMC, new String[] {"bar", "bar2", "a", "b", "c"});
-
- // f.bar
- IExpressionDMContext[] children1 =
- getChildren(children[0], new String[] {"d", "e"});
- // f.bar.d
- getChildren(children1[0], new String[0]);
- // f.bar.e
- IExpressionDMContext[] children2 =
- getChildren(children1[1], new String[] {"e[0]", "e[1]"});
- // f.bar.e[0]
- getChildren(children2[0], new String[0]);
- // f.bar.e[1]
- getChildren(children2[1], new String[0]);
-
- // f.bar2
- children1 = getChildren(children[1], new String[] {"f", "g"});
- // f.bar2.f
- getChildren(children1[0], new String[0]);
- // f.bar2.g
- children2 = getChildren(children1[1], new String[] {"g[0]", "g[1]"});
- // f.bar2.g[0]
- getChildren(children2[0], new String[0]);
- // f.bar2.g[1]
- getChildren(children2[1], new String[0]);
-
- // f.a
- children1 = getChildren(children[2], new String[] {"a[0]", "a[1]"});
- // f.a[0]
- getChildren(children1[0], new String[0]);
- // f.a[1]
- getChildren(children1[1], new String[0]);
-
- // f.b
- children1 = getChildren(children[3], new String[] {"d", "e"});
- // f.b.d
- getChildren(children1[0], new String[0]);
- // f.b.e
- children2 = getChildren(children1[1], new String[] {"e[0]", "e[1]"});
- // f.b.e[0]
- getChildren(children2[0], new String[0]);
- // f.b.e[1]
- getChildren(children2[1], new String[0]);
-
- // f.c
- getChildren(children[4], new String[0]);
-
- assertTrue("ExprChangedEvent problem: expected 0, received " + getExprChangedCount(),
- getExprChangedCount() == 0);
+ fExpService.getExpressionAddressData(dmc,
+ new DataRequestMonitor<IExpressionDMAddress>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (isSuccess()) {
+ wait.setReturnInfo(getData());
+ }
+
+ wait.waitFinished(getStatus());
+ }
+ });
+ }
+ });
+
+ wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ assertTrue(wait.getMessage(), wait.isOK());
+
+ IExpressionDMAddress addr = (IExpressionDMAddress) wait.getReturnInfo();
+
+ assertTrue("Unable to get address", addr != null);
+ if (addr != null) {
+ assertTrue("Received wrong address of " + addr.toString() + " instead of (" + actualAddrStr + ", "
+ + actualAddrSize + ")", addressesEqual(addr, actualAddrStr, actualAddrSize));
+ }
}
- // This method tests IExspressions.getSubExpressions(IExpressionDMC, DRM);
- protected IExpressionDMContext[] getChildren(
- final IExpressionDMContext parentDmc,
- String[] expectedValues) throws Throwable {
+ private void doTestChildren(IExpressionDMContext exprDMC) throws Throwable {
+ IExpressionDMContext[] children = getChildren(exprDMC, new String[] { "bar", "bar2", "a", "b", "c" });
+
+ // f.bar
+ IExpressionDMContext[] children1 = getChildren(children[0], new String[] { "d", "e" });
+ // f.bar.d
+ getChildren(children1[0], new String[0]);
+ // f.bar.e
+ IExpressionDMContext[] children2 = getChildren(children1[1], new String[] { "e[0]", "e[1]" });
+ // f.bar.e[0]
+ getChildren(children2[0], new String[0]);
+ // f.bar.e[1]
+ getChildren(children2[1], new String[0]);
+
+ // f.bar2
+ children1 = getChildren(children[1], new String[] { "f", "g" });
+ // f.bar2.f
+ getChildren(children1[0], new String[0]);
+ // f.bar2.g
+ children2 = getChildren(children1[1], new String[] { "g[0]", "g[1]" });
+ // f.bar2.g[0]
+ getChildren(children2[0], new String[0]);
+ // f.bar2.g[1]
+ getChildren(children2[1], new String[0]);
+
+ // f.a
+ children1 = getChildren(children[2], new String[] { "a[0]", "a[1]" });
+ // f.a[0]
+ getChildren(children1[0], new String[0]);
+ // f.a[1]
+ getChildren(children1[1], new String[0]);
+
+ // f.b
+ children1 = getChildren(children[3], new String[] { "d", "e" });
+ // f.b.d
+ getChildren(children1[0], new String[0]);
+ // f.b.e
+ children2 = getChildren(children1[1], new String[] { "e[0]", "e[1]" });
+ // f.b.e[0]
+ getChildren(children2[0], new String[0]);
+ // f.b.e[1]
+ getChildren(children2[1], new String[0]);
+
+ // f.c
+ getChildren(children[4], new String[0]);
+
+ assertTrue("ExprChangedEvent problem: expected 0, received " + getExprChangedCount(),
+ getExprChangedCount() == 0);
+ }
+
+ // This method tests IExspressions.getSubExpressions(IExpressionDMC, DRM);
+ protected IExpressionDMContext[] getChildren(final IExpressionDMContext parentDmc, String[] expectedValues)
+ throws Throwable {
- final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
+ final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
- fExpService.getExecutor().submit(new Runnable() {
- @Override
+ fExpService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- fExpService.getSubExpressions(parentDmc,
- new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (isSuccess()) {
- wait.setReturnInfo(getData());
- }
- wait.waitFinished(getStatus());
- }
- });
- }
- });
-
- wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- assertTrue(wait.getMessage(), wait.isOK());
-
- IExpressionDMContext[] childDmcs =
- (IExpressionDMContext[]) wait.getReturnInfo();
-
- String[] childExpressions = new String[childDmcs.length];
- MIExpressionDMCAccessor[] childDmcsAccessor = new MIExpressionDMCAccessor[childDmcs.length];
-
- // Convert to a MIExpressionDMCAccessor to be able to call getRelativeExpression
- // Also convert to String[] to be able to use Arrays.toString()
- for (int i = 0; i < childExpressions.length; i++) {
- childDmcsAccessor[i] = new MIExpressionDMCAccessor(childDmcs[i]);
- childExpressions[i] = childDmcsAccessor[i].getRelativeExpression();
- }
- assertTrue("Expected " + Arrays.toString(expectedValues) + " but got " + Arrays.toString(childExpressions),
- expectedValues.length == childExpressions.length);
-
- for (int i = 0; i < childDmcsAccessor.length; i++) {
- assertEquals(expectedValues[i], childDmcsAccessor[i].getRelativeExpression());
- }
-
- return childDmcs;
- }
-
- // This method tests IExpressions.getSubExpressions(IExpressionDMC, int, int, DRM);
- protected IExpressionDMContext[] getChildren(
- final IExpressionDMContext parentDmc,
- final int startIndex,
- final int length,
- String[] expectedValues) throws Throwable {
-
- final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
-
- fExpService.getExecutor().submit(new Runnable() {
- @Override
+ fExpService.getSubExpressions(parentDmc,
+ new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (isSuccess()) {
+ wait.setReturnInfo(getData());
+ }
+ wait.waitFinished(getStatus());
+ }
+ });
+ }
+ });
+
+ wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ assertTrue(wait.getMessage(), wait.isOK());
+
+ IExpressionDMContext[] childDmcs = (IExpressionDMContext[]) wait.getReturnInfo();
+
+ String[] childExpressions = new String[childDmcs.length];
+ MIExpressionDMCAccessor[] childDmcsAccessor = new MIExpressionDMCAccessor[childDmcs.length];
+
+ // Convert to a MIExpressionDMCAccessor to be able to call getRelativeExpression
+ // Also convert to String[] to be able to use Arrays.toString()
+ for (int i = 0; i < childExpressions.length; i++) {
+ childDmcsAccessor[i] = new MIExpressionDMCAccessor(childDmcs[i]);
+ childExpressions[i] = childDmcsAccessor[i].getRelativeExpression();
+ }
+ assertTrue("Expected " + Arrays.toString(expectedValues) + " but got " + Arrays.toString(childExpressions),
+ expectedValues.length == childExpressions.length);
+
+ for (int i = 0; i < childDmcsAccessor.length; i++) {
+ assertEquals(expectedValues[i], childDmcsAccessor[i].getRelativeExpression());
+ }
+
+ return childDmcs;
+ }
+
+ // This method tests IExpressions.getSubExpressions(IExpressionDMC, int, int, DRM);
+ protected IExpressionDMContext[] getChildren(final IExpressionDMContext parentDmc, final int startIndex,
+ final int length, String[] expectedValues) throws Throwable {
+
+ final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
+
+ fExpService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- fExpService.getSubExpressions(
- parentDmc,
- startIndex,
- length,
- new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (isSuccess()) {
- wait.setReturnInfo(getData());
- }
- wait.waitFinished(getStatus());
- }
- });
- }
- });
-
- wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- assertTrue(wait.getMessage(), wait.isOK());
-
- IExpressionDMContext[] childDmcs =
- (IExpressionDMContext[]) wait.getReturnInfo();
-
- String[] childExpressions = new String[childDmcs.length];
- MIExpressionDMCAccessor[] childDmcsAccessor = new MIExpressionDMCAccessor[childDmcs.length];
-
- // Convert to a MIExpressionDMCAccessor to be able to call getRelativeExpression
- // Also convert to String[] to be able to use Arrays.toString()
- for (int i = 0; i < childExpressions.length; i++) {
- childDmcsAccessor[i] = new MIExpressionDMCAccessor(childDmcs[i]);
- childExpressions[i] = childDmcsAccessor[i].getRelativeExpression();
- }
- assertTrue("Expected " + Arrays.toString(expectedValues) + " but got " + Arrays.toString(childExpressions),
- expectedValues.length == childExpressions.length);
-
- for (int i = 0; i < childDmcsAccessor.length; i++) {
- assertTrue("Expected: " + expectedValues[i] + " got: " + childDmcsAccessor[i].getRelativeExpression(),
- childDmcsAccessor[i].getRelativeExpression().equals(expectedValues[i]));
- }
-
- return childDmcs;
- }
-
- /**
- * This test verifies that large arrays are properly partitioned and
- * the handling of "small" arrays is not affected.
- */
- @Test
- public void testArrays() throws Throwable {
- MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("testArrays");
-
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
-
- // int array_simple[10];
- IExpressionDMContext arraySimpleExprDMC = SyncUtil.createExpression(frameDmc, "array_simple");
-
- assertChildrenCount(arraySimpleExprDMC, 10);
-
- // get all children
- String[] expectedValues = new String[10];
- for (int i = 0; i < expectedValues.length; ++i) {
- expectedValues[i] = String.format("array_simple[%d]", i);
- }
- IExpressionDMContext[] arraySimpleChildren = getChildren(arraySimpleExprDMC, expectedValues);
- for (IExpressionDMContext ctx : arraySimpleChildren)
- getChildren(ctx, new String[0]);
-
- // get some parts of the children array
- getChildren(arraySimpleExprDMC, 3, 2, new String[] { "array_simple[3]", "array_simple[4]" });
- getChildren(arraySimpleExprDMC, 9, 3, new String[] { "array_simple[9]" });
-
- // int array_int[24321];
- IExpressionDMContext arrayIntExprDMC = SyncUtil.createExpression(frameDmc, "array_int");
- assertChildrenCount(arrayIntExprDMC, 3);
-
- // get top level partitions: [0-9999], [10000-19999], [20000-24321]
- IExpressionDMContext[] arrayIntPartitions =
- getChildren(arrayIntExprDMC, new String[] {"*((array_int)+0)@10000", "*((array_int)+10000)@10000", "*((array_int)+20000)@4321"});
- assertTrue(String.format("Invalid number of partition: expected 3 got %d", arrayIntPartitions.length), arrayIntPartitions.length == 3);
-
- // get children of the last partition: [20000-24321]
- expectedValues = new String[44];
- for(int i = 0; i < expectedValues.length - 1; ++i) {
- expectedValues[i] = String.format("*((array_int)+%d)@100", 20000 + i*100);
- }
- expectedValues[expectedValues.length - 1] = "*((array_int)+24300)@21";
- IExpressionDMContext[] arrayIntPartitions1 = getChildren(arrayIntPartitions[2], expectedValues);
- expectedValues = new String[21];
- for(int i = 0; i < expectedValues.length; ++i) {
- expectedValues[i] = String.format("array_int[%d]", 24300 + i);
- }
- getChildren(arrayIntPartitions1[arrayIntPartitions1.length - 1], expectedValues);
-
- // foo array_foo[1200];
- IExpressionDMContext arrayFooExprDMC = SyncUtil.createExpression(frameDmc, "array_foo");
- assertChildrenCount(arrayFooExprDMC, 12);
- expectedValues = new String[12];
- for (int i = 0; i < expectedValues.length; ++i) {
- expectedValues[i] = String.format("*((array_foo)+%d)@%d", i*100, 100);
- }
- IExpressionDMContext[] arrayFooPartitions = getChildren(arrayFooExprDMC, expectedValues);
- for (int i = 0; i < arrayFooPartitions.length; ++i) {
- IExpressionDMContext ctx = arrayFooPartitions[i];
- assertTrue(String.format("Invalid DM context type: expected '%s' got '%s'",
- IIndexedPartitionDMContext.class.getName(), ctx.getClass().getName()),
- ctx instanceof IIndexedPartitionDMContext);
- expectedValues = new String[100];
- for (int j = 0; j < expectedValues.length; ++j) {
- expectedValues[j] = String.format("array_foo[%d]", i*100 + j);
- }
- IExpressionDMContext[] arrayFooChildren = getChildren(ctx, expectedValues);
- // check the children of a couple of children
- getChildren(arrayFooChildren[0], new String[] {"bar", "bar2", "a", "b", "c"});
- getChildren(arrayFooChildren[80], new String[] {"bar", "bar2", "a", "b", "c"});
-
- // get parts of the children array
- expectedValues = new String[] { String.format("array_foo[%d]", i*100 + 3), String.format("array_foo[%d]", i*100 + 4) };
- getChildren(ctx, 3, 2, expectedValues);
- getChildren(ctx, 99, 3, new String[] { String.format("array_foo[%d]", i*100 + 99) });
- }
- }
-
- /**
- * This test verifies that large double arrays are properly partitioned
- */
- @Test
- public void testLargeDoubleArray() throws Throwable {
- MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("testArrays");
-
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
-
- // char array_double_large[111][210]
- IExpressionDMContext arrayDoubleLargeExprDMC = SyncUtil.createExpression(frameDmc, "array_double_large");
-
- assertChildrenCount(arrayDoubleLargeExprDMC, 2);
-
- // get top level partitions: [0-99], [100-110]
- IExpressionDMContext[] arrayTopPartitions =
- getChildren(arrayDoubleLargeExprDMC, new String[] {"*((array_double_large)+0)@100", "*((array_double_large)+100)@11"});
- assertTrue(String.format("Invalid number of partition: expected 2 got %d", arrayTopPartitions.length), arrayTopPartitions.length == 2);
-
- // get children child array_double_large[100-110]
- IExpressionDMContext arrayDoubleLargeChildExprDMC = arrayTopPartitions[1];
-
- assertChildrenCount(arrayDoubleLargeChildExprDMC, 11);
-
- String[] expectedValues = new String[11];
- for(int i = 0; i < expectedValues.length; ++i) {
- expectedValues[i] = String.format("array_double_large[%d]", 100 +i);
- }
- IExpressionDMContext[] arrayChild = getChildren(arrayDoubleLargeChildExprDMC, expectedValues);
-
- // get second level partitions: array_double_large[101][0-99], [100-199], [200-209]
- IExpressionDMContext arrayDoubleLargeChildExprDMC2 = arrayChild[1];
-
- assertChildrenCount(arrayDoubleLargeChildExprDMC2, 3);
-
- IExpressionDMContext[] arraySecondLevelPartitions =
- getChildren(arrayDoubleLargeChildExprDMC2, new String[] {"*((array_double_large[101])+0)@100",
- "*((array_double_large[101])+100)@100",
- "*((array_double_large[101])+200)@10"});
- assertTrue(String.format("Invalid number of partition: expected 3 got %d", arraySecondLevelPartitions.length), arraySecondLevelPartitions.length == 3);
-
- // get children of array_double_large[101][0-99]
- IExpressionDMContext arrayDoubleLargeChildExprDMC3 = arraySecondLevelPartitions[0];
-
- assertChildrenCount(arrayDoubleLargeChildExprDMC3, 100);
-
- expectedValues = new String[100];
- for(int i = 0; i < expectedValues.length; ++i) {
- expectedValues[i] = String.format("array_double_large[101][%d]", i);
- }
- IExpressionDMContext[] arrayChild2 = getChildren(arrayDoubleLargeChildExprDMC3, expectedValues);
-
- // No more children for array_double_large[101][*]
- for (IExpressionDMContext ctx : arrayChild2)
- getChildren(ctx, new String[0]);
-
- // get some parts of the children array
- getChildren(arrayDoubleLargeChildExprDMC3, 3, 2, new String[] { "array_double_large[101][3]", "array_double_large[101][4]" });
- getChildren(arrayDoubleLargeChildExprDMC3, 98, 3, new String[] { "array_double_large[101][98]","array_double_large[101][99]" });
- }
-
- /**
- * This test verifies that "small" double arrays is not affected by partitions.
- */
- @Test
- public void testSmallDoubleArray() throws Throwable {
- MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("testArrays");
-
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
-
- // int array_double_small[11][21];
- IExpressionDMContext arrayDoubleSmallExprDMC = SyncUtil.createExpression(frameDmc, "array_double_small");
-
- assertChildrenCount(arrayDoubleSmallExprDMC, 11);
-
- // get all children of array_double_small
- String[] expectedValues = new String[11];
- for (int i = 0; i < expectedValues.length; ++i) {
- expectedValues[i] = String.format("array_double_small[%d]", i);
- }
- IExpressionDMContext[] arrayDoubleSmallChildren = getChildren(arrayDoubleSmallExprDMC, expectedValues);
-
- // get all children of array_double_small[3]
- IExpressionDMContext arrayDoubleSmallChildExprDMC = arrayDoubleSmallChildren[3];
-
- assertChildrenCount(arrayDoubleSmallChildExprDMC, 21);
-
- expectedValues = new String[21];
- for (int i = 0; i < expectedValues.length; ++i) {
- expectedValues[i] = arrayDoubleSmallChildExprDMC.getExpression() + "[" + i +"]";
- }
- IExpressionDMContext[] arrayDoubleSmallGrandChildren = getChildren(arrayDoubleSmallChildExprDMC, expectedValues);
-
- // No more children for array_double_small[3][*]
- for (IExpressionDMContext ctx : arrayDoubleSmallGrandChildren)
- getChildren(ctx, new String[0]);
-
- // get some parts of the children array
- getChildren(arrayDoubleSmallChildExprDMC, 3, 2, new String[] { "array_double_small[3][3]", "array_double_small[3][4]" });
- getChildren(arrayDoubleSmallChildExprDMC, 19, 3, new String[] { "array_double_small[3][19]","array_double_small[3][20]" });
- }
-
- /**
- * This test verifies that there is no RTTI support before GDB 7.5.
- */
- @Test
- public void testRTTI() throws Throwable {
- assumeGdbVersionNot(ITestConstants.SUFFIX_GDB_6_7); // crashing
- assumeGdbVersionLowerThen(ITestConstants.SUFFIX_GDB_7_5);
- SyncUtil.runToLocation("testRTTI");
- MIStoppedEvent stoppedEvent = SyncUtil.step(3, StepType.STEP_OVER);
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
-
- // The expression we will follow as it changes types: derived.ptr
- IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, "derived.ptr");
-
- // Now, the expression should be type VirtualBase
- getExpressionType(exprDmc, "VirtualBase *");
- assertChildrenCount(exprDmc, 2);
- // get all children
- String[] expectedValues = new String[2];
- expectedValues[0] = "a";
- expectedValues[1] = "b";
- getChildren(exprDmc, expectedValues);
-
- // Make the type of our expression change
- SyncUtil.step(1, StepType.STEP_OVER);
- // Now, the expression should be type Derived, but GDB < 7.5 does not tell us
- // so we should still get the base type.
- getExpressionType(exprDmc, "VirtualBase *");
- assertChildrenCount(exprDmc, 2);
- // The children are also the same as before
- getChildren(exprDmc, expectedValues);
-
- // Make the type of our expression change
- SyncUtil.step(1, StepType.STEP_OVER);
- // Now, the expression should be type OtherDerived, but GDB < 7.5 does not tell us
- // so we should still get the base type.
- getExpressionType(exprDmc, "VirtualBase *");
- assertChildrenCount(exprDmc, 2);
- // The children are also the same as before
- getChildren(exprDmc, expectedValues);
+ fExpService.getSubExpressions(parentDmc, startIndex, length,
+ new DataRequestMonitor<IExpressionDMContext[]>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (isSuccess()) {
+ wait.setReturnInfo(getData());
+ }
+ wait.waitFinished(getStatus());
+ }
+ });
+ }
+ });
+
+ wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ assertTrue(wait.getMessage(), wait.isOK());
+
+ IExpressionDMContext[] childDmcs = (IExpressionDMContext[]) wait.getReturnInfo();
+
+ String[] childExpressions = new String[childDmcs.length];
+ MIExpressionDMCAccessor[] childDmcsAccessor = new MIExpressionDMCAccessor[childDmcs.length];
+
+ // Convert to a MIExpressionDMCAccessor to be able to call getRelativeExpression
+ // Also convert to String[] to be able to use Arrays.toString()
+ for (int i = 0; i < childExpressions.length; i++) {
+ childDmcsAccessor[i] = new MIExpressionDMCAccessor(childDmcs[i]);
+ childExpressions[i] = childDmcsAccessor[i].getRelativeExpression();
+ }
+ assertTrue("Expected " + Arrays.toString(expectedValues) + " but got " + Arrays.toString(childExpressions),
+ expectedValues.length == childExpressions.length);
+
+ for (int i = 0; i < childDmcsAccessor.length; i++) {
+ assertTrue("Expected: " + expectedValues[i] + " got: " + childDmcsAccessor[i].getRelativeExpression(),
+ childDmcsAccessor[i].getRelativeExpression().equals(expectedValues[i]));
+ }
+
+ return childDmcs;
+ }
+
+ /**
+ * This test verifies that large arrays are properly partitioned and
+ * the handling of "small" arrays is not affected.
+ */
+ @Test
+ public void testArrays() throws Throwable {
+ MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("testArrays");
+
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+
+ // int array_simple[10];
+ IExpressionDMContext arraySimpleExprDMC = SyncUtil.createExpression(frameDmc, "array_simple");
+
+ assertChildrenCount(arraySimpleExprDMC, 10);
+
+ // get all children
+ String[] expectedValues = new String[10];
+ for (int i = 0; i < expectedValues.length; ++i) {
+ expectedValues[i] = String.format("array_simple[%d]", i);
+ }
+ IExpressionDMContext[] arraySimpleChildren = getChildren(arraySimpleExprDMC, expectedValues);
+ for (IExpressionDMContext ctx : arraySimpleChildren)
+ getChildren(ctx, new String[0]);
+
+ // get some parts of the children array
+ getChildren(arraySimpleExprDMC, 3, 2, new String[] { "array_simple[3]", "array_simple[4]" });
+ getChildren(arraySimpleExprDMC, 9, 3, new String[] { "array_simple[9]" });
+
+ // int array_int[24321];
+ IExpressionDMContext arrayIntExprDMC = SyncUtil.createExpression(frameDmc, "array_int");
+ assertChildrenCount(arrayIntExprDMC, 3);
+
+ // get top level partitions: [0-9999], [10000-19999], [20000-24321]
+ IExpressionDMContext[] arrayIntPartitions = getChildren(arrayIntExprDMC,
+ new String[] { "*((array_int)+0)@10000", "*((array_int)+10000)@10000", "*((array_int)+20000)@4321" });
+ assertTrue(String.format("Invalid number of partition: expected 3 got %d", arrayIntPartitions.length),
+ arrayIntPartitions.length == 3);
+
+ // get children of the last partition: [20000-24321]
+ expectedValues = new String[44];
+ for (int i = 0; i < expectedValues.length - 1; ++i) {
+ expectedValues[i] = String.format("*((array_int)+%d)@100", 20000 + i * 100);
+ }
+ expectedValues[expectedValues.length - 1] = "*((array_int)+24300)@21";
+ IExpressionDMContext[] arrayIntPartitions1 = getChildren(arrayIntPartitions[2], expectedValues);
+ expectedValues = new String[21];
+ for (int i = 0; i < expectedValues.length; ++i) {
+ expectedValues[i] = String.format("array_int[%d]", 24300 + i);
+ }
+ getChildren(arrayIntPartitions1[arrayIntPartitions1.length - 1], expectedValues);
+
+ // foo array_foo[1200];
+ IExpressionDMContext arrayFooExprDMC = SyncUtil.createExpression(frameDmc, "array_foo");
+ assertChildrenCount(arrayFooExprDMC, 12);
+ expectedValues = new String[12];
+ for (int i = 0; i < expectedValues.length; ++i) {
+ expectedValues[i] = String.format("*((array_foo)+%d)@%d", i * 100, 100);
+ }
+ IExpressionDMContext[] arrayFooPartitions = getChildren(arrayFooExprDMC, expectedValues);
+ for (int i = 0; i < arrayFooPartitions.length; ++i) {
+ IExpressionDMContext ctx = arrayFooPartitions[i];
+ assertTrue(
+ String.format("Invalid DM context type: expected '%s' got '%s'",
+ IIndexedPartitionDMContext.class.getName(), ctx.getClass().getName()),
+ ctx instanceof IIndexedPartitionDMContext);
+ expectedValues = new String[100];
+ for (int j = 0; j < expectedValues.length; ++j) {
+ expectedValues[j] = String.format("array_foo[%d]", i * 100 + j);
+ }
+ IExpressionDMContext[] arrayFooChildren = getChildren(ctx, expectedValues);
+ // check the children of a couple of children
+ getChildren(arrayFooChildren[0], new String[] { "bar", "bar2", "a", "b", "c" });
+ getChildren(arrayFooChildren[80], new String[] { "bar", "bar2", "a", "b", "c" });
+
+ // get parts of the children array
+ expectedValues = new String[] { String.format("array_foo[%d]", i * 100 + 3),
+ String.format("array_foo[%d]", i * 100 + 4) };
+ getChildren(ctx, 3, 2, expectedValues);
+ getChildren(ctx, 99, 3, new String[] { String.format("array_foo[%d]", i * 100 + 99) });
+ }
+ }
+
+ /**
+ * This test verifies that large double arrays are properly partitioned
+ */
+ @Test
+ public void testLargeDoubleArray() throws Throwable {
+ MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("testArrays");
+
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+
+ // char array_double_large[111][210]
+ IExpressionDMContext arrayDoubleLargeExprDMC = SyncUtil.createExpression(frameDmc, "array_double_large");
+
+ assertChildrenCount(arrayDoubleLargeExprDMC, 2);
+
+ // get top level partitions: [0-99], [100-110]
+ IExpressionDMContext[] arrayTopPartitions = getChildren(arrayDoubleLargeExprDMC,
+ new String[] { "*((array_double_large)+0)@100", "*((array_double_large)+100)@11" });
+ assertTrue(String.format("Invalid number of partition: expected 2 got %d", arrayTopPartitions.length),
+ arrayTopPartitions.length == 2);
+
+ // get children child array_double_large[100-110]
+ IExpressionDMContext arrayDoubleLargeChildExprDMC = arrayTopPartitions[1];
+
+ assertChildrenCount(arrayDoubleLargeChildExprDMC, 11);
+
+ String[] expectedValues = new String[11];
+ for (int i = 0; i < expectedValues.length; ++i) {
+ expectedValues[i] = String.format("array_double_large[%d]", 100 + i);
+ }
+ IExpressionDMContext[] arrayChild = getChildren(arrayDoubleLargeChildExprDMC, expectedValues);
+
+ // get second level partitions: array_double_large[101][0-99], [100-199], [200-209]
+ IExpressionDMContext arrayDoubleLargeChildExprDMC2 = arrayChild[1];
+
+ assertChildrenCount(arrayDoubleLargeChildExprDMC2, 3);
+
+ IExpressionDMContext[] arraySecondLevelPartitions = getChildren(arrayDoubleLargeChildExprDMC2,
+ new String[] { "*((array_double_large[101])+0)@100", "*((array_double_large[101])+100)@100",
+ "*((array_double_large[101])+200)@10" });
+ assertTrue(String.format("Invalid number of partition: expected 3 got %d", arraySecondLevelPartitions.length),
+ arraySecondLevelPartitions.length == 3);
+
+ // get children of array_double_large[101][0-99]
+ IExpressionDMContext arrayDoubleLargeChildExprDMC3 = arraySecondLevelPartitions[0];
+
+ assertChildrenCount(arrayDoubleLargeChildExprDMC3, 100);
+
+ expectedValues = new String[100];
+ for (int i = 0; i < expectedValues.length; ++i) {
+ expectedValues[i] = String.format("array_double_large[101][%d]", i);
+ }
+ IExpressionDMContext[] arrayChild2 = getChildren(arrayDoubleLargeChildExprDMC3, expectedValues);
+
+ // No more children for array_double_large[101][*]
+ for (IExpressionDMContext ctx : arrayChild2)
+ getChildren(ctx, new String[0]);
+
+ // get some parts of the children array
+ getChildren(arrayDoubleLargeChildExprDMC3, 3, 2,
+ new String[] { "array_double_large[101][3]", "array_double_large[101][4]" });
+ getChildren(arrayDoubleLargeChildExprDMC3, 98, 3,
+ new String[] { "array_double_large[101][98]", "array_double_large[101][99]" });
+ }
+
+ /**
+ * This test verifies that "small" double arrays is not affected by partitions.
+ */
+ @Test
+ public void testSmallDoubleArray() throws Throwable {
+ MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("testArrays");
+
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+
+ // int array_double_small[11][21];
+ IExpressionDMContext arrayDoubleSmallExprDMC = SyncUtil.createExpression(frameDmc, "array_double_small");
+
+ assertChildrenCount(arrayDoubleSmallExprDMC, 11);
+
+ // get all children of array_double_small
+ String[] expectedValues = new String[11];
+ for (int i = 0; i < expectedValues.length; ++i) {
+ expectedValues[i] = String.format("array_double_small[%d]", i);
+ }
+ IExpressionDMContext[] arrayDoubleSmallChildren = getChildren(arrayDoubleSmallExprDMC, expectedValues);
+
+ // get all children of array_double_small[3]
+ IExpressionDMContext arrayDoubleSmallChildExprDMC = arrayDoubleSmallChildren[3];
+
+ assertChildrenCount(arrayDoubleSmallChildExprDMC, 21);
+
+ expectedValues = new String[21];
+ for (int i = 0; i < expectedValues.length; ++i) {
+ expectedValues[i] = arrayDoubleSmallChildExprDMC.getExpression() + "[" + i + "]";
+ }
+ IExpressionDMContext[] arrayDoubleSmallGrandChildren = getChildren(arrayDoubleSmallChildExprDMC,
+ expectedValues);
+
+ // No more children for array_double_small[3][*]
+ for (IExpressionDMContext ctx : arrayDoubleSmallGrandChildren)
+ getChildren(ctx, new String[0]);
+
+ // get some parts of the children array
+ getChildren(arrayDoubleSmallChildExprDMC, 3, 2,
+ new String[] { "array_double_small[3][3]", "array_double_small[3][4]" });
+ getChildren(arrayDoubleSmallChildExprDMC, 19, 3,
+ new String[] { "array_double_small[3][19]", "array_double_small[3][20]" });
}
- /**
- * This test verifies that we can cast to a type and then revert.
- */
- @Test
- public void testCastToType() throws Throwable {
- SyncUtil.runToLocation("testCasting");
- MIStoppedEvent stoppedEvent = SyncUtil.step(3, StepType.STEP_OVER);
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
-
- IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, "int_ptr");
-
- assertTrue("Expression service does not support casting", fExpService instanceof IExpressions2);
-
- ICastedExpressionDMContext castExprDmc =
- ((IExpressions2)fExpService).createCastedExpression(exprDmc, new CastInfo("char*"));
-
- // Check type of original expression and new casted one
- getExpressionType(exprDmc, "int *");
- getExpressionType(castExprDmc, "char *");
-
- assertChildrenCount(castExprDmc, 1);
- // get child and its value
- final IExpressionDMContext[] children = getChildren(exprDmc, new String[] {"*int_ptr"});
-
- Query<String> query = new Query<String>() {
+ /**
+ * This test verifies that there is no RTTI support before GDB 7.5.
+ */
+ @Test
+ public void testRTTI() throws Throwable {
+ assumeGdbVersionNot(ITestConstants.SUFFIX_GDB_6_7); // crashing
+ assumeGdbVersionLowerThen(ITestConstants.SUFFIX_GDB_7_5);
+ SyncUtil.runToLocation("testRTTI");
+ MIStoppedEvent stoppedEvent = SyncUtil.step(3, StepType.STEP_OVER);
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+
+ // The expression we will follow as it changes types: derived.ptr
+ IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, "derived.ptr");
+
+ // Now, the expression should be type VirtualBase
+ getExpressionType(exprDmc, "VirtualBase *");
+ assertChildrenCount(exprDmc, 2);
+ // get all children
+ String[] expectedValues = new String[2];
+ expectedValues[0] = "a";
+ expectedValues[1] = "b";
+ getChildren(exprDmc, expectedValues);
+
+ // Make the type of our expression change
+ SyncUtil.step(1, StepType.STEP_OVER);
+ // Now, the expression should be type Derived, but GDB < 7.5 does not tell us
+ // so we should still get the base type.
+ getExpressionType(exprDmc, "VirtualBase *");
+ assertChildrenCount(exprDmc, 2);
+ // The children are also the same as before
+ getChildren(exprDmc, expectedValues);
+
+ // Make the type of our expression change
+ SyncUtil.step(1, StepType.STEP_OVER);
+ // Now, the expression should be type OtherDerived, but GDB < 7.5 does not tell us
+ // so we should still get the base type.
+ getExpressionType(exprDmc, "VirtualBase *");
+ assertChildrenCount(exprDmc, 2);
+ // The children are also the same as before
+ getChildren(exprDmc, expectedValues);
+ }
+
+ /**
+ * This test verifies that we can cast to a type and then revert.
+ */
+ @Test
+ public void testCastToType() throws Throwable {
+ SyncUtil.runToLocation("testCasting");
+ MIStoppedEvent stoppedEvent = SyncUtil.step(3, StepType.STEP_OVER);
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+
+ IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, "int_ptr");
+
+ assertTrue("Expression service does not support casting", fExpService instanceof IExpressions2);
+
+ ICastedExpressionDMContext castExprDmc = ((IExpressions2) fExpService).createCastedExpression(exprDmc,
+ new CastInfo("char*"));
+
+ // Check type of original expression and new casted one
+ getExpressionType(exprDmc, "int *");
+ getExpressionType(castExprDmc, "char *");
+
+ assertChildrenCount(castExprDmc, 1);
+ // get child and its value
+ final IExpressionDMContext[] children = getChildren(exprDmc, new String[] { "*int_ptr" });
+
+ Query<String> query = new Query<String>() {
@Override
protected void execute(final DataRequestMonitor<String> rm) {
fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(children[0], IFormattedValues.NATURAL_FORMAT),
+ fExpService.getFormattedValueContext(children[0], IFormattedValues.NATURAL_FORMAT),
new ImmediateDataRequestMonitor<FormattedValueDMData>(rm) {
@Override
protected void handleCompleted() {
rm.done(getData().getFormattedValue());
- }
+ }
});
}
- };
-
- fSession.getExecutor().execute(query);
- String value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ };
+
+ fSession.getExecutor().execute(query);
+ String value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
assertEquals("65", value);
-
- final IExpressionDMContext[] castChildren = getChildren(castExprDmc, new String[] {"*((char*)(int_ptr))"});
- query = new Query<String>() {
+
+ final IExpressionDMContext[] castChildren = getChildren(castExprDmc, new String[] { "*((char*)(int_ptr))" });
+ query = new Query<String>() {
@Override
protected void execute(final DataRequestMonitor<String> rm) {
fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(castChildren[0], IFormattedValues.NATURAL_FORMAT),
+ fExpService.getFormattedValueContext(castChildren[0], IFormattedValues.NATURAL_FORMAT),
new ImmediateDataRequestMonitor<FormattedValueDMData>(rm) {
@Override
protected void handleCompleted() {
rm.done(getData().getFormattedValue());
- }
+ }
});
}
- };
- fSession.getExecutor().execute(query);
- value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ };
+ fSession.getExecutor().execute(query);
+ value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
assertEquals("65 'A'", value);
-
+
// Now check that the casted type still remembers what its original type is
assertEquals(castExprDmc.getParents()[0], exprDmc);
- }
-
- /**
- * This test verifies that we can display as array and then revert.
- */
- @Test
- public void testDisplayAsArray() throws Throwable {
- SyncUtil.runToLocation("testCasting");
- MIStoppedEvent stoppedEvent = SyncUtil.step(3, StepType.STEP_OVER);
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
-
- IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, "int_ptr");
-
- assertTrue("Expression service does not support casting", fExpService instanceof IExpressions2);
-
- // Display as an array of 2 elements, starting at index 1
- ICastedExpressionDMContext castExprDmc =
- ((IExpressions2)fExpService).createCastedExpression(exprDmc, new CastInfo(1,2));
-
- // Check type of original expression and new casted one
- getExpressionType(exprDmc, "int *");
- getExpressionType(castExprDmc, "int [2]");
-
- assertChildrenCount(castExprDmc, 2);
- // get children and their values
- final IExpressionDMContext[] children = getChildren(castExprDmc, new String[] {"int_ptr[1]", "int_ptr[2]"});
- String[] expectedValues = new String[] {"1094861636", "1162233672"};
- for (int i = 0; i<children.length;i++) {
- final IExpressionDMContext child = children[i];
- Query<String> query = new Query<String>() {
- @Override
- protected void execute(final DataRequestMonitor<String> rm) {
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(child, IFormattedValues.NATURAL_FORMAT),
- new ImmediateDataRequestMonitor<FormattedValueDMData>(rm) {
- @Override
- protected void handleCompleted() {
- rm.done(getData().getFormattedValue());
- }
- });
- }
- };
-
- fSession.getExecutor().execute(query);
- String value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
- assertEquals(expectedValues[i], value);
- }
-
-
+ }
+
+ /**
+ * This test verifies that we can display as array and then revert.
+ */
+ @Test
+ public void testDisplayAsArray() throws Throwable {
+ SyncUtil.runToLocation("testCasting");
+ MIStoppedEvent stoppedEvent = SyncUtil.step(3, StepType.STEP_OVER);
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+
+ IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, "int_ptr");
+
+ assertTrue("Expression service does not support casting", fExpService instanceof IExpressions2);
+
+ // Display as an array of 2 elements, starting at index 1
+ ICastedExpressionDMContext castExprDmc = ((IExpressions2) fExpService).createCastedExpression(exprDmc,
+ new CastInfo(1, 2));
+
+ // Check type of original expression and new casted one
+ getExpressionType(exprDmc, "int *");
+ getExpressionType(castExprDmc, "int [2]");
+
+ assertChildrenCount(castExprDmc, 2);
+ // get children and their values
+ final IExpressionDMContext[] children = getChildren(castExprDmc, new String[] { "int_ptr[1]", "int_ptr[2]" });
+ String[] expectedValues = new String[] { "1094861636", "1162233672" };
+ for (int i = 0; i < children.length; i++) {
+ final IExpressionDMContext child = children[i];
+ Query<String> query = new Query<String>() {
+ @Override
+ protected void execute(final DataRequestMonitor<String> rm) {
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(child, IFormattedValues.NATURAL_FORMAT),
+ new ImmediateDataRequestMonitor<FormattedValueDMData>(rm) {
+ @Override
+ protected void handleCompleted() {
+ rm.done(getData().getFormattedValue());
+ }
+ });
+ }
+ };
+
+ fSession.getExecutor().execute(query);
+ String value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ assertEquals(expectedValues[i], value);
+ }
+
// Now check that the casted type still remembers what its original type is
assertEquals(castExprDmc.getParents()[0], exprDmc);
- }
-
- /**
- * This test verifies that we can display as array and cast to a type together
- * and then revert.
- */
- @Test
- public void testDisplayAsArrayAndCastToType() throws Throwable {
- SyncUtil.runToLocation("testCasting");
- MIStoppedEvent stoppedEvent = SyncUtil.step(3, StepType.STEP_OVER);
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
-
- IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, "int_ptr");
-
- assertTrue("Expression service does not support casting", fExpService instanceof IExpressions2);
-
- // We create the casted type and the displaying as an array in a single request. This is because
- // that is the way the UI does it. Furthermore, the service handles the cast first, then the
- // array, which is why our array of 2 ints becomes 8 chars, and then we only look at 4 of them
- // starting at index 4.
- ICastedExpressionDMContext castExprDmc =
- ((IExpressions2)fExpService).createCastedExpression(exprDmc, new CastInfo("char*", 4,4));
-
- getExpressionType(castExprDmc, "char [4]");
-
- assertChildrenCount(castExprDmc, 4);
- // get children and their values
- // The array index starts at 0 again because the cast to char[] creates a new array
- final IExpressionDMContext[] children =
- getChildren(castExprDmc, new String[] {"int_ptr[4]", "int_ptr[5]", "int_ptr[6]", "int_ptr[7]"});
- String[] expectedValues = new String[] { "68 'D'", "67 'C'", "66 'B'", "65 'A'"};
- for (int i = 0; i<children.length;i++) {
- final IExpressionDMContext child = children[i];
-
- getExpressionType(child, "char");
-
- Query<String> query = new Query<String>() {
- @Override
- protected void execute(final DataRequestMonitor<String> rm) {
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(child, IFormattedValues.NATURAL_FORMAT),
- new ImmediateDataRequestMonitor<FormattedValueDMData>(rm) {
- @Override
- protected void handleCompleted() {
- rm.done(getData().getFormattedValue());
- }
- });
- }
- };
-
- fSession.getExecutor().execute(query);
- String value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
- assertEquals(expectedValues[i], value);
- }
-
-
+ }
+
+ /**
+ * This test verifies that we can display as array and cast to a type together
+ * and then revert.
+ */
+ @Test
+ public void testDisplayAsArrayAndCastToType() throws Throwable {
+ SyncUtil.runToLocation("testCasting");
+ MIStoppedEvent stoppedEvent = SyncUtil.step(3, StepType.STEP_OVER);
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+
+ IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, "int_ptr");
+
+ assertTrue("Expression service does not support casting", fExpService instanceof IExpressions2);
+
+ // We create the casted type and the displaying as an array in a single request. This is because
+ // that is the way the UI does it. Furthermore, the service handles the cast first, then the
+ // array, which is why our array of 2 ints becomes 8 chars, and then we only look at 4 of them
+ // starting at index 4.
+ ICastedExpressionDMContext castExprDmc = ((IExpressions2) fExpService).createCastedExpression(exprDmc,
+ new CastInfo("char*", 4, 4));
+
+ getExpressionType(castExprDmc, "char [4]");
+
+ assertChildrenCount(castExprDmc, 4);
+ // get children and their values
+ // The array index starts at 0 again because the cast to char[] creates a new array
+ final IExpressionDMContext[] children = getChildren(castExprDmc,
+ new String[] { "int_ptr[4]", "int_ptr[5]", "int_ptr[6]", "int_ptr[7]" });
+ String[] expectedValues = new String[] { "68 'D'", "67 'C'", "66 'B'", "65 'A'" };
+ for (int i = 0; i < children.length; i++) {
+ final IExpressionDMContext child = children[i];
+
+ getExpressionType(child, "char");
+
+ Query<String> query = new Query<String>() {
+ @Override
+ protected void execute(final DataRequestMonitor<String> rm) {
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(child, IFormattedValues.NATURAL_FORMAT),
+ new ImmediateDataRequestMonitor<FormattedValueDMData>(rm) {
+ @Override
+ protected void handleCompleted() {
+ rm.done(getData().getFormattedValue());
+ }
+ });
+ }
+ };
+
+ fSession.getExecutor().execute(query);
+ String value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ assertEquals(expectedValues[i], value);
+ }
+
// Now check that the casted type still remembers what its original type is
assertEquals(castExprDmc.getParents()[0], exprDmc);
- }
-
- /**
- * This test verifies that we can cast an array to a different type and then revert.
- */
- @Test
- public void testCastToTypeOfArray() throws Throwable {
- SyncUtil.runToLocation("testCasting");
- MIStoppedEvent stoppedEvent = SyncUtil.step(3, StepType.STEP_OVER);
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
-
- IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, "array_small");
-
- assertTrue("Expression service does not support casting", fExpService instanceof IExpressions2);
-
- ICastedExpressionDMContext castExprDmc =
- ((IExpressions2)fExpService).createCastedExpression(exprDmc, new CastInfo("char[]"));
-
- getExpressionType(exprDmc, "int [4]");
- getExpressionType(castExprDmc, "char [16]");
-
- assertChildrenCount(castExprDmc, 16);
- // get children and their values
- // The array index starts at 0 again because the cast to char[] creates a new array
- final IExpressionDMContext[] children =
- getChildren(castExprDmc, new String[] {"array_small[0]", "array_small[1]", "array_small[2]", "array_small[3]",
- "array_small[4]", "array_small[5]", "array_small[6]", "array_small[7]",
- "array_small[8]", "array_small[9]", "array_small[10]", "array_small[11]",
- "array_small[12]", "array_small[13]", "array_small[14]", "array_small[15]"});
- // Only check elements 4 through 7 for simplicity
- String[] expectedValues = new String[] { "68 'D'", "67 'C'", "66 'B'", "65 'A'"};
- for (int i = 4; i<8;i++) {
- final IExpressionDMContext child = children[i];
-
- getExpressionType(child, "char");
-
- Query<String> query = new Query<String>() {
- @Override
- protected void execute(final DataRequestMonitor<String> rm) {
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(child, IFormattedValues.NATURAL_FORMAT),
- new ImmediateDataRequestMonitor<FormattedValueDMData>(rm) {
- @Override
- protected void handleCompleted() {
- rm.done(getData().getFormattedValue());
- }
- });
- }
- };
-
- fSession.getExecutor().execute(query);
- String value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
- assertEquals(expectedValues[i-4], value);
- }
-
-
+ }
+
+ /**
+ * This test verifies that we can cast an array to a different type and then revert.
+ */
+ @Test
+ public void testCastToTypeOfArray() throws Throwable {
+ SyncUtil.runToLocation("testCasting");
+ MIStoppedEvent stoppedEvent = SyncUtil.step(3, StepType.STEP_OVER);
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+
+ IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, "array_small");
+
+ assertTrue("Expression service does not support casting", fExpService instanceof IExpressions2);
+
+ ICastedExpressionDMContext castExprDmc = ((IExpressions2) fExpService).createCastedExpression(exprDmc,
+ new CastInfo("char[]"));
+
+ getExpressionType(exprDmc, "int [4]");
+ getExpressionType(castExprDmc, "char [16]");
+
+ assertChildrenCount(castExprDmc, 16);
+ // get children and their values
+ // The array index starts at 0 again because the cast to char[] creates a new array
+ final IExpressionDMContext[] children = getChildren(castExprDmc,
+ new String[] { "array_small[0]", "array_small[1]", "array_small[2]", "array_small[3]", "array_small[4]",
+ "array_small[5]", "array_small[6]", "array_small[7]", "array_small[8]", "array_small[9]",
+ "array_small[10]", "array_small[11]", "array_small[12]", "array_small[13]", "array_small[14]",
+ "array_small[15]" });
+ // Only check elements 4 through 7 for simplicity
+ String[] expectedValues = new String[] { "68 'D'", "67 'C'", "66 'B'", "65 'A'" };
+ for (int i = 4; i < 8; i++) {
+ final IExpressionDMContext child = children[i];
+
+ getExpressionType(child, "char");
+
+ Query<String> query = new Query<String>() {
+ @Override
+ protected void execute(final DataRequestMonitor<String> rm) {
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(child, IFormattedValues.NATURAL_FORMAT),
+ new ImmediateDataRequestMonitor<FormattedValueDMData>(rm) {
+ @Override
+ protected void handleCompleted() {
+ rm.done(getData().getFormattedValue());
+ }
+ });
+ }
+ };
+
+ fSession.getExecutor().execute(query);
+ String value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ assertEquals(expectedValues[i - 4], value);
+ }
+
// Now check that the casted type still remembers what its original type is
assertEquals(castExprDmc.getParents()[0], exprDmc);
- }
-
- /**
- * This test verifies that we can cast to a type and then revert
- * when dealing with an array with partitions.
- */
- @Test
- public void testCastToTypeWithPartition() throws Throwable {
- SyncUtil.runToLocation("testCasting");
- MIStoppedEvent stoppedEvent = SyncUtil.step(3, StepType.STEP_OVER);
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
-
- IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, "array_large");
-
- assertTrue("Expression service does not support casting", fExpService instanceof IExpressions2);
-
- ICastedExpressionDMContext castExprDmc =
- ((IExpressions2)fExpService).createCastedExpression(exprDmc, new CastInfo("char[]"));
-
- // Check type of original expression and new casted one
- getExpressionType(exprDmc, "int [111]");
- getExpressionType(castExprDmc, "char [444]");
-
- // get the 5 partition children
- assertChildrenCount(castExprDmc, 5);
- IExpressionDMContext[] children = getChildren(castExprDmc, new String[] {"*((((char[])(array_large)))+0)@100", "*((((char[])(array_large)))+100)@100",
- "*((((char[])(array_large)))+200)@100", "*((((char[])(array_large)))+300)@100",
- "*((((char[])(array_large)))+400)@44" });
-
- // Now make sure the children of the partitions have the proper casting
- final String[] expectedChildren = new String[100];
- for (int i=0; i < expectedChildren.length; i++) {
- expectedChildren[i] = String.format("array_large[%d]", i);
- }
- IExpressionDMContext[] castedChildren = getChildren(children[0], expectedChildren);
- assertEquals(100, castedChildren.length);
-
- // Check the type and value of a few of the first children
- final String[] expectedValues = new String[] { "65 'A'", "0 '\\0'", "0 '\\0'", "0 '\\0'", "68 'D'", "67 'C'", "66 'B'", "65 'A'" };
- for (int i = 0; i < expectedValues.length; i++) {
- final IExpressionDMContext child = castedChildren[i];
- getExpressionType(child, "char");
-
- Query<String> query = new Query<String>() {
- @Override
- protected void execute(final DataRequestMonitor<String> rm) {
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(child, IFormattedValues.NATURAL_FORMAT),
- new ImmediateDataRequestMonitor<FormattedValueDMData>(rm) {
- @Override
- protected void handleCompleted() {
- rm.done(getData().getFormattedValue());
- }
- });
- }
- };
-
- fSession.getExecutor().execute(query);
- String value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
- assertEquals(expectedValues[i], value);
- }
-
+ }
+
+ /**
+ * This test verifies that we can cast to a type and then revert
+ * when dealing with an array with partitions.
+ */
+ @Test
+ public void testCastToTypeWithPartition() throws Throwable {
+ SyncUtil.runToLocation("testCasting");
+ MIStoppedEvent stoppedEvent = SyncUtil.step(3, StepType.STEP_OVER);
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+
+ IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, "array_large");
+
+ assertTrue("Expression service does not support casting", fExpService instanceof IExpressions2);
+
+ ICastedExpressionDMContext castExprDmc = ((IExpressions2) fExpService).createCastedExpression(exprDmc,
+ new CastInfo("char[]"));
+
+ // Check type of original expression and new casted one
+ getExpressionType(exprDmc, "int [111]");
+ getExpressionType(castExprDmc, "char [444]");
+
+ // get the 5 partition children
+ assertChildrenCount(castExprDmc, 5);
+ IExpressionDMContext[] children = getChildren(castExprDmc,
+ new String[] { "*((((char[])(array_large)))+0)@100", "*((((char[])(array_large)))+100)@100",
+ "*((((char[])(array_large)))+200)@100", "*((((char[])(array_large)))+300)@100",
+ "*((((char[])(array_large)))+400)@44" });
+
+ // Now make sure the children of the partitions have the proper casting
+ final String[] expectedChildren = new String[100];
+ for (int i = 0; i < expectedChildren.length; i++) {
+ expectedChildren[i] = String.format("array_large[%d]", i);
+ }
+ IExpressionDMContext[] castedChildren = getChildren(children[0], expectedChildren);
+ assertEquals(100, castedChildren.length);
+
+ // Check the type and value of a few of the first children
+ final String[] expectedValues = new String[] { "65 'A'", "0 '\\0'", "0 '\\0'", "0 '\\0'", "68 'D'", "67 'C'",
+ "66 'B'", "65 'A'" };
+ for (int i = 0; i < expectedValues.length; i++) {
+ final IExpressionDMContext child = castedChildren[i];
+ getExpressionType(child, "char");
+
+ Query<String> query = new Query<String>() {
+ @Override
+ protected void execute(final DataRequestMonitor<String> rm) {
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(child, IFormattedValues.NATURAL_FORMAT),
+ new ImmediateDataRequestMonitor<FormattedValueDMData>(rm) {
+ @Override
+ protected void handleCompleted() {
+ rm.done(getData().getFormattedValue());
+ }
+ });
+ }
+ };
+
+ fSession.getExecutor().execute(query);
+ String value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ assertEquals(expectedValues[i], value);
+ }
+
// Now check that the casted type still remembers what its original type is
assertEquals(castExprDmc.getParents()[0], exprDmc);
- }
-
- /**
- * This test verifies that we can display as array and then revert
- * when dealing with an array with partitions.
- */
- @Test
- public void testDisplayAsArrayWithPartition() throws Throwable {
- SyncUtil.runToLocation("testCasting");
- MIStoppedEvent stoppedEvent = SyncUtil.step(3, StepType.STEP_OVER);
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
-
- // The expression we will cast from int to char
- IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, "array_large");
-
- assertTrue("Expression service does not support casting", fExpService instanceof IExpressions2);
-
- // Display as an array of 101 elements, starting at index 1 (we need at least 101 elements to get partitions)
- ICastedExpressionDMContext castExprDmc =
- ((IExpressions2)fExpService).createCastedExpression(exprDmc, new CastInfo(1, 101));
-
- // Check type of original expression and new casted one
- getExpressionType(exprDmc, "int [111]");
- getExpressionType(castExprDmc, "int [101]");
-
- // Two partitions as children
- assertChildrenCount(castExprDmc, 2);
- IExpressionDMContext[] children = getChildren(castExprDmc, new String[] {"*(((*((array_large)+1)@101))+0)@100", "*(((*((array_large)+1)@101))+100)@1" });
-
- assertTrue("Should have seen the child as a partition", children[0] instanceof IIndexedPartitionDMContext);
- assertEquals("Wrong start index for partition", 0, ((IIndexedPartitionDMContext)children[0]).getIndex());
- assertEquals("Wrong partition length", 100, ((IIndexedPartitionDMContext)children[0]).getLength());
- assertTrue("Should have seen the child as a partition", children[1] instanceof IIndexedPartitionDMContext);
- assertEquals("Wrong start index for partition", 100, ((IIndexedPartitionDMContext)children[1]).getIndex());
- assertEquals("Wrong partition length", 1, ((IIndexedPartitionDMContext)children[1]).getLength());
-
- // Now make sure the children of the partitions have the proper casting and start at the proper index
- final String[] expectedChildren = new String[100];
- for (int i=0; i < expectedChildren.length; i++) {
- expectedChildren[i] = String.format("array_large[%d]", i+1);
- }
- IExpressionDMContext[] castedChildren = getChildren(children[0], expectedChildren);
- assertEquals(100, castedChildren.length);
-
- // Check the type and value of a few of the first children
- final String[] expectedValues = new String[] { "1094861636", "1162233672" };
- for (int i = 0; i < expectedValues.length; i++) {
- final IExpressionDMContext child = castedChildren[i];
- getExpressionType(child, "int");
-
- Query<String> query = new Query<String>() {
- @Override
- protected void execute(final DataRequestMonitor<String> rm) {
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(child, IFormattedValues.NATURAL_FORMAT),
- new ImmediateDataRequestMonitor<FormattedValueDMData>(rm) {
- @Override
- protected void handleCompleted() {
- rm.done(getData().getFormattedValue());
- }
- });
- }
- };
-
- fSession.getExecutor().execute(query);
- String value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
- assertEquals(expectedValues[i], value);
- }
-
+ }
+
+ /**
+ * This test verifies that we can display as array and then revert
+ * when dealing with an array with partitions.
+ */
+ @Test
+ public void testDisplayAsArrayWithPartition() throws Throwable {
+ SyncUtil.runToLocation("testCasting");
+ MIStoppedEvent stoppedEvent = SyncUtil.step(3, StepType.STEP_OVER);
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+
+ // The expression we will cast from int to char
+ IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, "array_large");
+
+ assertTrue("Expression service does not support casting", fExpService instanceof IExpressions2);
+
+ // Display as an array of 101 elements, starting at index 1 (we need at least 101 elements to get partitions)
+ ICastedExpressionDMContext castExprDmc = ((IExpressions2) fExpService).createCastedExpression(exprDmc,
+ new CastInfo(1, 101));
+
+ // Check type of original expression and new casted one
+ getExpressionType(exprDmc, "int [111]");
+ getExpressionType(castExprDmc, "int [101]");
+
+ // Two partitions as children
+ assertChildrenCount(castExprDmc, 2);
+ IExpressionDMContext[] children = getChildren(castExprDmc,
+ new String[] { "*(((*((array_large)+1)@101))+0)@100", "*(((*((array_large)+1)@101))+100)@1" });
+
+ assertTrue("Should have seen the child as a partition", children[0] instanceof IIndexedPartitionDMContext);
+ assertEquals("Wrong start index for partition", 0, ((IIndexedPartitionDMContext) children[0]).getIndex());
+ assertEquals("Wrong partition length", 100, ((IIndexedPartitionDMContext) children[0]).getLength());
+ assertTrue("Should have seen the child as a partition", children[1] instanceof IIndexedPartitionDMContext);
+ assertEquals("Wrong start index for partition", 100, ((IIndexedPartitionDMContext) children[1]).getIndex());
+ assertEquals("Wrong partition length", 1, ((IIndexedPartitionDMContext) children[1]).getLength());
+
+ // Now make sure the children of the partitions have the proper casting and start at the proper index
+ final String[] expectedChildren = new String[100];
+ for (int i = 0; i < expectedChildren.length; i++) {
+ expectedChildren[i] = String.format("array_large[%d]", i + 1);
+ }
+ IExpressionDMContext[] castedChildren = getChildren(children[0], expectedChildren);
+ assertEquals(100, castedChildren.length);
+
+ // Check the type and value of a few of the first children
+ final String[] expectedValues = new String[] { "1094861636", "1162233672" };
+ for (int i = 0; i < expectedValues.length; i++) {
+ final IExpressionDMContext child = castedChildren[i];
+ getExpressionType(child, "int");
+
+ Query<String> query = new Query<String>() {
+ @Override
+ protected void execute(final DataRequestMonitor<String> rm) {
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(child, IFormattedValues.NATURAL_FORMAT),
+ new ImmediateDataRequestMonitor<FormattedValueDMData>(rm) {
+ @Override
+ protected void handleCompleted() {
+ rm.done(getData().getFormattedValue());
+ }
+ });
+ }
+ };
+
+ fSession.getExecutor().execute(query);
+ String value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ assertEquals(expectedValues[i], value);
+ }
+
// Now check that the casted type still remembers what its original type is
assertEquals(castExprDmc.getParents()[0], exprDmc);
- }
-
- /**
- * This test verifies that we can display as array and cast to a type together
- * and then revert when dealing with an array with partitions.
- */
- @Test
- public void testDisplayAsArrayAndCastToTypeWithPartition() throws Throwable {
- SyncUtil.runToLocation("testCasting");
- MIStoppedEvent stoppedEvent = SyncUtil.step(3, StepType.STEP_OVER);
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
-
- IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, "array_large");
-
- assertTrue("Expression service does not support casting", fExpService instanceof IExpressions2);
-
- ICastedExpressionDMContext castExprDmc =
- ((IExpressions2)fExpService).createCastedExpression(exprDmc, new CastInfo("char[]", 4, 101));
-
- // Check type of original expression and new casted one
- getExpressionType(exprDmc, "int [111]");
- getExpressionType(castExprDmc, "char [101]");
-
- // get the 5 partition children
- assertChildrenCount(castExprDmc, 2);
- IExpressionDMContext[] children = getChildren(castExprDmc, new String[] {"*(((*(((char[])(array_large))+4)@101))+0)@100", "*(((*(((char[])(array_large))+4)@101))+100)@1"});
-
- assertTrue("Should have seen the child as a partition", children[0] instanceof IIndexedPartitionDMContext);
- assertEquals("Wrong start index for partition", 0, ((IIndexedPartitionDMContext)children[0]).getIndex());
- assertEquals("Wrong partition length", 100, ((IIndexedPartitionDMContext)children[0]).getLength());
- assertTrue("Should have seen the child as a partition", children[1] instanceof IIndexedPartitionDMContext);
- assertEquals("Wrong start index for partition", 100, ((IIndexedPartitionDMContext)children[1]).getIndex());
- assertEquals("Wrong partition length", 1, ((IIndexedPartitionDMContext)children[1]).getLength());
-
- // Now make sure the children of the partitions have the proper casting
- final String[] expectedChildren = new String[100];
- for (int i=0; i < expectedChildren.length; i++) {
- expectedChildren[i] = String.format("array_large[%d]", i+4);
- }
- IExpressionDMContext[] castedChildren = getChildren(children[0], expectedChildren);
- assertEquals(100, castedChildren.length);
-
- // Check the type and value of a few of the first children
- final String[] expectedValues = new String[] { "68 'D'", "67 'C'", "66 'B'", "65 'A'" };
- for (int i = 0; i < expectedValues.length; i++) {
- final IExpressionDMContext child = castedChildren[i];
- getExpressionType(child, "char");
-
- Query<String> query = new Query<String>() {
- @Override
- protected void execute(final DataRequestMonitor<String> rm) {
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(child, IFormattedValues.NATURAL_FORMAT),
- new ImmediateDataRequestMonitor<FormattedValueDMData>(rm) {
- @Override
- protected void handleCompleted() {
- rm.done(getData().getFormattedValue());
- }
- });
- }
- };
-
- fSession.getExecutor().execute(query);
- String value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
- assertEquals(expectedValues[i], value);
- }
-
+ }
+
+ /**
+ * This test verifies that we can display as array and cast to a type together
+ * and then revert when dealing with an array with partitions.
+ */
+ @Test
+ public void testDisplayAsArrayAndCastToTypeWithPartition() throws Throwable {
+ SyncUtil.runToLocation("testCasting");
+ MIStoppedEvent stoppedEvent = SyncUtil.step(3, StepType.STEP_OVER);
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+
+ IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, "array_large");
+
+ assertTrue("Expression service does not support casting", fExpService instanceof IExpressions2);
+
+ ICastedExpressionDMContext castExprDmc = ((IExpressions2) fExpService).createCastedExpression(exprDmc,
+ new CastInfo("char[]", 4, 101));
+
+ // Check type of original expression and new casted one
+ getExpressionType(exprDmc, "int [111]");
+ getExpressionType(castExprDmc, "char [101]");
+
+ // get the 5 partition children
+ assertChildrenCount(castExprDmc, 2);
+ IExpressionDMContext[] children = getChildren(castExprDmc, new String[] {
+ "*(((*(((char[])(array_large))+4)@101))+0)@100", "*(((*(((char[])(array_large))+4)@101))+100)@1" });
+
+ assertTrue("Should have seen the child as a partition", children[0] instanceof IIndexedPartitionDMContext);
+ assertEquals("Wrong start index for partition", 0, ((IIndexedPartitionDMContext) children[0]).getIndex());
+ assertEquals("Wrong partition length", 100, ((IIndexedPartitionDMContext) children[0]).getLength());
+ assertTrue("Should have seen the child as a partition", children[1] instanceof IIndexedPartitionDMContext);
+ assertEquals("Wrong start index for partition", 100, ((IIndexedPartitionDMContext) children[1]).getIndex());
+ assertEquals("Wrong partition length", 1, ((IIndexedPartitionDMContext) children[1]).getLength());
+
+ // Now make sure the children of the partitions have the proper casting
+ final String[] expectedChildren = new String[100];
+ for (int i = 0; i < expectedChildren.length; i++) {
+ expectedChildren[i] = String.format("array_large[%d]", i + 4);
+ }
+ IExpressionDMContext[] castedChildren = getChildren(children[0], expectedChildren);
+ assertEquals(100, castedChildren.length);
+
+ // Check the type and value of a few of the first children
+ final String[] expectedValues = new String[] { "68 'D'", "67 'C'", "66 'B'", "65 'A'" };
+ for (int i = 0; i < expectedValues.length; i++) {
+ final IExpressionDMContext child = castedChildren[i];
+ getExpressionType(child, "char");
+
+ Query<String> query = new Query<String>() {
+ @Override
+ protected void execute(final DataRequestMonitor<String> rm) {
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(child, IFormattedValues.NATURAL_FORMAT),
+ new ImmediateDataRequestMonitor<FormattedValueDMData>(rm) {
+ @Override
+ protected void handleCompleted() {
+ rm.done(getData().getFormattedValue());
+ }
+ });
+ }
+ };
+
+ fSession.getExecutor().execute(query);
+ String value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ assertEquals(expectedValues[i], value);
+ }
+
// Now check that the casted type still remembers what its original type is
- assertEquals(castExprDmc.getParents()[0], exprDmc);
- }
-
- /**
- * This test verifies that we display the simple return value of a method after
- * a step-return operation, but only for the first stack frame.
- */
- @Test
- public void testDisplaySimpleReturnValueForStepReturn() throws Throwable {
- SyncUtil.runToLocation("testSimpleReturn");
- MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_RETURN);
-
- // Check the return value is shown when looking at the first frame
- final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
- IVariableDMData[] result = SyncUtil.getLocals(frameDmc);
-
- assertEquals(3, result.length); // Two variables and one return value
-
- // Return value
- assertEquals("$2", result[0].getName());
- assertEquals("6", result[0].getValue());
- // first variable
- assertEquals("a", result[1].getName());
- assertEquals("10", result[1].getValue());
- // Second variable
- assertEquals("b", result[2].getName());
- assertEquals("false", result[2].getValue());
-
- // Now check how the return value will be displayed to the user
- final IExpressionDMContext returnExprDmc = SyncUtil.createExpression(frameDmc, "$2");
+ assertEquals(castExprDmc.getParents()[0], exprDmc);
+ }
+
+ /**
+ * This test verifies that we display the simple return value of a method after
+ * a step-return operation, but only for the first stack frame.
+ */
+ @Test
+ public void testDisplaySimpleReturnValueForStepReturn() throws Throwable {
+ SyncUtil.runToLocation("testSimpleReturn");
+ MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_RETURN);
+
+ // Check the return value is shown when looking at the first frame
+ final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ IVariableDMData[] result = SyncUtil.getLocals(frameDmc);
+
+ assertEquals(3, result.length); // Two variables and one return value
+
+ // Return value
+ assertEquals("$2", result[0].getName());
+ assertEquals("6", result[0].getValue());
+ // first variable
+ assertEquals("a", result[1].getName());
+ assertEquals("10", result[1].getValue());
+ // Second variable
+ assertEquals("b", result[2].getName());
+ assertEquals("false", result[2].getValue());
+
+ // Now check how the return value will be displayed to the user
+ final IExpressionDMContext returnExprDmc = SyncUtil.createExpression(frameDmc, "$2");
Query<IExpressionDMData> query = new Query<IExpressionDMData>() {
@Override
protected void execute(final DataRequestMonitor<IExpressionDMData> rm) {
@@ -3852,44 +3958,44 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
// Now check the actual value using the expression service
String value = SyncUtil.getExpressionValue(returnExprDmc, IFormattedValues.DECIMAL_FORMAT);
assertEquals("6", value);
-
- // Now make sure we don't show the return value for another frame
+
+ // Now make sure we don't show the return value for another frame
final IFrameDMContext frameDmc2 = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 1);
- result = SyncUtil.getLocals(frameDmc2);
-
- // only one variable
- assertEquals(1, result.length);
- assertEquals("b", result[0].getName());
- }
-
- /**
- * This test verifies that we display the complex return value of a method after
- * a step-return operation, but only for the first stack frame.
- */
- @Test
- public void testDisplayComplexReturnValueForStepReturn() throws Throwable {
- SyncUtil.runToLocation("testComplexReturn");
- MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_RETURN);
-
- // Check the return value is show when looking at the first frame
- final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
- IVariableDMData[] result = SyncUtil.getLocals(frameDmc);
-
- assertEquals(3, result.length); // Two variables and one return value
-
- // Return value
- assertEquals("$2", result[0].getName());
-
- // first variable
- assertEquals("a", result[1].getName());
- assertEquals("10", result[1].getValue());
- // Second variable
- assertEquals("b", result[2].getName());
- assertEquals("false", result[2].getValue());
-
- // Now check how the return value will be displayed to the user
- final IExpressionDMContext returnExprDmc = SyncUtil.createExpression(frameDmc, "$2");
- Query<IExpressionDMData> query = new Query<IExpressionDMData>() {
+ result = SyncUtil.getLocals(frameDmc2);
+
+ // only one variable
+ assertEquals(1, result.length);
+ assertEquals("b", result[0].getName());
+ }
+
+ /**
+ * This test verifies that we display the complex return value of a method after
+ * a step-return operation, but only for the first stack frame.
+ */
+ @Test
+ public void testDisplayComplexReturnValueForStepReturn() throws Throwable {
+ SyncUtil.runToLocation("testComplexReturn");
+ MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_RETURN);
+
+ // Check the return value is show when looking at the first frame
+ final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ IVariableDMData[] result = SyncUtil.getLocals(frameDmc);
+
+ assertEquals(3, result.length); // Two variables and one return value
+
+ // Return value
+ assertEquals("$2", result[0].getName());
+
+ // first variable
+ assertEquals("a", result[1].getName());
+ assertEquals("10", result[1].getValue());
+ // Second variable
+ assertEquals("b", result[2].getName());
+ assertEquals("false", result[2].getValue());
+
+ // Now check how the return value will be displayed to the user
+ final IExpressionDMContext returnExprDmc = SyncUtil.createExpression(frameDmc, "$2");
+ Query<IExpressionDMData> query = new Query<IExpressionDMData>() {
@Override
protected void execute(final DataRequestMonitor<IExpressionDMData> rm) {
fExpService.getExpressionData(returnExprDmc, rm);
@@ -3902,206 +4008,207 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
// Now check the content of the complex return expression
doTestChildren(returnExprDmc);
- // Now make sure we don't show the return value for another frame
+ // Now make sure we don't show the return value for another frame
IFrameDMContext frameDmc2 = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 1);
- result = SyncUtil.getLocals(frameDmc2);
-
- // only one variable
- assertEquals(1, result.length);
- assertEquals("b", result[0].getName());
- }
-
- /**
- * This test verifies that we properly display variables after a step-return operation
- * from a method returning void.
- */
- @Test
- public void testNoReturnValueForEmptyStepReturn() throws Throwable {
- SyncUtil.runToLocation("noReturnValue");
- MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_RETURN);
-
- // Check no return value is shown when looking at the first frame
- final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
- IVariableDMData[] result = SyncUtil.getLocals(frameDmc);
-
- assertEquals(2, result.length); // Two variables and one return value
-
- // first variable
- assertEquals("a", result[0].getName());
- assertEquals("10", result[0].getValue());
- // Second variable
- assertEquals("b", result[1].getName());
- assertEquals("false", result[1].getValue());
- }
-
- /**
- * This tests verifies that we can obtain a child even though
- * is was already created directly.
- */
- @Test
- public void testExistingChild() throws Throwable {
- SyncUtil.runToLocation("testExistingChild");
- MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
-
- final String PARENT_EXPR = "b";
- final String CHILD_EXPR = "((b).d)";
- final String CHILD__REL_EXPR = "d";
-
- // Fetch the child directly
- final IExpressionDMContext childDmc = SyncUtil.createExpression(frameDmc, CHILD_EXPR);
- Query<String> query = new Query<String>() {
+ result = SyncUtil.getLocals(frameDmc2);
+
+ // only one variable
+ assertEquals(1, result.length);
+ assertEquals("b", result[0].getName());
+ }
+
+ /**
+ * This test verifies that we properly display variables after a step-return operation
+ * from a method returning void.
+ */
+ @Test
+ public void testNoReturnValueForEmptyStepReturn() throws Throwable {
+ SyncUtil.runToLocation("noReturnValue");
+ MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_RETURN);
+
+ // Check no return value is shown when looking at the first frame
+ final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ IVariableDMData[] result = SyncUtil.getLocals(frameDmc);
+
+ assertEquals(2, result.length); // Two variables and one return value
+
+ // first variable
+ assertEquals("a", result[0].getName());
+ assertEquals("10", result[0].getValue());
+ // Second variable
+ assertEquals("b", result[1].getName());
+ assertEquals("false", result[1].getValue());
+ }
+
+ /**
+ * This tests verifies that we can obtain a child even though
+ * is was already created directly.
+ */
+ @Test
+ public void testExistingChild() throws Throwable {
+ SyncUtil.runToLocation("testExistingChild");
+ MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+
+ final String PARENT_EXPR = "b";
+ final String CHILD_EXPR = "((b).d)";
+ final String CHILD__REL_EXPR = "d";
+
+ // Fetch the child directly
+ final IExpressionDMContext childDmc = SyncUtil.createExpression(frameDmc, CHILD_EXPR);
+ Query<String> query = new Query<String>() {
@Override
protected void execute(final DataRequestMonitor<String> rm) {
fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(childDmc, IFormattedValues.NATURAL_FORMAT),
+ fExpService.getFormattedValueContext(childDmc, IFormattedValues.NATURAL_FORMAT),
new ImmediateDataRequestMonitor<FormattedValueDMData>(rm) {
@Override
protected void handleSuccess() {
rm.done(getData().getFormattedValue());
- }
+ }
});
}
- };
-
- fSession.getExecutor().execute(query);
- String value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ };
+
+ fSession.getExecutor().execute(query);
+ String value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
assertEquals("8", value);
- // Now fetch the child through its parent
- final IExpressionDMContext parentDmc = SyncUtil.createExpression(frameDmc, PARENT_EXPR);
- query = new Query<String>() {
+ // Now fetch the child through its parent
+ final IExpressionDMContext parentDmc = SyncUtil.createExpression(frameDmc, PARENT_EXPR);
+ query = new Query<String>() {
@Override
protected void execute(final DataRequestMonitor<String> rm) {
- fExpService.getSubExpressions(
- parentDmc,
- new ImmediateDataRequestMonitor<IExpressionDMContext[]>(rm) {
- @Override
- protected void handleSuccess() {
- if (getData().length != 2) {
- rm.done(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Wrong number for children. Expecting 2 but got " + getData().length, null));
- return;
- }
-
- MIExpressionDMC firstChildContext = (MIExpressionDMC)getData()[0];
- if (firstChildContext.getExpression().equals(CHILD_EXPR) == false) {
- rm.done(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Got wrong first child. Expected " + CHILD_EXPR + " but got " + firstChildContext.getExpression(), null));
- return;
- }
-
- if (firstChildContext.getRelativeExpression().equals(CHILD__REL_EXPR) == false) {
- rm.done(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Got wrong relative expression. Expected " + CHILD__REL_EXPR + " but got " + firstChildContext.getRelativeExpression(), null));
- return;
- }
-
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(firstChildContext, IFormattedValues.NATURAL_FORMAT),
- new ImmediateDataRequestMonitor<FormattedValueDMData>(rm) {
- @Override
- protected void handleSuccess() {
- rm.done(getData().getFormattedValue());
- }
- });
-
- }
- });
+ fExpService.getSubExpressions(parentDmc, new ImmediateDataRequestMonitor<IExpressionDMContext[]>(rm) {
+ @Override
+ protected void handleSuccess() {
+ if (getData().length != 2) {
+ rm.done(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Wrong number for children. Expecting 2 but got " + getData().length, null));
+ return;
+ }
+
+ MIExpressionDMC firstChildContext = (MIExpressionDMC) getData()[0];
+ if (firstChildContext.getExpression().equals(CHILD_EXPR) == false) {
+ rm.done(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID, "Got wrong first child. Expected "
+ + CHILD_EXPR + " but got " + firstChildContext.getExpression(), null));
+ return;
+ }
+
+ if (firstChildContext.getRelativeExpression().equals(CHILD__REL_EXPR) == false) {
+ rm.done(new Status(
+ IStatus.ERROR, TestsPlugin.PLUGIN_ID, "Got wrong relative expression. Expected "
+ + CHILD__REL_EXPR + " but got " + firstChildContext.getRelativeExpression(),
+ null));
+ return;
+ }
+
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(firstChildContext,
+ IFormattedValues.NATURAL_FORMAT),
+ new ImmediateDataRequestMonitor<FormattedValueDMData>(rm) {
+ @Override
+ protected void handleSuccess() {
+ rm.done(getData().getFormattedValue());
+ }
+ });
+
+ }
+ });
}
- };
-
- fSession.getExecutor().execute(query);
- value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ };
+
+ fSession.getExecutor().execute(query);
+ value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
assertEquals("8", value);
- }
-
- /**
- * This tests verifies that we can manually create a child of an expression
- * after that child was automatically created through the parent.
- * This case happens when selecting a child of an expression and using "Watch"
- * to create an expression automatically.
- */
- @Test
- public void testExplicitChildCreation() throws Throwable {
- SyncUtil.runToLocation("testExistingChild");
- MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
-
- final String PARENT_EXPR = "b";
- final String CHILD_EXPR = "((b).d)";
- final String CHILD__REL_EXPR = "d";
-
- // First fetch the child through its parent
- final IExpressionDMContext parentDmc = SyncUtil.createExpression(frameDmc, PARENT_EXPR);
- Query<String> query = new Query<String>() {
+ }
+
+ /**
+ * This tests verifies that we can manually create a child of an expression
+ * after that child was automatically created through the parent.
+ * This case happens when selecting a child of an expression and using "Watch"
+ * to create an expression automatically.
+ */
+ @Test
+ public void testExplicitChildCreation() throws Throwable {
+ SyncUtil.runToLocation("testExistingChild");
+ MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+
+ final String PARENT_EXPR = "b";
+ final String CHILD_EXPR = "((b).d)";
+ final String CHILD__REL_EXPR = "d";
+
+ // First fetch the child through its parent
+ final IExpressionDMContext parentDmc = SyncUtil.createExpression(frameDmc, PARENT_EXPR);
+ Query<String> query = new Query<String>() {
@Override
protected void execute(final DataRequestMonitor<String> rm) {
- fExpService.getSubExpressions(
- parentDmc,
- new ImmediateDataRequestMonitor<IExpressionDMContext[]>(rm) {
- @Override
- protected void handleSuccess() {
- if (getData().length != 2) {
- rm.done(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Wrong number for children. Expecting 2 but got " + getData().length, null));
- return;
- }
-
- MIExpressionDMC firstChildContext = (MIExpressionDMC)getData()[0];
- if (firstChildContext.getExpression().equals(CHILD_EXPR) == false) {
- rm.done(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Got wrong first child. Expected " + CHILD_EXPR + " but got " + firstChildContext.getExpression(), null));
- return;
- }
-
- if (firstChildContext.getRelativeExpression().equals(CHILD__REL_EXPR) == false) {
- rm.done(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
- "Got wrong relative expression. Expected " + CHILD__REL_EXPR + " but got " + firstChildContext.getRelativeExpression(), null));
- return;
- }
-
- fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(firstChildContext, IFormattedValues.NATURAL_FORMAT),
- new ImmediateDataRequestMonitor<FormattedValueDMData>(rm) {
- @Override
- protected void handleSuccess() {
- rm.done(getData().getFormattedValue());
- }
- });
-
- }
- });
+ fExpService.getSubExpressions(parentDmc, new ImmediateDataRequestMonitor<IExpressionDMContext[]>(rm) {
+ @Override
+ protected void handleSuccess() {
+ if (getData().length != 2) {
+ rm.done(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
+ "Wrong number for children. Expecting 2 but got " + getData().length, null));
+ return;
+ }
+
+ MIExpressionDMC firstChildContext = (MIExpressionDMC) getData()[0];
+ if (firstChildContext.getExpression().equals(CHILD_EXPR) == false) {
+ rm.done(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID, "Got wrong first child. Expected "
+ + CHILD_EXPR + " but got " + firstChildContext.getExpression(), null));
+ return;
+ }
+
+ if (firstChildContext.getRelativeExpression().equals(CHILD__REL_EXPR) == false) {
+ rm.done(new Status(
+ IStatus.ERROR, TestsPlugin.PLUGIN_ID, "Got wrong relative expression. Expected "
+ + CHILD__REL_EXPR + " but got " + firstChildContext.getRelativeExpression(),
+ null));
+ return;
+ }
+
+ fExpService.getFormattedExpressionValue(
+ fExpService.getFormattedValueContext(firstChildContext,
+ IFormattedValues.NATURAL_FORMAT),
+ new ImmediateDataRequestMonitor<FormattedValueDMData>(rm) {
+ @Override
+ protected void handleSuccess() {
+ rm.done(getData().getFormattedValue());
+ }
+ });
+
+ }
+ });
}
- };
-
- fSession.getExecutor().execute(query);
- String value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ };
+
+ fSession.getExecutor().execute(query);
+ String value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
assertEquals("8", value);
- // Now access the child directly
- final IExpressionDMContext childDmc = SyncUtil.createExpression(frameDmc, CHILD_EXPR);
- query = new Query<String>() {
+ // Now access the child directly
+ final IExpressionDMContext childDmc = SyncUtil.createExpression(frameDmc, CHILD_EXPR);
+ query = new Query<String>() {
@Override
protected void execute(final DataRequestMonitor<String> rm) {
fExpService.getFormattedExpressionValue(
- fExpService.getFormattedValueContext(childDmc, IFormattedValues.NATURAL_FORMAT),
+ fExpService.getFormattedValueContext(childDmc, IFormattedValues.NATURAL_FORMAT),
new ImmediateDataRequestMonitor<FormattedValueDMData>(rm) {
@Override
protected void handleSuccess() {
rm.done(getData().getFormattedValue());
- }
+ }
});
}
- };
-
- fSession.getExecutor().execute(query);
- value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ };
+
+ fSession.getExecutor().execute(query);
+ value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
assertEquals("8", value);
- }
+ }
- protected void assertChildrenCount(final IExpressionDMContext parentDmc,
- final int expectedCount) throws Throwable {
+ protected void assertChildrenCount(final IExpressionDMContext parentDmc, final int expectedCount) throws Throwable {
Query<Integer> query = new Query<Integer>() {
@Override
@@ -4117,28 +4224,26 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
assertThat(count, is(expectedCount));
}
- protected String getExpressionType(final IExpressionDMContext exprDmc, final String expectedType) throws Throwable {
-
- Query<String> query = new Query<String>() {
+ protected String getExpressionType(final IExpressionDMContext exprDmc, final String expectedType) throws Throwable {
+
+ Query<String> query = new Query<String>() {
@Override
protected void execute(final DataRequestMonitor<String> rm) {
- fExpService.getExpressionData(
- exprDmc,
- new ImmediateDataRequestMonitor<IExpressionDMData>(rm) {
- @Override
- protected void handleCompleted() {
- rm.done(getData().getTypeName());
- }
- });
+ fExpService.getExpressionData(exprDmc, new ImmediateDataRequestMonitor<IExpressionDMData>(rm) {
+ @Override
+ protected void handleCompleted() {
+ rm.done(getData().getTypeName());
+ }
+ });
}
- };
-
- fSession.getExecutor().execute(query);
- String type = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ };
+
+ fSession.getExecutor().execute(query);
+ String type = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
assertEquals(expectedType, type);
return type;
- }
-
+ }
+
// Slight change in GDB output to fix a bug, so we must change the test a
// little
// Bug 320277
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIMemoryTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIMemoryTest.java
index 4e7f97bba26..e73002eb40c 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIMemoryTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIMemoryTest.java
@@ -74,14 +74,14 @@ import org.junit.runners.Parameterized;
public class MIMemoryTest extends BaseParametrizedTestCase {
private static final String EXEC_NAME = "MemoryTestApp.exe";
- private DsfSession fSession;
- private DsfServicesTracker fServicesTracker;
- private IMemoryDMContext fMemoryDmc;
- private MIRunControl fRunControl;
- private IMemory fMemoryService;
- private IExpressions fExpressionService;
- private int fWordSize = 1 /* Default */;
- private ByteOrder fByteOrder;
+ private DsfSession fSession;
+ private DsfServicesTracker fServicesTracker;
+ private IMemoryDMContext fMemoryDmc;
+ private MIRunControl fRunControl;
+ private IMemory fMemoryService;
+ private IExpressions fExpressionService;
+ private int fWordSize = 1 /* Default */;
+ private ByteOrder fByteOrder;
// Keeps track of the MemoryChangedEvents
private final int BLOCK_SIZE = 256;
@@ -96,41 +96,39 @@ public class MIMemoryTest extends BaseParametrizedTestCase {
// Housekeeping stuff
// ========================================================================
-
-
@Override
public void doBeforeTest() throws Exception {
super.doBeforeTest();
- fSession = getGDBLaunch().getSession();
- fMemoryDmc = (IMemoryDMContext)SyncUtil.getContainerContext();
- assert(fMemoryDmc != null);
+ fSession = getGDBLaunch().getSession();
+ fMemoryDmc = (IMemoryDMContext) SyncUtil.getContainerContext();
+ assert (fMemoryDmc != null);
- Runnable runnable = new Runnable() {
- @Override
+ Runnable runnable = new Runnable() {
+ @Override
public void run() {
- // Get a reference to the memory service
- fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
- assert(fServicesTracker != null);
+ // Get a reference to the memory service
+ fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
+ assert (fServicesTracker != null);
- fRunControl = fServicesTracker.getService(MIRunControl.class);
- assert(fRunControl != null);
+ fRunControl = fServicesTracker.getService(MIRunControl.class);
+ assert (fRunControl != null);
- fMemoryService = fServicesTracker.getService(IMemory.class);
- assert(fMemoryService != null);
+ fMemoryService = fServicesTracker.getService(IMemory.class);
+ assert (fMemoryService != null);
- fExpressionService = fServicesTracker.getService(IExpressions.class);
- assert(fExpressionService != null);
+ fExpressionService = fServicesTracker.getService(IExpressions.class);
+ assert (fExpressionService != null);
- fSession.addServiceEventListener(MIMemoryTest.this, null);
- fBaseAddress = null;
- clearEventCounters();
+ fSession.addServiceEventListener(MIMemoryTest.this, null);
+ fBaseAddress = null;
+ clearEventCounters();
fWordSize = SyncUtil.readAddressableSize(fMemoryDmc);
fByteOrder = SyncUtil.getMemoryByteOrder(fMemoryDmc);
- }
- };
- fSession.getExecutor().submit(runnable).get();
+ }
+ };
+ fSession.getExecutor().submit(runnable).get();
}
@Override
@@ -161,62 +159,61 @@ public class MIMemoryTest extends BaseParametrizedTestCase {
// Helper Functions
// ========================================================================
- /* ------------------------------------------------------------------------
- * eventDispatched
- * ------------------------------------------------------------------------
- * Processes MemoryChangedEvents.
- * First checks if the memory block base address was set so the individual
- * test can control if it wants to verify the event(s).
- * ------------------------------------------------------------------------
- * @param e The MemoryChangedEvent
- * ------------------------------------------------------------------------
- */
- @DsfServiceEventHandler
- public void eventDispatched(IMemoryChangedEvent e) {
- synchronized(fMemoryChangedEventCount) {
- fMemoryChangedEventCount++;
- }
- IAddress[] addresses = e.getAddresses();
- for (int i = 0; i < addresses.length; i++) {
- int offset = Math.abs(addresses[i].distanceTo(fBaseAddress).intValue());
- if (offset < BLOCK_SIZE)
- synchronized(fMemoryAddressesChanged) {
- fMemoryAddressesChanged[offset] = true;
- }
- }
- }
-
- // Clears the counters
- private void clearEventCounters() {
- synchronized(fMemoryChangedEventCount) {
- fMemoryChangedEventCount = 0;
- }
- synchronized(fMemoryAddressesChanged) {
- for (int i = 0; i < BLOCK_SIZE; i++)
- fMemoryAddressesChanged[i] = false;
- }
- }
-
- // Returns the total number of events received
- private int getEventCount() {
- int count;
- synchronized(fMemoryChangedEventCount) {
- count = fMemoryChangedEventCount;
- }
- return count;
- }
-
- // Returns the number of distinct addresses reported
- private int getAddressCount() {
- int count = 0;
- synchronized(fMemoryAddressesChanged) {
- for (int i = 0; i < BLOCK_SIZE; i++)
- if (fMemoryAddressesChanged[i])
- count++;
- }
- return count;
- }
+ /* ------------------------------------------------------------------------
+ * eventDispatched
+ * ------------------------------------------------------------------------
+ * Processes MemoryChangedEvents.
+ * First checks if the memory block base address was set so the individual
+ * test can control if it wants to verify the event(s).
+ * ------------------------------------------------------------------------
+ * @param e The MemoryChangedEvent
+ * ------------------------------------------------------------------------
+ */
+ @DsfServiceEventHandler
+ public void eventDispatched(IMemoryChangedEvent e) {
+ synchronized (fMemoryChangedEventCount) {
+ fMemoryChangedEventCount++;
+ }
+ IAddress[] addresses = e.getAddresses();
+ for (int i = 0; i < addresses.length; i++) {
+ int offset = Math.abs(addresses[i].distanceTo(fBaseAddress).intValue());
+ if (offset < BLOCK_SIZE)
+ synchronized (fMemoryAddressesChanged) {
+ fMemoryAddressesChanged[offset] = true;
+ }
+ }
+ }
+
+ // Clears the counters
+ private void clearEventCounters() {
+ synchronized (fMemoryChangedEventCount) {
+ fMemoryChangedEventCount = 0;
+ }
+ synchronized (fMemoryAddressesChanged) {
+ for (int i = 0; i < BLOCK_SIZE; i++)
+ fMemoryAddressesChanged[i] = false;
+ }
+ }
+
+ // Returns the total number of events received
+ private int getEventCount() {
+ int count;
+ synchronized (fMemoryChangedEventCount) {
+ count = fMemoryChangedEventCount;
+ }
+ return count;
+ }
+ // Returns the number of distinct addresses reported
+ private int getAddressCount() {
+ int count = 0;
+ synchronized (fMemoryAddressesChanged) {
+ for (int i = 0; i < BLOCK_SIZE; i++)
+ if (fMemoryAddressesChanged[i])
+ count++;
+ }
+ return count;
+ }
private byte[] valueToBytes(int val) {
ByteBuffer buff = ByteBuffer.allocate(fWordSize);
@@ -237,21 +234,20 @@ public class MIMemoryTest extends BaseParametrizedTestCase {
}
}
- /* ------------------------------------------------------------------------
- * evaluateExpression
- * ------------------------------------------------------------------------
- * Invokes the ExpressionService to evaluate an expression. In theory, we
- * shouldn't rely on another service to test this one but we need a way to
- * access a variable from the test application in order verify that the
- * memory operations (read/write) are working properly.
- * ------------------------------------------------------------------------
- * @param expression Expression to resolve
- * @return Resolved expression
- * @throws InterruptedException
- * ------------------------------------------------------------------------
- */
- private IAddress evaluateExpression(IDMContext ctx, String expression) throws Throwable
- {
+ /* ------------------------------------------------------------------------
+ * evaluateExpression
+ * ------------------------------------------------------------------------
+ * Invokes the ExpressionService to evaluate an expression. In theory, we
+ * shouldn't rely on another service to test this one but we need a way to
+ * access a variable from the test application in order verify that the
+ * memory operations (read/write) are working properly.
+ * ------------------------------------------------------------------------
+ * @param expression Expression to resolve
+ * @return Resolved expression
+ * @throws InterruptedException
+ * ------------------------------------------------------------------------
+ */
+ private IAddress evaluateExpression(IDMContext ctx, String expression) throws Throwable {
IExpressionDMContext expressionDMC = SyncUtil.createExpression(ctx, expression);
return new Addr64(SyncUtil.getExpressionValue(expressionDMC, IFormattedValues.HEX_FORMAT));
}
@@ -385,7 +381,7 @@ public class MIMemoryTest extends BaseParametrizedTestCase {
// Run to the point where the variable is initialized
SyncUtil.runToLocation("MemoryTestApp.cc:zeroBlocks");
MIStoppedEvent stoppedEvent = SyncUtil.step(StepType.STEP_RETURN);
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
// Setup call parameters
long offset = 0;
@@ -456,7 +452,7 @@ public class MIMemoryTest extends BaseParametrizedTestCase {
// Run to the point where the array is zeroed
SyncUtil.runToLocation("MemoryTestApp.cc:zeroBlocks");
MIStoppedEvent stoppedEvent = SyncUtil.step(StepType.STEP_RETURN);
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
// Setup call parameters
int count = 1;
@@ -494,7 +490,7 @@ public class MIMemoryTest extends BaseParametrizedTestCase {
// Run to the point where the variable is zeroed
SyncUtil.runToLocation("MemoryTestApp.cc:zeroBlocks");
MIStoppedEvent stoppedEvent = SyncUtil.step(StepType.STEP_RETURN);
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
// Setup call parameters
int count = BLOCK_SIZE;
@@ -541,7 +537,7 @@ public class MIMemoryTest extends BaseParametrizedTestCase {
// Run to the point where the variable is initialized
SyncUtil.runToLocation("MemoryTestApp.cc:zeroBlocks");
MIStoppedEvent stoppedEvent = SyncUtil.step(StepType.STEP_RETURN);
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
// Setup call parameters
long offset = 0;
@@ -583,9 +579,7 @@ public class MIMemoryTest extends BaseParametrizedTestCase {
// Error message for new -data-write-memory-bytes command
String expectedStr2 = "Could not write memory";
expectedException.expect(ExecutionException.class);
- expectedException.expectMessage(anyOf(
- containsString(expectedStr1),
- containsString(expectedStr2)));
+ expectedException.expectMessage(anyOf(containsString(expectedStr1), containsString(expectedStr2)));
// Perform the test
try {
@@ -606,7 +600,7 @@ public class MIMemoryTest extends BaseParametrizedTestCase {
// Run to the point where the variable is initialized
SyncUtil.runToLocation("MemoryTestApp.cc:zeroBlocks");
MIStoppedEvent stoppedEvent = SyncUtil.step(StepType.STEP_RETURN);
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
// Setup call parameters
long offset = 0;
@@ -636,7 +630,7 @@ public class MIMemoryTest extends BaseParametrizedTestCase {
// Run to the point where the variable is initialized
SyncUtil.runToLocation("MemoryTestApp.cc:zeroBlocks");
MIStoppedEvent stoppedEvent = SyncUtil.step(StepType.STEP_RETURN);
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
// Setup call parameters
long offset = 0;
@@ -696,7 +690,7 @@ public class MIMemoryTest extends BaseParametrizedTestCase {
// Run to the point where the variable is zeroed
SyncUtil.runToLocation("MemoryTestApp.cc:zeroBlocks");
MIStoppedEvent stoppedEvent = SyncUtil.step(StepType.STEP_RETURN);
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
// Setup call parameters
long offset = 0;
@@ -706,8 +700,8 @@ public class MIMemoryTest extends BaseParametrizedTestCase {
fBaseAddress = evaluateExpression(frameDmc, "&charBlock");
- ServiceEventWaitor<IMemoryChangedEvent> eventWaitor = new ServiceEventWaitor<>(
- fSession, IMemoryChangedEvent.class);
+ ServiceEventWaitor<IMemoryChangedEvent> eventWaitor = new ServiceEventWaitor<>(fSession,
+ IMemoryChangedEvent.class);
// Perform the test
for (int i = 0; i < count; i++) {
@@ -748,14 +742,14 @@ public class MIMemoryTest extends BaseParametrizedTestCase {
// Run to the point where the variable is zeroed
SyncUtil.runToLocation("MemoryTestApp.cc:zeroBlocks");
MIStoppedEvent stoppedEvent = SyncUtil.step(StepType.STEP_RETURN);
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
int count = BLOCK_SIZE;
byte[] buffer;
fBaseAddress = evaluateExpression(frameDmc, "&charBlock");
- ServiceEventWaitor<IMemoryChangedEvent> eventWaitor = new ServiceEventWaitor<>(
- fSession, IMemoryChangedEvent.class);
+ ServiceEventWaitor<IMemoryChangedEvent> eventWaitor = new ServiceEventWaitor<>(fSession,
+ IMemoryChangedEvent.class);
// Perform the test
for (int offset = 0; offset < count; offset++) {
@@ -795,7 +789,7 @@ public class MIMemoryTest extends BaseParametrizedTestCase {
// Run to the point where the variable is zeroed
SyncUtil.runToLocation("MemoryTestApp.cc:zeroBlocks");
MIStoppedEvent stoppedEvent = SyncUtil.step(StepType.STEP_RETURN);
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
// Setup call parameters
int count = BLOCK_SIZE;
@@ -842,7 +836,7 @@ public class MIMemoryTest extends BaseParametrizedTestCase {
// Run to the point where the variable is initialized
SyncUtil.runToLocation("MemoryTestApp.cc:zeroBlocks");
MIStoppedEvent stoppedEvent = SyncUtil.step(StepType.STEP_RETURN);
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
// Setup call parameters
long offset = 0;
@@ -885,9 +879,7 @@ public class MIMemoryTest extends BaseParametrizedTestCase {
// Error message for new -data-write-memory-bytes command
String expectedStr2 = "Could not write memory";
expectedException.expect(ExecutionException.class);
- expectedException.expectMessage(anyOf(
- containsString(expectedStr1),
- containsString(expectedStr2)));
+ expectedException.expectMessage(anyOf(containsString(expectedStr1), containsString(expectedStr2)));
// Perform the test
try {
@@ -908,7 +900,7 @@ public class MIMemoryTest extends BaseParametrizedTestCase {
// Run to the point where the variable is initialized
SyncUtil.runToLocation("MemoryTestApp.cc:zeroBlocks");
MIStoppedEvent stoppedEvent = SyncUtil.step(StepType.STEP_RETURN);
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
// Setup call parameters
long offset = 0;
@@ -938,7 +930,7 @@ public class MIMemoryTest extends BaseParametrizedTestCase {
// Run to the point where the variable is initialized
SyncUtil.runToLocation("MemoryTestApp.cc:zeroBlocks");
MIStoppedEvent stoppedEvent = SyncUtil.step(StepType.STEP_RETURN);
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
// Setup call parameters
long offset = 0;
@@ -968,7 +960,7 @@ public class MIMemoryTest extends BaseParametrizedTestCase {
// Run to the point where the variable is initialized
SyncUtil.runToLocation("MemoryTestApp.cc:zeroBlocks");
MIStoppedEvent stoppedEvent = SyncUtil.step(StepType.STEP_RETURN);
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
// Setup call parameters
long offset = 0;
@@ -1049,7 +1041,7 @@ public class MIMemoryTest extends BaseParametrizedTestCase {
// Run to the point where the variable is zeroed
SyncUtil.runToLocation("MemoryTestApp.cc:zeroBlocks");
MIStoppedEvent stoppedEvent = SyncUtil.step(StepType.STEP_RETURN);
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
// Setup call parameters
long offset = 0;
@@ -1065,7 +1057,8 @@ public class MIMemoryTest extends BaseParametrizedTestCase {
fBaseAddress = evaluateExpression(frameDmc, "&charBlock");
// Ensure that the memory is zeroed
- MemoryByte[] block = SyncUtil.readMemory(fMemoryDmc, fBaseAddress, offset, fWordSize, patternRepetitionCount * patternLength);
+ MemoryByte[] block = SyncUtil.readMemory(fMemoryDmc, fBaseAddress, offset, fWordSize,
+ patternRepetitionCount * patternLength);
MemoryByteBuffer memBuf = new MemoryByteBuffer(block, fByteOrder, fWordSize);
for (int i = 0; i < (patternRepetitionCount * patternLength); i++) {
assertThat(memBuf.getNextWord(), is(0L));
@@ -1099,7 +1092,7 @@ public class MIMemoryTest extends BaseParametrizedTestCase {
// Run to the point where the variable is zeroed
SyncUtil.runToLocation("MemoryTestApp.cc:zeroBlocks");
MIStoppedEvent stoppedEvent = SyncUtil.step(StepType.STEP_RETURN);
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
// Setup call parameters
int maxPatternRepetitionCount = 64;
@@ -1115,7 +1108,8 @@ public class MIMemoryTest extends BaseParametrizedTestCase {
fBaseAddress = evaluateExpression(frameDmc, "&charBlock");
// Ensure that the memory is zeroed
- MemoryByte[] block = SyncUtil.readMemory(fMemoryDmc, fBaseAddress, 0, fWordSize, maxPatternRepetitionCount * patternLength);
+ MemoryByte[] block = SyncUtil.readMemory(fMemoryDmc, fBaseAddress, 0, fWordSize,
+ maxPatternRepetitionCount * patternLength);
MemoryByteBuffer memBuf = new MemoryByteBuffer(block, fByteOrder, fWordSize);
for (int i = 0; i < (maxPatternRepetitionCount * patternLength); i++) {
assertThat(memBuf.getNextWord(), is(0L));
@@ -1148,7 +1142,7 @@ public class MIMemoryTest extends BaseParametrizedTestCase {
// Run to the point where the array is zeroed
SyncUtil.runToLocation("MemoryTestApp.cc:zeroBlocks");
MIStoppedEvent stoppedEvent = SyncUtil.step(StepType.STEP_RETURN);
- IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
+ IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
// Setup call parameters
fBaseAddress = evaluateExpression(frameDmc, "&charBlock");
@@ -1158,8 +1152,7 @@ public class MIMemoryTest extends BaseParametrizedTestCase {
// Send many read queries
for (int offset = 0; offset < BLOCK_SIZE; offset++) {
- readQueries[offset] = new MemoryReadQuery(fMemoryService,
- fMemoryDmc, fBaseAddress, offset, fWordSize, 1);
+ readQueries[offset] = new MemoryReadQuery(fMemoryService, fMemoryDmc, fBaseAddress, offset, fWordSize, 1);
fMemoryService.getExecutor().submit(readQueries[offset]);
}
@@ -1171,14 +1164,14 @@ public class MIMemoryTest extends BaseParametrizedTestCase {
}
// Write asynchronously
- ServiceEventWaitor<IMemoryChangedEvent> eventWaitor = new ServiceEventWaitor<IMemoryChangedEvent>(
- fSession, IMemoryChangedEvent.class);
+ ServiceEventWaitor<IMemoryChangedEvent> eventWaitor = new ServiceEventWaitor<IMemoryChangedEvent>(fSession,
+ IMemoryChangedEvent.class);
MemoryWriteQuery writeQueries[] = new MemoryWriteQuery[BLOCK_SIZE];
for (int offset = 0; offset < BLOCK_SIZE; offset++) {
byte[] block = valueToBytes(offset);
- writeQueries[offset] = new MemoryWriteQuery(fMemoryService,
- fMemoryDmc, fBaseAddress, offset, fWordSize, 1, block);
+ writeQueries[offset] = new MemoryWriteQuery(fMemoryService, fMemoryDmc, fBaseAddress, offset, fWordSize, 1,
+ block);
fMemoryService.getExecutor().submit(writeQueries[offset]);
}
@@ -1195,8 +1188,7 @@ public class MIMemoryTest extends BaseParametrizedTestCase {
// Verify asynchronously that all bytes are set
// Send many read queries
for (int offset = 0; offset < BLOCK_SIZE; offset++) {
- readQueries[offset] = new MemoryReadQuery(fMemoryService,
- fMemoryDmc, fBaseAddress, offset, fWordSize, 1);
+ readQueries[offset] = new MemoryReadQuery(fMemoryService, fMemoryDmc, fBaseAddress, offset, fWordSize, 1);
fMemoryService.getExecutor().submit(readQueries[offset]);
}
@@ -1278,8 +1270,7 @@ public class MIMemoryTest extends BaseParametrizedTestCase {
private int fWordSize;
private int fCount;
- public MemoryReadQuery(IMemory fMemoryService,
- IMemoryDMContext memoryDmc, IAddress baseAddress, int offset,
+ public MemoryReadQuery(IMemory fMemoryService, IMemoryDMContext memoryDmc, IAddress baseAddress, int offset,
int wordSize, int count) {
this.fMemoryService = fMemoryService;
this.fMemoryDmc = memoryDmc;
@@ -1291,8 +1282,7 @@ public class MIMemoryTest extends BaseParametrizedTestCase {
@Override
protected void execute(DataRequestMonitor<MemoryByte[]> rm) {
- fMemoryService.getMemory(fMemoryDmc, fBaseAddress, fOffset,
- fWordSize, fCount, rm);
+ fMemoryService.getMemory(fMemoryDmc, fBaseAddress, fOffset, fWordSize, fCount, rm);
}
}
@@ -1306,8 +1296,7 @@ public class MIMemoryTest extends BaseParametrizedTestCase {
private int fCount;
private byte[] fBuffer;
- public MemoryWriteQuery(IMemory fMemoryService,
- IMemoryDMContext memoryDmc, IAddress baseAddress, int offset,
+ public MemoryWriteQuery(IMemory fMemoryService, IMemoryDMContext memoryDmc, IAddress baseAddress, int offset,
int wordSize, int count, byte[] buffer) {
this.fMemoryService = fMemoryService;
this.fMemoryDmc = memoryDmc;
@@ -1320,8 +1309,7 @@ public class MIMemoryTest extends BaseParametrizedTestCase {
@Override
protected void execute(DataRequestMonitor<Void> rm) {
- fMemoryService.setMemory(fMemoryDmc, fBaseAddress, fOffset,
- fWordSize, fCount, fBuffer, rm);
+ fMemoryService.setMemory(fMemoryDmc, fBaseAddress, fOffset, fWordSize, fCount, fBuffer, rm);
}
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIModifiedServicesTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIModifiedServicesTest.java
index 96acd859ff7..87e81666074 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIModifiedServicesTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIModifiedServicesTest.java
@@ -77,7 +77,7 @@ public class MIModifiedServicesTest extends BaseParametrizedTestCase {
public TestBackendBasicConsole(DsfSession session, ILaunchConfiguration lc) {
super(session, lc);
}
-
+
@Override
public boolean isFullGdbConsoleSupported() {
return false;
@@ -102,7 +102,6 @@ public class MIModifiedServicesTest extends BaseParametrizedTestCase {
}
}
-
@Override
public void doBeforeTest() throws Exception {
removeTeminatedLaunchesBeforeTest();
@@ -150,8 +149,8 @@ public class MIModifiedServicesTest extends BaseParametrizedTestCase {
try {
ch = fis.read();
} catch (IOException e) {
- Assert.fail("Problem inspecting file to see if it's a cygwin executable : "
- + e.getLocalizedMessage());
+ Assert.fail(
+ "Problem inspecting file to see if it's a cygwin executable : " + e.getLocalizedMessage());
}
if (ch == -1) { // EOF
break;
@@ -193,7 +192,7 @@ public class MIModifiedServicesTest extends BaseParametrizedTestCase {
session.getId());
IMIProcesses procService = servicesTracker.getService(IMIProcesses.class);
- IProcessDMContext procDmc = DMContexts.getAncestorOfType(fContainerDmc, IProcessDMContext.class);
+ IProcessDMContext procDmc = DMContexts.getAncestorOfType(fContainerDmc, IProcessDMContext.class);
IThreadDMContext threadDmc = procService.createThreadContext(procDmc, "1");
fThreadExecDmc = procService.createExecutionContext(fContainerDmc, threadDmc, "1");
@@ -201,7 +200,7 @@ public class MIModifiedServicesTest extends BaseParametrizedTestCase {
fBackend = servicesTracker.getService(IGDBBackend.class);
servicesTracker.dispose();
-
+
rm.done();
}
};
@@ -223,8 +222,7 @@ public class MIModifiedServicesTest extends BaseParametrizedTestCase {
setLaunchAttribute(ServiceFactoriesManager.DEBUG_SERVICES_FACTORY_KEY, servicesFactoryId);
}
- private void resumeContainerContextExe()
- throws InterruptedException, ExecutionException, TimeoutException {
+ private void resumeContainerContextExe() throws InterruptedException, ExecutionException, TimeoutException {
final ServiceEventWaitor<IResumedDMEvent> resumedWaitor = new ServiceEventWaitor<IResumedDMEvent>(
getGDBLaunch().getSession(), IResumedDMEvent.class);
@@ -264,7 +262,7 @@ public class MIModifiedServicesTest extends BaseParametrizedTestCase {
* environment e.g. Linux with GDB 7.12 This test case forces the use of the Basic console which triggers
* async mode off, and will cause the program interrupt via the CLI (rather than MI -exec-interrupt which
* is used with async mode)
- *
+ *
* Note: This test case uses a modified Test Backend service which is instrumented before test execution,
* see initializeLaunchAttributes
*/
@@ -317,7 +315,7 @@ public class MIModifiedServicesTest extends BaseParametrizedTestCase {
assertTrue("Not using the expected backend service", fBackend instanceof TestBackendBasicConsole);
resumeContainerContextExe();
-
+
// Verify that with the basic console, we cannot accept commands when the target is running.
assertFalse("Target should be running with async off, and should NOT be accepting commands",
fRunCtrl.isTargetAcceptingCommands());
@@ -325,7 +323,7 @@ public class MIModifiedServicesTest extends BaseParametrizedTestCase {
/**
* Validate that with the basic console, interrupting a running target does work.
- * This would not be feasible to test with our standard services.
+ * This would not be feasible to test with our standard services.
* This test case forces the use of the Basic console by using a test IGDBBackEnd service.
*/
@Test
@@ -340,7 +338,7 @@ public class MIModifiedServicesTest extends BaseParametrizedTestCase {
assertTrue("Not using the expected backend service", fBackend instanceof TestBackendBasicConsole);
resumeContainerContextExe();
-
+
interruptRunningTargetExe();
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRegistersTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRegistersTest.java
index e3b4e029bed..69f6bd79273 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRegistersTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRegistersTest.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
* Alvaro Sanchez-Leon (Ericsson) - Make Registers View specific to a frame (Bug 323552)
@@ -112,19 +112,20 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
fRunControl = fServicesTracker.getService(IRunControl.class);
}
};
-
+
fSession.getExecutor().submit(runnable).get();
//resolve the execution context
IFrameDMContext frameDmc = SyncUtil.getStackFrame(getInitialStoppedEvent().getDMContext(), 0);
//resolve the container context
- IContainerDMContext containerDmc = DMContexts.getAncestorOfType(getInitialStoppedEvent().getDMContext(), IContainerDMContext.class);
+ IContainerDMContext containerDmc = DMContexts.getAncestorOfType(getInitialStoppedEvent().getDMContext(),
+ IContainerDMContext.class);
//The container dmc is expected to contain the frame and container context
fCompositeDmc = new CompositeDMContext(new IDMContext[] { containerDmc, frameDmc });
fGroupNameSuffix = 0;
}
-
+
@Override
protected void setLaunchAttributes() {
super.setLaunchAttributes();
@@ -132,13 +133,13 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EXEC_PATH + EXEC_NAME);
}
-
-
+
@Override
public void doAfterTest() throws Exception {
super.doAfterTest();
- if (fServicesTracker!=null) fServicesTracker.dispose();
+ if (fServicesTracker != null)
+ fServicesTracker.dispose();
fRegService = null;
}
@@ -149,11 +150,12 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
//Get all the registers from the Container (Process)
IRegisterDMContext[] registers = getRegisters(fCompositeDmc);
assertTrue(registers.length > 0);
-
+
//Get the register group from any of the register contexts
- IRegisterGroupDMContext regGroupsDMC = DMContexts.getAncestorOfType(registers[0], IRegisterGroupDMContext.class);
+ IRegisterGroupDMContext regGroupsDMC = DMContexts.getAncestorOfType(registers[0],
+ IRegisterGroupDMContext.class);
assertNotNull(regGroupsDMC);
-
+
return regGroupsDMC;
}
@@ -161,7 +163,7 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
* This is a common support method which gets the Registers names.
*/
private IRegisterDMContext[] getAllRegisters(final IFrameDMContext frameDmc) throws Throwable {
-
+
Query<IRegisterDMContext[]> queryRegisters = new Query<IRegisterDMContext[]>() {
@Override
protected void execute(DataRequestMonitor<IRegisterDMContext[]> rm) {
@@ -178,11 +180,11 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
return regContexts;
}
- /*
- * Get the Registers for the specified composite context
- */
- private IRegisterDMContext[] getRegisters(final IDMContext dmc) throws Throwable {
-
+ /*
+ * Get the Registers for the specified composite context
+ */
+ private IRegisterDMContext[] getRegisters(final IDMContext dmc) throws Throwable {
+
Query<IRegisterDMContext[]> queryRegistersDmc = new Query<IRegisterDMContext[]>() {
@Override
protected void execute(DataRequestMonitor<IRegisterDMContext[]> rm) {
@@ -190,26 +192,28 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
}
};
- fRegService.getExecutor().submit(queryRegistersDmc);
- IRegisterDMContext[] regContexts = queryRegistersDmc.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
-
- return(regContexts);
- }
-
- /*
- * This is a common support method which gets the Register context of root group over the specified frame context
- */
- private IRegisterDMContext[] getTargetRegisters(final IFrameDMContext frameDmc) throws Throwable {
- IRegisterDMContext[] regContexts = getRegisters(new CompositeDMContext(new IDMContext[] { fCompositeDmc, frameDmc}));
- assertEquals("Wrong number of registers", getRegistersFromGdb().size(), regContexts.length);
-
- return regContexts;
- }
+ fRegService.getExecutor().submit(queryRegistersDmc);
+ IRegisterDMContext[] regContexts = queryRegistersDmc.get(TestsPlugin.massageTimeout(500),
+ TimeUnit.MILLISECONDS);
+
+ return (regContexts);
+ }
+
+ /*
+ * This is a common support method which gets the Register context of root group over the specified frame context
+ */
+ private IRegisterDMContext[] getTargetRegisters(final IFrameDMContext frameDmc) throws Throwable {
+ IRegisterDMContext[] regContexts = getRegisters(
+ new CompositeDMContext(new IDMContext[] { fCompositeDmc, frameDmc }));
+ assertEquals("Wrong number of registers", getRegistersFromGdb().size(), regContexts.length);
+
+ return regContexts;
+ }
/*************************************************************************
- *
+ *
* The tests for the register service.
- *
+ *
*************************************************************************/
@Test
public void resolveTargetRegisterGroup() throws Throwable {
@@ -234,16 +238,17 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
final IRegisterDMContext[] regDMCs = getAllRegisters(frameDmc);
List<String> regNames = getRegistersFromGdb();
- IRegisterDMData[] datas = getRegistersData(regDMCs);
-
- for(IRegisterDMData data: datas){
- String regName = data.getName();
- assertTrue("GDB does not support register name: " + regName, regNames.contains(regName));
- }
- }
-
- private IRegisterDMData[] getRegistersData(final IRegisterDMContext[] regDMCs) throws InterruptedException, ExecutionException {
-
+ IRegisterDMData[] datas = getRegistersData(regDMCs);
+
+ for (IRegisterDMData data : datas) {
+ String regName = data.getName();
+ assertTrue("GDB does not support register name: " + regName, regNames.contains(regName));
+ }
+ }
+
+ private IRegisterDMData[] getRegistersData(final IRegisterDMContext[] regDMCs)
+ throws InterruptedException, ExecutionException {
+
Query<IRegisterDMData[]> query = new Query<IRegisterDMData[]>() {
@Override
protected void execute(DataRequestMonitor<IRegisterDMData[]> rm) {
@@ -253,13 +258,14 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
countingRm.setDoneCount(regDMCs.length);
for (int i = 0; i < regDMCs.length; i++) {
final int index = i;
- fRegService.getRegisterData(regDMCs[index], new ImmediateDataRequestMonitor<IRegisterDMData>(countingRm) {
- @Override
- protected void handleSuccess() {
- datas[index] = getData();
- countingRm.done();
- }
- });
+ fRegService.getRegisterData(regDMCs[index],
+ new ImmediateDataRequestMonitor<IRegisterDMData>(countingRm) {
+ @Override
+ protected void handleSuccess() {
+ datas[index] = getData();
+ countingRm.done();
+ }
+ });
}
}
@@ -267,10 +273,11 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
fSession.getExecutor().execute(query);
- return query.get();
+ return query.get();
}
- private String getModelDataForRegisterDataValue(IFrameDMContext frameDmc, String format, int regNo) throws Throwable {
+ private String getModelDataForRegisterDataValue(IFrameDMContext frameDmc, String format, int regNo)
+ throws Throwable {
final IRegisterDMContext[] regDMCs = getAllRegisters(frameDmc);
return getModelDataForRegisterDataValue(regDMCs[regNo], format);
}
@@ -292,7 +299,6 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
return data.getFormattedValue();
}
-
@Test
public void getModelDataForRegisterDataValueInDifferentNumberFormats() throws Throwable {
MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
@@ -321,22 +327,24 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
@Test
public void compareRegisterForMultipleExecutionContexts() throws Throwable {
- MIStoppedEvent stoppedEvent = SyncUtil.runToLocation(SOURCE_NAME + ':'
- + getLineForTag("LINE_MAIN_ALL_THREADS_STARTED"));
+ MIStoppedEvent stoppedEvent = SyncUtil
+ .runToLocation(SOURCE_NAME + ':' + getLineForTag("LINE_MAIN_ALL_THREADS_STARTED"));
// Get the thread IDs
- final IContainerDMContext containerDmc = DMContexts.getAncestorOfType(stoppedEvent.getDMContext(), IContainerDMContext.class);
-
+ final IContainerDMContext containerDmc = DMContexts.getAncestorOfType(stoppedEvent.getDMContext(),
+ IContainerDMContext.class);
+
Query<IExecutionDMContext[]> queryExecutionContexts = new Query<IExecutionDMContext[]>() {
@Override
protected void execute(DataRequestMonitor<IExecutionDMContext[]> rm) {
fRunControl.getExecutionContexts(containerDmc, rm);
}
};
-
- fRegService.getExecutor().submit(queryExecutionContexts);
- IExecutionDMContext[] ctxts = queryExecutionContexts.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ fRegService.getExecutor().submit(queryExecutionContexts);
+
+ IExecutionDMContext[] ctxts = queryExecutionContexts.get(TestsPlugin.massageTimeout(500),
+ TimeUnit.MILLISECONDS);
assertNotNull(ctxts);
assertTrue(ctxts.length > 1);
@@ -365,21 +373,29 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
String dupliThread2RegVal5 = getModelDataForRegisterDataValue(frameDmc2, IFormattedValues.NATURAL_FORMAT, 5);
// If Values not equal , then context haven't been re-set properly
- assertEquals("Multiple context not working. Execution Context is not reset to 2", thread2RegVal0, dupliThread2RegVal0);
- assertEquals("Multiple context not working. Execution Context is not reset to 2", thread2RegVal1, dupliThread2RegVal1);
- assertEquals("Multiple context not working. Execution Context is not reset to 2", thread2RegVal2, dupliThread2RegVal2);
- assertEquals("Multiple context not working. Execution Context is not reset to 2", thread2RegVal3, dupliThread2RegVal3);
- assertEquals("Multiple context not working. Execution Context is not reset to 2", thread2RegVal4, dupliThread2RegVal4);
- assertEquals("Multiple context not working. Execution Context is not reset to 2", thread2RegVal5, dupliThread2RegVal5);
+ assertEquals("Multiple context not working. Execution Context is not reset to 2", thread2RegVal0,
+ dupliThread2RegVal0);
+ assertEquals("Multiple context not working. Execution Context is not reset to 2", thread2RegVal1,
+ dupliThread2RegVal1);
+ assertEquals("Multiple context not working. Execution Context is not reset to 2", thread2RegVal2,
+ dupliThread2RegVal2);
+ assertEquals("Multiple context not working. Execution Context is not reset to 2", thread2RegVal3,
+ dupliThread2RegVal3);
+ assertEquals("Multiple context not working. Execution Context is not reset to 2", thread2RegVal4,
+ dupliThread2RegVal4);
+ assertEquals("Multiple context not working. Execution Context is not reset to 2", thread2RegVal5,
+ dupliThread2RegVal5);
}
- private void writeRegister(IFrameDMContext frameDmc, final int regIndex, final String regValue, final String formatId) throws Throwable {
+ private void writeRegister(IFrameDMContext frameDmc, final int regIndex, final String regValue,
+ final String formatId) throws Throwable {
final IRegisterDMContext[] regDMCs = getAllRegisters(frameDmc);
writeRegister(regDMCs[regIndex], regValue, formatId);
}
- private void writeRegister(final IRegisterDMContext registerDmc, final String regValue, final String formatId) throws Throwable {
+ private void writeRegister(final IRegisterDMContext registerDmc, final String regValue, final String formatId)
+ throws Throwable {
Query<Object> queryAction = new Query<Object>() {
@Override
@@ -391,14 +407,14 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
fRegService.getExecutor().submit(queryAction);
queryAction.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
}
-
+
/**
* Waits for IRegistersChangedDMEvent(s) during a time interval, collects them and returns them after timeout
*/
- private List<IRegistersChangedDMEvent> writeRegisterWaitNotication(final IRegisterDMContext registerDmc, final String regValue, final String formatId)
- throws Throwable {
- ServiceEventWaitor<IRegistersChangedDMEvent> eventWaitor =
- new ServiceEventWaitor<IRegistersChangedDMEvent>(fSession, IRegistersChangedDMEvent.class);
+ private List<IRegistersChangedDMEvent> writeRegisterWaitNotication(final IRegisterDMContext registerDmc,
+ final String regValue, final String formatId) throws Throwable {
+ ServiceEventWaitor<IRegistersChangedDMEvent> eventWaitor = new ServiceEventWaitor<IRegistersChangedDMEvent>(
+ fSession, IRegistersChangedDMEvent.class);
writeRegister(registerDmc, regValue, formatId);
@@ -409,8 +425,7 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
*/
return eventWaitor.waitForEvents(TestsPlugin.massageTimeout(100));
}
-
-
+
@Test
public void writeRegisterNaturalFormat() throws Throwable {
MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
@@ -456,10 +471,10 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
assertEquals("Failed writing register", regValue, val);
}
- /**
- * This test validates retrieval of different values for the same register used on different frames
- */
- @Test
+ /**
+ * This test validates retrieval of different values for the same register used on different frames
+ */
+ @Test
public void frameSpecificValues() throws Throwable {
// Step to a multi-level stack to be able to test different stack frames
SyncUtil.runToLocation("PrintHello");
@@ -480,90 +495,91 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
MIRegisterDMC sp_reg_f0 = (MIRegisterDMC) findStackPointerRegister(sp_name, registers_f0);
assertNotNull(sp_reg_f0);
String sp_f0_str = getModelDataForRegisterDataValue(frame0, IFormattedValues.HEX_FORMAT, sp_reg_f0.getRegNo());
-
+
// Get the stack pointer value for frame1
IFrameDMContext frame1 = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 1);
IRegisterDMContext[] registers_f1 = getTargetRegisters(frame1);
MIRegisterDMC sp_reg_f1 = (MIRegisterDMC) findStackPointerRegister(sp_name, registers_f1);
assertNotNull(sp_reg_f1);
String sp_f1_str = getModelDataForRegisterDataValue(frame1, IFormattedValues.HEX_FORMAT, sp_reg_f1.getRegNo());
-
+
//The stack pointer's are not expected to be the same among frames
assertFalse("Stack pointers shall be different among frames", sp_f0_str.equals(sp_f1_str));
}
- private IRegisterDMContext findStackPointerRegister(String sp_name, IRegisterDMContext[] registerDMCs) throws InterruptedException, ExecutionException {
+ private IRegisterDMContext findStackPointerRegister(String sp_name, IRegisterDMContext[] registerDMCs)
+ throws InterruptedException, ExecutionException {
IRegisterDMData[] registersData = getRegistersData(registerDMCs);
for (int i = 0; i < registersData.length; i++) {
IRegisterDMData registerData = registersData[i];
-
+
if (registerData.getName().equals(sp_name)) {
return registerDMCs[i];
}
}
-
+
return null;
}
private String resolveStackPointerName() throws Throwable {
List<String> regNames = getRegistersFromGdb();
-
+
// for 64 bits
String sp_name = "rsp";
if (regNames.contains(sp_name)) {
return sp_name;
}
-
+
// for 32 bits
sp_name = "esp";
if (regNames.contains(sp_name)) {
return sp_name;
}
-
+
// for 16 bits
sp_name = "sp";
if (regNames.contains(sp_name)) {
return sp_name;
}
-
+
return null;
}
-
+
@Test
public void getRegisterGroupsData() throws Throwable {
int grpsIncrement = 3;
- //Group name to Group description
+ //Group name to Group description
Map<String, String> groupNameToDescMap = new HashMap<>();
groupNameToDescMap.put("Group_1", "");
groupNameToDescMap.put("Group_2", "");
groupNameToDescMap.put("Group_3", "");
groupNameToDescMap.put("General Registers", "General Purpose and FPU Register Group");
-
+
//Tracking groups found
Set<String> groupsFound = new HashSet<>();
-
+
addRegisterGroups(grpsIncrement);
final IRegisterDMContext[] regInGroup = getRegisters(0, 4);
-
+
IRegisterGroupDMData[] groupsData = getRegisterGroupsData(regInGroup[0]);
//increment + root
assertEquals(grpsIncrement + 1, groupsData.length);
- for (IRegisterGroupDMData grpData: groupsData) {
+ for (IRegisterGroupDMData grpData : groupsData) {
// Validate group name
assertTrue(groupNameToDescMap.containsKey(grpData.getName()));
String grpDataDesc = grpData.getDescription();
String expectedName = groupNameToDescMap.get(grpData.getName());
-
+
//Validate group description
assertEquals(expectedName, grpDataDesc);
groupsFound.add(grpData.getName());
}
-
+
//Make sure all expected groups were found
assertEquals(groupNameToDescMap.size(), groupsFound.size());
}
-
+
@Test
public void canAddRegisterGroup() throws Throwable {
// only root group expected
@@ -571,7 +587,7 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
assertEquals("Unexpected groups present, only root was expected", 1, groups.length);
assertTrue("Can not Add register groups", canAddRegisterGroup(groups[0]));
}
-
+
@Test
public void canNotEditRootRegisterGroup() throws Throwable {
// only root group expected
@@ -580,7 +596,7 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
assertFalse("Not expected to allow the editing of the root register group", canEditRegisterGroup(groups[0]));
}
-
+
@Test
public void canNotEditUnknownRegisterGroup() throws Throwable {
// only root group expected
@@ -644,9 +660,9 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
//Add a valid execution context to resolve the register values
IFrameDMContext frameDmc = DMContexts.getAncestorOfType(regInGroup[0], IFrameDMContext.class);
- CompositeDMContext compositeDmc = new CompositeDMContext(new IDMContext[]{frameDmc, groups[0]});
+ CompositeDMContext compositeDmc = new CompositeDMContext(new IDMContext[] { frameDmc, groups[0] });
IRegisterDMContext[] readRegisters = getRegisters(compositeDmc);
-
+
// Same order, same data and same values are expected, although different instances to different parents
assertTrue(sameData(regInGroup, readRegisters, false));
@@ -663,7 +679,7 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
assertEquals("unexpected groups present", 1, groups.length);
IRegisterGroupDMContext group = addDefaultUserGroup();
-
+
IRegisterDMContext[] origRegisters = getRegisters(group);
// Assert the default group name
@@ -685,7 +701,7 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
IFrameDMContext frameDmc = DMContexts.getAncestorOfType(newRegisters[0], IFrameDMContext.class);
//Read the context with a valid execution context
- CompositeDMContext compositeDmc = new CompositeDMContext(new IDMContext[]{group, frameDmc});
+ CompositeDMContext compositeDmc = new CompositeDMContext(new IDMContext[] { group, frameDmc });
IRegisterDMContext[] readRegisters = getRegisters(compositeDmc);
//Same data but not from the same parent group, newRegisters from root, readRegisters from GroupY
@@ -698,7 +714,7 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
// only root group expected
IRegisterGroupDMContext[] groups = getRegisterGroups(1);
assertFalse("Removal of root register group shall not be allowed", canRemoveRegisterGroups(groups));
-
+
//Add another two groups
// Define a subset of registers to create a register group (from, to)
final IRegisterDMContext[] regInGroup = getRegisters(0, 4);
@@ -715,17 +731,17 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
// Retrieve the existing groups, expected and validated to root + 3
groups = getRegisterGroups(4);
-
+
//Remove the root group from the list, so the remaining can be validated
//as can be removed
- groups = Arrays.copyOfRange(groups, 0, groups.length-1);
+ groups = Arrays.copyOfRange(groups, 0, groups.length - 1);
assertTrue("Not allowing removal of groups", canRemoveRegisterGroups(groups));
-
+
//remove the non root groups and validate the result
removeGroups(groups);
groups = getRegisterGroups(1);
}
-
+
@Test
public void removeRegisterGroups() throws Throwable {
int grpsIncrement = 3;
@@ -766,15 +782,14 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
getRegisterGroups(1); // assert root is preserved
}
-
@Test
public void canRestoreRegisterGroups() throws Throwable {
int grpsIncrement = 3;
addRegisterGroups(grpsIncrement);
- //Always able to restore to default
+ //Always able to restore to default
assertTrue(canRestoreDefaultGroups());
}
-
+
@Test
public void restoreRegisterGroups() throws Throwable {
int grpsIncrement = 3;
@@ -887,7 +902,7 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
writtenValue, readVal);
}
-
+
/**
* Get an array with all available register groups
*/
@@ -902,7 +917,8 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
fRegService.getExecutor().execute(queryGroupsCtx);
- IRegisterGroupDMContext[] regGroupsDMCs = queryGroupsCtx.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ IRegisterGroupDMContext[] regGroupsDMCs = queryGroupsCtx.get(TestsPlugin.massageTimeout(500),
+ TimeUnit.MILLISECONDS);
return (regGroupsDMCs);
}
@@ -957,14 +973,14 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
fRegService.getExecutor().submit(queryAction);
return queryAction.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
}
-
+
private void addGroup(final String groupName, final IRegisterDMContext[] regIndexes) throws Throwable {
if (regIndexes == null || regIndexes.length < 1) {
fail("Invalid argument regIndexes");
return;
}
-
+
Query<Object> queryAction = new Query<Object>() {
@Override
protected void execute(DataRequestMonitor<Object> rm) {
@@ -977,7 +993,8 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
queryAction.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
}
- private void editGroup(final IRegisterGroupDMContext group, final String newGroupName, final IRegisterDMContext[] regIndexes) throws Throwable {
+ private void editGroup(final IRegisterGroupDMContext group, final String newGroupName,
+ final IRegisterDMContext[] regIndexes) throws Throwable {
Query<Object> queryAction = new Query<Object>() {
@Override
@@ -1019,7 +1036,7 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
//Validate, we can always restore to defaults
return queryCanRestore.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
}
-
+
private void restoreDefaultGroups() throws Throwable {
Query<Object> queryRestore = new Query<Object>() {
@@ -1037,7 +1054,7 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
}
private void resetRegService() throws Throwable {
- assert(fRegService instanceof GDBRegisters);
+ assert (fRegService instanceof GDBRegisters);
final GDBRegisters regManager = (GDBRegisters) fRegService;
Query<Object> queryReset = new Query<Object>() {
@@ -1054,7 +1071,7 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
}
private void saveRegGroups() throws Throwable {
- assert(fRegService instanceof GDBRegisters);
+ assert (fRegService instanceof GDBRegisters);
final GDBRegisters regManager = (GDBRegisters) fRegService;
Query<Object> querySave = new Query<Object>() {
@@ -1090,7 +1107,8 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
Query<FormattedValueDMData> registerValueQ = new Query<FormattedValueDMData>() {
@Override
protected void execute(DataRequestMonitor<FormattedValueDMData> rm) {
- FormattedValueDMContext valueDmc = new FormattedValueDMContext(fRegService, registerDmc, IFormattedValues.NATURAL_FORMAT);
+ FormattedValueDMContext valueDmc = new FormattedValueDMContext(fRegService, registerDmc,
+ IFormattedValues.NATURAL_FORMAT);
fRegService.getFormattedExpressionValue(valueDmc, rm);
}
};
@@ -1131,7 +1149,7 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
return groupsData;
}
-
+
private void getRegisterGroupsData(final IDMContext dmc, final DataRequestMonitor<IRegisterGroupDMData[]> rm) {
assert (dmc != null);
final DsfExecutor executor = fRegService.getExecutor();
@@ -1155,13 +1173,14 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
// Resolve all register group data
for (int i = 0; i < groupsCtx.length; i++) {
final int index = i;
- fRegService.getRegisterGroupData(groupsCtx[index], new DataRequestMonitor<IRegisterGroupDMData>(executor, crm) {
- @Override
- protected void handleSuccess() {
- groupsData[index] = getData();
- crm.done();
- }
- });
+ fRegService.getRegisterGroupData(groupsCtx[index],
+ new DataRequestMonitor<IRegisterGroupDMData>(executor, crm) {
+ @Override
+ protected void handleSuccess() {
+ groupsData[index] = getData();
+ crm.done();
+ }
+ });
}
crm.setDoneCount(groupsCtx.length);
@@ -1196,7 +1215,7 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
// first i.e. index 0
// Our new group shall be at the top then i.e. 0
IFrameDMContext frameDmc = DMContexts.getAncestorOfType(regInGroup[0], IFrameDMContext.class);
- CompositeDMContext compositeDmc = new CompositeDMContext(new IDMContext[]{groups[0], frameDmc});
+ CompositeDMContext compositeDmc = new CompositeDMContext(new IDMContext[] { groups[0], frameDmc });
IRegisterDMContext[] readRegisters = getRegisters(compositeDmc);
// Same objects and same order expected, although different parents
@@ -1238,17 +1257,20 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
return same;
}
- private boolean sameData(IRegisterDMContext[] regArrOne, IRegisterDMContext[] regArrTwo, boolean sameParentGroup) throws Throwable {
+ private boolean sameData(IRegisterDMContext[] regArrOne, IRegisterDMContext[] regArrTwo, boolean sameParentGroup)
+ throws Throwable {
if (regArrOne.length != regArrTwo.length) {
return false;
}
- for (int i=0; i< regArrOne.length; i++) {
+ for (int i = 0; i < regArrOne.length; i++) {
if (sameParentGroup) {
//same group parent expected
- final IRegisterGroupDMContext parentGroupOne = DMContexts.getAncestorOfType(regArrOne[i], IRegisterGroupDMContext.class);
- final IRegisterGroupDMContext parentGroupTwo = DMContexts.getAncestorOfType(regArrTwo[i], IRegisterGroupDMContext.class);
- if(!parentGroupOne.equals(parentGroupTwo)) {
+ final IRegisterGroupDMContext parentGroupOne = DMContexts.getAncestorOfType(regArrOne[i],
+ IRegisterGroupDMContext.class);
+ final IRegisterGroupDMContext parentGroupTwo = DMContexts.getAncestorOfType(regArrTwo[i],
+ IRegisterGroupDMContext.class);
+ if (!parentGroupOne.equals(parentGroupTwo)) {
return false;
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlReverseTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlReverseTest.java
index 1bf60871850..c715c21c274 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlReverseTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlReverseTest.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.tests;
-
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -42,16 +41,15 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
-
/**
- * Tests MIRunControl class for some reverse debugging scenarios.
+ * Tests MIRunControl class for some reverse debugging scenarios.
*/
@RunWith(Parameterized.class)
public class MIRunControlReverseTest extends BaseParametrizedTestCase {
- private DsfServicesTracker fServicesTracker;
+ private DsfServicesTracker fServicesTracker;
private DsfSession fSession;
- private IGDBControl fGDBCtrl;
+ private IGDBControl fGDBCtrl;
private IMIRunControl fRunCtrl;
private IExpressions fExpressions;
@@ -64,62 +62,57 @@ public class MIRunControlReverseTest extends BaseParametrizedTestCase {
public void doBeforeTest() throws Exception {
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_0);
super.doBeforeTest();
-
+
fSession = getGDBLaunch().getSession();
-
- Runnable runnable = new Runnable() {
- @Override
+
+ Runnable runnable = new Runnable() {
+ @Override
public void run() {
- fServicesTracker =
- new DsfServicesTracker(TestsPlugin.getBundleContext(),
- fSession.getId());
- fGDBCtrl = fServicesTracker.getService(IGDBControl.class);
- fRunCtrl = fServicesTracker.getService(IMIRunControl.class);
- fExpressions = fServicesTracker.getService(IExpressions.class);
- }
- };
- fSession.getExecutor().submit(runnable).get();
+ fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
+ fGDBCtrl = fServicesTracker.getService(IGDBControl.class);
+ fRunCtrl = fServicesTracker.getService(IMIRunControl.class);
+ fExpressions = fServicesTracker.getService(IExpressions.class);
+ }
+ };
+ fSession.getExecutor().submit(runnable).get();
}
-
@Override
public void doAfterTest() throws Exception {
super.doAfterTest();
-
- if (fServicesTracker != null) {
- fServicesTracker.dispose();
- }
+
+ if (fServicesTracker != null) {
+ fServicesTracker.dispose();
+ }
}
-
+
@Override
protected void setLaunchAttributes() {
super.setLaunchAttributes();
-
- setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME,
- EXEC_PATH + EXEC_NAME);
+
+ setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EXEC_PATH + EXEC_NAME);
}
/**
- * This test verifies that we properly handle a query sent from GDB.
- * When running the basic console (GDB < 7.12) GDB answer's the query itself
- * and so we should not answer again. When using the full Console, GDB does
- * not answer so we must answer ourselves. When using the full console
- * we have both an MI and a CLI channel open; this test verifies how
- * we react to getting query on the MI-only channel, which is actually
- * not something GDB should do, but at least in 7.12, it does happen.
- */
+ * This test verifies that we properly handle a query sent from GDB.
+ * When running the basic console (GDB < 7.12) GDB answer's the query itself
+ * and so we should not answer again. When using the full Console, GDB does
+ * not answer so we must answer ourselves. When using the full console
+ * we have both an MI and a CLI channel open; this test verifies how
+ * we react to getting query on the MI-only channel, which is actually
+ * not something GDB should do, but at least in 7.12, it does happen.
+ */
@Test
public void testQueryHandling() throws Throwable {
SyncUtil.runToLocation("testLocals");
-
+
assertTrue("Reverse debugging is not supported", fRunCtrl instanceof IReverseRunControl);
- final IReverseRunControl reverseService = (IReverseRunControl)fRunCtrl;
+ final IReverseRunControl reverseService = (IReverseRunControl) fRunCtrl;
Query<Boolean> query = new Query<Boolean>() {
@Override
protected void execute(final DataRequestMonitor<Boolean> rm) {
- reverseService.enableReverseMode(fGDBCtrl.getContext(), true,
- new ImmediateRequestMonitor(rm) {
+ reverseService.enableReverseMode(fGDBCtrl.getContext(), true, new ImmediateRequestMonitor(rm) {
@Override
protected void handleSuccess() {
reverseService.isReverseModeEnabled(fGDBCtrl.getContext(), rm);
@@ -127,7 +120,7 @@ public class MIRunControlReverseTest extends BaseParametrizedTestCase {
});
}
};
-
+
fSession.getExecutor().execute(query);
Boolean enabled = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
assertTrue("Reverse debugging should be enabled", enabled);
@@ -136,25 +129,25 @@ public class MIRunControlReverseTest extends BaseParametrizedTestCase {
SyncUtil.step(2, StepType.STEP_OVER);
// Step back once to start using the record buffer
MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER, true);
-
+
IExpressionDMContext expr = SyncUtil.createExpression(stoppedEvent.getDMContext(), "lIntVar");
-
- // Register an event listener to check that we don't send out a 'y'
+
+ // Register an event listener to check that we don't send out a 'y'
// command when we don't need to.
boolean yesCommandSent[] = new boolean[1];
yesCommandSent[0] = false;
fGDBCtrl.addEventListener(new IEventListener() {
-
+
@Override
public void eventReceived(Object output) {
- for (MIOOBRecord oobr : ((MIOutput)output).getMIOOBRecords()) {
+ for (MIOOBRecord oobr : ((MIOutput) output).getMIOOBRecords()) {
if (oobr instanceof MILogStreamOutput) {
MILogStreamOutput stream = (MILogStreamOutput) oobr;
if (stream.getCString().indexOf("Undefined command: \"y") != -1) {
yesCommandSent[0] = true;
}
}
- }
+ }
}
});
@@ -172,11 +165,11 @@ public class MIRunControlReverseTest extends BaseParametrizedTestCase {
} catch (TimeoutException e) {
assert false : "Timed-out waiting to write to a variable, probably because of a query.";
}
-
+
// Now verify that the write work and that GDB is answering
String value = SyncUtil.getExpressionValue(expr, IFormattedValues.DECIMAL_FORMAT);
assertEquals("Value was not writtent to variable", newValue, value);
-
+
assertTrue("Sent a 'y' command unnecessarily", !yesCommandSent[0]); //$NON-NLS-1$
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTargetAvailableTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTargetAvailableTest.java
index f5a9b5fe8d1..97504bc5132 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTargetAvailableTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTargetAvailableTest.java
@@ -7,13 +7,12 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson AB - Initial implementation of Test cases
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.tests;
-
import static org.junit.Assert.fail;
import java.util.concurrent.ExecutionException;
@@ -43,15 +42,14 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
-
/**
- * Tests MIRunControl class for for the execWhileTargetAvailable() method.
+ * Tests MIRunControl class for for the execWhileTargetAvailable() method.
*/
@RunWith(Parameterized.class)
public class MIRunControlTargetAvailableTest extends BaseParametrizedTestCase {
- private DsfServicesTracker fServicesTracker;
+ private DsfServicesTracker fServicesTracker;
- private IGDBControl fGDBCtrl;
+ private IGDBControl fGDBCtrl;
private IMIRunControl fRunCtrl;
private IContainerDMContext fContainerDmc;
@@ -64,415 +62,425 @@ public class MIRunControlTargetAvailableTest extends BaseParametrizedTestCase {
@Override
public void doBeforeTest() throws Exception {
super.doBeforeTest();
-
+
final DsfSession session = getGDBLaunch().getSession();
-
- Runnable runnable = new Runnable() {
- @Override
+
+ Runnable runnable = new Runnable() {
+ @Override
public void run() {
- fServicesTracker =
- new DsfServicesTracker(TestsPlugin.getBundleContext(),
- session.getId());
- fGDBCtrl = fServicesTracker.getService(IGDBControl.class);
-
- fRunCtrl = fServicesTracker.getService(IMIRunControl.class);
- }
- };
- session.getExecutor().submit(runnable).get();
-
- fContainerDmc = SyncUtil.getContainerContext();
- }
+ fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), session.getId());
+ fGDBCtrl = fServicesTracker.getService(IGDBControl.class);
+ fRunCtrl = fServicesTracker.getService(IMIRunControl.class);
+ }
+ };
+ session.getExecutor().submit(runnable).get();
+
+ fContainerDmc = SyncUtil.getContainerContext();
+ }
@Override
public void doAfterTest() throws Exception {
super.doAfterTest();
-
- if (fServicesTracker!=null) fServicesTracker.dispose();
+
+ if (fServicesTracker != null)
+ fServicesTracker.dispose();
}
-
+
@Override
protected void setLaunchAttributes() {
super.setLaunchAttributes();
-
- setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME,
- EXEC_PATH + EXEC_NAME);
+
+ setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EXEC_PATH + EXEC_NAME);
}
- /**
- * Test that the executeWhileTargetAvailale interface works properly
- * for a single operation with a single step when the target is stopped.
- */
- @Test
- public void executeSingleStepSingleOpWhileTargetStopped() throws Throwable {
- // The target is currently stopped.
-
- // A single step that will set a breakpoint at PrintHello, which we will then make sure hits
- final Step[] steps = new Step[] {
- new Step() {
- @Override
- public void execute(RequestMonitor rm) {
- IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc, IBreakpointsTargetDMContext.class);
-
- fGDBCtrl.queueCommand(
- fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null, 0, "PrintHello", "0"),
- new DataRequestMonitor<MIBreakInsertInfo> (fGDBCtrl.getExecutor(), rm));
- }}
- };
-
- Query<Boolean> query = new Query<Boolean>() {
+ /**
+ * Test that the executeWhileTargetAvailale interface works properly
+ * for a single operation with a single step when the target is stopped.
+ */
+ @Test
+ public void executeSingleStepSingleOpWhileTargetStopped() throws Throwable {
+ // The target is currently stopped.
+
+ // A single step that will set a breakpoint at PrintHello, which we will then make sure hits
+ final Step[] steps = new Step[] { new Step() {
+ @Override
+ public void execute(RequestMonitor rm) {
+ IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc,
+ IBreakpointsTargetDMContext.class);
+
+ fGDBCtrl.queueCommand(
+ fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null, 0,
+ "PrintHello", "0"),
+ new DataRequestMonitor<MIBreakInsertInfo>(fGDBCtrl.getExecutor(), rm));
+ }
+ } };
+
+ Query<Boolean> query = new Query<Boolean>() {
@Override
protected void execute(DataRequestMonitor<Boolean> rm) {
- fRunCtrl.executeWithTargetAvailable(fContainerDmc, steps, rm);
+ fRunCtrl.executeWithTargetAvailable(fContainerDmc, steps, rm);
+ }
+ };
+ {
+ fRunCtrl.getExecutor().execute(query);
+ query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ }
+
+ // Now resume the target and check that we stop at the breakpoint.
+
+ ServiceEventWaitor<ISuspendedDMEvent> suspendedEventWaitor = new ServiceEventWaitor<ISuspendedDMEvent>(
+ getGDBLaunch().getSession(), ISuspendedDMEvent.class);
+
+ SyncUtil.resume();
+
+ // Wait up to 3 second for the target to suspend. Should happen within 2 second.
+ suspendedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(3000));
+ }
+
+ /**
+ * Test that the executeWhileTargetAvailale interface works properly
+ * for a single operation with a single step when the target is running.
+ */
+ @Test
+ public void executeSingleStepSingleOpWhileTargetRunning() throws Throwable {
+ // A single step that will set a breakpoint at PrintHello, which we will then make sure hits
+ final Step[] steps = new Step[] { new Step() {
+ @Override
+ public void execute(RequestMonitor rm) {
+ IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc,
+ IBreakpointsTargetDMContext.class);
+
+ fGDBCtrl.queueCommand(
+ fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null, 0,
+ "PrintHello", "0"),
+ new DataRequestMonitor<MIBreakInsertInfo>(fGDBCtrl.getExecutor(), rm));
}
- };
- {
- fRunCtrl.getExecutor().execute(query);
- query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
- }
-
- // Now resume the target and check that we stop at the breakpoint.
-
- ServiceEventWaitor<ISuspendedDMEvent> suspendedEventWaitor = new ServiceEventWaitor<ISuspendedDMEvent>(
- getGDBLaunch().getSession(),
- ISuspendedDMEvent.class);
-
- SyncUtil.resume();
-
- // Wait up to 3 second for the target to suspend. Should happen within 2 second.
- suspendedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(3000));
- }
-
- /**
- * Test that the executeWhileTargetAvailale interface works properly
- * for a single operation with a single step when the target is running.
- */
- @Test
- public void executeSingleStepSingleOpWhileTargetRunning() throws Throwable {
- // A single step that will set a breakpoint at PrintHello, which we will then make sure hits
- final Step[] steps = new Step[] {
- new Step() {
- @Override
- public void execute(RequestMonitor rm) {
- IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc, IBreakpointsTargetDMContext.class);
-
- fGDBCtrl.queueCommand(
- fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null, 0, "PrintHello", "0"),
- new DataRequestMonitor<MIBreakInsertInfo> (fGDBCtrl.getExecutor(), rm));
- }}
- };
-
- // The target is currently stopped so we resume it
- ServiceEventWaitor<ISuspendedDMEvent> suspendedEventWaitor = new ServiceEventWaitor<ISuspendedDMEvent>(
- getGDBLaunch().getSession(),
- ISuspendedDMEvent.class);
-
- SyncUtil.resume();
-
- Query<Boolean> query = new Query<Boolean>() {
+ } };
+
+ // The target is currently stopped so we resume it
+ ServiceEventWaitor<ISuspendedDMEvent> suspendedEventWaitor = new ServiceEventWaitor<ISuspendedDMEvent>(
+ getGDBLaunch().getSession(), ISuspendedDMEvent.class);
+
+ SyncUtil.resume();
+
+ Query<Boolean> query = new Query<Boolean>() {
@Override
protected void execute(DataRequestMonitor<Boolean> rm) {
- fRunCtrl.executeWithTargetAvailable(fContainerDmc, steps, rm);
+ fRunCtrl.executeWithTargetAvailable(fContainerDmc, steps, rm);
}
- };
- {
- fRunCtrl.getExecutor().execute(query);
- query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
- }
-
- // Now check that the target is stopped at the breakpoint.
- // Wait up to 3 second for the target to suspend. Should happen at most in 2 seconds.
- suspendedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(3000));
- }
-
- /**
- * Test that the executeWhileTargetAvailale interface works properly
- * for a single operation with multiple steps when the target is stopped.
- */
- @Test
- public void executeMultiStepSingleOpWhileTargetStopped() throws Throwable {
- // The target is currently stopped.
-
- // Multiple steps that will set three temp breakpoints at three different lines
- // We then check that the target will stop three times
- final Step[] steps = new Step[] {
- new Step() {
- @Override
- public void execute(RequestMonitor rm) {
- IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc, IBreakpointsTargetDMContext.class);
-
- fGDBCtrl.queueCommand(
- fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null, 0, "PrintHello", "0"),
- new DataRequestMonitor<MIBreakInsertInfo> (fGDBCtrl.getExecutor(), rm));
- }},
- new Step() {
- @Override
- public void execute(RequestMonitor rm) {
- IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc, IBreakpointsTargetDMContext.class);
-
- fGDBCtrl.queueCommand(
- fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null, 0, "PrintHi", "0"),
- new DataRequestMonitor<MIBreakInsertInfo> (fGDBCtrl.getExecutor(), rm));
- }},
- new Step() {
- @Override
- public void execute(RequestMonitor rm) {
- IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc, IBreakpointsTargetDMContext.class);
-
- fGDBCtrl.queueCommand(
- fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null, 0, "PrintBonjour", "0"),
- new DataRequestMonitor<MIBreakInsertInfo> (fGDBCtrl.getExecutor(), rm));
- }}
- };
-
- Query<Boolean> query = new Query<Boolean>() {
+ };
+ {
+ fRunCtrl.getExecutor().execute(query);
+ query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ }
+
+ // Now check that the target is stopped at the breakpoint.
+ // Wait up to 3 second for the target to suspend. Should happen at most in 2 seconds.
+ suspendedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(3000));
+ }
+
+ /**
+ * Test that the executeWhileTargetAvailale interface works properly
+ * for a single operation with multiple steps when the target is stopped.
+ */
+ @Test
+ public void executeMultiStepSingleOpWhileTargetStopped() throws Throwable {
+ // The target is currently stopped.
+
+ // Multiple steps that will set three temp breakpoints at three different lines
+ // We then check that the target will stop three times
+ final Step[] steps = new Step[] { new Step() {
+ @Override
+ public void execute(RequestMonitor rm) {
+ IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc,
+ IBreakpointsTargetDMContext.class);
+
+ fGDBCtrl.queueCommand(
+ fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null, 0,
+ "PrintHello", "0"),
+ new DataRequestMonitor<MIBreakInsertInfo>(fGDBCtrl.getExecutor(), rm));
+ }
+ }, new Step() {
+ @Override
+ public void execute(RequestMonitor rm) {
+ IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc,
+ IBreakpointsTargetDMContext.class);
+
+ fGDBCtrl.queueCommand(fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null,
+ 0, "PrintHi", "0"), new DataRequestMonitor<MIBreakInsertInfo>(fGDBCtrl.getExecutor(), rm));
+ }
+ }, new Step() {
+ @Override
+ public void execute(RequestMonitor rm) {
+ IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc,
+ IBreakpointsTargetDMContext.class);
+
+ fGDBCtrl.queueCommand(
+ fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null, 0,
+ "PrintBonjour", "0"),
+ new DataRequestMonitor<MIBreakInsertInfo>(fGDBCtrl.getExecutor(), rm));
+ }
+ } };
+
+ Query<Boolean> query = new Query<Boolean>() {
@Override
protected void execute(DataRequestMonitor<Boolean> rm) {
- fRunCtrl.executeWithTargetAvailable(fContainerDmc, steps, rm);
+ fRunCtrl.executeWithTargetAvailable(fContainerDmc, steps, rm);
+ }
+ };
+ {
+ fRunCtrl.getExecutor().execute(query);
+ query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ }
+
+ // Now resume the target three times and check that we stop three times.
+ for (int i = 0; i < steps.length; i++) {
+ ServiceEventWaitor<ISuspendedDMEvent> suspendedEventWaitor = new ServiceEventWaitor<ISuspendedDMEvent>(
+ getGDBLaunch().getSession(), ISuspendedDMEvent.class);
+
+ SyncUtil.resume();
+
+ // Wait up to 3 second for the target to suspend. Should happen within 2 seconds.
+ suspendedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(3000));
+ }
+ }
+
+ /**
+ * Test that the executeWhileTargetAvailale interface works properly
+ * for a single operation with multiple steps when the target is stopped
+ * and one of the steps fails.
+ */
+ @Test
+ public void executeMultiStepSingleOpWhileTargetStoppedWithError() throws Throwable {
+ // The target is currently stopped.
+
+ // Multiple steps that will set three temp breakpoints at three different lines
+ // We then check that the target will stop three times
+ final Step[] steps = new Step[] { new Step() {
+ @Override
+ public void execute(RequestMonitor rm) {
+ IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc,
+ IBreakpointsTargetDMContext.class);
+
+ fGDBCtrl.queueCommand(
+ fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null, 0,
+ "PrintHello", "0"),
+ new DataRequestMonitor<MIBreakInsertInfo>(fGDBCtrl.getExecutor(), rm));
+ }
+ }, new Step() {
+ @Override
+ public void execute(RequestMonitor rm) {
+ IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc,
+ IBreakpointsTargetDMContext.class);
+
+ fGDBCtrl.queueCommand(
+ fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, "invalid condition",
+ 0, "PrintHi", "0"),
+ new DataRequestMonitor<MIBreakInsertInfo>(fGDBCtrl.getExecutor(), rm));
+ }
+ }, new Step() {
+ @Override
+ public void execute(RequestMonitor rm) {
+ IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc,
+ IBreakpointsTargetDMContext.class);
+
+ fGDBCtrl.queueCommand(
+ fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null, 0,
+ "PrintBonjour", "0"),
+ new DataRequestMonitor<MIBreakInsertInfo>(fGDBCtrl.getExecutor(), rm));
}
- };
- {
- fRunCtrl.getExecutor().execute(query);
- query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
- }
-
- // Now resume the target three times and check that we stop three times.
- for (int i=0; i<steps.length; i++) {
- ServiceEventWaitor<ISuspendedDMEvent> suspendedEventWaitor = new ServiceEventWaitor<ISuspendedDMEvent>(
- getGDBLaunch().getSession(),
- ISuspendedDMEvent.class);
-
- SyncUtil.resume();
-
- // Wait up to 3 second for the target to suspend. Should happen within 2 seconds.
- suspendedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(3000));
- }
- }
-
- /**
- * Test that the executeWhileTargetAvailale interface works properly
- * for a single operation with multiple steps when the target is stopped
- * and one of the steps fails.
- */
- @Test
- public void executeMultiStepSingleOpWhileTargetStoppedWithError() throws Throwable {
- // The target is currently stopped.
-
- // Multiple steps that will set three temp breakpoints at three different lines
- // We then check that the target will stop three times
- final Step[] steps = new Step[] {
- new Step() {
- @Override
- public void execute(RequestMonitor rm) {
- IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc, IBreakpointsTargetDMContext.class);
-
- fGDBCtrl.queueCommand(
- fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null, 0, "PrintHello", "0"),
- new DataRequestMonitor<MIBreakInsertInfo> (fGDBCtrl.getExecutor(), rm));
- }},
- new Step() {
- @Override
- public void execute(RequestMonitor rm) {
- IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc, IBreakpointsTargetDMContext.class);
-
- fGDBCtrl.queueCommand(
- fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, "invalid condition", 0, "PrintHi", "0"),
- new DataRequestMonitor<MIBreakInsertInfo> (fGDBCtrl.getExecutor(), rm));
- }},
- new Step() {
- @Override
- public void execute(RequestMonitor rm) {
- IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc, IBreakpointsTargetDMContext.class);
-
- fGDBCtrl.queueCommand(
- fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null, 0, "PrintBonjour", "0"),
- new DataRequestMonitor<MIBreakInsertInfo> (fGDBCtrl.getExecutor(), rm));
- }}
- };
-
- Query<Boolean> query = new Query<Boolean>() {
+ } };
+
+ Query<Boolean> query = new Query<Boolean>() {
@Override
protected void execute(DataRequestMonitor<Boolean> rm) {
- fRunCtrl.executeWithTargetAvailable(fContainerDmc, steps, rm);
+ fRunCtrl.executeWithTargetAvailable(fContainerDmc, steps, rm);
+ }
+ };
+ try {
+ fRunCtrl.getExecutor().execute(query);
+ query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ } catch (ExecutionException e) {
+ // We want to detect the error, so this is success
+ return;
+ }
+
+ fail("Did not detect the error of the step");
+ }
+
+ /**
+ * Test that the executeWhileTargetAvailale interface works properly
+ * for a single operation with multiple steps when the target is running.
+ */
+ @Test
+ public void executeMultiStepSingleOpWhileTargetRunning() throws Throwable {
+ // Multiple steps that will set three temp breakpoints at three different lines
+ // We then check that the target will stop three times
+ final Step[] steps = new Step[] { new Step() {
+ @Override
+ public void execute(RequestMonitor rm) {
+ IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc,
+ IBreakpointsTargetDMContext.class);
+
+ fGDBCtrl.queueCommand(
+ fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null, 0,
+ "PrintHello", "0"),
+ new DataRequestMonitor<MIBreakInsertInfo>(fGDBCtrl.getExecutor(), rm));
+ }
+ }, new Step() {
+ @Override
+ public void execute(RequestMonitor rm) {
+ IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc,
+ IBreakpointsTargetDMContext.class);
+
+ fGDBCtrl.queueCommand(fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null,
+ 0, "PrintHi", "0"), new DataRequestMonitor<MIBreakInsertInfo>(fGDBCtrl.getExecutor(), rm));
}
- };
- try {
- fRunCtrl.getExecutor().execute(query);
- query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
- } catch (ExecutionException e) {
- // We want to detect the error, so this is success
- return;
- }
-
- fail("Did not detect the error of the step");
- }
-
- /**
- * Test that the executeWhileTargetAvailale interface works properly
- * for a single operation with multiple steps when the target is running.
- */
- @Test
- public void executeMultiStepSingleOpWhileTargetRunning() throws Throwable {
- // Multiple steps that will set three temp breakpoints at three different lines
- // We then check that the target will stop three times
- final Step[] steps = new Step[] {
- new Step() {
- @Override
- public void execute(RequestMonitor rm) {
- IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc, IBreakpointsTargetDMContext.class);
-
- fGDBCtrl.queueCommand(
- fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null, 0, "PrintHello", "0"),
- new DataRequestMonitor<MIBreakInsertInfo> (fGDBCtrl.getExecutor(), rm));
- }},
- new Step() {
- @Override
- public void execute(RequestMonitor rm) {
- IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc, IBreakpointsTargetDMContext.class);
-
- fGDBCtrl.queueCommand(
- fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null, 0, "PrintHi", "0"),
- new DataRequestMonitor<MIBreakInsertInfo> (fGDBCtrl.getExecutor(), rm));
- }},
- new Step() {
- @Override
- public void execute(RequestMonitor rm) {
- IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc, IBreakpointsTargetDMContext.class);
-
- fGDBCtrl.queueCommand(
- fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null, 0, "PrintBonjour", "0"),
- new DataRequestMonitor<MIBreakInsertInfo> (fGDBCtrl.getExecutor(), rm));
- }}
- };
-
- // The target is currently stopped so we resume it
- ServiceEventWaitor<ISuspendedDMEvent> suspendedEventWaitor = new ServiceEventWaitor<ISuspendedDMEvent>(
- getGDBLaunch().getSession(),
- ISuspendedDMEvent.class);
-
- SyncUtil.resume();
-
- Query<Boolean> query = new Query<Boolean>() {
+ }, new Step() {
+ @Override
+ public void execute(RequestMonitor rm) {
+ IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc,
+ IBreakpointsTargetDMContext.class);
+
+ fGDBCtrl.queueCommand(
+ fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null, 0,
+ "PrintBonjour", "0"),
+ new DataRequestMonitor<MIBreakInsertInfo>(fGDBCtrl.getExecutor(), rm));
+ }
+ } };
+
+ // The target is currently stopped so we resume it
+ ServiceEventWaitor<ISuspendedDMEvent> suspendedEventWaitor = new ServiceEventWaitor<ISuspendedDMEvent>(
+ getGDBLaunch().getSession(), ISuspendedDMEvent.class);
+
+ SyncUtil.resume();
+
+ Query<Boolean> query = new Query<Boolean>() {
@Override
protected void execute(DataRequestMonitor<Boolean> rm) {
- fRunCtrl.executeWithTargetAvailable(fContainerDmc, steps, rm);
+ fRunCtrl.executeWithTargetAvailable(fContainerDmc, steps, rm);
}
- };
- {
- fRunCtrl.getExecutor().execute(query);
- query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
- }
-
- // Now resume the target three times and check that we stop three times.
- for (int i=0; i<steps.length; i++) {
- // Wait up to 3 second for the target to suspend. Should happen within two seconds.
- suspendedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(3000));
-
- suspendedEventWaitor = new ServiceEventWaitor<ISuspendedDMEvent>(
- getGDBLaunch().getSession(),
- ISuspendedDMEvent.class);
-
- SyncUtil.resume();
-
- }
- }
-
- /**
- * Test that the executeWhileTargetAvailale interface works properly
- * for a single operation with multiple steps when the target is running
- * and one of the steps fails.
- */
- @Test
- public void executeMultiStepSingleOpWhileTargetRunningWithError() throws Throwable {
- // Multiple steps that will set three temp breakpoints at three different lines
- // We then check that the target will stop three times
- final Step[] steps = new Step[] {
- new Step() {
- @Override
- public void execute(RequestMonitor rm) {
- IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc, IBreakpointsTargetDMContext.class);
-
- fGDBCtrl.queueCommand(
- fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null, 0, "PrintHello", "0"),
- new DataRequestMonitor<MIBreakInsertInfo> (fGDBCtrl.getExecutor(), rm));
- }},
- new Step() {
- @Override
- public void execute(RequestMonitor rm) {
- IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc, IBreakpointsTargetDMContext.class);
-
- fGDBCtrl.queueCommand(
- fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, "invalid condition", 0, "PrintHi", "0"),
- new DataRequestMonitor<MIBreakInsertInfo> (fGDBCtrl.getExecutor(), rm));
- }},
- new Step() {
- @Override
- public void execute(RequestMonitor rm) {
- IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc, IBreakpointsTargetDMContext.class);
-
- fGDBCtrl.queueCommand(
- fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null, 0, "PrintBonjour", "0"),
- new DataRequestMonitor<MIBreakInsertInfo> (fGDBCtrl.getExecutor(), rm));
- }}
- };
-
- // The target is currently stopped so we resume it
- ServiceEventWaitor<ISuspendedDMEvent> suspendedEventWaitor = new ServiceEventWaitor<ISuspendedDMEvent>(
- getGDBLaunch().getSession(),
- ISuspendedDMEvent.class);
-
- SyncUtil.resume();
-
- Query<Boolean> query = new Query<Boolean>() {
+ };
+ {
+ fRunCtrl.getExecutor().execute(query);
+ query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ }
+
+ // Now resume the target three times and check that we stop three times.
+ for (int i = 0; i < steps.length; i++) {
+ // Wait up to 3 second for the target to suspend. Should happen within two seconds.
+ suspendedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(3000));
+
+ suspendedEventWaitor = new ServiceEventWaitor<ISuspendedDMEvent>(getGDBLaunch().getSession(),
+ ISuspendedDMEvent.class);
+
+ SyncUtil.resume();
+
+ }
+ }
+
+ /**
+ * Test that the executeWhileTargetAvailale interface works properly
+ * for a single operation with multiple steps when the target is running
+ * and one of the steps fails.
+ */
+ @Test
+ public void executeMultiStepSingleOpWhileTargetRunningWithError() throws Throwable {
+ // Multiple steps that will set three temp breakpoints at three different lines
+ // We then check that the target will stop three times
+ final Step[] steps = new Step[] { new Step() {
+ @Override
+ public void execute(RequestMonitor rm) {
+ IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc,
+ IBreakpointsTargetDMContext.class);
+
+ fGDBCtrl.queueCommand(
+ fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null, 0,
+ "PrintHello", "0"),
+ new DataRequestMonitor<MIBreakInsertInfo>(fGDBCtrl.getExecutor(), rm));
+ }
+ }, new Step() {
+ @Override
+ public void execute(RequestMonitor rm) {
+ IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc,
+ IBreakpointsTargetDMContext.class);
+
+ fGDBCtrl.queueCommand(
+ fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, "invalid condition",
+ 0, "PrintHi", "0"),
+ new DataRequestMonitor<MIBreakInsertInfo>(fGDBCtrl.getExecutor(), rm));
+ }
+ }, new Step() {
+ @Override
+ public void execute(RequestMonitor rm) {
+ IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc,
+ IBreakpointsTargetDMContext.class);
+
+ fGDBCtrl.queueCommand(
+ fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null, 0,
+ "PrintBonjour", "0"),
+ new DataRequestMonitor<MIBreakInsertInfo>(fGDBCtrl.getExecutor(), rm));
+ }
+ } };
+
+ // The target is currently stopped so we resume it
+ ServiceEventWaitor<ISuspendedDMEvent> suspendedEventWaitor = new ServiceEventWaitor<ISuspendedDMEvent>(
+ getGDBLaunch().getSession(), ISuspendedDMEvent.class);
+
+ SyncUtil.resume();
+
+ Query<Boolean> query = new Query<Boolean>() {
@Override
protected void execute(DataRequestMonitor<Boolean> rm) {
- fRunCtrl.executeWithTargetAvailable(fContainerDmc, steps, rm);
+ fRunCtrl.executeWithTargetAvailable(fContainerDmc, steps, rm);
}
- };
-
- boolean caughtError = false;
- try {
- fRunCtrl.getExecutor().execute(query);
- query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
- } catch (ExecutionException e) {
- caughtError = true;
- }
-
- Assert.assertTrue("Did not catch the error of the step", caughtError);
-
- // Now make sure the target stop of the first breakpoint
- // Wait up to 3 second for the target to suspend. Should happen within two seconds.
- suspendedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(3000));
- }
-
- /**
- * Test that the executeWhileTargetAvailale interface works properly
- * for concurrent operations with a single step when the target is stopped.
- */
- @Test
- public void executeSingleStepConcurrentOpWhileTargetStopped() throws Throwable {
- // The target is currently stopped.
-
- final int NUM_CONCURRENT = 3;
-
- String[] locations = { "PrintHello", "PrintHi", "PrintBonjour" };
- final Step[][] steps = new Step[NUM_CONCURRENT][1]; // one step for each concurrent operation
- for (int i=0; i<steps.length; i++) {
- final String location = locations[i];
- steps[i] = new Step[] {
- new Step() {
- @Override
- public void execute(RequestMonitor rm) {
- IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc, IBreakpointsTargetDMContext.class);
-
- fGDBCtrl.queueCommand(
- fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null, 0, location, "0"),
- new DataRequestMonitor<MIBreakInsertInfo> (fGDBCtrl.getExecutor(), rm));
- }}
- };
- }
-
- Query<Boolean> query = new Query<Boolean>() {
+ };
+
+ boolean caughtError = false;
+ try {
+ fRunCtrl.getExecutor().execute(query);
+ query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ } catch (ExecutionException e) {
+ caughtError = true;
+ }
+
+ Assert.assertTrue("Did not catch the error of the step", caughtError);
+
+ // Now make sure the target stop of the first breakpoint
+ // Wait up to 3 second for the target to suspend. Should happen within two seconds.
+ suspendedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(3000));
+ }
+
+ /**
+ * Test that the executeWhileTargetAvailale interface works properly
+ * for concurrent operations with a single step when the target is stopped.
+ */
+ @Test
+ public void executeSingleStepConcurrentOpWhileTargetStopped() throws Throwable {
+ // The target is currently stopped.
+
+ final int NUM_CONCURRENT = 3;
+
+ String[] locations = { "PrintHello", "PrintHi", "PrintBonjour" };
+ final Step[][] steps = new Step[NUM_CONCURRENT][1]; // one step for each concurrent operation
+ for (int i = 0; i < steps.length; i++) {
+ final String location = locations[i];
+ steps[i] = new Step[] { new Step() {
+ @Override
+ public void execute(RequestMonitor rm) {
+ IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc,
+ IBreakpointsTargetDMContext.class);
+
+ fGDBCtrl.queueCommand(
+ fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null, 0,
+ location, "0"),
+ new DataRequestMonitor<MIBreakInsertInfo>(fGDBCtrl.getExecutor(), rm));
+ }
+ } };
+ }
+
+ Query<Boolean> query = new Query<Boolean>() {
@Override
protected void execute(final DataRequestMonitor<Boolean> rm) {
CountingRequestMonitor crm = new CountingRequestMonitor(fGDBCtrl.getExecutor(), null) {
@@ -481,67 +489,65 @@ public class MIRunControlTargetAvailableTest extends BaseParametrizedTestCase {
rm.done();
};
};
-
int index;
- for (index=0; index<steps.length; index++) {
+ for (index = 0; index < steps.length; index++) {
fRunCtrl.executeWithTargetAvailable(fContainerDmc, steps[index], crm);
}
-
+
crm.setDoneCount(index);
}
- };
- {
- fRunCtrl.getExecutor().execute(query);
- query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
- }
-
- for (int i=0; i<steps.length; i++) {
- // Now resume the target and check that we stop at all the breakpoints.
- ServiceEventWaitor<ISuspendedDMEvent> suspendedEventWaitor = new ServiceEventWaitor<ISuspendedDMEvent>(
- getGDBLaunch().getSession(),
- ISuspendedDMEvent.class);
-
- SyncUtil.resume();
-
- // Wait up to 3 second for the target to suspend. Should happen within 2 second.
- suspendedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(3000));
- }
- }
-
- /**
- * Test that the executeWhileTargetAvailale interface works properly
- * for concurrent operations with a single step when the target is running.
- */
- @Test
- public void executeSingleStepConcurrentOpWhileTargetRunning() throws Throwable {
- final int NUM_CONCURRENT = 3;
-
- String[] locations = { "PrintHello", "PrintHi", "PrintBonjour" };
- final Step[][] steps = new Step[NUM_CONCURRENT][1]; // one step for each concurrent operation
- for (int i=0; i<steps.length; i++) {
- final String location = locations[i];
- steps[i] = new Step[] {
- new Step() {
- @Override
- public void execute(RequestMonitor rm) {
- IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc, IBreakpointsTargetDMContext.class);
-
- fGDBCtrl.queueCommand(
- fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null, 0, location, "0"),
- new DataRequestMonitor<MIBreakInsertInfo> (fGDBCtrl.getExecutor(), rm));
- }}
- };
- }
-
- // The target is currently stopped so we resume it
- ServiceEventWaitor<ISuspendedDMEvent> suspendedEventWaitor = new ServiceEventWaitor<ISuspendedDMEvent>(
- getGDBLaunch().getSession(),
- ISuspendedDMEvent.class);
-
- SyncUtil.resume();
-
- Query<Boolean> query = new Query<Boolean>() {
+ };
+ {
+ fRunCtrl.getExecutor().execute(query);
+ query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ }
+
+ for (int i = 0; i < steps.length; i++) {
+ // Now resume the target and check that we stop at all the breakpoints.
+ ServiceEventWaitor<ISuspendedDMEvent> suspendedEventWaitor = new ServiceEventWaitor<ISuspendedDMEvent>(
+ getGDBLaunch().getSession(), ISuspendedDMEvent.class);
+
+ SyncUtil.resume();
+
+ // Wait up to 3 second for the target to suspend. Should happen within 2 second.
+ suspendedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(3000));
+ }
+ }
+
+ /**
+ * Test that the executeWhileTargetAvailale interface works properly
+ * for concurrent operations with a single step when the target is running.
+ */
+ @Test
+ public void executeSingleStepConcurrentOpWhileTargetRunning() throws Throwable {
+ final int NUM_CONCURRENT = 3;
+
+ String[] locations = { "PrintHello", "PrintHi", "PrintBonjour" };
+ final Step[][] steps = new Step[NUM_CONCURRENT][1]; // one step for each concurrent operation
+ for (int i = 0; i < steps.length; i++) {
+ final String location = locations[i];
+ steps[i] = new Step[] { new Step() {
+ @Override
+ public void execute(RequestMonitor rm) {
+ IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc,
+ IBreakpointsTargetDMContext.class);
+
+ fGDBCtrl.queueCommand(
+ fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null, 0,
+ location, "0"),
+ new DataRequestMonitor<MIBreakInsertInfo>(fGDBCtrl.getExecutor(), rm));
+ }
+ } };
+ }
+
+ // The target is currently stopped so we resume it
+ ServiceEventWaitor<ISuspendedDMEvent> suspendedEventWaitor = new ServiceEventWaitor<ISuspendedDMEvent>(
+ getGDBLaunch().getSession(), ISuspendedDMEvent.class);
+
+ SyncUtil.resume();
+
+ Query<Boolean> query = new Query<Boolean>() {
@Override
protected void execute(final DataRequestMonitor<Boolean> rm) {
CountingRequestMonitor crm = new CountingRequestMonitor(fGDBCtrl.getExecutor(), null) {
@@ -550,289 +556,289 @@ public class MIRunControlTargetAvailableTest extends BaseParametrizedTestCase {
rm.done();
};
};
-
int index;
- for (index=0; index<steps.length; index++) {
+ for (index = 0; index < steps.length; index++) {
fRunCtrl.executeWithTargetAvailable(fContainerDmc, steps[index], crm);
}
-
+
crm.setDoneCount(index);
}
- };
- {
- fRunCtrl.getExecutor().execute(query);
- query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
- }
-
- for (int i=0; i<steps.length; i++) {
- // Wait up to 3 second for the target to suspend. Should happen within 2 seconds.
- suspendedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(3000));
-
- // Now resume the target and check that we stop at all the breakpoints.
- suspendedEventWaitor = new ServiceEventWaitor<ISuspendedDMEvent>(
- getGDBLaunch().getSession(),
- ISuspendedDMEvent.class);
-
- SyncUtil.resume();
- }
- }
-
- /**
- * Test that the executeWhileTargetAvailale interface works properly
- * for concurrent operations with a single step when the target is stopped.
- * This tests verifies that we properly handle concurrent operations that are sent
- * while other operations are already being run.
- */
- @Test
- public void executeSingleStepConcurrentButDelayedOpWhileTargetStopped() throws Throwable {
- // The target is currently stopped.
-
- final String location = "PrintHello";
- final String location2 = "PrintHi";
- final Step[] steps = new Step[] {
- new Step() {
- @Override
- public void execute(final RequestMonitor rm) {
- final IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc, IBreakpointsTargetDMContext.class);
-
- fGDBCtrl.queueCommand(
- fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null, 0, location, "0"),
- new DataRequestMonitor<MIBreakInsertInfo> (fGDBCtrl.getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- // Now that time has elapsed, send another command
- fRunCtrl.executeWithTargetAvailable(fContainerDmc, new Step[] {
- new Step() {
- @Override
- public void execute(final RequestMonitor rm) {
- fGDBCtrl.queueCommand(
- fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null, 0, location2, "0"),
- new DataRequestMonitor<MIBreakInsertInfo> (fGDBCtrl.getExecutor(), null));
- }}}, new RequestMonitor(fGDBCtrl.getExecutor(), null));
-
- // Complete the first operation because the two are supposed to be independent
- rm.done();
- }});
- }}
- };
-
- Query<Boolean> query = new Query<Boolean>() {
+ };
+ {
+ fRunCtrl.getExecutor().execute(query);
+ query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ }
+
+ for (int i = 0; i < steps.length; i++) {
+ // Wait up to 3 second for the target to suspend. Should happen within 2 seconds.
+ suspendedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(3000));
+
+ // Now resume the target and check that we stop at all the breakpoints.
+ suspendedEventWaitor = new ServiceEventWaitor<ISuspendedDMEvent>(getGDBLaunch().getSession(),
+ ISuspendedDMEvent.class);
+
+ SyncUtil.resume();
+ }
+ }
+
+ /**
+ * Test that the executeWhileTargetAvailale interface works properly
+ * for concurrent operations with a single step when the target is stopped.
+ * This tests verifies that we properly handle concurrent operations that are sent
+ * while other operations are already being run.
+ */
+ @Test
+ public void executeSingleStepConcurrentButDelayedOpWhileTargetStopped() throws Throwable {
+ // The target is currently stopped.
+
+ final String location = "PrintHello";
+ final String location2 = "PrintHi";
+ final Step[] steps = new Step[] { new Step() {
+ @Override
+ public void execute(final RequestMonitor rm) {
+ final IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc,
+ IBreakpointsTargetDMContext.class);
+
+ fGDBCtrl.queueCommand(fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null,
+ 0, location, "0"), new DataRequestMonitor<MIBreakInsertInfo>(fGDBCtrl.getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ // Now that time has elapsed, send another command
+ fRunCtrl.executeWithTargetAvailable(fContainerDmc, new Step[] { new Step() {
+ @Override
+ public void execute(final RequestMonitor rm) {
+ fGDBCtrl.queueCommand(
+ fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true,
+ false, null, 0, location2, "0"),
+ new DataRequestMonitor<MIBreakInsertInfo>(fGDBCtrl.getExecutor(),
+ null));
+ }
+ } }, new RequestMonitor(fGDBCtrl.getExecutor(), null));
+
+ // Complete the first operation because the two are supposed to be independent
+ rm.done();
+ }
+ });
+ }
+ } };
+
+ Query<Boolean> query = new Query<Boolean>() {
@Override
protected void execute(final DataRequestMonitor<Boolean> rm) {
- fRunCtrl.executeWithTargetAvailable(fContainerDmc, steps, rm);
+ fRunCtrl.executeWithTargetAvailable(fContainerDmc, steps, rm);
}
- };
- {
- fRunCtrl.getExecutor().execute(query);
- query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
- }
-
- for (int i=0; i<2; i++) {
- // The target is currently stopped so we resume it
- ServiceEventWaitor<ISuspendedDMEvent> suspendedEventWaitor = new ServiceEventWaitor<ISuspendedDMEvent>(
- getGDBLaunch().getSession(),
- ISuspendedDMEvent.class);
-
- SyncUtil.resume();
-
- // Wait up to 3 second for the target to suspend. Should happen within 2 seconds.
- suspendedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(3000));
- }
- }
-
- /**
- * Test that the executeWhileTargetAvailale interface works properly
- * for concurrent operations with a single step when the target is running.
- * This tests verifies that we properly handle concurrent operations that are sent
- * while other operations are already being run.
- */
- @Test
- public void executeSingleStepConcurrentButDelayedOpWhileTargetRunning() throws Throwable {
- final String location = "PrintHello";
- final String location2 = "PrintHi";
- final Step[] steps = new Step[] {
- new Step() {
- @Override
- public void execute(final RequestMonitor rm) {
- final IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc, IBreakpointsTargetDMContext.class);
-
- fGDBCtrl.queueCommand(
- fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null, 0, location, "0"),
- new DataRequestMonitor<MIBreakInsertInfo> (fGDBCtrl.getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- // Now that time has elapsed, send another command
- fRunCtrl.executeWithTargetAvailable(fContainerDmc, new Step[] {
- new Step() {
- @Override
- public void execute(final RequestMonitor otherRm) {
- fGDBCtrl.queueCommand(
- fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null, 0, location2, "0"),
- new DataRequestMonitor<MIBreakInsertInfo> (fGDBCtrl.getExecutor(), otherRm));
- }}}, new RequestMonitor(fGDBCtrl.getExecutor(), null));
-
- // Complete the first operation because the two are supposed to be independent
- rm.done();
- }});
- }}
- };
-
- // The target is currently stopped so we resume it
- ServiceEventWaitor<ISuspendedDMEvent> suspendedEventWaitor = new ServiceEventWaitor<ISuspendedDMEvent>(
- getGDBLaunch().getSession(),
- ISuspendedDMEvent.class);
-
- SyncUtil.resume();
-
- Query<Boolean> query = new Query<Boolean>() {
+ };
+ {
+ fRunCtrl.getExecutor().execute(query);
+ query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ }
+
+ for (int i = 0; i < 2; i++) {
+ // The target is currently stopped so we resume it
+ ServiceEventWaitor<ISuspendedDMEvent> suspendedEventWaitor = new ServiceEventWaitor<ISuspendedDMEvent>(
+ getGDBLaunch().getSession(), ISuspendedDMEvent.class);
+
+ SyncUtil.resume();
+
+ // Wait up to 3 second for the target to suspend. Should happen within 2 seconds.
+ suspendedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(3000));
+ }
+ }
+
+ /**
+ * Test that the executeWhileTargetAvailale interface works properly
+ * for concurrent operations with a single step when the target is running.
+ * This tests verifies that we properly handle concurrent operations that are sent
+ * while other operations are already being run.
+ */
+ @Test
+ public void executeSingleStepConcurrentButDelayedOpWhileTargetRunning() throws Throwable {
+ final String location = "PrintHello";
+ final String location2 = "PrintHi";
+ final Step[] steps = new Step[] { new Step() {
+ @Override
+ public void execute(final RequestMonitor rm) {
+ final IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc,
+ IBreakpointsTargetDMContext.class);
+
+ fGDBCtrl.queueCommand(fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null,
+ 0, location, "0"), new DataRequestMonitor<MIBreakInsertInfo>(fGDBCtrl.getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ // Now that time has elapsed, send another command
+ fRunCtrl.executeWithTargetAvailable(fContainerDmc, new Step[] { new Step() {
+ @Override
+ public void execute(final RequestMonitor otherRm) {
+ fGDBCtrl.queueCommand(
+ fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true,
+ false, null, 0, location2, "0"),
+ new DataRequestMonitor<MIBreakInsertInfo>(fGDBCtrl.getExecutor(),
+ otherRm));
+ }
+ } }, new RequestMonitor(fGDBCtrl.getExecutor(), null));
+
+ // Complete the first operation because the two are supposed to be independent
+ rm.done();
+ }
+ });
+ }
+ } };
+
+ // The target is currently stopped so we resume it
+ ServiceEventWaitor<ISuspendedDMEvent> suspendedEventWaitor = new ServiceEventWaitor<ISuspendedDMEvent>(
+ getGDBLaunch().getSession(), ISuspendedDMEvent.class);
+
+ SyncUtil.resume();
+
+ Query<Boolean> query = new Query<Boolean>() {
@Override
protected void execute(final DataRequestMonitor<Boolean> rm) {
- fRunCtrl.executeWithTargetAvailable(fContainerDmc, steps, rm);
+ fRunCtrl.executeWithTargetAvailable(fContainerDmc, steps, rm);
}
- };
- {
- fRunCtrl.getExecutor().execute(query);
- query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
- }
-
- for (int i=0; i<2; i++) {
- // Wait up to 3 second for the target to suspend. Should happen within 2 seconds.
- suspendedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(3000));
-
- // Now resume the target and check that we stop at all the breakpoints.
- suspendedEventWaitor = new ServiceEventWaitor<ISuspendedDMEvent>(
- getGDBLaunch().getSession(),
- ISuspendedDMEvent.class);
-
- SyncUtil.resume();
- }
- }
-
- /**
- * Test that the executeWhileTargetAvailale interface works properly
- * for concurrent operations with a single step when the target is stopped.
- * This tests verifies that we properly handle concurrent operations that are
- * dependent on each other; this means that the second operation needs to complete
- * for the second one to complete.
- */
- @Test
- public void executeSingleStepConcurrentAndDependentOpWhileTargetStopped() throws Throwable {
- // The target is currently stopped.
-
- final String location = "PrintHello";
- final String location2 = "PrintHi";
- final Step[] steps = new Step[] {
- new Step() {
- @Override
- public void execute(final RequestMonitor rm) {
- final IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc, IBreakpointsTargetDMContext.class);
-
- fGDBCtrl.queueCommand(
- fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null, 0, location, "0"),
- new DataRequestMonitor<MIBreakInsertInfo> (fGDBCtrl.getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- // Send another such operation and wait for it to complete to mark the original one as completed
- fRunCtrl.executeWithTargetAvailable(fContainerDmc, new Step[] {
- new Step() {
- @Override
- public void execute(final RequestMonitor otherRm) {
- fGDBCtrl.queueCommand(
- fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null, 0, location2, "0"),
- new DataRequestMonitor<MIBreakInsertInfo> (fGDBCtrl.getExecutor(), otherRm));
- }}}, rm);
- }});
- }}
- };
-
- Query<Boolean> query = new Query<Boolean>() {
+ };
+ {
+ fRunCtrl.getExecutor().execute(query);
+ query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ }
+
+ for (int i = 0; i < 2; i++) {
+ // Wait up to 3 second for the target to suspend. Should happen within 2 seconds.
+ suspendedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(3000));
+
+ // Now resume the target and check that we stop at all the breakpoints.
+ suspendedEventWaitor = new ServiceEventWaitor<ISuspendedDMEvent>(getGDBLaunch().getSession(),
+ ISuspendedDMEvent.class);
+
+ SyncUtil.resume();
+ }
+ }
+
+ /**
+ * Test that the executeWhileTargetAvailale interface works properly
+ * for concurrent operations with a single step when the target is stopped.
+ * This tests verifies that we properly handle concurrent operations that are
+ * dependent on each other; this means that the second operation needs to complete
+ * for the second one to complete.
+ */
+ @Test
+ public void executeSingleStepConcurrentAndDependentOpWhileTargetStopped() throws Throwable {
+ // The target is currently stopped.
+
+ final String location = "PrintHello";
+ final String location2 = "PrintHi";
+ final Step[] steps = new Step[] { new Step() {
+ @Override
+ public void execute(final RequestMonitor rm) {
+ final IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc,
+ IBreakpointsTargetDMContext.class);
+
+ fGDBCtrl.queueCommand(fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null,
+ 0, location, "0"), new DataRequestMonitor<MIBreakInsertInfo>(fGDBCtrl.getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ // Send another such operation and wait for it to complete to mark the original one as completed
+ fRunCtrl.executeWithTargetAvailable(fContainerDmc, new Step[] { new Step() {
+ @Override
+ public void execute(final RequestMonitor otherRm) {
+ fGDBCtrl.queueCommand(
+ fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true,
+ false, null, 0, location2, "0"),
+ new DataRequestMonitor<MIBreakInsertInfo>(fGDBCtrl.getExecutor(),
+ otherRm));
+ }
+ } }, rm);
+ }
+ });
+ }
+ } };
+
+ Query<Boolean> query = new Query<Boolean>() {
@Override
protected void execute(final DataRequestMonitor<Boolean> rm) {
- fRunCtrl.executeWithTargetAvailable(fContainerDmc, steps, rm);
+ fRunCtrl.executeWithTargetAvailable(fContainerDmc, steps, rm);
+ }
+ };
+ {
+ fRunCtrl.getExecutor().execute(query);
+ query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ }
+
+ for (int i = 0; i < 2; i++) {
+ // The target is currently stopped so we resume it
+ ServiceEventWaitor<ISuspendedDMEvent> suspendedEventWaitor = new ServiceEventWaitor<ISuspendedDMEvent>(
+ getGDBLaunch().getSession(), ISuspendedDMEvent.class);
+
+ SyncUtil.resume();
+
+ // Wait up to 3 second for the target to suspend. Should happen within 2 seconds.
+ suspendedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(3000));
+ }
+ }
+
+ /**
+ * Test that the executeWhileTargetAvailale interface works properly
+ * for concurrent operations with a single step when the target is running.
+ * This tests verifies that we properly handle concurrent operations that are
+ * dependent on each other; this means that the second operation needs to complete
+ * for the second one to complete.
+ */
+ @Test
+ public void executeSingleStepConcurrentAndDependentOpWhileTargetRunning() throws Throwable {
+ final String location = "PrintHello";
+ final String location2 = "PrintHi";
+ final Step[] steps = new Step[] { new Step() {
+ @Override
+ public void execute(final RequestMonitor rm) {
+ final IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc,
+ IBreakpointsTargetDMContext.class);
+
+ fGDBCtrl.queueCommand(fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null,
+ 0, location, "0"), new DataRequestMonitor<MIBreakInsertInfo>(fGDBCtrl.getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ // Send another such operation and wait for it to complete to mark the original one as completed
+ fRunCtrl.executeWithTargetAvailable(fContainerDmc, new Step[] { new Step() {
+ @Override
+ public void execute(final RequestMonitor otherRm) {
+ fGDBCtrl.queueCommand(
+ fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true,
+ false, null, 0, location2, "0"),
+ new DataRequestMonitor<MIBreakInsertInfo>(fGDBCtrl.getExecutor(),
+ otherRm));
+ }
+ } }, rm);
+ }
+ });
}
- };
- {
- fRunCtrl.getExecutor().execute(query);
- query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
- }
-
- for (int i=0; i<2; i++) {
- // The target is currently stopped so we resume it
- ServiceEventWaitor<ISuspendedDMEvent> suspendedEventWaitor = new ServiceEventWaitor<ISuspendedDMEvent>(
- getGDBLaunch().getSession(),
- ISuspendedDMEvent.class);
-
- SyncUtil.resume();
-
- // Wait up to 3 second for the target to suspend. Should happen within 2 seconds.
- suspendedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(3000));
- }
- }
-
- /**
- * Test that the executeWhileTargetAvailale interface works properly
- * for concurrent operations with a single step when the target is running.
- * This tests verifies that we properly handle concurrent operations that are
- * dependent on each other; this means that the second operation needs to complete
- * for the second one to complete.
- */
- @Test
- public void executeSingleStepConcurrentAndDependentOpWhileTargetRunning() throws Throwable {
- final String location = "PrintHello";
- final String location2 = "PrintHi";
- final Step[] steps = new Step[] {
- new Step() {
- @Override
- public void execute(final RequestMonitor rm) {
- final IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc, IBreakpointsTargetDMContext.class);
-
- fGDBCtrl.queueCommand(
- fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null, 0, location, "0"),
- new DataRequestMonitor<MIBreakInsertInfo> (fGDBCtrl.getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- // Send another such operation and wait for it to complete to mark the original one as completed
- fRunCtrl.executeWithTargetAvailable(fContainerDmc, new Step[] {
- new Step() {
- @Override
- public void execute(final RequestMonitor otherRm) {
- fGDBCtrl.queueCommand(
- fGDBCtrl.getCommandFactory().createMIBreakInsert(bpTargetDmc, true, false, null, 0, location2, "0"),
- new DataRequestMonitor<MIBreakInsertInfo> (fGDBCtrl.getExecutor(), otherRm));
- }}}, rm);
- }});
- }}
- };
-
- // The target is currently stopped so we resume it
- ServiceEventWaitor<ISuspendedDMEvent> suspendedEventWaitor = new ServiceEventWaitor<ISuspendedDMEvent>(
- getGDBLaunch().getSession(),
- ISuspendedDMEvent.class);
-
- SyncUtil.resume();
-
- Query<Boolean> query = new Query<Boolean>() {
+ } };
+
+ // The target is currently stopped so we resume it
+ ServiceEventWaitor<ISuspendedDMEvent> suspendedEventWaitor = new ServiceEventWaitor<ISuspendedDMEvent>(
+ getGDBLaunch().getSession(), ISuspendedDMEvent.class);
+
+ SyncUtil.resume();
+
+ Query<Boolean> query = new Query<Boolean>() {
@Override
protected void execute(final DataRequestMonitor<Boolean> rm) {
- fRunCtrl.executeWithTargetAvailable(fContainerDmc, steps, rm);
+ fRunCtrl.executeWithTargetAvailable(fContainerDmc, steps, rm);
}
- };
- {
- fRunCtrl.getExecutor().execute(query);
- query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
- }
-
- for (int i=0; i<2; i++) {
- // Wait up to 3 second for the target to suspend. Should happen within 2 seconds.
- suspendedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(3000));
-
- // Now resume the target and check that we stop at all the breakpoints.
- suspendedEventWaitor = new ServiceEventWaitor<ISuspendedDMEvent>(
- getGDBLaunch().getSession(),
- ISuspendedDMEvent.class);
-
- SyncUtil.resume();
- }
- }
+ };
+ {
+ fRunCtrl.getExecutor().execute(query);
+ query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ }
+
+ for (int i = 0; i < 2; i++) {
+ // Wait up to 3 second for the target to suspend. Should happen within 2 seconds.
+ suspendedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(3000));
+
+ // Now resume the target and check that we stop at all the breakpoints.
+ suspendedEventWaitor = new ServiceEventWaitor<ISuspendedDMEvent>(getGDBLaunch().getSession(),
+ ISuspendedDMEvent.class);
+
+ SyncUtil.resume();
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTest.java
index a1744bfea18..f14babb9ccf 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTest.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson AB - Initial implementation of Test cases
* Simon Marchi (Ericsson) - Add and use runningOnWindows().
@@ -16,7 +16,6 @@
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.tests;
-
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@@ -66,9 +65,8 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
-
/**
- * Tests MIRunControl class for Multi-threaded application.
+ * Tests MIRunControl class for Multi-threaded application.
*/
@RunWith(Parameterized.class)
public class MIRunControlTest extends BaseParametrizedTestCase {
@@ -80,20 +78,19 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
* examine the test program and set this flag to true if it uses the cygwin
* dll.
*/
- private static boolean sProgramIsCygwin;
+ private static boolean sProgramIsCygwin;
- private DsfServicesTracker fServicesTracker;
+ private DsfServicesTracker fServicesTracker;
- private IGDBControl fGDBCtrl;
+ private IGDBControl fGDBCtrl;
private IMIRunControl fRunCtrl;
- private IGDBBackend fBackEnd;
+ private IGDBBackend fBackEnd;
private IContainerDMContext fContainerDmc;
private IExecutionDMContext fThreadExecDmc;
// Breakpoint tags in MultiThread.cc
- public static final String[] LINE_TAGS = new String[] {
- "LINE_MAIN_BEFORE_THREAD_START", // Just before StartThread
+ public static final String[] LINE_TAGS = new String[] { "LINE_MAIN_BEFORE_THREAD_START", // Just before StartThread
"LINE_MAIN_AFTER_THREAD_START", // Just after StartThread
"LINE_MAIN_ALL_THREADS_STARTED", // Where all threads are guaranteed to be started.
};
@@ -111,61 +108,59 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
resolveLineTagLocations(SOURCE_NAME, LINE_TAGS);
final DsfSession session = getGDBLaunch().getSession();
-
- Runnable runnable = new Runnable() {
- @Override
+
+ Runnable runnable = new Runnable() {
+ @Override
public void run() {
- fServicesTracker =
- new DsfServicesTracker(TestsPlugin.getBundleContext(),
- session.getId());
- fGDBCtrl = fServicesTracker.getService(IGDBControl.class);
-
- IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
- IProcessDMContext procDmc = procService.createProcessContext(fGDBCtrl.getContext(), MIProcesses.UNIQUE_GROUP_ID);
- fContainerDmc = procService.createContainerContext(procDmc, MIProcesses.UNIQUE_GROUP_ID);
- IThreadDMContext threadDmc = procService.createThreadContext(procDmc, "1");
- fThreadExecDmc = procService.createExecutionContext(fContainerDmc, threadDmc, "1");
-
- fRunCtrl = fServicesTracker.getService(IMIRunControl.class);
- fBackEnd = fServicesTracker.getService(IGDBBackend.class);
- }
- };
- session.getExecutor().submit(runnable).get();
+ fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), session.getId());
+ fGDBCtrl = fServicesTracker.getService(IGDBControl.class);
+
+ IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
+ IProcessDMContext procDmc = procService.createProcessContext(fGDBCtrl.getContext(),
+ MIProcesses.UNIQUE_GROUP_ID);
+ fContainerDmc = procService.createContainerContext(procDmc, MIProcesses.UNIQUE_GROUP_ID);
+ IThreadDMContext threadDmc = procService.createThreadContext(procDmc, "1");
+ fThreadExecDmc = procService.createExecutionContext(fContainerDmc, threadDmc, "1");
+
+ fRunCtrl = fServicesTracker.getService(IMIRunControl.class);
+ fBackEnd = fServicesTracker.getService(IGDBBackend.class);
+ }
+ };
+ session.getExecutor().submit(runnable).get();
}
-
@Override
public void doAfterTest() throws Exception {
super.doAfterTest();
-
- if (fServicesTracker!=null) fServicesTracker.dispose();
+
+ if (fServicesTracker != null)
+ fServicesTracker.dispose();
}
-
+
@Override
protected void setLaunchAttributes() {
super.setLaunchAttributes();
-
- setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME,
- EXEC_PATH + EXEC_NAME);
+
+ setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EXEC_PATH + EXEC_NAME);
// This is crude, but effective. We need to determine if the program was
// built with cygwin. The easiest way is to scan the binary file looking
// for 'cygwin1.dll'. In the real world, this wouldn't cut mustard, but
// since this is just testing code, and we control the programs, it's a
// no brainer.
- if (runningOnWindows()) {
+ if (runningOnWindows()) {
- // This is interesting. Our tests rely on the working directory.
+ // This is interesting. Our tests rely on the working directory.
// That is, we specify a program path in the launch configuration
// that is relative to the working directory.
File file = new File(EXEC_PATH + EXEC_NAME);
-
+
FileInputStream fis = null;
try {
fis = new FileInputStream(file);
} catch (FileNotFoundException e) {
Assert.fail(e.getLocalizedMessage());
- return; // needed to avoid warning at fis usage below
+ return; // needed to avoid warning at fis usage below
}
final String MATCH = "cygwin1.dll";
@@ -176,213 +171,211 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
try {
ch = fis.read();
} catch (IOException e) {
- Assert.fail("Problem inspecting file to see if it's a cygwin executable : " + e.getLocalizedMessage());
+ Assert.fail(
+ "Problem inspecting file to see if it's a cygwin executable : " + e.getLocalizedMessage());
}
- if (ch == -1) { // EOF
+ if (ch == -1) { // EOF
break;
}
if (ch == MATCH.charAt(i)) {
if (i == MATCH_LEN - 1) {
sProgramIsCygwin = true;
- break; // found it!
+ break; // found it!
}
i++;
- }
- else {
+ } else {
i = 0;
}
}
- if (fis !=null) {
+ if (fis != null) {
try {
fis.close();
} catch (IOException e) {
}
}
- }
+ }
}
-
+
/*
- * For Multi-threaded application - In case of one thread, Thread id should start with 1.
+ * For Multi-threaded application - In case of one thread, Thread id should start with 1.
*/
@Test
public void getExecutionContext() throws InterruptedException, ExecutionException, TimeoutException {
- final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
+ final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
/*
- * Create a request monitor
+ * Create a request monitor
+ */
+ final DataRequestMonitor<IExecutionDMContext[]> rm = new DataRequestMonitor<IExecutionDMContext[]>(
+ fRunCtrl.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (isSuccess()) {
+ wait.setReturnInfo(getData());
+ }
+ wait.waitFinished(getStatus());
+ }
+ };
+
+ final IContainerDMContext containerDmc = SyncUtil.getContainerContext();
+
+ /*
+ * Test getExecutionContexts() when only one thread exist.
*/
- final DataRequestMonitor<IExecutionDMContext[]> rm =
- new DataRequestMonitor<IExecutionDMContext[]>(fRunCtrl.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (isSuccess()) {
- wait.setReturnInfo(getData());
- }
- wait.waitFinished(getStatus());
- }
- };
-
- final IContainerDMContext containerDmc = SyncUtil.getContainerContext();
-
- /*
- * Test getExecutionContexts() when only one thread exist.
- */
- fRunCtrl.getExecutor().submit(new Runnable() {
- @Override
+ fRunCtrl.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- fRunCtrl.getExecutionContexts(containerDmc, rm);
- }
- });
- wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
- Assert.assertTrue(wait.getMessage(), wait.isOK());
+ fRunCtrl.getExecutionContexts(containerDmc, rm);
+ }
+ });
+ wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
+ Assert.assertTrue(wait.getMessage(), wait.isOK());
- /*
- * Get data from the Request Monitor
- */
- IExecutionDMContext[] ctxts = (IExecutionDMContext[])wait.getReturnInfo();
+ /*
+ * Get data from the Request Monitor
+ */
+ IExecutionDMContext[] ctxts = (IExecutionDMContext[]) wait.getReturnInfo();
// Context can not be null
Assert.assertNotNull(ctxts);
- Assert.assertEquals("Unexpected number of threads for a simple program", sProgramIsCygwin ? 2 : 1, ctxts.length);
+ Assert.assertEquals("Unexpected number of threads for a simple program", sProgramIsCygwin ? 2 : 1,
+ ctxts.length);
+ // The ordering of the contexts is not deterministic
+ LinkedList<Integer> ids = new LinkedList<Integer>(Arrays.asList(new Integer[] { 1 }));
+ if (sProgramIsCygwin) {
+ ids.add(2);
+ }
- // The ordering of the contexts is not deterministic
- LinkedList<Integer> ids = new LinkedList<Integer>(Arrays.asList(new Integer[] {1}));
- if (sProgramIsCygwin) {
- ids.add(2);
- }
+ // Note that List.remove(int) and List.remove(Integer) have different effects so this should stay remove(Integer)
+ assertTrue(ids.remove(Integer.valueOf(((IMIExecutionDMContext) ctxts[0]).getThreadId())));
+ if (sProgramIsCygwin) {
+ assertTrue(ids.remove(Integer.valueOf(((IMIExecutionDMContext) ctxts[1]).getThreadId())));
+ }
- // Note that List.remove(int) and List.remove(Integer) have different effects so this should stay remove(Integer)
- assertTrue(ids.remove(Integer.valueOf(((IMIExecutionDMContext)ctxts[0]).getThreadId())));
- if (sProgramIsCygwin) {
- assertTrue(ids.remove(Integer.valueOf(((IMIExecutionDMContext)ctxts[1]).getThreadId())));
- }
-
wait.waitReset();
}
-
-
+
/*
* Get Execution DMCs for a valid container DMC
* Testing for two execution DMC with id 1 & 2
*/
@Test
public void getExecutionContexts() throws Throwable {
- final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
+ final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
+ /*
+ * Create a request monitor
+ */
+ final DataRequestMonitor<IExecutionDMContext[]> rmExecutionCtxts = new DataRequestMonitor<IExecutionDMContext[]>(
+ fRunCtrl.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (isSuccess()) {
+ wait.setReturnInfo(getData());
+ }
+ wait.waitFinished(getStatus());
+ }
+ };
+
+ // Prepare a waiter to make sure we have received the thread started event
+ final ServiceEventWaitor<IStartedDMEvent> startedEventWaitor = new ServiceEventWaitor<IStartedDMEvent>(
+ getGDBLaunch().getSession(), IStartedDMEvent.class);
+
+ SyncUtil.runToLocation(SOURCE_NAME + ':' + getLineForTag("LINE_MAIN_AFTER_THREAD_START"));
+
+ final IContainerDMContext containerDmc = SyncUtil.getContainerContext();
+
/*
- * Create a request monitor
+ * Test getExecutionContexts for a valid container DMC
*/
- final DataRequestMonitor<IExecutionDMContext[]> rmExecutionCtxts =
- new DataRequestMonitor<IExecutionDMContext[]>(fRunCtrl.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (isSuccess()) {
- wait.setReturnInfo(getData());
- }
- wait.waitFinished(getStatus());
- }
- };
-
- // Prepare a waiter to make sure we have received the thread started event
- final ServiceEventWaitor<IStartedDMEvent> startedEventWaitor =
- new ServiceEventWaitor<IStartedDMEvent>(
- getGDBLaunch().getSession(),
- IStartedDMEvent.class);
-
- SyncUtil.runToLocation(SOURCE_NAME + ':'
- + getLineForTag("LINE_MAIN_AFTER_THREAD_START"));
-
- final IContainerDMContext containerDmc = SyncUtil.getContainerContext();
-
- /*
- * Test getExecutionContexts for a valid container DMC
- */
- fRunCtrl.getExecutor().submit(new Runnable() {
- @Override
+ fRunCtrl.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- fRunCtrl.getExecutionContexts(containerDmc, rmExecutionCtxts);
- }
- });
- wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
- Assert.assertTrue(wait.getMessage(), wait.isOK());
- wait.waitReset();
-
+ fRunCtrl.getExecutionContexts(containerDmc, rmExecutionCtxts);
+ }
+ });
+ wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
+ Assert.assertTrue(wait.getMessage(), wait.isOK());
+ wait.waitReset();
+
// Make sure thread started event was received
- // We check this _after_ we ask for the execution contexts because when running remote (i.e., with gdbserver),
- // thread events are not sent by gdb until a request for a thread list is given (Bug 455992)
- IStartedDMEvent startedEvent = startedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(1000));
- Assert.assertEquals("Thread created event is for wrong thread id", sProgramIsCygwin ? "3" : "2", ((IMIExecutionDMContext)startedEvent.getDMContext()).getThreadId());
-
- /*
- * Get data
- */
- IExecutionDMContext[] data = rmExecutionCtxts.getData();
- /*
- * Contexts returned can not be null
- */
- Assert.assertNotNull(data);
-
- Assert.assertEquals("Unexpected number of threads", sProgramIsCygwin ? 3 : 2, data.length);
-
- // The ordering of the contexts is not deterministic
- LinkedList<Integer> ids = new LinkedList<Integer>(Arrays.asList(new Integer[] {1,2}));
- if (sProgramIsCygwin) {
- ids.add(3);
- }
-
- assertTrue(ids.remove(Integer.valueOf(((IMIExecutionDMContext)data[0]).getThreadId())));
- assertTrue(ids.remove(Integer.valueOf(((IMIExecutionDMContext)data[1]).getThreadId())));
- if (sProgramIsCygwin) {
- assertTrue(ids.remove(Integer.valueOf(((IMIExecutionDMContext)data[2]).getThreadId())));
- }
- }
+ // We check this _after_ we ask for the execution contexts because when running remote (i.e., with gdbserver),
+ // thread events are not sent by gdb until a request for a thread list is given (Bug 455992)
+ IStartedDMEvent startedEvent = startedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(1000));
+ Assert.assertEquals("Thread created event is for wrong thread id", sProgramIsCygwin ? "3" : "2",
+ ((IMIExecutionDMContext) startedEvent.getDMContext()).getThreadId());
+
+ /*
+ * Get data
+ */
+ IExecutionDMContext[] data = rmExecutionCtxts.getData();
+ /*
+ * Contexts returned can not be null
+ */
+ Assert.assertNotNull(data);
+
+ Assert.assertEquals("Unexpected number of threads", sProgramIsCygwin ? 3 : 2, data.length);
+
+ // The ordering of the contexts is not deterministic
+ LinkedList<Integer> ids = new LinkedList<Integer>(Arrays.asList(new Integer[] { 1, 2 }));
+ if (sProgramIsCygwin) {
+ ids.add(3);
+ }
+
+ assertTrue(ids.remove(Integer.valueOf(((IMIExecutionDMContext) data[0]).getThreadId())));
+ assertTrue(ids.remove(Integer.valueOf(((IMIExecutionDMContext) data[1]).getThreadId())));
+ if (sProgramIsCygwin) {
+ assertTrue(ids.remove(Integer.valueOf(((IMIExecutionDMContext) data[2]).getThreadId())));
+ }
+ }
/*
* Testing getModelData() for ExecutionDMC
*/
@Test
public void getModelDataForThread() throws InterruptedException, ExecutionException, TimeoutException {
- final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
+ final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
/*
* Create a request monitor
*/
- final DataRequestMonitor<IExecutionDMData> rm =
- new DataRequestMonitor<IExecutionDMData>(fRunCtrl.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (isSuccess()) {
- wait.setReturnInfo(getData());
- }
- wait.waitFinished(getStatus());
- }
- };
-
- final IContainerDMContext containerDmc = SyncUtil.getContainerContext();
-
- /*
- * Call getModelData for Execution DMC
- */
- fRunCtrl.getExecutor().submit(new Runnable() {
- @Override
+ final DataRequestMonitor<IExecutionDMData> rm = new DataRequestMonitor<IExecutionDMData>(fRunCtrl.getExecutor(),
+ null) {
+ @Override
+ protected void handleCompleted() {
+ if (isSuccess()) {
+ wait.setReturnInfo(getData());
+ }
+ wait.waitFinished(getStatus());
+ }
+ };
+
+ final IContainerDMContext containerDmc = SyncUtil.getContainerContext();
+
+ /*
+ * Call getModelData for Execution DMC
+ */
+ fRunCtrl.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- fRunCtrl.getExecutionData(((MIRunControl)fRunCtrl).createMIExecutionContext(containerDmc, "1"), rm);
- }
- });
- wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
- Assert.assertTrue(wait.getMessage(), wait.isOK());
-
- IRunControl.IExecutionDMData data = rm.getData();
- if(data == null)
- Assert.fail("No data returned.");
- else{
- /*
- * getModelData should return StateChangeReason.
- */
- Assert.assertEquals("Unexpected state change reason.", StateChangeReason.BREAKPOINT, data.getStateChangeReason());
- }
+ fRunCtrl.getExecutionData(((MIRunControl) fRunCtrl).createMIExecutionContext(containerDmc, "1"), rm);
+ }
+ });
+ wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
+ Assert.assertTrue(wait.getMessage(), wait.isOK());
+
+ IRunControl.IExecutionDMData data = rm.getData();
+ if (data == null)
+ Assert.fail("No data returned.");
+ else {
+ /*
+ * getModelData should return StateChangeReason.
+ */
+ Assert.assertEquals("Unexpected state change reason.", StateChangeReason.BREAKPOINT,
+ data.getStateChangeReason());
+ }
}
-
+
/**
- * Allows subclasses to override the expected reason for the stop on main.
+ * Allows subclasses to override the expected reason for the stop on main.
* @return
*/
protected StateChangeReason getExpectedMainThreadStopReason() {
@@ -391,180 +384,179 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
@Test
public void getModelDataForThreadWhenStep() throws Throwable {
- final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
+ final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
/*
* Run till step returns
*/
- final MIStoppedEvent stoppedEvent = SyncUtil.step(StepType.STEP_OVER);
-
- final DataRequestMonitor<IExecutionDMData> rm =
- new DataRequestMonitor<IExecutionDMData>(fRunCtrl.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (isSuccess()) {
- wait.setReturnInfo(getData());
- }
- wait.waitFinished(getStatus());
- }
- };
- /*
- * getModelData for Execution DMC
- */
- fRunCtrl.getExecutor().submit(new Runnable() {
- @Override
+ final MIStoppedEvent stoppedEvent = SyncUtil.step(StepType.STEP_OVER);
+
+ final DataRequestMonitor<IExecutionDMData> rm = new DataRequestMonitor<IExecutionDMData>(fRunCtrl.getExecutor(),
+ null) {
+ @Override
+ protected void handleCompleted() {
+ if (isSuccess()) {
+ wait.setReturnInfo(getData());
+ }
+ wait.waitFinished(getStatus());
+ }
+ };
+ /*
+ * getModelData for Execution DMC
+ */
+ fRunCtrl.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- fRunCtrl.getExecutionData(stoppedEvent.getDMContext(), rm);
- }
- });
- wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
- Assert.assertTrue(wait.getMessage(), wait.isOK());
-
- IRunControl.IExecutionDMData data = rm.getData();
- if(data == null)
- Assert.fail("No data Returned.");
- else{
- /*
- * getModelData for Execution DMC in case Step has been performed.
- */
- Assert.assertTrue("getModelData for ExecutionDMC in case of step should be STEP." ,
- StateChangeReason.STEP == data.getStateChangeReason());
- }
+ fRunCtrl.getExecutionData(stoppedEvent.getDMContext(), rm);
+ }
+ });
+ wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
+ Assert.assertTrue(wait.getMessage(), wait.isOK());
+
+ IRunControl.IExecutionDMData data = rm.getData();
+ if (data == null)
+ Assert.fail("No data Returned.");
+ else {
+ /*
+ * getModelData for Execution DMC in case Step has been performed.
+ */
+ Assert.assertTrue("getModelData for ExecutionDMC in case of step should be STEP.",
+ StateChangeReason.STEP == data.getStateChangeReason());
+ }
}
-
+
/*
* getModelData() for ExecutionDMC when a breakpoint is hit
*/
@Test
public void getModelDataForThreadWhenBreakpoint() throws Throwable {
- final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
- /*
+ final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
+ /*
* Add a breakpoint
*/
- SyncUtil.addBreakpoint(SOURCE_NAME + ":"
- + getLineForTag("LINE_MAIN_BEFORE_THREAD_START"), false);
-
+ SyncUtil.addBreakpoint(SOURCE_NAME + ":" + getLineForTag("LINE_MAIN_BEFORE_THREAD_START"), false);
+
/*
* Resume till the breakpoint is hit
*/
final MIStoppedEvent stoppedEvent = SyncUtil.resumeUntilStopped();
-
- final DataRequestMonitor<IExecutionDMData> rm =
- new DataRequestMonitor<IExecutionDMData>(fRunCtrl.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (isSuccess()) {
- wait.setReturnInfo(getData());
- }
- wait.waitFinished(getStatus());
- }
- };
- fRunCtrl.getExecutor().submit(new Runnable() {
- @Override
+
+ final DataRequestMonitor<IExecutionDMData> rm = new DataRequestMonitor<IExecutionDMData>(fRunCtrl.getExecutor(),
+ null) {
+ @Override
+ protected void handleCompleted() {
+ if (isSuccess()) {
+ wait.setReturnInfo(getData());
+ }
+ wait.waitFinished(getStatus());
+ }
+ };
+ fRunCtrl.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- fRunCtrl.getExecutionData(stoppedEvent.getDMContext(), rm);
- }
- });
- wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
- Assert.assertTrue(wait.getMessage(), wait.isOK());
-
- IRunControl.IExecutionDMData data = rm.getData();
- if(data == null)
- Assert.fail("No data Returned.");
- else{
- /*
- * getModelData for ExecutionDMC in case a breakpoint is hit
- */
- Assert.assertTrue("getModelData for an Execution DMC when a breakpoint is hit is not BREAKPOINT and is " + data.getStateChangeReason(),
- StateChangeReason.BREAKPOINT == data.getStateChangeReason());
- }
+ fRunCtrl.getExecutionData(stoppedEvent.getDMContext(), rm);
+ }
+ });
+ wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
+ Assert.assertTrue(wait.getMessage(), wait.isOK());
+
+ IRunControl.IExecutionDMData data = rm.getData();
+ if (data == null)
+ Assert.fail("No data Returned.");
+ else {
+ /*
+ * getModelData for ExecutionDMC in case a breakpoint is hit
+ */
+ Assert.assertTrue("getModelData for an Execution DMC when a breakpoint is hit is not BREAKPOINT and is "
+ + data.getStateChangeReason(), StateChangeReason.BREAKPOINT == data.getStateChangeReason());
+ }
}
-
+
/*
* getModelData() for Container DMC
*/
@Test
public void getModelDataForContainer() throws Throwable {
- final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
- /*
+ final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
+ /*
* Add a breakpoint
*/
- SyncUtil.addBreakpoint(SOURCE_NAME + ":21", false);
+ SyncUtil.addBreakpoint(SOURCE_NAME + ":21", false);
/*
* Resume till the breakpoint is hit
*/
SyncUtil.resumeUntilStopped();
- final DataRequestMonitor<IExecutionDMData> rm =
- new DataRequestMonitor<IExecutionDMData>(fRunCtrl.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (isSuccess()) {
- wait.setReturnInfo(getData());
- }
- wait.waitFinished(getStatus());
- }
- };
-
- fRunCtrl.getExecutor().submit(new Runnable() {
- @Override
+ final DataRequestMonitor<IExecutionDMData> rm = new DataRequestMonitor<IExecutionDMData>(fRunCtrl.getExecutor(),
+ null) {
+ @Override
+ protected void handleCompleted() {
+ if (isSuccess()) {
+ wait.setReturnInfo(getData());
+ }
+ wait.waitFinished(getStatus());
+ }
+ };
+
+ fRunCtrl.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- fRunCtrl.getExecutionData(fContainerDmc, rm);
- }
- });
- wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
- Assert.assertTrue(wait.getMessage(), wait.isOK());
-
- IRunControl.IExecutionDMData data = rm.getData();
- if(data == null)
- Assert.fail("No data returned.");
- else{
- Assert.assertTrue(" State change reason for a normal execution should be BREAKPOINT instead of " + data.getStateChangeReason(),
- StateChangeReason.BREAKPOINT == data.getStateChangeReason());
- }
+ fRunCtrl.getExecutionData(fContainerDmc, rm);
+ }
+ });
+ wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
+ Assert.assertTrue(wait.getMessage(), wait.isOK());
+
+ IRunControl.IExecutionDMData data = rm.getData();
+ if (data == null)
+ Assert.fail("No data returned.");
+ else {
+ Assert.assertTrue(" State change reason for a normal execution should be BREAKPOINT instead of "
+ + data.getStateChangeReason(), StateChangeReason.BREAKPOINT == data.getStateChangeReason());
+ }
}
-
+
/*
- * getExecutionContexts for an invalid container DMC
+ * getExecutionContexts for an invalid container DMC
*/
@Ignore
@Test
- public void getExecutionContextsForInvalidContainerDMC() throws InterruptedException{
- final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
-
- final DataRequestMonitor<IExecutionDMContext[]> rm =
- new DataRequestMonitor<IExecutionDMContext[]>(fRunCtrl.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (isSuccess()) {
- wait.setReturnInfo(getData());
- }
- wait.waitFinished(getStatus());
- }
- };
-// final IContainerDMContext ctxt = new GDBControlDMContext("-1", getClass().getName() + ":" + 1);
- fRunCtrl.getExecutor().submit(new Runnable() {
- @Override
+ public void getExecutionContextsForInvalidContainerDMC() throws InterruptedException {
+ final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
+
+ final DataRequestMonitor<IExecutionDMContext[]> rm = new DataRequestMonitor<IExecutionDMContext[]>(
+ fRunCtrl.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (isSuccess()) {
+ wait.setReturnInfo(getData());
+ }
+ wait.waitFinished(getStatus());
+ }
+ };
+ // final IContainerDMContext ctxt = new GDBControlDMContext("-1", getClass().getName() + ":" + 1);
+ fRunCtrl.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- // Pass an invalid dmc
- fRunCtrl.getExecutionContexts(fContainerDmc, rm);
- }
- });
- wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
- Assert.assertTrue(wait.getMessage(), !wait.isOK());
-
- IStatus status = rm.getStatus();
- Assert.assertEquals("Error message for invalid container", IStatus.ERROR, status.getSeverity());
+ // Pass an invalid dmc
+ fRunCtrl.getExecutionContexts(fContainerDmc, rm);
+ }
+ });
+ wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
+ Assert.assertTrue(wait.getMessage(), !wait.isOK());
+
+ IStatus status = rm.getStatus();
+ Assert.assertEquals("Error message for invalid container", IStatus.ERROR, status.getSeverity());
}
- /*
- * Cache after ContainerSuspendEvent should be re-set
- */
- @Test
- public void cacheAfterContainerSuspendEvent() throws InterruptedException{
- /*
- * Step to fire ContainerSuspendEvent
- */
- try {
+ /*
+ * Cache after ContainerSuspendEvent should be re-set
+ */
+ @Test
+ public void cacheAfterContainerSuspendEvent() throws InterruptedException {
+ /*
+ * Step to fire ContainerSuspendEvent
+ */
+ try {
SyncUtil.step(StepType.STEP_OVER);
} catch (Throwable e) {
Assert.fail("Exception in SyncUtil.SyncStep: " + e.getMessage());
@@ -574,38 +566,34 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
*/
//TODO TRy going to back end and fetching values instead
//Assert.assertEquals(fRunCtrl.getCache().getCachedContext().size(), 0);
- }
-
-
- //Also test Cache after ContainerResumeEvent
- @Test
- public void resume() throws InterruptedException, ExecutionException, TimeoutException {
- final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
-
- final DataRequestMonitor<MIInfo> rm =
- new DataRequestMonitor<MIInfo>(fRunCtrl.getExecutor(), null) {
- @Override
+ }
+
+ //Also test Cache after ContainerResumeEvent
+ @Test
+ public void resume() throws InterruptedException, ExecutionException, TimeoutException {
+ final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
+
+ final DataRequestMonitor<MIInfo> rm = new DataRequestMonitor<MIInfo>(fRunCtrl.getExecutor(), null) {
+ @Override
protected void handleCompleted() {
- wait.waitFinished(getStatus());
- //TestsPlugin.debug("handleCompleted over");
- }
- };
- final ServiceEventWaitor<IResumedDMEvent> eventWaitor =
- new ServiceEventWaitor<IResumedDMEvent>(
- getGDBLaunch().getSession(),
- IResumedDMEvent.class);
-
- final IContainerDMContext containerDmc = SyncUtil.getContainerContext();
-
- fRunCtrl.getExecutor().submit(new Runnable() {
- @Override
+ wait.waitFinished(getStatus());
+ //TestsPlugin.debug("handleCompleted over");
+ }
+ };
+ final ServiceEventWaitor<IResumedDMEvent> eventWaitor = new ServiceEventWaitor<IResumedDMEvent>(
+ getGDBLaunch().getSession(), IResumedDMEvent.class);
+
+ final IContainerDMContext containerDmc = SyncUtil.getContainerContext();
+
+ fRunCtrl.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- fRunCtrl.resume(containerDmc, rm);
- }
- });
- wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
+ fRunCtrl.resume(containerDmc, rm);
+ }
+ });
+ wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
- try {
+ try {
eventWaitor.waitForEvent(TestsPlugin.massageTimeout(5000));
} catch (Exception e) {
Assert.fail("Exception raised:: " + e.getMessage());
@@ -613,9 +601,9 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
return;
}
Assert.assertTrue(wait.getMessage(), wait.isOK());
-
+
wait.waitReset();
-
+
fRunCtrl.getExecutor().submit(new Runnable() {
@Override
public void run() {
@@ -624,39 +612,36 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
}
});
- wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
- Assert.assertFalse("Target is suspended. It should have been running", (Boolean)wait.getReturnInfo());
+ wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
+ Assert.assertFalse("Target is suspended. It should have been running", (Boolean) wait.getReturnInfo());
- wait.waitReset();
- }
+ wait.waitReset();
+ }
- @Test
- public void resumeContainerContext() throws InterruptedException, ExecutionException, TimeoutException {
- final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
+ @Test
+ public void resumeContainerContext() throws InterruptedException, ExecutionException, TimeoutException {
+ final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
- final DataRequestMonitor<MIInfo> rm =
- new DataRequestMonitor<MIInfo>(fRunCtrl.getExecutor(), null) {
- @Override
+ final DataRequestMonitor<MIInfo> rm = new DataRequestMonitor<MIInfo>(fRunCtrl.getExecutor(), null) {
+ @Override
protected void handleCompleted() {
- wait.waitFinished(getStatus());
- }
- };
-
- final ServiceEventWaitor<IResumedDMEvent> eventWaitor =
- new ServiceEventWaitor<IResumedDMEvent>(
- getGDBLaunch().getSession(),
- IResumedDMEvent.class);
-
- fRunCtrl.getExecutor().submit(new Runnable() {
- @Override
+ wait.waitFinished(getStatus());
+ }
+ };
+
+ final ServiceEventWaitor<IResumedDMEvent> eventWaitor = new ServiceEventWaitor<IResumedDMEvent>(
+ getGDBLaunch().getSession(), IResumedDMEvent.class);
+
+ fRunCtrl.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- fRunCtrl.resume(fContainerDmc, rm);
- }
- });
- wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
- try {
+ fRunCtrl.resume(fContainerDmc, rm);
+ }
+ });
+ wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
+ try {
eventWaitor.waitForEvent(TestsPlugin.massageTimeout(5000));
- //TestsPlugin.debug("DsfMIRunningEvent received");
+ //TestsPlugin.debug("DsfMIRunningEvent received");
} catch (Exception e) {
Assert.fail("Exception raised:: " + e.getMessage());
e.printStackTrace();
@@ -664,25 +649,25 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
}
Assert.assertTrue(wait.getMessage(), wait.isOK());
-
+
wait.waitReset();
-
- final IContainerDMContext containerDmc = SyncUtil.getContainerContext();
-
- fRunCtrl.getExecutor().submit(new Runnable() {
- @Override
+
+ final IContainerDMContext containerDmc = SyncUtil.getContainerContext();
+
+ fRunCtrl.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- wait.setReturnInfo(fRunCtrl.isSuspended(containerDmc));
- wait.waitFinished();
- }
- });
+ wait.setReturnInfo(fRunCtrl.isSuspended(containerDmc));
+ wait.waitFinished();
+ }
+ });
- wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
- Assert.assertFalse("Target is suspended. It should have been running", (Boolean)wait.getReturnInfo());
+ wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
+ Assert.assertFalse("Target is suspended. It should have been running", (Boolean) wait.getReturnInfo());
- wait.waitReset();
+ wait.waitReset();
- // In all-stop mode, MI async is active when the Full GDB console is used
+ // In all-stop mode, MI async is active when the Full GDB console is used
if (fBackEnd.isFullGdbConsoleSupported()) {
assertTrue("Target should be running with async on, and shall be accepting commands",
fRunCtrl.isTargetAcceptingCommands());
@@ -692,21 +677,18 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
assertFalse("Target should be running with async off, and shall NOT be accepting commands",
fRunCtrl.isTargetAcceptingCommands());
}
-
- @Test
- public void runToLine() throws Throwable {
- final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
- ServiceEventWaitor<ISuspendedDMEvent> suspendedEventWaitor = new ServiceEventWaitor<ISuspendedDMEvent>(
- getGDBLaunch().getSession(),
- ISuspendedDMEvent.class);
+ @Test
+ public void runToLine() throws Throwable {
+ final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
+
+ ServiceEventWaitor<ISuspendedDMEvent> suspendedEventWaitor = new ServiceEventWaitor<ISuspendedDMEvent>(
+ getGDBLaunch().getSession(), ISuspendedDMEvent.class);
-
fRunCtrl.getExecutor().submit(new Runnable() {
@Override
public void run() {
- fRunCtrl.runToLine(fThreadExecDmc, SOURCE_NAME,
- getLineForTag("LINE_MAIN_ALL_THREADS_STARTED"), true,
+ fRunCtrl.runToLine(fThreadExecDmc, SOURCE_NAME, getLineForTag("LINE_MAIN_ALL_THREADS_STARTED"), true,
new RequestMonitor(fRunCtrl.getExecutor(), null) {
@Override
protected void handleCompleted() {
@@ -715,95 +697,91 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
});
}
});
-
- wait.waitUntilDone(TestsPlugin.massageTimeout(1000));
- Assert.assertTrue(wait.getMessage(), wait.isOK());
- wait.waitReset();
-
- suspendedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(10000));
- final IContainerDMContext containerDmc = SyncUtil.getContainerContext();
-
- fRunCtrl.getExecutor().submit(new Runnable() {
- @Override
+
+ wait.waitUntilDone(TestsPlugin.massageTimeout(1000));
+ Assert.assertTrue(wait.getMessage(), wait.isOK());
+ wait.waitReset();
+
+ suspendedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(10000));
+ final IContainerDMContext containerDmc = SyncUtil.getContainerContext();
+
+ fRunCtrl.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- wait.setReturnInfo(fRunCtrl.isSuspended(containerDmc));
- wait.waitFinished();
- }
- });
-
- wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
- Assert.assertTrue("Target is running. It should have been suspended", (Boolean)wait.getReturnInfo());
-
- wait.waitReset();
- }
-
- /**
- * Test that interrupting a running target works
- */
- @Test
- public void interruptRunningTarget() throws Throwable {
- final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
-
- ServiceEventWaitor<ISuspendedDMEvent> suspendedEventWaitor = new ServiceEventWaitor<ISuspendedDMEvent>(
- getGDBLaunch().getSession(),
- ISuspendedDMEvent.class);
-
-
- // Resume the target
- fRunCtrl.getExecutor().submit(new Runnable() {
- @Override
+ wait.setReturnInfo(fRunCtrl.isSuspended(containerDmc));
+ wait.waitFinished();
+ }
+ });
+
+ wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
+ Assert.assertTrue("Target is running. It should have been suspended", (Boolean) wait.getReturnInfo());
+
+ wait.waitReset();
+ }
+
+ /**
+ * Test that interrupting a running target works
+ */
+ @Test
+ public void interruptRunningTarget() throws Throwable {
+ final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
+
+ ServiceEventWaitor<ISuspendedDMEvent> suspendedEventWaitor = new ServiceEventWaitor<ISuspendedDMEvent>(
+ getGDBLaunch().getSession(), ISuspendedDMEvent.class);
+
+ // Resume the target
+ fRunCtrl.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- fRunCtrl.resume(fThreadExecDmc,
- new RequestMonitor(fRunCtrl.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- wait.waitFinished(getStatus());
- }
- });
- }
- });
- wait.waitUntilDone(TestsPlugin.massageTimeout(1000));
- Assert.assertTrue(wait.getMessage(), wait.isOK());
- wait.waitReset();
-
+ fRunCtrl.resume(fThreadExecDmc, new RequestMonitor(fRunCtrl.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ wait.waitFinished(getStatus());
+ }
+ });
+ }
+ });
+ wait.waitUntilDone(TestsPlugin.massageTimeout(1000));
+ Assert.assertTrue(wait.getMessage(), wait.isOK());
+ wait.waitReset();
+
// Wait one second and attempt to interrupt the target.
- // As of gdb 7.8, interrupting execution after a thread exit does not
- // work well. This test works around it by interrupting before threads
- // exit. Once the bug in gdb is fixed, we should add a test that
- // interrupts after the threads exit.
- // Ref: https://sourceware.org/bugzilla/show_bug.cgi?id=17627
- Thread.sleep(1000);
- fRunCtrl.getExecutor().submit(new Runnable() {
- @Override
+ // As of gdb 7.8, interrupting execution after a thread exit does not
+ // work well. This test works around it by interrupting before threads
+ // exit. Once the bug in gdb is fixed, we should add a test that
+ // interrupts after the threads exit.
+ // Ref: https://sourceware.org/bugzilla/show_bug.cgi?id=17627
+ Thread.sleep(1000);
+ fRunCtrl.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- fRunCtrl.suspend(fThreadExecDmc,
- new RequestMonitor(fRunCtrl.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- wait.waitFinished(getStatus());
- }
- });
- }
- });
-
- wait.waitUntilDone(TestsPlugin.massageTimeout(1000));
- Assert.assertTrue(wait.getMessage(), wait.isOK());
- wait.waitReset();
-
- // Wait up to 2 seconds for the target to suspend. Should happen immediately.
- suspendedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000));
-
- // Double check that the target is in the suspended state
- final IContainerDMContext containerDmc = SyncUtil.getContainerContext();
- fRunCtrl.getExecutor().submit(new Runnable() {
- @Override
+ fRunCtrl.suspend(fThreadExecDmc, new RequestMonitor(fRunCtrl.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ wait.waitFinished(getStatus());
+ }
+ });
+ }
+ });
+
+ wait.waitUntilDone(TestsPlugin.massageTimeout(1000));
+ Assert.assertTrue(wait.getMessage(), wait.isOK());
+ wait.waitReset();
+
+ // Wait up to 2 seconds for the target to suspend. Should happen immediately.
+ suspendedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000));
+
+ // Double check that the target is in the suspended state
+ final IContainerDMContext containerDmc = SyncUtil.getContainerContext();
+ fRunCtrl.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- wait.setReturnInfo(fRunCtrl.isSuspended(containerDmc));
- wait.waitFinished();
- }
- });
- wait.waitUntilDone(TestsPlugin.massageTimeout(2000));
- Assert.assertTrue("Target is running. It should have been suspended", (Boolean)wait.getReturnInfo());
- wait.waitReset();
- }
+ wait.setReturnInfo(fRunCtrl.isSuspended(containerDmc));
+ wait.waitFinished();
+ }
+ });
+ wait.waitUntilDone(TestsPlugin.massageTimeout(2000));
+ Assert.assertTrue("Target is running. It should have been suspended", (Boolean) wait.getReturnInfo());
+ wait.waitReset();
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/OperationsWhileTargetIsRunningTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/OperationsWhileTargetIsRunningTest.java
index f9cd5bcd251..958324ee03f 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/OperationsWhileTargetIsRunningTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/OperationsWhileTargetIsRunningTest.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson AB - Initial implementation of Test cases
*******************************************************************************/
@@ -45,14 +45,13 @@ import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.osgi.service.prefs.Preferences;
-
/**
* Tests that we can perform different operations while the target
- * is running.
+ * is running.
*/
@RunWith(Parameterized.class)
public class OperationsWhileTargetIsRunningTest extends BaseParametrizedTestCase {
- private DsfServicesTracker fServicesTracker;
+ private DsfServicesTracker fServicesTracker;
private IGDBProcesses fProcesses;
private IMIContainerDMContext fContainerDmc;
private IGDBControl fControl;
@@ -61,284 +60,270 @@ public class OperationsWhileTargetIsRunningTest extends BaseParametrizedTestCase
private static boolean fgAutoTerminate;
- @BeforeClass
+ @BeforeClass
public static void doBeforeClass() throws Exception {
// Save the original values of the preferences used in this class
- fgAutoTerminate = Platform.getPreferencesService().getBoolean(
- GdbPlugin.PLUGIN_ID,
- IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB,
- true,
- null );
- }
+ fgAutoTerminate = Platform.getPreferencesService().getBoolean(GdbPlugin.PLUGIN_ID,
+ IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, true, null);
+ }
@Override
public void doBeforeTest() throws Exception {
super.doBeforeTest();
final DsfSession session = getGDBLaunch().getSession();
-
- Runnable runnable = new Runnable() {
- @Override
+
+ Runnable runnable = new Runnable() {
+ @Override
public void run() {
- fServicesTracker =
- new DsfServicesTracker(TestsPlugin.getBundleContext(),
- session.getId());
-
- fProcesses = fServicesTracker.getService(IGDBProcesses.class);
- fControl = fServicesTracker.getService(IGDBControl.class);
- }
- };
- session.getExecutor().submit(runnable).get();
-
- fContainerDmc = (IMIContainerDMContext)SyncUtil.getContainerContext();
+ fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), session.getId());
- }
+ fProcesses = fServicesTracker.getService(IGDBProcesses.class);
+ fControl = fServicesTracker.getService(IGDBControl.class);
+ }
+ };
+ session.getExecutor().submit(runnable).get();
+
+ fContainerDmc = (IMIContainerDMContext) SyncUtil.getContainerContext();
+ }
@Override
public void doAfterTest() throws Exception {
super.doAfterTest();
- if (fServicesTracker!=null) fServicesTracker.dispose();
+ if (fServicesTracker != null)
+ fServicesTracker.dispose();
// Restore the different preferences we might have changed
- IEclipsePreferences node = InstanceScope.INSTANCE.getNode( GdbPlugin.PLUGIN_ID );
- node.putBoolean( IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, fgAutoTerminate );
+ IEclipsePreferences node = InstanceScope.INSTANCE.getNode(GdbPlugin.PLUGIN_ID);
+ node.putBoolean(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, fgAutoTerminate);
}
-
+
@Override
protected void setLaunchAttributes() {
super.setLaunchAttributes();
-
- setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME,
- EXEC_PATH + EXEC_NAME);
+
+ setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EXEC_PATH + EXEC_NAME);
}
- /**
- * Test that the restart operation works properly while the target is running, and
- * with the option to kill GDB after the process terminates, enabled.
- */
- @Test
- public void restartWhileTargetRunningKillGDB() throws Throwable {
- // Restart is not supported for a remote session
- if (isRemoteSession()) {
- Assert.assertFalse("Restart operation should not be allowed for a remote session",
- SyncUtil.canRestart());
- return;
- }
-
- // First set the preference to kill GDB (although it should not happen in this test)
- Preferences node = InstanceScope.INSTANCE.getNode(GdbPlugin.PLUGIN_ID);
- node.putBoolean(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, true);
-
- // The target is currently stopped. We resume to get it running
- // then we do the restart, and confirm we are then stopped on main
- SyncUtil.resume();
+ /**
+ * Test that the restart operation works properly while the target is running, and
+ * with the option to kill GDB after the process terminates, enabled.
+ */
+ @Test
+ public void restartWhileTargetRunningKillGDB() throws Throwable {
+ // Restart is not supported for a remote session
+ if (isRemoteSession()) {
+ Assert.assertFalse("Restart operation should not be allowed for a remote session", SyncUtil.canRestart());
+ return;
+ }
+
+ // First set the preference to kill GDB (although it should not happen in this test)
+ Preferences node = InstanceScope.INSTANCE.getNode(GdbPlugin.PLUGIN_ID);
+ node.putBoolean(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, true);
+
+ // The target is currently stopped. We resume to get it running
+ // then we do the restart, and confirm we are then stopped on main
+ SyncUtil.resume();
MIStoppedEvent stoppedEvent = SyncUtil.restart(getGDBLaunch());
-
+
String func = stoppedEvent.getFrame().getFunction();
- Assert.assertTrue("Expected to be stopped at main, but is stopped at " + func,
- "main".equals(func));
-
- // Now make sure GDB is still alive
- Assert.assertTrue("GDB should have been still alive", fControl.isActive());
- }
-
- /**
- * Test that the restart operation works properly while the target is running, and
- * with the option to kill GDB after the process terminates, disabled.
- */
- @Test
- public void restartWhileTargetRunningGDBAlive() throws Throwable {
- // Restart is not supported for a remote session
- if (isRemoteSession()) {
- Assert.assertFalse("Restart operation should not be allowed for a remote session",
- SyncUtil.canRestart());
- return;
- }
-
- // First set the preference not to kill gdb
- Preferences node = InstanceScope.INSTANCE.getNode(GdbPlugin.PLUGIN_ID);
- node.putBoolean(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, false);
-
- // The target is currently stopped. We resume to get it running
- // then we do the restart, and confirm we are then stopped on main
- SyncUtil.resume();
+ Assert.assertTrue("Expected to be stopped at main, but is stopped at " + func, "main".equals(func));
+
+ // Now make sure GDB is still alive
+ Assert.assertTrue("GDB should have been still alive", fControl.isActive());
+ }
+
+ /**
+ * Test that the restart operation works properly while the target is running, and
+ * with the option to kill GDB after the process terminates, disabled.
+ */
+ @Test
+ public void restartWhileTargetRunningGDBAlive() throws Throwable {
+ // Restart is not supported for a remote session
+ if (isRemoteSession()) {
+ Assert.assertFalse("Restart operation should not be allowed for a remote session", SyncUtil.canRestart());
+ return;
+ }
+
+ // First set the preference not to kill gdb
+ Preferences node = InstanceScope.INSTANCE.getNode(GdbPlugin.PLUGIN_ID);
+ node.putBoolean(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, false);
+
+ // The target is currently stopped. We resume to get it running
+ // then we do the restart, and confirm we are then stopped on main
+ SyncUtil.resume();
MIStoppedEvent stoppedEvent = SyncUtil.restart(getGDBLaunch());
-
+
String func = stoppedEvent.getFrame().getFunction();
- Assert.assertTrue("Expected to be stopped at main, but is stopped at " + func,
- "main".equals(func));
-
- // Now make sure GDB is still alive
- Assert.assertTrue("GDB should have been still alive", fControl.isActive());
- }
-
- /**
- * Test that the terminate operation works properly while the target is running, and
- * with the option to kill GDB after the process terminates, enabled.
- */
- @Test
- public void terminateWhileTargetRunningKillGDB() throws Throwable {
- // First set the preference to kill GDB
- Preferences node = InstanceScope.INSTANCE.getNode(GdbPlugin.PLUGIN_ID);
- node.putBoolean(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, true);
-
- // The target is currently stopped. We resume to get it running
- // then we terminate, and confirm that we shutdown right away
- SyncUtil.resume();
-
- ServiceEventWaitor<ICommandControlShutdownDMEvent> shutdownEventWaitor = new ServiceEventWaitor<ICommandControlShutdownDMEvent>(
- getGDBLaunch().getSession(),
- ICommandControlShutdownDMEvent.class);
-
- // Don't use a query here. The terminate, because it kills GDB, may not return right away
- // but that is ok because we wait for a shutdown event right after
- Runnable runnable = new Runnable() {
- @Override
+ Assert.assertTrue("Expected to be stopped at main, but is stopped at " + func, "main".equals(func));
+
+ // Now make sure GDB is still alive
+ Assert.assertTrue("GDB should have been still alive", fControl.isActive());
+ }
+
+ /**
+ * Test that the terminate operation works properly while the target is running, and
+ * with the option to kill GDB after the process terminates, enabled.
+ */
+ @Test
+ public void terminateWhileTargetRunningKillGDB() throws Throwable {
+ // First set the preference to kill GDB
+ Preferences node = InstanceScope.INSTANCE.getNode(GdbPlugin.PLUGIN_ID);
+ node.putBoolean(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, true);
+
+ // The target is currently stopped. We resume to get it running
+ // then we terminate, and confirm that we shutdown right away
+ SyncUtil.resume();
+
+ ServiceEventWaitor<ICommandControlShutdownDMEvent> shutdownEventWaitor = new ServiceEventWaitor<ICommandControlShutdownDMEvent>(
+ getGDBLaunch().getSession(), ICommandControlShutdownDMEvent.class);
+
+ // Don't use a query here. The terminate, because it kills GDB, may not return right away
+ // but that is ok because we wait for a shutdown event right after
+ Runnable runnable = new Runnable() {
+ @Override
public void run() {
- IProcessDMContext processDmc = DMContexts.getAncestorOfType(fContainerDmc, IProcessDMContext.class);
- fProcesses.terminate(processDmc, new ImmediateRequestMonitor());
- }
- };
- fProcesses.getExecutor().execute(runnable);
-
+ IProcessDMContext processDmc = DMContexts.getAncestorOfType(fContainerDmc, IProcessDMContext.class);
+ fProcesses.terminate(processDmc, new ImmediateRequestMonitor());
+ }
+ };
+ fProcesses.getExecutor().execute(runnable);
+
// The shutdown must happen quickly, which will confirm that it was
// our own terminate that did it. If it take longer, it indicates
// that the program terminated on its own, which is not what we want.
- // See Bug 518643 for details as to length of this delay
- shutdownEventWaitor.waitForEvent(TestsPlugin.massageTimeout(1000));
-
- // Now make sure GDB is dead
- Assert.assertTrue("GDB should have been terminated", !fControl.isActive());
- }
-
- /**
- * Test that the terminate operation works properly while the target is running, and
- * with the option to kill GDB after the process terminates, disabled.
- */
- @Test
- public void terminateWhileTargetRunningKeepGDBAlive() throws Throwable {
- // First set the preference not to kill gdb
- Preferences node = InstanceScope.INSTANCE.getNode(GdbPlugin.PLUGIN_ID);
- node.putBoolean(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, false);
-
- // The target is currently stopped. We resume to get it running
- // then we terminate the process, and confirm that there are no more processes
- SyncUtil.resume();
-
- ServiceEventWaitor<IExitedDMEvent> exitedEventWaitor = new ServiceEventWaitor<IExitedDMEvent>(
- getGDBLaunch().getSession(),
- IExitedDMEvent.class);
-
- Query<Object> query = new Query<Object>() {
- @Override
- protected void execute(final DataRequestMonitor<Object> rm) {
- IProcessDMContext processDmc = DMContexts.getAncestorOfType(fContainerDmc, IProcessDMContext.class);
- fProcesses.terminate(processDmc, rm);
- }
- };
- {
- fProcesses.getExecutor().execute(query);
- query.get(TestsPlugin.massageTimeout(1000), TimeUnit.MILLISECONDS);
- }
-
- IExitedDMEvent event = exitedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(500));
- if (!(event.getDMContext() instanceof IMIContainerDMContext)) {
- // This was the thread exited event, we want the container exited event
- event = exitedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(500));
- }
-
- // Make sure this event shows that the process was terminated
- Assert.assertTrue("Process was not terminated", event.getDMContext() instanceof IMIContainerDMContext);
- IMIContainerDMContext dmc = (IMIContainerDMContext)event.getDMContext();
- Assert.assertTrue("Expected process " + fContainerDmc.getGroupId() + " but got " + dmc.getGroupId(),
- fContainerDmc.getGroupId().equals(dmc.getGroupId()));
-
- // Now make sure GDB is still alive
- Assert.assertTrue("GDB should have been still alive", fControl.isActive());
- }
-
- /**
- * Test that the detach operation works properly while the target is running, and
- * with the option to kill GDB after the process terminates, enabled.
- */
- @Test
- public void detachWhileTargetRunningKillGDB() throws Throwable {
- // First set the preference to kill GDB
- Preferences node = InstanceScope.INSTANCE.getNode(GdbPlugin.PLUGIN_ID);
- node.putBoolean(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, true);
-
- // The target is currently stopped. We resume to get it running
- // then we detach the process, and confirm that we are shutdown
- SyncUtil.resume();
-
- ServiceEventWaitor<ICommandControlShutdownDMEvent> shutdownEventWaitor = new ServiceEventWaitor<ICommandControlShutdownDMEvent>(
- getGDBLaunch().getSession(),
- ICommandControlShutdownDMEvent.class);
-
- // Don't use a query here. Because GDB will be killed, the call to detach may not return right away
- // but that is ok because we wait for a shutdown event right after
- Runnable runnable = new Runnable() {
- @Override
+ // See Bug 518643 for details as to length of this delay
+ shutdownEventWaitor.waitForEvent(TestsPlugin.massageTimeout(1000));
+
+ // Now make sure GDB is dead
+ Assert.assertTrue("GDB should have been terminated", !fControl.isActive());
+ }
+
+ /**
+ * Test that the terminate operation works properly while the target is running, and
+ * with the option to kill GDB after the process terminates, disabled.
+ */
+ @Test
+ public void terminateWhileTargetRunningKeepGDBAlive() throws Throwable {
+ // First set the preference not to kill gdb
+ Preferences node = InstanceScope.INSTANCE.getNode(GdbPlugin.PLUGIN_ID);
+ node.putBoolean(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, false);
+
+ // The target is currently stopped. We resume to get it running
+ // then we terminate the process, and confirm that there are no more processes
+ SyncUtil.resume();
+
+ ServiceEventWaitor<IExitedDMEvent> exitedEventWaitor = new ServiceEventWaitor<IExitedDMEvent>(
+ getGDBLaunch().getSession(), IExitedDMEvent.class);
+
+ Query<Object> query = new Query<Object>() {
+ @Override
+ protected void execute(final DataRequestMonitor<Object> rm) {
+ IProcessDMContext processDmc = DMContexts.getAncestorOfType(fContainerDmc, IProcessDMContext.class);
+ fProcesses.terminate(processDmc, rm);
+ }
+ };
+ {
+ fProcesses.getExecutor().execute(query);
+ query.get(TestsPlugin.massageTimeout(1000), TimeUnit.MILLISECONDS);
+ }
+
+ IExitedDMEvent event = exitedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(500));
+ if (!(event.getDMContext() instanceof IMIContainerDMContext)) {
+ // This was the thread exited event, we want the container exited event
+ event = exitedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(500));
+ }
+
+ // Make sure this event shows that the process was terminated
+ Assert.assertTrue("Process was not terminated", event.getDMContext() instanceof IMIContainerDMContext);
+ IMIContainerDMContext dmc = (IMIContainerDMContext) event.getDMContext();
+ Assert.assertTrue("Expected process " + fContainerDmc.getGroupId() + " but got " + dmc.getGroupId(),
+ fContainerDmc.getGroupId().equals(dmc.getGroupId()));
+
+ // Now make sure GDB is still alive
+ Assert.assertTrue("GDB should have been still alive", fControl.isActive());
+ }
+
+ /**
+ * Test that the detach operation works properly while the target is running, and
+ * with the option to kill GDB after the process terminates, enabled.
+ */
+ @Test
+ public void detachWhileTargetRunningKillGDB() throws Throwable {
+ // First set the preference to kill GDB
+ Preferences node = InstanceScope.INSTANCE.getNode(GdbPlugin.PLUGIN_ID);
+ node.putBoolean(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, true);
+
+ // The target is currently stopped. We resume to get it running
+ // then we detach the process, and confirm that we are shutdown
+ SyncUtil.resume();
+
+ ServiceEventWaitor<ICommandControlShutdownDMEvent> shutdownEventWaitor = new ServiceEventWaitor<ICommandControlShutdownDMEvent>(
+ getGDBLaunch().getSession(), ICommandControlShutdownDMEvent.class);
+
+ // Don't use a query here. Because GDB will be killed, the call to detach may not return right away
+ // but that is ok because we wait for a shutdown event right after
+ Runnable runnable = new Runnable() {
+ @Override
public void run() {
- fProcesses.detachDebuggerFromProcess(fContainerDmc, new ImmediateRequestMonitor());
- }
- };
- fProcesses.getExecutor().execute(runnable);
-
+ fProcesses.detachDebuggerFromProcess(fContainerDmc, new ImmediateRequestMonitor());
+ }
+ };
+ fProcesses.getExecutor().execute(runnable);
+
// The shutdown must happen quickly, which will confirm that it was
// our own terminate that did it. If it take longer, it indicates
// that the program terminated on its own, which is not what we want.
- // See Bug 518643 for details as to length of this delay
- shutdownEventWaitor.waitForEvent(TestsPlugin.massageTimeout(1000));
-
- // Now make sure GDB is dead
- Assert.assertTrue("GDB should have been terminated", !fControl.isActive());
- }
-
- /**
- * Test that the detach operation works properly while the target is running, and
- * with the option to kill GDB after the process terminates, disabled.
- */
- @Test
- public void detachWhileTargetRunningGDBAlive() throws Throwable {
- // First set the preference not to kill gdb
- Preferences node = InstanceScope.INSTANCE.getNode(GdbPlugin.PLUGIN_ID);
- node.putBoolean(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, false);
-
- // The target is currently stopped. We resume to get it running
- // then we detach the process, and confirm that we are not longer running
- SyncUtil.resume();
-
- ServiceEventWaitor<IExitedDMEvent> exitedEventWaitor = new ServiceEventWaitor<IExitedDMEvent>(
- getGDBLaunch().getSession(),
- IExitedDMEvent.class);
-
- Query<Object> query = new Query<Object>() {
- @Override
- protected void execute(final DataRequestMonitor<Object> rm) {
- fProcesses.detachDebuggerFromProcess(fContainerDmc, rm);
- }
- };
- {
- fProcesses.getExecutor().execute(query);
- query.get(TestsPlugin.massageTimeout(1000), TimeUnit.MILLISECONDS);
- }
-
- IExitedDMEvent event = exitedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(500));
- if (!(event.getDMContext() instanceof IMIContainerDMContext)) {
- // This was the thread exited event, we want the container exited event
- event = exitedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(500));
- }
-
- // Make sure this event shows that the process was detached
- Assert.assertTrue("Process was not detached", event.getDMContext() instanceof IMIContainerDMContext);
- IMIContainerDMContext dmc = (IMIContainerDMContext)event.getDMContext();
- Assert.assertTrue("Expected process " + fContainerDmc.getGroupId() + " but got " + dmc.getGroupId(),
- fContainerDmc.getGroupId().equals(dmc.getGroupId()));
-
- // Now make sure GDB is still alive
- Assert.assertTrue("GDB should have been still alive", fControl.isActive());
- }
+ // See Bug 518643 for details as to length of this delay
+ shutdownEventWaitor.waitForEvent(TestsPlugin.massageTimeout(1000));
+
+ // Now make sure GDB is dead
+ Assert.assertTrue("GDB should have been terminated", !fControl.isActive());
+ }
+
+ /**
+ * Test that the detach operation works properly while the target is running, and
+ * with the option to kill GDB after the process terminates, disabled.
+ */
+ @Test
+ public void detachWhileTargetRunningGDBAlive() throws Throwable {
+ // First set the preference not to kill gdb
+ Preferences node = InstanceScope.INSTANCE.getNode(GdbPlugin.PLUGIN_ID);
+ node.putBoolean(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, false);
+
+ // The target is currently stopped. We resume to get it running
+ // then we detach the process, and confirm that we are not longer running
+ SyncUtil.resume();
+
+ ServiceEventWaitor<IExitedDMEvent> exitedEventWaitor = new ServiceEventWaitor<IExitedDMEvent>(
+ getGDBLaunch().getSession(), IExitedDMEvent.class);
+
+ Query<Object> query = new Query<Object>() {
+ @Override
+ protected void execute(final DataRequestMonitor<Object> rm) {
+ fProcesses.detachDebuggerFromProcess(fContainerDmc, rm);
+ }
+ };
+ {
+ fProcesses.getExecutor().execute(query);
+ query.get(TestsPlugin.massageTimeout(1000), TimeUnit.MILLISECONDS);
+ }
+
+ IExitedDMEvent event = exitedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(500));
+ if (!(event.getDMContext() instanceof IMIContainerDMContext)) {
+ // This was the thread exited event, we want the container exited event
+ event = exitedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(500));
+ }
+
+ // Make sure this event shows that the process was detached
+ Assert.assertTrue("Process was not detached", event.getDMContext() instanceof IMIContainerDMContext);
+ IMIContainerDMContext dmc = (IMIContainerDMContext) event.getDMContext();
+ Assert.assertTrue("Expected process " + fContainerDmc.getGroupId() + " but got " + dmc.getGroupId(),
+ fContainerDmc.getGroupId().equals(dmc.getGroupId()));
+
+ // Now make sure GDB is still alive
+ Assert.assertTrue("GDB should have been still alive", fControl.isActive());
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/PostMortemCoreTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/PostMortemCoreTest.java
index 499abd0afd0..4ad84e4fc14 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/PostMortemCoreTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/PostMortemCoreTest.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - Initial Implementation
* Marc Khouzam (Ericsson) - Added test to handle different cases of core
@@ -63,232 +63,234 @@ public class PostMortemCoreTest extends BaseParametrizedTestCase {
private static final String INVALID_CORE_NAME = "MultiThread.exe";
private static final String CORE_NAME = "core";
- private DsfSession fSession;
+ private DsfSession fSession;
- private DsfServicesTracker fServicesTracker;
+ private DsfServicesTracker fServicesTracker;
- private IExpressions fExpService;
+ private IExpressions fExpService;
private IMemoryDMContext fMemoryDmc;
- @Override
+ @Override
public void doBeforeTest() throws Exception {
assumeLocalSession();
removeTeminatedLaunchesBeforeTest();
setLaunchAttributes();
- // Can't run the launch right away because each test needs to first set some
- // parameters. The individual tests will be responsible for starting the launch.
+ // Can't run the launch right away because each test needs to first set some
+ // parameters. The individual tests will be responsible for starting the launch.
}
-
+
@Override
- protected void setLaunchAttributes() {
- super.setLaunchAttributes();
-
+ protected void setLaunchAttributes() {
+ super.setLaunchAttributes();
+
// Set a working directory for GDB that is different than eclipse's directory.
// This allows us to make sure we properly handle finding the core file,
// especially in the case of a relative path
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, "${workspace_loc}");
// Because we just set a different working directory, we must use an absolute path for the program
- String absoluteProgram = new Path(EXEC_PATH + EXEC_NAME).toFile().getAbsolutePath();
- setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, absoluteProgram);
-
- // Set post-mortem launch
+ String absoluteProgram = new Path(EXEC_PATH + EXEC_NAME).toFile().getAbsolutePath();
+ setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, absoluteProgram);
+
+ // Set post-mortem launch
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
- ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE);
+ ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE);
// Set post-mortem type to core file
setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_POST_MORTEM_TYPE,
- IGDBLaunchConfigurationConstants.DEBUGGER_POST_MORTEM_CORE_FILE);
+ IGDBLaunchConfigurationConstants.DEBUGGER_POST_MORTEM_CORE_FILE);
// Set default core file path
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, EXEC_PATH + CORE_NAME);
- }
-
- // This method cannot be tagged as @Before, because the launch is not
- // running yet. We have to call this manually after all the proper
- // parameters have been set for the launch
- @Override
+ }
+
+ // This method cannot be tagged as @Before, because the launch is not
+ // running yet. We have to call this manually after all the proper
+ // parameters have been set for the launch
+ @Override
protected void doLaunch() throws Exception {
- // perform the launch
- super.doLaunch();
+ // perform the launch
+ super.doLaunch();
- fSession = getGDBLaunch().getSession();
+ fSession = getGDBLaunch().getSession();
- fMemoryDmc = (IMemoryDMContext)SyncUtil.getContainerContext();
- assert(fMemoryDmc != null);
+ fMemoryDmc = (IMemoryDMContext) SyncUtil.getContainerContext();
+ assert (fMemoryDmc != null);
- Runnable runnable = new Runnable() {
- @Override
+ Runnable runnable = new Runnable() {
+ @Override
public void run() {
- fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
- fExpService = fServicesTracker.getService(IExpressions.class);
- }
- };
- fSession.getExecutor().submit(runnable).get();
- }
-
- @Override
+ fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
+ fExpService = fServicesTracker.getService(IExpressions.class);
+ }
+ };
+ fSession.getExecutor().submit(runnable).get();
+ }
+
+ @Override
public void doAfterTest() throws Exception {
- super.doAfterTest();
-
- if (fSession != null) {
- fSession.getExecutor().submit(()->fSession.removeServiceEventListener(PostMortemCoreTest.this)).get();
- }
-
- fExpService = null;
- if (fServicesTracker != null) fServicesTracker.dispose();
- }
-
- /**
- * Test that we support specifying a core file with an absolute path.
- */
- @Test
- public void testAbsoluteCoreFilePath() throws Throwable {
- File file = new File(EXEC_PATH + CORE_NAME);
- assertTrue("Cannot find test file; " + file.toString(), file.exists());
-
- String absoluteCoreFile = file.getAbsolutePath();
-
+ super.doAfterTest();
+
+ if (fSession != null) {
+ fSession.getExecutor().submit(() -> fSession.removeServiceEventListener(PostMortemCoreTest.this)).get();
+ }
+
+ fExpService = null;
+ if (fServicesTracker != null)
+ fServicesTracker.dispose();
+ }
+
+ /**
+ * Test that we support specifying a core file with an absolute path.
+ */
+ @Test
+ public void testAbsoluteCoreFilePath() throws Throwable {
+ File file = new File(EXEC_PATH + CORE_NAME);
+ assertTrue("Cannot find test file; " + file.toString(), file.exists());
+
+ String absoluteCoreFile = file.getAbsolutePath();
+
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, absoluteCoreFile);
doLaunch();
-
+
// If the launch passed, we are ok, nothing more to check
- }
-
- /**
- * Test that we support specifying a core file with a relative path.
- */
- @Test
- public void testRelativeCoreFilePath() throws Throwable {
- File file = new File(EXEC_PATH + CORE_NAME);
- assertTrue("Cannot find test file; " + file.toString(), file.exists());
-
- String relativeCoreFile = file.toString();
-
+ }
+
+ /**
+ * Test that we support specifying a core file with a relative path.
+ */
+ @Test
+ public void testRelativeCoreFilePath() throws Throwable {
+ File file = new File(EXEC_PATH + CORE_NAME);
+ assertTrue("Cannot find test file; " + file.toString(), file.exists());
+
+ String relativeCoreFile = file.toString();
+
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, relativeCoreFile);
doLaunch();
-
+
// If the launch passed, we are ok, nothing more to check
- }
-
- /**
- * Test that we handle specifying an invalid core file with an absolute path.
- */
- @Test
- public void testAbsoluteCoreFilePathInvalid() throws Throwable {
- File file = new File(EXEC_PATH + INVALID_CORE_NAME);
- assertTrue("Cannot find test file: " + file.toString(), file.exists());
-
- String absoluteCoreFile = file.getAbsolutePath();
-
+ }
+
+ /**
+ * Test that we handle specifying an invalid core file with an absolute path.
+ */
+ @Test
+ public void testAbsoluteCoreFilePathInvalid() throws Throwable {
+ File file = new File(EXEC_PATH + INVALID_CORE_NAME);
+ assertTrue("Cannot find test file: " + file.toString(), file.exists());
+
+ String absoluteCoreFile = file.getAbsolutePath();
+
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, absoluteCoreFile);
- try {
- doLaunch();
- } catch (DebugException e) {
- // Success of the test
- return;
- }
-
- fail("Launch seems to have succeeded even though the specified core file is invalid");
- }
-
- /**
- * Test that we handle specifying an invalid core file with a relative path.
- */
- @Test
- public void testRelativeCoreFilePathInvalid() throws Throwable {
- File file = new File(EXEC_PATH + INVALID_CORE_NAME);
- assertTrue("Cannot find test file: " + file.toString(), file.exists());
-
- String relativeCoreFile = file.toString();
-
+ try {
+ doLaunch();
+ } catch (DebugException e) {
+ // Success of the test
+ return;
+ }
+
+ fail("Launch seems to have succeeded even though the specified core file is invalid");
+ }
+
+ /**
+ * Test that we handle specifying an invalid core file with a relative path.
+ */
+ @Test
+ public void testRelativeCoreFilePathInvalid() throws Throwable {
+ File file = new File(EXEC_PATH + INVALID_CORE_NAME);
+ assertTrue("Cannot find test file: " + file.toString(), file.exists());
+
+ String relativeCoreFile = file.toString();
+
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, relativeCoreFile);
- try {
- doLaunch();
- } catch (CoreException e) {
- // Success of the test
- return;
- }
-
- fail("Launch seems to have succeeded even though the specified core file is invalid");
- }
-
- /**
- * Test that we handle specifying a missing core file with an absolute path.
- */
- @Test
- public void testAbsoluteCoreFilePathMissing() throws Throwable {
- File file = new File(EXEC_PATH + "MissingFile");
- assertTrue("Should not have found test file: " + file.toString(), !file.exists());
-
- String absoluteCoreFile = file.getAbsolutePath();
-
+ try {
+ doLaunch();
+ } catch (CoreException e) {
+ // Success of the test
+ return;
+ }
+
+ fail("Launch seems to have succeeded even though the specified core file is invalid");
+ }
+
+ /**
+ * Test that we handle specifying a missing core file with an absolute path.
+ */
+ @Test
+ public void testAbsoluteCoreFilePathMissing() throws Throwable {
+ File file = new File(EXEC_PATH + "MissingFile");
+ assertTrue("Should not have found test file: " + file.toString(), !file.exists());
+
+ String absoluteCoreFile = file.getAbsolutePath();
+
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, absoluteCoreFile);
- try {
- doLaunch();
- } catch (CoreException e) {
- // Success of the test
- return;
- }
-
- fail("Launch seems to have succeeded even though the specified core file does not exist");
- }
-
- /**
- * Test that we handle specifying a missing core file with a relative path.
- */
- @Test
- public void testRelativeCoreFilePathMissing() throws Throwable {
- File file = new File(EXEC_PATH + "MissingFile");
- assertTrue("Should not have found test file: " + file.toString(), !file.exists());
-
- String relativeCoreFile = file.toString();
-
+ try {
+ doLaunch();
+ } catch (CoreException e) {
+ // Success of the test
+ return;
+ }
+
+ fail("Launch seems to have succeeded even though the specified core file does not exist");
+ }
+
+ /**
+ * Test that we handle specifying a missing core file with a relative path.
+ */
+ @Test
+ public void testRelativeCoreFilePathMissing() throws Throwable {
+ File file = new File(EXEC_PATH + "MissingFile");
+ assertTrue("Should not have found test file: " + file.toString(), !file.exists());
+
+ String relativeCoreFile = file.toString();
+
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, relativeCoreFile);
- try {
- doLaunch();
- } catch (CoreException e) {
- // Success of the test
- return;
- }
-
- fail("Launch seems to have succeeded even though the specified core file does not exist");
- }
-
- /**
- * Test that we support a valid core file path using variables.
- */
- @Test
- public void testCoreFilePathWithVariable() throws Throwable {
- // I couldn't find an easy way to test with a variable.
- // Here what we do here:
- // create the variable for the workspace location and expand it
- // The resulting path has a common part with the absolute core
- // file path. Find that common part and count how many .. we
- // have to insert to use the common part of the variablePath
- // inside the absolute path.
- // Then, send the variable itself, with all the .., and the
- // absolute path, and make sure the variable gets translated
- // properly.
-
- // Absolute path of the core file
- File file = new File(EXEC_PATH + CORE_NAME);
- String absoluteCoreFile = file.getAbsolutePath();
-
- // Variable for workspace location
- String variable = "${workspace_loc}";
- // Expand workspace location
- String workspaceLocation = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(variable, false);
+ try {
+ doLaunch();
+ } catch (CoreException e) {
+ // Success of the test
+ return;
+ }
+
+ fail("Launch seems to have succeeded even though the specified core file does not exist");
+ }
+
+ /**
+ * Test that we support a valid core file path using variables.
+ */
+ @Test
+ public void testCoreFilePathWithVariable() throws Throwable {
+ // I couldn't find an easy way to test with a variable.
+ // Here what we do here:
+ // create the variable for the workspace location and expand it
+ // The resulting path has a common part with the absolute core
+ // file path. Find that common part and count how many .. we
+ // have to insert to use the common part of the variablePath
+ // inside the absolute path.
+ // Then, send the variable itself, with all the .., and the
+ // absolute path, and make sure the variable gets translated
+ // properly.
+
+ // Absolute path of the core file
+ File file = new File(EXEC_PATH + CORE_NAME);
+ String absoluteCoreFile = file.getAbsolutePath();
+
+ // Variable for workspace location
+ String variable = "${workspace_loc}";
+ // Expand workspace location
+ String workspaceLocation = VariablesPlugin.getDefault().getStringVariableManager()
+ .performStringSubstitution(variable, false);
// Path to the core file
IPath corePath = new Path(absoluteCoreFile);
// Prepare to find the common path between the core file and the workspace
IPath commonPath = new Path(workspaceLocation);
-
+
StringBuilder backwards = new StringBuilder("/");
// While the commonPath is not the prefix of the core file path
// remove one more segment of the potential commonPath
@@ -296,10 +298,10 @@ public class PostMortemCoreTest extends BaseParametrizedTestCase {
commonPath = commonPath.removeLastSegments(1);
backwards.append("../");
}
-
+
// Remove the commonPath from the workspace path
IPath trailingPathCoreFile = corePath.removeFirstSegments(commonPath.segmentCount());
-
+
// Build the path using the variable unexpanded, the number of ..
// to remove all non-common segments, the trailing part of the
// path of the core file
@@ -307,94 +309,98 @@ public class PostMortemCoreTest extends BaseParametrizedTestCase {
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, coreFile);
- doLaunch();
- }
-
- /**
- * Test that we can correctly evaluate integer expressions.
- */
- @Test
- public void testLiteralIntegerExpressions() throws Throwable {
- doLaunch();
-
- // Create a map of expressions and their expected values.
- Map<String, String[]> tests = new HashMap<String, String[]>();
-
- tests.put("0 + 0 - 0", new String[] { "0x0", "0", "0", "0", "0", "0" });
- tests.put("3 + 4", new String[] { "0x7", "07", "111", "7", "7", "7" });
- tests.put("3 + 4 * 5", new String[] { "0x17", "027", "10111", "23", "23", "23" });
- tests.put("5 * 3 + 4", new String[] { "0x13", "023", "10011", "19", "19", "19" });
- tests.put("5 * (3 + 4)", new String[] { "0x23", "043", "100011", "35", "35", "35" });
- tests.put("10 - 15", new String[] { "0xFFFFFFFB", "037777777773", "11111111111111111111111111111011", "-5",
- "-5", "-5" });
- tests.put("10 + -15", new String[] { "0xFFFFFFFB", "037777777773", "11111111111111111111111111111011", "-5",
- "-5", "-5" });
-
- executeExpressionSubTests(tests, SyncUtil.getStackFrame(SyncUtil.getExecutionContext(0), 0));
- }
-
- /**
- * Test that we can correctly evaluate floating-point expressions.
- */
- @Test
- public void testLiteralFloatingPointExpressions() throws Throwable {
- doLaunch();
-
- // Create a map of expressions and their expected values.
- Map<String, String[]> tests = new HashMap<String, String[]>();
-
- tests.put("3.14159 + 1.1111", new String[] { "0x4", "04", "100", "4", "4.2526", "4.2526" });
- tests.put("100.0 / 3.0", new String[] { "0x21", "041", "100001", "33", "33.3333", "33.3333" });
- tests.put("-100.0 / 3.0", new String[] { "0xffffffffffffffdf", "01777777777777777777737",
- "1111111111111111111111111111111111111111111111111111111111011111", "-33", "-33.3333", "-33.3333" });
- tests.put("-100.0 / -3.0", new String[] { "0x21", "041", "100001", "33", "33.3333", "33.3333" });
- executeExpressionSubTests(tests, false, SyncUtil.getStackFrame(SyncUtil.getExecutionContext(0), 0));
-
- tests.clear();
- tests.put("100.0 / 0.5", new String[] { "0xc8", "0310", "11001000", "200", "200", "200" });
- executeExpressionSubTests(tests, true, SyncUtil.getStackFrame(SyncUtil.getExecutionContext(0), 0));
-
- }
-
- /**
- * Test that we can correctly evaluate C expressions involving local
- * variables.
- */
- @Test
- public void testLocalVariables() throws Throwable {
- doLaunch();
-
- // Create a map of expressions to expected values.
- Map<String, String[]> tests1 = new HashMap<String, String[]>();
-
- tests1.put("lIntVar", new String[] { "0x3039", "030071", "11000000111001", "12345", "12345", "12345" });
- tests1.put("lDoubleVar", new String[] { "0x3039", "030071", "11000000111001", "12345", "12345.123449999999", "12345.123449999999" });
- tests1.put("lCharVar", new String[] { "0x6d", "0155", "1101101", "109", "109 'm'", "109 'm'" });
- tests1.put("lBoolVar", new String[] { "0x0", "0", "0", "0", "false", "false" });
-
- tests1.put("lIntArray[1]", new String[] { "0x3039", "030071", "11000000111001", "12345", "12345", "12345" });
- tests1.put("lDoubleArray[1]", new String[] { "0x3039", "030071", "11000000111001", "12345", "12345.123449999999", "12345.123449999999" });
- tests1.put("lCharArray[1]", new String[] { "0x6d", "0155", "1101101", "109", "109 'm'", "109 'm'" });
- tests1.put("lBoolArray[1]", new String[] { "0x0", "0", "0", "0", "false", "false" });
-
- tests1.put("*lIntPtr", new String[] { "0x3039", "030071", "11000000111001", "12345", "12345", "12345" });
- tests1.put("*lDoublePtr", new String[] { "0x3039", "030071", "11000000111001", "12345", "12345.123449999999", "12345.123449999999" });
- tests1.put("*lCharPtr", new String[] { "0x6d", "0155", "1101101", "109", "109 'm'", "109 'm'" });
- tests1.put("*lBoolPtr", new String[] { "0x0", "0", "0", "0", "false", "false" });
-
- tests1.put("lIntPtr2", new String[] { "0x1", "01", "1", "1", "0x1", "0x1" });
- tests1.put("lDoublePtr2", new String[] { "0x2345", "021505", "10001101000101", "9029", "0x2345", "0x2345" });
- // GDB says a char* is out of bounds, but not the other pointers???
- // tests1.put("CharPtr2", new String[] { "0x1234", "011064",
- // "1001000110100", "4660", "0x1234" });
- tests1.put("lBoolPtr2", new String[] { "0x123ABCDE", "02216536336", "10010001110101011110011011110", "305839326", "0x123ABCDE", "0x123ABCDE" });
-
- executeExpressionSubTests(tests1, SyncUtil.getStackFrame(SyncUtil.getExecutionContext(0), 0));
- }
-
+ doLaunch();
+ }
+
+ /**
+ * Test that we can correctly evaluate integer expressions.
+ */
+ @Test
+ public void testLiteralIntegerExpressions() throws Throwable {
+ doLaunch();
+
+ // Create a map of expressions and their expected values.
+ Map<String, String[]> tests = new HashMap<String, String[]>();
+
+ tests.put("0 + 0 - 0", new String[] { "0x0", "0", "0", "0", "0", "0" });
+ tests.put("3 + 4", new String[] { "0x7", "07", "111", "7", "7", "7" });
+ tests.put("3 + 4 * 5", new String[] { "0x17", "027", "10111", "23", "23", "23" });
+ tests.put("5 * 3 + 4", new String[] { "0x13", "023", "10011", "19", "19", "19" });
+ tests.put("5 * (3 + 4)", new String[] { "0x23", "043", "100011", "35", "35", "35" });
+ tests.put("10 - 15",
+ new String[] { "0xFFFFFFFB", "037777777773", "11111111111111111111111111111011", "-5", "-5", "-5" });
+ tests.put("10 + -15",
+ new String[] { "0xFFFFFFFB", "037777777773", "11111111111111111111111111111011", "-5", "-5", "-5" });
+
+ executeExpressionSubTests(tests, SyncUtil.getStackFrame(SyncUtil.getExecutionContext(0), 0));
+ }
+
+ /**
+ * Test that we can correctly evaluate floating-point expressions.
+ */
+ @Test
+ public void testLiteralFloatingPointExpressions() throws Throwable {
+ doLaunch();
+
+ // Create a map of expressions and their expected values.
+ Map<String, String[]> tests = new HashMap<String, String[]>();
+
+ tests.put("3.14159 + 1.1111", new String[] { "0x4", "04", "100", "4", "4.2526", "4.2526" });
+ tests.put("100.0 / 3.0", new String[] { "0x21", "041", "100001", "33", "33.3333", "33.3333" });
+ tests.put("-100.0 / 3.0", new String[] { "0xffffffffffffffdf", "01777777777777777777737",
+ "1111111111111111111111111111111111111111111111111111111111011111", "-33", "-33.3333", "-33.3333" });
+ tests.put("-100.0 / -3.0", new String[] { "0x21", "041", "100001", "33", "33.3333", "33.3333" });
+ executeExpressionSubTests(tests, false, SyncUtil.getStackFrame(SyncUtil.getExecutionContext(0), 0));
+
+ tests.clear();
+ tests.put("100.0 / 0.5", new String[] { "0xc8", "0310", "11001000", "200", "200", "200" });
+ executeExpressionSubTests(tests, true, SyncUtil.getStackFrame(SyncUtil.getExecutionContext(0), 0));
+
+ }
+
+ /**
+ * Test that we can correctly evaluate C expressions involving local
+ * variables.
+ */
+ @Test
+ public void testLocalVariables() throws Throwable {
+ doLaunch();
+
+ // Create a map of expressions to expected values.
+ Map<String, String[]> tests1 = new HashMap<String, String[]>();
+
+ tests1.put("lIntVar", new String[] { "0x3039", "030071", "11000000111001", "12345", "12345", "12345" });
+ tests1.put("lDoubleVar", new String[] { "0x3039", "030071", "11000000111001", "12345", "12345.123449999999",
+ "12345.123449999999" });
+ tests1.put("lCharVar", new String[] { "0x6d", "0155", "1101101", "109", "109 'm'", "109 'm'" });
+ tests1.put("lBoolVar", new String[] { "0x0", "0", "0", "0", "false", "false" });
+
+ tests1.put("lIntArray[1]", new String[] { "0x3039", "030071", "11000000111001", "12345", "12345", "12345" });
+ tests1.put("lDoubleArray[1]", new String[] { "0x3039", "030071", "11000000111001", "12345",
+ "12345.123449999999", "12345.123449999999" });
+ tests1.put("lCharArray[1]", new String[] { "0x6d", "0155", "1101101", "109", "109 'm'", "109 'm'" });
+ tests1.put("lBoolArray[1]", new String[] { "0x0", "0", "0", "0", "false", "false" });
+
+ tests1.put("*lIntPtr", new String[] { "0x3039", "030071", "11000000111001", "12345", "12345", "12345" });
+ tests1.put("*lDoublePtr", new String[] { "0x3039", "030071", "11000000111001", "12345", "12345.123449999999",
+ "12345.123449999999" });
+ tests1.put("*lCharPtr", new String[] { "0x6d", "0155", "1101101", "109", "109 'm'", "109 'm'" });
+ tests1.put("*lBoolPtr", new String[] { "0x0", "0", "0", "0", "false", "false" });
+
+ tests1.put("lIntPtr2", new String[] { "0x1", "01", "1", "1", "0x1", "0x1" });
+ tests1.put("lDoublePtr2", new String[] { "0x2345", "021505", "10001101000101", "9029", "0x2345", "0x2345" });
+ // GDB says a char* is out of bounds, but not the other pointers???
+ // tests1.put("CharPtr2", new String[] { "0x1234", "011064",
+ // "1001000110100", "4660", "0x1234" });
+ tests1.put("lBoolPtr2", new String[] { "0x123ABCDE", "02216536336", "10010001110101011110011011110",
+ "305839326", "0x123ABCDE", "0x123ABCDE" });
+
+ executeExpressionSubTests(tests1, SyncUtil.getStackFrame(SyncUtil.getExecutionContext(0), 0));
+ }
+
@Test
public void readMemoryArray() throws Throwable {
- doLaunch();
+ doLaunch();
IAddress address = evaluateExpression(SyncUtil.getStackFrame(SyncUtil.getExecutionContext(0), 0), "&lBoolPtr2");
@@ -402,7 +408,7 @@ public class PostMortemCoreTest extends BaseParametrizedTestCase {
// Get the memory block
MemoryByte[] buffer = SyncUtil.readMemory(fMemoryDmc, address, 0, 1, LENGTH);
-
+
assertEquals(LENGTH, buffer.length);
assertEquals(buffer[0].getValue(), 0xffffffde);
@@ -411,54 +417,59 @@ public class PostMortemCoreTest extends BaseParametrizedTestCase {
assertEquals(buffer[3].getValue(), 0x12);
}
- /**
- * Test that we support setting only the initial path with an absolute path.
- */
- @Ignore("Can't test without the UI")
- @Test
- public void testAbsoluteInitialPath() throws Throwable {
- }
- /**
- * Test that we support setting an invalid initial path with an absolute path.
- */
- @Ignore("Can't test without the UI")
- @Test
- public void testAbsoluteInitialPathInvalid() throws Throwable {
- }
- /**
- * Test that we support setting only the initial path with a relative path.
- */
- @Ignore("Can't test without the UI")
- @Test
- public void testRelativeInitialPath() throws Throwable {
- }
- /**
- * Test that we support an empty path
- */
- @Ignore("Can't test without the UI")
- @Test
- public void testEmptyInitialPath() throws Throwable {
- }
- /**
- * Test that we support a valid initial path using variables.
- */
- @Ignore("Can't test without the UI")
- @Test
- public void testInitialPathWithVariable() throws Throwable {
- }
- /**
- * Test that we support setting an invalid initial path with a relative path.
- */
- @Ignore("Can't test without the UI")
- @Test
- public void testRelativeInitialPathInvalid() throws Throwable {
- }
-
- private IAddress evaluateExpression(IDMContext ctx, String expression) throws Throwable
- {
- // Create the expression and format contexts
+ /**
+ * Test that we support setting only the initial path with an absolute path.
+ */
+ @Ignore("Can't test without the UI")
+ @Test
+ public void testAbsoluteInitialPath() throws Throwable {
+ }
+
+ /**
+ * Test that we support setting an invalid initial path with an absolute path.
+ */
+ @Ignore("Can't test without the UI")
+ @Test
+ public void testAbsoluteInitialPathInvalid() throws Throwable {
+ }
+
+ /**
+ * Test that we support setting only the initial path with a relative path.
+ */
+ @Ignore("Can't test without the UI")
+ @Test
+ public void testRelativeInitialPath() throws Throwable {
+ }
+
+ /**
+ * Test that we support an empty path
+ */
+ @Ignore("Can't test without the UI")
+ @Test
+ public void testEmptyInitialPath() throws Throwable {
+ }
+
+ /**
+ * Test that we support a valid initial path using variables.
+ */
+ @Ignore("Can't test without the UI")
+ @Test
+ public void testInitialPathWithVariable() throws Throwable {
+ }
+
+ /**
+ * Test that we support setting an invalid initial path with a relative path.
+ */
+ @Ignore("Can't test without the UI")
+ @Test
+ public void testRelativeInitialPathInvalid() throws Throwable {
+ }
+
+ private IAddress evaluateExpression(IDMContext ctx, String expression) throws Throwable {
+ // Create the expression and format contexts
final IExpressionDMContext expressionDMC = SyncUtil.createExpression(ctx, expression);
- final FormattedValueDMContext formattedValueDMC = SyncUtil.getFormattedValue(fExpService, expressionDMC, IFormattedValues.HEX_FORMAT);
+ final FormattedValueDMContext formattedValueDMC = SyncUtil.getFormattedValue(fExpService, expressionDMC,
+ IFormattedValues.HEX_FORMAT);
Query<FormattedValueDMData> query = new Query<FormattedValueDMData>() {
@Override
@@ -466,11 +477,11 @@ public class PostMortemCoreTest extends BaseParametrizedTestCase {
fExpService.getFormattedExpressionValue(formattedValueDMC, rm);
}
};
-
+
fSession.getExecutor().execute(query);
FormattedValueDMData value = null;
{
- value = query.get(TestsPlugin.massageTimeout(2000), TimeUnit.MILLISECONDS);
+ value = query.get(TestsPlugin.massageTimeout(2000), TimeUnit.MILLISECONDS);
}
return new Addr64(value.getFormattedValue());
@@ -478,7 +489,7 @@ public class PostMortemCoreTest extends BaseParametrizedTestCase {
/**
* Executes a group of sub-tests.
- *
+ *
* @param tests
* A Map in which the key is an expression to evaluate and the
* value is an array of expected values, one for each of the
@@ -496,118 +507,130 @@ public class PostMortemCoreTest extends BaseParametrizedTestCase {
* if, e.g., the gdb expression resolves to "1.23456789", but the
* caller only supplied "1.2345".
*/
- private void executeExpressionSubTests(final Map<String, String[]> tests, final boolean exact, IDMContext dmc)
- throws Throwable
- {
-
- // Now evaluate each of the above expressions and compare the actual
- // value against
- // the expected value.
- for (final String expressionToEvaluate : tests.keySet()) {
-
- // Get an IExpressionDMContext object representing the expression to
- // be evaluated.
- final IExpressionDMContext exprDMC = SyncUtil.createExpression(dmc, expressionToEvaluate);
-
- final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
-
- // Get the list of available format IDs for this expression and for
- // each one,
- // get the value of the expression
- fExpService.getExecutor().submit(new Runnable() {
- @Override
+ private void executeExpressionSubTests(final Map<String, String[]> tests, final boolean exact, IDMContext dmc)
+ throws Throwable {
+
+ // Now evaluate each of the above expressions and compare the actual
+ // value against
+ // the expected value.
+ for (final String expressionToEvaluate : tests.keySet()) {
+
+ // Get an IExpressionDMContext object representing the expression to
+ // be evaluated.
+ final IExpressionDMContext exprDMC = SyncUtil.createExpression(dmc, expressionToEvaluate);
+
+ final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
+
+ // Get the list of available format IDs for this expression and for
+ // each one,
+ // get the value of the expression
+ fExpService.getExecutor().submit(new Runnable() {
+ @Override
public void run() {
- fExpService.getAvailableFormats(exprDMC, new DataRequestMonitor<String[]>(
- fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
- final String[] formatIds = getData();
-
- // Now run the current sub-test using each of
- // the formats available for the type of
- // the expression in the sub-test.
-
- for (final String formatId : formatIds) {
- // Get a FormattedValueCMContext object for
- // the expression-formatID pair.
- final FormattedValueDMContext valueDmc = fExpService.getFormattedValueContext(
- exprDMC, formatId);
-
- // Increment the number of completed
- // requests to wait for, since we will send
- // multiple concurrent requests
- wait.increment();
-
- // Evaluate the expression represented by
- // the FormattedValueDMContext object
- // This actually evaluates the expression.
- fExpService.getFormattedExpressionValue(valueDmc,
- new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (!isSuccess()) {
- wait.waitFinished(getStatus());
- } else {
-
- // Get the
- // FormattedValueDMData
- // object from the waiter.
- FormattedValueDMData exprValueDMData = getData();
-
- final String[] expectedValues = tests.get(expressionToEvaluate);
-
- // Check the value of the expression for correctness.
- String actualValue = exprValueDMData.getFormattedValue();
- String expectedValue;
-
- if (formatId.equals(IFormattedValues.HEX_FORMAT))
- expectedValue = expectedValues[0];
- else if (formatId.equals(IFormattedValues.OCTAL_FORMAT))
- expectedValue = expectedValues[1];
- else if (formatId.equals(IFormattedValues.BINARY_FORMAT))
- expectedValue = expectedValues[2];
- else if (formatId.equals(IFormattedValues.DECIMAL_FORMAT))
- expectedValue = expectedValues[3];
- else if (formatId.equals(IFormattedValues.NATURAL_FORMAT))
- expectedValue = expectedValues[4];
- else if (formatId.equals(MIExpressions.DETAILS_FORMAT))
- expectedValue = expectedValues[5];
- else
- expectedValue = "[Unrecognized format ID: " + formatId + "]";
-
- if ((exact == false) &&
- (formatId.equals(IFormattedValues.NATURAL_FORMAT) || formatId.equals(MIExpressions.DETAILS_FORMAT)) &&
- (expectedValue.length() < actualValue.length())) {
- actualValue = actualValue.substring(0, expectedValue.length());
- }
-
- if (actualValue.equalsIgnoreCase(expectedValue)) {
- wait.waitFinished();
- } else {
- String errorMsg = "Failed to correctly evalutate '"
- + expressionToEvaluate + "': expected '" + expectedValue
- + "', got '" + actualValue + "'";
- wait.waitFinished(new Status(IStatus.ERROR,
- TestsPlugin.PLUGIN_ID, errorMsg, null));
- }
- }
- }
- });
- }
- }
- }
- });
- }
- });
- wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
- assertTrue(wait.getMessage(), wait.isOK());
- }
- }
-
- private void executeExpressionSubTests(final Map<String, String[]> tests, IDMContext dmc) throws Throwable {
- executeExpressionSubTests(tests, true, dmc);
- }
+ fExpService.getAvailableFormats(exprDMC,
+ new DataRequestMonitor<String[]>(fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+ final String[] formatIds = getData();
+
+ // Now run the current sub-test using each of
+ // the formats available for the type of
+ // the expression in the sub-test.
+
+ for (final String formatId : formatIds) {
+ // Get a FormattedValueCMContext object for
+ // the expression-formatID pair.
+ final FormattedValueDMContext valueDmc = fExpService
+ .getFormattedValueContext(exprDMC, formatId);
+
+ // Increment the number of completed
+ // requests to wait for, since we will send
+ // multiple concurrent requests
+ wait.increment();
+
+ // Evaluate the expression represented by
+ // the FormattedValueDMContext object
+ // This actually evaluates the expression.
+ fExpService.getFormattedExpressionValue(valueDmc,
+ new DataRequestMonitor<FormattedValueDMData>(
+ fExpService.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (!isSuccess()) {
+ wait.waitFinished(getStatus());
+ } else {
+
+ // Get the
+ // FormattedValueDMData
+ // object from the waiter.
+ FormattedValueDMData exprValueDMData = getData();
+
+ final String[] expectedValues = tests
+ .get(expressionToEvaluate);
+
+ // Check the value of the expression for correctness.
+ String actualValue = exprValueDMData
+ .getFormattedValue();
+ String expectedValue;
+
+ if (formatId.equals(IFormattedValues.HEX_FORMAT))
+ expectedValue = expectedValues[0];
+ else if (formatId.equals(IFormattedValues.OCTAL_FORMAT))
+ expectedValue = expectedValues[1];
+ else if (formatId
+ .equals(IFormattedValues.BINARY_FORMAT))
+ expectedValue = expectedValues[2];
+ else if (formatId
+ .equals(IFormattedValues.DECIMAL_FORMAT))
+ expectedValue = expectedValues[3];
+ else if (formatId
+ .equals(IFormattedValues.NATURAL_FORMAT))
+ expectedValue = expectedValues[4];
+ else if (formatId.equals(MIExpressions.DETAILS_FORMAT))
+ expectedValue = expectedValues[5];
+ else
+ expectedValue = "[Unrecognized format ID: "
+ + formatId + "]";
+
+ if ((exact == false)
+ && (formatId
+ .equals(IFormattedValues.NATURAL_FORMAT)
+ || formatId.equals(
+ MIExpressions.DETAILS_FORMAT))
+ && (expectedValue.length() < actualValue
+ .length())) {
+ actualValue = actualValue.substring(0,
+ expectedValue.length());
+ }
+
+ if (actualValue.equalsIgnoreCase(expectedValue)) {
+ wait.waitFinished();
+ } else {
+ String errorMsg = "Failed to correctly evalutate '"
+ + expressionToEvaluate + "': expected '"
+ + expectedValue + "', got '" + actualValue
+ + "'";
+ wait.waitFinished(new Status(IStatus.ERROR,
+ TestsPlugin.PLUGIN_ID, errorMsg, null));
+ }
+ }
+ }
+ });
+ }
+ }
+ }
+ });
+ }
+ });
+ wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
+ assertTrue(wait.getMessage(), wait.isOK());
+ }
+ }
+
+ private void executeExpressionSubTests(final Map<String, String[]> tests, IDMContext dmc) throws Throwable {
+ executeExpressionSubTests(tests, true, dmc);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/SourceLookupTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/SourceLookupTest.java
index 0843f532851..c47f654d26b 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/SourceLookupTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/SourceLookupTest.java
@@ -473,10 +473,10 @@ public class SourceLookupTest extends BaseParametrizedTestCase {
* the mailing list</a> and associated <a href=
* "https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=ec83d2110de6831ac2ed0e5a56dc33c60a477eb6">
* gdb/NEWS item</a> (although you have to dig quite deep on these changes.)
- *
+ *
* Therefore in version < 7.6 the MI frame info has file="SourceLookup.cc"
* and no fullname field. This means there is no path to source map against.
- *
+ *
* In version >= 7.6 the MI frame info has file="SourceLookup.cc",fullname=
* "<cdt.git path>/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/build/SourceLookup.cc"
* fields, so there is a path to do the mapping against. Recall that the
@@ -1100,7 +1100,7 @@ public class SourceLookupTest extends BaseParametrizedTestCase {
/**
* Terminate the session on the executor thread without blocking.
- *
+ *
* This models the way DsfTerminateCommand terminates the launches.
*/
protected void terminateAsync(DsfSession session) throws Exception {
@@ -1116,9 +1116,9 @@ public class SourceLookupTest extends BaseParametrizedTestCase {
/**
* Test that two launches can be launched and terminated without becoming
* interlocked.
- *
+ *
* This is a regression test for Bug 494650.
- *
+ *
* XXX: If this test fails as it did for the reason of Bug 494650, there is
* deadlock and the JVM does not recover, causing this test to timeout and
* all subsequent tests not to work.
@@ -1138,7 +1138,7 @@ public class SourceLookupTest extends BaseParametrizedTestCase {
* sufficient. However, it can happen that the first one terminates
* progresses sufficiently far that the deadlock does not happen on the
* second.
- *
+ *
* NOTE: Can't use launch.terminate() here because it terminates
* synchronously when adapters are not installed. Instead we need to
* issue the terminates in a non-blocking way on both the the executor
@@ -1153,7 +1153,7 @@ public class SourceLookupTest extends BaseParametrizedTestCase {
* executor thread. The UI thread is waiting by using a Query, and
* before the bug fix the two executor threads were waiting on each
* other using a Query too.
- *
+ *
* This test does not use the UI thread (aka main), but instead the
* JUnit test thread. We determine success if both launches terminate,
* because if they both terminate they have stayed responsive and
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/StepIntoSelectionTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/StepIntoSelectionTest.java
index 4cd2eda7d07..00da7d80ce8 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/StepIntoSelectionTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/StepIntoSelectionTest.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Alvaro Sanchez-Leon (Ericsson AB) - Support for Step into selection (bug 244865)
* Simon Marchi (Ericsson) - Fix atDoubleMethod* tests for older gdb (<= 7.3)
@@ -45,7 +45,7 @@ import org.junit.runners.Parameterized;
/**
* Tests Non Stop GDB RunControl "Step into Selection feature"
- *
+ *
*/
@SuppressWarnings("restriction")
@RunWith(Parameterized.class)
@@ -66,15 +66,9 @@ public class StepIntoSelectionTest extends BaseParametrizedTestCase {
protected int ADD_WITH_ARG_LINE;
protected int ADD_NO_ARG_LINE;
- protected static final String[] SOURCE_LINE_TAGS = {
- "FOO_LINE",
- "BAR_LINE",
- "ADD_WITH_ARG_LINE",
- "ADD_NO_ARG_LINE",
- };
- protected static final String[] HEADER_LINE_TAGS = {
- "VALUE_LINE",
- };
+ protected static final String[] SOURCE_LINE_TAGS = { "FOO_LINE", "BAR_LINE", "ADD_WITH_ARG_LINE",
+ "ADD_NO_ARG_LINE", };
+ protected static final String[] HEADER_LINE_TAGS = { "VALUE_LINE", };
//Target Functions
private final static FunctionDeclaration funcFoo = new FunctionDeclaration(null, "foo");
@@ -85,24 +79,24 @@ public class StepIntoSelectionTest extends BaseParametrizedTestCase {
private final static FunctionDeclaration funcAddWithArg = new FunctionDeclaration(null, "add");
static {
- funcBar.setParameterTypes(new String[]{"int"});
- funcRecursive.setParameterTypes(new String[]{"int"});
- funcAddWithArg.setParameterTypes(new String[]{"int"});
+ funcBar.setParameterTypes(new String[] { "int" });
+ funcRecursive.setParameterTypes(new String[] { "int" });
+ funcAddWithArg.setParameterTypes(new String[] { "int" });
}
class ResultContext {
MIStoppedEvent fEvent = null;
IExecutionDMContext fContext = null;
-
+
public ResultContext(MIStoppedEvent event, IExecutionDMContext context) {
this.fEvent = event;
this.fContext = context;
}
-
+
public MIStoppedEvent getEvent() {
return fEvent;
}
-
+
public IExecutionDMContext getContext() {
return fContext;
}
@@ -136,7 +130,8 @@ public class StepIntoSelectionTest extends BaseParametrizedTestCase {
public void doAfterTest() throws Exception {
super.doAfterTest();
- if (fServicesTracker!=null) fServicesTracker.dispose();
+ if (fServicesTracker != null)
+ fServicesTracker.dispose();
}
@Override
@@ -145,32 +140,30 @@ public class StepIntoSelectionTest extends BaseParametrizedTestCase {
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EXEC_PATH + EXEC_NAME);
}
- private void validateLocation(ISuspendedDMEvent suspendedEvent, String expectedFunction,
- String expectedFile, int expectedLine, int expectedDepth) throws Throwable {
+ private void validateLocation(ISuspendedDMEvent suspendedEvent, String expectedFunction, String expectedFile,
+ int expectedLine, int expectedDepth) throws Throwable {
assertNotNull(suspendedEvent);
assertTrue("Expected suspended event to be IMIDMEvent, but it was not.", suspendedEvent instanceof IMIDMEvent);
- Object miEvent = ((IMIDMEvent)suspendedEvent).getMIEvent();
-
+ Object miEvent = ((IMIDMEvent) suspendedEvent).getMIEvent();
+
assertTrue("Expected mi event to be MIStoppedEvent, but it was not.", miEvent instanceof MIStoppedEvent);
- MIStoppedEvent stoppedEvent = (MIStoppedEvent)miEvent;
-
+ MIStoppedEvent stoppedEvent = (MIStoppedEvent) miEvent;
+
// Validate that the last stopped frame received is at the specified location
MIFrame frame = stoppedEvent.getFrame();
- assertTrue("Not inside the expected function. Expected " +
- expectedFunction + " but got " +
- frame.getFunction(),
- frame.getFunction().endsWith(expectedFunction));
+ assertTrue(
+ "Not inside the expected function. Expected " + expectedFunction + " but got " + frame.getFunction(),
+ frame.getFunction().endsWith(expectedFunction));
assertEquals(expectedLine, frame.getLine());
-
- assertTrue("Not inside the expected file. Expected " +
- expectedFile + " but got " + frame.getFile(),
- frame.getFile().endsWith(expectedFile));
+
+ assertTrue("Not inside the expected file. Expected " + expectedFile + " but got " + frame.getFile(),
+ frame.getFile().endsWith(expectedFile));
int newDepth = SyncUtil.getStackDepth(stoppedEvent.getDMContext());
assertEquals(expectedDepth, newDepth);
- checkGdbIsSuspended();
+ checkGdbIsSuspended();
}
private void checkGdbIsSuspended() throws Throwable {
@@ -182,7 +175,7 @@ public class StepIntoSelectionTest extends BaseParametrizedTestCase {
}
};
fSession.getExecutor().execute(query);
-
+
boolean suspended = query.get(TestsPlugin.massageTimeout(5000), TimeUnit.SECONDS);
assertTrue("Target is running. It should have been suspended", suspended);
}
@@ -191,14 +184,10 @@ public class StepIntoSelectionTest extends BaseParametrizedTestCase {
* Perform a stepIntoSelection operation and return the SuspendedEvent indicating the
* stepInto has been completed.
*/
- private ISuspendedDMEvent triggerStepIntoSelection(final IExecutionDMContext exeContext,
- final String sourceName,
- final int targetLine,
- final IFunctionDeclaration function,
- final boolean skipBreakPoints)
- throws Throwable {
- ServiceEventWaitor<ISuspendedDMEvent> eventWaitor =
- new ServiceEventWaitor<ISuspendedDMEvent>(fSession, ISuspendedDMEvent.class);
+ private ISuspendedDMEvent triggerStepIntoSelection(final IExecutionDMContext exeContext, final String sourceName,
+ final int targetLine, final IFunctionDeclaration function, final boolean skipBreakPoints) throws Throwable {
+ ServiceEventWaitor<ISuspendedDMEvent> eventWaitor = new ServiceEventWaitor<ISuspendedDMEvent>(fSession,
+ ISuspendedDMEvent.class);
Query<Object> query = new Query<Object>() {
@Override
@@ -208,21 +197,18 @@ public class StepIntoSelectionTest extends BaseParametrizedTestCase {
};
fSession.getExecutor().execute(query);
query.get();
-
- return eventWaitor.waitForEvent(TestsPlugin.massageTimeout(10000));
+
+ return eventWaitor.waitForEvent(TestsPlugin.massageTimeout(10000));
}
/**
* Perform a stepIntoSelection operation and return the SuspendedEvent indicating the
* stepInto has been completed.
*/
- private ISuspendedDMEvent triggerRunToLine(final IExecutionDMContext exeContext,
- final String sourceName,
- final int targetLine,
- final boolean skipBreakPoints)
- throws Throwable {
- ServiceEventWaitor<ISuspendedDMEvent> eventWaitor =
- new ServiceEventWaitor<ISuspendedDMEvent>(fSession, ISuspendedDMEvent.class);
+ private ISuspendedDMEvent triggerRunToLine(final IExecutionDMContext exeContext, final String sourceName,
+ final int targetLine, final boolean skipBreakPoints) throws Throwable {
+ ServiceEventWaitor<ISuspendedDMEvent> eventWaitor = new ServiceEventWaitor<ISuspendedDMEvent>(fSession,
+ ISuspendedDMEvent.class);
Query<Object> query = new Query<Object>() {
@Override
@@ -232,8 +218,8 @@ public class StepIntoSelectionTest extends BaseParametrizedTestCase {
};
fSession.getExecutor().execute(query);
query.get();
-
- return eventWaitor.waitForEvent(TestsPlugin.massageTimeout(10000));
+
+ return eventWaitor.waitForEvent(TestsPlugin.massageTimeout(10000));
}
/**
@@ -241,33 +227,33 @@ public class StepIntoSelectionTest extends BaseParametrizedTestCase {
*/
@Test
public void atSameLine() throws Throwable {
- MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("sameLineTest");
- int originalDepth = SyncUtil.getStackDepth(stoppedEvent.getDMContext());
-
- FunctionDeclaration targetFunction = funcFoo;
-
- // StepInto the method
- ISuspendedDMEvent suspendedEvent = triggerStepIntoSelection(stoppedEvent.getDMContext(), SOURCE_NAME,
- stoppedEvent.getFrame().getLine(), targetFunction, false);
-
- validateLocation(suspendedEvent, targetFunction.getElementName(), SOURCE_NAME, FOO_LINE, originalDepth + 1);
+ MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("sameLineTest");
+ int originalDepth = SyncUtil.getStackDepth(stoppedEvent.getDMContext());
+
+ FunctionDeclaration targetFunction = funcFoo;
+
+ // StepInto the method
+ ISuspendedDMEvent suspendedEvent = triggerStepIntoSelection(stoppedEvent.getDMContext(), SOURCE_NAME,
+ stoppedEvent.getFrame().getLine(), targetFunction, false);
+
+ validateLocation(suspendedEvent, targetFunction.getElementName(), SOURCE_NAME, FOO_LINE, originalDepth + 1);
}
-
+
/**
* This test verifies that we can step into a selection from a later line than where we are currently.
*/
@Test
public void atLaterLine() throws Throwable {
- MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("laterLineTest");
- int originalDepth = SyncUtil.getStackDepth(stoppedEvent.getDMContext());
+ MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("laterLineTest");
+ int originalDepth = SyncUtil.getStackDepth(stoppedEvent.getDMContext());
- FunctionDeclaration targetFunction = funcFoo;
- int line = stoppedEvent.getFrame().getLine() + 3; // The method to stepInto is three lines below the start of the method
- // StepInto the method
- ISuspendedDMEvent suspendedEvent = triggerStepIntoSelection(stoppedEvent.getDMContext(), SOURCE_NAME,
- line, targetFunction, false);
+ FunctionDeclaration targetFunction = funcFoo;
+ int line = stoppedEvent.getFrame().getLine() + 3; // The method to stepInto is three lines below the start of the method
+ // StepInto the method
+ ISuspendedDMEvent suspendedEvent = triggerStepIntoSelection(stoppedEvent.getDMContext(), SOURCE_NAME, line,
+ targetFunction, false);
- validateLocation(suspendedEvent, targetFunction.getElementName(), SOURCE_NAME, FOO_LINE, originalDepth + 1);
+ validateLocation(suspendedEvent, targetFunction.getElementName(), SOURCE_NAME, FOO_LINE, originalDepth + 1);
}
/**
@@ -275,34 +261,34 @@ public class StepIntoSelectionTest extends BaseParametrizedTestCase {
*/
@Test
public void atLaterLineOnDifferentFile() throws Throwable {
- MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("laterLineDifferentFileTest");
- int originalDepth = SyncUtil.getStackDepth(stoppedEvent.getDMContext());
+ MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("laterLineDifferentFileTest");
+ int originalDepth = SyncUtil.getStackDepth(stoppedEvent.getDMContext());
- FunctionDeclaration targetFunction = funcValue;
- int line = stoppedEvent.getFrame().getLine() + 1; // The method to stepInto is one line below the start of the method
- // StepInto the method
- ISuspendedDMEvent suspendedEvent = triggerStepIntoSelection(stoppedEvent.getDMContext(), SOURCE_NAME,
- line, targetFunction, false);
+ FunctionDeclaration targetFunction = funcValue;
+ int line = stoppedEvent.getFrame().getLine() + 1; // The method to stepInto is one line below the start of the method
+ // StepInto the method
+ ISuspendedDMEvent suspendedEvent = triggerStepIntoSelection(stoppedEvent.getDMContext(), SOURCE_NAME, line,
+ targetFunction, false);
- validateLocation(suspendedEvent, targetFunction.getElementName(), HEADER_NAME, VALUE_LINE, originalDepth + 1);
+ validateLocation(suspendedEvent, targetFunction.getElementName(), HEADER_NAME, VALUE_LINE, originalDepth + 1);
}
-
+
/**
* This test verifies that we can step into a selection than has two method calls.
* We try to step into the deepest call.
*/
@Test
public void atDoubleMethodDeepCall() throws Throwable {
- MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("doubleMethodTest");
- int originalDepth = SyncUtil.getStackDepth(stoppedEvent.getDMContext());
+ MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("doubleMethodTest");
+ int originalDepth = SyncUtil.getStackDepth(stoppedEvent.getDMContext());
- FunctionDeclaration targetFunction = funcFoo;
- int line = stoppedEvent.getFrame().getLine() + 1; // The method to stepInto is one line below the start of the method
- // StepInto the method
- ISuspendedDMEvent suspendedEvent = triggerStepIntoSelection(stoppedEvent.getDMContext(), SOURCE_NAME,
- line, targetFunction, false);
+ FunctionDeclaration targetFunction = funcFoo;
+ int line = stoppedEvent.getFrame().getLine() + 1; // The method to stepInto is one line below the start of the method
+ // StepInto the method
+ ISuspendedDMEvent suspendedEvent = triggerStepIntoSelection(stoppedEvent.getDMContext(), SOURCE_NAME, line,
+ targetFunction, false);
- validateLocation(suspendedEvent, targetFunction.getElementName(), SOURCE_NAME, FOO_LINE, originalDepth + 1);
+ validateLocation(suspendedEvent, targetFunction.getElementName(), SOURCE_NAME, FOO_LINE, originalDepth + 1);
}
/**
@@ -311,16 +297,16 @@ public class StepIntoSelectionTest extends BaseParametrizedTestCase {
*/
@Test
public void atDoubleMethodShalowCall() throws Throwable {
- MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("doubleMethodTest");
- int originalDepth = SyncUtil.getStackDepth(stoppedEvent.getDMContext());
+ MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("doubleMethodTest");
+ int originalDepth = SyncUtil.getStackDepth(stoppedEvent.getDMContext());
- FunctionDeclaration targetFunction = funcBar;
- int line = stoppedEvent.getFrame().getLine() + 1; // The method to stepInto is one line below the start of the method
- // StepInto the method
- ISuspendedDMEvent suspendedEvent = triggerStepIntoSelection(stoppedEvent.getDMContext(), SOURCE_NAME,
- line, targetFunction, false);
+ FunctionDeclaration targetFunction = funcBar;
+ int line = stoppedEvent.getFrame().getLine() + 1; // The method to stepInto is one line below the start of the method
+ // StepInto the method
+ ISuspendedDMEvent suspendedEvent = triggerStepIntoSelection(stoppedEvent.getDMContext(), SOURCE_NAME, line,
+ targetFunction, false);
- validateLocation(suspendedEvent, targetFunction.getElementName(), SOURCE_NAME, BAR_LINE, originalDepth + 1);
+ validateLocation(suspendedEvent, targetFunction.getElementName(), SOURCE_NAME, BAR_LINE, originalDepth + 1);
}
/**
@@ -328,20 +314,20 @@ public class StepIntoSelectionTest extends BaseParametrizedTestCase {
*/
@Test
public void recursiveMethod() throws Throwable {
- MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("recursiveTest");
- int finalLine = stoppedEvent.getFrame().getLine();
- int originalDepth = SyncUtil.getStackDepth(stoppedEvent.getDMContext());
-
- FunctionDeclaration targetFunction = funcRecursive;
-
- int line = stoppedEvent.getFrame().getLine() + 2; // The method to stepInto is two lines below the start of the method
- // StepInto the method
- ISuspendedDMEvent suspendedEvent = triggerStepIntoSelection(stoppedEvent.getDMContext(), SOURCE_NAME,
- line, targetFunction, false);
-
- validateLocation(suspendedEvent, targetFunction.getElementName(), SOURCE_NAME, finalLine, originalDepth + 1);
+ MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("recursiveTest");
+ int finalLine = stoppedEvent.getFrame().getLine();
+ int originalDepth = SyncUtil.getStackDepth(stoppedEvent.getDMContext());
+
+ FunctionDeclaration targetFunction = funcRecursive;
+
+ int line = stoppedEvent.getFrame().getLine() + 2; // The method to stepInto is two lines below the start of the method
+ // StepInto the method
+ ISuspendedDMEvent suspendedEvent = triggerStepIntoSelection(stoppedEvent.getDMContext(), SOURCE_NAME, line,
+ targetFunction, false);
+
+ validateLocation(suspendedEvent, targetFunction.getElementName(), SOURCE_NAME, finalLine, originalDepth + 1);
}
-
+
/**
* This test verifies that if we try to step into a selection from an earlier line we will end up
* stopping at the first breakpoint that hits.
@@ -349,26 +335,26 @@ public class StepIntoSelectionTest extends BaseParametrizedTestCase {
@Test
public void atPreviousLine() throws Throwable {
String functionName = "laterLineTest";
- MIStoppedEvent stoppedEvent = SyncUtil.runToLocation(functionName);
- int originalLine = stoppedEvent.getFrame().getLine();
- int originalDepth = SyncUtil.getStackDepth(stoppedEvent.getDMContext());
+ MIStoppedEvent stoppedEvent = SyncUtil.runToLocation(functionName);
+ int originalLine = stoppedEvent.getFrame().getLine();
+ int originalDepth = SyncUtil.getStackDepth(stoppedEvent.getDMContext());
// Step past the function call
- stoppedEvent = SyncUtil.step(4, StepType.STEP_OVER);
- // Set a bp one line below. We will check that this breakpoint hits when a stepInto is done
- int bpline = originalLine + 4 + 1;
- SyncUtil.addBreakpoint(Integer.toString(bpline));
-
- FunctionDeclaration targetFunction = funcFoo;
- int line = originalLine + 3; // The method to stepInto is three lines below the start of the method
-
- // StepInto the method
- ISuspendedDMEvent suspendedEvent = triggerStepIntoSelection(stoppedEvent.getDMContext(), SOURCE_NAME,
- line, targetFunction, false);
-
- validateLocation(suspendedEvent, functionName, SOURCE_NAME, bpline, originalDepth);
+ stoppedEvent = SyncUtil.step(4, StepType.STEP_OVER);
+ // Set a bp one line below. We will check that this breakpoint hits when a stepInto is done
+ int bpline = originalLine + 4 + 1;
+ SyncUtil.addBreakpoint(Integer.toString(bpline));
+
+ FunctionDeclaration targetFunction = funcFoo;
+ int line = originalLine + 3; // The method to stepInto is three lines below the start of the method
+
+ // StepInto the method
+ ISuspendedDMEvent suspendedEvent = triggerStepIntoSelection(stoppedEvent.getDMContext(), SOURCE_NAME, line,
+ targetFunction, false);
+
+ validateLocation(suspendedEvent, functionName, SOURCE_NAME, bpline, originalDepth);
}
-
+
/**
* This test verifies that if we try to step into a selection from a later line that we will not reach, we will end up
* stopping at the first breakpoint that hits.
@@ -377,29 +363,28 @@ public class StepIntoSelectionTest extends BaseParametrizedTestCase {
public void atLaterLineThatIsNotHit() throws Throwable {
String functionName = "laterLineNotHitTest";
MIStoppedEvent stoppedEvent = SyncUtil.runToLocation(functionName);
- int originalDepth = SyncUtil.getStackDepth(stoppedEvent.getDMContext());
+ int originalDepth = SyncUtil.getStackDepth(stoppedEvent.getDMContext());
- FunctionDeclaration targetFunction = funcFoo;
- int line = stoppedEvent.getFrame().getLine() + 2; // The method to stepInto is two lines below the start of the method
- // Except we'll never reach it
- // Set a bp a couple of lines below. We will check that this breakpoint hits and the stepInto is cancelled
- int bpline = line + 2;
- SyncUtil.addBreakpoint(Integer.toString(bpline));
+ FunctionDeclaration targetFunction = funcFoo;
+ int line = stoppedEvent.getFrame().getLine() + 2; // The method to stepInto is two lines below the start of the method
+ // Except we'll never reach it
+ // Set a bp a couple of lines below. We will check that this breakpoint hits and the stepInto is cancelled
+ int bpline = line + 2;
+ SyncUtil.addBreakpoint(Integer.toString(bpline));
- // StepInto the method
- ISuspendedDMEvent suspendedEvent = triggerStepIntoSelection(stoppedEvent.getDMContext(), SOURCE_NAME,
- line, targetFunction, false); // Don't skip breakpoints
+ // StepInto the method
+ ISuspendedDMEvent suspendedEvent = triggerStepIntoSelection(stoppedEvent.getDMContext(), SOURCE_NAME, line,
+ targetFunction, false); // Don't skip breakpoints
- validateLocation(suspendedEvent, functionName, SOURCE_NAME, bpline, originalDepth);
+ validateLocation(suspendedEvent, functionName, SOURCE_NAME, bpline, originalDepth);
- // Make sure the step to selection operation is no longer active by triggering a run to line before the step into selection line
- suspendedEvent = triggerRunToLine(stoppedEvent.getDMContext(), SOURCE_NAME,
- bpline + 1, false);
-
- validateLocation(suspendedEvent, functionName, SOURCE_NAME, bpline + 1, originalDepth);
+ // Make sure the step to selection operation is no longer active by triggering a run to line before the step into selection line
+ suspendedEvent = triggerRunToLine(stoppedEvent.getDMContext(), SOURCE_NAME, bpline + 1, false);
+
+ validateLocation(suspendedEvent, functionName, SOURCE_NAME, bpline + 1, originalDepth);
}
-
+
/**
* This test verifies that when specified, we stop at a breakpoint that is hit before the StepIntoSelection
* is completed.
@@ -407,50 +392,49 @@ public class StepIntoSelectionTest extends BaseParametrizedTestCase {
@Test
public void atLaterLineStopAtBreakpoint() throws Throwable {
String functionName = "laterLineTest";
- MIStoppedEvent stoppedEvent = SyncUtil.runToLocation(functionName);
- int originalDepth = SyncUtil.getStackDepth(stoppedEvent.getDMContext());
- int originalLine = stoppedEvent.getFrame().getLine();
-
- // Set a breakpoint before the stepInto line
- SyncUtil.addBreakpoint(Integer.toString(originalLine+1));
-
- int line = originalLine + 3; // The method to stepInto is three lines below the start of the method
- // StepInto the method
- ISuspendedDMEvent suspendedEvent = triggerStepIntoSelection(stoppedEvent.getDMContext(), SOURCE_NAME,
- line, funcFoo, false);
-
- validateLocation(suspendedEvent, functionName, SOURCE_NAME, originalLine + 1, originalDepth);
+ MIStoppedEvent stoppedEvent = SyncUtil.runToLocation(functionName);
+ int originalDepth = SyncUtil.getStackDepth(stoppedEvent.getDMContext());
+ int originalLine = stoppedEvent.getFrame().getLine();
+
+ // Set a breakpoint before the stepInto line
+ SyncUtil.addBreakpoint(Integer.toString(originalLine + 1));
+
+ int line = originalLine + 3; // The method to stepInto is three lines below the start of the method
+ // StepInto the method
+ ISuspendedDMEvent suspendedEvent = triggerStepIntoSelection(stoppedEvent.getDMContext(), SOURCE_NAME, line,
+ funcFoo, false);
+
+ validateLocation(suspendedEvent, functionName, SOURCE_NAME, originalLine + 1, originalDepth);
// Make sure the step to selection operation is no longer active by triggering a run to line before the step into selection line
- suspendedEvent = triggerRunToLine(stoppedEvent.getDMContext(), SOURCE_NAME,
- originalLine + 2, false);
-
- validateLocation(suspendedEvent, functionName, SOURCE_NAME, originalLine + 2, originalDepth);
+ suspendedEvent = triggerRunToLine(stoppedEvent.getDMContext(), SOURCE_NAME, originalLine + 2, false);
+
+ validateLocation(suspendedEvent, functionName, SOURCE_NAME, originalLine + 2, originalDepth);
}
-
+
/**
* This test verifies that when specified, we ignore all breakpoints that are hit before the StepIntoSelection
* is completed.
*/
@Test
public void atLaterLineSkipBreakpoints() throws Throwable {
- MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("laterLineTest");
- int originalDepth = SyncUtil.getStackDepth(stoppedEvent.getDMContext());
- int originalLine = stoppedEvent.getFrame().getLine();
+ MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("laterLineTest");
+ int originalDepth = SyncUtil.getStackDepth(stoppedEvent.getDMContext());
+ int originalLine = stoppedEvent.getFrame().getLine();
- // Set two breakpoints before the stepInto line
- SyncUtil.addBreakpoint(Integer.toString(originalLine+1));
- SyncUtil.addBreakpoint(Integer.toString(originalLine+2));
-
- int line = originalLine + 3; // The method to stepInto is three lines below the start of the method
+ // Set two breakpoints before the stepInto line
+ SyncUtil.addBreakpoint(Integer.toString(originalLine + 1));
+ SyncUtil.addBreakpoint(Integer.toString(originalLine + 2));
- FunctionDeclaration targetFunction = funcFoo;
+ int line = originalLine + 3; // The method to stepInto is three lines below the start of the method
- // StepInto the method
- ISuspendedDMEvent suspendedEvent = triggerStepIntoSelection(stoppedEvent.getDMContext(), SOURCE_NAME,
- line, targetFunction, true);
+ FunctionDeclaration targetFunction = funcFoo;
+
+ // StepInto the method
+ ISuspendedDMEvent suspendedEvent = triggerStepIntoSelection(stoppedEvent.getDMContext(), SOURCE_NAME, line,
+ targetFunction, true);
- validateLocation(suspendedEvent, targetFunction.getElementName(), SOURCE_NAME, FOO_LINE, originalDepth + 1);
+ validateLocation(suspendedEvent, targetFunction.getElementName(), SOURCE_NAME, FOO_LINE, originalDepth + 1);
}
private void atDoubleMethodStopAtBreakpointCommon(int foo_line) throws Throwable {
@@ -464,10 +448,10 @@ public class StepIntoSelectionTest extends BaseParametrizedTestCase {
FunctionDeclaration targetFunction = funcBar;
int line = stoppedEvent.getFrame().getLine() + 1; // The method to stepInto is one line below the start of the method
// StepInto the method
- ISuspendedDMEvent suspendedEvent = triggerStepIntoSelection(stoppedEvent.getDMContext(), SOURCE_NAME,
- line, targetFunction, false); // Set not to skip breakpoints, but it should have no effect
+ ISuspendedDMEvent suspendedEvent = triggerStepIntoSelection(stoppedEvent.getDMContext(), SOURCE_NAME, line,
+ targetFunction, false); // Set not to skip breakpoints, but it should have no effect
- validateLocation(suspendedEvent, targetFunction.getElementName(), SOURCE_NAME, BAR_LINE, originalDepth + 1);
+ validateLocation(suspendedEvent, targetFunction.getElementName(), SOURCE_NAME, BAR_LINE, originalDepth + 1);
}
/**
@@ -504,8 +488,8 @@ public class StepIntoSelectionTest extends BaseParametrizedTestCase {
FunctionDeclaration targetFunction = funcBar;
int line = stoppedEvent.getFrame().getLine() + 1; // The method to stepInto is one line below the start of the method
// StepInto the method
- ISuspendedDMEvent suspendedEvent = triggerStepIntoSelection(stoppedEvent.getDMContext(), SOURCE_NAME,
- line, targetFunction, true); // Set skip breakpoints, which should have non impact
+ ISuspendedDMEvent suspendedEvent = triggerStepIntoSelection(stoppedEvent.getDMContext(), SOURCE_NAME, line,
+ targetFunction, true); // Set skip breakpoints, which should have non impact
validateLocation(suspendedEvent, targetFunction.getElementName(), SOURCE_NAME, BAR_LINE, originalDepth + 1);
}
@@ -540,27 +524,29 @@ public class StepIntoSelectionTest extends BaseParametrizedTestCase {
*/
@Test
public void diffMethodByArgsNumber() throws Throwable {
- MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("methodWithDiffArgsNumberTest");
- int originalDepth = SyncUtil.getStackDepth(stoppedEvent.getDMContext());
+ MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("methodWithDiffArgsNumberTest");
+ int originalDepth = SyncUtil.getStackDepth(stoppedEvent.getDMContext());
- FunctionDeclaration targetFunction = funcAddWithArg;
- // StepInto the method
- ISuspendedDMEvent suspendedEvent = triggerStepIntoSelection(stoppedEvent.getDMContext(), SOURCE_NAME,
- stoppedEvent.getFrame().getLine(), targetFunction, false);
+ FunctionDeclaration targetFunction = funcAddWithArg;
+ // StepInto the method
+ ISuspendedDMEvent suspendedEvent = triggerStepIntoSelection(stoppedEvent.getDMContext(), SOURCE_NAME,
+ stoppedEvent.getFrame().getLine(), targetFunction, false);
- validateLocation(suspendedEvent, targetFunction.getElementName(), SOURCE_NAME, ADD_WITH_ARG_LINE, originalDepth + 1);
+ validateLocation(suspendedEvent, targetFunction.getElementName(), SOURCE_NAME, ADD_WITH_ARG_LINE,
+ originalDepth + 1);
}
@Test
public void diffMethodByArgsNumber2() throws Throwable {
- MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("methodWithDiffArgsNumberTest");
- int originalDepth = SyncUtil.getStackDepth(stoppedEvent.getDMContext());
+ MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("methodWithDiffArgsNumberTest");
+ int originalDepth = SyncUtil.getStackDepth(stoppedEvent.getDMContext());
- FunctionDeclaration targetFunction = funcAddNoArg;
- // StepInto the method
- ISuspendedDMEvent suspendedEvent = triggerStepIntoSelection(stoppedEvent.getDMContext(), SOURCE_NAME,
- stoppedEvent.getFrame().getLine(), targetFunction, false);
+ FunctionDeclaration targetFunction = funcAddNoArg;
+ // StepInto the method
+ ISuspendedDMEvent suspendedEvent = triggerStepIntoSelection(stoppedEvent.getDMContext(), SOURCE_NAME,
+ stoppedEvent.getFrame().getLine(), targetFunction, false);
- validateLocation(suspendedEvent, targetFunction.getElementName(), SOURCE_NAME, ADD_NO_ARG_LINE, originalDepth + 1);
+ validateLocation(suspendedEvent, targetFunction.getElementName(), SOURCE_NAME, ADD_NO_ARG_LINE,
+ originalDepth + 1);
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/SuiteGdb.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/SuiteGdb.java
index 48b5718437a..29c3e7f7030 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/SuiteGdb.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/SuiteGdb.java
@@ -36,35 +36,16 @@ import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({
// new style tests
- MIBreakpointsTest.class,
- MICatchpointsTest.class,
- MIRegistersTest.class,
- MIExpressionsTest.class,
- LaunchConfigurationAndRestartTest.class,
- SourceLookupTest.class,
- StepIntoSelectionTest.class,
- OperationsWhileTargetIsRunningTest.class,
- MIModifiedServicesTest.class,
- MIRunControlTest.class,
- MIRunControlTargetAvailableTest.class,
- MIRunControlReverseTest.class,
- GDBPatternMatchingExpressionsTest.class,
- GDBMultiNonStopRunControlTest.class,
- GDBConsoleBreakpointsTest.class,
- MIRunControlNonStopTargetAvailableTest.class,
- MIExpressionsNonStopTest.class,
- OperationsWhileTargetIsRunningNonStopTest.class,
- StepIntoSelectionNonStopTest.class,
- GDBRemoteTracepointsTest.class,
- TraceFileTest.class,
- GDBConsoleSynchronizingTest.class,
- MIMemoryTest.class,
- MIDisassemblyTest.class,
- GDBProcessesTest.class,
- PostMortemCoreTest.class,
- CommandTimeoutTest.class,
- ThreadStackFrameSyncTest.class,
- CommandLineArgsTest.class,
+ MIBreakpointsTest.class, MICatchpointsTest.class, MIRegistersTest.class, MIExpressionsTest.class,
+ LaunchConfigurationAndRestartTest.class, SourceLookupTest.class, StepIntoSelectionTest.class,
+ OperationsWhileTargetIsRunningTest.class, MIModifiedServicesTest.class, MIRunControlTest.class,
+ MIRunControlTargetAvailableTest.class, MIRunControlReverseTest.class, GDBPatternMatchingExpressionsTest.class,
+ GDBMultiNonStopRunControlTest.class, GDBConsoleBreakpointsTest.class,
+ MIRunControlNonStopTargetAvailableTest.class, MIExpressionsNonStopTest.class,
+ OperationsWhileTargetIsRunningNonStopTest.class, StepIntoSelectionNonStopTest.class,
+ GDBRemoteTracepointsTest.class, TraceFileTest.class, GDBConsoleSynchronizingTest.class, MIMemoryTest.class,
+ MIDisassemblyTest.class, GDBProcessesTest.class, PostMortemCoreTest.class, CommandTimeoutTest.class,
+ ThreadStackFrameSyncTest.class, CommandLineArgsTest.class,
/* Add your test class here */
})
public class SuiteGdb {
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/TraceFileTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/TraceFileTest.java
index 26b2a2ae02a..4b17bfbe7ba 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/TraceFileTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/TraceFileTest.java
@@ -73,10 +73,7 @@ public class TraceFileTest extends BaseParametrizedTestCase {
private final static String TRACE_NAME = "trace";
private final static String TRACE_FILE_PATH = EXEC_PATH + TRACE_NAME;
// Breakpoint tags in TracepointTestApp.cc
- public static final String[] LINE_TAGS = new String[] {
- "IF_X_NE_A",
- "INCR_X",
- };
+ public static final String[] LINE_TAGS = new String[] { "IF_X_NE_A", "INCR_X", };
private final static String END_FUNCTION = "lastCall";
private final static String TEVAL_STRING = "a";
private final static String COLLECT_STRING1 = "x";
@@ -90,41 +87,40 @@ public class TraceFileTest extends BaseParametrizedTestCase {
private ITraceTargetDMContext fTraceTargetDmc;
private boolean suppressRemoveAllPlatformBreakpoints;
-
- @Override
+ @Override
public void doBeforeTest() throws Exception {
// GDB tracepoints are only supported on a remote target (e.g., using gdbserver)
- assumeRemoteSession();
+ assumeRemoteSession();
resolveLineTagLocations(SOURCE_NAME, LINE_TAGS);
- assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_4);
- removeTeminatedLaunchesBeforeTest();
- // Suppress settings of the launch attributes and launching.
- // Each test sets its own launch attributes
+ assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_4);
+ removeTeminatedLaunchesBeforeTest();
+ // Suppress settings of the launch attributes and launching.
+ // Each test sets its own launch attributes
}
- @AfterClass
- public static void doAfterClassTraceFileTest_7_4() {
- try {
- // Make sure we don't have any tracepoint actions
- // or any kind of breakpoints in the workspace
- // so that tests run after this class are not affected
+ @AfterClass
+ public static void doAfterClassTraceFileTest_7_4() {
+ try {
+ // Make sure we don't have any tracepoint actions
+ // or any kind of breakpoints in the workspace
+ // so that tests run after this class are not affected
deleteActionsAndBreakpoints();
} catch (Throwable e) {
System.out.println("ERROR: Failed to delete all breakpoints");
}
- }
-
+ }
+
/**
* Some tests call doBefore/After in the middle of their test and rely on
* platform breakpoints to survive that step. So override with the ability
* to disable.
*/
@Override
- public void removeAllPlatformBreakpoints() throws CoreException {
- if (!suppressRemoveAllPlatformBreakpoints) {
- super.removeAllPlatformBreakpoints();
- }
- }
+ public void removeAllPlatformBreakpoints() throws CoreException {
+ if (!suppressRemoveAllPlatformBreakpoints) {
+ super.removeAllPlatformBreakpoints();
+ }
+ }
@Override
@After
@@ -144,17 +140,17 @@ public class TraceFileTest extends BaseParametrizedTestCase {
* This method implements the following steps.
* 1. Starts a remote session
* 2. Sets two tracepoints in data/launch/src/TracepointTestApp.cc
- * The first tracepoint's command is "teval a".
- * The second tracepoint's commands are "collect counter" and "collect $regs".
- * 3. Sets a regular breakpoint at the end of the source file.
+ * The first tracepoint's command is "teval a".
+ * The second tracepoint's commands are "collect counter" and "collect $regs".
+ * 3. Sets a regular breakpoint at the end of the source file.
* 4. Starts tracing
* 5. Resumes and runs until the breakpoint is hit
* 6. Stops tracing
* 7. Saves the trace data into a file (data/launch/bin/trace).
*/
protected void createTraceFile() throws Throwable {
- // Make sure that there are no tracepoint actions and no platform breakpoints in the workspace.
- deleteActionsAndBreakpoints();
+ // Make sure that there are no tracepoint actions and no platform breakpoints in the workspace.
+ deleteActionsAndBreakpoints();
deleteOldTraceFile();
startRemoteSession();
@@ -163,7 +159,7 @@ public class TraceFileTest extends BaseParametrizedTestCase {
startTracing();
MIStoppedEvent stoppedEvent = SyncUtil.resumeUntilStopped();
assertTrue(stoppedEvent instanceof MIBreakpointHitEvent
- && ((MIBreakpointHitEvent)stoppedEvent).getNumber().equals(bptDMC.getReference()));
+ && ((MIBreakpointHitEvent) stoppedEvent).getNumber().equals(bptDMC.getReference()));
stopTracing();
saveTraceData();
}
@@ -184,166 +180,168 @@ public class TraceFileTest extends BaseParametrizedTestCase {
createTraceFile();
}
- /**
- * This test sets up by first creating a trace file
- * by calling {@link #createTraceFile}
- *
- * It then removes all existing tracepoint actions and tracepoints
- * and verifies that corresponding platform tracepoints with the proper
- * actions are created.
- */
- @Test
- public void testTraceFile() throws Throwable {
- // This test will force a local post-mortem session, so only run it in local mode
+ /**
+ * This test sets up by first creating a trace file
+ * by calling {@link #createTraceFile}
+ *
+ * It then removes all existing tracepoint actions and tracepoints
+ * and verifies that corresponding platform tracepoints with the proper
+ * actions are created.
+ */
+ @Test
+ public void testTraceFile() throws Throwable {
+ // This test will force a local post-mortem session, so only run it in local mode
Assume.assumeTrue("Skipping remote", !remote);
try {
- createTraceFile();
- suppressRemoveAllPlatformBreakpoints = true;
- try {
- // Cleanup the interim launch that we just caused
- doAfterTest();
- // Setup for the upcoming launch
- doBeforeTest();
- } finally {
- suppressRemoveAllPlatformBreakpoints = false;
- }
- } catch (Throwable t) {
- // If we cannot create the trace file, ignore the test using the
- // assume check below. The reason for the failure could be a missing
- // gdbserver, and we don't want to fail a local test due to that
- }
-
+ createTraceFile();
+ suppressRemoveAllPlatformBreakpoints = true;
+ try {
+ // Cleanup the interim launch that we just caused
+ doAfterTest();
+ // Setup for the upcoming launch
+ doBeforeTest();
+ } finally {
+ suppressRemoveAllPlatformBreakpoints = false;
+ }
+ } catch (Throwable t) {
+ // If we cannot create the trace file, ignore the test using the
+ // assume check below. The reason for the failure could be a missing
+ // gdbserver, and we don't want to fail a local test due to that
+ }
+
Assume.assumeTrue("Cannot find trace file: " + TRACE_FILE_PATH, new File(TRACE_FILE_PATH).exists());
- // Make sure that there are no tracepoint actions and no platform breakpoints in the workspace.
- deleteActionsAndBreakpoints();
-
- startTraceFileSession();
- // Verify that required tracepoints and new tracepoint actions are created.
- checkActionsAndTracepoints();
- }
-
- /**
- * This test sets up by first creating a trace file and importing it back
- * by calling {@link #testTraceFile} which also calls {@link #createTraceFile}
-
- * It then verifies that the tracepoint actions and platform tracepoints
- * created by {@link #testTraceFile()} are associated with the corresponding target
- * tracepoints and are not created a second time.
- */
- @Test
- public void testTraceFileWithExistingTracepoints() throws Throwable {
- // This test will force a local post-mortem session, so only run it in local mode
+ // Make sure that there are no tracepoint actions and no platform breakpoints in the workspace.
+ deleteActionsAndBreakpoints();
+
+ startTraceFileSession();
+ // Verify that required tracepoints and new tracepoint actions are created.
+ checkActionsAndTracepoints();
+ }
+
+ /**
+ * This test sets up by first creating a trace file and importing it back
+ * by calling {@link #testTraceFile} which also calls {@link #createTraceFile}
+
+ * It then verifies that the tracepoint actions and platform tracepoints
+ * created by {@link #testTraceFile()} are associated with the corresponding target
+ * tracepoints and are not created a second time.
+ */
+ @Test
+ public void testTraceFileWithExistingTracepoints() throws Throwable {
+ // This test will force a local post-mortem session, so only run it in local mode
Assume.assumeTrue("Skipping remote", !remote);
// This test requires the presence of tracepoints created by another test.
// To allow our current test to be independent, we explicitly call
- // the required test ourselves.
+ // the required test ourselves.
testTraceFile();
suppressRemoveAllPlatformBreakpoints = true;
try {
- // Cleanup the interim launch that we just caused
- doAfterTest();
- // Setup for the upcoming launch
- clearLineTags();
- doBeforeTest();
+ // Cleanup the interim launch that we just caused
+ doAfterTest();
+ // Setup for the upcoming launch
+ clearLineTags();
+ doBeforeTest();
} finally {
suppressRemoveAllPlatformBreakpoints = false;
}
// Verify that actions and tracepoints required for this test are in place.
- checkActionsAndTracepoints();
- startTraceFileSession();
- // Verify that no new platform tracepoints or new tracepoint actions are created.
- checkActionsAndTracepoints();
- }
-
- private void startTraceFileSession() throws Throwable {
- // Set launch attributes
- super.setLaunchAttributes();
+ checkActionsAndTracepoints();
+ startTraceFileSession();
+ // Verify that no new platform tracepoints or new tracepoint actions are created.
+ checkActionsAndTracepoints();
+ }
+
+ private void startTraceFileSession() throws Throwable {
+ // Set launch attributes
+ super.setLaunchAttributes();
// Set a working directory for GDB that is different than eclipse's directory.
// This allows us to make sure we properly handle finding the core file,
// especially in the case of a relative path
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, "${workspace_loc}");
// Because we just set a different working directory, we must use an absolute path for the program
- String absoluteProgram = new Path(EXEC_PATH + EXEC_NAME).toFile().getAbsolutePath();
- setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, absoluteProgram);
+ String absoluteProgram = new Path(EXEC_PATH + EXEC_NAME).toFile().getAbsolutePath();
+ setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, absoluteProgram);
- // Set post-mortem launch
+ // Set post-mortem launch
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
- ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE);
+ ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE);
// Set post-mortem type to trace file
setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_POST_MORTEM_TYPE,
- IGDBLaunchConfigurationConstants.DEBUGGER_POST_MORTEM_TRACE_FILE);
+ IGDBLaunchConfigurationConstants.DEBUGGER_POST_MORTEM_TRACE_FILE);
// Set core file path
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, TRACE_FILE_PATH);
doLaunch();
- // Allow time to create tracepoint actions
- Thread.sleep(1000);
- }
-
- /**
- * Deletes all tracepoint actions and all existing platform breakpoints.
- */
- private static void deleteActionsAndBreakpoints() throws Throwable {
- TracepointActionManager tam = TracepointActionManager.getInstance();
- IBreakpointManager bm = DebugPlugin.getDefault().getBreakpointManager();
-
- // Delete all existing actions
- @SuppressWarnings( "unchecked" )
- ArrayList<ITracepointAction> actions = (ArrayList<ITracepointAction>)tam.getActions().clone();
- for (ITracepointAction a : actions) {
- tam.deleteAction(a);
- }
-
- IBreakpoint[] bpts = bm.getBreakpoints();
- for (IBreakpoint b : bpts) {
- bm.removeBreakpoint(b, true);
- }
- }
-
- /**
- * Checks whether there are only two platform tracepoints and three tracepoint actions.
- */
- private void checkActionsAndTracepoints() throws Throwable {
- TracepointActionManager tam = TracepointActionManager.getInstance();
- IBreakpointManager bm = DebugPlugin.getDefault().getBreakpointManager();
- ArrayList<ITracepointAction> actions = tam.getActions();
- IBreakpoint[] bpts = bm.getBreakpoints();
- actions = tam.getActions();
- assertTrue(String.format("Unexpected count of tracepoint actions: %d", actions.size()), actions.size() == 3);
- bpts = bm.getBreakpoints();
- assertTrue(String.format("Unexpected count of breakpoints: %d", bpts.length), bpts.length == 2);
- for (IBreakpoint b : bpts) {
- assertTrue(b instanceof ICTracepoint);
- checkTracepoint((ICTracepoint)b);
- }
- }
-
- private void checkTracepoint(ICTracepoint tracepoint) throws Throwable {
- TracepointActionManager tam = TracepointActionManager.getInstance();
+ // Allow time to create tracepoint actions
+ Thread.sleep(1000);
+ }
+
+ /**
+ * Deletes all tracepoint actions and all existing platform breakpoints.
+ */
+ private static void deleteActionsAndBreakpoints() throws Throwable {
+ TracepointActionManager tam = TracepointActionManager.getInstance();
+ IBreakpointManager bm = DebugPlugin.getDefault().getBreakpointManager();
+
+ // Delete all existing actions
+ @SuppressWarnings("unchecked")
+ ArrayList<ITracepointAction> actions = (ArrayList<ITracepointAction>) tam.getActions().clone();
+ for (ITracepointAction a : actions) {
+ tam.deleteAction(a);
+ }
+
+ IBreakpoint[] bpts = bm.getBreakpoints();
+ for (IBreakpoint b : bpts) {
+ bm.removeBreakpoint(b, true);
+ }
+ }
+
+ /**
+ * Checks whether there are only two platform tracepoints and three tracepoint actions.
+ */
+ private void checkActionsAndTracepoints() throws Throwable {
+ TracepointActionManager tam = TracepointActionManager.getInstance();
+ IBreakpointManager bm = DebugPlugin.getDefault().getBreakpointManager();
+ ArrayList<ITracepointAction> actions = tam.getActions();
+ IBreakpoint[] bpts = bm.getBreakpoints();
+ actions = tam.getActions();
+ assertTrue(String.format("Unexpected count of tracepoint actions: %d", actions.size()), actions.size() == 3);
+ bpts = bm.getBreakpoints();
+ assertTrue(String.format("Unexpected count of breakpoints: %d", bpts.length), bpts.length == 2);
+ for (IBreakpoint b : bpts) {
+ assertTrue(b instanceof ICTracepoint);
+ checkTracepoint((ICTracepoint) b);
+ }
+ }
+
+ private void checkTracepoint(ICTracepoint tracepoint) throws Throwable {
+ TracepointActionManager tam = TracepointActionManager.getInstance();
assertTrue(SOURCE_NAME.equals(new Path(tracepoint.getFileName()).lastSegment()));
- assertTrue(getLineForTag("IF_X_NE_A") == tracepoint.getLineNumber() || getLineForTag("INCR_X") == tracepoint.getLineNumber());
- String[] actionNames =
- ((String)tracepoint.getMarker().getAttribute(BreakpointActionManager.BREAKPOINT_ACTION_ATTRIBUTE)).split(TracepointActionManager.TRACEPOINT_ACTION_DELIMITER);
+ assertTrue(getLineForTag("IF_X_NE_A") == tracepoint.getLineNumber()
+ || getLineForTag("INCR_X") == tracepoint.getLineNumber());
+ String[] actionNames = ((String) tracepoint.getMarker()
+ .getAttribute(BreakpointActionManager.BREAKPOINT_ACTION_ATTRIBUTE))
+ .split(TracepointActionManager.TRACEPOINT_ACTION_DELIMITER);
for (String name : actionNames) {
ITracepointAction a = tam.findAction(name);
assertNotNull(a);
if (a instanceof EvaluateAction) {
- assertTrue(TEVAL_STRING.equals(((EvaluateAction)a).getEvalString()));
+ assertTrue(TEVAL_STRING.equals(((EvaluateAction) a).getEvalString()));
}
if (a instanceof CollectAction) {
- assertTrue(COLLECT_STRING1.equals(((CollectAction)a).getCollectString())
- || COLLECT_STRING2.equals(((CollectAction)a).getCollectString()));
+ assertTrue(COLLECT_STRING1.equals(((CollectAction) a).getCollectString())
+ || COLLECT_STRING2.equals(((CollectAction) a).getCollectString()));
}
}
- }
+ }
- private void startRemoteSession() throws Throwable {
- // Set launch attributes
+ private void startRemoteSession() throws Throwable {
+ // Set launch attributes
super.setLaunchAttributes();
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EXEC_PATH + EXEC_NAME);
setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_TRACEPOINT_MODE,
@@ -369,35 +367,32 @@ public class TraceFileTest extends BaseParametrizedTestCase {
assertNotNull(fBreakpointsDmc);
fTraceTargetDmc = DMContexts.getAncestorOfType(containerDmc, ITraceTargetDMContext.class);
assertNotNull(fTraceTargetDmc);
- }
+ }
- private void startTracing() throws Throwable {
+ private void startTracing() throws Throwable {
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
fSession.getExecutor().submit(new Runnable() {
@Override
public void run() {
- fTraceService.getTraceStatus(
- fTraceTargetDmc,
- new DataRequestMonitor<ITraceStatusDMData>(fSession.getExecutor(), null) {
- @Override
- @ConfinedToDsfExecutor("fExecutor")
- protected void handleCompleted() {
- if (isSuccess() && getData().isTracingSupported()) {
- fTraceService.startTracing(
- fTraceTargetDmc,
- new RequestMonitor(fSession.getExecutor(), null) {
- @Override
- @ConfinedToDsfExecutor("fExecutor")
- protected void handleCompleted() {
- wait.waitFinished(getStatus());
- }
- });
- }
- else {
- wait.waitFinished(getStatus());
+ fTraceService.getTraceStatus(fTraceTargetDmc,
+ new DataRequestMonitor<ITraceStatusDMData>(fSession.getExecutor(), null) {
+ @Override
+ @ConfinedToDsfExecutor("fExecutor")
+ protected void handleCompleted() {
+ if (isSuccess() && getData().isTracingSupported()) {
+ fTraceService.startTracing(fTraceTargetDmc,
+ new RequestMonitor(fSession.getExecutor(), null) {
+ @Override
+ @ConfinedToDsfExecutor("fExecutor")
+ protected void handleCompleted() {
+ wait.waitFinished(getStatus());
+ }
+ });
+ } else {
+ wait.waitFinished(getStatus());
+ }
}
- }
- });
+ });
}
});
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
@@ -409,15 +404,13 @@ public class TraceFileTest extends BaseParametrizedTestCase {
fSession.getExecutor().submit(new Runnable() {
@Override
public void run() {
- fTraceService.stopTracing(
- fTraceTargetDmc,
- new RequestMonitor(fSession.getExecutor(), null) {
- @Override
- @ConfinedToDsfExecutor("fExecutor")
- protected void handleCompleted() {
- wait.waitFinished(getStatus());
- }
- });
+ fTraceService.stopTracing(fTraceTargetDmc, new RequestMonitor(fSession.getExecutor(), null) {
+ @Override
+ @ConfinedToDsfExecutor("fExecutor")
+ protected void handleCompleted() {
+ wait.waitFinished(getStatus());
+ }
+ });
}
});
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
@@ -431,7 +424,7 @@ public class TraceFileTest extends BaseParametrizedTestCase {
attributes.put(MIBreakpoints.FUNCTION, END_FUNCTION);
IBreakpointDMContext bptDMC = insertBreakpoint(fBreakpointsDmc, attributes);
assertTrue(bptDMC instanceof MIBreakpointDMContext);
- return (MIBreakpointDMContext)bptDMC;
+ return (MIBreakpointDMContext) bptDMC;
}
private void setTracepoints() throws Throwable {
@@ -442,7 +435,6 @@ public class TraceFileTest extends BaseParametrizedTestCase {
collectAction1.setName(String.format("Collect %s", COLLECT_STRING1));
tam.addAction(collectAction1);
-
CollectAction collectAction2 = new CollectAction();
collectAction2.setCollectString(COLLECT_STRING2);
collectAction2.setName(String.format("Collect %s", COLLECT_STRING2));
@@ -461,15 +453,13 @@ public class TraceFileTest extends BaseParametrizedTestCase {
insertBreakpoint(fBreakpointsDmc, attributes);
attributes.put(MIBreakpoints.LINE_NUMBER, getLineForTag("INCR_X"));
- attributes.put(MIBreakpoints.COMMANDS,
- String.format("%s%s%s", collectAction1.getName(),
- TracepointActionManager.TRACEPOINT_ACTION_DELIMITER, collectAction2.getName()));
+ attributes.put(MIBreakpoints.COMMANDS, String.format("%s%s%s", collectAction1.getName(),
+ TracepointActionManager.TRACEPOINT_ACTION_DELIMITER, collectAction2.getName()));
insertBreakpoint(fBreakpointsDmc, attributes);
}
- private IBreakpointDMContext insertBreakpoint(
- final IBreakpointsTargetDMContext context,
- final Map<String,Object> attributes) throws InterruptedException {
+ private IBreakpointDMContext insertBreakpoint(final IBreakpointsTargetDMContext context,
+ final Map<String, Object> attributes) throws InterruptedException {
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
fSession.getExecutor().submit(new Runnable() {
@@ -477,12 +467,12 @@ public class TraceFileTest extends BaseParametrizedTestCase {
public void run() {
fBreakpointService.insertBreakpoint(context, attributes,
new DataRequestMonitor<IBreakpointDMContext>(fBreakpointService.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- wait.setReturnInfo(getData());
- wait.waitFinished(getStatus());
- }
- });
+ @Override
+ protected void handleCompleted() {
+ wait.setReturnInfo(getData());
+ wait.waitFinished(getStatus());
+ }
+ });
}
});
@@ -490,26 +480,23 @@ public class TraceFileTest extends BaseParametrizedTestCase {
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
assertTrue(wait.getMessage(), wait.isOK());
- return (IBreakpointDMContext)wait.getReturnInfo();
+ return (IBreakpointDMContext) wait.getReturnInfo();
}
private void saveTraceData() throws Throwable {
- final File traceFile = new Path(TRACE_FILE_PATH).toFile();
+ final File traceFile = new Path(TRACE_FILE_PATH).toFile();
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
fSession.getExecutor().submit(new Runnable() {
@Override
public void run() {
- fTraceService.saveTraceData(
- fTraceTargetDmc,
- traceFile.getAbsolutePath(),
- false,
- new RequestMonitor(fSession.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- wait.waitFinished(getStatus());
- }
- });
+ fTraceService.saveTraceData(fTraceTargetDmc, traceFile.getAbsolutePath(), false,
+ new RequestMonitor(fSession.getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ wait.waitFinished(getStatus());
+ }
+ });
}
});
@@ -520,7 +507,7 @@ public class TraceFileTest extends BaseParametrizedTestCase {
}
private void deleteOldTraceFile() throws Throwable {
- File traceFile = new Path(TRACE_FILE_PATH).toFile();
+ File traceFile = new Path(TRACE_FILE_PATH).toFile();
traceFile.delete();
assertFalse(traceFile.exists());
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/GDBMultiNonStopRunControlTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/GDBMultiNonStopRunControlTest.java
index 8dea85cd18d..119923cacec 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/GDBMultiNonStopRunControlTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/GDBMultiNonStopRunControlTest.java
@@ -13,7 +13,6 @@
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.tests.nonstop;
-
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -48,7 +47,6 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
-
/**
* Tests IMultiRunControl class for Non-stop multi-threaded application.
*/
@@ -78,38 +76,36 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
final DsfSession session = getGDBLaunch().getSession();
- Runnable runnable = new Runnable() {
- @Override
+ Runnable runnable = new Runnable() {
+ @Override
public void run() {
- fServicesTracker =
- new DsfServicesTracker(TestsPlugin.getBundleContext(),
- session.getId());
- fMultiRun = fServicesTracker.getService(IMultiRunControl.class);
- }
- };
- session.getExecutor().submit(runnable).get();
+ fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), session.getId());
+ fMultiRun = fServicesTracker.getService(IMultiRunControl.class);
+ }
+ };
+ session.getExecutor().submit(runnable).get();
}
@Override
protected void setLaunchAttributes() {
super.setLaunchAttributes();
- setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME,
- EXEC_PATH + EXEC_NAME);
+ setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EXEC_PATH + EXEC_NAME);
// Multi run control only makes sense for non-stop mode
- setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP, true);
+ setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP, true);
}
@Override
public void doAfterTest() throws Exception {
super.doAfterTest();
- if (fServicesTracker!=null) fServicesTracker.dispose();
+ if (fServicesTracker != null)
+ fServicesTracker.dispose();
}
private abstract class AsyncRunnable<V> {
- public abstract void run(DataRequestMonitor<V> drm);
+ public abstract void run(DataRequestMonitor<V> drm);
};
private <V> V runAsyncCall(final AsyncRunnable<V> runnable) throws Exception {
@@ -118,33 +114,33 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
private <V> V runAsyncCall(final AsyncRunnable<V> runnable, boolean expectExecutionException) throws Exception {
Query<V> query = new Query<V>() {
- @Override
- protected void execute(DataRequestMonitor<V> rm) {
- runnable.run(rm);
- }
- };
-
- V result = null;
- try {
- fMultiRun.getExecutor().execute(query);
- result = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
- } catch (ExecutionException e) {
- if (expectExecutionException) {
- return null;
- }
- throw new AssertionError(e);
- }
-
- if (expectExecutionException) {
- fail("Didn't get the expected execution exception");
- }
-
- return result;
+ @Override
+ protected void execute(DataRequestMonitor<V> rm) {
+ runnable.run(rm);
+ }
+ };
+
+ V result = null;
+ try {
+ fMultiRun.getExecutor().execute(query);
+ result = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
+ } catch (ExecutionException e) {
+ if (expectExecutionException) {
+ return null;
+ }
+ throw new AssertionError(e);
+ }
+
+ if (expectExecutionException) {
+ fail("Didn't get the expected execution exception");
+ }
+
+ return result;
}
//////////////////////////////////////////////////////////////////////
// Tests for verifying the run-state of multiple threads
- //////////////////////////////////////////////////////////////////////
+ //////////////////////////////////////////////////////////////////////
/**
* Test canResume*, canSuspend*, isSuspended*, canStep*, isStepping*
@@ -159,14 +155,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canResume calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canResumeAll(threads, drm);
}
});
assertTrue("expected to be able to resume all, but cannot", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canResumeSome(threads, drm);
}
});
@@ -174,14 +172,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canSuspend calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canSuspendAll(threads, drm);
}
});
assertFalse("expected not to be able to suspend all, but can", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canSuspendSome(threads, drm);
}
});
@@ -189,14 +189,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// isSuspended calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(threads, drm);
}
});
assertTrue("expected to find all threads suspended but didn't", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(threads, drm);
}
});
@@ -205,14 +207,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canStep calls
for (final IRunControl.StepType type : IRunControl.StepType.values()) {
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canStepAll(threads, type, drm);
}
}, true /* Not implemented yet*/);
// assertTrue("expected to be able to step all, but cannot", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canStepSome(threads, type, drm);
}
}, true /* Not implemented yet*/);
@@ -221,14 +225,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// isStepping calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSteppingAll(threads, drm);
}
}, true /* Not implemented yet*/);
// assertFalse("expected to find no thread stepping but did", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSteppingSome(threads, drm);
}
}, true /* Not implemented yet*/);
@@ -251,14 +257,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canResume calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canResumeAll(threads, drm);
}
});
assertFalse("expected not to be able to resume all, but can", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canResumeSome(threads, drm);
}
});
@@ -266,14 +274,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canSuspend calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canSuspendAll(threads, drm);
}
});
assertTrue("expected to be able to suspend all, but cannot", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canSuspendSome(threads, drm);
}
});
@@ -281,14 +291,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// isSuspended calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(threads, drm);
}
});
assertFalse("expected to find no thread suspended but did", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(threads, drm);
}
});
@@ -297,14 +309,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canStep calls
for (final IRunControl.StepType type : IRunControl.StepType.values()) {
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canStepAll(threads, type, drm);
}
}, true /* Not implemented yet*/);
// assertFalse("expected to not be able to step all, but can", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canStepSome(threads, type, drm);
}
}, true /* Not implemented yet*/);
@@ -313,14 +327,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// isStepping calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSteppingAll(threads, drm);
}
}, true /* Not implemented yet*/);
// assertFalse("expected to find no thread stepping but did", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSteppingSome(threads, drm);
}
}, true /* Not implemented yet*/);
@@ -337,12 +353,12 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitor =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
final IMIExecutionDMContext[] threads = SyncUtil.getExecutionContexts();
assertTrue("Expected two threads but got " + threads.length, threads.length == 2);
@@ -351,14 +367,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canResume calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canResumeAll(threads, drm);
}
});
assertTrue("expected to be able to resume all, but cannot", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canResumeSome(threads, drm);
}
});
@@ -366,14 +384,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canSuspend calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canSuspendAll(threads, drm);
}
});
assertFalse("expected not to be able to suspend all, but can", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canSuspendSome(threads, drm);
}
});
@@ -381,14 +401,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// isSuspended calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(threads, drm);
}
});
assertTrue("expected to find all threads suspended but didn't", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(threads, drm);
}
});
@@ -397,14 +419,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canStep calls
for (final IRunControl.StepType type : IRunControl.StepType.values()) {
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canStepAll(threads, type, drm);
}
}, true /* Not implemented yet*/);
// assertTrue("expected to be able to step all, but can't", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canStepSome(threads, type, drm);
}
}, true /* Not implemented yet*/);
@@ -413,14 +437,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// isStepping calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSteppingAll(threads, drm);
}
}, true /* Not implemented yet*/);
// assertFalse("expected to find no thread stepping but did", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSteppingSome(threads, drm);
}
}, true /* Not implemented yet*/);
@@ -437,16 +463,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitor =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
// Now resume program again and wait for one of the two threads to stop
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
final IMIExecutionDMContext[] threads = SyncUtil.getExecutionContexts();
assertTrue("Expected two threads but got " + threads.length, threads.length == 2);
@@ -455,14 +481,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canResume calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canResumeAll(threads, drm);
}
});
assertFalse("expected to not be able to resume all, but can", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canResumeSome(threads, drm);
}
});
@@ -470,14 +498,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canSuspend calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canSuspendAll(threads, drm);
}
});
assertFalse("expected not to be able to suspend all, but can", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canSuspendSome(threads, drm);
}
});
@@ -485,14 +515,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// isSuspended calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(threads, drm);
}
});
assertFalse("expected that not all threads are suspended but they are", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(threads, drm);
}
});
@@ -501,14 +533,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canStep calls
for (final IRunControl.StepType type : IRunControl.StepType.values()) {
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canStepAll(threads, type, drm);
}
}, true /* Not implemented yet*/);
// assertFalse("expected not to be able to step all, but can", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canStepSome(threads, type, drm);
}
}, true /* Not implemented yet*/);
@@ -517,14 +551,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// isStepping calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSteppingAll(threads, drm);
}
}, true /* Not implemented yet*/);
// assertFalse("expected to find no thread stepping but did", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSteppingSome(threads, drm);
}
}, true /* Not implemented yet*/);
@@ -541,16 +577,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitor =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
// Now resume program again and wait for one of the two threads to stop
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
// Now resume the thread again to have both running
SyncUtil.resumeAll();
@@ -562,14 +598,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canResume calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canResumeAll(threads, drm);
}
});
assertFalse("expected not to be able to resume all, but can", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canResumeSome(threads, drm);
}
});
@@ -577,14 +615,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canSuspend calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canSuspendAll(threads, drm);
}
});
assertTrue("expected to be able to suspend all, but cannot", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canSuspendSome(threads, drm);
}
});
@@ -592,14 +632,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// isSuspended calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(threads, drm);
}
});
assertFalse("expected that no threads are suspended but they are", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(threads, drm);
}
});
@@ -608,14 +650,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canStep calls
for (final IRunControl.StepType type : IRunControl.StepType.values()) {
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canStepAll(threads, type, drm);
}
}, true /* Not implemented yet*/);
// assertFalse("expected not to be able to step all, but can", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canStepSome(threads, type, drm);
}
}, true /* Not implemented yet*/);
@@ -624,14 +668,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// isStepping calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSteppingAll(threads, drm);
}
}, true /* Not implemented yet*/);
// assertFalse("expected to find no thread stepping but did", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSteppingSome(threads, drm);
}
}, true /* Not implemented yet*/);
@@ -640,7 +686,7 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
//////////////////////////////////////////////////////////////////////
// Tests for verifying the resume operation on multiple threads
- //////////////////////////////////////////////////////////////////////
+ //////////////////////////////////////////////////////////////////////
/**
* Test resume of multiple contexts with one thread which is stopped.
@@ -650,11 +696,12 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
final IMIExecutionDMContext[] threads = SyncUtil.getExecutionContexts();
assertTrue("Expected a single thread but got " + threads.length, threads.length == 1);
- final ServiceEventWaitor<MIRunningEvent> eventWaitor =
- new ServiceEventWaitor<MIRunningEvent>(fMultiRun.getSession(), MIRunningEvent.class);
+ final ServiceEventWaitor<MIRunningEvent> eventWaitor = new ServiceEventWaitor<MIRunningEvent>(
+ fMultiRun.getSession(), MIRunningEvent.class);
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.resume(threads, drm);
}
});
@@ -663,7 +710,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Also confirm that all threads are running
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(threads, drm);
}
});
@@ -683,7 +731,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Confirm that all threads are running
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(threads, drm);
}
});
@@ -691,14 +740,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// No error should be thrown, the call should ignore running threads
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.resume(threads, drm);
}
});
// Confirm that all threads are still running
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(threads, drm);
}
});
@@ -716,8 +767,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
@@ -726,11 +777,12 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
final IMIExecutionDMContext[] threads = SyncUtil.getExecutionContexts();
assertTrue("Expected two threads but got " + threads.length, threads.length == 2);
- final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning =
- new ServiceEventWaitor<MIRunningEvent>(fMultiRun.getSession(), MIRunningEvent.class);
+ final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<MIRunningEvent>(
+ fMultiRun.getSession(), MIRunningEvent.class);
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.resume(threads[0], drm);
}
});
@@ -739,14 +791,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Also confirm that only one threads is running
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(threads, drm);
}
});
assertTrue("expected some threads to be suspended, but found none", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(threads, drm);
}
});
@@ -765,8 +819,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
@@ -775,11 +829,12 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
final IMIExecutionDMContext[] threads = SyncUtil.getExecutionContexts();
assertTrue("Expected two threads but got " + threads.length, threads.length == 2);
- final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning =
- new ServiceEventWaitor<MIRunningEvent>(fMultiRun.getSession(), MIRunningEvent.class);
+ final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<MIRunningEvent>(
+ fMultiRun.getSession(), MIRunningEvent.class);
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.resume(threads, drm);
}
});
@@ -789,7 +844,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Also confirm that all threads are running
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(threads, drm);
}
});
@@ -806,26 +862,27 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
- eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
+ eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
// Now resume program again and wait for one of the two threads to stop
SyncUtil.resumeAll();
- eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
final IMIExecutionDMContext[] threads = SyncUtil.getExecutionContexts();
assertTrue("Expected two threads but got " + threads.length, threads.length == 2);
- final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning =
- new ServiceEventWaitor<MIRunningEvent>(fMultiRun.getSession(), MIRunningEvent.class);
+ final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<MIRunningEvent>(
+ fMultiRun.getSession(), MIRunningEvent.class);
// No error should be thrown, the call should ignore running threads
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.resume(threads, drm);
}
});
@@ -834,7 +891,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Also confirm that all threads are running
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(threads, drm);
}
});
@@ -852,16 +910,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitor =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
// Now resume program again and wait for one of the two threads to stop
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
// Now resume the thread again to have both running
SyncUtil.resumeAll();
@@ -869,19 +927,21 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
final IMIExecutionDMContext[] threads = SyncUtil.getExecutionContexts();
assertTrue("Expected two threads but got " + threads.length, threads.length == 2);
- final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning =
- new ServiceEventWaitor<MIRunningEvent>(fMultiRun.getSession(), MIRunningEvent.class);
+ final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<MIRunningEvent>(
+ fMultiRun.getSession(), MIRunningEvent.class);
// No error should be thrown, the call should ignore running threads
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.resume(threads, drm);
}
});
// Also confirm that all threads are running
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(threads, drm);
}
});
@@ -892,7 +952,7 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
//////////////////////////////////////////////////////////////////////
// Tests for verifying the suspend operation on multiple threads
- //////////////////////////////////////////////////////////////////////
+ //////////////////////////////////////////////////////////////////////
/**
* Test suspend of multiple contexts with one thread which is stopped.
@@ -902,16 +962,18 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
final IMIExecutionDMContext[] threads = SyncUtil.getExecutionContexts();
assertTrue("Expected a single thread but got " + threads.length, threads.length == 1);
- // No error should be thrown, the already suspended threads should be ignored
+ // No error should be thrown, the already suspended threads should be ignored
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.suspend(threads, drm);
}
});
// Also confirm that all threads are still suspended
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(threads, drm);
}
});
@@ -931,26 +993,29 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Confirm that all threads are running
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(threads, drm);
}
});
assertFalse("expected no threads to be suspended, but found some", result);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitor =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.suspend(threads, drm);
}
});
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(100)); // Thread should interrupt
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(100)); // Thread should interrupt
// Confirm that all threads are suspended
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(threads, drm);
}
});
@@ -966,8 +1031,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
@@ -976,16 +1041,18 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
final IMIExecutionDMContext[] threads = SyncUtil.getExecutionContexts();
assertTrue("Expected two threads but got " + threads.length, threads.length == 2);
- // No error should be thrown, the already suspended threads should be ignored
- runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ // No error should be thrown, the already suspended threads should be ignored
+ runAsyncCall(new AsyncRunnable<Object>() {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.suspend(threads, drm);
}
});
// Also confirm that all threads are still suspended
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(threads, drm);
}
});
@@ -1002,23 +1069,24 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
- eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
+ eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
// Now resume program again and wait for one of the two threads to stop
SyncUtil.resumeAll();
- eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
final IMIExecutionDMContext[] threads = SyncUtil.getExecutionContexts();
assertTrue("Expected two threads but got " + threads.length, threads.length == 2);
// No error should be thrown, the call should ignore the suspended threads
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.suspend(threads, drm);
}
});
@@ -1027,7 +1095,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Also confirm that all threads are suspended
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(threads, drm);
}
});
@@ -1044,16 +1113,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitor =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
// Now resume program again and wait for one of the two threads to stop
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
// Now resume the thread again to have both running
SyncUtil.resumeAll();
@@ -1063,22 +1132,25 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// No error should be thrown, the call should ignore running threads
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.suspend(threads[0], drm);
}
});
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(100)); // confirm one thread was suspended
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(100)); // confirm one thread was suspended
// Also confirm that some but not all threads are suspended
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(threads, drm);
}
});
assertTrue("expected some threads to be suspended, but found none", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(threads, drm);
}
});
@@ -1097,16 +1169,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitor =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
// Now resume program again and wait for one of the two threads to stop
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
// Now resume the thread again to have both running
SyncUtil.resumeAll();
@@ -1115,17 +1187,19 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
assertTrue("Expected two threads but got " + threads.length, threads.length == 2);
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.suspend(threads, drm);
}
});
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(100)); // confirm one thread was suspended
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(100)); // confirm the other thread was suspended
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(100)); // confirm one thread was suspended
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(100)); // confirm the other thread was suspended
// Also confirm that all threads are suspended
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(threads, drm);
}
});
@@ -1134,7 +1208,7 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
//////////////////////////////////////////////////////////////////////
// Tests for verifying the step operation on multiple threads
- //////////////////////////////////////////////////////////////////////
+ //////////////////////////////////////////////////////////////////////
/**
* Test that the feature is not implemented. Once this fails, we will
@@ -1147,7 +1221,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
for (final IRunControl.StepType type : IRunControl.StepType.values()) {
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.step(threads, type, drm);
}
}, true /* Not implemented yet*/);
@@ -1158,7 +1233,7 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
//////////////////////////////////////////////////////////////////////
// Tests for verifying the run-state of the process.
// This should be done with multi-process but we are not quite setup for it.
- //////////////////////////////////////////////////////////////////////
+ //////////////////////////////////////////////////////////////////////
/**
* Test canResume*, canSuspend*, isSuspended*, canStep*, isStepping*
@@ -1166,21 +1241,22 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
*/
@Test
public void testStateProcessOneThreadStopped() throws Throwable {
- final IContainerDMContext[] processes =
- new IContainerDMContext[] { SyncUtil.getContainerContext() };
+ final IContainerDMContext[] processes = new IContainerDMContext[] { SyncUtil.getContainerContext() };
Boolean result;
// canResume calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canResumeAll(processes, drm);
}
});
assertTrue("expected to be able to resume all, but cannot", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canResumeSome(processes, drm);
}
});
@@ -1188,14 +1264,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canSuspend calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canSuspendAll(processes, drm);
}
});
assertFalse("expected not to be able to suspend all, but can", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canSuspendSome(processes, drm);
}
});
@@ -1203,14 +1281,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// isSuspended calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(processes, drm);
}
});
assertTrue("expected to find all processes suspended but didn't", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(processes, drm);
}
});
@@ -1219,14 +1299,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canStep calls
for (final IRunControl.StepType type : IRunControl.StepType.values()) {
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canStepAll(processes, type, drm);
}
}, true /* Not implemented yet*/);
// assertTrue("expected to be able to step all, but cannot", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canStepSome(processes, type, drm);
}
}, true /* Not implemented yet*/);
@@ -1235,14 +1317,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// isStepping calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSteppingAll(processes, drm);
}
}, true /* Not implemented yet*/);
// assertFalse("expected to find no process stepping but did", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSteppingSome(processes, drm);
}
}, true /* Not implemented yet*/);
@@ -1255,8 +1339,7 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
*/
@Test
public void testStateProcessOneThreadRunning() throws Throwable {
- final IContainerDMContext[] processes =
- new IContainerDMContext[] { SyncUtil.getContainerContext() };
+ final IContainerDMContext[] processes = new IContainerDMContext[] { SyncUtil.getContainerContext() };
// Resume the program to check thread while it is running
SyncUtil.resumeAll();
@@ -1265,14 +1348,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canResume calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canResumeAll(processes, drm);
}
});
assertFalse("expected not to be able to resume all, but can", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canResumeSome(processes, drm);
}
});
@@ -1280,14 +1365,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canSuspend calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canSuspendAll(processes, drm);
}
});
assertTrue("expected to be able to suspend all, but cannot", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canSuspendSome(processes, drm);
}
});
@@ -1295,14 +1382,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// isSuspended calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(processes, drm);
}
});
assertFalse("expected to find no thread suspended but did", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(processes, drm);
}
});
@@ -1311,14 +1400,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canStep calls
for (final IRunControl.StepType type : IRunControl.StepType.values()) {
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canStepAll(processes, type, drm);
}
}, true /* Not implemented yet*/);
// assertFalse("expected to not be able to step all, but can", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canStepSome(processes, type, drm);
}
}, true /* Not implemented yet*/);
@@ -1327,14 +1418,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// isStepping calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSteppingAll(processes, drm);
}
}, true /* Not implemented yet*/);
// assertFalse("expected to find no thread stepping but did", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSteppingSome(processes, drm);
}
}, true /* Not implemented yet*/);
@@ -1351,28 +1444,29 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitor =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
- final IContainerDMContext[] processes =
- new IContainerDMContext[] { SyncUtil.getContainerContext() };
+ final IContainerDMContext[] processes = new IContainerDMContext[] { SyncUtil.getContainerContext() };
Boolean result;
// canResume calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canResumeAll(processes, drm);
}
});
assertTrue("expected to be able to resume all, but cannot", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canResumeSome(processes, drm);
}
});
@@ -1380,14 +1474,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canSuspend calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canSuspendAll(processes, drm);
}
});
assertFalse("expected not to be able to suspend all, but can", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canSuspendSome(processes, drm);
}
});
@@ -1395,14 +1491,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// isSuspended calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(processes, drm);
}
});
assertTrue("expected to find all threads suspended but didn't", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(processes, drm);
}
});
@@ -1411,14 +1509,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canStep calls
for (final IRunControl.StepType type : IRunControl.StepType.values()) {
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canStepAll(processes, type, drm);
}
}, true /* Not implemented yet*/);
// assertTrue("expected to be able to step all, but can't", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canStepSome(processes, type, drm);
}
}, true /* Not implemented yet*/);
@@ -1427,14 +1527,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// isStepping calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSteppingAll(processes, drm);
}
}, true /* Not implemented yet*/);
// assertFalse("expected to find no thread stepping but did", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSteppingSome(processes, drm);
}
}, true /* Not implemented yet*/);
@@ -1451,32 +1553,33 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitor =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
// Now resume program again and wait for one of the two threads to stop
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
- final IContainerDMContext[] processes =
- new IContainerDMContext[] { SyncUtil.getContainerContext() };
+ final IContainerDMContext[] processes = new IContainerDMContext[] { SyncUtil.getContainerContext() };
Boolean result;
// canResume calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canResumeAll(processes, drm);
}
});
assertTrue("expected to be able to resume all, but cannot", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canResumeSome(processes, drm);
}
});
@@ -1484,14 +1587,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canSuspend calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canSuspendAll(processes, drm);
}
});
assertTrue("expected to be able to suspend all, but cannot", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canSuspendSome(processes, drm);
}
});
@@ -1499,14 +1604,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// isSuspended calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(processes, drm);
}
});
assertTrue("expected that all processes are suspended but they are not", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(processes, drm);
}
});
@@ -1515,14 +1622,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canStep calls
for (final IRunControl.StepType type : IRunControl.StepType.values()) {
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canStepAll(processes, type, drm);
}
}, true /* Not implemented yet*/);
// assertFalse("expected not to be able to step all, but can", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canStepSome(processes, type, drm);
}
}, true /* Not implemented yet*/);
@@ -1531,14 +1640,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// isStepping calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSteppingAll(processes, drm);
}
}, true /* Not implemented yet*/);
// assertFalse("expected to find no process stepping but did", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSteppingSome(processes, drm);
}
}, true /* Not implemented yet*/);
@@ -1555,35 +1666,36 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitor =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
// Now resume program again and wait for one of the two threads to stop
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
// Now resume the thread again to have both running
SyncUtil.resumeAll();
- final IContainerDMContext[] processes =
- new IContainerDMContext[] { SyncUtil.getContainerContext() };
+ final IContainerDMContext[] processes = new IContainerDMContext[] { SyncUtil.getContainerContext() };
Boolean result;
// canResume calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canResumeAll(processes, drm);
}
});
assertFalse("expected not to be able to resume all, but can", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canResumeSome(processes, drm);
}
});
@@ -1591,14 +1703,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canSuspend calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canSuspendAll(processes, drm);
}
});
assertTrue("expected to be able to suspend all, but cannot", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canSuspendSome(processes, drm);
}
});
@@ -1606,14 +1720,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// isSuspended calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(processes, drm);
}
});
assertFalse("expected that no threads are suspended but they are", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(processes, drm);
}
});
@@ -1622,14 +1738,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canStep calls
for (final IRunControl.StepType type : IRunControl.StepType.values()) {
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canStepAll(processes, type, drm);
}
}, true /* Not implemented yet*/);
// assertFalse("expected not to be able to step all, but can", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canStepSome(processes, type, drm);
}
}, true /* Not implemented yet*/);
@@ -1638,14 +1756,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// isStepping calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSteppingAll(processes, drm);
}
}, true /* Not implemented yet*/);
// assertFalse("expected to find no process stepping but did", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSteppingSome(processes, drm);
}
}, true /* Not implemented yet*/);
@@ -1656,7 +1776,7 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Tests for verifying the run-state of the process and a thread.
// Because the thread is part of the process, it should be ignored,
// and the results should be as if only the process was selected.
- //////////////////////////////////////////////////////////////////////
+ //////////////////////////////////////////////////////////////////////
/**
* Test canResume*, canSuspend*, isSuspended*, canStep*, isStepping*
@@ -1668,21 +1788,22 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
final IMIExecutionDMContext[] threads = SyncUtil.getExecutionContexts();
assertTrue("Expected a single thread but got " + threads.length, threads.length == 1);
- final IExecutionDMContext[] execDmcs =
- new IExecutionDMContext[] { SyncUtil.getContainerContext(), threads[0] };
+ final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] { SyncUtil.getContainerContext(), threads[0] };
Boolean result;
// canResume calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canResumeAll(execDmcs, drm);
}
});
assertTrue("expected to be able to resume all, but cannot", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canResumeSome(execDmcs, drm);
}
});
@@ -1690,14 +1811,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canSuspend calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canSuspendAll(execDmcs, drm);
}
});
assertFalse("expected not to be able to suspend all, but can", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canSuspendSome(execDmcs, drm);
}
});
@@ -1705,14 +1828,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// isSuspended calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(execDmcs, drm);
}
});
assertTrue("expected to find all processes suspended but didn't", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(execDmcs, drm);
}
});
@@ -1721,14 +1846,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canStep calls
for (final IRunControl.StepType type : IRunControl.StepType.values()) {
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canStepAll(execDmcs, type, drm);
}
}, true /* Not implemented yet*/);
// assertTrue("expected to be able to step all, but cannot", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canStepSome(execDmcs, type, drm);
}
}, true /* Not implemented yet*/);
@@ -1737,14 +1864,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// isStepping calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSteppingAll(execDmcs, drm);
}
}, true /* Not implemented yet*/);
// assertFalse("expected to find no process stepping but did", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSteppingSome(execDmcs, drm);
}
}, true /* Not implemented yet*/);
@@ -1761,8 +1890,7 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
final IMIExecutionDMContext[] threads = SyncUtil.getExecutionContexts();
assertTrue("Expected a single thread but got " + threads.length, threads.length == 1);
- final IExecutionDMContext[] execDmcs =
- new IExecutionDMContext[] { SyncUtil.getContainerContext(), threads[0] };
+ final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] { SyncUtil.getContainerContext(), threads[0] };
// Resume the program to check thread while it is running
SyncUtil.resumeAll();
@@ -1771,14 +1899,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canResume calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canResumeAll(execDmcs, drm);
}
});
assertFalse("expected not to be able to resume all, but can", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canResumeSome(execDmcs, drm);
}
});
@@ -1786,14 +1916,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canSuspend calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canSuspendAll(execDmcs, drm);
}
});
assertTrue("expected to be able to suspend all, but cannot", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canSuspendSome(execDmcs, drm);
}
});
@@ -1801,14 +1933,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// isSuspended calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(execDmcs, drm);
}
});
assertFalse("expected to find no thread suspended but did", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(execDmcs, drm);
}
});
@@ -1817,14 +1951,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canStep calls
for (final IRunControl.StepType type : IRunControl.StepType.values()) {
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canStepAll(execDmcs, type, drm);
}
}, true /* Not implemented yet*/);
// assertFalse("expected to not be able to step all, but can", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canStepSome(execDmcs, type, drm);
}
}, true /* Not implemented yet*/);
@@ -1833,14 +1969,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// isStepping calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSteppingAll(execDmcs, drm);
}
}, true /* Not implemented yet*/);
// assertFalse("expected to find no thread stepping but did", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSteppingSome(execDmcs, drm);
}
}, true /* Not implemented yet*/);
@@ -1858,31 +1996,32 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitor =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
final IMIExecutionDMContext[] threads = SyncUtil.getExecutionContexts();
assertTrue("Expected a single thread but got " + threads.length, threads.length == 2);
- final IExecutionDMContext[] execDmcs =
- new IExecutionDMContext[] { SyncUtil.getContainerContext(), threads[0] };
+ final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] { SyncUtil.getContainerContext(), threads[0] };
Boolean result;
// canResume calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canResumeAll(execDmcs, drm);
}
});
assertTrue("expected to be able to resume all, but cannot", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canResumeSome(execDmcs, drm);
}
});
@@ -1890,14 +2029,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canSuspend calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canSuspendAll(execDmcs, drm);
}
});
assertFalse("expected not to be able to suspend all, but can", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canSuspendSome(execDmcs, drm);
}
});
@@ -1905,14 +2046,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// isSuspended calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(execDmcs, drm);
}
});
assertTrue("expected to find all threads suspended but didn't", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(execDmcs, drm);
}
});
@@ -1921,14 +2064,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canStep calls
for (final IRunControl.StepType type : IRunControl.StepType.values()) {
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canStepAll(execDmcs, type, drm);
}
}, true /* Not implemented yet*/);
// assertTrue("expected to be able to step all, but can't", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canStepSome(execDmcs, type, drm);
}
}, true /* Not implemented yet*/);
@@ -1937,14 +2082,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// isStepping calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSteppingAll(execDmcs, drm);
}
}, true /* Not implemented yet*/);
// assertFalse("expected to find no thread stepping but did", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSteppingSome(execDmcs, drm);
}
}, true /* Not implemented yet*/);
@@ -1962,35 +2109,37 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitor =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
// Now resume program again and wait for one of the two threads to stop
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
final IMIExecutionDMContext[] threads = SyncUtil.getExecutionContexts();
assertTrue("Expected a single thread but got " + threads.length, threads.length == 2);
- final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] {
- SyncUtil.getContainerContext(), SyncUtil.getExecutionContext(0) };
+ final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] { SyncUtil.getContainerContext(),
+ SyncUtil.getExecutionContext(0) };
Boolean result;
// canResume calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canResumeAll(execDmcs, drm);
}
});
assertTrue("expected to be able to resume all, but cannot", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canResumeSome(execDmcs, drm);
}
});
@@ -1998,14 +2147,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canSuspend calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canSuspendAll(execDmcs, drm);
}
});
assertTrue("expected to be able to suspend all, but cannot", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canSuspendSome(execDmcs, drm);
}
});
@@ -2013,14 +2164,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// isSuspended calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(execDmcs, drm);
}
});
assertTrue("expected that all processes are suspended but they are not", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(execDmcs, drm);
}
});
@@ -2029,14 +2182,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canStep calls
for (final IRunControl.StepType type : IRunControl.StepType.values()) {
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canStepAll(execDmcs, type, drm);
}
}, true /* Not implemented yet*/);
// assertFalse("expected not to be able to step all, but can", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canStepSome(execDmcs, type, drm);
}
}, true /* Not implemented yet*/);
@@ -2045,14 +2200,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// isStepping calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSteppingAll(execDmcs, drm);
}
}, true /* Not implemented yet*/);
// assertFalse("expected to find no process stepping but did", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSteppingSome(execDmcs, drm);
}
}, true /* Not implemented yet*/);
@@ -2070,35 +2227,37 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitor =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
// Now resume program again and wait for one of the two threads to stop
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
final IMIExecutionDMContext[] threads = SyncUtil.getExecutionContexts();
assertTrue("Expected a single thread but got " + threads.length, threads.length == 2);
- final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] {
- SyncUtil.getContainerContext(), SyncUtil.getExecutionContext(1) };
+ final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] { SyncUtil.getContainerContext(),
+ SyncUtil.getExecutionContext(1) };
Boolean result;
// canResume calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canResumeAll(execDmcs, drm);
}
});
assertTrue("expected to be able to resume all, but cannot", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canResumeSome(execDmcs, drm);
}
});
@@ -2106,14 +2265,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canSuspend calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canSuspendAll(execDmcs, drm);
}
});
assertTrue("expected to be able to suspend all, but cannot", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canSuspendSome(execDmcs, drm);
}
});
@@ -2121,14 +2282,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// isSuspended calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(execDmcs, drm);
}
});
assertTrue("expected that all processes are suspended but they are not", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(execDmcs, drm);
}
});
@@ -2137,14 +2300,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canStep calls
for (final IRunControl.StepType type : IRunControl.StepType.values()) {
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canStepAll(execDmcs, type, drm);
}
}, true /* Not implemented yet*/);
// assertFalse("expected not to be able to step all, but can", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canStepSome(execDmcs, type, drm);
}
}, true /* Not implemented yet*/);
@@ -2153,14 +2318,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// isStepping calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSteppingAll(execDmcs, drm);
}
}, true /* Not implemented yet*/);
// assertFalse("expected to find no process stepping but did", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSteppingSome(execDmcs, drm);
}
}, true /* Not implemented yet*/);
@@ -2170,7 +2337,7 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
/**
* Test canResume*, canSuspend*, isSuspended*, canStep*, isStepping*
* on the process with two threads which are both running.
- * We also select both threads
+ * We also select both threads
*/
@Test
public void testStateProcessThreadTwoThreadsRunning() throws Throwable {
@@ -2178,16 +2345,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitor =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
// Now resume program again and wait for one of the two threads to stop
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
// Now resume the thread again to have both running
SyncUtil.resumeAll();
@@ -2195,21 +2362,22 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
final IMIExecutionDMContext[] threads = SyncUtil.getExecutionContexts();
assertTrue("Expected a single thread but got " + threads.length, threads.length == 2);
- final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] {
- SyncUtil.getContainerContext(), threads[0] };
+ final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] { SyncUtil.getContainerContext(), threads[0] };
Boolean result;
// canResume calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canResumeAll(execDmcs, drm);
}
});
assertFalse("expected not to be able to resume all, but can", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canResumeSome(execDmcs, drm);
}
});
@@ -2217,14 +2385,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canSuspend calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canSuspendAll(execDmcs, drm);
}
});
assertTrue("expected to be able to suspend all, but cannot", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canSuspendSome(execDmcs, drm);
}
});
@@ -2232,14 +2402,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// isSuspended calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(execDmcs, drm);
}
});
assertFalse("expected that no threads are suspended but they are", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(execDmcs, drm);
}
});
@@ -2248,14 +2420,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canStep calls
for (final IRunControl.StepType type : IRunControl.StepType.values()) {
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canStepAll(execDmcs, type, drm);
}
}, true /* Not implemented yet*/);
// assertFalse("expected not to be able to step all, but can", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canStepSome(execDmcs, type, drm);
}
}, true /* Not implemented yet*/);
@@ -2264,14 +2438,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// isStepping calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSteppingAll(execDmcs, drm);
}
}, true /* Not implemented yet*/);
// assertFalse("expected to find no process stepping but did", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSteppingSome(execDmcs, drm);
}
}, true /* Not implemented yet*/);
@@ -2282,7 +2458,7 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Tests for verifying the run-state of the process and both threads.
// Because the threads are part of the process, they should be ignored,
// and the results should be as if only the process was selected.
- //////////////////////////////////////////////////////////////////////
+ //////////////////////////////////////////////////////////////////////
/**
* Test canResume*, canSuspend*, isSuspended*, canStep*, isStepping*
@@ -2295,31 +2471,33 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitor =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
final IMIExecutionDMContext[] threads = SyncUtil.getExecutionContexts();
assertTrue("Expected a single thread but got " + threads.length, threads.length == 2);
- final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] {
- SyncUtil.getContainerContext(), threads[0], threads[1] };
+ final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] { SyncUtil.getContainerContext(), threads[0],
+ threads[1] };
Boolean result;
// canResume calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canResumeAll(execDmcs, drm);
}
});
assertTrue("expected to be able to resume all, but cannot", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canResumeSome(execDmcs, drm);
}
});
@@ -2327,14 +2505,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canSuspend calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canSuspendAll(execDmcs, drm);
}
});
assertFalse("expected not to be able to suspend all, but can", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canSuspendSome(execDmcs, drm);
}
});
@@ -2342,14 +2522,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// isSuspended calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(execDmcs, drm);
}
});
assertTrue("expected to find all threads suspended but didn't", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(execDmcs, drm);
}
});
@@ -2358,14 +2540,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canStep calls
for (final IRunControl.StepType type : IRunControl.StepType.values()) {
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canStepAll(execDmcs, type, drm);
}
}, true /* Not implemented yet*/);
// assertTrue("expected to be able to step all, but can't", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canStepSome(execDmcs, type, drm);
}
}, true /* Not implemented yet*/);
@@ -2374,14 +2558,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// isStepping calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSteppingAll(execDmcs, drm);
}
}, true /* Not implemented yet*/);
// assertFalse("expected to find no thread stepping but did", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSteppingSome(execDmcs, drm);
}
}, true /* Not implemented yet*/);
@@ -2399,35 +2585,37 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitor =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
// Now resume program again and wait for one of the two threads to stop
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
final IMIExecutionDMContext[] threads = SyncUtil.getExecutionContexts();
assertTrue("Expected a single thread but got " + threads.length, threads.length == 2);
- final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] {
- SyncUtil.getContainerContext(), threads[0], threads[1] };
+ final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] { SyncUtil.getContainerContext(), threads[0],
+ threads[1] };
Boolean result;
// canResume calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canResumeAll(execDmcs, drm);
}
});
assertTrue("expected to be able to resume all, but cannot", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canResumeSome(execDmcs, drm);
}
});
@@ -2435,14 +2623,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canSuspend calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canSuspendAll(execDmcs, drm);
}
});
assertTrue("expected to be able to suspend all, but cannot", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canSuspendSome(execDmcs, drm);
}
});
@@ -2450,14 +2640,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// isSuspended calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(execDmcs, drm);
}
});
assertTrue("expected that all processes are suspended but they are not", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(execDmcs, drm);
}
});
@@ -2466,14 +2658,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canStep calls
for (final IRunControl.StepType type : IRunControl.StepType.values()) {
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canStepAll(execDmcs, type, drm);
}
}, true /* Not implemented yet*/);
// assertFalse("expected not to be able to step all, but can", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canStepSome(execDmcs, type, drm);
}
}, true /* Not implemented yet*/);
@@ -2482,14 +2676,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// isStepping calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSteppingAll(execDmcs, drm);
}
}, true /* Not implemented yet*/);
// assertFalse("expected to find no process stepping but did", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSteppingSome(execDmcs, drm);
}
}, true /* Not implemented yet*/);
@@ -2507,16 +2703,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitor =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
// Now resume program again and wait for one of the two threads to stop
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
// Now resume the thread again to have both running
SyncUtil.resumeAll();
@@ -2524,21 +2720,23 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
final IMIExecutionDMContext[] threads = SyncUtil.getExecutionContexts();
assertTrue("Expected a single thread but got " + threads.length, threads.length == 2);
- final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] {
- SyncUtil.getContainerContext(), threads[0], threads[1] };
+ final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] { SyncUtil.getContainerContext(), threads[0],
+ threads[1] };
Boolean result;
// canResume calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canResumeAll(execDmcs, drm);
}
});
assertFalse("expected not to be able to resume all, but can", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canResumeSome(execDmcs, drm);
}
});
@@ -2546,14 +2744,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canSuspend calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canSuspendAll(execDmcs, drm);
}
});
assertTrue("expected to be able to suspend all, but cannot", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canSuspendSome(execDmcs, drm);
}
});
@@ -2561,14 +2761,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// isSuspended calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(execDmcs, drm);
}
});
assertFalse("expected that no threads are suspended but they are", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(execDmcs, drm);
}
});
@@ -2577,14 +2779,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// canStep calls
for (final IRunControl.StepType type : IRunControl.StepType.values()) {
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canStepAll(execDmcs, type, drm);
}
}, true /* Not implemented yet*/);
// assertFalse("expected not to be able to step all, but can", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.canStepSome(execDmcs, type, drm);
}
}, true /* Not implemented yet*/);
@@ -2593,14 +2797,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// isStepping calls
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSteppingAll(execDmcs, drm);
}
}, true /* Not implemented yet*/);
// assertFalse("expected to find no process stepping but did", result);
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSteppingSome(execDmcs, drm);
}
}, true /* Not implemented yet*/);
@@ -2609,21 +2815,21 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
//////////////////////////////////////////////////////////////////////
// Tests for verifying the multi resume operation on processes
- //////////////////////////////////////////////////////////////////////
+ //////////////////////////////////////////////////////////////////////
/**
* Test resume of multiple contexts with one thread which is stopped.
*/
@Test
public void testResumeProcessOneThreadStopped() throws Throwable {
- final IExecutionDMContext[] processes = new IExecutionDMContext[] {
- SyncUtil.getContainerContext() };
+ final IExecutionDMContext[] processes = new IExecutionDMContext[] { SyncUtil.getContainerContext() };
- final ServiceEventWaitor<MIRunningEvent> eventWaitor =
- new ServiceEventWaitor<MIRunningEvent>(fMultiRun.getSession(), MIRunningEvent.class);
+ final ServiceEventWaitor<MIRunningEvent> eventWaitor = new ServiceEventWaitor<MIRunningEvent>(
+ fMultiRun.getSession(), MIRunningEvent.class);
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.resume(processes, drm);
}
});
@@ -2632,7 +2838,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Also confirm that process is running
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(processes, drm);
}
});
@@ -2644,15 +2851,15 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
*/
@Test
public void testResumeProcessOneThreadRunning() throws Throwable {
- final IExecutionDMContext[] processes = new IExecutionDMContext[] {
- SyncUtil.getContainerContext() };
+ final IExecutionDMContext[] processes = new IExecutionDMContext[] { SyncUtil.getContainerContext() };
// Resume the program to get thread running
SyncUtil.resumeAll();
// Confirm that all threads are running
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(processes, drm);
}
});
@@ -2660,14 +2867,16 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// No error should be thrown, the call should ignore running processes
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.resume(processes, drm);
}
});
// Confirm that all threads are still running
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(processes, drm);
}
});
@@ -2685,21 +2894,21 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
- final IExecutionDMContext[] processes = new IExecutionDMContext[] {
- SyncUtil.getContainerContext() };
+ final IExecutionDMContext[] processes = new IExecutionDMContext[] { SyncUtil.getContainerContext() };
- final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning =
- new ServiceEventWaitor<MIRunningEvent>(fMultiRun.getSession(), MIRunningEvent.class);
+ final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<MIRunningEvent>(
+ fMultiRun.getSession(), MIRunningEvent.class);
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.resume(processes, drm);
}
});
@@ -2709,7 +2918,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Also confirm that all processes are running
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(processes, drm);
}
});
@@ -2726,26 +2936,26 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
- eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
+ eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
// Now resume program again and wait for one of the two threads to stop
SyncUtil.resumeAll();
- eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- final IExecutionDMContext[] processes = new IExecutionDMContext[] {
- SyncUtil.getContainerContext() };
+ final IExecutionDMContext[] processes = new IExecutionDMContext[] { SyncUtil.getContainerContext() };
- final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning =
- new ServiceEventWaitor<MIRunningEvent>(fMultiRun.getSession(), MIRunningEvent.class);
+ final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<MIRunningEvent>(
+ fMultiRun.getSession(), MIRunningEvent.class);
// No error should be thrown, the call should ignore running threads
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.resume(processes, drm);
}
});
@@ -2754,7 +2964,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Also confirm that all threads are running
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(processes, drm);
}
});
@@ -2772,36 +2983,37 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitor =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
// Now resume program again and wait for one of the two threads to stop
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
// Now resume the thread again to have both running
SyncUtil.resumeAll();
- final IExecutionDMContext[] processes = new IExecutionDMContext[] {
- SyncUtil.getContainerContext() };
+ final IExecutionDMContext[] processes = new IExecutionDMContext[] { SyncUtil.getContainerContext() };
- final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning =
- new ServiceEventWaitor<MIRunningEvent>(fMultiRun.getSession(), MIRunningEvent.class);
+ final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<MIRunningEvent>(
+ fMultiRun.getSession(), MIRunningEvent.class);
// No error should be thrown, the call should ignore running threads
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.resume(processes, drm);
}
});
// Also confirm that all threads are running
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(processes, drm);
}
});
@@ -2812,29 +3024,30 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
//////////////////////////////////////////////////////////////////////
// Tests for verifying the suspend operation on processes
- //////////////////////////////////////////////////////////////////////
+ //////////////////////////////////////////////////////////////////////
/**
* Test suspend of multiple contexts with one thread which is stopped.
*/
@Test
public void testSuspendProcessOneThreadStopped() throws Throwable {
- final IExecutionDMContext[] processes = new IExecutionDMContext[] {
- SyncUtil.getContainerContext() };
+ final IExecutionDMContext[] processes = new IExecutionDMContext[] { SyncUtil.getContainerContext() };
final IMIExecutionDMContext[] threads = SyncUtil.getExecutionContexts();
assertTrue("Expected a single thread but got " + threads.length, threads.length == 1);
- // No error should be thrown, the already suspended processes should be ignored
+ // No error should be thrown, the already suspended processes should be ignored
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.suspend(processes, drm);
}
});
// Also confirm that all threads are still suspended
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(processes, drm);
}
});
@@ -2842,46 +3055,49 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Also confirm that all threads are suspended
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(threads, drm);
}
});
assertTrue("expected all threads to be suspended, but they are not", result);
-}
+ }
/**
* Test suspend of multiple contexts with one thread which is running.
*/
@Test
public void testSuspendProcessOneThreadRunning() throws Throwable {
- final IExecutionDMContext[] processes = new IExecutionDMContext[] {
- SyncUtil.getContainerContext() };
+ final IExecutionDMContext[] processes = new IExecutionDMContext[] { SyncUtil.getContainerContext() };
// Resume the program to get thread running
SyncUtil.resumeAll();
// Confirm that all threads are running
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(processes, drm);
}
});
assertFalse("expected no process to be suspended, but found some", result);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitor =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.suspend(processes, drm);
}
});
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(100)); // Thread should interrupt
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(100)); // Thread should interrupt
// Confirm that all threads are suspended
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(processes, drm);
}
});
@@ -2897,29 +3113,30 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
- final IExecutionDMContext[] processes = new IExecutionDMContext[] {
- SyncUtil.getContainerContext() };
+ final IExecutionDMContext[] processes = new IExecutionDMContext[] { SyncUtil.getContainerContext() };
final IMIExecutionDMContext[] threads = SyncUtil.getExecutionContexts();
assertTrue("Expected two threads but got " + threads.length, threads.length == 2);
- // No error should be thrown, the already suspended threads should be ignored
- runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ // No error should be thrown, the already suspended threads should be ignored
+ runAsyncCall(new AsyncRunnable<Object>() {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.suspend(processes, drm);
}
});
// Also confirm that all processes are still suspended
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(processes, drm);
}
});
@@ -2927,7 +3144,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Also confirm that all threads are still suspended
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(threads, drm);
}
});
@@ -2944,26 +3162,26 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
- eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
+ eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
// Now resume program again and wait for one of the two threads to stop
SyncUtil.resumeAll();
- eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- final IExecutionDMContext[] processes = new IExecutionDMContext[] {
- SyncUtil.getContainerContext() };
+ final IExecutionDMContext[] processes = new IExecutionDMContext[] { SyncUtil.getContainerContext() };
final IMIExecutionDMContext[] threads = SyncUtil.getExecutionContexts();
assertTrue("Expected two threads but got " + threads.length, threads.length == 2);
// No error should be thrown, the call should ignore the suspended threads
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.suspend(processes, drm);
}
});
@@ -2972,7 +3190,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Also confirm that all processes are suspended
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(processes, drm);
}
});
@@ -2980,7 +3199,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Also confirm that all threads are suspended
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(threads, drm);
}
});
@@ -2997,38 +3217,39 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitor =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
// Now resume program again and wait for one of the two threads to stop
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
// Now resume the thread again to have both running
SyncUtil.resumeAll();
- final IExecutionDMContext[] processes = new IExecutionDMContext[] {
- SyncUtil.getContainerContext() };
+ final IExecutionDMContext[] processes = new IExecutionDMContext[] { SyncUtil.getContainerContext() };
final IMIExecutionDMContext[] threads = SyncUtil.getExecutionContexts();
assertTrue("Expected two threads but got " + threads.length, threads.length == 2);
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.suspend(processes, drm);
}
});
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(100)); // confirm one thread was suspended
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(100)); // confirm the other thread was suspended
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(100)); // confirm one thread was suspended
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(100)); // confirm the other thread was suspended
// Also confirm that all processes are suspended
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(processes, drm);
}
});
@@ -3036,7 +3257,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Also confirm that all threads are suspended
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(threads, drm);
}
});
@@ -3045,7 +3267,7 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
//////////////////////////////////////////////////////////////////////
// Tests for verifying the step operation on multiple threads
- //////////////////////////////////////////////////////////////////////
+ //////////////////////////////////////////////////////////////////////
/**
* Test that the feature is not implemented. Once this fails, we will
@@ -3053,12 +3275,12 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
*/
@Test
public void testStepProcessNotImplemented() throws Throwable {
- final IExecutionDMContext[] processes = new IExecutionDMContext[] {
- SyncUtil.getContainerContext() };
+ final IExecutionDMContext[] processes = new IExecutionDMContext[] { SyncUtil.getContainerContext() };
for (final IRunControl.StepType type : IRunControl.StepType.values()) {
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.step(processes, type, drm);
}
}, true /* Not implemented yet*/);
@@ -3069,7 +3291,7 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Tests for verifying the different operations on the process and a thread.
// Because the thread is part of the process, it should be ignored,
// and the results should be as if only the process was selected.
- //////////////////////////////////////////////////////////////////////
+ //////////////////////////////////////////////////////////////////////
/**
* Test resume of multiple contexts with one thread which is stopped.
@@ -3077,14 +3299,15 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
*/
@Test
public void testResumeProcessThreadOneThreadStopped() throws Throwable {
- final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] {
- SyncUtil.getContainerContext(), SyncUtil.getExecutionContext(0) };
+ final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] { SyncUtil.getContainerContext(),
+ SyncUtil.getExecutionContext(0) };
- final ServiceEventWaitor<MIRunningEvent> eventWaitor =
- new ServiceEventWaitor<MIRunningEvent>(fMultiRun.getSession(), MIRunningEvent.class);
+ final ServiceEventWaitor<MIRunningEvent> eventWaitor = new ServiceEventWaitor<MIRunningEvent>(
+ fMultiRun.getSession(), MIRunningEvent.class);
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.resume(execDmcs, drm);
}
});
@@ -3093,7 +3316,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Also confirm that process is running
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(execDmcs, drm);
}
});
@@ -3108,33 +3332,36 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
*/
@Test
public void testResumeProcessThreadOneThreadRunning() throws Throwable {
- final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] {
- SyncUtil.getContainerContext(), SyncUtil.getExecutionContext(0) };
+ final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] { SyncUtil.getContainerContext(),
+ SyncUtil.getExecutionContext(0) };
// Resume the program to get thread running
SyncUtil.resumeAll();
// Confirm that all threads are running
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(execDmcs, drm);
}
});
assertFalse("expected no contexts to be suspended, but found some", result);
- final ServiceEventWaitor<MIRunningEvent> eventWaitor =
- new ServiceEventWaitor<MIRunningEvent>(fMultiRun.getSession(), MIRunningEvent.class);
+ final ServiceEventWaitor<MIRunningEvent> eventWaitor = new ServiceEventWaitor<MIRunningEvent>(
+ fMultiRun.getSession(), MIRunningEvent.class);
// No error should be thrown, the call should ignore running processes
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.resume(execDmcs, drm);
}
});
// Confirm that all threads are still running
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(execDmcs, drm);
}
});
@@ -3154,21 +3381,22 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
- final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] {
- SyncUtil.getContainerContext(), SyncUtil.getExecutionContext(0) };
+ final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] { SyncUtil.getContainerContext(),
+ SyncUtil.getExecutionContext(0) };
- final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning =
- new ServiceEventWaitor<MIRunningEvent>(fMultiRun.getSession(), MIRunningEvent.class);
+ final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<MIRunningEvent>(
+ fMultiRun.getSession(), MIRunningEvent.class);
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.resume(execDmcs, drm);
}
});
@@ -3178,7 +3406,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Also confirm that all processes are running
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(execDmcs, drm);
}
});
@@ -3198,26 +3427,27 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
- eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
+ eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
// Now resume program again and wait for one of the two threads to stop
SyncUtil.resumeAll();
- eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] {
- SyncUtil.getContainerContext(), SyncUtil.getExecutionContext(0) };
+ final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] { SyncUtil.getContainerContext(),
+ SyncUtil.getExecutionContext(0) };
- final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning =
- new ServiceEventWaitor<MIRunningEvent>(fMultiRun.getSession(), MIRunningEvent.class);
+ final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<MIRunningEvent>(
+ fMultiRun.getSession(), MIRunningEvent.class);
// No error should be thrown, the call should ignore running threads
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.resume(execDmcs, drm);
}
});
@@ -3226,7 +3456,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Also confirm that all threads are running
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(execDmcs, drm);
}
});
@@ -3246,26 +3477,27 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
- eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
+ eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
// Now resume program again and wait for one of the two threads to stop
SyncUtil.resumeAll();
- eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] {
- SyncUtil.getContainerContext(), SyncUtil.getExecutionContext(1) };
+ final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] { SyncUtil.getContainerContext(),
+ SyncUtil.getExecutionContext(1) };
- final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning =
- new ServiceEventWaitor<MIRunningEvent>(fMultiRun.getSession(), MIRunningEvent.class);
+ final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<MIRunningEvent>(
+ fMultiRun.getSession(), MIRunningEvent.class);
// No error should be thrown, the call should ignore running threads
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.resume(execDmcs, drm);
}
});
@@ -3274,7 +3506,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Also confirm that all threads are running
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(execDmcs, drm);
}
});
@@ -3293,36 +3526,38 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitor =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
// Now resume program again and wait for one of the two threads to stop
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
// Now resume the thread again to have both running
SyncUtil.resumeAll();
- final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] {
- SyncUtil.getContainerContext(), SyncUtil.getExecutionContext(0) };
+ final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] { SyncUtil.getContainerContext(),
+ SyncUtil.getExecutionContext(0) };
- final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning =
- new ServiceEventWaitor<MIRunningEvent>(fMultiRun.getSession(), MIRunningEvent.class);
+ final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<MIRunningEvent>(
+ fMultiRun.getSession(), MIRunningEvent.class);
// No error should be thrown, the call should ignore running threads
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.resume(execDmcs, drm);
}
});
// Also confirm that all threads are running
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(execDmcs, drm);
}
});
@@ -3353,7 +3588,7 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
//////////////////////////////////////////////////////////////////////
// Tests for verifying the suspend operation on processes
- //////////////////////////////////////////////////////////////////////
+ //////////////////////////////////////////////////////////////////////
/**
* Test suspend of multiple contexts with one thread which is stopped.
@@ -3361,22 +3596,24 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
*/
@Test
public void testSuspendProcessThreadOneThreadStopped() throws Throwable {
- final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] {
- SyncUtil.getContainerContext(), SyncUtil.getExecutionContext(0) };
+ final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] { SyncUtil.getContainerContext(),
+ SyncUtil.getExecutionContext(0) };
final IMIExecutionDMContext[] threads = SyncUtil.getExecutionContexts();
assertTrue("Expected a single thread but got " + threads.length, threads.length == 1);
- // No error should be thrown, the already suspended processes should be ignored
+ // No error should be thrown, the already suspended processes should be ignored
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.suspend(execDmcs, drm);
}
});
// Also confirm that all threads are still suspended
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(execDmcs, drm);
}
});
@@ -3384,7 +3621,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Also confirm that all threads are suspended
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(threads, drm);
}
});
@@ -3397,34 +3635,37 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
*/
@Test
public void testSuspendProcessThreadOneThreadRunning() throws Throwable {
- final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] {
- SyncUtil.getContainerContext(), SyncUtil.getExecutionContext(0) };
+ final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] { SyncUtil.getContainerContext(),
+ SyncUtil.getExecutionContext(0) };
// Resume the program to get thread running
SyncUtil.resumeAll();
// Confirm that all threads are running
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(execDmcs, drm);
}
});
assertFalse("expected no process to be suspended, but found some", result);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitor =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.suspend(execDmcs, drm);
}
});
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(100)); // Thread should interrupt
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(100)); // Thread should interrupt
// Confirm that all threads are suspended
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(execDmcs, drm);
}
});
@@ -3441,29 +3682,31 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
- final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] {
- SyncUtil.getContainerContext(), SyncUtil.getExecutionContext(0) };
+ final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] { SyncUtil.getContainerContext(),
+ SyncUtil.getExecutionContext(0) };
final IMIExecutionDMContext[] threads = SyncUtil.getExecutionContexts();
assertTrue("Expected two threads but got " + threads.length, threads.length == 2);
- // No error should be thrown, the already suspended threads should be ignored
- runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ // No error should be thrown, the already suspended threads should be ignored
+ runAsyncCall(new AsyncRunnable<Object>() {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.suspend(execDmcs, drm);
}
});
// Also confirm that all processes are still suspended
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(execDmcs, drm);
}
});
@@ -3471,7 +3714,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Also confirm that all threads are still suspended
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(threads, drm);
}
});
@@ -3489,26 +3733,27 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
- eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
+ eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
// Now resume program again and wait for one of the two threads to stop
SyncUtil.resumeAll();
- eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] {
- SyncUtil.getContainerContext(), SyncUtil.getExecutionContext(0) };
+ final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] { SyncUtil.getContainerContext(),
+ SyncUtil.getExecutionContext(0) };
final IMIExecutionDMContext[] threads = SyncUtil.getExecutionContexts();
assertTrue("Expected two threads but got " + threads.length, threads.length == 2);
// No error should be thrown, the call should ignore the suspended threads
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.suspend(execDmcs, drm);
}
});
@@ -3517,7 +3762,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Also confirm that all processes are suspended
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(execDmcs, drm);
}
});
@@ -3525,7 +3771,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Also confirm that all threads are suspended
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(threads, drm);
}
});
@@ -3543,26 +3790,27 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
- eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
+ eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
// Now resume program again and wait for one of the two threads to stop
SyncUtil.resumeAll();
- eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] {
- SyncUtil.getContainerContext(), SyncUtil.getExecutionContext(1) };
+ final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] { SyncUtil.getContainerContext(),
+ SyncUtil.getExecutionContext(1) };
final IMIExecutionDMContext[] threads = SyncUtil.getExecutionContexts();
assertTrue("Expected two threads but got " + threads.length, threads.length == 2);
// No error should be thrown, the call should ignore the suspended threads
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.suspend(execDmcs, drm);
}
});
@@ -3571,7 +3819,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Also confirm that all processes are suspended
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(execDmcs, drm);
}
});
@@ -3579,7 +3828,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Also confirm that all threads are suspended
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(threads, drm);
}
});
@@ -3597,38 +3847,40 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitor =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
// Now resume program again and wait for one of the two threads to stop
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
// Now resume the thread again to have both running
SyncUtil.resumeAll();
- final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] {
- SyncUtil.getContainerContext(), SyncUtil.getExecutionContext(0) };
+ final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] { SyncUtil.getContainerContext(),
+ SyncUtil.getExecutionContext(0) };
final IMIExecutionDMContext[] threads = SyncUtil.getExecutionContexts();
assertTrue("Expected two threads but got " + threads.length, threads.length == 2);
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.suspend(execDmcs, drm);
}
});
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(100)); // confirm one thread was suspended
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(100)); // confirm the other thread was suspended
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(100)); // confirm one thread was suspended
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(100)); // confirm the other thread was suspended
// Also confirm that all processes are suspended
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(execDmcs, drm);
}
});
@@ -3636,7 +3888,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Also confirm that all threads are suspended
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(threads, drm);
}
});
@@ -3645,7 +3898,7 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
//////////////////////////////////////////////////////////////////////
// Tests for verifying the step operation on multiple threads
- //////////////////////////////////////////////////////////////////////
+ //////////////////////////////////////////////////////////////////////
/**
* Test that the feature is not implemented. Once this fails, we will
@@ -3654,12 +3907,13 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
*/
@Test
public void testStepProcessThreadNotImplemented() throws Throwable {
- final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] {
- SyncUtil.getContainerContext(), SyncUtil.getExecutionContext(0) };
+ final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] { SyncUtil.getContainerContext(),
+ SyncUtil.getExecutionContext(0) };
for (final IRunControl.StepType type : IRunControl.StepType.values()) {
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.step(execDmcs, type, drm);
}
}, true /* Not implemented yet*/);
@@ -3670,7 +3924,7 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Tests for verifying the different operations on the process and both threads.
// Because the threads are part of the process, they should be ignored,
// and the results should be as if only the process was selected.
- //////////////////////////////////////////////////////////////////////
+ //////////////////////////////////////////////////////////////////////
/**
* Test resume of multiple contexts with two stopped threads. Only one thread
@@ -3683,21 +3937,22 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
- final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] {
- SyncUtil.getContainerContext(), SyncUtil.getExecutionContext(0), SyncUtil.getExecutionContext(1) };
+ final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] { SyncUtil.getContainerContext(),
+ SyncUtil.getExecutionContext(0), SyncUtil.getExecutionContext(1) };
- final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning =
- new ServiceEventWaitor<MIRunningEvent>(fMultiRun.getSession(), MIRunningEvent.class);
+ final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<MIRunningEvent>(
+ fMultiRun.getSession(), MIRunningEvent.class);
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.resume(execDmcs, drm);
}
});
@@ -3707,7 +3962,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Also confirm that all processes are running
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(execDmcs, drm);
}
});
@@ -3727,26 +3983,27 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
- eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
+ eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
// Now resume program again and wait for one of the two threads to stop
SyncUtil.resumeAll();
- eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] {
- SyncUtil.getContainerContext(), SyncUtil.getExecutionContext(0), SyncUtil.getExecutionContext(1) };
+ final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] { SyncUtil.getContainerContext(),
+ SyncUtil.getExecutionContext(0), SyncUtil.getExecutionContext(1) };
- final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning =
- new ServiceEventWaitor<MIRunningEvent>(fMultiRun.getSession(), MIRunningEvent.class);
+ final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<MIRunningEvent>(
+ fMultiRun.getSession(), MIRunningEvent.class);
// No error should be thrown, the call should ignore running threads
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.resume(execDmcs, drm);
}
});
@@ -3755,7 +4012,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Also confirm that all threads are running
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(execDmcs, drm);
}
});
@@ -3774,36 +4032,38 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitor =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
// Now resume program again and wait for one of the two threads to stop
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
// Now resume the thread again to have both running
SyncUtil.resumeAll();
- final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] {
- SyncUtil.getContainerContext(), SyncUtil.getExecutionContext(0), SyncUtil.getExecutionContext(1) };
+ final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] { SyncUtil.getContainerContext(),
+ SyncUtil.getExecutionContext(0), SyncUtil.getExecutionContext(1) };
- final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning =
- new ServiceEventWaitor<MIRunningEvent>(fMultiRun.getSession(), MIRunningEvent.class);
+ final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<MIRunningEvent>(
+ fMultiRun.getSession(), MIRunningEvent.class);
// No error should be thrown, the call should ignore running threads
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.resume(execDmcs, drm);
}
});
// Also confirm that all threads are running
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedSome(execDmcs, drm);
}
});
@@ -3814,7 +4074,7 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
//////////////////////////////////////////////////////////////////////
// Tests for verifying the suspend operation on processes
- //////////////////////////////////////////////////////////////////////
+ //////////////////////////////////////////////////////////////////////
/**
* Test suspend of multiple contexts with two stopped threads.
@@ -3826,29 +4086,31 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
- final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] {
- SyncUtil.getContainerContext(), SyncUtil.getExecutionContext(0), SyncUtil.getExecutionContext(1) };
+ final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] { SyncUtil.getContainerContext(),
+ SyncUtil.getExecutionContext(0), SyncUtil.getExecutionContext(1) };
final IMIExecutionDMContext[] threads = SyncUtil.getExecutionContexts();
assertTrue("Expected two threads but got " + threads.length, threads.length == 2);
- // No error should be thrown, the already suspended threads should be ignored
- runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ // No error should be thrown, the already suspended threads should be ignored
+ runAsyncCall(new AsyncRunnable<Object>() {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.suspend(execDmcs, drm);
}
});
// Also confirm that all processes are still suspended
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(execDmcs, drm);
}
});
@@ -3856,7 +4118,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Also confirm that all threads are still suspended
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(threads, drm);
}
});
@@ -3874,26 +4137,27 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
- eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
+ eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
// Now resume program again and wait for one of the two threads to stop
SyncUtil.resumeAll();
- eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] {
- SyncUtil.getContainerContext(), SyncUtil.getExecutionContext(0), SyncUtil.getExecutionContext(1) };
+ final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] { SyncUtil.getContainerContext(),
+ SyncUtil.getExecutionContext(0), SyncUtil.getExecutionContext(1) };
final IMIExecutionDMContext[] threads = SyncUtil.getExecutionContexts();
assertTrue("Expected two threads but got " + threads.length, threads.length == 2);
// No error should be thrown, the call should ignore the suspended threads
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.suspend(execDmcs, drm);
}
});
@@ -3902,7 +4166,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Also confirm that all processes are suspended
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(execDmcs, drm);
}
});
@@ -3910,7 +4175,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Also confirm that all threads are suspended
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(threads, drm);
}
});
@@ -3928,38 +4194,40 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Run program until both threads are stopped
SyncUtil.addBreakpoint("firstBreakpoint", false);
- final ServiceEventWaitor<MIStoppedEvent> eventWaitor =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRun.getSession(), MIStoppedEvent.class);
+ final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRun.getSession(), MIStoppedEvent.class);
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
// Now resume program again and wait for one of the two threads to stop
SyncUtil.resumeAll();
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
// Now resume the thread again to have both running
SyncUtil.resumeAll();
- final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] {
- SyncUtil.getContainerContext(), SyncUtil.getExecutionContext(0), SyncUtil.getExecutionContext(1) };
+ final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] { SyncUtil.getContainerContext(),
+ SyncUtil.getExecutionContext(0), SyncUtil.getExecutionContext(1) };
final IMIExecutionDMContext[] threads = SyncUtil.getExecutionContexts();
assertTrue("Expected two threads but got " + threads.length, threads.length == 2);
runAsyncCall(new AsyncRunnable<Object>() {
- @Override public void run(DataRequestMonitor<Object> drm) {
+ @Override
+ public void run(DataRequestMonitor<Object> drm) {
fMultiRun.suspend(execDmcs, drm);
}
});
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(100)); // confirm one thread was suspended
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(100)); // confirm the other thread was suspended
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(100)); // confirm one thread was suspended
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(100)); // confirm the other thread was suspended
// Also confirm that all processes are suspended
Boolean result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(execDmcs, drm);
}
});
@@ -3967,7 +4235,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
// Also confirm that all threads are suspended
result = runAsyncCall(new AsyncRunnable<Boolean>() {
- @Override public void run(DataRequestMonitor<Boolean> drm) {
+ @Override
+ public void run(DataRequestMonitor<Boolean> drm) {
fMultiRun.isSuspendedAll(threads, drm);
}
});
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/MIExpressionsNonStopTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/MIExpressionsNonStopTest.java
index b4532834aca..626903086c0 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/MIExpressionsNonStopTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/MIExpressionsNonStopTest.java
@@ -39,6 +39,6 @@ public class MIExpressionsNonStopTest extends MIExpressionsTest {
protected void setLaunchAttributes() {
super.setLaunchAttributes();
- setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP, true);
+ setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP, true);
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/MIRunControlNonStopTargetAvailableTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/MIRunControlNonStopTargetAvailableTest.java
index a2c1cd46278..0280cd15ed6 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/MIRunControlNonStopTargetAvailableTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/MIRunControlNonStopTargetAvailableTest.java
@@ -42,7 +42,7 @@ public class MIRunControlNonStopTargetAvailableTest extends MIRunControlTargetAv
}
@Test
- public void checknothing(){
+ public void checknothing() {
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/ThreadStackFrameSyncTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/ThreadStackFrameSyncTest.java
index 6aaf03d1252..4584f0fb3ed 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/ThreadStackFrameSyncTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/ThreadStackFrameSyncTest.java
@@ -61,19 +61,17 @@ import org.junit.Test;
public class ThreadStackFrameSyncTest extends BaseParametrizedTestCase {
-
final static private int DEFAULT_TIMEOUT = 1000;
-
+
private DsfServicesTracker fServicesTracker;
private IMultiRunControl fMultiRunControl;
private IGDBControl fCommandControl;
private IGDBFocusSynchronizer fGdbSync;
- private DsfSession fSession;
+ private DsfSession fSession;
private List<IDMEvent<? extends IDMContext>> fEventsReceived = new ArrayList<IDMEvent<? extends IDMContext>>();
-
+
// Breakpoint tags in MultiThread.cc
- public static final String[] LINE_TAGS = new String[] {
- "LINE_MAIN_BEFORE_THREAD_START", // Just before StartThread
+ public static final String[] LINE_TAGS = new String[] { "LINE_MAIN_BEFORE_THREAD_START", // Just before StartThread
"LINE_MAIN_AFTER_THREAD_START", // Just after StartThread
"LINE_MAIN_ALL_THREADS_STARTED", // Where all threads are guaranteed to be started.
};
@@ -93,47 +91,46 @@ public class ThreadStackFrameSyncTest extends BaseParametrizedTestCase {
public void doBeforeTest() throws Exception {
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_12);
super.doBeforeTest();
-
+
resolveLineTagLocations(SOURCE_NAME, LINE_TAGS);
fSession = getGDBLaunch().getSession();
Assert.assertNotNull(fSession);
-
+
Runnable runnable = new Runnable() {
@Override
public void run() {
-
+
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
Assert.assertTrue(fServicesTracker != null);
-
+
fCommandControl = fServicesTracker.getService(IGDBControl.class);
- Assert.assertTrue(fCommandControl != null);
-
+ Assert.assertTrue(fCommandControl != null);
+
fMultiRunControl = fServicesTracker.getService(IMultiRunControl.class);
Assert.assertTrue(fMultiRunControl != null);
-
+
fGdbSync = fServicesTracker.getService(IGDBFocusSynchronizer.class);
Assert.assertTrue(fGdbSync != null);
-
+
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
Assert.assertTrue(procService != null);
// Register to receive DSF events
- fSession.addServiceEventListener(ThreadStackFrameSyncTest.this, null);
+ fSession.addServiceEventListener(ThreadStackFrameSyncTest.this, null);
}
};
- fSession.getExecutor().submit(runnable).get();
+ fSession.getExecutor().submit(runnable).get();
}
@Override
protected void setLaunchAttributes() {
super.setLaunchAttributes();
- setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME,
- EXEC_PATH + EXEC_NAME);
+ setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EXEC_PATH + EXEC_NAME);
// Multi run control only makes sense for non-stop mode
- setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP, true);
+ setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP, true);
}
@Override
@@ -144,164 +141,163 @@ public class ThreadStackFrameSyncTest extends BaseParametrizedTestCase {
fSession.getExecutor().submit(() -> fSession.removeServiceEventListener(ThreadStackFrameSyncTest.this))
.get();
}
- fEventsReceived.clear();
-
- if (fServicesTracker!=null) fServicesTracker.dispose();
+ fEventsReceived.clear();
+
+ if (fServicesTracker != null)
+ fServicesTracker.dispose();
}
//////////////////////////////////////////////////////////////////////////////////////
// Start of tests
//////////////////////////////////////////////////////////////////////////////////////
-
-
- /**
- * This test verifies that changing the active thread, in GDB, in CLI,
- * triggers a GDB notification that a new thread has been selected.
- */
+
+ /**
+ * This test verifies that changing the active thread, in GDB, in CLI,
+ * triggers a GDB notification that a new thread has been selected.
+ */
@Test
public void testChangingCurrentThreadCLINotification() throws Throwable {
- ServiceEventWaitor<MIStoppedEvent> eventWaitor =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRunControl.getSession(), MIStoppedEvent.class);
-
+ ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRunControl.getSession(), MIStoppedEvent.class);
+
// add a breakpoint in main
SyncUtil.addBreakpoint(SOURCE_NAME + ":" + getLineForTag("LINE_MAIN_ALL_THREADS_STARTED"), false);
// add a breakpoint in thread code
SyncUtil.addBreakpoint("36", false);
- // Run program
+ // Run program
SyncUtil.resumeAll();
-
+
eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000));
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000));
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000));
-
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000));
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000));
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000));
+
// *** at this point all 5 threads should be stopped
-
- // Try some thread switching - SwitchThreadAndCaptureThreadSwitchedEvent will
- // capture the "=thread-selected" event and return the newly selected thread
+
+ // Try some thread switching - SwitchThreadAndCaptureThreadSwitchedEvent will
+ // capture the "=thread-selected" event and return the newly selected thread
// for us to compare to what we ordered
for (int i = 0; i < 2; i++) {
- assertEquals("2",switchThreadAndCaptureThreadSwitchedEvent("2"));
- assertEquals("3",switchThreadAndCaptureThreadSwitchedEvent("3"));
- assertEquals("4",switchThreadAndCaptureThreadSwitchedEvent("4"));
- assertEquals("5",switchThreadAndCaptureThreadSwitchedEvent("5"));
- assertEquals("1",switchThreadAndCaptureThreadSwitchedEvent("1"));
+ assertEquals("2", switchThreadAndCaptureThreadSwitchedEvent("2"));
+ assertEquals("3", switchThreadAndCaptureThreadSwitchedEvent("3"));
+ assertEquals("4", switchThreadAndCaptureThreadSwitchedEvent("4"));
+ assertEquals("5", switchThreadAndCaptureThreadSwitchedEvent("5"));
+ assertEquals("1", switchThreadAndCaptureThreadSwitchedEvent("1"));
}
}
-
-
+
/**
- * This test verifies that changing the active frame, in GDB, in CLI,
- * triggers a GDB notification that a new frame has been selected.
- */
+ * This test verifies that changing the active frame, in GDB, in CLI,
+ * triggers a GDB notification that a new frame has been selected.
+ */
@Test
public void testChangingCurrentFrameCLINotification() throws Throwable {
- ServiceEventWaitor<MIStoppedEvent> eventWaitor =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRunControl.getSession(), MIStoppedEvent.class);
-
+ ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRunControl.getSession(), MIStoppedEvent.class);
+
// add a breakpoint in main
SyncUtil.addBreakpoint(SOURCE_NAME + ":" + getLineForTag("LINE_MAIN_ALL_THREADS_STARTED"), false);
// add a breakpoint in thread code
SyncUtil.addBreakpoint("36", false);
// Run program
SyncUtil.resumeAll();
-
+
eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000));
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000));
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000));
-
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000));
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000));
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000));
+
// *** at this point all 5 threads should be stopped
-
+
// switch to a thread that has some stack frames
- assertEquals("2",switchThreadAndCaptureThreadSwitchedEvent("2"));
-
- // Try some stack frame switching - SwitchFrameAndCaptureThreadSwitchedEvent will
- // capture the "=thread-selected" event and return the newly selected stack frame,
+ assertEquals("2", switchThreadAndCaptureThreadSwitchedEvent("2"));
+
+ // Try some stack frame switching - SwitchFrameAndCaptureThreadSwitchedEvent will
+ // capture the "=thread-selected" event and return the newly selected stack frame,
// for us to compare to what we ordered
for (int i = 0; i < 5; i++) {
- assertEquals("1",switchFrameAndCaptureStackFrameSwitchedEvent("1"));
- assertEquals("0",switchFrameAndCaptureStackFrameSwitchedEvent("0"));
+ assertEquals("1", switchFrameAndCaptureStackFrameSwitchedEvent("1"));
+ assertEquals("0", switchFrameAndCaptureStackFrameSwitchedEvent("0"));
}
}
/**
- * This test verifies that the GDB Synchronizer service is able to set
- * the current GDB thread
- */
+ * This test verifies that the GDB Synchronizer service is able to set
+ * the current GDB thread
+ */
@Test
public void testGdbSyncServiceCanSwitchGDBThread() throws Throwable {
- ServiceEventWaitor<MIStoppedEvent> eventWaitor =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRunControl.getSession(), MIStoppedEvent.class);
-
+ ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRunControl.getSession(), MIStoppedEvent.class);
+
// add a breakpoint in main
SyncUtil.addBreakpoint(SOURCE_NAME + ":" + getLineForTag("LINE_MAIN_ALL_THREADS_STARTED"), false);
// add a breakpoint in thread code
SyncUtil.addBreakpoint("36", false);
- // Run program
+ // Run program
SyncUtil.resumeAll();
-
+
eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000));
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000));
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000));
-
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000));
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000));
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000));
+
// *** at this point all 5 threads should be stopped
-
+
// have the sync service set GDB current tid to thread 5
- fGdbSync.setFocus(new IDMContext[] {getContextForThreadId(5)}, new ImmediateRequestMonitor());
+ fGdbSync.setFocus(new IDMContext[] { getContextForThreadId(5) }, new ImmediateRequestMonitor());
assertEquals("5", getCurrentThread());
-
- fGdbSync.setFocus(new IDMContext[] {getContextForThreadId(4)}, new ImmediateRequestMonitor());
+
+ fGdbSync.setFocus(new IDMContext[] { getContextForThreadId(4) }, new ImmediateRequestMonitor());
assertEquals("4", getCurrentThread());
-
- fGdbSync.setFocus(new IDMContext[] {getContextForThreadId(3)}, new ImmediateRequestMonitor());
+
+ fGdbSync.setFocus(new IDMContext[] { getContextForThreadId(3) }, new ImmediateRequestMonitor());
assertEquals("3", getCurrentThread());
-
- fGdbSync.setFocus(new IDMContext[] {getContextForThreadId(2)}, new ImmediateRequestMonitor());
+
+ fGdbSync.setFocus(new IDMContext[] { getContextForThreadId(2) }, new ImmediateRequestMonitor());
assertEquals("2", getCurrentThread());
-
- fGdbSync.setFocus(new IDMContext[] {getContextForThreadId(1)}, new ImmediateRequestMonitor());
+
+ fGdbSync.setFocus(new IDMContext[] { getContextForThreadId(1) }, new ImmediateRequestMonitor());
assertEquals("1", getCurrentThread());
}
-
+
/**
- * This test verifies that the GDB Synchronizer service is able to set
- * the current GDB stack frame
- */
+ * This test verifies that the GDB Synchronizer service is able to set
+ * the current GDB stack frame
+ */
@Test
public void testGdbSyncServiceCanSwitchGDBStackFrame() throws Throwable {
- ServiceEventWaitor<MIStoppedEvent> eventWaitor =
- new ServiceEventWaitor<MIStoppedEvent>(fMultiRunControl.getSession(), MIStoppedEvent.class);
-
+ ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<MIStoppedEvent>(
+ fMultiRunControl.getSession(), MIStoppedEvent.class);
+
// add a breakpoint in main
SyncUtil.addBreakpoint(SOURCE_NAME + ":" + getLineForTag("LINE_MAIN_ALL_THREADS_STARTED"), false);
// add a breakpoint in thread code
SyncUtil.addBreakpoint("36", false);
- // Run program
+ // Run program
SyncUtil.resumeAll();
-
+
eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for second thread to stop
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000));
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000));
- eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000));
-
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000));
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000));
+ eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000));
+
// *** at this point all 5 threads should be stopped
final IFrameDMContext frame1 = SyncUtil.getStackFrame(1, 1);
final IFrameDMContext frame0 = SyncUtil.getStackFrame(1, 0);
-
+
// do a few of times
for (int i = 0; i < 50; i++) {
// have the sync service switch stack frame to 1
fSession.getExecutor().execute(new Runnable() {
@Override
public void run() {
- fGdbSync.setFocus(new IDMContext[] {frame1}, new ImmediateRequestMonitor());
+ fGdbSync.setFocus(new IDMContext[] { frame1 }, new ImmediateRequestMonitor());
}
});
Thread.sleep(100);
@@ -311,86 +307,83 @@ public class ThreadStackFrameSyncTest extends BaseParametrizedTestCase {
fSession.getExecutor().execute(new Runnable() {
@Override
public void run() {
- fGdbSync.setFocus(new IDMContext[] {frame0}, new ImmediateRequestMonitor());
- }
+ fGdbSync.setFocus(new IDMContext[] { frame0 }, new ImmediateRequestMonitor());
+ }
});
Thread.sleep(100);
assertEquals("0", getCurrentStackFrameLevel());
}
}
-
-
+
//////////////////////////////////////////////////////////////////////////////////////
// End of tests
//////////////////////////////////////////////////////////////////////////////////////
- // SyncUtil.getExecutionContext() takes the index of the
- // array of all threads, so it will return a thread off by one.
+ // SyncUtil.getExecutionContext() takes the index of the
+ // array of all threads, so it will return a thread off by one.
// We compensate for this in this method
- private IMIExecutionDMContext getContextForThreadId(int tid) throws InterruptedException, ExecutionException, TimeoutException {
- return SyncUtil.getExecutionContext(tid -1);
+ private IMIExecutionDMContext getContextForThreadId(int tid)
+ throws InterruptedException, ExecutionException, TimeoutException {
+ return SyncUtil.getExecutionContext(tid - 1);
}
-
- /**
- * This is a wrapper around selectGdbThread(), that waits and captures the
- * expected "=thread-selected" event, and returns the thread id from it.
- * @throws Throwable
+ /**
+ * This is a wrapper around selectGdbThread(), that waits and captures the
+ * expected "=thread-selected" event, and returns the thread id from it.
+ * @throws Throwable
*/
private String switchThreadAndCaptureThreadSwitchedEvent(String tid) throws Throwable {
Thread.sleep(100);
fEventsReceived.clear();
selectGdbThread(tid);
-
- IDMContext ctx = waitForEvent(IGDBFocusChangedEvent.class).getDMContext();
+
+ IDMContext ctx = waitForEvent(IGDBFocusChangedEvent.class).getDMContext();
if (ctx instanceof IMIExecutionDMContext) {
IMIExecutionDMContext execDmc = (IMIExecutionDMContext) ctx;
return execDmc.getThreadId();
- }
- else if (ctx instanceof IFrameDMContext) {
+ } else if (ctx instanceof IFrameDMContext) {
IMIExecutionDMContext execDmc = DMContexts.getAncestorOfType(ctx, IMIExecutionDMContext.class);
return execDmc.getThreadId();
}
return "unknown";
}
-
- /**
- * Waits and captures the expected "=thread-selected" event, and returns the frame id from it.
- * @throws Throwable
+
+ /**
+ * Waits and captures the expected "=thread-selected" event, and returns the frame id from it.
+ * @throws Throwable
*/
private String switchFrameAndCaptureStackFrameSwitchedEvent(String frameLevel) throws Throwable {
IFrameDMContext newFrame = null;
-
+
Thread.sleep(100);
fEventsReceived.clear();
selectGdbStackFrame(frameLevel);
-
+
Object[] elems = fGdbSync.getFocus();
for (Object elem : elems) {
if (elem instanceof IFrameDMContext) {
- newFrame = (IFrameDMContext)elem;
+ newFrame = (IFrameDMContext) elem;
break;
}
}
-
+
return newFrame != null ? Integer.toString(newFrame.getLevel()) : null;
}
-
-
- /**
- * Changes the current thread, using the CLI command "thread <tid>"
- * @param tid: the thread id of the thread to switch-to. If empty,
- * the command will simply report the current thread.
+
+ /**
+ * Changes the current thread, using the CLI command "thread <tid>"
+ * @param tid: the thread id of the thread to switch-to. If empty,
+ * the command will simply report the current thread.
* @return the tid of the (possibly newly) currently selected gdb thread
- * @throws Exception
+ * @throws Exception
*/
private String sendCLIThread(String tid) throws Exception {
IContainerDMContext containerDmc = SyncUtil.getContainerContext();
-
+
Query<CLIThreadInfo> query = new Query<CLIThreadInfo>() {
@Override
protected void execute(DataRequestMonitor<CLIThreadInfo> rm) {
- fCommandControl.queueCommand(new CLICommand<CLIThreadInfo>(containerDmc,"thread " + tid) {
+ fCommandControl.queueCommand(new CLICommand<CLIThreadInfo>(containerDmc, "thread " + tid) {
@Override
public CLIThreadInfo getResult(MIOutput output) {
return new CLIThreadInfo(output);
@@ -398,31 +391,31 @@ public class ThreadStackFrameSyncTest extends BaseParametrizedTestCase {
}, rm);
}
};
-
+
fCommandControl.getExecutor().execute(query);
CLIThreadInfo info = query.get();
-
- return info.getCurrentThread();
+
+ return info.getCurrentThread();
}
-
+
private String getCurrentThread() throws Exception {
return sendCLIThread("");
}
-
+
/**
* Changes the current stack frame, using the CLI command "frame <level>". Then parses
- * the output to extract the current frame.
+ * the output to extract the current frame.
* @param level the frame level wanted. If empty, the command will report the current level
- * @return newly set level.
+ * @return newly set level.
* @throws Exception
*/
private String sendCLIFrame(String level) throws Exception {
IContainerDMContext containerDmc = SyncUtil.getContainerContext();
-
+
Query<MIInfo> query = new Query<MIInfo>() {
@Override
protected void execute(DataRequestMonitor<MIInfo> rm) {
- fCommandControl.queueCommand(new CLICommand<MIInfo>(containerDmc,"frame " + level) {
+ fCommandControl.queueCommand(new CLICommand<MIInfo>(containerDmc, "frame " + level) {
@Override
public CLIThreadInfo getResult(MIOutput output) {
return new CLIThreadInfo(output);
@@ -430,109 +423,105 @@ public class ThreadStackFrameSyncTest extends BaseParametrizedTestCase {
}, rm);
}
};
-
+
fCommandControl.getExecutor().execute(query);
-
+
String frameLevel = null;
for (MIOOBRecord oobr : query.get().getMIOutput().getMIOOBRecords()) {
// if frame changed, we'll get this printout:
- if (oobr instanceof MINotifyAsyncOutput) {
- // example of output:
- // =thread-selected,id="2",frame={level="1",addr="0x00007ffff7bc4184",func="start_thread",args=[],from="/lib/x86_64-linux-gnu/libpthread.so.0"}
- MINotifyAsyncOutput out = (MINotifyAsyncOutput) oobr;
- String miEvent = out.getAsyncClass();
- if ("thread-selected".equals(miEvent)) { //$NON-NLS-1$
- // parse =thread-selected to extract current stack frame
- MIResult[] results = out.getMIResults();
- for (int i = 0; i < results.length; i++) {
- String var = results[i].getVariable();
- MIValue val = results[i].getMIValue();
- if (var.equals("frame") && val instanceof MITuple) { //$NON-NLS-1$
- // dig deeper to get the frame level
- MIResult[] res = ((MITuple)val).getMIResults();
- for (int j = 0; j < res.length; j++) {
- var = res[j].getVariable();
- val = res[j].getMIValue();
- if (var.equals("level")) { //$NON-NLS-1$
- if (val instanceof MIConst) {
- frameLevel = ((MIConst) val).getString();
- }
- }
- }
- }
- }
- }
- }
- // if frame command was not given a parameter or the parameter is already
- // the current frame, we'll get this version of the printout:
- else if (oobr instanceof MIConsoleStreamOutput) {
- // example of output (here frame = 0):
- // ~"#0 main (argc=1 ...
- String printout = ((MIConsoleStreamOutput) oobr).getCString();
- int index1 = printout.indexOf('#');
- int index2 = printout.indexOf(' ');
- if (index1 != -1 && index2 != -1) {
- frameLevel = printout.substring(index1 + 1, index2);
- break;
- }
- }
+ if (oobr instanceof MINotifyAsyncOutput) {
+ // example of output:
+ // =thread-selected,id="2",frame={level="1",addr="0x00007ffff7bc4184",func="start_thread",args=[],from="/lib/x86_64-linux-gnu/libpthread.so.0"}
+ MINotifyAsyncOutput out = (MINotifyAsyncOutput) oobr;
+ String miEvent = out.getAsyncClass();
+ if ("thread-selected".equals(miEvent)) { //$NON-NLS-1$
+ // parse =thread-selected to extract current stack frame
+ MIResult[] results = out.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ MIValue val = results[i].getMIValue();
+ if (var.equals("frame") && val instanceof MITuple) { //$NON-NLS-1$
+ // dig deeper to get the frame level
+ MIResult[] res = ((MITuple) val).getMIResults();
+ for (int j = 0; j < res.length; j++) {
+ var = res[j].getVariable();
+ val = res[j].getMIValue();
+ if (var.equals("level")) { //$NON-NLS-1$
+ if (val instanceof MIConst) {
+ frameLevel = ((MIConst) val).getString();
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ // if frame command was not given a parameter or the parameter is already
+ // the current frame, we'll get this version of the printout:
+ else if (oobr instanceof MIConsoleStreamOutput) {
+ // example of output (here frame = 0):
+ // ~"#0 main (argc=1 ...
+ String printout = ((MIConsoleStreamOutput) oobr).getCString();
+ int index1 = printout.indexOf('#');
+ int index2 = printout.indexOf(' ');
+ if (index1 != -1 && index2 != -1) {
+ frameLevel = printout.substring(index1 + 1, index2);
+ break;
+ }
+ }
}
return frameLevel;
}
-
+
private String getCurrentStackFrameLevel() throws Throwable {
return sendCLIFrame("");
}
-
-
- @DsfServiceEventHandler
+
+ @DsfServiceEventHandler
public void eventDispatched(IDMEvent<? extends IDMContext> e) {
- synchronized(this) {
- fEventsReceived.add(e);
- notifyAll();
- }
- }
-
- private void selectGdbThread(String tid) throws Throwable {
- queueConsoleCommand(String.format("thread %s", tid));
- }
-
- private void selectGdbStackFrame(String frameLevel) throws Throwable {
- queueConsoleCommand(String.format("frame %s", frameLevel));
- }
-
- private void queueConsoleCommand(String command) throws Throwable {
- queueConsoleCommand(command, TestsPlugin.massageTimeout(DEFAULT_TIMEOUT), TimeUnit.MILLISECONDS);
- }
-
- private void queueConsoleCommand(final String command, int timeout, TimeUnit unit) throws Throwable {
+ synchronized (this) {
+ fEventsReceived.add(e);
+ notifyAll();
+ }
+ }
+
+ private void selectGdbThread(String tid) throws Throwable {
+ queueConsoleCommand(String.format("thread %s", tid));
+ }
+
+ private void selectGdbStackFrame(String frameLevel) throws Throwable {
+ queueConsoleCommand(String.format("frame %s", frameLevel));
+ }
+
+ private void queueConsoleCommand(String command) throws Throwable {
+ queueConsoleCommand(command, TestsPlugin.massageTimeout(DEFAULT_TIMEOUT), TimeUnit.MILLISECONDS);
+ }
+
+ private void queueConsoleCommand(final String command, int timeout, TimeUnit unit) throws Throwable {
Query<MIInfo> query = new Query<MIInfo>() {
@Override
protected void execute(DataRequestMonitor<MIInfo> rm) {
- fCommandControl.queueCommand(
- fCommandControl.getCommandFactory().createMIInterpreterExecConsole(
- fCommandControl.getContext(),
- command),
- rm);
+ fCommandControl.queueCommand(fCommandControl.getCommandFactory()
+ .createMIInterpreterExecConsole(fCommandControl.getContext(), command), rm);
}
};
fSession.getExecutor().execute(query);
query.get(timeout, unit);
- }
+ }
- private <V extends IDMEvent<? extends IDMContext>> V waitForEvent(Class<V> eventType) throws Exception {
- return waitForEvent(eventType, TestsPlugin.massageTimeout(DEFAULT_TIMEOUT));
- }
+ private <V extends IDMEvent<? extends IDMContext>> V waitForEvent(Class<V> eventType) throws Exception {
+ return waitForEvent(eventType, TestsPlugin.massageTimeout(DEFAULT_TIMEOUT));
+ }
- @SuppressWarnings("unchecked")
- private <V extends IDMEvent<? extends IDMContext>> V waitForEvent(Class<V> eventType, int timeout) throws Exception {
- IDMEvent<?> event = getEvent(eventType);
- if (event == null) {
- synchronized(this) {
+ @SuppressWarnings("unchecked")
+ private <V extends IDMEvent<? extends IDMContext>> V waitForEvent(Class<V> eventType, int timeout)
+ throws Exception {
+ IDMEvent<?> event = getEvent(eventType);
+ if (event == null) {
+ synchronized (this) {
try {
wait(timeout);
- }
- catch (InterruptedException ex) {
+ } catch (InterruptedException ex) {
}
}
event = getEvent(eventType);
@@ -540,20 +529,18 @@ public class ThreadStackFrameSyncTest extends BaseParametrizedTestCase {
throw new Exception(String.format("Timed out waiting for '%s' to occur.", eventType.getName()));
}
}
- return (V)event;
+ return (V) event;
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked")
private synchronized <V extends IDMEvent<? extends IDMContext>> V getEvent(Class<V> eventType) {
for (IDMEvent<?> e : fEventsReceived) {
if (eventType.isAssignableFrom(e.getClass())) {
fEventsReceived.remove(e);
- return (V)e;
+ return (V) e;
}
}
return null;
- }
+ }
-
-
}

Back to the top