Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt')
-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
460 files changed, 31049 insertions, 30899 deletions
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));
}
}
}

Back to the top