diff options
Diffstat (limited to 'debug/org.eclipse.cdt.debug.mi.core')
398 files changed, 0 insertions, 39011 deletions
diff --git a/debug/org.eclipse.cdt.debug.mi.core/.classpath b/debug/org.eclipse.cdt.debug.mi.core/.classpath deleted file mode 100644 index 0afe5291481..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/.classpath +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="src" path="mi"/> - <classpathentry kind="src" path="cdi"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/debug/org.eclipse.cdt.debug.mi.core/.cvsignore b/debug/org.eclipse.cdt.debug.mi.core/.cvsignore deleted file mode 100644 index ba077a4031a..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -bin diff --git a/debug/org.eclipse.cdt.debug.mi.core/.options b/debug/org.eclipse.cdt.debug.mi.core/.options deleted file mode 100644 index 76c7d9926fc..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/.options +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.cdt.debug.mi.core/debug=true
\ No newline at end of file diff --git a/debug/org.eclipse.cdt.debug.mi.core/.project b/debug/org.eclipse.cdt.debug.mi.core/.project deleted file mode 100644 index ccce5584ad9..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/.project +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.cdt.debug.mi.core</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.jdt.core.javanature</nature> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature> - </natures> -</projectDescription> diff --git a/debug/org.eclipse.cdt.debug.mi.core/.settings/org.eclipse.jdt.core.prefs b/debug/org.eclipse.cdt.debug.mi.core/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 397ee5a8e4b..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,74 +0,0 @@ -#Wed Apr 08 15:56:28 BST 2009 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning -org.eclipse.jdt.core.compiler.problem.deadCode=warning -org.eclipse.jdt.core.compiler.problem.deprecation=warning -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore -org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore -org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=error -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore -org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning -org.eclipse.jdt.core.compiler.problem.nullReference=error -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error -org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning -org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedImport=error -org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/debug/org.eclipse.cdt.debug.mi.core/ChangeLog b/debug/org.eclipse.cdt.debug.mi.core/ChangeLog deleted file mode 100644 index 83856982c5f..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/ChangeLog +++ /dev/null @@ -1,1219 +0,0 @@ -2006-08-31 Mikhail Khodjaiants - Bug 155816: NPE thrown by info threads - Applied patch from James Blackburn (jamesblackburn+eclipse@gmail.com). - * Target.java - -2006-08-22 Mikhail Khodjaiants - Bug 145758: Unable to use the default command factories. - * MANIFEST.MF - -2006-08-22 Mikhail Khodjaiants - Bug 146725: Erroneous error message during GDB startup. - * CygwinGDBCDIDebugger2.java - * GDBCDIDebugger2.java - * CommandFactory.java - + MIGDBSetNewConsole.java - * StandardLinuxCommandFactory.java - -2006-08-22 Mikhail Khodjaiants - Bug 153894: Variable View: Can not format 'short int' to Hex. - Applied patch from James Blackburn (jamesblackburn+eclipse@gmail.com). - * SourceManager.java - -2006-05-25 Mikhail Khodjaiants - Bug 137970: No default debugger in C++ managed project. - * MIPlugin.java - -2006-05-25 Mikhail Khodjaiants - Bug 109733: Request to make certain methods as public (MISession and MIInferior). - * MIInferior.java - * MISession.java - -2006-05-25 Mikhail Khodjaiants - Bug 109733: Request to make certain methods as public (null check for setPrompt). - * RxThread.java - -2006-04-21 Mikhail Khodjaiants - Don't create pty when using gdbserver. - * AbstractGDBCDIDebugger.java - * GDBServerCDIDebugger2.java - -2006-04-21 Mikhail Khodjaiants - Close the pty if the session creation failed. - * MIPlugin.java - -2006-04-18 Mikhail Khodjaiants - Duplicate message key. - * MIPluginResources.properties - * AbstractGDBCDIDebugger.java - -2006-04-17 Mikhail Khodjaiants - Breakpoint can be temporary and hardware at the same time. - * MIBreakInsert.java - -2006-04-16 Mikhail Khodjaiants - Bug 113107: Make trace logs more readily available. - * AbstractGDBCDIDebugger.java - * IMILaunchConfigurationConstants.java - -2006-04-13 Mikhail Khodjaiants - Bug 113107: Make trace logs more readily available. - Core support for the "Verbose Mode" action. - * Target.java - * MISession.java - * RxThread.java - * AbstractGDBCDIDebugger.java - + GDBProcess.java - -2006-04-12 Mikhail Khodjaiants - Write log messages to the system out instead of err. - * MIPlugin.java - -2006-04-12 Mikhail Khodjaiants - Bug 136206: Suppress Resumed events when processing solib events. - * EventManager.java - * RxThread.java - * Command.java - * MIEvent.java - -2006-04-12 Mikhail Khodjaiants - Bug 119740: allow to specify only a subset of shared objects that we want symbols to be loaded for. - Support for deferred breakpoints. - * BreakpointManager.java - * EventManager.java - * SharedLibraryManager.java - * Target.java - * GDBCDIDebugger.java - * GDBCDIDebugger2.java - * GDBDebugger.java - -2006-04-10 Mikhail Khodjaiants - Bug 119740: allow to specify only a subset of shared objects that we want symbols to be loaded for. - * SharedLibraryManager.java - * GDBCDIDebugger2.java - * IMILaunchConfigurationConstants.java - * MICoreUtils.java - -2006-04-10 Mikhail Khodjaiants - "set solib-search-path" and "show solib-search-path" are not supported on Windows. - * StandardWinCommandFactory.java - -2006-04-03 Mikhail Khodjaiants - Bug 134617: The "stop on shared library event" option doesn't work. - * GDBCDIDebugger2.java - -2006-03-31 Mikhail Khodjaiants - Corrected position of the "try-catch-finally" clause in createSession. - * AbstractGDBCDIDebugger.java - -2006-03-31 Mikhail Khodjaiants - Throw OperationCanceledException instead of IOException when getGDBprocess is canceled. - * MIProcessAdapter.java - -2006-03-27 Mikhail Khodjaiants - Cleaned up the "Session" class constructors. - * Session.java - -2006-03-27 Mikhail Khodjaiants - Added the "getSessionConfiguration" method to allow clients to provide their own session configurations. - * AbstractGDBCDIDebugger.java - -2006-03-23 Mikhail Khodjaiants - Pass ILaunch instead of ILaunchConfiguration. - Added "getGDBPath" method. - * AbstractGDBCDIDebugger.java - * CygwinGDBCDIDebugger2.java - * GDBCDIDebugger2.java - * GDBServerCDIDebugger2.java - -2006-03-23 Mikhail Khodjaiants - Added default attribute value for ATTR_DEBUG_NAME. - * IMILaunchConfigurationConstants.java - -2006-03-21 Mikhail Khodjaiants - Missing error message. - * MIPluginResources.properties - -2006-03-20 Mikhail Khodjaiants - Made "getCommandFile" and "getWorkingDirectory" methods protected. - * GDBCDIDebugger2.java - -2006-03-16 Mikhail Khodjaiants - ILaunch is added to the arguments list of "doStartSession". - * AbstractGDBCDIDebugger.java - * CygwinGDBCDIDebugger2.java - * GDBCDIDebugger2.java - -2006-03-13 Mikhail Khodjaiants - Added default implementation for "getExtraArguments". No need to force - clients to implement this method. - * AbstractGDBCDIDebugger.java - -2006-02-09 Mikhail Khodjaiants - Bug 114793: Add an extension point to contribute command factories. - Registered windows and linux specific command factories for gdbserver. - * plugin.properties - * plugin.xml - -2006-02-09 Mikhail Khodjaiants - The inferior is in the suspended state when connecting to gsbserver. - * GDBServerCDIDebugger2.java - -2006-02-08 Mikhail Khodjaiants - Bug 114793: Add an extension point to contribute command factories. - Added standard command factory for gdb server. - * plugin.xml - * plugin.properties - -2006-02-07 Mikhail Khodjaiants - Bug 114793: Add an extension point to contribute command factories. - + mi/org/eclipse/cdt/debug/mi/core/command/factories/linux (package) - + LinuxCLIInfoSharedLibrary.java - + LinuxCLIInfoSharedLibraryInfo.java - + StandardLinuxCommandFactory.java - * plugin.xml - -2006-02-07 Mikhail Khodjaiants - Bug 126789: Use new "fullname" attribute of stack frame description. - * MIStackListFrames.java - * MIFrame.java - -2006-02-06 Mikhail Khodjaiants - Suppress "set auto-solib" - returns error on Windows. - * StandardWinCommandFactory.java - -2006-02-06 Mikhail Khodjaiants - Use getters to access members of "MICommand". - * MIBreakCondition.java - * MICommand.java - * MIDataDisassemble.java - * MIEnvironmentCD.java - * MIGDBSetEnvironment.java - -2006-02-06 Mikhail Khodjaiants - Bug 114793: Add an extension point to contribute command factories. - * MANIFEST.MF - * CommandFactory.java - + mi/org/eclipse/cdt/debug/mi/core/command/factories (package) - + CommandFactoriesMessages.java - + CommandFactoriesMessages.properties - + CommandFactoryDescriptor.java - + CommandFactoryManager.java - + StandardCommandFactory.java - + mi/org/eclipse/cdt/debug/mi/core/command/factories/win32 (package) - + CygwinCommandFactory.java - + CygwinMIEnvironmentCD.java - + CygwinMIEnvironmentDirectory.java - + StandardWinCommandFactory.java - + WinCLIInfoSharedLibrary.java - + WinCLIInfoSharedLibraryInfo.java - + WinMIEnvironmentCD.java - * CLIInfoSharedLibraryInfo.java - + commandFactories.exsd - - CygwinCommandFactory.java - * CygwinGDBCDIDebugger.java - * CygwinGDBCDIDebugger2.java - * CygwinGDBDebugger.java - - CygwinMIEnvironmentCD.java - - CygwinMIEnvironmentDirectory.java - * GDBCDIDebugger2.java - * IMILaunchConfigurationConstants.java - * MIPlugin.java - * plugin.xml - * plugin.properties - -2006-01-31 Mikhail Khodjaiants - Bug 124966: GDBTypeParser.parse(String) parses incorrectly. - Applied patch from Matthias Spycher (matthias@coware.com). - * GDBTypeParser.java - -2006-01-27 Mikhail Khodjaiants - Bug 107202: slow debug launch with external sources. - Use "-p" option when passing a large number of directories to "cygpath". - * CygwinMIEnvironmentDirectory.java - -2006-01-25 Mikhail Khodjaiants - Reversing changes made to fix bug 107571. The fix for bug 119683 covers this problem too. - * mi/org/eclipse/cdt/debug/mi/core/MISession.java - -2006-01-23 Mikhail Khodjaiants - Bug 119683: long messages during launch cause gdb to timeout, launch to fail. - * plugin.xml - * plugin.properties - * MISession.java - + AbstractGDBCDIDebugger.java - + CygwinGDBCDIDebugger2.java - + GDBCDIDebugger2.java - + GDBServerCDIDebugger2.java - * MIPlugin.java - * MIPluginResources.properties - -2006-01-04 Mikhail Khodjaiants - Bug 118900: Display libraries loaded in post-mortem debug. - Applied with modifications the patch from Joanne Woo (jwoo.mvista.com). - * GDBCDIDebugger.java - -2005-12-27 Mikhail Khodjaiants - Cleanup. - * BreakpointManager.java - * RegisterManager.java - -2005-12-27 Mikhail Khodjaiants - Bug 109526: Support Eclipse-LazyStart and deprecate Eclipse-AutoStart. - * MANIFEST.MF - -2005-12-20 Mikhail Khodjaiants - Bug 120390: Avoiding .gdbinit - * GDBCDIDebugger.java - * GDBDebugger.java - * GDBServerCDIDebugger.java - * GDBServerDebugger.java - * IMILaunchConfigurationConstants.java - * MIPlugin.java - -2005-11-29 Mikhail Khodjaiants - Partial fix for bug 118114: Cannot view typedef'ed array in debugger. - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/VariableDescriptor.java - -2005-11-29 Mikhail Khodjaiants - Bug 100298: [Memory View] Changing variable's value from variables view or memory view doesn't sync to each other. - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/MemoryBlock.java - -2005-11-02 Mikhail Khodjaiants - Bug 113364: Wrong values displaying an array of structures. - Previous fix didn't work for classes with access specifiers. - * cdi/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/VariableDescriptor.java - -2005-10-21 Mikhail Khodjaiants - Bug 113364: Wrong values displaying an array of structures. - * cdi/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/VariableDescriptor.java - -2005-10-18 Mikhail Khodjaiants - Bug 106632: Invalid detail value for arrays with dimension greater than 100. - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java - -2005-10-18 Mikhail Khodjaiants - Bug 111568: Fix for corrupt stack messages not working. - Applied patch from Timesys. - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java - -2005-09-01 Mikhail Khodjaiants - Bug 108636: mi level selection option should be moved to the gdb page. - * src/org/eclipse/cdt/debug/mi/core/GDBCDIDebugger.java - * src/org/eclipse/cdt/debug/mi/core/GDBServerCDIDebugger.java - * src/org/eclipse/cdt/debug/mi/core/IMILaunchConfigurationConstants.java - * src/org/eclipse/cdt/debug/mi/core/MIPlugin.java - -2005-09-01 Mikhail Khodjaiants - Bug 108424: Debugger stops on removed breakpoints. - * cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java - -2005-08-31 Alain Magloire - Improve performance by caching the type result on the frame - and on the RegisterManager. The patch is originally from Chris Wiebe - with modifications. - * cdi/org/eclipse/cdt/debug/mi/core/cdi/RegisterManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Register.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/StackFrame.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/VariableDescriptor.java - -2005-08-31 Alain Magloire - Fix Pr 107571: Do not create the Console pipe is we - have no consumer. - * mi/org/eclipse/cdt/debug/mi/core/MISession.java - -2005-08-28 Alain Magloire - Speed improvement after exchanging with the HP folks. - HP has apps having hundred of local variable running on machine - with hundred of registers. The latency of the command "-var-create" - is too taxing. So we take the approach of not waiting for post command - MISession.postCommand(MIVarCreate, -1) and synchronize when we need the - mi varObj. - - The next step will be to cache the types, since sending ptype/whatis - is also time consuming. - - * cdi/org/eclipse/cdt/debug/mi/core/cdi/ExpressionManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/RegisterManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Argument.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/GlobalVariable.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/LocalVariable.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Register.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/ThreadStorage.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java - * mi/org/eclipse/cdt/debug/mi/core/RxThread.java - -2005-08-26 Mikhail Khodjaiants - Bug 108130: wrong type shown on breakpoint view for R watchpoint created from gdb console. - * cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java - -2005-08-25 Mikhail Khodjaiants - Bug 66446: Use the debugger path as a debugger process label. - * src/org/eclipse/cdt/debug/mi/core/GDBCDIDebugger.java - -2005-07-28 Alain Magloire - Fix Pr 104421: The register did not update. - * cdi/org/eclipse/cdt/debug/mi/core/cdi/RegisterManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Register.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/StackFrame.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Value.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/VariableDescriptor.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/ArrayValue.java - -2005-07-26 Alain Magloire - Fix for 92446 - * cdi/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Value.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java - -2005-07-21 Alain Magloire - Fix for PR 103193 - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/LocationBreakpoint.java - * src/org/eclipse/cdt/debug/mi/core/MIPlugin.java - -2005-07-18 Alain Magloire - GDB has now four different version of MI, so it has become - important to give the user the choice of the version. - * mi/org/eclipse/cdt/debug/mi/core/MISession.java - * mi/org/eclipse/cdt/debug/mi/core/RxThread.java - * mi/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java - * mi/org/eclipse/cdt/debug/mi/core/command/MICommand.java - + mi/org/eclipse/cdt/debug/mi/core/command/MIVersion.java - * src/org/eclipse/cdt/debug/mi/core/GDBCDIDebugger.java - * src/org/eclipse/cdt/debug/mi/core/GDBDebugger.java - * src/org/eclipse/cdt/debug/mi/core/GDBServerCDIDebugger.java - * src/org/eclipse/cdt/debug/mi/core/MIPlugin.java - * src/org/eclipse/cdt/debug/mi/core/MIProcessAdapter.java - -2005-07-10 Alain Magloire - Fix for PR 100992: Setting breakpoints for methods - * cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java - -2005-07-07 Alain Magloire - Try to suspend the target before disconnecting. - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java - -2005-06-29 Alain Magloire - Fix PR 100602 - * mi/org/eclipse/cdt/debug/mi/core/GDBTypeParser.java - -2005-06-28 Alain Magloire - Fix PR 94612: addr =<PENDING> - * mi/org/eclipse/cdt/debug/mi/core/MIFormat.java - -2005-06-27 Alain Magloire - New command from newer version of gdb "set breakpoint pending" - better handling of the breakpoint while the target is running. - * cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java - * mi/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java - + mi/org/eclipse/cdt/debug/mi/core/ccommand/MIGDBSetBreakpoinPending.java - -2005-06-27 Alain Magloire - Bug when parsing "int *&" corrected. - Change in ICDIReferenceValue. - Use the type in the response of the var-create instead of reissuing -var-info-type - - * cdi/org/eclipse/cdt/debug/mi/core/cdi/CdiResource.properties - * cdi/org/eclipse/cdt/debug/mi/core/cdi/SignalManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/ SourceManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Value.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java - * cdi;/org/eclipse/cdt/debug/mi/core/cdi/model/CharValue.java - * cdi;/org/eclipse/cdt/debug/mi/core/cdi/model/IntergralValue.java - * cdi;/org/eclipse/cdt/debug/mi/core/cdi/model/PointerValue.java - * cdi;/org/eclipse/cdt/debug/mi/core/cdi/model/ReferenceValue.java - * mi/org/eclipse/cdt/debug/mi/core/GDBTypeParser.java - * mi/org/eclipse/cdt/debug/mi/core/MIInferior.java - -2005-06-27 Alain Magloire - Base on a patch from Chris Wiebe. - * cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java - -2005-06-27 Alain Magloire - Fix PR 100069 - * cdi/org/eclipse/cdt/debug/mi/core/cdi/Location.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/Locator.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/StackFrame.java - -2005-06-27 Alain Magloire - Refactor the class extending CLICommand to CLIXXXX for more clarity. - Pass the MIVersion in all of the class extending MICommand, this is - necessary some command option will not be accepted depending on the version. - Too much file to enumerate. - * ... - -2005-06-25 Alain Magloire - We should consider a "^done" like a suspended only for CLICommands, for example: - (gdb) run - ^done - (gdb) - * mi/org/eclipse/cdt/debug/mi/core/RxThread.java - -2005-06-06 Alain Magloire - Fix PR 98182 - * cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/LocationBreakpoint.java - -2005-05-25 Alain Magloire - Fix PR 95705 - * mi/org/eclipse/cdt/debug/mi/core/output/MIInfoSharedLibraryInfo.java - -2005-05-16 Alain Magloire - Fix PR 91975 - * cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java - -2005-05-12 Alain Magloire - Fix PR 94841 - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java - -2005-04-28 Alain Magloire - Added command -gdb-show endian - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java - * mi/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java - + mi/org/eclipse/cdt/debug/mi/core/command/MIGDBShowEndian.java - - mi/org/eclipse/cdt/debug/mi/core/command/MIShowEndian.java - + mi/org/eclipse/cdt/debug/mi/core/output/MIGDBShowEndianInfo.java - - mi/org/eclipse/cdt/debug/mi/core/output/MIGDBShowEndian.java - -2005-04-27 Alain Magloire - Changes in the CDI interface - * cdi/org/eclipse/cdt/debug/core/cdi/model/BreakpointManager.java - * cdi/org/eclipse/cdt/debug/core/cdi/model/Session.java - * cdi/org/eclipse/cdt/debug/core/cdi/model/SourceManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java - * mi/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java - * mi/org/eclipse/cdt/debug/mi/core/command/MIEnvrionmentDirectory.java - * src/org/eclipse/cdt/debug/mi/core/CygwinCommandfactory.java - * src/org/eclipse/cdt/debug/mi/core/CygwinMIEnvironmentDirectory.java - -2005-04-25 Alain Magloire - * cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManger.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/CdiResources.properties - * cdi/org/eclipse/cdt/debug/mi/core/cdi/Location.java - + cdi/org/eclipse/cdt/debug/mi/core/cdi/Locator.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/MI2CDIException.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/SharedLibraryManager.java - - + cdi/org/eclipse/cdt/debug/mi/core/cdi/model/AddressBreakpoint.java - + cdi/org/eclipse/cdt/debug/mi/core/cdi/model/FunctionBreakpoint.java - + cdi/org/eclipse/cdt/debug/mi/core/cdi/model/LineBreakpoint.java - + cdi/org/eclipse/cdt/debug/mi/core/cdi/model/LocationBreakpoint.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Breakpoint.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Exceptionpoint.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/StackFrame.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Threa.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Watchpoint.java - -2005-04-05 Alain Magloire - PR 90090 - * cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/event/ExitedEvent.java - -2005-03-24 Alain Magloire - * cdi/org/eclipse/cdt/debug/mi/core/cdi/MemoryManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/Memoryblock.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/Target.java - * mi/org/eclipse/cdt/debug/mi/core/command/MIShowEndian.java - * mi/org/eclipse/cdt/debug/mi/core/output/MIShowEndianInfo.java - -2005-03-23 Alain Magloire - Changes in the CDI ICDIMemoryBlock && ICDIMemoryBlockManagement API. - * cdi/org/eclipse/cdt/debug/mi/core/cdi/MemoryManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/MemoryBlock.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java - -2005-03-09 Mikhail Khodjaiants - Fix for bug 87546: Obsolete debug MI settings in Preference need to be removed. - * RegisterManager.java - * IMIConstants.java - * MIPreferenceInitializer.java - -2005-03-07 Alain Magloire - Fix for 87230: base on Jayaprakash ideas/patch - On HP statck-list-frames answer contain not kosher strings - * mi/org/eclipse/cdt/debug/mi/core/output/MIParser.java - -2005-02-01 Alain Magloire - Part of Fix for PR 84165 - We check in the expression is a number and - add a "*" for address watchpoint - * cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java - -2005-01-20 Mikhail Khodjaiants - Fix for bug 83355: The disable/enable breakpoints durning debugging acts weird. - * cdi\org\eclipse\cdt\debug\mi\core\cdi\model\Breakpoint.java - * cdi\org\eclipse\cdt\debug\mi\core\cdi\BreakpointManager.java - -2005-01-13 Alain Magloire - PR 82764 Fix the the type parsing. - * mi/org/eclipse/cdt/debug/mi/core/GDBTypeParser.java - -2005-01-10 Mikhail Khodjaiants - PR 82601 changes to the memory block interface - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/ICDIMemoryBlock.java - * mi/org/eclipse/cdt/debug/mi/core/output/MIMemory.java - -2005-01-10 Alain Magloire - Fix for PR 82506 - * mi/org/eclipse/cdt/debug/mi/core/MISession.java - * mi/org/eclipse/cdt/debug/mi/core/output/MIParser.java - -2004-12-20 Alain Magloire - Fix for PR 81019 for MacOsX - * mi/org/eclipse/cdt/debug/mi/core/output/MIVarListChildrenInfo.java - -2004-11-26 Alain Magloire - Make the deferred breakpoint on by default. - * cdi/org/eclipose/cdt/debug/mi/core/cdi/SharedLibraryManager.java - -2004-11-26 Alain Magloire - Final fix for PR 79583 - * cdi/org/eclipose/cdt/debug/mi/core/cdi/EventManager.java - * cdi/org/eclipose/cdt/debug/mi/core/cdi/SharedLibraryManager.java - -2004-11-26 Alain Magloire - Final fix for PR 79452 - * cdi/org/eclipose/cdt/debug/mi/core/cdi/BreapointManager.java - -2004-11-26 Alain Magloire - Fix for PR 79582 - * src/org/eclipse/cdt/debug/mi/core/CygwinGDBCDIDebugger.java - * src/org/eclipse/cdt/debug/mi/core/GDBServerCDIDebugger.java - -2004-11-24 Alain Magloire - Make the terminate() more responsive when gdb is shuting down. - See long discussion part of the 77435 fixes and 40087. - - * cdi/org/eclipse/cdt/debug/mi/core/cdi/ExpressionManager.java - * mi/org/eclipse/cdt/debug/core/MIInferior.java - -2004-11-23 Alain Magloire - Tentative fix for 77435 - * cdi/org/eclipse/cdt/debug/mi/core/cdi/SourceManager.java - -2004-11-19 Alain Magloire - Protect agains possible NPE. - * cdi/org/eclipse/cdt/debug/mi/core/cdi/RegisterManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/SourceManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/VariableDescriptor.java - -2004-11-19 Alain Magloire - Use the qualified name when creating a register. - Destroy the corresponding gdb variable on register's disposal. - * cdi/org/eclipse/cdt/debug/mi/core/cdi/RegisterManager.java - - Added the "dispose" method. - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Register.java - -2004-11-19 Alain Magloire - RegisterManager.findRegister() was not implemented correctly - * cdi/org/eclipse/cdt/debug/mi/core/cdi/RegisterManager.java - -2004-11-19 Alain Magloire - No need for stackframe when creating the Type class, - but rather use the target in the constructor. - -2004-11-19 Alain Magloire - Fix for 78816 - * src/org/eclipse/cdt/debug/mi/core/MIPlugin.java - -2004-11-19 Alain Magloire - - Clear the confusion about sublist of stackframes. - PR 78611 - - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java - -2004-11-17 David Inglis - - ICDIDebugger change to use IBinaryObject instead of IBnaryExecutable - - * stc/org/eclipse/cdt/debug/mi/core/GDBCDIDebugger.java - -2004-11-17 Alain Magloire - Fix for 78816 - * mi/org/eclipse/cdt/debug/mi/core/MIInferior.java - -2004-11-16 Alain Magloire - Optimize things by providing a new method - ICDIRegisterGroup.hasRegisters(); - * cdi/org/eclipse/cdt/debug/core/cdi/model/RegisterGroup.java - -2004-11-16 Alain Magloire - Remove some warnings and use the new Launch key - to decide whether or not to use pseudo tty. - * mi/org/eclipse/cdt/debug/mi/core/TxThread.java - * mi/org/eclipse/cdt/debug/mi/core/command/RawCommand.java - * src/org/eclipse/cdt/debug/mi/core/MIPlugin.java - -2004-11-16 Alain Magloire - NPE when watchpoints are set in the gdb console. - * cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java - -2004-11-16 Alain Magloire - Do not check for isEnable() when changing condition. - * cdi/org/eclipse/cdt/debug/mi/core/cdi/mode/Breakpoint.java - -2004-11-12 Mikhail Khodjaiants - Implemented the "equals' method of the "Condition" class. - * cdi/org/eclipse/cdt/debug/mi/core/cdi/Condition.java - -2004-11-12 Alain Magloire - Fix for PR 78488 - * mi/org/eclipse/cdt/debug/mi/core/command/MICommand.java - -2004-11-11 Alain Magloire - Fix for PR 75000, from PalmSource - * cdi/org/eclipse/cdt/debug/core/cdi/model/Variable.java - * cdi/org/eclipse/cdt/debug/core/cdi/model/VariableDescriptor.java - * mi/org/eclipse/cdt/debug/mi/core/command/MIVarInfoType.java - -2004-11-10 Alain Magloire - Fix for PR 51113 and PR 66268 - It allow more flexibility in the GDB console, for example - when gdb require interactive questions. - - * mi/org/eclipse/cdt/debug/mi/core/CLIProcessor.java - * mi/org/eclipse/cdt/debug/mi/core/MISession.java - * mi/org/eclipse/cdt/debug/mi/core/RxThread.java - * mi/org/eclipse/cdt/debug/mi/core/SessionProcess.java - * mi/org/eclipse/cdt/debug/mi/core/TxThread.java - * mi/org/eclipse/cdt/debug/core/command/MIGDBShowPrompt.java - * mi/org/eclipse/cdt/debug/core/command/RawCommand.java - * mi/org/eclipse/cdt/debug/core/output/MIOutput.java - * mi/org/eclipse/cdt/debug/core/output/MIParser.java - -2004-11-09 Alain Magloire - Throw not implemented exception for exception breakpoint - -2004-11-09 Alain Magloire - Reverting the changes below, for PR 74496. After exchanging with - the Palm folks, it was not fixing the problem. - This PR can not be fix for CDT-2.1 moving - it to 3.0 where we should have enough framework for a better fix. - - * cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java - -2004-11-08 Alain Magloire - Fix for 74496 ; we should destroy the global - variables if they are in the address range of a - shared library being unloaded. - - * cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java - -2004-11-08 Mikhail Khodjaiants - Added support for refresh preferences and properties. - * IMIConstants.java - * MIPlugin.java - * MIPreferenceInitializer.java: new - * RegisterManager.java - * SharedLibraryManager.java - * plugin.xml - -2004-11-08 Alain Magloire - Implement new Interface ICDIFunctionFinished. - It returns the return value of the function. - * cdi/org/eclipse/cdt/debug/mi/core/cdi/FunctionFinished.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/event/SuspendedEvent.java - * mi/org/eclipse/cdt/debug/mi/core/event/MIFuncitonFinishedEvent.java - -2004-11-07 Alain Magloire - Support for MIInterpreterExec - -2004-11-03 Alain Magloire - Partial fix for 77435 - * cdi/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/VariableDescriptor.java - -2004-11-02 Alain Magloire - Refactor ICDIConfiguratio --> ICDISessionConfiguration and ICDITargetConfiguration - * cdi/org/eclipse/cdt/debug/core/cdi/Session.java - * cdi/org/eclipse/cdt/debug/core/cdi/SessionConfiguration.java - * cdi/org/eclipse/cdt/debug/core/cdi/model/Target.java - * cdi/org/eclipse/cdt/debug/core/cdi/model/TargetConfiguration.java - -2004-11-02 Alain Magloire - Tentative fix for PR 77435 - * cdi/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java - -2004-10-31 Alain Magloire - Tentative fix for PR 74496 - -2004-10-31 Alain Magloire - Refactor ICDIVariableObject --> ICDIVariableDescriptor - Refactor ICDIArgumentObject --> ICDIArgumentDescriptor - Refactor ICDIRegisterObject --> ICDIRegisterDescriptor - Addition ICDIThreadStorageDescriptor, ICDIThreadStorage - Addition ICDILocalVariableDescriptor, ICDILocalVariable - Addition ICDIGlobalVariableDescriptor, ICDIGlovalVariable - - Adjust the classes to the changes. - -2004-10-29 Alain Magloire - Remove of ICDISharedLibraryManager - * cdi/org/eclipse/cdt/debug/core/cdi/Session.java - * cdi/org/eclipse/cdt/debug/core/cdi/SharedLibraryManager.java - * cdi/org/eclipse/cdt/debug/core/cdi/model/Target.java - * cdi/org/eclipse/cdt/debug/core/cdi/model/SharedLibraryManagement.java - - * src/org/eclipse/cdt/debug/mi/core/GDBCDIDebugger.java - * src/org/eclipse/cdt/debug/mi/core/GDBServerCDIDebugger.java - -2004-10-28 Alain Magloire - Add ICDIValue.getType() and ICDIExpression.geType() new methods. - -2004-10-26 Alain Magloire - Remove ICDIMemoryManager in CDI - * cdi/org/eclipse/cdt/debug/mi/core/cdi/Session.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/MemoryManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/MemoryBlock.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/event/CreatedEvent.java - -2004-10-26 Alain Magloire - Remove of ICDISourceManager in CDI - * cdi/org/eclipse/cdt/debug/mi/core/cdi/Session.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/SourceManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java - - * mi/org/eclipse/cdt/debug/mi/core/cdi/command/MIDataDsassemble.java - -2004-10-26 Alain Magloire - Remove of ICDISignalManager in CDI - * cdi/org/eclipse/cdt/debug/mi/core/cdi/Session.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/SignalManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Signal.java - -2004-10-25 Alain Magloire - Remove of ICDExpressionManager in CDI - ICDIExpression changes in the interface. - * cdi/rg/eclipse/cdt/debug/mo/core/cdi/EventManager.java - * cdi/rg/eclipse/cdt/debug/mo/core/cdi/ExpressionManager.java - * cdi/rg/eclipse/cdt/debug/mo/core/cdi/Session.java - * cdi/rg/eclipse/cdt/debug/mo/core/cdi/event/ChangedEvent.java - * cdi/rg/eclipse/cdt/debug/mo/core/cdi/event/DestroyedEvent.java - * cdi/rg/eclipse/cdt/debug/mo/core/cdi/model/Expression.java - * cdi/rg/eclipse/cdt/debug/mo/core/cdi/model/Target.java - * cdi/rg/eclipse/cdt/debug/mo/core/cdi/model/Variable.java - -2004-10-24 Alain Magloire - Changes in ICDITarget.evaluateExpressionToString() - * org/eclipse/cdt/debug/mi/core/cdi/model/Target.java - -2004-10-20 Alain Magloire - Use the new ICDIDebugger interface - - * mi/org/eclipse/cdt/debug/mi/core/MIInferior.java - * mi/org/eclipse/cdt/debug/mi/core/MISession.java - * mi/org/eclipse/cdt/debug/mi/core/SessionProcess.java - * src/org/eclipse/cdt/debug/mi/core/CygwinGDBCDIDebugger.java - * src/org/eclipse/cdt/debug/mi/core/GDBCDIDebugger.java - * src/org/eclipse/cdt/debug/mi/core/GDBDebugger.java - * src/org/eclipse/cdt/debug/mi/core/GDBServerDebugger.java - * src/org/eclipse/cdt/debug/mi/core/MIPlugin.java - * src/org/eclipse/cdt/debug/mi/core/MIProcessAdapter.java - * plugin.xml - -2004-10-20 David Inglis - Fixed terminated delay for corefile - * mi/org/eclipse/cdt/debug/mi/core/MIInferior.java - -2004-10-19 Alain Magloire - Fix Core Launching - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java - * mi/org/eclipse/cdt/debug/mi/core/CoreProcess.java - * mi/org/eclipse/cdt/debug/mi/core/MIInferior.java - * src/org/eclipse/cdt/debug/mi/core/MIPlugin.java - -2004-10-18 Alain Magloire - Adjust to changes in CDI - * src/org/eclipse/cdt/debug/mi/core/cdi/model/RuntimeOptions.java - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java - * src/org/eclipse/cdt/debug/mi/core/cdi/Session.java - -2004-10-17 Alain Magloire - Remove deprecated method in CDI adjust the implementation. - -2004-10-15 Alain Magloire - - The way we do breakpoints is changing. gdb does not have - -break-thread-id command that would allow to change if a breakpoint - is associated with a particular thread(the same way as in - -break-condition, and -break-after). So to do thread breakpoint - we associate 1 Eclipse breakpoint with n GDB breakpoints: - 1:n - - * cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/Condition.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Breakpoint.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Exceptionpoint.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Watchpoint.java - -2004-10-04 Alain Magloire - - IllegalMonitorException fix. - mi/org/eclipse/cdt/debug/mi/core/MIInferior.java - src/org/eclipse/cdt/debug/mi/core/MIProcessAdapter.java - -2004-09-22 Alain Magloire - Makes the mi/ source folder independant of the cdt.core - so we can make it a library. - To many files to enumerate - -2004-09-17 Alain Magloire - Support for 64 bits application - PR 74056 74058. Pathc from Artyom Kuanbekov - To much files to enumerate. - -2004-09-15 Alain Magloire - - Chang Type to take a VariableObject. - -2004-09-15 Alain Magloire - - The correct thread was not set. - * cdi/org/eclipse/cdt/debug/mi/core/cdi/ExpressionManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java - -2004-09-12 Alain Magloire - Since MISession is attach to the Target, the - way we fire termination events must change also. - * cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/ProcessManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/Session.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java - * src/org/eclipse/cdt/debug/mi/core/MISession.java - -2004-09-09 Alain Magloire - Introduction of new classes in the CDI interface - ICDIExecuteStep - ICDIExecuteStepReturn - ICDIExecuteResume - ICDISuspend - ICDIThreadGroup - The code is adjust to the new demands. - -2004-09-07 Alain Magloire - - Remove ICDIBreakpointManager class - * cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointHit.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/Session.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/WatchpointScope.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/WatchpointTrigger.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Breakpoint.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java - -2004-09-06 Alain Magloire - - The changes is move the MISession as part - of Target. The rationale; we want to have - Session - --------------- - | | - Target(gdb) Target(gdb) - To be able to do this we need to untie the MISession - from Session. - - Also we are moving toward retiring the ICDIXXXXManager - and move the methods in the the proper methods. - -2004-09-01 Alain Magloire - - Fix for 72974 - * cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java - -2004-08-14 Alain Magloire - - Fix for 71992. - * src/org/eclipse/cdt/debug/mi/core/GDBTypeParser.java - -2004-08-05 Alain Magloire - - Tentative Fix for PR 69991 - * src/org/eclipse/cdt/debug/mi/core/RxThread.java - -2004-07-22 Alain Magloire - - Fix for PR 70688 - * src/org/eclipse/cdt/debug/mi/core/GDBTypeParser.java - -2004-07-12 Alain Magloire - - Remove some compiler warnings. - - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Register.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java - - * mi/org/eclipse/cdt/debug/mi/core/command/CygwinMIEnvirnmentDirectory.java - * src/org/eclipse/cdt/debug/mi/core/CygwinGDBDebugger.java - * src/org/eclipse/cdt/debug/mi/core/GDBTypeParser.java - * src/org/eclipse/cdt/debug/mi/core/MIPlugin.java - -2004-07-09 Alain Magloire - - Patch from gwatson to deal with Mac - version of gdb, there gdb as a different - syntax but still valid. - - * mi/org/eclipse/cdt/debug/mi/core/output/MIArg.java - -2004-07-09 Alain Magloire - - Patch from Stefan Bylund for PR 69711 - Added support for thread name. - - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java - * mi/org/eclipse/cdt/debug/mi/core/output/MIInfoThreadsInfo.java - -2004-07-02 Mikhail Khodjaiants - - Fix for bug 68934: Debug into dll doesn't work. - The "solib-search-path" and "stop-on-solib-events" options are not supported by gdb on CygWin. - * src/org/eclipse/cdt/debug/mi/core/CygwinGDBDebugger.java - -2004-07-02 Alain Magloire - - * cdi/org/eclipse/cdt/debug/mi/core/cdi/ProcessManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/ThreadManager.java - -2004-06-29 Alain Magloire - - When selecting threads gdb can reset the current - stack frame on us. We should be aware of it and reset. - - * cdi/org/eclipse/cdt/debug/mi/core/cdi/mode/Target.java - -2004-06-24 Alain Magloire - - Fix 68226 - * cdi/org/eclipse/cdt/debug/mic/core/cdi/EventManager.java - * cdi/org/eclipse/cdt/debug/mic/core/cdi/Configuration.java - * cdi/org/eclipse/cdt/debug/mic/core/cdi/SoourceManager.java - -2004-06-22 Alain Magloire - - Fix PR 68176 - * mi/org/eclipse/cdt/debug/mi/core/command/CygwinMIEnvironmentCD.java - -2004-06-09 Alain Magloire - Fix for PR 66338 - * cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/Condition.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Breakpoint.java - -2004-06-09 Alain Magloire - - Keep the breakpoint disable when doing - deffered breakpoint installation. - - * cdt/org/eclpse/cdt/debug/mi/core/cdi/EventManager.java - -2004-06-08 Alain Magloire - - Fix for PR 65077 - - * mi/org/eclipse/cdt/debug/mi/core/command/CygwinCommandFactory.java - * mi/org/eclipse/cdt/debug/mi/core/command/CygwinMIEnvironmentCD.jav - * src/org/eclipse/cdt/debug/mi/core/CygwinGDBDebugger.java - -2004-06-02 Mikhail Khodjaiants - - Moved externalized strings to the right property file. - - * cdi/org/eclipse/cdt/debug/mi/core/cdi/CdiResources.properties - * src/org/eclipse/cdt/debug/mi/core/MIPluginResources.properties - -2004-0602 Alain Magloire - - Overload getFullName() for registerObject - - * cdi/org/eclipse/cdt/debug/mi/core/cdi/mode/RegisterObject.java - -2004-05-28 Alain Magloire - - GDB has special "types" - int8_t int16_t etc ... parse them also. - - * cdi/org/eclipse/cdt/debug/mi/core/cdi/SourceManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Register.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/RegisterObject.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/ArrayValue.java - -2004-05-28 Alain Magloire - - QuickFix for PR 58249 - - * cdi/org/eclipse/cdt/debug/mi/core/cdi/SourceManager.java -2004-05-28 Alain Magloire - - Error in looking for the CIdentifier. - * src/org/eclipse/cdt/debug/mi/core/GDBTypeParser.java - -2004-05-28 Alain Magloire - - Fix to PR 60020. - GDB returns the children when a pointer - points to a structure. - Also ignore the keyword "const" when parsing. - - * cdi/org/eclipse/cdt/debug/mi/core/cdi/SourceManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/VariableObject.java - * src/org/eclipse/cdt/debug/mi/core/GDBTypeParser.java - -2004-05-18 Alain Magloire - - Remove dependencies on the compatibility plugin - and move to be more Eclipse-3.0 compliant. - -2004-05-07 Alain Magloire - PR 57127. Pass the stream verbatim - even if it has spaces. - This what gdb expects. - - * mi/org/eclipse/cdt/debug/mi/core/command/MIEnvironmentCD.java - -2004-05-07 Alain Magloire - - Patch from Keith Rolling(Palm Source). - PR 60664 - * src/org/eclipse/cdt/debug/mi/core/MIInferior.java - -2004-04-01 Alain Magloire - - GDBServer configuration should be "*" not "native" - - * plugin.xml - -2004-03-23 Alain Magloire - - Fix for bug 55766: The Shared Libraries view displays the wrong icon if the "Load Symbols" action fails. - - * src/org/eclipse/cdt/debug/mi/core/cdi/SharedLibraryManager.java - -2004-03-17 Alain Magloire - - Changes pass the array of events instead - of one at a time - - * cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java - * cdi/org/eclipse/cdt/debug/mi/core/cdi/Manager.java - -2004-03-16 Tanya Wolff - - Marked strings in src as non-translatable - * src/GDBServerDebugger.java - * src/GDBTypeParser.java - * src/RxThread.java - -2004-03-14 Alain Magloire - - Break the ChangeLog file in two. - - * ChangeLog - * ChangeLog-2003 - -2004-03-14 Alain Magloire - - The Managers extends Manager class for more flexibility - - * cdi/org/eclipse/cdt/debug/mi/core/cdi/Manager.java - -2004-03-12 Tanya Wolff - - Marked strings as non-translatable and externalized strings in new exceptions thrown. - - * cdi/ - * src/ - -2004-03-12 Tanya Wolff - - Marked strings as non-translatable. - - * mi/ - -2004-03-01 Alain Magloire - - Reog. New source browser. - Move the classes to the appropriate categories. - - * mi/ - * cdi/ - -2004-02-19 Alain Magloire - - PR #52317 - The children were added in the wrong order. - - * src/org/eclipse/cdt/debug/mi/core/GDBTypeParser.java - -2004-02-17 Alain Magloire - - If we attach save the PID for later - for example to be able to suspend. - - * src/org/eclipse/cdt/debug/mi/core/MIInferior.java - * src/org/eclipse/cdt/debug/mi/core/MIPlugin.java - -2004-02-11 Alain Magloire - - Use String.endsWith("(gdb)") to detect the prompt. - Sometimes gdb does not flush the endline. - - * src/org/eclipse/cdt/debug/mi/core/MIPlugin.java - -2004-01-30 Alain Magloire - - Allow the clients to override the interrupt. - - * src/org/eclipse/cdt/debug/mi/core/MIInferior.java - * src/org/eclipse/cdt/debug/mi/core/TxThread.java - * src/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java - * src/org/eclipse/cdt/debug/mi/core/command/MICommand.java - -2004-01-29 Alain Magloire - - The CDT debug ui prefers things to be in ascending - number. It makes life easier so we comply. - - * src/org/eclipse/cdt/debug/mi/core/output/MIInfoThreadsInfo.java - -2004-01-28 Alain Magloire - - Some clients using MI need to have access to thoes - methods change the scope for protected. - - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Value.java - * src/org/eclipse/cdt/debug/mi/core/command/CLICommand.java - * src/org/eclipse/cdt/debug/mi/core/output/MIInfoThreadsInfo.java - -2004-01-22 Alain Magloire - - Cache the stackframes when we become suspended, to reduce - the chat between gdb. - - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java - diff --git a/debug/org.eclipse.cdt.debug.mi.core/ChangeLog-2003 b/debug/org.eclipse.cdt.debug.mi.core/ChangeLog-2003 deleted file mode 100644 index 60b45209194..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/ChangeLog-2003 +++ /dev/null @@ -1,2151 +0,0 @@ -2003-12-22 Mikhail Khodjaiants - Fix for bug 49282 terminate the gdb session if the termination of the inferior fails. - - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java - -2003-12-22 Mikhail Khodjaiants - Fix for Bug 49278 do not retry the "info threads" command if the first attempt fails. - Throw an exception from the "getCThreads" method when it fails. - - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java - -2003-12-18 Alain Magloire - - PR 49148 - Set environment variable value to give the program. - Arguments are VAR VALUE where VAR is variable name and VALUE is value. - VALUES of environment variables are uninterpreted strings. - This does not affect the program until the next "run" command. - - So pass the string raw. - - * src/org/eclipse/cdt/debug/mi/core/command/MIGDBSetEnvironment.java - * src/org/eclipse/cdt/debug/mi/core/cdi/RuntimeOptions.java - * src/org/eclipse/cdt/debug/mi/core/CommandFactory.java - -2003-12-17 Mikhail Khodjaiants - - Fix for bug 49061: Different values are used as default for the "Load shared library symbols automatically" option. - - * src/org/eclipse/cdt/debug/mi/core/GDBDebugger.java - * src/org/eclipse/cdt/debug/mi/core/GDBServerDebugger.java - * src/org/eclipse/cdt/debug/mi/core/IMILaunchConfigurationConstants.java - * src/org/eclipse/cdt/debug/mi/core/CygwinGDBDebugger.java - -2003-12-16 Mikhail Khodjaiants - - Show the gdb arguments when tracing. - - * src/org/eclipse/cdt/debug/mi/core/MIPlugin.java - -2003-12-16 Mikhail Khodjaiants - - Fix for PR 48870: Terminate gdb if attach to process fails. - - * src/org/eclipse/cdt/debug/mi/core/MIPlugin.java - -2003-12-09 Alain Magloire - - Do not try to interrupt if the target was suspended. - - * src/org/eclipse/cdt/debug/mi/core/MIInferior.java - -2003-12-08 Alain Magloire - - Target.terminate() did not pass the exception up. - Added new method MIInferior.terminate(). - - * src/org/eclipse/cdt/debug/mi/core/MIInferior.java - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java - -2003-12-02 Alain Magloire - - Retry the stack-info-depth when it fails the first time - and decrement the count. GDB can cope up the second try - and probably mark the thread invalid. - Patch base on Ashish Karkare patch: - - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java - -2003-11-26 Mikhail Khodjaiants - Cleanup. - - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java - * src/org/eclipse/cdt/debug/mi/core/GDBTypeParser.java - -2003-11-26 Mikhail Khodjaiants - Cleanup. - - * src/org/eclipse/cdt/debug/mi/core/GDBDebugger.java - * src/org/eclipse/cdt/debug/mi/core/GDBServerDebugger.java - * src/org/eclipse/cdt/debug/mi/core/CygwinGDBDebugger.java - * src/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java - * src/org/eclipse/cdt/debug/mi/core/cdi/event/ResumedEvent.java - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java - * src/org/eclipse/cdt/debug/mi/core/command/MIBreakAfter.java - * src/org/eclipse/cdt/debug/mi/core/event/MIFunctionFinishedEvent.java - * src/org/eclipse/cdt/debug/mi/core/event/MIInferiorSignalExitEvent.java - * src/org/eclipse/cdt/debug/mi/core/event/MISignalEvent.java - * src/org/eclipse/cdt/debug/mi/core/event/MIWatchpointTriggerEvent.java - * src/org/eclipse/cdt/debug/mi/core/output/MIGDBShowDirectoriesInfo.java - * src/org/eclipse/cdt/debug/mi/core/output/MIGDBShowSolibSearchPathInfo.java - * src/org/eclipse/cdt/debug/mi/core/output/MIList.java - -2003-11-25 Alain Magloire - - Process the suspend event even if there is not threads - or stack associated with the target. - - * src/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java - -2003-11-22 Alain Magloire - - In MISession constructor if the initialization fails shutdown - the Tx/RX/Event threads. - In MIPlugin if the initialization fails shutdown the pty console. - Ditto for GDBDebugger/GDBServerDebugger/CygwinGDBDebugger. - - * src/org/eclipse/cdt/debug/mi/core/MIPlugin.java - * src/org/eclipse/cdt/debug/mi/core/MISession.java - * src/org/eclipse/cdt/debug/mi/core/GDBDebugger.java - * src/org/eclipse/cdt/debug/mi/core/GDBServerDebugger.java - * src/org/eclipse/cdt/debug/mi/core/CygwinGDBDebugger.java - -2003-11-21 Alain Magloire - - The wrong MIPlugin.createCSession() method was used. - Problem noted by Ashish. - - * src/org/eclipse/cdt/debug/mi/core/GDBServerDebugger.java - -2003-11-21 Mikhail Khodjaiants - - * src/org/eclipse/cdt/debug/mi/core/output/MIFrame.java - Fix for PR 46592: Debug View shows Functions as func(type param,...)(). - Return an empty string instead of "??" if the function name is not available. - -2003-11-20 Alain Magloire - - Fix NPE: 46313. Setting breakpoint when the target was running - was throwing NPE. - - * src/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java - * src/org/eclipse/cdt/debug/mi/core/cdit/EventManager.java - -2003-11-19 Mikhail Khodjaiants - - Fix for PR 45533: MIException while creating MISession can leave an orphan gdb process. - * src/org/eclipse/cdt/debug/mi/core/MIPlugin.java: removed the 'getAdjustedTimeout' method. - -2003-11-19 Mikhail Khodjaiants - - Fix for PR 45533: MIException while creating MISession can leave an orphan gdb process. - * src/org/eclipse/cdt/debug/mi/core/MIPlugin.java: initialization of preferences by default values. - * src/org/eclipse/cdt/debug/mi/core/MISession.java: removed the duplicate constant for the default - launch timeout value. - -2003-11-13 Mikhail Khodjaiants - - * src/org/eclipse/cdt/debug/mi/core/output/MIFrame.java - Fix for PR 46592: Debug View shows Functions as func(type param,...)(). - In some situations gdb returns the function names that include parameter types. - To make the presentation consistent truncate the parameters. - -2003-11-06 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java: - Small fix for the defferred breakpoint support. - -2003-11-06 Alain Magloire - - Patch from Ashish Karkare: - A CDT 1.2 patch that enables setting of - serial line speed in the launch configuration when debugging remote targets. - - * src/org/eclipse/cdt/debug/mi/core/IGDBServerMILaunchConfigurationConstants.java - New attribute definition DEV_SPEED. - - * src/org/eclipse/cdt/debug/mi/core/GDBServerDebugger.java - Extracts serial speed value and passes it to createCSession(). - - -2003-10-29 Alain Magloire - - Deal with PR 45533 - - Make a preferenc for Timeout and use it when launching - the ICDebugger session, when way wait for for gdb - to say "ready" by returning the prompt. - - * src/org/eclipse/cdt/debug/mi/core/MISession.java - * src/org/eclipse/cdt/debug/mi/core/MIPlugin.java - * src/org/eclipse/cdt/debug/mi/core/IMIConstants.java - -2003-10-17 Alain Magloire - - Put the framework to deal with deferred breakpoint. - - * src/org/eclipse/cdt/debug/mi/core/cdi/event/ResumeEvent.java - Deal with MIRunningEvent.RETURN. - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Breakpoint.java - Check if MIBreakpoint is null first. - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Watchpoint.java - Check if MIWathchpoint is null first. - * src/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java - Implement Deferred Breakpoint - * src/org/eclipse/cdt/debug/mi/core/cdi/SharedLibraryManager.java - Implement Deferred Breakpoint - * src/org/eclipse/cdt/debug/mi/core/GDBDebugger.java - Enable deferredBreakpoint. - * src/org/eclipse/cdt/debug/mi/core/CygwinDebugger.java - Enable deferredBreakpoint. - - -2003-10-07 Mikhail Khodjaiants - - All methods of 'IRuntimeOptions' should throw CDI exceptions in case of failure. - * src/org/eclipse/cdt/debug/mi/core/cdi/RuntimeOptions.java - -2003-09-30 Alain Magloire - - ICDIVariableObject.equals(); - - * src/org/eclipse/cdt/debug/mi/core/cdi/model/VariableObject.java - -2003-09-29 Mikhail Khodjaiants - Added the initialization of the shared libraries' attributes to CygwinGDBDebugger. - - * src/org/eclipse/cdt/debug/mi/core/CygwinGDBDebugger.java - -2003-09-26 Alain Magloire - - Second part of PR 43496. - On the startup of GDB, we have to wait for "(gdb)" prompt - to make sure that gdb is ready to accept command. - - * src/org/eclipse/cdt/debug/mi/core/MIPlugin.java - -2003-09-25 Alain Magloire - - Fix for PR 43496. - In the event of an error we should Process.destroy() - after creating the Process. - - * src/org/eclipse/cdt/debug/mi/core/MIPlugin.java - -2003-09-11 Mikhail Khodjaiants - Moving the shared library search paths block to mi UI. - * IMILaunchConfigurationConstants.java: added the 'ATTR_DEBUGGER_SOLIB_PATH' attribute. - -2003-09-11 Alain Magloire - - Fix to info shared parsing. - - * src/org/eclipse/cdt/debug/mi/core/output/MIInfoSharedLibary.java - -2003-09-09 Mikhail Khodjaiants - Regrouping the launch configuration constants. - * IMILaunchConfigurationConstants.java - -2003-09-09 Mikhail Khodjaiants - Added the 'stop-on-solib-events' option. - Changed the initialization of the shared library search path. - Changed the messages of the thrown exceptions. - * GDBDebugger.java - -2003-09-09 Mikhail Khodjaiants - - CoreFileConfiguration supports shared libraries. - - * src/org/eclipse/cdt/debug/mi/core/cdi/CoreFileConfiguration.java - -2003-08-30 Alain Magloire - - Unnecessary synchronization making deadlocks. Should revisit this code. - - * src/org/eclipse/cdt/debug/mi/core/MIInferior.java - -2003-08-29 Mikhail Khodjaiants - - Added new command - 'set stop-on-solib-events'. - - * src/org/eclipse/cdt/debug/mi/core/command/MIGDBSetStopOnSolibEvents.java - * src/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java - - Implementation of the new methods added to the 'ICDISharedLibraryManager' interface. - - * src/org/eclipse/cdt/debug/mi/core/cdi/SharedLibraryManager.java - -2003-08-26 Alain Magloire - - This is still a hack: "info shared" the real solution - is to implement in GDB/MI the corresponding command. - So now we do weird parsing, that varies from platform - to platform. For example Cygwin output of "info shared" - is totally different from the GNU/Linux one etc ... - We the best we can to cope ... but things will break. - - * src/org/eclipse.cdt/debug/mi/core/output/MIInfoSharedLibraryInfo.java - -2003-08-26 Alain Magloire - - Using the wrong method for toString() and we were returning - a overly verbose string. - - * src/org/eclipse/cdt/debug/mi/core/GDBTypeParser.java - -2003-08-25 Alain Magloire - - Small fix, get the datatype for the GDBTypeParser. - - * src/org/eclipse/cdt/debug/mi/core/cdi/SourceManager.java - -2003-08-22 Alain Magloire - - For casting array we use the "@" format, hide it in - the name. But show it the qualifiedName() since the - expression is use to evaluate. - - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java - * src/org/eclipse/cdt/debug/mi/core/cdi/model/VariableObject.java - * src/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java - -2003-08-21 Alain Magloire - - GDB varobj for the arrays children name only returns - the index. We need to construct the entire name: - char buffer[2] - GDB return "0", "1" for the children names. - We will return - "buffer[0]", "buffer[1]" - - * src/org/eclipse/cdt/debug/mi/core/cdi/Variable.java - -2003-08-20 Alain Magloire - - GDB/MI altough define an interface that all commands should - follow .. they do not. For example, we should be able - to separate options from agument with a "--" string not - all commands. The latest is -break-condition. - So we override the MICommand.toString() to do specific - parsing for specific commands. - - * src/org/eclipse/cdt/debug/mi/core/command/MICommand.java - break the toString() method. - * src/org/eclipse/cdt/debug/mi/core/command/MIBreakCondition.java - -2003-08-19 Alain Magloire - - Fix to the GDBTypeParser to deal with gdb - awkwardness - * src/org/eclipse/cdt/debug/mi/core/GDBTypeParser.java - -2003-08-19 Alain Magloire - - GDB, uses false category for C++ class/struct. - Fix to return the correct name. - - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java - -2003-08-18 Alain Magloire - - Patch from Chris Songer, excerpt from the email. - Using the phrase "To ensure consistency between a register name and its - number, the output list may include empty register names," the MI protocol - appears to allow gdb to return a "sparse" array of registers by giving a 0 - length name in response to the -data-list-register-names-command. CDT 1.0.1 - does not handle this especially well and subsequently exposes a bug in GDB - 5.1.3 and crashes it if the debugger has more than 3 register names of 0 - length. - - example: - - 8-data-list-register-names - (gdb) - 8^done,register-names=["ar0","ar1",... ,"","","","","","","ur0",\ - "ur1","ur2","ur3","ur4","ur5","ur6","ur7","","" ..] - - - * src/org/eclipse/cdt/debug/mi/core/output/MIDataListRegisterNamesInfo.java: - New method getNumRealNames(). - * src/org/eclipse/cdt/debug/mi/core/cdi/RegisterManager.java: - Check if the register name is not empty. - -2003-08-18 Alain Magloire - - From the manual: - By default GDB will automatically keep track of objects as they are - loaded and unloaded by the dynamic linker. By using the command `set - stop-on-solib-events 1' you can arrange for GDB to stop the inferior - when shared library events occur, thus allowing you to set breakpoints - in shared libraries which are explicitly loaded by the inferior. - - * src/org/eclipse/cdt/debug/mi/core/event/MISharedLibEvent.java: - New file, StoppedEvent du to shared lib events. - * src/org/eclipse/cdt/debug/mi/core/cdi/event/SuspendedEvent.java: - Catch MISharedLibEvent. - * src/org/eclipse/cdt/debug/mi/core/cdi/SharedLibraryevent.java: - New file implements ICDISharedLibaryEvent. - * src/org/eclipse/cdt/debug/mi/core/RxThread.java: - Hack to catch suspend/stop on shared library. - -2003-08-11 Mikhail Khodjaiants - * src/org/eclipse/cdt/debug/mi/core/cdi/model/type/ArrayValue.java: - * src/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java: - Removed the 'type' parameter from the 'getVariableObjectAsArray' method. - -2003-08-11 Mikhail Khodjaiants - * src/org/eclipse/cdt/debug/mi/core/cdi/model/type/ArrayValue.java: - The 'type' argument of the 'getVariableObjectAsArray' method shouldn't be null. - -2003-08-11 Mikhail Khodjaiants - * src/org/eclipse/cdt/debug/mi/core/cdi/variableManager.java - Mistype in the 'CheckType' method. - -2003-08-07 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/cdi/variableManager.java - getVariableObjectAsArray() ignore the type argument it does - not work with gdb. - - * src/org/eclipse/cdt/debug/mi/core/cdi/model/VariableObject.java - Added hasChildren() method. - -2003-08-07 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java: - Update the interface to reflect ICDIVariableManager. - -2003-08-06 Mikhail Khodjaiants - * src/org/eclipse/cdt/debug/mi/core/cdi/model/type/ArrayValue.java: - Removed the unused local variable 'children' from the 'getVariables' method. - -2003-08-07 Alain Magloire - - PR 38964. - - * src/org/eclipse/cdt/debug/mi/core/MIInferior.java: - The method interrupted was synchronized and so was the - setSuspended(). Now do a notify when the status change. - Throw an exception if the interrupt() failed. - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java: - Do not check for running. - -2003-08-06 Alain Magloire - - Dealing with casting: Casting a field of a structure did not - work properly for example: - struct foo { int bar; } foobar; - To cast the field bar, we need to construct the full qualified - name "foobar.bar". - Unfortunately for C++ things are hectic in the GDB/MI world - the childre of structure are not the fields. So we try to - deal with it too. - - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java: - New constructor, new method getLanguage() to deal with - different type of languages ex: C vs C++. - * src/org/eclipse/cdt/debug/mi/core/cdi/model/VariableObject.java: - Clean up and added a bunch of set/getXXX() methods instead of - accessing directly the fields. - * src/og/eclipse/cdt/debug/mi/core/cdi/VariableManager.java: - Clean the methods use for casting and format the indentation. - * src/org/eclipse/cdt/debug/mi/core/command/MIVarInfoExpression.java: - Added parsing method. - -2003-08-06 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/cdi/model/VariableObject.java: - Implement isEditable method. - -2003-08-06 Mikhail Khodjaiants - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java: - Fix for 'isEditable'. - * src/org/eclipse/cdt/debug/mi/core/cdi/model/VariableObject.java: - Use correct expression in 'sizeof'. - -2003-08-06 Alain Magloire - - First framework to deal with breaking the arrays in ranges. - - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Argument.java: - Remove unused getArgumentObject(). - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Register.java: - Remove unuse getRegisterObject(). - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java: - Move methods to VariableObject to comply with the interface. - * src/org/eclipse/cdt/debug/mi/core/cdi/model/VariableObject.java: - Implement new methods of ICDIVariableObject.java - Save the castin information. - * src/org/eclipse/cdt/debug/mi/core/cdi/model/type/ArrayValue.java: - New method getVariables(int, int). - * src/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java: - New method encodeVariable(), to get the encode specific string - for gdb casting of arrays. - -2003-07-28 Mikhail Khodjaiants - - Minimize the number of the "evaluate expression" requests when changing the value of the floating point types. - - * src/org/eclipse/cdt/debug/mi/core/cdi/model/type/FloatingPointValue.java - -2003-07-17 Alain Magloire - - Catch the use of cli command "detach" and fire the appropriate events. - - * src/org/eclipse/cdt/debug/mi/core/CLIProcessor.java - -2003-07-16 Alain Magloire - - Provide FunctionValue, PointerValue and ArrayValue. - For ArrayValue apply the patch from Chris Songer, excerpt from - his email: - Given GDB performance, we saw CDT start to time out on large array - requests. The following patch corrects this by scaling the time out with - the number of children being retrieved. I have not looked at the head on - this so your mileage may vary. On 1.0.1 with this and the MIParser change - you can open 16k arrays. - - * src/org/eclipse/cdt/debug/mi/core/cdi/model/type/AggregateValue.java - * src/org/eclipse/cdt/debug/mi/core/cdi/model/type/DerivedValue.java - * src/org/eclipse/cdt/debug/mi/core/cdi/model/type/PointerValue.java - * src/org/eclipse/cdt/debug/mi/core/cdi/model/type/ReferenceValueValue.java - * src/org/eclipse/cdt/debug/mi/core/cdi/model/type/ArrayValue.java - * src/org/eclipse/cdt/debug/mi/core/cdi/model/type/StructValue.java - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Value.java - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java - -2003-07-10 Alain Magloire - - In the case of not having a PTY to unmixed inferior output from gdb commands - do the only sane thing and when a response comes in that is not a valid - MI format consider it as inferior output. - - * src/org/eclipse/cdt/debug/mi/core/output/MIParser.java: - Put non valid lines in the TargetStream. - * src/org/eclipse/cdt/debug/mi/core/MIInferior.java: - Pass output straight to the target. - * src/org/eclipse/cdt/debug/mi/core/TxThread.java: - Remove unused code. - * src/org/eclipse/cdt/debug/mi/core/command/Command.java: - Try to remove duplicate errors when throwing the MIException. - -2003-07-08 Alain Magloire - - Unfortunately GDB/MI does not make the errors available via the advertise - way explain in the documentation, for example: - 27-var-create - * this->aaa - &"There is no member or method named aaa.\n" - &"Type Hello has no component named aaa.\n" - 27^error,msg="." - - According to the doc, the error should be available in the msg field: - 27^error,msg="There is no member or method named aaaa" - - Since this will not be fix in GDB/MI anytime soon, we cope with it by - grabing the logstream error and make it available in - - CDIException.getDetailedMesssage(). - - * src/org/eclipse/cdt/debug/mi/core/command/*.java: All the commands - changed to grab also the logstream messages if any for the exception. - -2003-06-25 Alain Magloire - - Patch from Chris Songer, excerpt from its email: - The MIParser is O(N^2) time in the length of a line returned from GDB. - While not an issue for OOB messages, this can be quite an issue for array - retrieval from the target and other potentially long messages. It's N^2 - because it relies on StringBuffer.deleteCharAt( 0 ) and - StringBuffer.delete( 0, X ). These operations appear to do a copy of the - remaining data in the Sun Java library rather than bumping some index. - - The following diffs are code that we are using on 1.0.1 to correct this - issue. It's relatively new, so there may be some bugs but has certainly - performed just fine in our initial regressions. Because of that I'm not - sending it in as a patch, more an FYI really. The basic change is exactly - what you'd expect: these diffs make MIParser use a new type of string - buffer that's quite efficient at deleting from the head of the array. - - * src/org/eclipse/cdt/debug/mi/core/output/MIParser.java - -2003-06-18 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/cdi/event/ChangedEvent.java: - Check if the variable was a register. - * src/org/eclipse/cdt/debug/mi/core/cdi/event/CreatedEvent.java: - Cleanup. - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Register.java: - Removing of method {get,set}Value() and new method getChildren(). - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java - (setValue): calls update on the appropriate manager. - * src/org/eclipse/cdt/debug/mi/core/cdi/model/RegisterValue.java: - Remove file, unused. - * src/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java: - (getVariableObjectAsType): check for register. - (getVariableObjectAsArray): check for register. - * src/org/eclipse/cdt/debug/mi/core/cdi/RegisterManager.java: - (getRegister): reimplemented. - -2003-06-18 Mikhail Khodjaiants - Removed unused local variable. - * src/org/eclipse/cdt/debug/mi/core/cdi/RegisterManager.java - -2003-06-17 Alain Magloire - - PR 38934 - * src/org/eclipse/cdt/debug/mi/core/cdi/RegisterManager.java (update): - We have to call "-var-update" to update the register values in gdb. - -2003-06-05 Mikhail Khodjaiants - gdb/mi support of infinite values of the floating point types. - * DoubleValue.java - * FloatingPointValue.java - * FloatValue.java - -2003-06-05 Mikhail Khodjaiants - Removed the redundant methods from the 'ICDIFloatingPointValue' interface. - * src/org/eclipse/cdt/debug/mi/core/cdi/model/type/FloatingPointValue.java - -2003-06-04 Mikhail Khodjaiants - Correction in the parsing of reference value. - * src/org/eclipse/cdt/debug/mi/core/cdi/model/type/ReferenceValue.java - -2003-06-04 Mikhail Khodjaiants - Added some missing types and methods for the type parsing. - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java - * src/org/eclipse/cdt/debug/mi/core/cdi/model/type/ArrayType.java - * src/org/eclipse/cdt/debug/mi/core/cdi/model/type/DoubleValue.java - * src/org/eclipse/cdt/debug/mi/core/cdi/model/type/FloatingPointValue.java - * src/org/eclipse/cdt/debug/mi/core/cdi/model/type/FloatValue.java - * src/org/eclipse/cdt/debug/mi/core/cdi/model/type/PointerValue.java: new - * src/org/eclipse/cdt/debug/mi/core/cdi/model/type/ReferenceValue.java: new - -2003-06-03 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/GDBTypeParser.java: - Bug fix gdb returns fix like "char [200]" no variables. - -2003-06-03 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/cdi/SourceManager.java - (getType): save the head of the type for the return value. - -2003-06-02 Alain Magloire - - Enable the new type parsing with the class GDBTypeParser. - This class takes the output of GDB/MI - (gdb) whatis - or - (gdb) ptype - And parse it. - - * src/org/eclipse/cdt/debug/mi/core/cdi/model/type/ArrayType.java - * src/org/eclipse/cdt/debug/mi/core/cdi/model/type/DerivedType.java - * src/org/eclipse/cdt/debug/mi/core/cdi/model/type/PointerType.java - * src/org/eclipse/cdt/debug/mi/core/cdi/model/type/FunctionType.java - * src/org/eclipse/cdt/debug/mi/core/cdi/SourceManager.java - * src/org/eclipse/cdt/debug/mi/core/GDBTypeParser.java - -2003-05-25 Alain Magloire - - Do extra parsing. - * src/org/eclipse/cdt/debug/mi/core/model/type/ArrayType.java - * src/org/eclipse/cdt/debug/mi/core/model/type/DerivedType.java - * src/org/eclipse/cdt/debug/mi/core/model/type/PointerType.java - * src/org/eclipse/cdt/debug/mi/core/model/type/FunctionType.java - * src/org/eclipse/cdt/debug/mi/core/model/Variable.java - -2003-05-24 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/cdi/StackFrame.java - When execption reset the variable to null and rethrow the exception. - -2003-05-24 Alain Magloire - - Continuing the implementation of types. - ICDIType is ICDIObject. - * src/org/eclispe/cdt/mi/core/cdi/model/type/Type.java: - Extends CObject - -2003-05-23 Alain Magloire - - Draft implementation of org.eclipse.cdt.debug.core.cdi.model.type/* - -2003-05-06 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java (suspend): - Suspend the program before selecting the thread. - -2003-05-01 Mikhail Khodjaiants - Implementations of the new "terminateSessionOnExit" method of ICDIConfiguration. - * Configuration.java - * CoreFileConfiguration.java - -2003-04-30 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/MIPlugin.java: - Call MIInferior.update() if attaching session. - -2003-04-30 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/cdi/Configuration.java (supportsTerminate): - Returns true. - -2003-04-25 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/EventManager.java (update): - Remove the call to MIInferior.update(), wrong place. - * src/org/eclipse/cdt/debug/mi/core/EventThread.java (run): - Call MIInferior.update() when suspended. - * src/org/eclipse/cdt/debug/mi/core/MIInferior.java (update): - Do not do the call to "info program" for type "attached" sessions. - * src/org/eclipse/cdt/debug/mi/core/MISession.java (terminate): - When terminate() is call disable posting commands to the queue etc... - -2003-04-25 Mikhail Khodjaiants - - Fix for bug 36909. - * MIFrame.java: - gdb returns "??" as a function name if symbols are not available. - Set the function name in this case to ""; - -2003-04-24 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java (createMIInfoProgram): - New method. - * src/org/eclipse/cdt/debug/mi/core/command/MIInfoProgram.java: - New file, "info program". - * src/org/eclipse/cdt/debug/mi/core/output/MIInfoProgramInfo.java: - New file, parsing of "info Program". - * src/org/eclipse/cdt/debug/mi/core/output/EventManager.java (processSuspend): - Call MIInferio.update(); - * src/org/eclipse/cdt/debug/mi/core/MIInferior.java (update): - New method to retrieve the pid. - (interrupt): Try doing Spawner.raise(pid, INT) as a fallback. - * src/org/eclipse/cdt/debug/mi/core/cdi/Configuration.java (supportSuspend): - Bug fix. - -2003-04-23 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/cdi/SignalManager.java (update): - Move the creation of the list after the call to "info signals". - The call may fail. - -2003-04-21 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/cdi/Target.java (suspend): - Remove the delay of 10 secs. - * src/org/eclipse/cdt/debug/mi/core/MIInferior.java (interrupt): - Do a delay of 10 secs to allow time for the inferior to stop. - * src/org/eclipse/cdt/debug/mi/core/MISession.java (terminate) : - Clear the EventQueue, if we restart. - * src/org/eclipse/cdt/debug/mi/core/Queue (isEmpty): - New method. - -2003-04-21 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/GDBDebugger.java: - * src/org/eclipse/cdt/debug/mi/core/GDBServerDebugger.java: - Ignore exception when doing "set auto-solib-path on". - -2003-04-17 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java: - setCurrentThread(), calls VariableManager.update(); - * src/org/eclipse/cdt/debug/micore/cdt/model/Thread.java: - setCurrentStackFrame() calls VariableManager.update(); - -2003-04-07 Mikhail Khodjaiants - Changed the messages of CDI exceptions. - * MISession.java - * Target.java - -2003-04-04 Alain Magloire - - Code from Monta Vista to add a Session via GDBServer. - - * src/org/eclipse/cdt/debug/mi/core/MIPlugin.java: - * src/org/eclipse/cdt/debug/mi/core/GDBServerDebugger.java: - * src/org/eclipse/cdt/debug/mi/core/IGDBServerMILaunchConfigurationConstants.java: - * plugin.xml - -2003-04-04 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/cdt/VariableManager.java: - Check for null in update(). - -2003-04-03 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/cdt/VariableManager.java: - update(), put a limit on the number of stack we check for variables. - -2003-04-03 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/cdt/model/Target.java: - * src/org/eclipse/cdt/debug/mi/core/cdt/model/Thread.java: - Before updating the register check if the manager is on autoupdate. - -2003-04-02 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/cdt/model/Target.java: - suspend() sync for at least < 10 seconds to allow the gdb to - suspend via SIGINT the program. - -2003-03-28 Mikhail Khodjaiants - Added time stamp to the trace messages. - * MIPlugin.java - -2003-03-28 Mikhail Khodjaiants - Correction of the previous patch. - * MIAsm.java - -2003-03-27 Mikhail Khodjaiants - Applied patch from Chris Songer: Assembly View Fixups - * Instruction.java - * MIAsm.java - -2003-03-19 Alain Magloire - - Some applications, like recursive code, have a very deep stackframes - bigger > 50. This can turn out to be a problem, as the VariableManager - will try to update all the variables and there can be a lot of local - variable in all those stackframes. We can not use: - "-var-update *" - either since on gdb-5.2.1, for reasons unknown to me this will make - gdb unstable/crash. So the approach is to only update variables - in the current stackframe. - The advantage we only update a small set of variables. - The downside if we have side effects i.e. pointers pass to - argument and modifying the pointer affect the callees memory. - But this is a small price to pay and usually C/C++ programmer - are interrested to see changes of variables in the current stack - not changes 20 stack before. - - * src/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java: - Method update() only check the variable in the scope of the - current stackframe(the highest stack). This will include - any globals. - -2003-03-19 Alain Magloire - - Base on PR/patch from Chris Songer. - Assigning a value to a register may have side-effects - on other registers. When assigning, the action is now - to upate again the values. The same for the variables. - - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java: - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Register.java: - Method setValue() calls manager.update() after the assignment. - -2003-03-17 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/cdi/model/StackFrame.java: - getArguments() and getLocalVariable() are caching the results. - -2003-03-16 Alain Magloire - - GDB/MI does not keep the stack level, from what we expect. In gdb, the - highest stack is level 0 and lower stack as the highest level: - -stack-list-frames - ^done,stack=[frame={level="0 ",addr="0x0804845b",func="main",file="hello.c",line="24"}, - frame={level="1 ",addr="0x42017499",func="__libc_start_main",from="/lib/i686/libc.so.6"}] - - -stack-list-frames - ^done,stack=[frame={level="0 ",addr="0x08048556",func="main2",file="hello.c",line="58"}, - frame={level="1 ",addr="0x08048501",func="main",file="hello.c",line="41"}, - frame={level="2 ",addr="0x42017499",func="__libc_start_main",from="/lib/i686/libc.so.6"}] - - This is of no use to us since the level is always "0". The level is necessary for example when - doing recursive calls to make a distinction between frames. - So in CDT this reverse the hidghest frame will have the highest number. In CDT: - stack=[frame={level="2 ",addr="0x0804845b",func="main",file="hello.c",line="24"}, - frame={level="1 ",addr="0x42017499",func="__libc_start_main",from="/lib/i686/libc.so.6"}] - - stack=[frame={level="3 ",addr="0x08048556",func="main2",file="hello.c",line="58"}, - frame={level="2 ",addr="0x08048501",func="main",file="hello.c",line="41"}, - frame={level="1 ",addr="0x42017499",func="__libc_start_main",from="/lib/i686/libc.so.6"}] - - - * src/org/eclipse/cdt/debug/mi/core/cdi/model/StackFrame.java: - Takes a new Argument in the constructor, the level. - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Threawd.java: - Create the StackFrame with the constructor. - * src/org/eclipse/cdt/debug/mi/core/cdi/Location.java: - Fix equals(). - * src/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java: - Use the right level when setting the frame. - -2003-03-14 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Argument.java: - New method getArgumentObject(). - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Register.java: - New method getRegisterObject(). - * src/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java: - Checks for ICDIVariable and ICDIArgument since they are now ICDIVariableObject too. - * src/org/eclipse/cdt/debug/mi/core/cdi/RegisterManager.java: - Checks for ICDIRegister when creating since they are now ICDIRegisterObject too. - -2003-03-13 Alain Magloire - - Small bug fix - * src/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java - -2003-03-13 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java: - New method getLocalVariableObjects() implemented returns all the local. - * src/org/eclipse/cdt/debug/mi/core/cdi/model/StackFrame.java - getLocalVariables() use getLocalVariableObjects(). - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java: - getName() does not longer throw an Exception. - -2003-03-11 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java: - New methods getVariableObjectAsArray() getVariableObjectAsType(). - -2003-03-03 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/CommandQueue.java (print): Comment out. - * src/org/eclipse/cdt/debug/mi/core/Queue.java (print): Comment out. - -2003-02-12 Mikhail Khodjaiants - The 'setAutoSolib' method is no longer in ICDISharedLibraryManager. - * GDBDebugger.java - -2003-02-12 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java: - Removed getRegisterObjects(), getRegisters(), getSharedLibraries(). - Those actions are done via the managers. - - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java (getChild): - Check the grand children also. - -2003-02-12 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/cdi/SharedLibraryManager.java (isAutoLoadSymbols): - New method. - * src/org/eclipse/cdt/deb/mi/core/command/MIGDBShow.java (getMIGDBShowInfo): - New method. - -2003-02-12 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/cdi/event/ChangedEvent.java (ChangedEvent): - Returns a Variable. - * src/org/eclipse/cdt/debug/mi/core/cdi/event/DestroyedEvent.java (DestroyedEvent): - Check if it was an expression also. - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Value.java (getVariables): - Calls the parent's implementation. - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java (getVariables): - New implementation. - * src/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java (update): - Deal with new MIVarDeleteEvent. - * src/org/eclipse/cdt/debug/mi/core/cdi/ExpressionManager.java (addExpression): - Removed. - (removeExpression): New method. - * src/org/eclipse/cdt/debug/mi/core/event/MIVarChangedEvent.java (getScope): - removed. - * src/org/eclipse/cdt/debug/mi/core/event/MIVarDeletedEvent.java: - New file. - -2003-02-09 Alain Magloire - - in GDB/MI 5.3 and below, the -data-list-register-xxx can bring gdb down with - an assert(). The problem is that code like this - ui_out_list_begin(); - for () { - if(error) - return ERROR; - } - ui_out_list_end(); - The ui_out_list_end() is never call. - However gdb offers the varobj to deal cleanly with register but calling - "-var-update *" seems to make gdb misbehave and hang after a while. - So we use a mixed of -data-list-register-xxx calls and var-object to deal - with registers and do not call "-var-update *" but rather call it for - each time for individual objects to see the updates. - - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Register.java: - Reimplemented to use the var obj. - * src/org/eclipse/cdt/debug/mi/core/cdi/model/RegisterValue.java: - New file implement ICDIValue. - * src/org/eclipse/cdt/debug/mi/core/cdi/EventManagero.java (processSuspendedEvent): - Call each manager.update(). - * src/org/eclipse/cdt/debug/mi/core/cdi/ExpressionManager.java (update): - Reimplemented. - * src/org/eclipse/cdt/debug/mi/core/cdi/RegisterManager.java (update): - Reimplemented - * src/org/eclipse/cdt/debug/mi/core/cdi/UpdateManager.java: - Removed. - * src/org/eclipse/cdt/debug/mi/core/cdi/IUpdateListener.java: - Removed. - * src/org/eclipse/cdt/debug/mi/core/CLIProcessor.java: - Catch the cli "run" command. - -2003-02-06 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java (getVariableArrayObject): - New Method to type cast in an array. - * src/org/eclipse/cdt/debug/mi/core/cdi/model/VariableObject.java (VariableObject): - New constructor. - * src/org/eclipse/cdt/debug/mi/core/cdi/SignalManger.java(getSignal): - Return an signal object even when the session is terminated. - -2003-02-05 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/command/MISignal.java: - * src/org/eclipse/cdt/debug/mi/core/command/MIJump.java: - Return a fake ^running, since the MI semantic is not respected. - -2003-02-04 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/CLICommand.java: - Catch cli command "jump" - -2003-02-04 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java: - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java: - New implementation for signal(), jump, and stepReturn(boolean). - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Signal.java: - (signal): Calls Target.signal(). - * src/org/eclipse/cdt/debug/mi/core/cdi/model/SignalManager.java: - (signal): Method removed. - * src/org/eclipse/cdt/debug/mi/core/command/MIJump.java: - New file. - * src/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java: - New method creteMIJump(). - -2003-02-04 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/cdi/SignalManger.java: - Implement signal() method. - * src/org/eclipse/cdt/debug/mi/core/command/MISignal.java: - New file. - * src/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java: - (createMISignal): new method. - -2003-02-04 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/cdi/event/ExitedEvent.java: - Catch MIInferiorSignalExitEvent. - * src/org/eclipse/cdt/debug/mi/core/cdi/event/ExitedEvent.java: - Catch MIInferiorSignalExitEvent. - * src/org/eclipse/cdt/debug/mi/core/cdi/SignalExitInfo.java: - New File. - * src/org/eclipse/cdt/debug/mi/core/event/MIInferiorSignalExitEvent.java: - New File - * src/org/eclipse/cdt/debug/mi/core/event/CLIProcessir.java: - "signal" command is like continue. - * src/org/eclipse/cdt/debug/mi/core/event/RxThread.java: - Catch MIInferiorSignalExitEvent. - -2003-02-04 Alain Magloire - - Refactor MISignal in MISigHandle to not confus with - CLI command "signal SIGNAL". - - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Signal.java: - * src/org/eclipse/cdt/debug/mi/core/cdi/SignalManager.java: - * src/org/eclipse/cdt/debug/mi/core/output/MIInfoSignalsInfo.java: - * src/org/eclipse/cdt/debug/mi/core/output/MISigHandle.java: - -2003-02-03 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/cdi/SharedLibraryManager.java: - (loadSymbols): set the read flag to true. - * src/org/eclipse/cdt/debug/mi/core/cdi/model/SharedLibrary.java: - (getMIShared): New method. - * src/org/eclipse/cdt/debug/mi/core/output/MIShared.java: - (setSymbolsRead): New method. - -2003-02-01 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/cdi/event/ChangedEvent.java: - Support for ICDISignal event. - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Signal.java (handle): - Implemented. - * src/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java (update): - Support for ICDISignal event. - * src/org/eclipse/cdt/debug/mi/core/cdi/SignalManager.java (handle): - New method. - * src/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java (createMIHandle): - New method - * src/org/eclipse/cdt/debug/mi/core/command/MIHandle.java: - New File. - * src/org/eclipse/cdt/debug/mi/core/CLICommand.java: - Check for "handle" and "signal" cli command. - -2003-01-31 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/cdi/event/DestroyedEvent.java: - Use deleteSharedLibrary from the manager. - * src/org/eclipse/cdt/debug/mi/core/cdi/signal/Signal.java: - Construct a signal base on the MISignal response. - * src/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java - (suspendedInferior): Take ICDITarget as argument. - (resumeInferior): Take ICDITarget as argument. - * src/org/eclipse/cdt/debug/mi/core/cdi/SharedLibraryManager.java - (containsSharedLibrary): removed. - * src/org/eclipse/cdt/debug/mi/core/cdi/SignalManager.java - (update): implemented. - (getSignals): implemented. - * src/org/eclipse/cdt/debug/mi/core/cdi/SignalReceived.java: - Ask the manager for the signal. - * src/org/eclipse/cdt/debug/mi/core/event/MISignalEvent.java: - New file. - -2003-01-29 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/cdi/SharedLibraryManager.java (getSharedLibraryPaths): - New method. - (setSharedLibraryPaths): New method. - (setAutoLoadSymbols): New methos set autosolib. - * src/org/eclipse/cdt/debug/mi/core/cdi/SourceManager.java (setAutoSolib): - Move to SharedLibraryManager.java - -2003-01-28 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/command/MIInfoSignals.java: - * src/org/eclipse/cdt/debug/mi/core/output/MIInfoSignalsInfo.java: - * src/org/eclipse/cdt/debug/mi/core/output/MISignal.java: - New files. - -2003-01-28 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/cdi/model/ArgumentObject.java: - Use ICDIStackFrame in the constructor. - * src/org/eclipse/cdt/debug/mi/core/cdi/model/RegisterObject.java: - Use ICDIStackFrame in the constructor. - * src/org/eclipse/cdt/debug/mi/core/cdi/model/VariableObject.java: - Use ICDIStackFrame in the constructor. - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Value.java (getVariables): - No need to cast to StackFrame. - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java (setCurrentFrame): - Implement new method, takes a boolean as the second method. - * src/org/eclipse/cdt/debug/mi/core/cdi/ExpressionManager.java: - No need to cast to StackFrame. - * src/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java: - No need to cast to StackFrame. - -2003-01-28 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Breakpoint.java (getCondition): - Condition was initialize with the wrong parameter. - (setMIBreakpoint): reset location and condition. - -2003-01-28 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Breakpoint.java (setMIBreakpoint): - New method. - * src/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java (update): - Reset the new MIBreakpoint on the Breakpoint object. - (containsBreakpoint): Removed. - (hasBreakpointChanged): Change arguments. - * src/org/eclipse/cdt/debug/mi/core/output/MIBreakpoint.java (parser): - Better check for watchpoints. - * src/org/eclipse/cdt/debug/mi/core/CLIProcessor.java (isChangeBreakpoint): - Check for "ignore" and "condition" cli commands. - -2003-01-27 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Register.java (getTypeName): - Use MIWhatis to get the type of the register. - (getVariables): Cache the answer. - * src/org/eclipse/cdt/debug/mi/core/cdi/SharedLibraryManager.java (loadSymbols): - Use MISharedLibrary. - * src/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java (createMIWhatis): - New method. - (MIPType): New method. - * src/org/eclipse/cdt/debug/mi/core/command/MISharedLibrary.java: - New file. - - -2003-01-27 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java (getCThreads): - When attaching gdb(at least on some platform) does not show - the selected thread(info threads). Fallback on the first one. - -2003-01-27 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java (findVariable): - Bug fix, did not compare the stacks correctly. - -2003-01-27 Alain Magloire - - * src/org/eclipse/cdt/debug/mi/core/cdi/model/VariableObject.java: - * src/org/eclipse/cdt/debug/mi/core/cdi/model/ArgumentObject.java: - * src/org/eclipse/cdt/debug/mi/core/cdi/model/RegisterObject.java: - Move to model package. - -2003-01-26 Alain Magloire - - Major refactor of the code. Rewrote/Added Managers: - VariableManager - ExpressionManager - RegisterManager - UpdateManager. - - Refactor of CSession to Session, CTarget to Target - and CThread to Thread. - * src/.../mi/core/cdi/event/ChangedEvent.java: - * src/.../mi/core/cdi/event/CreatedEvent.java: - * src/.../mi/core/cdi/event/DestroyedEvent.java: - * src/.../mi/core/cdi/event/DisconnectedEvent.java: - * src/.../mi/core/cdi/event/ExitedEvent.java: - * src/.../mi/core/cdi/event/MemoryChangedEvent.java: - * src/.../mi/core/cdi/event/ResumedEvent.java: - * src/.../mi/core/cdi/event/SuspendedEvent.java: - - - * src/.../mi/core/cdi/model/Argument.java: - * src/.../mi/core/cdi/model/Breakpoint.java: - * src/.../mi/core/cdi/model/Thread.java: - * src/.../mi/core/cdi/model/Target.java: - * src/.../mi/core/cdi/model/MemoryBlock.java: - * src/.../mi/core/cdi/model/MixedInstruction.java: - * src/.../mi/core/cdi/model/Instruction.java: - * src/.../mi/core/cdi/model/Signal.java: - * src/.../mi/core/cdi/model/SharedLibrary.java: - * src/.../mi/core/cdi/model/CObject.java: - * src/.../mi/core/cdi/model/Expression.java: - * src/.../mi/core/cdi/model/Variable.java: - * src/.../mi/core/cdi/model/Value.java: - * src/.../mi/core/cdi/model/Register.java: - * src/.../mi/core/cdi/model/StackFrame.java: - - * src/.../mi/core/cdi/ArgumentObject.java: - * src/.../mi/core/cdi/VariableObject.java: - * src/.../mi/core/cdi/RegisterObject.java: - * src/.../mi/core/cdi/BreakpointHit.java: - * src/.../mi/core/cdi/BreakpointManager.java: - * src/.../mi/core/cdi/VariableManager.java: - * src/.../mi/core/cdi/ExpressionManager.java: - * src/.../mi/core/cdi/RegisterManaget.java: - * src/.../mi/core/cdi/SignalManager.java: - * src/.../mi/core/cdi/SharedLibraryManager.java: - * src/.../mi/core/cdi/EventManager.java: - * src/.../mi/core/cdi/MemoryManager.java: - * src/.../mi/core/cdi/ErrorInfo.java: - * src/.../mi/core/cdi/Session.java: - * src/.../mi/core/cdi/ExitInfo.java: - * src/.../mi/core/cdi/UpdateManager.java: - * src/.../mi/core/cdi/IUpdateListener.java: - * src/.../mi/core/cdi/SessionObject.java: - * src/.../mi/core/cdi/SignalReceived.java: - * src/.../mi/core/cdi/SourceManager.java: - * src/.../mi/core/cdi/RuntimeOptions.java: - * src/.../mi/core/cdi/WatchpointScope.java: - * src/.../mi/core/cdi/WatchpointTrigger.java: - * src/.../mi/core/cdi/EndSteppingRange.java: - - * src/.../mi/core/MIPlugin.java: - * src/.../mi/core/CygwinGDBDebugger.java: - * src/.../mi/core/GDBDebugger.java: - - - -2003-01-24 Alain Magloire - - * src/.../mi/core/CLIProcessor.java (isEnableBreakpoint): - Check for "enable", "disable" cli commands. - -2003-01-23 Alain Magloire - - * src/.../mi/core/CLIProcessor.java (isDeletingBreakpoint): - Check for "d" it means delete breakpoints. - -2003-01-20 Alain Magloire - - * src/.../mi/core/cdi/Configuration.java (supporstSharedLibrary): - New method. - * src/.../mi/core/cdi/CoreFileConfiguration.java (supporstSharedLibrary): - New method. - * src/.../mi/core/cdi/SharedLibraryManager.java (update): - Checks if support for shared Libary before doin an update. - -2003-01-20 Alain Magloire - - * src/.../mi/core/cdi/SuspendedEvent.java: Use SignalReceived. - * src/.../mi/core/cdi/model/Signal.java: New file. - * src/.../mi/core/cdi/model/SignalManager.java: Use model/Signal. - * src/.../mi/core/cdi/SignalReceived.java: New file. - -2003-01-20 Alain Magloire - - The problem was that no check was done for the existence of - the program/executable nor the working directory etc ... - By asking the arguements to be File, the check is done by - the caller. - - * src/.../mi/core/MIPlugin.java (createCSession): Change the - the arguments. - * src/.../mi/core/GDBDebugger.java (createCSession): Change the - -2003-01-20 Alain Magloire - - * src/.../mi/core/command/MIWhatis.java: New file. - * src/.../mi/core/command/MIPType.java: New file. - * src/.../mi/core/command/MISharedLibary.java: New file. - * src/.../mi/core/output/MIWhatisInfo.java: New file. - * src/.../mi/core/output/MIPTypeInfo.java: New file. - -2003-01-18 Alain Magloire - - * src/.../mi/core/cdi/event/DestroyedEvent.java (DestroyedEvent): - Remove the deleted shared library from the list. - * src/.../mi/core/cdi/SharedLibraryManager.java (getUnloadedLibrary): - Get a shared library slated for unload. - (removeFromUnloadedList): Remove the library form the list. - -2003-01-17 Alain Magloire - - * src/.../mi/core/output/MIInfoSharedLibraryInfo.java (parseWinShared): - Break the methods in parserUnixShared() and parseWinShared() to cope - with the different formats. - -2003-01-17 Alain Magloire - - * src/.../mi/core/cdi/SharedLibraryManager.java (loadSymbols): - New method takes and array of ICDISharedLibrary. - * src/.../mi/core/cdi/SharedLibrary.java (loadSymbols): - Call the share manager to load. - -2003-01-17 Alain Magloire - - * src/.../mi/core/cdi/SharedLibraryManager.java (loadSymbols): - Call "shared libraryname". - -2003-01-17 Alain Magloire - - The problem here is that we do not knw the state of - the session, for example "target remote server:port" - was issue, in this case the state is suspended. - We try to guess by posting a "info remote-process" - and set suspended when no error. - - * src/.../mi/core/MIPlugin.java (createCSession): - Try "info remote-process" to guess the state. - Remove the "new-console" call to windows specific files. - * src/.../mi/core/CygwinGDBDebugger.java(createLaunchSession): - call "set new-console" for windows plaforms. - -2003-01-16 Alain Magloire - - * src/.../mi/core/cdi/SharedLibary.java (setMIShared): - New method. - * src/.../mi/core/cdi/SharedLibraryManager.java (update): - When changed reset the MIShared of the SharedLibrary. - -2003-01-16 Alain Magloire - - Process gdbinit configuration file. - - * src/.../mi/core/MIPlugin.java (createCSession): Takes now two new - arguments for working directory and configuration file gdbinit. - * src/.../mi/core/GDBDebugger.java (createAttachSession): - (createCoreSession): pass the working directory and gdbinit file - (createLaunchSession): pass the working directory and gdbinit file - * src/.../mi/core/IMILaunchConfigurationConstants.java: - New constant ATTR_GDB_INIT. - -2003-01-16 Alain Magloire - - * src/.../mi/core/cdi/EventManager.java (processSuspended): - Also process the Shared lib by calling update on the manager. - - * src/.../mi/core/cdi/CSession.java: Create a shared - library manager. - -2003-01-16 Alain Magloire - - * src/.../mi/core/event/MISharedLibCreatedEvent.java: New file. - * src/.../mi/core/event/MISharedLibChangedEvent.java: New file. - * src/.../mi/core/event/MISharedLibUndloadedEvent.java: New file. - - * src/.../mi/core/cdi/event/CreatedEvent.java: - new constructors to deal with MISharedLibCreatedEvent. - * src/.../mi/core/cdi/event/ChangedEvent.java: - new constructors to deal with MISharedLibChangedEvent. - * src/.../mi/core/cdi/event/DestroyedEvent.java: - new constructors to deal with MISharedLibUnloadedEvent. - - * src/.../mi/core/cdi/model/SharedLibrary.java: New file. - - * src/.../mi/core/cdi/SharedLibraryManager.java: New file. - * src/.../mi/core/cdi/CSession.java (getSharedLibraryManager): - New method. - * src/.../mi/core/cdi/EventManager.java (update): - Deal with the new MISharedLibXXXEvents. - -2003-01-15 Alain Magloire - - * src/.../mi/core/command/CommandFactory.java (createMIInfoSharedLibrary): - New method. - * src/../mi/core/command/MIInfoSharedLibrary.java: New file. - * src/../mi/core/output/MIInfoSharedLibraryInfo.java: New File. - * src/../mi/core/output/MIShared.java: new File. - -2003-01-13 Mikhail Khodjaiants - * CTarget.java: in the 'runUntil' method check if file name or function name length > 0, otherwise use address. - -2003-01-10 Alain Magloire - - * src/.../mi/core/cdi/BreakpointManager.java (update): fix subscript - (setCondition): Fire a ChangedEvent. - (enableBreakpoint): Fire a ChangedEvent. - (disableBreakpoint): Fire a ChangedEvent. - -2003-01-10 Alain Magloire - - * src/.../mi/core/cdi/model/CTarget.java (runUntil): Address breakpoint - needs a "*" prefix. - -2003-01-09 Alain Magloire - - * src/.../mi/core/cdi/BreakpointManager.java (hasBreakpointChanged): - Implemented. - -2003-01-09 Alain Magloire - - * src/.../mi/core/cdi/model/CTarget.java (setCurrentThread): takes - a new argument to decide if the events should be fired. - * src/.../mi/core/cdi/model/CThread.java (getStackFrameCount): use - the setCurrentThread() with events updates disable - (getStackFrames): Ditto. - (updateState): Wrong subscript in the loop. - -2003-01-09 Alain Magloire - - Generate CreatedEvent's for Variable, Argument, Expression, Memory, Thread - objects when they are created. This makes it consistent with the generated - DestroyedEvent's. - - * src/.../mi/core/cdi/EventManager.java (update): Deal with - MI{Register,Memory,Thread,Var}CreatedEvent events. - * src/.../mi/core/cdi/model/Ctarget.java (updateState): Fire events - when threads are created or destroyed. - * src/.../mi/core/cdi/model/MemoryBlock.java: Move here. - * src/.../mi/core/cdi/model/Register.java (getID): rename getId() to getID(). - * src/.../mi/core/cdi/event/CreatedEvent.java: New constructors - to deal with MI{Register,Memory,Thread,Var}CreatedEvent. - - * src/.../mi/core/event/MIMemoryCreatedEvent.java: New file. - * src/.../mi/core/event/MIRegisterCreatedEvent.java: New file. - * src/.../mi/core/event/MIThreadCreatedEvent.java: New file. - * src/.../mi/core/event/MIVarCreatedEvent.java: New file. - * src/.../mi/core/event/MIBreakpointChangedEvent.java (MIBreakpointChangedEvent): - Reuse the constructor. - * src/.../mi/core/event/MIBreakpointCreatedEvent.java (MIBreakpointCreatedEvent): - Reuse the constructor. - * src/.../mi/core/event/MIBreakpointDeletedEvent.java (MIBreakpointDeletedEvent): - Reuse the constructor. - -2003-01-08 Alain Magloire - - Refactoring, split the org.eclipse.cdt.debug.mi.core.cdi in pacackages - org.eclipse.cdt.debug.mi.core.cdi - org.eclipse.cdt.debug.mi.core.cdi.event - org.eclipse.cdt.debug.mi.core.cdi.model - This help structure things up. - * src/.../mi/core/cdi/event: New files. - * src/.../mi/core/cdi/model: New files. - -2003-01-08 Alain Magloire - - * src/.../mi/core/cdi/EventManager.java (update): bug fix - was calling DestroyedEvent() incorrectly. - -2003-01-08 Alain Magloire - - CLIProcessor a new class to recognise the CLI(Command Line Interface) - of gdb example: - (gdb) next - (gdb) n - (gdb) b - (gdb) break - etc ..: - When the patterns are discover, the class will generate some events - to warn te UI that something change. - - * src/.../mi/core/cdi/BreakpointManager.java (update): - Send a -break-list and generate events for any difference, in - the breakpoints that we know about. - (deleteBreakpoint): Take as argument the breakpoint number. - (getBreakpoints): Call update() to generate events if new breakpoints. - (getMIBreakpoints): return the MIBreakpoints. - * src/.../mi/core/cdi/ChangedEvent.java (ChangedEvent): - New constructor with MIBreakPointChangedEvent. - * src/.../mi/core/cdi/DestroyedEvent.java (DestroyedEvent): - New constructor with MIBreakPointDeletedEvent. - * src/.../mi/core/cdi/Created.java: New file. - * src/.../mi/core/cdi/EventManager.java (update): - Watch for the new MIBreakPoint*Events. - * src/.../mi/core/event/MIBreakPointCreatedEvent.java: New file. - * src/.../mi/core/event/MIBreakPointChangedEvent.java: New file. - * src/.../mi/core/event/MIBreakPointDeletedEvent.java: New file. - * src/.../mi/core/event/MICreatedEvent.java: New file. - * src/.../mi/core/event/MIDestroyedEvent.java: New file. - * src/.../mi/core/event/MIInferiorExitEvent.java: Extends MIDestroyedEvent - * src/.../mi/core/event/MIThreadExitEvent.java: Extends MIDestroyedEvent - * src/.../mi/core/event/MIGDBExitEvent.java: Extends MIDestroyedEvent - * src/.../mi/core/event/MIDetachedEvent.java: Extends MIDestroyedEvent - * src/.../mi/core/CLIProcessor.java: New file. - * src/.../mi/core/TxThread.java: New file. - -2003-01-07 Alain Magloire - - * src/.../mi/core/MIInferior.java (getOutputStream): Remove useless assignement. - * src/.../mi/core/MIPluging.java (debugLog): Not need to be static. - * src/.../mi/core/cdi/EventManager.java (update): Remove useless assignement. - -2003-01-06 Alain Magloire - - * build.properties: Patch from Judy Green. - -2003-01-06 Alain Magloire - - * src/.../mi/core/cdi/BreapoinManager.java (createLocation): new method - to create a breakoint with an address. - * src/.../mi/core/cdi/Location.java (Location): New constructor takes - an address as argument. - -2003-01-03 Alain Magloire - - The Class creating the CDISession part of the initialization would call - (gdb) set autosolib on - this works fine for Unix system, but on Windows it throws an error - failing the debugger. Windows(Cygwin, MingWin) does not need any - special initialization like solib-search-paths etc .. - - * src/.../mi/core/cdi/SourceManager.java (setAutoSolib): Takes a boolean argument - to set the autosolib on or off. - * src/.../mi/core/CygwinGDBDebugger.java(initializeLibraries): - Empty method, cygwin does not need any special handling. - * src/.../mi/core/GDBDebugger.java (initializeLibraries): - Always call autosolib. - - -2003-01-02 Alain Magloire - - Bug when using recursive: - int recursive(int x) { - if (x > 10) - recursive(++x); - return 0; - } - - The Variable Manager is caching the MI/GDB var-obj for speed. - It is finding the object by looking at the name and the stack/thread, - for recursive calls, this is wrong and the code would be full in - thinking the variable "x"(see above) is the same object. To make the distinction - we use the depth "-stack-info-depth" that will be use also in the equality - to make sure we identify an object uniquely. In the recursive() case above - because the depth is different, a new "x" object will be created. The downside - is that on certain platform doing deep recursive/stackframe, we have noticed - that "-stack-info-depth" can be very long, test done for gdb/QNX with - a stack depth of 1000. - - * src/.../mi/core/cdi/VariableManager.java (getElement): - Use the depth when doing equal(). - (createElement): Save the depth of the stack part of the Element. - -2003-01-02 Alain Magloire - - GDB/MI uses some oob reasons that was not documented for the watchpoints - *stopped,reason="access-watchpoint-trigger"... - *stopped,reason="read-watchpoint-trigger",... - * src/.../mi/core/event/MIWatchpointTrigger.java (parse): - check for "hw-awpt" and "hw-rwpt". - * src/.../mi/core/RxThread.java (createEvents): - Check for "access-watchpoint-trigger", "read-watchpoint-trigger. - -2002-12-17 Alain Magloire - - * src/.../mi/core/cdi/Register.java (setFormat): bug fix - The format variable was not set. - -2002-12-05 Alain Magloire - - GDB/MI provides error messages in its log stream, one problem - is that it is not consistent, for example doing: - (gdb) info threads - & "info threads\n" - which is obviously not an error. - So we put the error stream output par of the exception so when - it is relevant it shows in the Exception. - MI2CDIException is the bridge class. - - * src/.../mi/core/cdi/BreakpoinManager.java: - * src/.../mi/core/cdi/CSession.java: - * src/.../mi/core/cdi/CTarget.java: - * src/.../mi/core/cdi/CThread.java: - * src/.../mi/core/cdi/MemoryBlock.java: - * src/.../mi/core/cdi/MemoryManager.java: - * src/.../mi/core/cdi/Register.java: - * src/.../mi/core/cdi/RegisterManager.java: - * src/.../mi/core/cdi/SourceManager.java: - * src/.../mi/core/cdi/Value.java: - * src/.../mi/core/cdi/Variable.java: - * src/.../mi/core/cdi/VariableManager.java: - - * src/.../mi/core/command/Command.java (getMIInfo): - When error get the log stream and put it in the MIException. - * src/.../mi/core/event/MIErrorEvent.java: - Get the log stream error also. - * src/.../mi/core/MIException.java (getLogMessage): New method - contains buffer output. - * src/.../mi/core/RxThread.java (processMIOutput): get the - oob arrays up so it can be use in MIErrorEvent. - -2002-12-02 Alain Magloire - - * src/.../mi/core/cdi/CTarget.java (updateState): If we - have the current thread id set it before, getCThread() if - it is implemented with "info threads" can override it but - "-stack-list-thread" does not give this information. - * src/.../mi/core/cdi/ErrorInfo.java: New file - * src/.../mi/core/cdi/EventManager.java (getReason): Return - an ErrorInfo also. - * src/.../mi/core/event/MIErroEvent.java: New file - * src/.../mi/core/RxThread.java (processMIOutput): - Generated MIErrorEvent for "^error". - -2002-11-29 Alain Magloire - - * src/.../mi/core/cdi/EventManager.java (processSuspended): - get the threadId. - -2002-11-29 Alain Magloire - - * src/.../mi/core/cdi/MemoryBlock.java (setValue): - Check if the change affects other block and fire MemoryChangedEvent - when necessary. - -2002-11-29 Alain Magloire - - * src/.../mi/core/event/MIBreakpointEvent.java: - * src/.../mi/core/event/MIFunctionFinishedEvent.java: - * src/.../mi/core/event/MILocationReachedEvent.java: - * src/.../mi/core/event/MISignalEvent.java: - * src/.../mi/core/event/MISteppingRangeEvent.java: - * src/.../mi/core/event/MIStoppedEvent.java: - * src/.../mi/core/event/MIWatchpointEvent.java: - * src/.../mi/core/event/MIWatchpointTriggerEvent.java: - * src/.../mi/core/RxThread.java: - Some events like the temporary events, do not have - any specific format but do provide a frame and a thread-id - move the code in MIStoppedEvent. - -2002-11-28 Alain Magloire - - * src/.../mi/core/cdi/MemoryBlock.java (setValue): Only get a byte. - -2002-11-28 Alain Magloire - - * src/.../mi/core/cdi/CTarget.java (runUntil): new method implemented. - * src/.../mi/core/cdi/CThread.java (runUntil): new method implemented. - -2002-11-26 Doug Schaefer - - * src/.../mi/core/CygwinGDBDebugger.java: - New Debugger that provides the Cygwin Command Factory to the MISession - * src/.../mi/core/command/CygwinCommandFactory.java: - New Command Factory for Cygwin specific implementations of the commands - * src/.../mi/core/command/CygwinMIEnvironmentDirectory.java: - New. Subclasses the MIEnvironmentDirectory command to convert the - paths using cygpath. - * plugin.xml: - Defines the new debugger extension. - -2002-11-25 Alain Magloire - - * src/.../mi/core/cdi/Watchpoint.java: - Check if it was access point also. - * src/.../mi/core/output/MIBreakInsertInfo.java (parse): - Check for "wpt" variable. - * src/.../mi/core/output/MIBreakpoint.java (IsWriteWatchpoint): - implemented. - -2002-11-20 Mikhail Khodjaiants - Fix for bug 26595. - * src/.../mi/core/cdi/MemoryManager.java (compareBlocks): - If the start address of a memory block has changed fir 'changed' event - only for the corresponding bytes of the overlapping area of new and old blocks. - -2002-11-19 Alain Magloire - - * src/.../mi/core/cdi/MemoryManager.java (compareBlocks): - The startAddress() may have change for example if we were - watching "char *p;" and the address move "p++". Take this - into account now. - -2002-11-18 Alain Magloire - - * src/.../mi/core/cdi/StackFrame.java (getCurrentStackFrame): - if the currentFrame was not set only get the top level - frame for the current. - * src/.../mi/core/cdi/CTarget.java (updateStateId): - Set the currentThreads && currentThreadId. - -2002-11-18 Alain Magloire - - * src/.../mi/core/cdi/CThread.java (getStackFrameCount): - Set the new thread before getting the value and restore - after. - -2002-11-14 Alain Magloire - - This is needed in post-mortem, application doing a - very deep recursion and crashing the stack size, for example - on GNU/Linux it may reach 200000 levels deep. Trying to - bring in the UI a bactrace tree of 200000 nodes is useless. - The UI could check the count and do the appropriate action - by showing ranges etc .. - - * src/.../mi/core/cdi/CThread.java (getStackFrame): - new method with a hi and low. - (getStackFrameCount): new method. - * src/.../mi/core/command/CommandFactory.java (createMIStackInfoDepth): - new method. - * src/.../mi/core/command/MIStackInfoDepth.java (getMIStackInfoDepthInfo): - new method. - -2002-11-13 Dave Inglis - * plugin.xml - Added "native" cpu support. - -2002-11-06 Alain Magloire - - * src/.../mi/core/cdi/StackFrame.java (getLocals): - If an exception was thrown, the array may contain null - entries. Use a list and catch the exception. - -2002-11-06 Alain Magloire - - * src/.../mi/core/cdi/StackFrame.java (getArguments): - If an exception was thrown, the array may contain null - entries. Use and a List and catch the exception. - -2002-11-05 Alain Magloire - - * src/.../mi/core/cdi/Register.java (setValue): Fire a - MIRegisterChangedEvent when changing value. - Fix PR:25730 - -2002-11-01 Alain Magloire - - The change in MISession(), will catch things like starting gdb-5.0 - with argument "-i mi1", that level of mi is not supported. - - * src/.../mi/core/cdi/MemoryBlock.java (refresh): When doing the refresh - check if other blocks wehre affected and update them. - * src/.../mi/core/cdi/MemoryManager.java (update): Return the array of - affected addresses. - * src/.../mi/core/MIPlugin.java (createCSession): Do not throw an - error when trying "set new-console", it does not work on Linux. - * src/.../mi/core/MISession.java (MISession): Check if the process - terminated early, maybe because of wron arguments etc .. and throw - the exception. - -2002-11-1 David Inglis - * src/.../mi/core/MIPlugin.java - throw MIExceptions in createSession (not rethorwn IOExceptions) - -2002-10-30 Alain Magloire - - * src/.../core/cdi/MemoryBlock.java (setDirty): When need a - refresh setDirty() to true. - (isDirty): Return the flag value. - - * src/.../core/cdi/MemoryManager.java (update): Check if - the MemoryBlock isDirty(). - -2002-10-30 Alain Magloire - - * src/.../core/cdi/MemoryBlock.java (setValue): reuse refresh() - to update the memory and fire any MemoryChangedEvents. - -2002-10-26 Alain Magloire - - * src/.../core/cdi/MemoryBlock.java (setValue): Generate - a MemoryChangeEvent when the value is set, gdb/mi will not - do it. - -2002-10-25 Alain Magloire - - * src/.../core/cdi/CThread.java (getStackFrames): Save the - current thread before changing and restore when operation finish. - - * src/.../core/cdi/MemoryBlock.java (refresh): Flush the old - data and get new memory. - (update): New method to compare individual blocks. - -2002-10-25 Alain Magloire - - Automatically suspend/resume gdb when setting a breakpoint. - The workflow when debuggin which gdb command prompt is to - hit CTRL-C set the breakpoint and continue. The UI debugger - should be smart enought to do this by itself. So if the - inferior is running, when setting a breakpoint the program - is suspended(target.suspend()), the suspend event is ignore - the breakpoint is set (--break-insert) and the target is resume. - To ignore a specific event, we use a (mis)behaviour of gdb that - associate the suspend(*stopped) with the last execution command. - (gdb) - 111-exec-continue - 111^running - (gdb) - 222-exec-interrupt - 222^done - (gdb) - 111*stopped,signal-name="SIGINT",signal-meaning="Interrupt", - frame={addr="0x00010140",func="foo",args=[],file="try.c",line="13"} - (gdb) - In the case above event 111 is ignore. - - * src/.../core/command/CLICommand.java (toString): Always put - the identifying token. - * src/.../core/command/Command.java (setToken): Removed. - (getUniqToken): New method returns a global uniq token. - (getToken): Returns a uniq token for the command. - * src/.../core/MIInferior.java (setTerminated): New argument token, - since now all MIEvent has the corresponding command token. - * src/.../core/MISession.java (cmdCount): Removed. - (postCommand): the command getToken() will return a uniq token. - * src/.../core/RxThread.java (processMIOOBRecord): MIEvent take - the corresponding command token as argument. - * src/.../core/TxThrea.java (token): Field removed, token are no - longer created in this tread. - * src/.../core/event/MIBreakpointEvent.java: - * src/.../core/event/MIBreakpointEvent.java: - * src/.../core/event/MIChangedEvent.java: - * src/.../core/event/MIDetachedEvent.java: - * src/.../core/event/MIEvent.java: - * src/.../core/event/MIFunctionFinishedEvent.java: - * src/.../core/event/MIGDBExitEvent.java: - * src/.../core/event/MIInferiorExitEvent.java: - * src/.../core/event/MILocationReachedEvent.java: - * src/.../core/event/MIMemoryChangedEvent.java: - * src/.../core/event/MIRegisterChangedEvent.java: - * src/.../core/event/MIRunningEvent.java: - * src/.../core/event/MISignalEvent.java: - * src/.../core/event/MISteppingRangeEvent.java: - * src/.../core/event/MIStoppedEvent.java: - * src/.../core/event/MIThreadExitEvent.java: - * src/.../core/event/MIVarChangedEvent.java: - * src/.../core/event/MIWatchpointScopeEvent.java: - * src/.../core/event/MIWatchpointTriggerEvent.java: - Calls super with getToken(). - * src/.../core/cdi/BreakpointManager.java (allowProgramInterruption): - New method to allow suspending the program to set a breakpoint. - (suspendInferior): get the last token execution an ignore the suspend - event. - * src/.../core/cdi/CTarget.java (getLastExecutionToken): New method - returns the token of the last execution command. - * src/.../core/cdi/EventManager.java (enableEventToken): New method. - (enableEventTokens): New method. - (disableEventToken): New method. - (disableEventTokens): New method. - (update): Ignore token in the disable list. - * src/.../core/cdi/RegisterManager.java (update): MIEvent takes - a token. - * src/.../core/cdi/Variable.java (setValue): MIEvent takes a token. - * src/.../core/cdi/VariableManager.java (update): MIEvent takes a token. - -2002-10-24 Alain Magloire - - * src/.../core/RxThread.java (processMIOutput): Fire a - suspended event when seeing an error. - -2002-10-24 Alain Magloire - - * src/.../core/output/MIConst.java (isoC): Change to return - a string instead '\n' is platform dependent and has to be - translate to "\r\n" for SWT widgets to work correctly on windows. - -2002-10-23 Alain Magloire - - gdb/mi for program control command will fire a change state event: - -exec-run - ^running - This allow the UI to change its state and wait for the suspended. - Providing a gdb prompt adds some problems, since there is no state - change, i.e.(^running) after command like, next/step/...: - next - &"next\n" - ... - So to palliate, the txthread do some query when the commands are - CLI commands trying to discover the type and fire any appropriate - events on behalf on gdb. - - * src/.../core/RxThread.java (createEvent): Adjust the parser to - not rely on the oob "*stopped", since for CLI command it is not - in the result-class. So the suspended state will be base of - the "reason" only. - * src/.../core/TxThread.java (processCLICommand): new method, - get the command and try to recognize if it is a program control - command like: next, step, etc .. - * src/.../core/command/CLICommand.java (getOperation): New method, - returns the command string. - -2002-10-22 Alain Magloire - - Change the framework to support access to gdb prompt. - Trying to reuse as much as possible Eclipse framework. - The session/gdb process is available via CDI. - - * src/.../core/GDBStreamsProxy.java: Removed. - * src/.../core/GDBProcess.java: Removed. - * src/.../core/GDBStreamMonitor.java: Removed. - * src/.../core/SessionProcess.java: New file. - * src/.../core/MISession.java (getMISessionProcess): - New method, returns a "fake" Process that wraps the input/outpu - stream of gdb. - (getGDBProcess): was getMIProcess(), renamed. - * src/.../core/cdi/CSession.java (getSessionProcess): New method - return gdb process. - -2002-10-22 Alain Magloire - - * src/.../core/GDBStreamsProxy.java (write): - Replace the OutputStream with a Write class. - And clear the buffer on flush(). - -2002-10-21 Alain Magloire - - * src/.../core/GDBProcess.java (getExitValue): Catch - IllegalThreadStateException. - (getAttribute): Only create Properties, when call. - (setAttribute): Only create Properties, when call. - (getAdapter): Implemented. - (canTerminate): true only of the process is alive. - (GDBProcess): Takes one more argument the name. - * src/.../core/GDBStreamMonitor.java (fireStreamAppend): New method. - Use a synchronized LinkedList for the listeners. - (read): new Method. - (startMonitoring): New method, start a thread in the background - to monitor the input. - * src/.../core/GDBStreamsProxy.java (getErrorStream): Start the monitor thread. - (getOutputStream): Start the monitor thread. - -2002-10-21 Alain Magloire - - Framework for having a gdb console. The idea is to reuse - the eclipse console and save a lot of work. We "adapt" - the gdb Process to what eclipse debug LaunchView wants(IProcess). - So when this fake "gdb process" is selected we can grab the - input/output of the console and redirect everything to raw gdb. - - * src/.../core/GDBProcess.java: New file, it implements Eclipse - debug class IProcess. - * src/.../core/GDBStreamMonitor: New file, it implements Eclipse - debug class IStreamMonitor. - * src/.../core/GDBStreamsProxy: New file, it implements Eclipse - debug class IStreamsProxy. - * src/../core/MISession.java (getMIConsoleStream): New method - to return the mi console stream output that we get from gdb/mi. - (getMILogStream): New method, to return the mi log stream output - that we get from gdb/mi. - (terminate): close the fake MI Console and Log streams. - * src/../core/RxThread.java (processMIOOBRecord): Redirect the - console and the log stream to a buffer pipe. - -2002-10-21 Alain Magloire - - * src/.../core/cdi/EventManager.java (update): Only - fire the event for MemoryChangedEvent if the block was - not frozen. - -2002-10-20 Alain Magloire - - Eclipse provides plugins a way to trace by having an .options file, - this mechanism is use to print out the mi exchange between gdb - and the plugin. To enable this in the debug launch one must enable - "tracing" and set for the "org.eclipse.debug.mi.core/debug" to true. - But one problem, the console will simply blow taking down eclipse, - for big MI line response, say 4k length, for example asking the children - of "char buffer[4096]", -var-list-children varxx. - This seem only to happen in Eclipse-gtk or Eclipse-motif - on GNU/Linux, so it will be break in smaller chunks to give a chance to - the console. - - * .options: Set debug to true. - * src/.../core/MIPlugin.java (debugLog): Break the log line in small chuncks of 100. - * src/.../core/MISession.java (postCommand): Print the gdb/mi command. - * src/.../core/RxThread.java (run): Print gdb/mi responses. - -2002-10-20 Alain Magloire - - -data-write-register-values is not in the texinfo manual but implemented in - gdb-5.2.1/gdb/mi/mim-main.c: - Write given values into registers. The registers and values are - given as pairs. The corresponding MI command is - -data-write-register-values <format> [<regnum1> <value1>...<regnumN> <valueN>] - - * src/.../core/command/MIDataWriteRegisterValues.java: New file. - * src/.../core/command/CommandFactory.java (createMIDataWriteMemory): New method. - * src/.../core/cdi/Register.java (setValue): Implemented. - -2002-10-20 Alain Magloire - - Althought -data-write-memory is not documented in the texinfo manual - it is implemented and well documented in the code(gdb-5.2.1/gdb/mi/mi-main.c). - "mi_cmd_data_write_memory: Usage: [-o COLUMN_OFFSET] ADDR FORMAT WORD-SIZE VALUE."); - - * src/.../core/command/MIDataWriteMemory.java: New file - * src/.../core/command/CommandFactory.java (createMIDataWriteMemory): New method. - * src/.../core/cdi/MemoryBlock.java (setValue): Implemented. - -2002-10-20 Alain Magloire - - * src/.../core/cdi/CTarget.java (getMemoryBlock): Remove - we use the MemoryManager instead. - (EvaluateExpressionToValue): Removed not use. - * src/.../core/cdi/SourceManager.java (setFile): Removed not use. - (getFile): Removed not use. - (reset): Removed not use. - -2002-10-19 Alain Magloire - - The responsability to generate Events for modify memory blocks is push - on the CDI implementation. The way we do this is every time consuming, - when the inferior is suspended(see EventManager.processSuspendedEvent()), - MemoryManager.update() is called, the method will go through the list of MemoryBlocks - that are not MemoryBlocks.setFrozen() and fetch the new memories, the data is compare - and MemoryChangedEvents are fired for blocks with changed values. - Gdb/mi var objects does not seem to provide any support for Memory ranges. - - * src/.../core/cdi/MemoryChangedEvent.java: New File implements ICDIMemoryChangedEvent. - * src/.../core/cdi/EventManager.java (update): Process MIMemoryChangedEvent's. - (processSuspendedEvent): call MemoryManager.update(). - * src/.../core/cdi/MemoryBlock.java (getExpression): New method. - (getMIDataReadMemoryInfo): New method. - (setMIDataReadMemoryInfo): New method. - * src/.../core/cdi/MemoryManager.java (update): New method. - (compareBlock): New method. - (listMemoryBlocks): New method. - - * src/.../core/cdi/CTarget.java (setCurrentThread): Catch null pointer. - (getCThreads): Likewise. - * src/.../core/event/MIMemoryChangedEvent.java: New File. - * src/.../core/event/MIThreadExitEvent.java: Indentation fixes. - * src/.../core/event/MIVarChangedEvent.java: Indentation fixes. - - - -2002-10-16 Alain Magloire - - * src/.../mi/core/cdi/MemoryManager.java (createMemoryBlock): - New method that takes a string instead of a long, rearrange - the method for it. - -2002-10-12 Alain Magloire - - There are some serious problems with gdb/mi, for example - the most recurrent one is when using -data-disassemble - in a threaded program, GNU/Linux uses a thread manager - when trying to access the stackframe, gdb usually coredumps - with an assert, it goes something like this: - --data-disassemble -f manager.c -l 136 -n 100 0 -&"Cannot access memory at address 0x4002d794\n" -^error,msg="Cannot access memory at address 0x4002d794" -(gdb) --data-disassemble -s 0x4002d900 -e 0x4002d964 0 -&"Cannot access memory at address 0x4002d900\n" -^error,msg="Cannot access memory at address 0x4002d900" -(gdb) --thread-select 2 -&"ui-out.c:133: gdb-internal-error: push_level: Assertion `uiout->level >= 0 && uiout->level < MAX_UI_OUT_LEVELS' failed.\n" - - The RxThread will spawn a thread to terminate the session - and clear the receiving queue. - - - * RxThread.java (run): When the thread is being cancel() or - running out of run(), clear the receiving queue(rxQueue) and - notify any commands waiting. - - * TxTread.java (run): Before putting the command in the - receiving queue(rxQueue) check to see if the thread is - still running. - When the thread is being cancel() or running out of run(), - clear the transmition queue(txQueue) an notify any commands - waiting. - - * Queue.java (clearItems): New method that clear the items - on the queue and returning them. - - * CommandQueue.java (clearCommands): New method calls super.clearItems() - whith the appropriate castings. - - * cdi/CThread.java (setCurrentStackFrame): Check for null. - -2002-10-12 Alain Magloire - - The memory block is implemented with - -data-read-memory (MIDataReadMemory) - Since the ICDIMemoryBlock only have - byte[] getBytes() - We will always issue: - -data-read-memory address x 1 1 length - The CDI upper layer will deal with any conversions - - The problem now is how to send changedEvent when - an element of the memory changed. - - * cdi/MemoryBlock.java (getLength): Implemented - (getBytes): Implemented - (getStartAddress): Implemented - - * cdi/MemoryManager.java: Implemented. - - * command/MIDataReadMemory (getMIDataReadMemoryInfo): - New helper method. - -2002-10-12 Alain Magloire - - * cdi/Location (getInstructions): Methods removed - no longer define in ICDILocation. - -2002-10-11 Alain Magloire - - * cdi/SourceManager (getMixedInstruction): - Implement the 3 new methods to return Mixed source - and assemby instructions. - - * cdi/MixedInstruction: New class implements - ICDIMixedInstruction. - -2002-10-11 Alain Magloire - - * cdi/ExpressionManager.java: Not needed, removed. - -2002-10-10 Alain Magloire - - The Eclipse/UI/Debug framewok is being very repetive - and each command can be ask 2, 3 times. So we'll try - to make certain commands smarter by not reissuing them - to gdb if the state is the same. We do this when - selecting the thread and when selecting the stackframe. - - The other problem is that Eclipse/UI/Debug is calling - ICDISession.terminate() twice, this is catch by looking - at isTerminated(). - - * cdi/CThread.java (setCurrentStackFrame): Make it smarter - to not reselect the stack level if it is already at that - level. - - * MISession.java (isTerminated): Declare a flag that will - hold the state. - (terminate): Check if it was call already. - -2002-10-10 Alain Magloire - - * SourceManager.java: Implement getInstructions(). diff --git a/debug/org.eclipse.cdt.debug.mi.core/META-INF/MANIFEST.MF b/debug/org.eclipse.cdt.debug.mi.core/META-INF/MANIFEST.MF deleted file mode 100644 index 77a4f13a8a5..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/META-INF/MANIFEST.MF +++ /dev/null @@ -1,30 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-SymbolicName: org.eclipse.cdt.debug.mi.core; singleton:=true -Bundle-Version: 7.3.0.qualifier -Bundle-Activator: org.eclipse.cdt.debug.mi.core.MIPlugin -Bundle-Vendor: %providerName -Bundle-Localization: plugin -Export-Package: org.eclipse.cdt.debug.mi.core, - org.eclipse.cdt.debug.mi.core.cdi, - org.eclipse.cdt.debug.mi.core.cdi.event, - org.eclipse.cdt.debug.mi.core.cdi.model, - org.eclipse.cdt.debug.mi.core.cdi.model.type, - org.eclipse.cdt.debug.mi.core.command, - org.eclipse.cdt.debug.mi.core.command.factories, - org.eclipse.cdt.debug.mi.core.command.factories.linux, - org.eclipse.cdt.debug.mi.core.command.factories.macos, - org.eclipse.cdt.debug.mi.core.command.factories.win32, - org.eclipse.cdt.debug.mi.core.event, - org.eclipse.cdt.debug.mi.core.output -Require-Bundle: org.eclipse.cdt.debug.core;bundle-version="[7.0.0,8.1.0)", - org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)", - org.eclipse.debug.core;bundle-version="[3.2.0,4.0.0)", - org.eclipse.cdt.core;bundle-version="[5.0.0,7.0.0)", - org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)", - org.eclipse.core.variables;bundle-version="3.2.200", - org.eclipse.cdt.gdb;bundle-version="7.0.0" -Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-1.7 -Import-Package: com.ibm.icu.text diff --git a/debug/org.eclipse.cdt.debug.mi.core/about.html b/debug/org.eclipse.cdt.debug.mi.core/about.html deleted file mode 100644 index d7c511887d6..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/about.html +++ /dev/null @@ -1,24 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"><head> -<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>About</title></head> - -<body lang="EN-US"> -<h2>About This Content</h2> - -<p>June 22, 2007</p> -<h3>License</h3> - -<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise -indicated below, the Content is provided to you under the terms and conditions of the -Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available -at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. -For purposes of the EPL, "Program" will mean the Content.</p> - -<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is -being redistributed by another party ("Redistributor") and different terms and conditions may -apply to your use of any object code in the Content. Check the Redistributor's license that was -provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise -indicated below, the terms and conditions of the EPL still apply to any source code in the Content -and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p> - -</body></html>
\ No newline at end of file diff --git a/debug/org.eclipse.cdt.debug.mi.core/build.properties b/debug/org.eclipse.cdt.debug.mi.core/build.properties deleted file mode 100644 index 479aeaeea51..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/build.properties +++ /dev/null @@ -1,27 +0,0 @@ -############################################################################### -# Copyright (c) 2003, 2009 QNX Software Systems and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# QNX Software Systems - initial API and implementation -############################################################################### - -bin.includes = plugin.xml,\ - plugin.properties,\ - about.html,\ - .,\ - META-INF/,\ - .options -src.includes = .options,\ - about.html -javadoc.packages = org.eclipse.cdt.debug.mi.core.*,\ - org.eclipse.cdt.debug.mi.core.cdi.*,\ - org.eclipse.cdt.debug.mi.core.command.*,\ - org.eclipse.cdt.debug.mi.core.event.*,\ - org.eclipse.cdt.debug.mi.core.output.* -source.. = cdi/,\ - mi/,\ - src/ diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointHit.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointHit.java deleted file mode 100644 index d4791c48007..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointHit.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi; - -import org.eclipse.cdt.debug.core.cdi.ICDIBreakpointHit; -import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint; -import org.eclipse.cdt.debug.mi.core.cdi.model.Breakpoint; -import org.eclipse.cdt.debug.mi.core.event.MIBreakpointHitEvent; - -/** - */ -public class BreakpointHit extends SessionObject implements ICDIBreakpointHit { - - MIBreakpointHitEvent breakEvent; - - public BreakpointHit(Session session, MIBreakpointHitEvent e) { - super(session); - breakEvent = e; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointHit#getBreakpoint() - */ - @Override - public ICDIBreakpoint getBreakpoint() { - int number = breakEvent.getNumber(); - // Ask the breakpointManager for the breakpoint - BreakpointManager mgr = ((Session)getSession()).getBreakpointManager(); - // We need to return the same object as the breakpoint. - Breakpoint point = mgr.getBreakpoint(breakEvent.getMISession(), number); - // FIXME: if point == null ?? Create a new breakpoint ?? - return point; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java deleted file mode 100644 index 86104fe7c8a..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java +++ /dev/null @@ -1,1152 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - * Anton Leherbauer (Wind River Systems) - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi; - -import java.io.File; -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.ICDIAddressLocation; -import org.eclipse.cdt.debug.core.cdi.ICDICondition; -import org.eclipse.cdt.debug.core.cdi.ICDIFunctionLocation; -import org.eclipse.cdt.debug.core.cdi.ICDILineLocation; -import org.eclipse.cdt.debug.core.cdi.ICDILocator; -import org.eclipse.cdt.debug.core.cdi.model.ICDIAddressBreakpoint; -import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint; -import org.eclipse.cdt.debug.core.cdi.model.ICDIEventBreakpoint; -import org.eclipse.cdt.debug.core.cdi.model.ICDIExceptionpoint; -import org.eclipse.cdt.debug.core.cdi.model.ICDIFunctionBreakpoint; -import org.eclipse.cdt.debug.core.cdi.model.ICDILineBreakpoint; -import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; -import org.eclipse.cdt.debug.core.cdi.model.ICDIWatchpoint; -import org.eclipse.cdt.debug.core.model.ICBreakpointType; -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.MIFormat; -import org.eclipse.cdt.debug.mi.core.MIPlugin; -import org.eclipse.cdt.debug.mi.core.MISession; -import org.eclipse.cdt.debug.mi.core.cdi.model.AddressBreakpoint; -import org.eclipse.cdt.debug.mi.core.cdi.model.AddressLocation; -import org.eclipse.cdt.debug.mi.core.cdi.model.Breakpoint; -import org.eclipse.cdt.debug.mi.core.cdi.model.EventBreakpoint; -import org.eclipse.cdt.debug.mi.core.cdi.model.Exceptionpoint; -import org.eclipse.cdt.debug.mi.core.cdi.model.FunctionBreakpoint; -import org.eclipse.cdt.debug.mi.core.cdi.model.FunctionLocation; -import org.eclipse.cdt.debug.mi.core.cdi.model.LineBreakpoint; -import org.eclipse.cdt.debug.mi.core.cdi.model.LocationBreakpoint; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; -import org.eclipse.cdt.debug.mi.core.cdi.model.Watchpoint; -import org.eclipse.cdt.debug.mi.core.command.CLICatch; -import org.eclipse.cdt.debug.mi.core.command.CommandFactory; -import org.eclipse.cdt.debug.mi.core.command.MIBreakAfter; -import org.eclipse.cdt.debug.mi.core.command.MIBreakCondition; -import org.eclipse.cdt.debug.mi.core.command.MIBreakDelete; -import org.eclipse.cdt.debug.mi.core.command.MIBreakDisable; -import org.eclipse.cdt.debug.mi.core.command.MIBreakEnable; -import org.eclipse.cdt.debug.mi.core.command.MIBreakInsert; -import org.eclipse.cdt.debug.mi.core.command.MIBreakList; -import org.eclipse.cdt.debug.mi.core.command.MIBreakWatch; -import org.eclipse.cdt.debug.mi.core.command.MIGDBSetBreakpointPending; -import org.eclipse.cdt.debug.mi.core.event.MIBreakpointChangedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIBreakpointCreatedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIBreakpointDeletedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIEvent; -import org.eclipse.cdt.debug.mi.core.output.CLICatchInfo; -import org.eclipse.cdt.debug.mi.core.output.MIBreakInsertInfo; -import org.eclipse.cdt.debug.mi.core.output.MIBreakListInfo; -import org.eclipse.cdt.debug.mi.core.output.MIBreakWatchInfo; -import org.eclipse.cdt.debug.mi.core.output.MIBreakpoint; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; - -/** - * Breakpoint Manager for the CDI interface. - */ -public class BreakpointManager extends Manager { - - public static ICDIBreakpoint[] EMPTY_BREAKPOINTS = {}; - - Map breakMap; - Map deferredMap; - boolean allowInterrupt; - - public BreakpointManager(Session session) { - super(session, false); - breakMap = Collections.synchronizedMap(new HashMap()); - deferredMap = Collections.synchronizedMap(new HashMap()); - allowInterrupt = true; - } - - synchronized List getBreakpointsList(ICDITarget target) { - List bList = (List)breakMap.get(target); - if (bList == null) { - bList = Collections.synchronizedList(new ArrayList()); - breakMap.put(target, bList); - } - return bList; - } - - MIBreakpoint[] getAllMIBreakpoints(MISession miSession) throws CDIException { - CommandFactory factory = miSession.getCommandFactory(); - MIBreakList breakpointList = factory.createMIBreakList(); - try { - miSession.postCommand(breakpointList); - MIBreakListInfo info = breakpointList.getMIBreakListInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - return info.getMIBreakpoints(); - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - - boolean hasBreakpointChanged(MIBreakpoint miBreak, MIBreakpoint miBreakpoint) { - return miBreak.isEnabled() != miBreakpoint.isEnabled() || - !miBreak.getCondition().equals(miBreakpoint.getCondition()) || - miBreak.getIgnoreCount() != miBreakpoint.getIgnoreCount(); - } - - public Watchpoint getWatchpoint(MISession miSession, int number) { - return (Watchpoint)getBreakpoint(miSession, number); - } - - public Breakpoint getBreakpoint(MISession miSession, int number) { - Session session = (Session)getSession(); - Target target = session.getTarget(miSession); - if (target != null) { - return getBreakpoint(target, number); - } - return null; - } - - public Breakpoint getBreakpoint(Target target, int number) { - List bList = (List)breakMap.get(target); - if (bList != null) { - Breakpoint[] bkpts = (Breakpoint[]) bList.toArray(new Breakpoint[0]); - for (int i = 0; i < bkpts.length; i++) { - MIBreakpoint[] miBreakpoints = bkpts[i].getMIBreakpoints(); - for (int j = 0; j < miBreakpoints.length; j++) { - if (miBreakpoints[j].getNumber() == number) { - return bkpts[i]; - } - } - } - } - return null; - } - - boolean suspendInferior(Target target) throws CDIException { - boolean shouldRestart = false; - // Stop the program - if (allowInterrupt && target.isRunning()) { - // Disable events. - ((EventManager) getSession().getEventManager()).allowProcessingEvents(false); - target.suspend(); - shouldRestart = true; - } - return shouldRestart; - } - - void resumeInferior(Target target, boolean shouldRestart) throws CDIException { - ((EventManager) getSession().getEventManager()).allowProcessingEvents(true); - if (shouldRestart) { - target.resume(); - } - } - - public void deleteBreakpoint(MISession miSession, int no) { - Session session = (Session)getSession(); - Target target = session.getTarget(miSession); - if (target != null) { - deleteBreakpoint(target, no); - } - } - - /** - * Use in the event classes, the breakpoint is not remove from the list - * It is only done in DestroyedEvent class. Since we need to keep the breakpoint - * type around. - * @param target - * @param no - */ - void deleteBreakpoint (Target target, int no) { - List bList = (List)breakMap.get(target); - if (bList != null) { - Breakpoint[] points = (Breakpoint[]) bList.toArray(new Breakpoint[0]); - for (int i = 0; i < points.length; i++) { - MIBreakpoint[] miBreakpoints = points[i].getMIBreakpoints(); - for (int j = 0; j < miBreakpoints.length; j++) { - if (miBreakpoints[j].getNumber() == no) { - bList.remove(points[i]); - break; - } - } - } - } - } - - /** - * Call through the Breakpoint class Breakpoint.setEnabled(boolean) - * - * @param breakpoint - * @throws CDIException - */ - public void enableBreakpoint(Breakpoint breakpoint) throws CDIException { - Target target = (Target)breakpoint.getTarget(); - - // Check if the breakpoint is in the deffered list - List dList = (List)deferredMap.get(target); - if (dList != null) { - if (dList.contains(breakpoint)) { - breakpoint.setEnabled0(true); - return; // bail out here, our work is done. - } - } - - List bList = (List)breakMap.get(target); - if (bList == null) { - throw new CDIException(CdiResources.getString("cdi.BreakpointManager.Not_a_CDT_breakpoint")); //$NON-NLS-1$ - } - if (!bList.contains(breakpoint)) { - throw new CDIException(CdiResources.getString("cdi.BreakpointManager.Not_a_CDT_breakpoint")); //$NON-NLS-1$ - } - MIBreakpoint[] miBreakpoints = breakpoint.getMIBreakpoints(); - if (miBreakpoints == null || miBreakpoints.length == 0) { - throw new CDIException(CdiResources.getString("cdi.BreakpointManager.Not_a_CDT_breakpoint")); //$NON-NLS-1$ - } - - int[] numbers = new int[miBreakpoints.length]; - for (int i = 0; i < miBreakpoints.length; i++) { - numbers[i] = miBreakpoints[i].getNumber(); - } - - boolean restart = false; - MISession miSession = target.getMISession(); - CommandFactory factory = miSession.getCommandFactory(); - MIBreakEnable breakEnable = factory.createMIBreakEnable(numbers); - try { - restart = suspendInferior(target); - miSession.postCommand(breakEnable); - MIInfo info = breakEnable.getMIInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - for (int i = 0; i < miBreakpoints.length; i++) { - miBreakpoints[i].setEnabled(true); - } - breakpoint.setEnabled0(true); - } catch (MIException e) { - throw new MI2CDIException(e); - } finally { - try { - // Resume the program and enable events. - resumeInferior(target, restart); - } finally { - // Fire a changed Event. - miSession.fireEvent(new MIBreakpointChangedEvent(miSession, numbers[0])); - } - } - - - } - - /** - * Call through the Breakpoint class. Breakpoint.disable - * - * @param breakpoint - * @throws CDIException - */ - public void disableBreakpoint(Breakpoint breakpoint) throws CDIException { - Target target = (Target)breakpoint.getTarget(); - - // Check if the breakpoint is in the deffered list - List dList = (List)deferredMap.get(target); - if (dList != null) { - if (dList.contains(breakpoint)) { - breakpoint.setEnabled0(false); - return; // bail out here, our work is done. - } - } - - List bList = (List)breakMap.get(target); - if (bList == null) { - throw new CDIException(CdiResources.getString("cdi.BreakpointManager.Not_a_CDT_breakpoint")); //$NON-NLS-1$ - } - if (!bList.contains(breakpoint)) { - throw new CDIException(CdiResources.getString("cdi.BreakpointManager.Not_a_CDT_breakpoint")); //$NON-NLS-1$ - } - - MIBreakpoint[] miBreakpoints = breakpoint.getMIBreakpoints(); - if (miBreakpoints == null || miBreakpoints.length == 0) { - throw new CDIException(CdiResources.getString("cdi.BreakpointManager.Not_a_CDT_breakpoint")); //$NON-NLS-1$ - } - int[] numbers = new int[miBreakpoints.length]; - for (int i = 0; i < miBreakpoints.length; i++) { - numbers[i] = miBreakpoints[i].getNumber(); - } - - boolean restart = false; - MISession miSession = target.getMISession(); - CommandFactory factory = miSession.getCommandFactory(); - MIBreakDisable breakDisable = factory.createMIBreakDisable(numbers); - try { - restart = suspendInferior(target); - miSession.postCommand(breakDisable); - MIInfo info = breakDisable.getMIInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - for (int i = 0; i < miBreakpoints.length; i++) { - miBreakpoints[i].setEnabled(false); - } - breakpoint.setEnabled0(false); - } catch (MIException e) { - throw new MI2CDIException(e); - } finally { - try { - resumeInferior(target, restart); - } finally { - // Fire a changed Event. - miSession.fireEvent(new MIBreakpointChangedEvent(miSession, numbers[0])); - } - } - } - - /** - * Use by the Breakpoint class, Breakpoint.setCondition(Condition cond) - * In this case we will not try to change the condition with -break-condition. - * Since condition may contains new thread-id it is simpler to remove the breakpoints - * and make a new breakpoints with the new conditions. - * @param breakpoint - * @param newCondition - * @throws CDIException - */ - public void setCondition(Breakpoint breakpoint, ICDICondition newCondition) throws CDIException { - Target target = (Target)breakpoint.getTarget(); - - // Check if the breakpoint is in the deffered list - List dList = (List)deferredMap.get(target); - if (dList != null) { - if (dList.contains(breakpoint)) { - breakpoint.setCondition0(newCondition); - return; // bail out here, our work is done. - } - } - - List bList = (List)breakMap.get(target); - if (bList == null) { - throw new CDIException(CdiResources.getString("cdi.BreakpointManager.Not_a_CDT_breakpoint")); //$NON-NLS-1$ - } - if (!bList.contains(breakpoint)) { - throw new CDIException(CdiResources.getString("cdi.BreakpointManager.Not_a_CDT_breakpoint")); //$NON-NLS-1$ - } - - MIBreakpoint[] miBreakpoints = breakpoint.getMIBreakpoints(); - deleteMIBreakpoints(target, miBreakpoints); - ICDICondition oldCondition = breakpoint.getCondition(); - boolean success = false; - try { - breakpoint.setCondition0(newCondition); - if (breakpoint instanceof LocationBreakpoint) { - setLocationBreakpoint((LocationBreakpoint)breakpoint); - } else if (breakpoint instanceof Watchpoint) { - setWatchpoint((Watchpoint)breakpoint, false); - } else { - throw new CDIException(CdiResources.getString("cdi.BreakpointManager.Not_a_CDT_breakpoint")); //$NON-NLS-1$ - } - success = true; - } finally { - if (!success) { - breakpoint.setCondition0(oldCondition); - if (breakpoint instanceof LocationBreakpoint) { - setLocationBreakpoint((LocationBreakpoint)breakpoint); - } else if (breakpoint instanceof Watchpoint) { - setWatchpoint((Watchpoint)breakpoint, false); - } - } - } - - // Fire a changed Event. - miBreakpoints = breakpoint.getMIBreakpoints(); - if (miBreakpoints != null && miBreakpoints.length > 0) { - MISession miSession = target.getMISession(); - miSession.fireEvent(new MIBreakpointChangedEvent(miSession, miBreakpoints[0].getNumber())); - } - } - - @Override - public void update(Target target) throws CDIException { - update(target, null); - } - - /** - * Pass the event that causes this update - * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=135250 - */ - public void update(Target target, MIEvent event) throws CDIException { - MISession miSession = target.getMISession(); - MIBreakpoint[] allMIBreakpoints = getAllMIBreakpoints(miSession); - List bList = getBreakpointsList(target); - List eventList = new ArrayList(allMIBreakpoints.length); - for (int i = 0; i < allMIBreakpoints.length; i++) { - MIBreakpoint miBreakpoint = allMIBreakpoints[i]; - int no = miBreakpoint.getNumber(); - Breakpoint bp = getBreakpoint(target, no); - if (bp != null) { - MIBreakpoint[] miBps = bp.getMIBreakpoints(); - for (int j = 0; j < miBps.length; j++) { - if (miBps[j].getNumber() == no) { - if (hasBreakpointChanged(miBps[j], miBreakpoint)) { - miBps[j] = miBreakpoint; - bp.setEnabled0(miBreakpoint.isEnabled()); - // FIXME: We have a problem if the thread id change. - ICDICondition oldCond = bp.getCondition(); - String[] tids = oldCond.getThreadIds(); - Condition newCondition = new Condition(miBreakpoint.getIgnoreCount(), - miBreakpoint.getCondition(), tids); - bp.setCondition0(newCondition); - // Fire ChangedEvent - eventList.add(new MIBreakpointChangedEvent(miSession, no)); - } - } - } - } else { - // add the new breakpoint and fire CreatedEvent - int type = ICBreakpointType.REGULAR; - if (miBreakpoint.isHardware()) { - type = ICBreakpointType.HARDWARE; - } else if (miBreakpoint.isTemporary()) { - type = ICBreakpointType.TEMPORARY; - } - String[] tids = null; - String tid = miBreakpoint.getThreadId(); - if (tid != null && tid.length() > 0) { - tids = new String[] { tid }; - } - Condition condition = new Condition(miBreakpoint.getIgnoreCount(), - miBreakpoint.getCondition(), tids); - - if (miBreakpoint.isWatchpoint()) { - int watchType = 0; - if (miBreakpoint.isAccessWatchpoint() || miBreakpoint.isReadWatchpoint()) { - watchType |= ICDIWatchpoint.READ; - } - if (miBreakpoint.isAccessWatchpoint() || miBreakpoint.isWriteWatchpoint()) { - watchType |= ICDIWatchpoint.WRITE; - } - Watchpoint wpoint = new Watchpoint(target, miBreakpoint.getWhat(), type, watchType, condition, miBreakpoint.isEnabled()); - wpoint.setMIBreakpoints(new MIBreakpoint[] {miBreakpoint}); - bList.add(wpoint); - } else { - int hint = MIBreakpointChangedEvent.HINT_NONE; - if (event instanceof MIBreakpointChangedEvent) { - hint = ((MIBreakpointChangedEvent)event).getHint(); - } - String function = miBreakpoint.getFunction(); - String file = miBreakpoint.getFile(); - int line = miBreakpoint.getLine(); - String addr = miBreakpoint.getAddress(); - boolean enabled = miBreakpoint.isEnabled(); - - Breakpoint newBreakpoint = null; - if (hint == MIBreakpointChangedEvent.HINT_NEW_LINE_BREAKPOINT || - (hint == MIBreakpointChangedEvent.HINT_NONE && file != null && file.length() > 0 && line > 0)) { - LineLocation location = createLineLocation (miBreakpoint.getFile(), - miBreakpoint.getLine()); - newBreakpoint = new LineBreakpoint(target, type, location, condition, enabled); - } else if ((hint == MIBreakpointChangedEvent.HINT_NEW_FUNCTION_BREAKPOINT || - hint == MIBreakpointChangedEvent.HINT_NONE) && function != null && function.length() > 0) { - FunctionLocation location = createFunctionLocation(file, function); - newBreakpoint = new FunctionBreakpoint(target, type, location, condition, enabled); - } else if (hint == MIBreakpointChangedEvent.HINT_NEW_EVENTBREAKPOINT || EventBreakpoint.getEventTypeFromMI(miBreakpoint)!=null) { - String ctype = EventBreakpoint.getEventTypeFromMI(miBreakpoint); - if (ctype != null) { - newBreakpoint = new EventBreakpoint(target, ctype, EventBreakpoint - .getEventArgumentFromMI(miBreakpoint), condition, enabled); - } else { - MIPlugin.log("Unsupported event breakpoint: "+miBreakpoint.getWhat()); //$NON-NLS-1$ log entry not for users - } - } else if (addr != null && addr.length() > 0) { - BigInteger big = MIFormat.getBigInteger(addr); - AddressLocation location = createAddressLocation(big); - newBreakpoint = new AddressBreakpoint(target, type, location, condition, - enabled); - } - if (newBreakpoint != null) { - newBreakpoint.setMIBreakpoints(new MIBreakpoint[] { miBreakpoint }); - bList.add(newBreakpoint); - } - } - eventList.add(new MIBreakpointCreatedEvent(miSession, no)); - } - } - // Check if any breakpoint was removed. - Breakpoint[] oldBreakpoints = (Breakpoint[]) bList.toArray(new Breakpoint[0]); - for (int i = 0; i < oldBreakpoints.length; i++) { - boolean found = false; - MIBreakpoint[] miBreakpoints = oldBreakpoints[i].getMIBreakpoints(); - for (int j = 0; j < miBreakpoints.length; j++) { - int no = miBreakpoints[j].getNumber(); - for (int k = 0; k < allMIBreakpoints.length; k++) { - if (no == allMIBreakpoints[k].getNumber()) { - found = true; - break; - } - } - if (!found) { - // Fire destroyed Events. - eventList.add(new MIBreakpointDeletedEvent(miSession, no)); - } - } - } - MIEvent[] events = (MIEvent[])eventList.toArray(new MIEvent[0]); - miSession.fireEvents(events); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#allowProgramInterruption() - */ - public void allowProgramInterruption(boolean e) { - allowInterrupt = e; - } - - public void deleteFromDeferredList(Breakpoint bkpt) { - List dList = (List)deferredMap.get(bkpt.getTarget()); - if (dList != null) { - dList.remove(bkpt); - } - } - - /** - * Use by the EventManager when checking for deferred breapoints. - * @param bkpt - */ - public void addToBreakpointList(Breakpoint bkpt) { - List bList = getBreakpointsList(bkpt.getTarget()); - bList.add(bkpt); - } - - public void deleteAllBreakpoints(Target target) throws CDIException { - List bList = (List)breakMap.get(target); - if (bList != null) { - ICDIBreakpoint[] bps = new ICDIBreakpoint[bList.size()]; - bList.toArray(bps); - deleteBreakpoints(target, bps); - } - } - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#deleteBreakpoint(ICDIBreakpoint) - */ - public void deleteBreakpoint(ICDIBreakpoint breakpoint) throws CDIException { - deleteBreakpoints((Target)breakpoint.getTarget(), new ICDIBreakpoint[] { breakpoint }); - } - - public void deleteBreakpoints(Target target, ICDIBreakpoint[] breakpoints) throws CDIException { - List bList = (List)breakMap.get(target); - List dList = (List)deferredMap.get(target); - - // Do the sanity check first, we will accept all or none - if (bList == null) { - throw new CDIException(CdiResources.getString("cdi.BreakpointManager.Not_a_CDT_breakpoint")); //$NON-NLS-1$ - } - for (int i = 0; i < breakpoints.length; i++) { - if (!(breakpoints[i] instanceof Breakpoint && (bList.contains(breakpoints[i]) || (dList != null && dList.contains(breakpoints[i]))))) { - throw new CDIException(CdiResources.getString("cdi.BreakpointManager.Not_a_CDT_breakpoint")); //$NON-NLS-1$ - } - } - - MISession miSession = target.getMISession(); - List eventList = new ArrayList(breakpoints.length); - for (int i = 0; i < breakpoints.length; i++) { - if (!(dList != null && dList.remove(breakpoints[i]))) { - MIBreakpoint[] miBreakpoints = ((Breakpoint)breakpoints[i]).getMIBreakpoints(); - if (miBreakpoints.length > 0) { - deleteMIBreakpoints(target, miBreakpoints); - eventList.add(new MIBreakpointDeletedEvent(miSession, miBreakpoints[0].getNumber())); - } - } - } - MIEvent[] events = (MIEvent[])eventList.toArray(new MIEvent[0]); - miSession.fireEvents(events); - } - - void deleteMIBreakpoints(Target target, MIBreakpoint[] miBreakpoints) throws CDIException { - MISession miSession = target.getMISession(); - int[] numbers = new int[miBreakpoints.length]; - for (int i = 0; i < miBreakpoints.length; ++i) { - numbers[i] = miBreakpoints[i].getNumber(); - } - boolean restart = false; - try { - restart = suspendInferior(target); - deleteMIBreakpoints(miSession, numbers); - } finally { - resumeInferior(target, restart); - } - } - - void deleteMIBreakpoints(MISession miSession, int[] numbers) throws CDIException { - CommandFactory factory = miSession.getCommandFactory(); - MIBreakDelete breakDelete = factory.createMIBreakDelete(numbers); - try { - miSession.postCommand(breakDelete); - MIInfo info = breakDelete.getMIInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - - public ICDIBreakpoint[] getBreakpoints(Target target) throws CDIException { - List list = (List)breakMap.get(target); - if (list != null) { - ICDIBreakpoint[] bps = new ICDIBreakpoint[list.size()]; - list.toArray(bps); - return bps; - } - return EMPTY_BREAKPOINTS; - } - - public ICDIBreakpoint[] getDeferredBreakpoints(Target target) throws CDIException { - List dlist = (List)deferredMap.get(target); - if (dlist != null) { - ICDIBreakpoint[] bps = new ICDIBreakpoint[dlist.size()]; - dlist.toArray(bps); - return bps; - } - return EMPTY_BREAKPOINTS; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpointManagement#setLineBreakpoint(int, org.eclipse.cdt.debug.core.cdi.ICDILineLocation, org.eclipse.cdt.debug.core.cdi.ICDICondition, boolean) - */ - public ICDILineBreakpoint setLineBreakpoint(Target target, int type, ICDILineLocation location, - ICDICondition condition, boolean deferred, boolean enabled) throws CDIException { - LineBreakpoint bkpt = new LineBreakpoint(target, type, location, condition, enabled); - setNewLocationBreakpoint(bkpt, deferred); - return bkpt; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpointManagement#setFunctionBreakpoint(int, org.eclipse.cdt.debug.core.cdi.ICDIFunctionLocation, org.eclipse.cdt.debug.core.cdi.ICDICondition, boolean) - */ - public ICDIFunctionBreakpoint setFunctionBreakpoint(Target target, int type, ICDIFunctionLocation location, - ICDICondition condition, boolean deferred, boolean enabled) throws CDIException { - FunctionBreakpoint bkpt = new FunctionBreakpoint(target, type, location, condition, enabled); - setNewLocationBreakpoint(bkpt, deferred); - return bkpt; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpointManagement#setAddressBreakpoint(int, org.eclipse.cdt.debug.core.cdi.ICDIAddressLocation, org.eclipse.cdt.debug.core.cdi.ICDICondition, boolean) - */ - public ICDIAddressBreakpoint setAddressBreakpoint(Target target, int type, ICDIAddressLocation location, - ICDICondition condition, boolean deferred, boolean enabled) throws CDIException { - AddressBreakpoint bkpt = new AddressBreakpoint(target, type, location, condition, enabled); - setNewLocationBreakpoint(bkpt, deferred); - return bkpt; - } - - - protected void setNewLocationBreakpoint(LocationBreakpoint bkpt, boolean deferred) throws CDIException { - Target target = (Target)bkpt.getTarget(); - MISession miSession = target.getMISession(); - try { - setLocationBreakpoint(bkpt); - List blist = getBreakpointsList(target); - blist.add(bkpt); - - // Fire a created Event. - MIBreakpoint[] miBreakpoints = bkpt.getMIBreakpoints(); - if (miBreakpoints != null && miBreakpoints.length > 0) { - miSession.fireEvent(new MIBreakpointCreatedEvent(miSession, miBreakpoints[0].getNumber())); - } - } catch (CDIException e) { - if (!deferred) { - throw e; - } - Session session = (Session)target.getSession(); - SharedLibraryManager sharedMgr = session.getSharedLibraryManager(); - if (sharedMgr.isDeferredBreakpoint(target)) { - addDeferredBreakpoint(bkpt); - } else { - throw e; - } - } - } - - private void addDeferredBreakpoint(Breakpoint breakpoint) { - Target target = (Target)breakpoint.getTarget(); - List dList = (List)deferredMap.get(target); - if (dList == null) { - dList = Collections.synchronizedList(new ArrayList()); - deferredMap.put(target, dList); - } - dList.add(breakpoint); - } - - public void setLocationBreakpoint (LocationBreakpoint bkpt) throws CDIException { - Target target = (Target)bkpt.getTarget(); - MISession miSession = target.getMISession(); - MIBreakInsert[] breakInserts = createMIBreakInsert(bkpt, miSession.isBreakpointsWithFullName()); - List pointList = new ArrayList(); - boolean restart = false; - try { - restart = suspendInferior(target); - CommandFactory factory = miSession.getCommandFactory(); - boolean enable = bkpt.isEnabled(); - for (int i = 0; i < breakInserts.length; i++) { - miSession.postCommand(breakInserts[i]); - MIBreakInsertInfo info = breakInserts[i].getMIBreakInsertInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - MIBreakpoint[] points = info.getMIBreakpoints(); - if (points == null || points.length == 0) { - throw new CDIException(CdiResources.getString("cdi.BreakpointManager.Parsing_Error")); //$NON-NLS-1$ - } - // Set - if (bkpt.getFile() != null && bkpt.getFile().length() > 0) - { - for (int j = 0; j < points.length; j++) { - points[j].setFile(bkpt.getFile()); - } - } - if (bkpt.getLineNumber()>0) { - for (int j = 0; j < points.length; j++) { - if (points[j].getLine() == 0) - points[j].setLine(bkpt.getLineNumber()); - } - } - // Make sure that if the breakpoint was disable we create them disable. - if (!enable) { - int[] numbers = new int[points.length]; - for (int j = 0; j < points.length; j++) { - numbers[j] = points[j].getNumber(); - } - MIBreakDisable breakDisable = factory.createMIBreakDisable(numbers); - try { - miSession.postCommand(breakDisable); - MIInfo disableInfo = breakDisable.getMIInfo(); - if (disableInfo == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - - pointList.addAll(Arrays.asList(points)); - } - } catch (MIException e) { - try { - // Things did not go well remove all the breakpoints we've set before. - MIBreakpoint[] allPoints = (MIBreakpoint[]) pointList.toArray(new MIBreakpoint[pointList.size()]); - if (allPoints != null && allPoints.length > 0) { - deleteMIBreakpoints(target, allPoints); - } - } catch (CDIException cdie) { - // ignore this one; - } - throw new MI2CDIException(e); - } finally { - resumeInferior(target, restart); - } - MIBreakpoint[] allPoints = (MIBreakpoint[]) pointList.toArray(new MIBreakpoint[pointList.size()]); - bkpt.setMIBreakpoints(allPoints); - } - - public void setWatchpoint(Watchpoint bkpt) throws CDIException { - setWatchpoint(bkpt, true); - } - - private void setWatchpoint(Watchpoint watchpoint, boolean isNew) throws CDIException { - Target target = (Target)watchpoint.getTarget(); - boolean access = watchpoint.isReadType() && watchpoint.isWriteType(); - boolean read = ! watchpoint.isWriteType() && watchpoint.isReadType(); - String expression = watchpoint.getDerivedExpression(); - boolean enable = watchpoint.isEnabled(); - - MISession miSession = target.getMISession(); - CommandFactory factory = miSession.getCommandFactory(); - MIBreakWatch breakWatch = - factory.createMIBreakWatch(access, read, expression); - MIBreakpoint[] points = null; - boolean restart = false; - try { - restart = suspendInferior(target); - miSession.postCommand(breakWatch); - MIBreakWatchInfo winfo = breakWatch.getMIBreakWatchInfo(); - if (winfo == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - points = winfo.getMIBreakpoints(); - if (points == null || points.length == 0) { - throw new CDIException(CdiResources.getString("cdi.BreakpointManager.Parsing_Error")); //$NON-NLS-1$ - } - - int no = points[0].getNumber(); - - // Put the condition now. - String exprCond = null; - int ignoreCount = 0; - - ICDICondition condition = watchpoint.getCondition(); - if (condition != null) { - exprCond = condition.getExpression(); - ignoreCount = condition.getIgnoreCount(); - } - if (exprCond != null && exprCond.length() > 0) { - MIBreakCondition breakCondition = factory.createMIBreakCondition(no, exprCond); - miSession.postCommand(breakCondition); - MIInfo info = breakCondition.getMIInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - } - if (ignoreCount > 0) { - MIBreakAfter breakAfter = factory.createMIBreakAfter(no, ignoreCount); - miSession.postCommand(breakAfter); - MIInfo info = breakAfter.getMIInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - } - if (!enable) { - int[] numbers = new int[1]; - numbers[0] = no; - MIBreakDisable breakDisable = factory.createMIBreakDisable(numbers); - try { - miSession.postCommand(breakDisable); - MIInfo disableInfo = breakDisable.getMIInfo(); - if (disableInfo == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - // how to deal with threads ??? - } catch (MIException e) { - throw new MI2CDIException(e); - } finally { - resumeInferior(target, restart); - } - watchpoint.setMIBreakpoints(points); - - if (isNew) { - List bList = getBreakpointsList(target); - bList.add(watchpoint); - - // Fire a created Event. - MIBreakpoint[] miBreakpoints = watchpoint.getMIBreakpoints(); - if (miBreakpoints != null && miBreakpoints.length > 0) { - miSession.fireEvent(new MIBreakpointCreatedEvent(miSession, miBreakpoints[0].getNumber())); - } - } - } - - Breakpoint[] exceptionBps = new Breakpoint[2]; - final int EXCEPTION_THROW_IDX = 0; - final int EXCEPTION_CATCH_IDX = 1; - final static String[] EXCEPTION_FUNCS = new String[] {"__cxa_throw", "__cxa_begin_catch"}; //$NON-NLS-1$ //$NON-NLS-2$ - - - public ICDIExceptionpoint setExceptionpoint(Target target, String clazz, boolean stopOnThrow, - boolean stopOnCatch, boolean enabled) throws CDIException { - - if (!stopOnThrow && !stopOnCatch) { - throw new CDIException("Must suspend on throw or catch"); //$NON-NLS-1$ - } - - MIBreakpoint[] miBreakpoints = null; - - if (stopOnThrow) { - synchronized(exceptionBps) { - int id = EXCEPTION_THROW_IDX; - if (exceptionBps[EXCEPTION_THROW_IDX] == null) { - FunctionLocation location = new FunctionLocation(null, EXCEPTION_FUNCS[id]); - FunctionBreakpoint bp = new FunctionBreakpoint(target, ICBreakpointType.REGULAR, location, null, enabled); - setLocationBreakpoint(bp); - exceptionBps[id] = bp; - miBreakpoints = bp.getMIBreakpoints(); - } - } - } - if (stopOnCatch) { - synchronized(exceptionBps) { - int id = EXCEPTION_THROW_IDX; - if (exceptionBps[id] == null) { - FunctionLocation location = new FunctionLocation(null, EXCEPTION_FUNCS[id]); - FunctionBreakpoint bp = new FunctionBreakpoint(target, ICBreakpointType.REGULAR, location, null, enabled); - setLocationBreakpoint(bp); - exceptionBps[id] = bp; - if (miBreakpoints != null) { - MIBreakpoint[] mibp = bp.getMIBreakpoints(); - MIBreakpoint[] temp = new MIBreakpoint[miBreakpoints.length + mibp.length]; - System.arraycopy(miBreakpoints, 0, temp, 0, miBreakpoints.length); - System.arraycopy(mibp, 0, temp, miBreakpoints.length, mibp.length); - } else { - miBreakpoints = bp.getMIBreakpoints(); - } - } - } - } - - Exceptionpoint excp = new Exceptionpoint(target, clazz, stopOnThrow, stopOnCatch, null, enabled); - if (miBreakpoints != null && miBreakpoints.length > 0) { - excp.setMIBreakpoints(miBreakpoints); - List blist = getBreakpointsList(target); - blist.add(excp); - - // Fire a created Event. - MISession miSession = target.getMISession(); - miSession.fireEvent(new MIBreakpointCreatedEvent(miSession, miBreakpoints[0].getNumber())); - } - return excp; - } - - /** - * Call -gdb-set breakpoint pending set - * @param target - * @param set - * @throws CDIException - */ - public void setBreakpointPending(Target target, boolean set) throws CDIException { - MISession miSession = target.getMISession(); - CommandFactory factory = miSession.getCommandFactory(); - MIGDBSetBreakpointPending bpp = factory.createMIGDBSetBreakpointPending(set); - try { - miSession.postCommand(bpp); - MIInfo info = bpp.getMIInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - - public Condition createCondition(int ignoreCount, String expression, String[] tids) { - return new Condition(ignoreCount, expression, tids); - } - - public LineLocation createLineLocation(String file, int line) { - return new LineLocation(file, line); - } - - public FunctionLocation createFunctionLocation(String file, String function) { - return new FunctionLocation(file, function); - } - - public AddressLocation createAddressLocation(BigInteger address) { - return new AddressLocation(address); - } - MIBreakInsert[] createMIBreakInsert(LocationBreakpoint bkpt) throws CDIException { - return createMIBreakInsert(bkpt, false); - } - MIBreakInsert[] createMIBreakInsert(LocationBreakpoint bkpt, boolean fullPath) throws CDIException { - boolean hardware = bkpt.isHardware(); - boolean temporary = bkpt.isTemporary(); - String exprCond = null; - int ignoreCount = 0; - String[] threadIds = null; - StringBuffer line = new StringBuffer(); - - if (bkpt.getCondition() != null) { - ICDICondition condition = bkpt.getCondition(); - exprCond = condition.getExpression(); - ignoreCount = condition.getIgnoreCount(); - threadIds = condition.getThreadIds(); - } - - if (bkpt.getLocator() != null) { - ICDILocator locator = bkpt.getLocator(); - String file = locator.getFile(); - if (file != null) { - if (fullPath==false) { - file = new File(file).getName(); - } - } - String function = locator.getFunction(); - int no = locator.getLineNumber(); - if (bkpt instanceof LineBreakpoint) { - if (file != null && file.length() > 0) { - line.append(file).append(':'); - } - line.append(no); - } else if (bkpt instanceof FunctionBreakpoint) { - if (function != null && function.length() > 0) { - // if the function contains :: assume the user - // knows the exact funciton - int colon = function.indexOf("::"); //$NON-NLS-1$ - if (colon != -1) { - line.append(function); - } else { - if (file != null && file.length() > 0) { - line.append(file).append(':'); - } - // GDB does not seem to accept function arguments when - // we use file name: - // (gdb) break file.c:Test(int) - // Will fail, altought it can accept this - // (gdb) break file.c:main - // so fall back to the line number or - // just the name of the function if lineno is invalid. - int paren = function.indexOf('('); - if (paren != -1) { - if (no <= 0) { - String func = function.substring(0, paren); - line.append(func); - } else { - line.append(no); - } - } else { - line.append(function); - } - } - } else { - // ??? - if (file != null && file.length() > 0) { - line.append(file).append(':'); - } - if (no > 0) { - line.append(no); - } - } - } else if (bkpt instanceof AddressBreakpoint) { - line.append('*').append(locator.getAddress()); - } else { - // ??? - if (file != null && file.length() > 0) { - line.append(file).append(':'); - } - line.append(no); - } - } - - MIBreakInsert[] miBreakInserts; - MISession miSession = ((Target)bkpt.getTarget()).getMISession(); - CommandFactory factory = miSession.getCommandFactory(); - if (threadIds == null || threadIds.length == 0) { - MIBreakInsert bi = factory.createMIBreakInsert(temporary, hardware, exprCond, ignoreCount, line.toString(), 0); - miBreakInserts = new MIBreakInsert[] { bi } ; - } else { - List list = new ArrayList(threadIds.length); - for (int i = 0; i < threadIds.length; i++) { - String threadId = threadIds[i]; - int tid = 0; - if (threadId != null && threadId.length() > 0) { - try { - tid = Integer.parseInt(threadId); - list.add(factory.createMIBreakInsert(temporary, hardware, exprCond, ignoreCount, line.toString(), tid)); - } catch (NumberFormatException e) { - } - } - } - miBreakInserts = (MIBreakInsert[]) list.toArray(new MIBreakInsert[list.size()]); - } - return miBreakInserts; - } - public ICDIEventBreakpoint setEventBreakpoint(Target target, String type, String arg, ICDICondition condition, boolean enabled) throws CDIException { - EventBreakpoint eventBkpt = new EventBreakpoint(target,type,arg,condition,enabled); - setEventBreakpoint(eventBkpt); - return eventBkpt; - } - public void setEventBreakpoint(EventBreakpoint eventBkpt) throws CDIException { - Target target = (Target) eventBkpt.getTarget(); - - MISession miSession = target.getMISession(); - CommandFactory factory = miSession.getCommandFactory(); - CLICatch breakCatch = factory.createCLICatch(eventBkpt.getGdbEvent(), eventBkpt - .getGdbArg()); - - eventBkpt.setMIBreakpoints(new MIBreakpoint[0]); // initialize - boolean restart = false; - try { - restart = suspendInferior(target); - miSession.postCommand(breakCatch); - int no; - try { - CLICatchInfo cinfo = (CLICatchInfo) breakCatch.getMIInfo(); - if (cinfo == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - MIBreakpoint[] points = cinfo.getMIBreakpoints(); - if (points == null || points.length == 0) { - throw new CDIException(CdiResources - .getString("cdi.BreakpointManager.Parsing_Error")); //$NON-NLS-1$ - } - no = points[0].getNumber(); - eventBkpt.setMIBreakpoints(points); - } catch (MIException e) { - if (!eventBkpt.isDeferred()) { - throw e; - } - addDeferredBreakpoint(eventBkpt); - return; - } - - // Put the condition now. - String exprCond = null; - int ignoreCount = 0; - - ICDICondition condition = eventBkpt.getCondition(); - if (condition != null) { - exprCond = condition.getExpression(); - ignoreCount = condition.getIgnoreCount(); - } - if (exprCond != null && exprCond.length() > 0) { - MIBreakCondition breakCondition = factory.createMIBreakCondition(no, exprCond); - miSession.postCommand(breakCondition); - MIInfo info = breakCondition.getMIInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - } - if (ignoreCount > 0) { - MIBreakAfter breakAfter = factory.createMIBreakAfter(no, ignoreCount); - miSession.postCommand(breakAfter); - MIInfo info = breakAfter.getMIInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - } - // how to deal with threads ??? - } catch (MIException e) { - throw new MI2CDIException(e); - } finally { - resumeInferior(target, restart); - } - - - - List bList = getBreakpointsList(target); - bList.add(eventBkpt); - - // Fire a created Event. - MIBreakpoint[] miBreakpoints = eventBkpt.getMIBreakpoints(); - if (miBreakpoints != null && miBreakpoints.length > 0) { - miSession.fireEvent(new MIBreakpointCreatedEvent(miSession, miBreakpoints[0] - .getNumber())); - } - - - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/CdiResources.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/CdiResources.java deleted file mode 100644 index 4f53848df86..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/CdiResources.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -/* - * Created on Mar 12, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.cdt.debug.mi.core.cdi; -import java.util.MissingResourceException; -import java.util.ResourceBundle; -/** - * @author twolff - * - * To change the template for this generated type comment go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -public class CdiResources { - private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.mi.core.cdi.CdiResources";//$NON-NLS-1$ - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); - /** - * - */ - private CdiResources() { - // TODO Auto-generated constructor stub - } - /** - * @param key - * @return - */ - public static String getString(String key) { - // TODO Auto-generated method stub - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/CdiResources.properties b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/CdiResources.properties deleted file mode 100644 index 853458e607b..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/CdiResources.properties +++ /dev/null @@ -1,33 +0,0 @@ -############################################################################### -# Copyright (c) 2003, 2009 QNX Software Systems and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# QNX Software Systems - initial API and implementation -# IBM Corporation -############################################################################### - -cdi.Common.No_answer=No answer -cdi.Common.Not_implemented=Not Implemented -cdi.SourceManager.Unknown_type=Unknown type -cdi.RegisterManager.Wrong_register_type=Wrong register type -cdi.BreakpointManager.Not_a_CDT_breakpoint=Not a CDT breakpoint -cdi.BreakpointManager.Not_Supported=Not Supported -cdi.BreakpointManager.Parsing_Error=Parsing Error -cdi.RuntimeOptions.Unable_to_set_args_target_not_responding=Unable to set arguments: target is not responding -cdi.RuntimeOptions.Unable_to_set_args=Unable to set environment: -cdi.RuntimeOptions.Unable_to_set_working_dir=Unable to set working directory: -cdi.Session.Unknown_target=Unkown target -cdi.VariableManager.Unknown_type=Unknown type -cdi.VariableManager.Wrong_variable_type=Wrong variable type -cdi.VariableManager.Unknown_variable_object=Unknown variable object -cdi.model.VariableObject.Target_not_responding=Target is not responding -cdi.model.Target.Unknown_thread=Unknown thread -cdi.model.Target.Target_not_responding=Target is not responding -cdi.model.Target.Cannot_switch_to_thread=Can not switch to thread -cdi.model.Target.Inferior_already_running=Inferior is already running -cdi.model.MemoryBlock.Bad_Offset=Bad Offset -cdi.mode.Target.Bad_location=Bad location diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Condition.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Condition.java deleted file mode 100644 index 4f27c0e1b03..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Condition.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi; - -import org.eclipse.cdt.debug.core.cdi.ICDICondition; - -/** - */ -public class Condition implements ICDICondition { - - int ignoreCount; - String expression; - String[] tids; - - public Condition(int ignore, String exp, String[] ids) { - ignoreCount = ignore; - expression = (exp == null) ? new String() : exp; - tids = (ids == null) ? new String[0] : ids; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDICondition#getIgnoreCount() - */ - @Override - public int getIgnoreCount() { - return ignoreCount; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDICondition#getExpression() - */ - @Override - public String getExpression() { - return expression; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.ICDICondition#getThreadId() - */ - @Override - public String[] getThreadIds() { - return tids; - } - - /* (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(ICDICondition obj) { - if (obj instanceof Condition) { - Condition cond = (Condition)obj; - if (cond.getIgnoreCount() != this.getIgnoreCount()) - return false; - if (cond.getExpression().compareTo(this.getExpression()) != 0) - return false; - if (cond.getThreadIds().length != this.getThreadIds().length) - return false; - for (int i = 0; i < cond.getThreadIds().length; ++i) { - if (cond.getThreadIds()[i].compareTo(this.getThreadIds()[i]) != 0) { - return false; - } - } - return true; - } - return false; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/EndSteppingRange.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/EndSteppingRange.java deleted file mode 100644 index 2c879f69fd5..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/EndSteppingRange.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi; - -import org.eclipse.cdt.debug.core.cdi.ICDIEndSteppingRange; - -/** - */ -public class EndSteppingRange extends SessionObject implements ICDIEndSteppingRange { - - public EndSteppingRange(Session session) { - super(session); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/ErrorInfo.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/ErrorInfo.java deleted file mode 100644 index 25526164303..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/ErrorInfo.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi; - -import org.eclipse.cdt.debug.core.cdi.ICDIErrorInfo; -import org.eclipse.cdt.debug.mi.core.event.MIErrorEvent; - -/** - */ -public class ErrorInfo extends SessionObject implements ICDIErrorInfo { - - MIErrorEvent event; - - public ErrorInfo(Session session, MIErrorEvent e) { - super(session); - event = e; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIErrorInfo#getMessage() - */ - @Override - public String getMessage() { - return event.getMessage(); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIErrorInfo#getDetailMessage() - */ - @Override - public String getDetailMessage() { - return event.getLogMessage(); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/EventBreakpointHit.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/EventBreakpointHit.java deleted file mode 100644 index 60a709b89f0..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/EventBreakpointHit.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2012 Freescale Semiconductor and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Freescale Semiconductor - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi; - -import org.eclipse.cdt.debug.core.cdi.ICDIEventBreakpointHit; - -/** - * @since 7.0 - */ -public class EventBreakpointHit extends SessionObject implements ICDIEventBreakpointHit { - - /** - * See description of eventType param in constructor - */ - private String fEventType; - - /** - * @param session - * @param eventType - * the type of event breakpoint, in descriptive form (rather than - * an ID). E.g., "signal", or "load". These are not standardized, - * and can vary slightly from one gdb version to another, because - * of difference in how catchpoint hits are reported. This string - * should be used solely for display purposes. - */ - public EventBreakpointHit(Session session, String eventType) { - super(session); - assert (eventType != null) && (eventType.length() > 0); - fEventType = eventType; - } - - @Override - public String getEventBreakpointType() { - return fEventType; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java deleted file mode 100644 index 11bdda88bb2..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java +++ /dev/null @@ -1,542 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi; - -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Observable; -import java.util.Observer; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.ICDIEventManager; -import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent; -import org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener; -import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame; -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.MIPlugin; -import org.eclipse.cdt.debug.mi.core.MISession; -import org.eclipse.cdt.debug.mi.core.cdi.event.ChangedEvent; -import org.eclipse.cdt.debug.mi.core.cdi.event.CreatedEvent; -import org.eclipse.cdt.debug.mi.core.cdi.event.DestroyedEvent; -import org.eclipse.cdt.debug.mi.core.cdi.event.DisconnectedEvent; -import org.eclipse.cdt.debug.mi.core.cdi.event.ExitedEvent; -import org.eclipse.cdt.debug.mi.core.cdi.event.MemoryChangedEvent; -import org.eclipse.cdt.debug.mi.core.cdi.event.ResumedEvent; -import org.eclipse.cdt.debug.mi.core.cdi.event.SuspendedEvent; -import org.eclipse.cdt.debug.mi.core.cdi.model.MemoryBlock; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; -import org.eclipse.cdt.debug.mi.core.cdi.model.Thread; -import org.eclipse.cdt.debug.mi.core.command.Command; -import org.eclipse.cdt.debug.mi.core.command.CommandFactory; -import org.eclipse.cdt.debug.mi.core.command.MIExecContinue; -import org.eclipse.cdt.debug.mi.core.command.MIExecFinish; -import org.eclipse.cdt.debug.mi.core.command.MIStackInfoDepth; -import org.eclipse.cdt.debug.mi.core.command.MIStackSelectFrame; -import org.eclipse.cdt.debug.mi.core.command.MIThreadSelect; -import org.eclipse.cdt.debug.mi.core.event.MIBreakpointChangedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIBreakpointCreatedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIBreakpointDeletedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIChangedEvent; -import org.eclipse.cdt.debug.mi.core.event.MICreatedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIDestroyedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIDetachedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIEvent; -import org.eclipse.cdt.debug.mi.core.event.MIGDBExitEvent; -import org.eclipse.cdt.debug.mi.core.event.MIInferiorCreatedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIInferiorExitEvent; -import org.eclipse.cdt.debug.mi.core.event.MIInferiorSignalExitEvent; -import org.eclipse.cdt.debug.mi.core.event.MIMemoryChangedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIMemoryCreatedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIRegisterChangedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIRegisterCreatedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIRunningEvent; -import org.eclipse.cdt.debug.mi.core.event.MISharedLibChangedEvent; -import org.eclipse.cdt.debug.mi.core.event.MISharedLibCreatedEvent; -import org.eclipse.cdt.debug.mi.core.event.MISharedLibEvent; -import org.eclipse.cdt.debug.mi.core.event.MISharedLibUnloadedEvent; -import org.eclipse.cdt.debug.mi.core.event.MISignalChangedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIStoppedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIThreadCreatedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIThreadExitEvent; -import org.eclipse.cdt.debug.mi.core.event.MIVarChangedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIVarCreatedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIVarDeletedEvent; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIStackInfoDepthInfo; - -/** - */ -public class EventManager extends SessionObject implements ICDIEventManager, Observer { - - List list = Collections.synchronizedList(new ArrayList(1)); - MIRunningEvent lastRunningEvent; - Command lastUserCommand = null; - boolean fAllowProcessingEvents = true; - /** - * Process the event from MI, do any state work on the CDI, - * and fire the corresponding CDI event. - */ - @Override - public void update(Observable o, Object arg) { - - MIEvent miEvent = (MIEvent)arg; - Session session = (Session)getSession(); - Target currentTarget = session.getTarget(miEvent.getMISession()); - if (currentTarget == null) { - return; // bailout; this no concern to us. But we should Assert. - } - List cdiList = new ArrayList(1); - - if (miEvent instanceof MIStoppedEvent) { - if (processSuspendedEvent((MIStoppedEvent)miEvent)) { - cdiList.add(new SuspendedEvent(session, miEvent)); - } - } else if (miEvent instanceof MIRunningEvent) { - if (processRunningEvent((MIRunningEvent)miEvent)) - cdiList.add(new ResumedEvent(session, (MIRunningEvent)miEvent)); - } else if (miEvent instanceof MIChangedEvent) { - if (miEvent instanceof MIVarChangedEvent) { - cdiList.add(new ChangedEvent(session, (MIVarChangedEvent)miEvent)); - } else if (miEvent instanceof MIRegisterChangedEvent) { - cdiList.add(new ChangedEvent(session, (MIRegisterChangedEvent)miEvent)); - } else if (miEvent instanceof MIMemoryChangedEvent) { - // We need to fire an event for all the register blocks - // that may contain the modified addresses. - MemoryManager mgr = session.getMemoryManager(); - MemoryBlock[] blocks = mgr.getMemoryBlocks(miEvent.getMISession()); - MIMemoryChangedEvent miMem = (MIMemoryChangedEvent)miEvent; - BigInteger[] addresses = miMem.getAddresses(); - for (int i = 0; i < blocks.length; i++) { - if (blocks[i].contains(addresses) && - (! blocks[i].isFrozen() || blocks[i].isDirty())) { - cdiList.add(new MemoryChangedEvent(session, blocks[i], miMem)); - blocks[i].setDirty(false); - } - } - } else if (miEvent instanceof MIBreakpointChangedEvent) { - MIBreakpointChangedEvent bpoint = (MIBreakpointChangedEvent)miEvent; - if (bpoint.getNumber() > 0) { - cdiList.add(new ChangedEvent(session, bpoint)); - } else { - try { - // Pass the event to access to the event's hint - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=135250 - session.getBreakpointManager().update(currentTarget, miEvent); - } catch (CDIException e) { - } - } - } else if (miEvent instanceof MISharedLibChangedEvent) { - cdiList.add(new ChangedEvent(session, (MISharedLibChangedEvent)miEvent)); - } else if (miEvent instanceof MISignalChangedEvent) { - MISignalChangedEvent sig = (MISignalChangedEvent)miEvent; - String name = sig.getName(); - if (name == null || name.length() == 0) { - // Something change we do not know what - // Let the signal manager handle it with an update(). - try { - SignalManager sMgr = session.getSignalManager(); - sMgr.update(currentTarget); - } catch (CDIException e) { - } - } else { - cdiList.add(new ChangedEvent(session, sig)); - } - } - } else if (miEvent instanceof MIDestroyedEvent) { - if (miEvent instanceof MIThreadExitEvent) { - cdiList.add(new DestroyedEvent(session,(MIThreadExitEvent)miEvent)); - } else if (miEvent instanceof MIInferiorSignalExitEvent) { - cdiList.add(new ExitedEvent(session, (MIInferiorSignalExitEvent)miEvent)); - } else if (miEvent instanceof MIInferiorExitEvent) { - cdiList.add(new ExitedEvent(session, (MIInferiorExitEvent)miEvent)); - } else if (miEvent instanceof MIGDBExitEvent) { - // Remove the target from the list. - Target target = session.getTarget(miEvent.getMISession()); - if (target != null) { - session.removeTargets(new Target[] { target }); - } - cdiList.add(new ExitedEvent(session, (MIGDBExitEvent)miEvent)); - } else if (miEvent instanceof MIDetachedEvent) { - cdiList.add(new DisconnectedEvent(session, (MIDetachedEvent)miEvent)); - } else if (miEvent instanceof MIBreakpointDeletedEvent) { - MIBreakpointDeletedEvent bpoint = (MIBreakpointDeletedEvent)miEvent; - if (bpoint.getNumber() > 0) { - cdiList.add(new DestroyedEvent(session, bpoint)); - } else { - // Something was deleted we do not know what - // Let the breakpoint manager handle it with an update(). - try { - session.getBreakpointManager().update(currentTarget); - } catch (CDIException e) { - } - } - } else if (miEvent instanceof MISharedLibUnloadedEvent) { - processSharedLibUnloadedEvent((MISharedLibUnloadedEvent)miEvent); - cdiList.add(new DestroyedEvent(session, (MISharedLibUnloadedEvent)miEvent)); - } else if (miEvent instanceof MIVarDeletedEvent) { - cdiList.add(new DestroyedEvent(session, (MIVarDeletedEvent)miEvent)); - } - } else if (miEvent instanceof MICreatedEvent) { - if (miEvent instanceof MIBreakpointCreatedEvent) { - MIBreakpointCreatedEvent bpoint = (MIBreakpointCreatedEvent)miEvent; - if (bpoint.getNumber() > 0) { - cdiList.add(new CreatedEvent(session, bpoint)); - } else { - // Something created we do not know what - // Let the breakpoint manager handle it with an update(). - try { - session.getBreakpointManager().update(currentTarget); - } catch (CDIException e) { - } - } - } else if (miEvent instanceof MIVarCreatedEvent) { - cdiList.add(new CreatedEvent(session, (MIVarCreatedEvent)miEvent)); - } else if (miEvent instanceof MIRegisterCreatedEvent) { - cdiList.add(new CreatedEvent(session, (MIRegisterCreatedEvent)miEvent)); - } else if (miEvent instanceof MIThreadCreatedEvent) { - cdiList.add(new CreatedEvent(session, (MIThreadCreatedEvent)miEvent)); - } else if (miEvent instanceof MIMemoryCreatedEvent) { - cdiList.add(new CreatedEvent(session, (MIMemoryCreatedEvent)miEvent)); - } else if (miEvent instanceof MISharedLibCreatedEvent) { - cdiList.add(new CreatedEvent(session, (MISharedLibCreatedEvent)miEvent)); - } else if (miEvent instanceof MIInferiorCreatedEvent) { - cdiList.add(new CreatedEvent(session, (MIInferiorCreatedEvent)miEvent)); - } - } - - // Fire the event; - ICDIEvent[] cdiEvents = (ICDIEvent[])cdiList.toArray(new ICDIEvent[0]); - fireEvents(cdiEvents); - } - - public EventManager(Session session) { - super(session); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIEventManager#addEventListener(ICDIEventListener) - */ - @Override - public void addEventListener(ICDIEventListener listener) { - list.add(listener); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIEventManager#removeEventListener(ICDIEventListener) - */ - @Override - public void removeEventListener(ICDIEventListener listener) { - list.remove(listener); - } - - public void removeEventListeners() { - list.clear(); - } - - /** - * Send ICDIEvent to the listeners. - */ - public void fireEvents(ICDIEvent[] cdiEvents) { - if (cdiEvents != null && cdiEvents.length > 0) { - ICDIEventListener[] listeners = (ICDIEventListener[])list.toArray(new ICDIEventListener[0]); - for (int i = 0; i < listeners.length; i++) { - listeners[i].handleDebugEvents(cdiEvents); - } - } - } - - /** - * When suspended arrives, reset managers and target. - * Alse the variable and the memory needs to be updated and events - * fired for changes. - */ - boolean processSuspendedEvent(MIStoppedEvent stopped) { - Session session = (Session)getSession(); - MISession miSession = stopped.getMISession(); - Target currentTarget = session.getTarget(miSession); - currentTarget.setSupended(true); - - // Bailout early if we do not want to process any events. - if (!isAllowingProcessingEvents()) { - return false; - } - - - if (processSharedLibEvent(stopped)) { - // Event was consumed by the shared lib processing bailout - return false; - } - - if (processBreakpointHitEvent(stopped)) { - // Event was consumed, i.e. it was not the right exception. - return false; - } - - int threadId = stopped.getThreadId(); - currentTarget.updateState(threadId); - try { - Thread cthread = (Thread)currentTarget.getCurrentThread(); - if (cthread != null) { - cthread.getCurrentStackFrame(); - } else { - return true; - } - } catch (CDIException e1) { - //e1.printStackTrace(); - return true; - } - - // Update the managers. - // For the Variable/Expression Managers call only the updateManager. - VariableManager varMgr = session.getVariableManager(); - ExpressionManager expMgr = session.getExpressionManager(); - RegisterManager regMgr = session.getRegisterManager(); - MemoryManager memMgr = session.getMemoryManager(); - BreakpointManager bpMgr = session.getBreakpointManager(); - SignalManager sigMgr = session.getSignalManager(); - SourceManager srcMgr = session.getSourceManager(); - SharedLibraryManager libMgr = session.getSharedLibraryManager(); - try { - if (varMgr.isAutoUpdate()) { - varMgr.update(currentTarget); - } - if (expMgr.isAutoUpdate()) { - expMgr.update(currentTarget); - } - if (regMgr.isAutoUpdate()) { - regMgr.update(currentTarget); - } - if (memMgr.isAutoUpdate()) { - memMgr.update(currentTarget); - } - if (bpMgr.isAutoUpdate()) { - bpMgr.update(currentTarget); - } - if (sigMgr.isAutoUpdate()) { - sigMgr.update(currentTarget); - } - if (libMgr.isAutoUpdate()) { - libMgr.update(currentTarget); - } - if (srcMgr.isAutoUpdate()) { - srcMgr.update(currentTarget); - } - } catch (CDIException e) { - // Something went wrong => preventing updates to the model, this is serious - MIPlugin.log(e); - } - return true; - } - - /** - * When a shared library is unloading we could possibly have stale libraries. - * GDB does no react well to this: see PR - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=74496 - * @param unLoaded - * @return - */ - boolean processSharedLibUnloadedEvent(MISharedLibUnloadedEvent unLoaded) { - Session session = (Session)getSession(); - MISession miSession = unLoaded.getMISession(); - Target target = session.getTarget(miSession); - - // We do not need to do fancy checking we can just delete all - // the expression variable and let UI recreate them by reevaluating. - ExpressionManager expMgr = session.getExpressionManager(); - try { - expMgr.deleteAllVariables(target); - } catch (CDIException e) { - } - - return false; - } - - /** - * If the deferredBreakpoint processing is set - * catch the shared-lib-event go to the last known - * stackframe and try to finish. - * Save the last user command and issue it again. - * @param stopped - * @return - */ - boolean processSharedLibEvent(MIStoppedEvent stopped) { - Session session = (Session)getSession(); - MISession miSession = stopped.getMISession(); - - Target currentTarget = session.getTarget(miSession); - SharedLibraryManager mgr = session.getSharedLibraryManager(); - - if (mgr.isDeferredBreakpoint(currentTarget)) { - if (stopped instanceof MISharedLibEvent) { - // Check if we have a new library loaded - try { - mgr.update(currentTarget); - } catch (CDIException e3) { - } - CommandFactory factory = miSession.getCommandFactory(); - int type = (lastRunningEvent == null) ? MIRunningEvent.CONTINUE : lastRunningEvent.getType(); - if (lastUserCommand == null) { - switch (type) { - case MIRunningEvent.NEXT: - lastUserCommand = factory.createMIExecNext(1); - break; - case MIRunningEvent.NEXTI: - lastUserCommand = factory.createMIExecNextInstruction(1); - break; - case MIRunningEvent.STEP: - lastUserCommand = factory.createMIExecStep(1); - break; - case MIRunningEvent.STEPI: - lastUserCommand = factory.createMIExecStepInstruction(1); - break; - case MIRunningEvent.FINISH: - lastUserCommand = factory.createMIExecFinish(); - break; - case MIRunningEvent.RETURN: - lastUserCommand = factory.createMIExecReturn(); - break; - case MIRunningEvent.CONTINUE: { - MIExecContinue cont = factory.createMIExecContinue(); - cont.setQuiet(true); - try { - miSession.postCommand(cont); - MIInfo info = cont.getMIInfo(); - if (info == null) { - // throw new CDIException("Target is not responding"); - } - } catch (MIException e) { - // throw new MI2CDIException(e); - } - return true; // for the continue bailout early no need to the stuff below - } - } - } - - int miLevel = 0; - int tid = 0; - Thread currentThread = null; - try { - currentThread = (Thread)currentTarget.getCurrentThread(); - } catch (CDIException e1) { - } - tid = currentThread.getId(); - // Select the old thread now. - if (tid > 0) { - MIThreadSelect selectThread = factory.createMIThreadSelect(tid); - try { - miSession.postCommand(selectThread); - } catch (MIException e) { - // ignore - } - } - ICDIStackFrame frame = null; - try { - frame = currentThread.getCurrentStackFrame(); - } catch (CDIException e2) { - } - int count = 0; - try { - MIStackInfoDepth depth = factory.createMIStackInfoDepth(); - miSession.postCommand(depth); - MIStackInfoDepthInfo info = depth.getMIStackInfoDepthInfo(); - if (info == null) { - //throw new CDIException("No answer"); - } - count = info.getDepth(); - } catch (MIException e) { - //throw new MI2CDIException(e); - //System.out.println(e); - } - if (frame != null) { - // Fortunately the ICDIStackFrame store the level - // in ascending level the higher the stack the higher the level - // GDB does the opposite the highest stack is 0. - // This allow us to do some calculation, in figure out the - // level of the old stack. The -1 is because gdb level is zero-based - miLevel = count - frame.getLevel() - 1; - } - if (miLevel >= 0) { - MIStackSelectFrame selectFrame = factory.createMIStackSelectFrame(miLevel); - MIExecFinish finish = factory.createMIExecFinish(); - finish.setQuiet(true); - try { - miSession.postCommand(selectFrame); - miSession.postCommand(finish); - } catch (MIException e) { - // ignore - } - } else { - // if we are still at the same level in the backtrace - // for example the StopEventLib was on a different thread - // redo the last command. - Command cmd = lastUserCommand; - cmd.setQuiet(true); - lastUserCommand = null; - try { - miSession.postCommand(cmd); - } catch (MIException e) { - // ignore - } - } - return true; - } else if (lastUserCommand != null) { - Command cmd = lastUserCommand; - cmd.setQuiet(true); - lastUserCommand = null; - try { - miSession.postCommand(cmd); - } catch (MIException e) { - } - return true; - } - } - return false; - } - - boolean processBreakpointHitEvent(MIStoppedEvent stopped) { -// Session session = (Session)getSession(); -// if (stopped instanceof MIBreakpointHitEvent) { -// MIBreakpointHitEvent bpEvent = (MIBreakpointHitEvent)stopped; -// BreakpointManager bpMgr = session.getBreakpointManager(); -// int bpNo = bpEvent.getNumber(); -// } - return false; - } - - /** - * Do any processing of before a running event. - */ - boolean processRunningEvent(MIRunningEvent running) { - lastRunningEvent = running; - - Session session = (Session)getSession(); - MISession miSession = running.getMISession(); - Target currentTarget = session.getTarget(miSession); - currentTarget.setSupended(false); - - // Bailout early if we do not want to process any events. - if (!isAllowingProcessingEvents() || !running.propagate()) { - return false; - } - - return true; - } - - public boolean isAllowingProcessingEvents() { - return fAllowProcessingEvents; - } - - public void allowProcessingEvents(boolean allowed) { - fAllowProcessingEvents = allowed; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/ExitInfo.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/ExitInfo.java deleted file mode 100644 index 961ce4b0a8f..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/ExitInfo.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi; - -import org.eclipse.cdt.debug.core.cdi.ICDIExitInfo; -import org.eclipse.cdt.debug.mi.core.event.MIInferiorExitEvent; - -/**. - */ -public class ExitInfo extends SessionObject implements ICDIExitInfo { - - MIInferiorExitEvent event; - - public ExitInfo(Session session, MIInferiorExitEvent e) { - super(session); - event = e; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIExitInfo#getCode() - */ - @Override - public int getCode() { - return event.getExitCode(); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/ExpressionManager.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/ExpressionManager.java deleted file mode 100644 index 121a9138428..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/ExpressionManager.java +++ /dev/null @@ -1,271 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - * Alena Laskavaia (QNX) - Bug 221224 - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Hashtable; -import java.util.List; -import java.util.Map; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.ICDIExpression; -import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable; -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.MISession; -import org.eclipse.cdt.debug.mi.core.cdi.model.Expression; -import org.eclipse.cdt.debug.mi.core.cdi.model.LocalVariable; -import org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; -import org.eclipse.cdt.debug.mi.core.cdi.model.Thread; -import org.eclipse.cdt.debug.mi.core.cdi.model.Variable; -import org.eclipse.cdt.debug.mi.core.command.CommandFactory; -import org.eclipse.cdt.debug.mi.core.command.MIVarCreate; -import org.eclipse.cdt.debug.mi.core.command.MIVarDelete; -import org.eclipse.cdt.debug.mi.core.command.MIVarUpdate; -import org.eclipse.cdt.debug.mi.core.event.MIEvent; -import org.eclipse.cdt.debug.mi.core.event.MIVarChangedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIVarDeletedEvent; -import org.eclipse.cdt.debug.mi.core.output.MIVar; -import org.eclipse.cdt.debug.mi.core.output.MIVarChange; -import org.eclipse.cdt.debug.mi.core.output.MIVarCreateInfo; -import org.eclipse.cdt.debug.mi.core.output.MIVarUpdateInfo; - -/** - */ -public class ExpressionManager extends Manager { - - final static ICDIExpression[] EMPTY_EXPRESSIONS = {}; - Map expMap; - Map varMap; - MIVarChange[] noChanges = new MIVarChange[0]; - - public ExpressionManager(Session session) { - super(session, true); - expMap = new Hashtable(); - varMap = new Hashtable(); - } - - synchronized List getExpressionList(Target target) { - List expList = (List)expMap.get(target); - if (expList == null) { - expList = Collections.synchronizedList(new ArrayList()); - expMap.put(target, expList); - } - return expList; - } - - synchronized List getVariableList(Target target) { - List varList = (List)varMap.get(target); - if (varList == null) { - varList = Collections.synchronizedList(new ArrayList()); - varMap.put(target, varList); - } - return varList; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIExpressionManager#createExpression(String) - */ - public ICDIExpression createExpression(Target target, String name) throws CDIException { - Expression expression = new Expression(target, name); - List exprList = getExpressionList(target); - exprList.add(expression); - return expression; - } - - public ICDIExpression[] getExpressions(Target target) throws CDIException { - List expList = (List) expMap.get(target); - if (expList != null) { - return (ICDIExpression[])expList.toArray(EMPTY_EXPRESSIONS); - } - return EMPTY_EXPRESSIONS; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIExpressionManager#removeExpression(ICDIExpression) - */ - public void destroyExpressions(Target target, ICDIExpression[] expressions) throws CDIException { - List expList = getExpressionList(target); - for (int i = 0; i < expressions.length; ++i) { - expList.remove(expressions[i]); - } - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIExpressionManager#removeExpression(ICDIExpression) - */ - public void destroyAllExpressions(Target target) throws CDIException { - ICDIExpression[] expressions = getExpressions(target); - destroyExpressions(target, expressions); - } - - @Override - public void update(Target target) throws CDIException { -// deleteAllVariables(target); - List eventList = new ArrayList(); - MISession mi = target.getMISession(); - CommandFactory factory = mi.getCommandFactory(); - List varList = getVariableList(target); - Variable[] variables = (Variable[]) varList.toArray(new Variable[varList.size()]); - for (int i = 0; i < variables.length; i++) { - Variable variable = variables[i]; - String varName = variable.getMIVar().getVarName(); - MIVarChange[] changes = noChanges; - MIVarUpdate update = factory.createMIVarUpdate(varName); - MIVarUpdateInfo info = null; - try { - mi.postCommand(update); - } catch (MIException e) { - throw new MI2CDIException(e); - } - boolean timedout = false; - try { - info = update.getMIVarUpdateInfo(); - if (info == null) { - timedout = true; - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - changes = info.getMIVarChanges(); - } catch (MIException e) { - if (timedout) { - throw new MI2CDIException(e); - } - eventList.add(new MIVarDeletedEvent(mi, varName)); - } - for (int j = 0; j < changes.length; j++) { - String n = changes[j].getVarName(); - if (changes[j].isInScope()) { - eventList.add(new MIVarChangedEvent(mi, n)); - } else { - deleteVariable(variable); - eventList.add(new MIVarDeletedEvent(mi, n)); - } - } - } - MIEvent[] events = (MIEvent[]) eventList.toArray(new MIEvent[0]); - mi.fireEvents(events); - } - - /** - * @param miSession - * @param varName - * @return - */ - public Variable getVariable(MISession miSession, String varName) { - Session session = (Session)getSession(); - Target target = session.getTarget(miSession); - List varList = getVariableList(target); - Variable[] vars = (Variable[])varList.toArray(new Variable[0]); - for (int i = 0; i < vars.length; i++) { - try { - if (vars[i].getMIVar().getVarName().equals(varName)) { - return vars[i]; - } - Variable v = vars[i].getChild(varName); - if (v != null) { - return v; - } - } catch (CDIException e) { - // ignore - } - } - return null; - } - - public Variable createVariable(StackFrame frame, String code) throws CDIException { - Target target = (Target)frame.getTarget(); - Thread currentThread = (Thread)target.getCurrentThread(); - StackFrame currentFrame = currentThread.getCurrentStackFrame(); - synchronized(target.getLock()) { - try { - target.setCurrentThread(frame.getThread(), false); - ((Thread)frame.getThread()).setCurrentStackFrame(frame, false); - MISession mi = target.getMISession(); - CommandFactory factory = mi.getCommandFactory(); - MIVarCreate var = factory.createMIVarCreate(code); - mi.postCommand(var); - MIVarCreateInfo info = var.getMIVarCreateInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - Variable variable = new LocalVariable(target, null, frame, code, null, 0, 0, info.getMIVar()); - List varList = getVariableList(target); - varList.add(variable); - return variable; - } catch (MIException e) { - throw new MI2CDIException(e); - } finally { - target.setCurrentThread(currentThread, false); - currentThread.setCurrentStackFrame(currentFrame, false); - } - } - } - - /** - * Remove variable form the maintained cache list. - * @param miSession - * @param varName - * @return - */ - public Variable removeVariableFromList(MISession miSession, String varName) { - Variable var = getVariable(miSession, varName); - if (var != null) { - Target target = ((Session)getSession()).getTarget(miSession); - List varList = getVariableList(target); - varList.remove(var); - return var; - } - return null; - } - - public void deleteAllVariables(Target target) throws CDIException { - List varList = getVariableList(target); - Variable[] variables = (Variable[]) varList.toArray(new Variable[varList.size()]); - for (int i = 0; i < variables.length; ++i) { - deleteVariable(variables[i]); - } - } - /** - * Get rid of the underlying variable. - */ - public void deleteVariable(Variable variable) throws CDIException { - Target target = (Target)variable.getTarget(); - MISession miSession = target.getMISession(); - MIVar miVar = variable.getMIVar(); - //remove the underlying var-object now. - CommandFactory factory = miSession.getCommandFactory(); - MIVarDelete var = factory.createMIVarDelete(miVar.getVarName()); - try { - miSession.postCommand(var); - var.getMIInfo(); - } catch (MIException e) { - //throw new MI2CDIException(e); - } - List varList = getVariableList(target); - varList.remove(variable); - - // remove any children - ICDIVariable[] children = variable.children; - if (children != null) { - for (int i = 0; i < children.length; ++i) { - if (children[0] instanceof Variable) { - Variable child = (Variable)children[i]; - MIVarDeletedEvent event = new MIVarDeletedEvent(miSession, child.getMIVar().getVarName()); - miSession.fireEvent(event); - } - } - } - miSession.fireEvent(new MIVarDeletedEvent(miSession, variable.getMIVar().getVarName())); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/FileLocation.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/FileLocation.java deleted file mode 100644 index abcde577f79..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/FileLocation.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi; - -import org.eclipse.cdt.debug.core.cdi.ICDIFileLocation; - -public class FileLocation extends Location implements ICDIFileLocation { - - public FileLocation(String file) { - super(file); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Format.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Format.java deleted file mode 100644 index 7875a602636..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Format.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi; - -import org.eclipse.cdt.debug.core.cdi.ICDIFormat; -import org.eclipse.cdt.debug.mi.core.MIFormat; - -/** - */ -public class Format { - - private Format() { - } - - public static int toMIFormat(int format) { - int fmt = MIFormat.NATURAL; - switch (format) { - case ICDIFormat.NATURAL: - fmt = MIFormat.NATURAL; - break; - - case ICDIFormat.DECIMAL: - fmt = MIFormat.DECIMAL; - break; - - case ICDIFormat.BINARY: - fmt = MIFormat.BINARY; - break; - - case ICDIFormat.OCTAL: - fmt = MIFormat.OCTAL; - break; - - case ICDIFormat.HEXADECIMAL: - fmt = MIFormat.HEXADECIMAL; - break; - } - return fmt; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/FunctionFinished.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/FunctionFinished.java deleted file mode 100644 index 4b59142950d..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/FunctionFinished.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.ICDIFunctionFinished; -import org.eclipse.cdt.debug.core.cdi.model.ICDIValue; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType; -import org.eclipse.cdt.debug.mi.core.cdi.model.LocalVariableDescriptor; -import org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; -import org.eclipse.cdt.debug.mi.core.cdi.model.Thread; -import org.eclipse.cdt.debug.mi.core.cdi.model.Variable; -import org.eclipse.cdt.debug.mi.core.event.MIFunctionFinishedEvent; - -/* - * FunctionFinished - */ -public class FunctionFinished extends EndSteppingRange implements ICDIFunctionFinished { - - MIFunctionFinishedEvent fMIEvent; - - /** - * @param session - */ - public FunctionFinished(Session session, MIFunctionFinishedEvent event) { - super(session); - fMIEvent = event; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.ICDIFunctionFinished#getReturnType() - */ - @Override - public ICDIType getReturnType() throws CDIException { - Session session = (Session)getSession(); - Target target = session.getTarget(fMIEvent.getMISession()); - String rType = fMIEvent.getReturnType(); - if (rType == null || rType.length() == 0) { - throw new CDIException(CdiResources.getString("cdi.VariableManager.Unknown_type")); //$NON-NLS-1$ - } - SourceManager srcMgr = session.getSourceManager(); - return srcMgr.getType(target, rType); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.ICDIFunctionFinished#getReturnValue() - */ - @Override - public ICDIValue getReturnValue() throws CDIException { - Session session = (Session)getSession(); - Target target = session.getTarget(fMIEvent.getMISession()); - Thread thread = (Thread)target.getCurrentThread(); - StackFrame frame = thread.getCurrentStackFrame(); - String gdbVariable = fMIEvent.getGDBResultVar(); - if (gdbVariable == null || gdbVariable.length() == 0) { - throw new CDIException(CdiResources.getString("cdi.VariableManager.Unknown_type")); //$NON-NLS-1$ - } - LocalVariableDescriptor varDesc = new LocalVariableDescriptor(target, thread, frame, gdbVariable, null, 0, 0); - VariableManager varMgr = session.getVariableManager(); - Variable var = varMgr.createVariable(varDesc); - return var.getValue(); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/LineLocation.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/LineLocation.java deleted file mode 100644 index 18954dcd147..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/LineLocation.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi; - -import org.eclipse.cdt.debug.core.cdi.ICDILineLocation; - -public class LineLocation extends Location implements ICDILineLocation { - - public LineLocation(String file, int line) { - super(file, line); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Location.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Location.java deleted file mode 100644 index c9d282043da..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Location.java +++ /dev/null @@ -1,155 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi; - -import java.math.BigInteger; - -import org.eclipse.cdt.debug.core.cdi.ICDIAddressLocation; -import org.eclipse.cdt.debug.core.cdi.ICDIFileLocation; -import org.eclipse.cdt.debug.core.cdi.ICDIFunctionLocation; -import org.eclipse.cdt.debug.core.cdi.ICDILineLocation; -import org.eclipse.cdt.debug.core.cdi.ICDILocation; - -/** - */ -public abstract class Location { - - BigInteger fAddress = null; - String fFile = null; - String fFunction = null; - int fLine; - - /** - * File location - * @param file - */ - public Location(String file) { - this(file, null, 0, null); - } - - /** - * File:function location - * @param file - * @param function - */ - public Location(String file, String function) { - this(file, function, 0, null); - } - - /** - * File:line location - * @param file - * @param line - */ - public Location(String file, int line) { - this (file, null, line, null); - } - - /** - * Address location - * @param address - */ - public Location(BigInteger address) { - this (null, null, 0, address); - } - - protected Location(String file, String function, int line, BigInteger address) { - fFile = file; - fFunction = function; - fLine = line; - fAddress = address; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDILocation#getAddress() - */ - public BigInteger getAddress() { - return fAddress; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDILocation#getFile() - */ - public String getFile() { - return fFile; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDILocation#getFunction() - */ - public String getFunction() { - return fFunction; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDILocation#getLineNumber() - */ - public int getLineNumber() { - return fLine; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDILocation#equals(ICDILocation) - */ - public boolean equals(ICDILocation location) { - if (location == this) { - return true; - } - if (location instanceof ICDILineLocation) { - ICDILineLocation lineLocation = (ICDILineLocation)location; - String oFile = lineLocation.getFile(); - if (oFile != null && oFile.length() > 0 && fFile != null && fFile.length() > 0 && oFile.equals(fFile)) { - if (lineLocation.getLineNumber() == fLine) { - return true; - } - } else if ((fFile == null || fFile.length() == 0) && (oFile == null || oFile.length() == 0)) { - if (lineLocation.getLineNumber() == fLine) { - return true; - } - } - } else if (location instanceof ICDIFunctionLocation) { - ICDIFunctionLocation funcLocation = (ICDIFunctionLocation)location; - String oFile = funcLocation.getFile(); - String oFunction = funcLocation.getFunction(); - if (oFile != null && oFile.length() > 0 && fFile != null && fFile.length() > 0 && oFile.equals(fFile)) { - if (oFunction != null && oFunction.length() > 0 && fFunction != null && fFunction.length() > 0 && oFunction.equals(fFunction)) { - return true; - } else if ((oFunction == null || oFunction.length() == 0) && (fFunction == null || fFunction.length() == 0)) { - return true; - } - } else if ((fFile == null || fFile.length() == 0) && (oFile == null || oFile.length() == 0)) { - if (oFunction != null && oFunction.length() > 0 && fFunction != null && fFunction.length() > 0 && oFunction.equals(fFunction)) { - return true; - } else if ((oFunction == null || oFunction.length() == 0) && (fFunction == null || fFunction.length() == 0)) { - return true; - } - } - } else if (location instanceof ICDIAddressLocation) { - ICDIAddressLocation addrLocation = (ICDIAddressLocation)location; - BigInteger oAddr = addrLocation.getAddress(); - if (oAddr != null && oAddr.equals(fAddress)) { - return true; - } else if (oAddr == null && fAddress == null) { - return true; - } - } else if (location instanceof ICDIFileLocation) { - ICDIFileLocation fileLocation = (ICDIFileLocation)location; - String oFile = fileLocation.getFile(); - if (oFile != null && oFile.length() > 0 && fFile != null && fFile.length() > 0 && oFile.equals(fFile)) { - return true; - } else if ((fFile == null || fFile.length() == 0) && (oFile == null || oFile.length() == 0)) { - return true; - } - } - return false; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Locator.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Locator.java deleted file mode 100644 index 53a19daf91b..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Locator.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi; - -import java.math.BigInteger; - -import org.eclipse.cdt.debug.core.cdi.ICDILocator; - -public class Locator extends Location implements ICDILocator { - - public Locator(String file, String function, int line, BigInteger address) { - super(file, function, line, address); - } - - boolean equalFile(String oFile) { - return equalString(oFile, getFile()); - } - - boolean equalFunction(String oFunction) { - return equalString(oFunction, getFunction()); - } - - boolean equalLine(int oLine) { - return oLine == getLineNumber(); - } - - boolean equalAddress(BigInteger oAddress) { - if (oAddress == null && getAddress() == null) { - return true; - } - if (oAddress != null && oAddress.equals(getAddress())) { - return true; - } - return false; - } - - public static boolean equalString(String f1, String f2) { - if (f1 != null && f1.length() > 0 && f2 != null && f2.length() > 0) { - return f1.equals(f2); - } else if ((f1 == null || f1.length() == 0) && (f2 == null || f2.length() == 0)) { - return true; - } - return false; - } - - public boolean equals(ICDILocator locator) { - - if (locator == this) { - return true; - } - String oFile = locator.getFile(); - String oFunction = locator.getFunction(); - int oLine = locator.getLineNumber(); - BigInteger oAddress = locator.getAddress(); - - if (equalFile(oFile) && equalFunction(oFunction) && - equalLine(oLine) && equalAddress(oAddress)) { - return true; - } - return false; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/MI2CDIException.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/MI2CDIException.java deleted file mode 100644 index f14bd8ec788..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/MI2CDIException.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2005 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.mi.core.MIException; - -/** - */ -public class MI2CDIException extends CDIException { - - /** - * - */ - private static final long serialVersionUID = 1L; - - public MI2CDIException(MIException e) { - super(e.getMessage(), e.getLogMessage()); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Manager.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Manager.java deleted file mode 100644 index c0c0749cd49..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Manager.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent; -import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; - -/** - * Manager - * - */ -public abstract class Manager extends SessionObject { - - boolean autoUpdate; - - public Manager(Session session, boolean update) { - super(session); - autoUpdate = update; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.ICDIUpdateManager#setAutoUpdate(boolean) - */ - public void setAutoUpdate(boolean update) { - autoUpdate = update; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.ICDIUpdateManager#isAutoUpdate() - */ - public boolean isAutoUpdate() { - return autoUpdate; - } - - protected abstract void update (Target target) throws CDIException; - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.impl.Manager#update() - */ - public void update() throws CDIException { - ICDITarget[] targets = getSession().getTargets(); - for (int i = 0; i < targets.length; ++i) { - if (targets[i] instanceof Target) { - update((Target)targets[i]); - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener#handleDebugEvents(org.eclipse.cdt.debug.core.cdi.event.ICDIEvent[]) - */ - public void handleDebugEvents(ICDIEvent[] events) { - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/MemoryManager.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/MemoryManager.java deleted file mode 100644 index f808b3e510e..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/MemoryManager.java +++ /dev/null @@ -1,195 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi; - -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Hashtable; -import java.util.List; -import java.util.Map; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock; -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.MIFormat; -import org.eclipse.cdt.debug.mi.core.MISession; -import org.eclipse.cdt.debug.mi.core.cdi.model.MemoryBlock; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; -import org.eclipse.cdt.debug.mi.core.command.CommandFactory; -import org.eclipse.cdt.debug.mi.core.command.MIDataReadMemory; -import org.eclipse.cdt.debug.mi.core.event.MIEvent; -import org.eclipse.cdt.debug.mi.core.event.MIMemoryChangedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIMemoryCreatedEvent; -import org.eclipse.cdt.debug.mi.core.output.MIDataReadMemoryInfo; - - -/** - */ -public class MemoryManager extends Manager { - - ICDIMemoryBlock[] EMPTY_MEMORY_BLOCKS = {}; - Map blockMap; - - public MemoryManager(Session session) { - super(session, true); - blockMap = new Hashtable(); - } - - synchronized List getMemoryBlockList(Target target) { - List blockList = (List)blockMap.get(target); - if (blockList == null) { - blockList = Collections.synchronizedList(new ArrayList()); - blockMap.put(target, blockList); - } - return blockList; - } - - /** - * This method will be call by the eventManager.processSuspended() every time the - * inferior comes to a Stop/Suspended. It will allow to look at the blocks that - * are registered and fired any event if changed. - * Note: Frozen blocks are not updated. - * - */ - @Override - public void update(Target target) { - MISession miSession = target.getMISession(); - List blockList = getMemoryBlockList(target); - MemoryBlock[] blocks = (MemoryBlock[]) blockList.toArray(new MemoryBlock[blockList.size()]); - List eventList = new ArrayList(blocks.length); - for (int i = 0; i < blocks.length; i++) { - if (! blocks[i].isFrozen()) { - try { - update(blocks[i], eventList); - } catch (CDIException e) { - } - } - } - MIEvent[] events = (MIEvent[])eventList.toArray(new MIEvent[0]); - miSession.fireEvents(events); - } - - /** - * update one Block. - */ - public BigInteger[] update(MemoryBlock block, List aList) throws CDIException { - Target target = (Target)block.getTarget(); - MISession miSession = target.getMISession(); - MemoryBlock newBlock = cloneBlock(block); - boolean newAddress = ! newBlock.getStartAddress().equals(block.getStartAddress()); - BigInteger[] array = compareBlocks(block, newBlock); - // Update the block MIDataReadMemoryInfo. - block.setMIDataReadMemoryInfo(newBlock.getMIDataReadMemoryInfo()); - if (array.length > 0 || newAddress) { - if (aList != null) { - aList.add(new MIMemoryChangedEvent(miSession, array)); - } else { - // fire right away. - miSession.fireEvent(new MIMemoryChangedEvent(miSession, array)); - } - } - return array; - } - - /** - * Compare two blocks and return an array of all _addresses_ that are different. - * This method is not smart it always assume that: - * oldBlock.getStartAddress() == newBlock.getStartAddress; - * oldBlock.getLength() == newBlock.getLength(); - * @return Long[] array of modified addresses. - */ - BigInteger[] compareBlocks (MemoryBlock oldBlock, MemoryBlock newBlock) throws CDIException { - byte[] oldBytes = oldBlock.getBytes(); - byte[] newBytes = newBlock.getBytes(); - List aList = new ArrayList(newBytes.length); - BigInteger distance = newBlock.getStartAddress().subtract(oldBlock.getStartAddress()); - //IPF_TODO enshure it is OK here - int diff = distance.intValue(); - if ( Math.abs(diff) < newBytes.length) { - for (int i = 0; i < newBytes.length; i++) { - if (i + diff < oldBytes.length && i + diff >= 0) { - if (oldBytes[i + diff] != newBytes[i]) { - aList.add(newBlock.getStartAddress().add(BigInteger.valueOf(i))); - } - } - } - } - return (BigInteger[]) aList.toArray(new BigInteger[aList.size()]); - } - - /** - * Use the same expression and length of the original block - * to create a new MemoryBlock. The new block is not register - * with the MemoryManager. - */ - MemoryBlock cloneBlock(MemoryBlock block) throws CDIException { - Target target = (Target)block.getTarget(); - String exp = block.getExpression(); - int wordSize = block.getWordSize(); - boolean little = target.isLittleEndian(); - MIDataReadMemoryInfo info = createMIDataReadMemoryInfo(target.getMISession(), exp, (int)block.getLength(), wordSize); - return new MemoryBlock(target, exp, wordSize, little, info); - } - - /** - * Post a -data-read-memory to gdb/mi. - */ - MIDataReadMemoryInfo createMIDataReadMemoryInfo(MISession miSession, String exp, int units, int wordSize) throws CDIException { - CommandFactory factory = miSession.getCommandFactory(); - MIDataReadMemory mem = factory.createMIDataReadMemory(0, exp, MIFormat.HEXADECIMAL, wordSize, 1, units, null); - try { - miSession.postCommand(mem); - MIDataReadMemoryInfo info = mem.getMIDataReadMemoryInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - return info; - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - - public ICDIMemoryBlock createMemoryBlock(Target target, String address, int units, int wordSize) throws CDIException { - boolean little = target.isLittleEndian(); - MIDataReadMemoryInfo info = createMIDataReadMemoryInfo(target.getMISession(), address, units, wordSize); - ICDIMemoryBlock block = new MemoryBlock(target, address, wordSize, little, info); - List blockList = getMemoryBlockList(target); - blockList.add(block); - MISession miSession = target.getMISession(); - miSession.fireEvent(new MIMemoryCreatedEvent(miSession, block.getStartAddress(), block.getLength())); - return block; - } - - public MemoryBlock[] getMemoryBlocks(MISession miSession) { - Session session = (Session)getSession(); - Target target = session.getTarget(miSession); - List blockList = getMemoryBlockList(target); - return (MemoryBlock[]) blockList.toArray(new MemoryBlock[blockList.size()]); - } - public ICDIMemoryBlock[] getMemoryBlocks(Target target) throws CDIException { - List blockList = getMemoryBlockList(target); - return (ICDIMemoryBlock[]) blockList.toArray(new ICDIMemoryBlock[blockList.size()]); - } - - public void removeAllBlocks(Target target) throws CDIException { - ICDIMemoryBlock[] blocks = getMemoryBlocks(target); - removeBlocks(target, blocks); - } - - public void removeBlocks(Target target, ICDIMemoryBlock[] memoryBlocks) throws CDIException { - List blockList = (List)blockMap.get(target); - if (blockList != null) { - blockList.removeAll(Arrays.asList(memoryBlocks)); - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/ProcessManager.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/ProcessManager.java deleted file mode 100644 index 390e32336e8..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/ProcessManager.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi; - -import java.util.Vector; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; -import org.eclipse.cdt.debug.mi.core.MISession; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; -import org.eclipse.cdt.debug.mi.core.event.MIInferiorCreatedEvent; - -/** - */ -public class ProcessManager extends Manager { - - static final Target[] EMPTY_TARGETS = new Target[0]; - Vector debugTargetList; - - public ProcessManager(Session session) { - super(session, true); - debugTargetList = new Vector(1); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIProcessManager#getProcesses() - */ - public Target[] getTargets() { - return (Target[]) debugTargetList.toArray(new Target[debugTargetList.size()]); - } - - public ICDITarget[] getCDITargets() { - return (ICDITarget[]) debugTargetList.toArray(new ICDITarget[debugTargetList.size()]); - } - - public void addTargets(Target[] targets) { - EventManager eventManager = (EventManager)getSession().getEventManager(); - for (int i = 0; i < targets.length; ++i) { - Target target = targets[i]; - MISession miSession = target.getMISession(); - if (miSession != null) { - miSession.addObserver(eventManager); - miSession.fireEvent(new MIInferiorCreatedEvent(miSession, 0)); - if (!debugTargetList.contains(target)) { - debugTargetList.add(target); - } - } - } - debugTargetList.trimToSize(); - } - - public void removeTargets(Target[] targets) { - EventManager eventManager = (EventManager)getSession().getEventManager(); - for (int i = 0; i < targets.length; ++i) { - Target target = targets[i]; - MISession miSession = target.getMISession(); - if (miSession != null) { - miSession.deleteObserver(eventManager); - } - debugTargetList.remove(target); - } - debugTargetList.trimToSize(); - } - - public Target getTarget(MISession miSession) { - synchronized(debugTargetList) { - for (int i = 0; i < debugTargetList.size(); ++i) { - Target target = (Target)debugTargetList.get(i); - MISession mi = target.getMISession(); - if (mi.equals(miSession)) { - return target; - } - } - } - // ASSERT: it should not happen. - return null; - } - - @Override - public void update(Target target) throws CDIException { - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/RegisterManager.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/RegisterManager.java deleted file mode 100644 index e825d864166..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/RegisterManager.java +++ /dev/null @@ -1,472 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2011 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - * Giuseppe Montalto, STMicroelectronics - bug 174988 - * Alena Laskavaia (QNX) - Bug 221224 - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.Hashtable; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterDescriptor; -import org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterGroup; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType; -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.MISession; -import org.eclipse.cdt.debug.mi.core.cdi.model.Register; -import org.eclipse.cdt.debug.mi.core.cdi.model.RegisterDescriptor; -import org.eclipse.cdt.debug.mi.core.cdi.model.RegisterGroup; -import org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; -import org.eclipse.cdt.debug.mi.core.cdi.model.Thread; -import org.eclipse.cdt.debug.mi.core.cdi.model.Variable; -import org.eclipse.cdt.debug.mi.core.cdi.model.VariableDescriptor; -import org.eclipse.cdt.debug.mi.core.command.CommandFactory; -import org.eclipse.cdt.debug.mi.core.command.MIDataListChangedRegisters; -import org.eclipse.cdt.debug.mi.core.command.MIDataListRegisterNames; -import org.eclipse.cdt.debug.mi.core.command.MIVarCreate; -import org.eclipse.cdt.debug.mi.core.command.MIVarDelete; -import org.eclipse.cdt.debug.mi.core.command.MIVarUpdate; -import org.eclipse.cdt.debug.mi.core.event.MIEvent; -import org.eclipse.cdt.debug.mi.core.event.MIRegisterChangedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIVarChangedEvent; -import org.eclipse.cdt.debug.mi.core.output.MIDataListChangedRegistersInfo; -import org.eclipse.cdt.debug.mi.core.output.MIDataListRegisterNamesInfo; -import org.eclipse.cdt.debug.mi.core.output.MIVar; -import org.eclipse.cdt.debug.mi.core.output.MIVarChange; -import org.eclipse.cdt.debug.mi.core.output.MIVarCreateInfo; -import org.eclipse.cdt.debug.mi.core.output.MIVarUpdateInfo; - -/** - */ -public class RegisterManager extends Manager { - - final int MAX_ENTRIES = 150; - - /** - * - * LRUMap.<br> - * Simple LRU cache using a LinkedHashMap - */ - class LRUMap extends LinkedHashMap { - private static final long serialVersionUID = 1L; - LRUMap() { - super(MAX_ENTRIES+1, .75F, true); - } - /* (non-Javadoc) - * @see java.util.LinkedHashMap#removeEldestEntry(java.util.Map.Entry) - */ - @Override - protected boolean removeEldestEntry(Map.Entry eldest) { - boolean toRemove = size() > MAX_ENTRIES; - if (toRemove) { - ShadowRegister v = (ShadowRegister)eldest.getValue(); - try { - Target target = (Target)v.getTarget(); - removeMIVar(target.getMISession(), v.getMIVar()); - } catch (Exception e) { - // ignore all - } - v.setMIVar(null); - } - return toRemove; - } - } - - /** - * - * ShadowRegister.<br> - * To keep track of the register value we can a shadow variable. If the - * the variable MIVar was destroy by the LRUCache we try to recreate it. - */ - class ShadowRegister extends Register { - - public ShadowRegister(Register reg, StackFrame frame, String n, MIVar v) { - super((Target)reg.getTarget(), (Thread)frame.getThread(), frame, n, null, 0, 0, v); - try { - fTypename = reg.getTypeName(); - } catch (CDIException e) { - // ignore - } - try { - fType = reg.getType(); - } catch (CDIException e) { - // ignore - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.core.cdi.model.Variable#getMIVar() - */ - @Override - public MIVar getMIVar() throws CDIException { - if (fMIVar == null) { - fMIVar = createMiVar((StackFrame)getStackFrame(), getName()); - } - return fMIVar; - } - - public void setMIVar(MIVar newMIVar) { - fMIVar = newMIVar; - } - } - - Map regsMap; - Map varsMap; - MIVarChange[] noChanges = new MIVarChange[0]; - HashMap fTypeCache; - - public RegisterManager(Session session) { - super(session, true); - regsMap = new Hashtable(); - varsMap = new Hashtable(); - // The register bookkeeping provides better update control. - setAutoUpdate( true ); - fTypeCache = new HashMap(); - } - - public ICDIType getFromTypeCache(String typeName) { - return (ICDIType)fTypeCache.get(typeName); - } - public void addToTypeCache(String typeName, ICDIType type) { - fTypeCache.put(typeName, type); - } - - - synchronized List getRegistersList(Target target) { - List regsList = (List)regsMap.get(target); - if (regsList == null) { - regsList = Collections.synchronizedList(new ArrayList()); - regsMap.put(target, regsList); - } - return regsList; - } - - synchronized Map getVariableMap(Target target) { - Map varMap = (Map)varsMap.get(target); - if (varMap == null) { - varMap = Collections.synchronizedMap(new LRUMap()); - varsMap.put(target, varMap); - } - return varMap; - } - - public ICDIRegisterGroup[] getRegisterGroups(Target target) throws CDIException { - RegisterGroup group = new RegisterGroup(target, "Main"); //$NON-NLS-1$ - return new ICDIRegisterGroup[] { group }; - } - - public ICDIRegisterDescriptor[] getRegisterDescriptors(RegisterGroup group) throws CDIException { - Target target = (Target)group.getTarget(); - return getRegisterDescriptors(target); - } - public ICDIRegisterDescriptor[] getRegisterDescriptors(Target target) throws CDIException { - MISession mi = target.getMISession(); - CommandFactory factory = mi.getCommandFactory(); - MIDataListRegisterNames registers = factory.createMIDataListRegisterNames(); - try { - mi.postCommand(registers); - MIDataListRegisterNamesInfo info = - registers.getMIDataListRegisterNamesInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - String[] names = info.getRegisterNames(); - List regsList = new ArrayList(names.length); - for (int i = 0; i < names.length; i++) { - if (names[i].length() > 0) { - regsList.add(new RegisterDescriptor(target, null, null, names[i], null, i, 0)); - } - } - return (ICDIRegisterDescriptor[])regsList.toArray(new ICDIRegisterDescriptor[0]); - } catch (MIException e) { - throw new MI2CDIException(e); - } finally { - } - } - - public Register createRegister(RegisterDescriptor regDesc) throws CDIException { - Register reg = findRegister(regDesc); - if (reg == null) { - try { - String name = regDesc.getQualifiedName(); - Target target = (Target)regDesc.getTarget(); - MISession mi = target.getMISession(); - CommandFactory factory = mi.getCommandFactory(); - MIVarCreate var = factory.createMIVarCreate(name); - mi.postCommand(var, -1); -// mi.postCommand(var); -// MIVarCreateInfo info = var.getMIVarCreateInfo(); -// if (info == null) { -// throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ -// } -// reg = new Register(regDesc, info.getMIVar()); - reg = new Register(regDesc, var); - List regList = getRegistersList(target); - regList.add(reg); - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - return reg; - } - - public void destroyRegister(Register reg) { - Target target = (Target)reg.getTarget(); - List regList = (List)regsMap.get(target); - if (regList != null) { - if (regList.remove(reg)) { - MISession miSession = target.getMISession(); - try { - removeMIVar(miSession, reg.getMIVar()); - } catch (CDIException e) { - // - } - } - } - } - - /** - * Tell gdb to remove the underlying var-object also. - */ - void removeMIVar(MISession miSession, MIVar miVar) throws CDIException { - CommandFactory factory = miSession.getCommandFactory(); - MIVarDelete var = factory.createMIVarDelete(miVar.getVarName()); - try { - miSession.postCommand(var); - var.getMIInfo(); - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - - public MIVar createMiVar(StackFrame frame, String regName) throws CDIException { - Target target = (Target)frame.getTarget(); - Thread currentThread = (Thread)target.getCurrentThread(); - StackFrame currentFrame = currentThread.getCurrentStackFrame(); - synchronized(target.getLock()) { - try { - target.setCurrentThread(frame.getThread(), false); - ((Thread)frame.getThread()).setCurrentStackFrame(frame, false); - MISession mi = target.getMISession(); - CommandFactory factory = mi.getCommandFactory(); - MIVarCreate var = factory.createMIVarCreate(regName); - mi.postCommand(var); - MIVarCreateInfo info = var.getMIVarCreateInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - return info.getMIVar(); - } catch (MIException e) { - throw new MI2CDIException(e); - } finally { - target.setCurrentThread(currentThread, false); - currentThread.setCurrentStackFrame(currentFrame, false); - } - } - } - - public MIVarChange[] updateMiVar(StackFrame frame, String varName) throws CDIException { - Target target = (Target)frame.getTarget(); - Thread currentThread = (Thread)target.getCurrentThread(); - StackFrame currentFrame = currentThread.getCurrentStackFrame(); - synchronized(target.getLock()) { - try { - target.setCurrentThread(frame.getThread(), false); - ((Thread)frame.getThread()).setCurrentStackFrame(frame, false); - - MISession mi = target.getMISession(); - CommandFactory factory = mi.getCommandFactory(); - MIVarUpdate var = factory.createMIVarUpdate(varName); - mi.postCommand(var); - MIVarUpdateInfo info = var.getMIVarUpdateInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - return info.getMIVarChanges(); - } catch (MIException e) { - throw new MI2CDIException(e); - } finally { - target.setCurrentThread(currentThread, false); - currentThread.setCurrentStackFrame(currentFrame, false); - } - } - } - - public Variable createShadowRegister(Register register, StackFrame frame, String regName) throws CDIException { - Target target = (Target)frame.getTarget(); - Map varMap = getVariableMap(target); - ShadowRegister variable = null; - - if(varMap.containsKey(regName)) { - variable = (ShadowRegister)varMap.get(regName); - updateMiVar(frame,variable.getMIVar().getVarName()); - } - else { - MIVar miVar = createMiVar(frame, regName); - variable = new ShadowRegister(register, frame, regName, miVar); - /* varMap seems to be unused, so I changed it... - * now it helds the register name, instead of the variable name; - * it now can be used to retrieve existing variables, thus avoiding - * variable prolification and also reducing the number of mi commands - * to be sent to the target. - */ - varMap.put(regName, variable); - } - - return variable; - } - - /** - * Use by the eventManager to find the Register; - */ - public Register getRegister(MISession miSession, String varName) { - Target target = ((Session)getSession()).getTarget(miSession); - Register[] regs = getRegisters(target); - for (int i = 0; i < regs.length; i++) { - try { - if (regs[i].getMIVar().getVarName().equals(varName)) { - return regs[i]; - } - try { - Register r = (Register)regs[i].getChild(varName); - if (r != null) { - return r; - } - } catch (ClassCastException e) { - // ignore ??? - } - } catch (CDIException e1) { - // ignore; - } - } - return null; - } - - /** - * Use by the eventManager to find the Register; - */ - public Register getRegister(MISession miSession, int regno) { - Target target = ((Session)getSession()).getTarget(miSession); - return getRegister(target, regno); - } - public Register getRegister(Target target, int regno) { - Register[] regs = getRegisters(target); - for (int i = 0; i < regs.length; i++) { - if (regs[i].getPosition() == regno) { - return regs[i]; - } - } - return null; - } - - @Override - public void update(Target target) throws CDIException { - MISession mi = target.getMISession(); - CommandFactory factory = mi.getCommandFactory(); - MIDataListChangedRegisters changed = factory.createMIDataListChangedRegisters(); - try { - mi.postCommand(changed); - MIDataListChangedRegistersInfo info = - changed.getMIDataListChangedRegistersInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - int[] regnos = info.getRegisterNumbers(); - List eventList = new ArrayList(regnos.length); - // Now that we know the registers changed - // call -var-update to update the value in gdb. - // And send the notification. - for (int i = 0 ; i < regnos.length; i++) { - Register reg = getRegister(target, regnos[i]); - if (reg != null) { - String varName = reg.getMIVar().getVarName(); - MIVarChange[] changes = noChanges; - MIVarUpdate update = factory.createMIVarUpdate(varName); - try { - mi.postCommand(update); - MIVarUpdateInfo updateInfo = update.getMIVarUpdateInfo(); - if (updateInfo == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - changes = updateInfo.getMIVarChanges(); - } catch (MIException e) { - //throw new MI2CDIException(e); - //eventList.add(new MIVarDeletedEvent(varName)); - } - if (changes.length != 0) { - for (int j = 0 ; j < changes.length; j++) { - String n = changes[j].getVarName(); - if (changes[j].isInScope()) { - eventList.add(new MIVarChangedEvent(mi, n)); - } - } - } else { - // Fall back to the register number. - eventList.add(new MIRegisterChangedEvent(mi, update.getToken(), reg.getName(), regnos[i])); - } - } - } - MIEvent[] events = (MIEvent[])eventList.toArray(new MIEvent[0]); - mi.fireEvents(events); - } catch (MIException e) { - if (!target.isTerminated()) - throw new MI2CDIException(e); - } - } - - private Register[] getRegisters(Target target) { - List regsList = (List)regsMap.get(target); - if (regsList != null) { - return (Register[]) regsList.toArray(new Register[regsList.size()]); - } - return new Register[0]; - } - -// private Variable[] getVariables(Target target) { -// List varList = (List)varsMap.get(target); -// if (varList != null) { -// return (Variable[]) varList.toArray(new Variable[varList.size()]); -// } -// return new Register[0]; -// } - - /** - * Return the Element with this thread/stackframe, and with this name. - * null is return if the element is not in the cache. - */ - private Register findRegister(RegisterDescriptor rd) throws CDIException { - Target target = (Target)rd.getTarget(); - String name = rd.getName(); - String fullName = rd.getFullName(); - int position = rd.getPosition(); - Register[] regs = getRegisters(target); - for (int i = 0; i < regs.length; i++) { - if (regs[i].getName().equals(name) - && regs[i].getFullName().equals(fullName) - && regs[i].getCastingArrayStart() == rd.getCastingArrayStart() - && regs[i].getCastingArrayEnd() == rd.getCastingArrayEnd() - && VariableDescriptor.equalsCasting(regs[i], rd)) { - // check threads - if (regs[i].getPosition() == position) { - return regs[i]; - } - } - } - return null; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Session.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Session.java deleted file mode 100644 index c6888c2a8d6..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Session.java +++ /dev/null @@ -1,236 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi; - -import java.util.Properties; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.ICDISessionConfiguration; -import org.eclipse.cdt.debug.core.cdi.ICDIEventManager; -import org.eclipse.cdt.debug.core.cdi.ICDISession; -import org.eclipse.cdt.debug.core.cdi.ICDISessionObject; -import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent; -import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; -import org.eclipse.cdt.debug.mi.core.MISession; -import org.eclipse.cdt.debug.mi.core.cdi.event.DestroyedEvent; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; - -/** - * @see org.eclipse.cdt.debug.core.cdi.ICDISession - */ -public class Session implements ICDISession, ICDISessionObject { - - public final static Target[] EMPTY_TARGETS = {}; - Properties props; - ProcessManager processManager; - EventManager eventManager; - BreakpointManager breakpointManager; - ExpressionManager expressionManager; - VariableManager variableManager; - RegisterManager registerManager; - MemoryManager memoryManager; - SharedLibraryManager sharedLibraryManager; - SignalManager signalManager; - SourceManager sourceManager; - ICDISessionConfiguration configuration; - - public Session(MISession miSession, ICDISessionConfiguration configuration) { - commonSetup(); - Target target = new Target(this, miSession); - addTargets(new Target[] { target }); - setConfiguration(configuration); - } - - // Why do we need this? - public Session(MISession miSession, boolean attach) { - this(miSession); - } - - public Session(MISession miSession) { - commonSetup(); - Target target = new Target(this, miSession); - addTargets(new Target[] { target }); - setConfiguration(new SessionConfiguration(this)); - } - - private void commonSetup() { - props = new Properties(); - processManager = new ProcessManager(this); - breakpointManager = new BreakpointManager(this); - eventManager = new EventManager(this); - expressionManager = new ExpressionManager(this); - variableManager = new VariableManager(this); - registerManager = new RegisterManager(this); - memoryManager = new MemoryManager(this); - signalManager = new SignalManager(this); - sourceManager = new SourceManager(this); - sharedLibraryManager = new SharedLibraryManager(this); - } - - public void addTargets(Target[] targets) { - ProcessManager pMgr = getProcessManager(); - pMgr.addTargets(targets); - } - - public void removeTargets(Target[] targets) { - ProcessManager pMgr = getProcessManager(); - pMgr.removeTargets(targets); - } - - public Target getTarget(MISession miSession) { - ProcessManager pMgr = getProcessManager(); - return pMgr.getTarget(miSession); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDISession#getAttribute(String) - */ - @Override - public String getAttribute(String key) { - return props.getProperty(key); - } - - public ProcessManager getProcessManager() { - return processManager; - } - - public BreakpointManager getBreakpointManager() { - return breakpointManager; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDISession#getEventManager() - */ - @Override - public ICDIEventManager getEventManager() { - return eventManager; - } - - public ExpressionManager getExpressionManager() { - return expressionManager; - } - - public VariableManager getVariableManager() { - return variableManager; - } - - public RegisterManager getRegisterManager() { - return registerManager; - } - - public SharedLibraryManager getSharedLibraryManager() { - return sharedLibraryManager; - } - - public MemoryManager getMemoryManager() { - return memoryManager; - } - - public SignalManager getSignalManager() { - return signalManager; - } - - public SourceManager getSourceManager() { - return sourceManager; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDISession#getTargets() - */ - @Override - public ICDITarget[] getTargets() { - ProcessManager pMgr = getProcessManager(); - return pMgr.getCDITargets(); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDISession#setAttribute(String, String) - */ - @Override - public void setAttribute(String key, String value) { - props.setProperty(key, value); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDISession#getConfiguration() - */ - @Override - public ICDISessionConfiguration getConfiguration() { - return configuration; - } - - public void setConfiguration(ICDISessionConfiguration conf) { - configuration = conf; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDISessionObject#getSession() - */ - @Override - public ICDISession getSession() { - return this; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDISession#terminate(ICDITarget) - */ - @Override - public void terminate() throws CDIException { - ProcessManager pMgr = getProcessManager(); - Target[] targets = pMgr.getTargets(); - for (int i = 0; i < targets.length; ++i) { - if (!targets[i].getMISession().isTerminated()) { - targets[i].getMISession().terminate(); - } - } - // Do not do the removeTargets(), Target.getMISession().terminate() will do it - // via an event, MIGDBExitEvent of the mi session - //removeTargets(targets); - - // wait ~2 seconds for the targets to be terminated. - for (int i = 0; i < 2; ++i) { - targets = pMgr.getTargets(); - if (targets.length == 0) { - break; - } - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - // - } - } - // send our goodbyes. - EventManager eMgr = (EventManager)getEventManager(); - eMgr.fireEvents(new ICDIEvent[] { new DestroyedEvent(this) }); - eMgr.removeEventListeners(); - } - - /** - * @deprecated - * @see org.eclipse.cdt.debug.core.cdi.ICDISession#getSessionProcess() - */ - @Deprecated - @Override - public Process getSessionProcess() throws CDIException { - ICDITarget[] targets = getTargets(); - if (targets != null && targets.length > 0) { - return getSessionProcess(targets[0]); - } - return null; - } - - public Process getSessionProcess(ICDITarget target) { - MISession miSession = ((Target)target).getMISession(); - return miSession.getSessionProcess(); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SessionConfiguration.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SessionConfiguration.java deleted file mode 100644 index 6a071ac1da1..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SessionConfiguration.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi; - -import org.eclipse.cdt.debug.core.cdi.ICDISessionConfiguration; - -/** - * @author User - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates - */ -public class SessionConfiguration extends SessionObject implements - ICDISessionConfiguration { - - /** - * @param session - */ - public SessionConfiguration(Session session) { - super(session); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.ICDISessionConfiguration#terminateSessionOnExit() - */ - @Override - public boolean terminateSessionOnExit() { - return true; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SessionObject.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SessionObject.java deleted file mode 100644 index 08435085090..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SessionObject.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi; - -import org.eclipse.cdt.debug.core.cdi.ICDISession; -import org.eclipse.cdt.debug.core.cdi.ICDISessionObject; - -/** - */ -public class SessionObject implements ICDISessionObject { - - private Session fSession; - - public SessionObject (Session session) { - fSession = session; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDISessionObject#getSession() - */ - @Override - public ICDISession getSession() { - return fSession; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SharedLibraryEvent.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SharedLibraryEvent.java deleted file mode 100644 index 97d8ebe4c7a..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SharedLibraryEvent.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi; - -import org.eclipse.cdt.debug.core.cdi.ICDISharedLibraryEvent; - -public class SharedLibraryEvent extends SessionObject implements ICDISharedLibraryEvent { - - public SharedLibraryEvent(Session session) { - super(session); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SharedLibraryManager.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SharedLibraryManager.java deleted file mode 100644 index c34c06b86b2..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SharedLibraryManager.java +++ /dev/null @@ -1,443 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi; - -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.List; -import java.util.Map; -import java.util.Set; -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint; -import org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary; -import org.eclipse.cdt.debug.core.cdi.model.ICDITargetConfiguration; -import org.eclipse.cdt.debug.mi.core.IMIConstants; -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.MIFormat; -import org.eclipse.cdt.debug.mi.core.MIPlugin; -import org.eclipse.cdt.debug.mi.core.MISession; -import org.eclipse.cdt.debug.mi.core.RxThread; -import org.eclipse.cdt.debug.mi.core.cdi.model.Breakpoint; -import org.eclipse.cdt.debug.mi.core.cdi.model.EventBreakpoint; -import org.eclipse.cdt.debug.mi.core.cdi.model.LocationBreakpoint; -import org.eclipse.cdt.debug.mi.core.cdi.model.SharedLibrary; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; -import org.eclipse.cdt.debug.mi.core.cdi.model.Watchpoint; -import org.eclipse.cdt.debug.mi.core.command.CLIInfoSharedLibrary; -import org.eclipse.cdt.debug.mi.core.command.CLISharedLibrary; -import org.eclipse.cdt.debug.mi.core.command.CommandFactory; -import org.eclipse.cdt.debug.mi.core.command.MIGDBSetAutoSolib; -import org.eclipse.cdt.debug.mi.core.command.MIGDBSetSolibSearchPath; -import org.eclipse.cdt.debug.mi.core.command.MIGDBSetStopOnSolibEvents; -import org.eclipse.cdt.debug.mi.core.command.MIGDBShow; -import org.eclipse.cdt.debug.mi.core.command.MIGDBShowSolibSearchPath; -import org.eclipse.cdt.debug.mi.core.command.MIInfoSharedLibrary; -import org.eclipse.cdt.debug.mi.core.event.MIBreakpointCreatedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIEvent; -import org.eclipse.cdt.debug.mi.core.event.MISharedLibChangedEvent; -import org.eclipse.cdt.debug.mi.core.event.MISharedLibCreatedEvent; -import org.eclipse.cdt.debug.mi.core.event.MISharedLibUnloadedEvent; -import org.eclipse.cdt.debug.mi.core.output.CLIInfoSharedLibraryInfo; -import org.eclipse.cdt.debug.mi.core.output.MIBreakpoint; -import org.eclipse.cdt.debug.mi.core.output.MIGDBShowInfo; -import org.eclipse.cdt.debug.mi.core.output.MIGDBShowSolibSearchPathInfo; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIInfoSharedLibraryInfo; -import org.eclipse.cdt.debug.mi.core.output.MIShared; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; - -/** - * Manager of the CDI shared libraries. - */ -public class SharedLibraryManager extends Manager { - - ICDISharedLibrary[] EMPTY_SHAREDLIB = {}; - Map sharedMap; - Set autoLoadSet; - boolean isDeferred = true; - - public SharedLibraryManager (Session session) { - super(session, true); - sharedMap = new Hashtable(); - autoLoadSet = new HashSet(); - setAutoUpdate( MIPlugin.getDefault().getPluginPreferences().getBoolean( IMIConstants.PREF_SHARED_LIBRARIES_AUTO_REFRESH ) ); - } - - synchronized List getSharedList(Target target) { - List sharedList = (List)sharedMap.get(target); - if (sharedList == null) { - sharedList = Collections.synchronizedList(new ArrayList()); - sharedMap.put(target, sharedList); - } - return sharedList; - } - - MIShared[] getMIShareds(MISession miSession) throws CDIException { - MIShared[] miLibs = new MIShared[0]; - CommandFactory factory = miSession.getCommandFactory(); - MIInfoSharedLibrary infoSharedMI = factory.createMIInfoSharedLibrary(); - - if (infoSharedMI != null) - { - try { - RxThread rxThread = miSession.getRxThread(); - rxThread.setEnableConsole(false); - miSession.postCommand(infoSharedMI); - MIInfoSharedLibraryInfo info = infoSharedMI.getMIInfoSharedLibraryInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - miLibs = info.getMIShared(); - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - else - { - - CLIInfoSharedLibrary infoShared = factory.createCLIInfoSharedLibrary(); - try { - RxThread rxThread = miSession.getRxThread(); - rxThread.setEnableConsole(false); - miSession.postCommand(infoShared); - CLIInfoSharedLibraryInfo info = infoShared.getMIInfoSharedLibraryInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - miLibs = info.getMIShared(); - } catch (MIException e) { - throw new MI2CDIException(e); - } finally { - RxThread rxThread = miSession.getRxThread(); - rxThread.setEnableConsole(true); - } - - } - return miLibs; - } - - @Override - public void update(Target target) throws CDIException { - MISession miSession = target.getMISession(); - Session session = (Session)target.getSession(); - List eventList = updateState(target); - // A new Libraries loaded or something change, try to set the breakpoints. - if (eventList.size() > 0) { - BreakpointManager bpMgr = session.getBreakpointManager(); - ICDIBreakpoint bpoints[] = null; - try { - bpoints = bpMgr.getDeferredBreakpoints(target); - } catch (CDIException e) { - bpoints = new ICDIBreakpoint[0]; - } - for (int i = 0; i < bpoints.length; i++) { - if (bpoints[i] instanceof Breakpoint) { - Breakpoint bkpt = (Breakpoint)bpoints[i]; - try { - boolean enable = bkpt.isEnabled(); - if (bkpt instanceof LocationBreakpoint) { - bpMgr.setLocationBreakpoint((LocationBreakpoint)bkpt); - } else if (bkpt instanceof Watchpoint) { - bpMgr.setWatchpoint((Watchpoint)bkpt); - } else if (bkpt instanceof EventBreakpoint) { - bpMgr.setEventBreakpoint((EventBreakpoint)bkpt); - } else { - throw new CDIException(); - } - bpMgr.deleteFromDeferredList(bkpt); - bpMgr.addToBreakpointList(bkpt); - // If the breakpoint was disable in the IDE - // install it but keep it disable - if (!enable) { - bpMgr.disableBreakpoint(bkpt); - } - MIBreakpoint[] miBreakpoints = bkpt.getMIBreakpoints(); - if (miBreakpoints != null && miBreakpoints.length > 0) { - eventList.add(new MIBreakpointCreatedEvent(miSession, miBreakpoints[0].getNumber())); - } - } catch (CDIException e) { - // ignore - } - } - } - } - MIEvent[] events = (MIEvent[])eventList.toArray(new MIEvent[0]); - miSession.fireEvents(events); - } - - private List updateState(Target target) throws CDIException { - MISession miSession = target.getMISession(); - ICDITargetConfiguration conf = target.getConfiguration(); - if (!conf.supportsSharedLibrary()) { - return Collections.EMPTY_LIST; // Bail out early; - } - - MIShared[] miLibs = getMIShareds(miSession); - ArrayList newLibList = new ArrayList(); - ArrayList eventList = new ArrayList(miLibs.length); - for (int i = 0; i < miLibs.length; i++) { - SharedLibrary sharedlib = getSharedLibrary(target, miLibs[i].getName()); - if (sharedlib != null) { - if (hasSharedLibChanged(sharedlib, miLibs[i])) { - // Fire ChangedEvent - sharedlib.setMIShared(miLibs[i]); - eventList.add(new MISharedLibChangedEvent(miSession, miLibs[i].getName())); - } - } else { - // add the new breakpoint and fire CreatedEvent - List sharedList = getSharedList(target); - SharedLibrary lib = new SharedLibrary(target, miLibs[i]); - sharedList.add(lib); - newLibList.add(lib); - eventList.add(new MISharedLibCreatedEvent(miSession, miLibs[i].getName())); - } - } - // Check if any libraries was unloaded. - List sharedList = (List)sharedMap.get(target); - if (sharedList != null) { - SharedLibrary[] oldlibs = (SharedLibrary[]) sharedList.toArray(new SharedLibrary[sharedList.size()]); - for (int i = 0; i < oldlibs.length; i++) { - boolean found = false; - for (int j = 0; j < miLibs.length; j++) { - if (miLibs[j].getName().equals(oldlibs[i].getFileName())) { - found = true; - break; - } - } - if (!found) { - // Fire destroyed Events. - eventList.add(new MISharedLibUnloadedEvent(miSession, oldlibs[i].getFileName())); - } - } - } - eventList.addAll(autoLoadSymbols(target, (SharedLibrary[])newLibList.toArray(new SharedLibrary[newLibList.size()]))); - return eventList; - } - - public boolean hasSharedLibChanged(SharedLibrary lib, MIShared miLib) { - return !miLib.getName().equals(lib.getFileName()) || - !MIFormat.getBigInteger(miLib.getFrom()).equals(lib.getStartAddress()) || - !MIFormat.getBigInteger(miLib.getTo()).equals(lib.getEndAddress()) || - miLib.isRead() != lib.areSymbolsLoaded(); - } - - /* - * this for the events - */ - public void deleteSharedLibrary(MISession miSession, SharedLibrary lib) { - Target target = ((Session)getSession()).getTarget(miSession); - List sharedList = (List)sharedMap.get(target); - if (sharedList != null) { - sharedList.remove(lib); - } - } - - public SharedLibrary getSharedLibrary(MISession miSession, String name) { - Target target = ((Session)getSession()).getTarget(miSession); - return getSharedLibrary(target, name); - } - public SharedLibrary getSharedLibrary(Target target, String name) { - List sharedList = (List)sharedMap.get(target); - if (sharedList != null) { - SharedLibrary[] libs = (SharedLibrary[]) sharedList.toArray(new SharedLibrary[sharedList.size()]); - for (int i = 0; i < libs.length; i++) { - if (name.equals(libs[i].getFileName())) { - return libs[i]; - } - } - } - return null; - } - - public void setDeferredBreakpoint(Target target, boolean set) { - target.deferBreakpoints( set ); - } - - public boolean isDeferredBreakpoint(Target target) { - return target.areBreakpointsDeferred(); - } - - public void setAutoLoadSymbols(Target target, boolean set) throws CDIException { - MISession mi = target.getMISession(); - CommandFactory factory = mi.getCommandFactory(); - MIGDBSetAutoSolib solib = factory.createMIGDBSetAutoSolib(set); - try { - mi.postCommand(solib); - solib.getMIInfo(); - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - - public boolean isAutoLoadSymbols(Target target) throws CDIException { - MISession mi = target.getMISession(); - CommandFactory factory = mi.getCommandFactory(); - MIGDBShow show = factory.createMIGDBShow(new String[]{"auto-solib-add"}); //$NON-NLS-1$ - try { - mi.postCommand(show); - MIGDBShowInfo info = show.getMIGDBShowInfo(); - String value = info.getValue(); - if (value != null) { - return value.equalsIgnoreCase("on"); //$NON-NLS-1$ - } - } catch (MIException e) { - throw new MI2CDIException(e); - } - return false; - } - - public void setStopOnSolibEvents(Target target, boolean set) throws CDIException { - MISession mi = target.getMISession(); - CommandFactory factory = mi.getCommandFactory(); - MIGDBSetStopOnSolibEvents stop = factory.createMIGDBSetStopOnSolibEvents(set); - try { - mi.postCommand(stop); - stop.getMIInfo(); - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - - public boolean isStopOnSolibEvents(Target target) throws CDIException { - MISession mi = target.getMISession(); - CommandFactory factory = mi.getCommandFactory(); - MIGDBShow show = factory.createMIGDBShow(new String[]{"stop-on-solib-events"}); //$NON-NLS-1$ - try { - mi.postCommand(show); - MIGDBShowInfo info = show.getMIGDBShowInfo(); - String value = info.getValue(); - if (value != null) { - return value.equalsIgnoreCase("1"); //$NON-NLS-1$ - } - } catch (MIException e) { - throw new MI2CDIException(e); - } - return false; - } - - public void setSharedLibraryPaths(Target target, String[] libPaths) throws CDIException { - MISession mi = target.getMISession(); - CommandFactory factory = mi.getCommandFactory(); - MIGDBSetSolibSearchPath solib = factory.createMIGDBSetSolibSearchPath(libPaths); - try { - mi.postCommand(solib); - solib.getMIInfo(); - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - - public String[] getSharedLibraryPaths(Target target) throws CDIException { - MISession mi = target.getMISession(); - CommandFactory factory = mi.getCommandFactory(); - MIGDBShowSolibSearchPath dir = factory.createMIGDBShowSolibSearchPath(); - try { - mi.postCommand(dir); - MIGDBShowSolibSearchPathInfo info = dir.getMIGDBShowSolibSearchPathInfo(); - return info.getDirectories(); - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - - public ICDISharedLibrary[] getSharedLibraries(Target target) throws CDIException { - List sharedList = (List)sharedMap.get(target); - if (sharedList != null) { - return (ICDISharedLibrary[]) sharedList.toArray(new ICDISharedLibrary[sharedList.size()]); - } - return EMPTY_SHAREDLIB; - } - - public void loadSymbols(Target target) throws CDIException { - MISession mi = target.getMISession(); - CommandFactory factory = mi.getCommandFactory(); - CLISharedLibrary sharedlibrary = factory.createCLISharedLibrary(); - try { - mi.postCommand(sharedlibrary); - MIInfo info = sharedlibrary.getMIInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - } catch (MIException e) { - throw new MI2CDIException(e); - } - update(target); - } - - public void loadSymbols(Target target, ICDISharedLibrary[] libs) throws CDIException { - MISession miSession = target.getMISession(); - CommandFactory factory = miSession.getCommandFactory(); - for (int i = 0; i < libs.length; i++) { - if (libs[i].areSymbolsLoaded()) { - continue; - } - CLISharedLibrary sharedlibrary = factory.createCLISharedLibrary(libs[i].getFileName()); - try { - miSession.postCommand(sharedlibrary); - MIInfo info = sharedlibrary.getMIInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - } catch (MIException e) { - throw new MI2CDIException(e); - } - // Do not do this, error are not propagate by the CLI "shared command - // So we have to manually recheck all the shared with "info shared" - //((SharedLibrary)libs[i]).getMIShared().setSymbolsRead(true); - //mi.fireEvent(new MISharedLibChangedEvent(libs[i].getFileName())); - update(target); - } - } - - public boolean supportsAutoLoadSymbols() { - return true; - } - - public boolean supportsStopOnSolibEvents() { - return true; - } - - public void autoLoadSymbols( File[] libs ) { - autoLoadSet.addAll( Arrays.asList( libs ) ); - } - - private List autoLoadSymbols(Target target, SharedLibrary[] libs) throws CDIException { - ArrayList eventList = new ArrayList(libs.length); - MISession miSession = target.getMISession(); - CommandFactory factory = miSession.getCommandFactory(); - for (int i = 0; i < libs.length; i++) { - IPath path = new Path( libs[i].getFileName() ); - File file = new File( path.lastSegment() ); - if (libs[i].areSymbolsLoaded() || !autoLoadSet.contains(file)) { - continue; - } - CLISharedLibrary sharedlibrary = factory.createCLISharedLibrary(libs[i].getFileName()); - try { - miSession.postCommand(sharedlibrary); - MIInfo info = sharedlibrary.getMIInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - } catch (MIException e) { - throw new MI2CDIException(e); - } - libs[i].getMIShared().setSymbolsRead( true ); - eventList.add(new MISharedLibChangedEvent(miSession, libs[i].getFileName())); - } - return eventList; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SignalExitInfo.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SignalExitInfo.java deleted file mode 100644 index 89a6512b169..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SignalExitInfo.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi; - -import org.eclipse.cdt.debug.core.cdi.ICDISignalExitInfo; -import org.eclipse.cdt.debug.mi.core.event.MIInferiorSignalExitEvent; - -/**. - */ -public class SignalExitInfo extends SessionObject implements ICDISignalExitInfo { - - MIInferiorSignalExitEvent event; - - public SignalExitInfo(Session session, MIInferiorSignalExitEvent e) { - super(session); - event = e; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDISignalExitInfo#getName() - */ - @Override - public String getName() { - return event.getName(); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDISignalExitInfo#getDescription() - */ - @Override - public String getDescription() { - return event.getMeaning(); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SignalManager.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SignalManager.java deleted file mode 100644 index 12a8273ccf1..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SignalManager.java +++ /dev/null @@ -1,217 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Hashtable; -import java.util.List; -import java.util.Map; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.ICDISignal; -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.MISession; -import org.eclipse.cdt.debug.mi.core.RxThread; -import org.eclipse.cdt.debug.mi.core.cdi.model.Signal; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; -import org.eclipse.cdt.debug.mi.core.command.CommandFactory; -import org.eclipse.cdt.debug.mi.core.command.CLIHandle; -import org.eclipse.cdt.debug.mi.core.command.CLIInfoSignals; -import org.eclipse.cdt.debug.mi.core.event.MIEvent; -import org.eclipse.cdt.debug.mi.core.event.MISignalChangedEvent; -import org.eclipse.cdt.debug.mi.core.output.CLIInfoSignalsInfo; -import org.eclipse.cdt.debug.mi.core.output.MISigHandle; - -/** - */ -public class SignalManager extends Manager { - - ICDISignal[] EMPTY_SIGNALS = {}; - MISigHandle[] noSigs = new MISigHandle[0]; - Map signalsMap; - - public SignalManager(Session session) { - super(session, false); - signalsMap = new Hashtable(); - } - - synchronized List getSignalsList(Target target) { - List signalsList = (List)signalsMap.get(target); - if (signalsList == null) { - signalsList = Collections.synchronizedList(new ArrayList()); - signalsMap.put(target, signalsList); - } - return signalsList; - } - - MISigHandle[] getMISignals(MISession miSession) throws CDIException { - MISigHandle[] miSigs; - CommandFactory factory = miSession.getCommandFactory(); - CLIInfoSignals sigs = factory.createCLIInfoSignals(); - try { - RxThread rxThread = miSession.getRxThread(); - rxThread.setEnableConsole(false); - miSession.postCommand(sigs); - CLIInfoSignalsInfo info = sigs.getMIInfoSignalsInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - miSigs = info.getMISignals(); - } catch (MIException e) { - throw new MI2CDIException(e); - } finally { - RxThread rxThread = miSession.getRxThread(); - rxThread.setEnableConsole(true); - } - return miSigs; - } - - MISigHandle getMISignal(MISession miSession, String name) throws CDIException { - MISigHandle sig = null; - CommandFactory factory = miSession.getCommandFactory(); - CLIInfoSignals sigs = factory.createCLIInfoSignals(name); - try { - RxThread rxThread = miSession.getRxThread(); - rxThread.setEnableConsole(false); - miSession.postCommand(sigs); - CLIInfoSignalsInfo info = sigs.getMIInfoSignalsInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - MISigHandle[] miSigs = info.getMISignals(); - if (miSigs.length > 0) { - sig = miSigs[0]; - } - } catch (MIException e) { - throw new MI2CDIException(e); - } finally { - RxThread rxThread = miSession.getRxThread(); - rxThread.setEnableConsole(true); - } - return sig; - } - - /** - * Method hasSignalChanged. - * @param sig - * @param mISignal - * @return boolean - */ - private boolean hasSignalChanged(ICDISignal sig, MISigHandle miSignal) { - return !sig.getName().equals(miSignal.getName()) || - sig.isStopSet() != miSignal.isStop() || - sig.isIgnore() != !miSignal.isPass(); - } - - protected ICDISignal findSignal(Target target, String name) { - ICDISignal sig = null; - List signalsList = (List) signalsMap.get(target); - if (signalsList != null) { - ICDISignal[] sigs = (ICDISignal[])signalsList.toArray(new ICDISignal[0]); - for (int i = 0; i < sigs.length; i++) { - if (sigs[i].getName().equals(name)) { - sig = sigs[i]; - break; - } - } - } - return sig; - } - - public ICDISignal getSignal(MISession miSession, String name) { - Session session = (Session)getSession(); - Target target = session.getTarget(miSession); - return getSignal(target, name); - } - public ICDISignal getSignal(Target target, String name) { - ICDISignal sig = findSignal(target, name); - if (sig == null) { - MISigHandle miSig = null; - try { - miSig = getMISignal(target.getMISession(), name); - sig = new Signal(target, miSig); - List signalsList = getSignalsList(target); - signalsList.add(sig); - } catch (CDIException e) { - // The session maybe terminated because of the signal. - miSig = new MISigHandle(name, false, false, false, name); - sig = new Signal(target, miSig); - } - } - return sig; - } - - public void handle(Signal sig, boolean isIgnore, boolean isStop) throws CDIException { - Target target = (Target)sig.getTarget(); - MISession miSession = target.getMISession(); - CommandFactory factory = miSession.getCommandFactory(); - StringBuffer buffer = new StringBuffer(sig.getName()); - buffer.append(" "); //$NON-NLS-1$ - if (isIgnore) { - buffer.append("ignore"); //$NON-NLS-1$ - } else { - buffer.append("noignore"); //$NON-NLS-1$ - } - buffer.append(" "); //$NON-NLS-1$ - if (isStop) { - buffer.append("stop"); //$NON-NLS-1$ - } else { - buffer.append("nostop"); //$NON-NLS-1$ - } - CLIHandle handle = factory.createCLIHandle(buffer.toString()); - try { - miSession.postCommand(handle); - handle.getMIInfo(); - } catch (MIException e) { - throw new MI2CDIException(e); - } - sig.getMISignal().handle(isIgnore, isStop); - miSession.fireEvent(new MISignalChangedEvent(miSession, sig.getName())); - } - - public ICDISignal[] getSignals(Target target) throws CDIException { - List signalsList = (List)signalsMap.get(target); - if (signalsList == null) { - update(target); - } - signalsList = (List)signalsMap.get(target); - if (signalsList != null) { - return (ICDISignal[])signalsList.toArray(new ICDISignal[0]); - } - return EMPTY_SIGNALS; - } - - @Override - public void update(Target target) throws CDIException { - MISession miSession = target.getMISession(); - MISigHandle[] miSigs = getMISignals(miSession); - List eventList = new ArrayList(miSigs.length); - List signalsList = getSignalsList(target); - for (int i = 0; i < miSigs.length; i++) { - ICDISignal sig = findSignal(target, miSigs[i].getName()); - if (sig != null) { - if (hasSignalChanged(sig, miSigs[i])) { - // Fire ChangedEvent - ((Signal)sig).setMISignal(miSigs[i]); - eventList.add(new MISignalChangedEvent(miSession, miSigs[i].getName())); - } - } else { - // add the new breakpoint and fire CreatedEvent - signalsList.add(new Signal(target, miSigs[i])); - //eventList.add(new MISignCreatedEvent(miSession, miSigs[i].getName())); - } - } - MIEvent[] events = (MIEvent[])eventList.toArray(new MIEvent[0]); - miSession.fireEvents(events); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SignalReceived.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SignalReceived.java deleted file mode 100644 index ddefd728a2b..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SignalReceived.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi; - -import org.eclipse.cdt.debug.core.cdi.ICDISignalReceived; -import org.eclipse.cdt.debug.core.cdi.model.ICDISignal; -import org.eclipse.cdt.debug.mi.core.event.MISignalEvent; - -/** - */ -public class SignalReceived extends SessionObject implements ICDISignalReceived { - - ICDISignal signal; - public SignalReceived(Session session, MISignalEvent event) { - super(session); - SignalManager mgr = session.getSignalManager(); - signal = mgr.getSignal(event.getMISession(), event.getName()); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDISignalReceived#getSignal() - */ - @Override - public ICDISignal getSignal() { - return signal; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SourceManager.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SourceManager.java deleted file mode 100644 index af376136422..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SourceManager.java +++ /dev/null @@ -1,503 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - * Alena Laskavaia (QNX) - Bug 221224 - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi; - -import java.math.BigInteger; -import java.util.StringTokenizer; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction; -import org.eclipse.cdt.debug.core.cdi.model.ICDIMixedInstruction; -import org.eclipse.cdt.debug.mi.core.GDBTypeParser; -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.MISession; -import org.eclipse.cdt.debug.mi.core.RxThread; -import org.eclipse.cdt.debug.mi.core.GDBTypeParser.GDBDerivedType; -import org.eclipse.cdt.debug.mi.core.GDBTypeParser.GDBType; -import org.eclipse.cdt.debug.mi.core.cdi.model.Instruction; -import org.eclipse.cdt.debug.mi.core.cdi.model.MixedInstruction; -import org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; -import org.eclipse.cdt.debug.mi.core.cdi.model.Thread; -import org.eclipse.cdt.debug.mi.core.cdi.model.type.ArrayType; -import org.eclipse.cdt.debug.mi.core.cdi.model.type.BoolType; -import org.eclipse.cdt.debug.mi.core.cdi.model.type.CharType; -import org.eclipse.cdt.debug.mi.core.cdi.model.type.DerivedType; -import org.eclipse.cdt.debug.mi.core.cdi.model.type.DoubleType; -import org.eclipse.cdt.debug.mi.core.cdi.model.type.EnumType; -import org.eclipse.cdt.debug.mi.core.cdi.model.type.FloatType; -import org.eclipse.cdt.debug.mi.core.cdi.model.type.FunctionType; -import org.eclipse.cdt.debug.mi.core.cdi.model.type.IntType; -import org.eclipse.cdt.debug.mi.core.cdi.model.type.LongLongType; -import org.eclipse.cdt.debug.mi.core.cdi.model.type.LongType; -import org.eclipse.cdt.debug.mi.core.cdi.model.type.PointerType; -import org.eclipse.cdt.debug.mi.core.cdi.model.type.ReferenceType; -import org.eclipse.cdt.debug.mi.core.cdi.model.type.ShortType; -import org.eclipse.cdt.debug.mi.core.cdi.model.type.StructType; -import org.eclipse.cdt.debug.mi.core.cdi.model.type.Type; -import org.eclipse.cdt.debug.mi.core.cdi.model.type.VoidType; -import org.eclipse.cdt.debug.mi.core.cdi.model.type.WCharType; -import org.eclipse.cdt.debug.mi.core.command.CommandFactory; -import org.eclipse.cdt.debug.mi.core.command.MIDataDisassemble; -import org.eclipse.cdt.debug.mi.core.command.MIEnvironmentDirectory; -import org.eclipse.cdt.debug.mi.core.command.MIGDBShowDirectories; -import org.eclipse.cdt.debug.mi.core.command.CLIPType; -import org.eclipse.cdt.debug.mi.core.command.CLIWhatis; -import org.eclipse.cdt.debug.mi.core.output.MIAsm; -import org.eclipse.cdt.debug.mi.core.output.MIDataDisassembleInfo; -import org.eclipse.cdt.debug.mi.core.output.MIGDBShowDirectoriesInfo; -import org.eclipse.cdt.debug.mi.core.output.CLIPTypeInfo; -import org.eclipse.cdt.debug.mi.core.output.MISrcAsm; -import org.eclipse.cdt.debug.mi.core.output.CLIWhatisInfo; - - -/** - */ -public class SourceManager extends Manager { - - GDBTypeParser gdbTypeParser; - - public SourceManager(Session session) { - super(session, false); - gdbTypeParser = new GDBTypeParser(); - } - - public void setSourcePaths(Target target, String[] dirs) throws CDIException { - MISession mi = target.getMISession(); - CommandFactory factory = mi.getCommandFactory(); - MIEnvironmentDirectory dir = factory.createMIEnvironmentDirectory(true, dirs); - try { - mi.postCommand(dir); - dir.getMIInfo(); - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - - public String[] getSourcePaths(Target target) throws CDIException { - MISession mi = target.getMISession(); - CommandFactory factory = mi.getCommandFactory(); - MIGDBShowDirectories dir = factory.createMIGDBShowDirectories(); - try { - mi.postCommand(dir); - MIGDBShowDirectoriesInfo info = dir.getMIGDBShowDirectoriesInfo(); - return info.getDirectories(); - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - - public ICDIInstruction[] getInstructions(Target target, String filename, int linenum) throws CDIException { - return getInstructions(target, filename, linenum, -1); - } - - public ICDIInstruction[] getInstructions(Target target, String filename, int linenum, int lines) throws CDIException { - MISession mi = target.getMISession(); - CommandFactory factory = mi.getCommandFactory(); - MIDataDisassemble dis = factory.createMIDataDisassemble(filename, linenum, lines, false); - try { - mi.postCommand(dis); - MIDataDisassembleInfo info = dis.getMIDataDisassembleInfo(); - MIAsm[] asm = info.getMIAsms(); - Instruction[] instructions = new Instruction[asm.length]; - for (int i = 0; i < instructions.length; i++) { - instructions[i] = new Instruction(target, asm[i]); - } - return instructions; - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - - public ICDIInstruction[] getInstructions(Target target, BigInteger start, BigInteger end) throws CDIException { - MISession mi = target.getMISession(); - CommandFactory factory = mi.getCommandFactory(); - String hex = "0x"; //$NON-NLS-1$ - String sa = hex + start.toString(16); - String ea = hex + end.toString(16); - MIDataDisassemble dis = factory.createMIDataDisassemble(sa, ea, false); - try { - mi.postCommand(dis); - MIDataDisassembleInfo info = dis.getMIDataDisassembleInfo(); - MIAsm[] asm = info.getMIAsms(); - Instruction[] instructions = new Instruction[asm.length]; - for (int i = 0; i < instructions.length; i++) { - instructions[i] = new Instruction(target, asm[i]); - } - return instructions; - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - - public ICDIMixedInstruction[] getMixedInstructions(Target target, String filename, int linenum) throws CDIException { - return getMixedInstructions(target, filename, linenum, -1); - } - - public ICDIMixedInstruction[] getMixedInstructions(Target target, String filename, int linenum, int lines) throws CDIException { - MISession mi = target.getMISession(); - CommandFactory factory = mi.getCommandFactory(); - MIDataDisassemble dis = factory.createMIDataDisassemble(filename, linenum, lines, true); - try { - mi.postCommand(dis); - MIDataDisassembleInfo info = dis.getMIDataDisassembleInfo(); - MISrcAsm[] srcAsm = info.getMISrcAsms(); - ICDIMixedInstruction[] mixed = new ICDIMixedInstruction[srcAsm.length]; - for (int i = 0; i < mixed.length; i++) { - mixed[i] = new MixedInstruction(target, srcAsm[i]); - } - return mixed; - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - - public ICDIMixedInstruction[] getMixedInstructions(Target target, BigInteger start, BigInteger end) throws CDIException { - MISession mi = target.getMISession(); - CommandFactory factory = mi.getCommandFactory(); - String hex = "0x"; //$NON-NLS-1$ - String sa = hex + start.toString(16); - String ea = hex + end.toString(16); - MIDataDisassemble dis = factory.createMIDataDisassemble(sa, ea, true); - try { - mi.postCommand(dis); - MIDataDisassembleInfo info = dis.getMIDataDisassembleInfo(); - MISrcAsm[] srcAsm = info.getMISrcAsms(); - ICDIMixedInstruction[] mixed = new ICDIMixedInstruction[srcAsm.length]; - for (int i = 0; i < mixed.length; i++) { - mixed[i] = new MixedInstruction(target, srcAsm[i]); - } - return mixed; - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - - @Override - public void update(Target target) throws CDIException { - } - - public Type getType(Target target, String name) throws CDIException { - if (name == null) { - name = new String(); - } - String typename = name.trim(); - - // Parse the string. - GDBType gdbType = gdbTypeParser.parse(typename); - Type headType = null; - Type type = null; - - // Convert the GDBType to an ICDIType. - // So we go through the gdbType tree and reconstruct an ICDIType tree - for (Type aType = null; gdbType != null; type = aType) { - if (gdbType instanceof GDBDerivedType) { - switch(gdbType.getType()) { - case GDBType.ARRAY: - int d = ((GDBDerivedType)gdbType).getDimension(); - aType = new ArrayType(target, gdbType.toString(), d); - break; - case GDBType.FUNCTION: - aType = new FunctionType(target, gdbType.toString()); - break; - case GDBType.POINTER: - aType = new PointerType(target, gdbType.toString()); - break; - case GDBType.REFERENCE: - aType = new ReferenceType(target, gdbType.toString()); - break; - } - gdbType = ((GDBDerivedType)gdbType).getChild(); - } else { - aType = toCDIType(target, gdbType.toString()); - gdbType = null; - } - if (type instanceof DerivedType) { - ((DerivedType)type).setComponentType(aType); - } - // Save the head to returning it. - if (headType == null) { - headType = aType; - } - } - - if (headType != null) { - return headType; - } - throw new CDIException(CdiResources.getString("cdi.SourceManager.Unknown_type")); //$NON-NLS-1$ - } - - Type toCDIType(Target target, String name) throws CDIException { - // Check the derived types and agregate types - if (name == null) { - name = new String(); - } - String typename = name.trim(); - - // Check the primitives. - if (typename.equals("char")) { //$NON-NLS-1$ - return new CharType(target, typename); - } else if (typename.equals("wchar_t")) { //$NON-NLS-1$ - return new WCharType(target, typename); - } else if (typename.equals("short")) { //$NON-NLS-1$ - return new ShortType(target, typename); - } else if (typename.equals("int")) { //$NON-NLS-1$ - return new IntType(target, typename); - } else if (typename.equals("long")) { //$NON-NLS-1$ - return new LongType(target, typename); - } else if (typename.equals("unsigned")) { //$NON-NLS-1$ - return new IntType(target, typename, true); - } else if (typename.equals("signed")) { //$NON-NLS-1$ - return new IntType(target, typename); - } else if (typename.equals("bool")) { //$NON-NLS-1$ - return new BoolType(target, typename); - } else if (typename.equals("_Bool")) { //$NON-NLS-1$ - return new BoolType(target, typename); - } else if (typename.equals("float")) { //$NON-NLS-1$ - return new FloatType(target, typename); - } else if (typename.equals("double")) { //$NON-NLS-1$ - return new DoubleType(target, typename); - } else if (typename.equals("void")) { //$NON-NLS-1$ - return new VoidType(target, typename); - } else if (typename.equals("enum")) { //$NON-NLS-1$ - return new EnumType(target, typename); - } else if (typename.equals("union")) { //$NON-NLS-1$ - return new StructType(target, typename); - } else if (typename.equals("struct")) { //$NON-NLS-1$ - return new StructType(target, typename); - } else if (typename.equals("class")) { //$NON-NLS-1$ - return new StructType(target, typename); - } - - // GDB has some special types for int - if (typename.equals("int8_t")) { //$NON-NLS-1$ - return new CharType(target, typename); - } else if (typename.equals("int16_t")) { //$NON-NLS-1$ - return new ShortType(target, typename); - } else if (typename.equals("int32_t")) { //$NON-NLS-1$ - return new IntType(target, typename); - } else if (typename.equals("int64_t")) { //$NON-NLS-1$ - return new LongLongType(target, typename); - } else if (typename.equals("int128_t")) { //$NON-NLS-1$ - return new IntType(target, typename); // ???? - } - - if (typename.equals("int8_t")) { //$NON-NLS-1$ - return new CharType(target, typename); - } else if (typename.equals("uint8_t")) { //$NON-NLS-1$ - return new CharType(target, typename, true); - } else if (typename.equals("int16_t")) { //$NON-NLS-1$ - return new ShortType(target, typename); - } else if (typename.equals("uint16_t")) { //$NON-NLS-1$ - return new ShortType(target, typename, true); - } else if (typename.equals("int32_t")) { //$NON-NLS-1$ - return new LongType(target, typename); - } else if (typename.equals("uint32_t")) { //$NON-NLS-1$ - return new LongType(target, typename, true); - } else if (typename.equals("int64_t")) { //$NON-NLS-1$ - return new LongLongType(target, typename); - } else if (typename.equals("uint64_t")) { //$NON-NLS-1$ - return new LongLongType(target, typename, true); - } else if (typename.equals("int128_t")) { //$NON-NLS-1$ - return new IntType(target, typename); // ???? - } else if (typename.equals("uint128_t")) { //$NON-NLS-1$ - return new IntType(target, typename, true); // ???? - } - - StringTokenizer st = new StringTokenizer(typename); - int count = st.countTokens(); - - if (count == 2) { - String first = st.nextToken(); - String second = st.nextToken(); - - // ISOC allows permutations: - // "signed int" and "int signed" are equivalent - boolean isUnsigned = (first.equals("unsigned") || second.equals("unsigned")); //$NON-NLS-1$ //$NON-NLS-2$ - boolean isSigned = (first.equals("signed") || second.equals("signed")); //$NON-NLS-1$ //$NON-NLS-2$ - boolean isChar = (first.equals("char") || second.equals("char")); //$NON-NLS-1$ //$NON-NLS-2$ - boolean isInt = (first.equals("int") || second.equals("int")); //$NON-NLS-1$ //$NON-NLS-2$ - boolean isLong = (first.equals("long") || second.equals("long")); //$NON-NLS-1$ //$NON-NLS-2$ - boolean isShort = (first.equals("short") || second.equals("short")); //$NON-NLS-1$ //$NON-NLS-2$ - boolean isLongLong = (first.equals("long") && second.equals("long")); //$NON-NLS-1$ //$NON-NLS-2$ - - boolean isDouble = (first.equals("double") || second.equals("double")); //$NON-NLS-1$ //$NON-NLS-2$ - boolean isFloat = (first.equals("float") || second.equals("float")); //$NON-NLS-1$ //$NON-NLS-2$ - boolean isComplex = (first.equals("complex") || second.equals("complex") || //$NON-NLS-1$ //$NON-NLS-2$ - first.equals("_Complex") || second.equals("_Complex")); //$NON-NLS-1$ //$NON-NLS-2$ - boolean isImaginery = (first.equals("_Imaginary") || second.equals("_Imaginary")); //$NON-NLS-1$ //$NON-NLS-2$ - - boolean isStruct = first.equals("struct"); //$NON-NLS-1$ - boolean isClass = first.equals("class"); //$NON-NLS-1$ - boolean isUnion = first.equals("union"); //$NON-NLS-1$ - boolean isEnum = first.equals("enum"); //$NON-NLS-1$ - - if (isChar && (isSigned || isUnsigned)) { - return new CharType(target, typename, isUnsigned); - } else if (isShort && (isInt || isSigned || isUnsigned)) { - return new ShortType(target, typename, isUnsigned); - } else if (isInt && (isSigned || isUnsigned)) { - return new IntType(target, typename, isUnsigned); - } else if (isLong && (isInt || isSigned || isUnsigned)) { - return new LongType(target, typename, isUnsigned); - } else if (isLongLong) { - return new LongLongType(target, typename); - } else if (isDouble && (isLong || isComplex || isImaginery)) { - return new DoubleType(target, typename, isComplex, isImaginery, isLong); - } else if (isFloat && (isComplex || isImaginery)) { - return new FloatType(target, typename, isComplex, isImaginery); - } else if (isStruct) { - return new StructType(target, typename); - } else if (isClass) { - return new StructType(target, typename); - } else if (isUnion) { - return new StructType(target, typename); - } else if (isEnum) { - return new EnumType(target, typename); - } - } else if (count == 3) { - // ISOC allows permutation. replace short by: long or short - // "unsigned short int", "unsigned int short" - // "short unsigned int". "short int unsigned" - // "int unsinged short". "int short unsigned" - // - // "unsigned long long", "long long unsigned" - // "signed long long", "long long signed" - String first = st.nextToken(); - String second = st.nextToken(); - String third = st.nextToken(); - - boolean isSigned = (first.equals("signed") || second.equals("signed") || third.equals("signed")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - boolean unSigned = (first.equals("unsigned") || second.equals("unsigned") || third.equals("unsigned")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - boolean isInt = (first.equals("int") || second.equals("int") || third.equals("int")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - boolean isLong = (first.equals("long") || second.equals("long") || third.equals("long")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - boolean isShort = (first.equals("short") || second.equals("short") || third.equals("short")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - boolean isLongLong = (first.equals("long") && second.equals("long")) || //$NON-NLS-1$ //$NON-NLS-2$ - (second.equals("long") && third.equals("long")); //$NON-NLS-1$ //$NON-NLS-2$ - boolean isDouble = (first.equals("double") || second.equals("double") || third.equals("double")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - boolean isComplex = (first.equals("complex") || second.equals("complex") || third.equals("complex") || //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - first.equals("_Complex") || second.equals("_Complex") || third.equals("_Complex")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - boolean isImaginery = (first.equals("_Imaginary") || second.equals("_Imaginary") || third.equals("_Imaginary")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - - - if (isSigned == false && unSigned==false) { - isSigned = true; // otherwise long long int would not work - } - if (isShort && isInt && (isSigned || unSigned)) { - return new ShortType(target, typename, unSigned); - } else if (isLongLong && (isSigned || unSigned)) { - return new LongLongType(target, typename, unSigned); - } else if (isLong && isInt && (isSigned || unSigned)) { - return new LongType(target, typename, unSigned); - } else if (isDouble && isLong && (isComplex || isImaginery)) { - return new DoubleType(target, typename, isComplex, isImaginery, isLong); - } - } else if (count == 4) { - // ISOC allows permutation: - // "unsigned long long int", "unsigned int long long" - // "long long unsigned int". "long long int unsigned" - // "int unsigned long long". "int long long unsigned" - String first = st.nextToken(); - String second = st.nextToken(); - String third = st.nextToken(); - String fourth = st.nextToken(); - - boolean unSigned = (first.equals("unsigned") || second.equals("unsigned") || third.equals("unsigned") || fourth.equals("unsigned")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - boolean isSigned = (first.equals("signed") || second.equals("signed") || third.equals("signed") || fourth.equals("signed")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - boolean isInt = (first.equals("int") || second.equals("int") || third.equals("int") || fourth.equals("int")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - boolean isLongLong = (first.equals("long") && second.equals("long")) //$NON-NLS-1$ //$NON-NLS-2$ - || (second.equals("long") && third.equals("long")) //$NON-NLS-1$ //$NON-NLS-2$ - || (third.equals("long") && fourth.equals("long")); //$NON-NLS-1$ //$NON-NLS-2$ - - if (isLongLong && isInt && (isSigned || unSigned)) { - return new LongLongType(target, typename, unSigned); - } - } - throw new CDIException(CdiResources.getString("cdi.SourceManager.Unknown_type")); //$NON-NLS-1$ - } - - public String getDetailTypeNameFromVariable(StackFrame frame, String variable) throws CDIException { - Target target = (Target)frame.getTarget(); - Thread currentThread = (Thread)target.getCurrentThread(); - StackFrame currentFrame = currentThread.getCurrentStackFrame(); - synchronized(target.getLock()) { - try { - target.setCurrentThread(frame.getThread(), false); - ((Thread)frame.getThread()).setCurrentStackFrame(frame, false); - return getDetailTypeName(target, variable); - } finally { - target.setCurrentThread(currentThread, false); - currentThread.setCurrentStackFrame(currentFrame, false); - } - } - } - public String getDetailTypeName(Target target, String typename) throws CDIException { - try { - MISession mi = target.getMISession(); - RxThread rxThread = mi.getRxThread(); - rxThread.setEnableConsole(false); - CommandFactory factory = mi.getCommandFactory(); - CLIPType ptype = factory.createCLIPType(typename); - mi.postCommand(ptype); - CLIPTypeInfo info = ptype.getMIPtypeInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - return info.getType(); - } catch (MIException e) { - throw new MI2CDIException(e); - } finally { - MISession mi = target.getMISession(); - RxThread rxThread = mi.getRxThread(); - rxThread.setEnableConsole(true); - - } - } - - public String getTypeNameFromVariable(StackFrame frame, String variable) throws CDIException { - Target target = (Target)frame.getTarget(); - Thread currentThread = (Thread)target.getCurrentThread(); - StackFrame currentFrame = currentThread.getCurrentStackFrame(); - synchronized(target.getLock()) { - try { - target.setCurrentThread(frame.getThread(), false); - ((Thread)frame.getThread()).setCurrentStackFrame(frame, false); - return getTypeName(target, variable); - } finally { - target.setCurrentThread(currentThread, false); - currentThread.setCurrentStackFrame(currentFrame, false); - } - } - } - - public String getTypeName(Target target, String variable) throws CDIException { - MISession miSession = target.getMISession(); - try { - RxThread rxThread = miSession.getRxThread(); - rxThread.setEnableConsole(false); - CommandFactory factory = miSession.getCommandFactory(); - CLIWhatis whatis = factory.createCLIWhatis(variable); - miSession.postCommand(whatis); - CLIWhatisInfo info = whatis.getMIWhatisInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - return info.getType(); - } catch (MIException e) { - throw new MI2CDIException(e); - } finally { - RxThread rxThread = miSession.getRxThread(); - rxThread.setEnableConsole(true); - } - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/ThreadManager.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/ThreadManager.java deleted file mode 100644 index 3483ccf8b5c..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/ThreadManager.java +++ /dev/null @@ -1,113 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi; - -import java.util.HashMap; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.ICDIThread; -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.MISession; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; -import org.eclipse.cdt.debug.mi.core.cdi.model.Thread; -import org.eclipse.cdt.debug.mi.core.command.CommandFactory; -import org.eclipse.cdt.debug.mi.core.command.CLIInfoThreads; -import org.eclipse.cdt.debug.mi.core.output.CLIInfoThreadsInfo; - - -/** - */ -public class ThreadManager extends Manager { //implements ICDIThreadManager { - - static final Thread[] noThreads = new Thread[0]; - HashMap threadMap; - - class ThreadSet { - ICDIThread[] currentThreads; - int currentThreadId; - ThreadSet(ICDIThread[] threads, int id) { - currentThreads = threads; - currentThreadId = id; - } - } - - public ThreadManager(Session session) { - super(session, true); - threadMap = new HashMap(); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIThreadManager#getThreads() - */ - public ICDIThread[] getThreads() throws CDIException { - return new ICDIThread[] {}; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIThreadManager#getThreads() - */ - public ICDIThread[] getThreads(Target process) throws CDIException { - ThreadSet set = (ThreadSet)threadMap.get(process); - if (set == null) { - set = getCThreads(process); - threadMap.put(process, set); - } - return set.currentThreads; - } - - public ThreadSet getCThreads(Target process) throws CDIException { - Thread[] cthreads = noThreads; - int currentThreadId = 0; - MISession mi = process.getMISession(); - CommandFactory factory = mi.getCommandFactory(); - try { - // HACK/FIXME: gdb/mi thread-list-ids does not - // show any newly create thread, we workaround by - // issuing "info threads" instead. - //MIThreadListIds tids = factory.createMIThreadListIds(); - //MIThreadListIdsInfo info = tids.getMIThreadListIdsInfo(); - - CLIInfoThreads tids = factory.createCLIInfoThreads(); - mi.postCommand(tids); - CLIInfoThreadsInfo info = tids.getMIInfoThreadsInfo(); - int [] ids; - if (info == null) { - ids = new int[0]; - } else { - ids = info.getThreadIds(); - } - if (ids != null && ids.length > 0) { - cthreads = new Thread[ids.length]; - // Ok that means it is a multiThreaded. - for (int i = 0; i < ids.length; i++) { - cthreads[i] = new Thread(process, ids[i]); - } - } else { - // Provide a dummy. - cthreads = new Thread[]{new Thread(process, 0)}; - } - currentThreadId = info.getCurrentThread(); - //FIX: When attaching there is no thread selected - // We will choose the first one as a workaround. - if (currentThreadId == 0 && cthreads.length > 0) { - currentThreadId = cthreads[0].getId(); - } - } catch (MIException e) { - throw new CDIException(e.getMessage()); - } - return new ThreadSet(cthreads, currentThreadId); - } - - @Override - public void update(Target target) throws CDIException { - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java deleted file mode 100644 index 8b3e936c14d..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java +++ /dev/null @@ -1,756 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - * Alena Laskavaia (QNX) - Bug 197986, Bug 221224 - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.ICDIArgumentDescriptor; -import org.eclipse.cdt.debug.core.cdi.model.ICDILocalVariableDescriptor; -import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame; -import org.eclipse.cdt.debug.core.cdi.model.ICDIThread; -import org.eclipse.cdt.debug.core.cdi.model.ICDIThreadStorageDescriptor; -import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable; -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.MISession; -import org.eclipse.cdt.debug.mi.core.RxThread; -import org.eclipse.cdt.debug.mi.core.cdi.model.Argument; -import org.eclipse.cdt.debug.mi.core.cdi.model.ArgumentDescriptor; -import org.eclipse.cdt.debug.mi.core.cdi.model.GlobalVariable; -import org.eclipse.cdt.debug.mi.core.cdi.model.GlobalVariableDescriptor; -import org.eclipse.cdt.debug.mi.core.cdi.model.LocalVariable; -import org.eclipse.cdt.debug.mi.core.cdi.model.LocalVariableDescriptor; -import org.eclipse.cdt.debug.mi.core.cdi.model.Register; -import org.eclipse.cdt.debug.mi.core.cdi.model.RegisterDescriptor; -import org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; -import org.eclipse.cdt.debug.mi.core.cdi.model.Thread; -import org.eclipse.cdt.debug.mi.core.cdi.model.ThreadStorage; -import org.eclipse.cdt.debug.mi.core.cdi.model.ThreadStorageDescriptor; -import org.eclipse.cdt.debug.mi.core.cdi.model.Variable; -import org.eclipse.cdt.debug.mi.core.cdi.model.VariableDescriptor; -import org.eclipse.cdt.debug.mi.core.command.CLIPType; -import org.eclipse.cdt.debug.mi.core.command.CommandFactory; -import org.eclipse.cdt.debug.mi.core.command.MIStackListArguments; -import org.eclipse.cdt.debug.mi.core.command.MIStackListLocals; -import org.eclipse.cdt.debug.mi.core.command.MIVarCreate; -import org.eclipse.cdt.debug.mi.core.command.MIVarDelete; -import org.eclipse.cdt.debug.mi.core.command.MIVarUpdate; -import org.eclipse.cdt.debug.mi.core.event.MIEvent; -import org.eclipse.cdt.debug.mi.core.event.MIVarChangedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIVarDeletedEvent; -import org.eclipse.cdt.debug.mi.core.output.CLIPTypeInfo; -import org.eclipse.cdt.debug.mi.core.output.MIArg; -import org.eclipse.cdt.debug.mi.core.output.MIFrame; -import org.eclipse.cdt.debug.mi.core.output.MIStackListArgumentsInfo; -import org.eclipse.cdt.debug.mi.core.output.MIStackListLocalsInfo; -import org.eclipse.cdt.debug.mi.core.output.MIVar; -import org.eclipse.cdt.debug.mi.core.output.MIVarChange; -import org.eclipse.cdt.debug.mi.core.output.MIVarCreateInfo; -import org.eclipse.cdt.debug.mi.core.output.MIVarUpdateInfo; - -/** - */ -public class VariableManager extends Manager { - - static final ICDIVariable[] EMPTY_VARIABLES = {}; - // We put a restriction on how deep we want to - // go when doing update of the variables. - // If the number is to high, gdb will just hang. - int MAX_STACK_DEPTH = Thread.STACKFRAME_DEFAULT_DEPTH; - Map variablesMap; - MIVarChange[] noChanges = new MIVarChange[0]; - - public VariableManager(Session session) { - super(session, true); - variablesMap = new Hashtable(); - } - - synchronized List getVariablesList(Target target) { - List variablesList = (List) variablesMap.get(target); - if (variablesList == null) { - variablesList = Collections.synchronizedList(new ArrayList()); - variablesMap.put(target, variablesList); - } - return variablesList; - } - - /** - * Return the element that have the uniq varName. - * null is return if the element is not in the cache. - */ - public Variable getVariable(MISession miSession, String varName) { - Target target = ((Session)getSession()).getTarget(miSession); - return getVariable(target, varName); - } - - /** - * Return the element that have the uniq varName. - * null is return if the element is not in the cache. - */ - public Variable getVariable(Target target, String varName) { - Variable[] vars = getVariables(target); - for (int i = 0; i < vars.length; i++) { - try { - if (vars[i].getMIVar().getVarName().equals(varName)) { - return vars[i]; - } - Variable v = vars[i].getChild(varName); - if (v != null) { - return v; - } - } catch (CDIException e) { - // - } - } - return null; - } - - /** - * Return the Element with this thread/stackframe, and with this name. - * null is return if the element is not in the cache. - */ - Variable findVariable(VariableDescriptor v) throws CDIException { - Target target = (Target)v.getTarget(); - ICDIStackFrame vstack = v.getStackFrame(); - ICDIThread vthread = v.getThread(); - int position = v.getPosition(); - int depth = v.getStackDepth(); - Variable[] vars = getVariables(target); - for (int i = 0; i < vars.length; i++) { - if (vars[i].getFullName().equals(v.getFullName()) - && vars[i].getName().equals(v.getName()) // see bug #113364 - && vars[i].getCastingArrayStart() == v.getCastingArrayStart() - && vars[i].getCastingArrayEnd() == v.getCastingArrayEnd() - && VariableDescriptor.equalsCasting(vars[i], v)) { - // check threads - ICDIThread thread = vars[i].getThread(); - if ((vthread == null && thread == null) || - (vthread != null && thread != null && thread.equals(vthread))) { - // check stackframes - ICDIStackFrame frame = vars[i].getStackFrame(); - if (vstack == null && frame == null) { - return vars[i]; - } else if (frame != null && vstack != null && frame.equals(vstack)) { - if (vars[i].getPosition() == position) { - if (vars[i].getStackDepth() == depth) { - return vars[i]; - } - } - } - } - } - } - return null; - } - - /** - * Returns all the elements that are in the cache. - */ - Variable[] getVariables(Target target) { - List variableList = (List)variablesMap.get(target); - if (variableList != null) { - return (Variable[]) variableList.toArray(new Variable[variableList.size()]); - } - return new Variable[0]; - } - - /** - * Check the type - */ - public void checkType(StackFrame frame, String type) throws CDIException { - if (type != null && type.length() > 0) { - Target target = (Target)frame.getTarget(); - Thread currentThread = (Thread)target.getCurrentThread(); - StackFrame currentFrame = currentThread.getCurrentStackFrame(); - synchronized(target.getLock()) { - try { - target.setCurrentThread(frame.getThread(), false); - ((Thread)frame.getThread()).setCurrentStackFrame(frame, false); - MISession miSession = target.getMISession(); - RxThread rxThread = miSession.getRxThread(); - rxThread.setEnableConsole(false); - CommandFactory factory = miSession.getCommandFactory(); - CLIPType ptype = factory.createCLIPType(type); - miSession.postCommand(ptype); - CLIPTypeInfo info = ptype.getMIPtypeInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - } catch (MIException e) { - throw new MI2CDIException(e); - } finally { - MISession miSession = target.getMISession(); - RxThread rxThread = miSession.getRxThread(); - rxThread.setEnableConsole(true); - target.setCurrentThread(currentThread, false); - currentThread.setCurrentStackFrame(currentFrame, false); - } - } - } else { - throw new CDIException(CdiResources.getString("cdi.VariableManager.Unknown_type")); //$NON-NLS-1$ - } - } - - /** - * Tell gdb to remove the underlying var-object also. - */ - void removeMIVar(MISession miSession, MIVar miVar) throws CDIException { - CommandFactory factory = miSession.getCommandFactory(); - MIVarDelete var = factory.createMIVarDelete(miVar.getVarName()); - try { - miSession.postCommand(var); - var.getMIInfo(); - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - - /** - * Remove variable form the maintained cache list. - * @param miSession - * @param varName - * @return - */ - public Variable removeVariableFromList(MISession miSession, String varName) { - Target target = ((Session)getSession()).getTarget(miSession); - List varList = getVariablesList(target); - synchronized (varList) { - for (Iterator iterator = varList.iterator(); iterator.hasNext();) { - Variable variable = (Variable)iterator.next(); - try { - if (variable.getMIVar().getVarName().equals(varName)) { - iterator.remove(); - return variable; - } - } catch (CDIException e) { - // - } - } - } - return null; - } - - /** - * Encode the variableDescriptor as an array - * @param varDesc - * @param start - * @param length - * @return - * @throws CDIException - */ - public VariableDescriptor getVariableDescriptorAsArray(VariableDescriptor varDesc, int start, int length) - throws CDIException { - Target target = (Target)varDesc.getTarget(); - Thread thread = (Thread)varDesc.getThread(); - StackFrame frame = (StackFrame)varDesc.getStackFrame(); - String name = varDesc.getName(); - String fullName = varDesc.getFullName(); - int pos = varDesc.getPosition(); - int depth = varDesc.getStackDepth(); - VariableDescriptor vo = null; - - if (varDesc instanceof ArgumentDescriptor || varDesc instanceof Argument) { - vo = new ArgumentDescriptor(target, thread, frame, name, fullName, pos, depth); - } else if (varDesc instanceof LocalVariableDescriptor || varDesc instanceof LocalVariable) { - vo = new LocalVariableDescriptor(target, thread, frame, name, fullName, pos, depth); - } else if (varDesc instanceof GlobalVariableDescriptor || varDesc instanceof GlobalVariable) { - vo = new GlobalVariableDescriptor(target, thread, frame, name, fullName, pos, depth); - } else if (varDesc instanceof RegisterDescriptor || varDesc instanceof Register) { - vo = new RegisterDescriptor(target, thread, frame, name, fullName, pos, depth); - } else if (varDesc instanceof ThreadStorageDescriptor || varDesc instanceof ThreadStorage) { - vo = new ThreadStorageDescriptor(target, thread, frame, name, fullName, pos, depth); - } else { - throw new CDIException(CdiResources.getString("cdi.VariableManager.Unknown_variable_object")); //$NON-NLS-1$ - } - - vo.setCastingArrayStart(varDesc.getCastingArrayStart() + start); - vo.setCastingArrayEnd(length); - return vo; - } - - /** - * Encode the variableDescriptor in a typecasting. - * @param varDesc - * @param type - * @return - * @throws CDIException - */ - public VariableDescriptor getVariableDescriptorAsType(VariableDescriptor varDesc, String type) throws CDIException { - // throw an exception if not a good type. - Target target = (Target)varDesc.getTarget(); - Thread thread = (Thread)varDesc.getThread(); - StackFrame frame = (StackFrame)varDesc.getStackFrame(); - String name = varDesc.getName(); - String fullName = varDesc.getFullName(); - int pos = varDesc.getPosition(); - int depth = varDesc.getStackDepth(); - - // Check the type validity. - { - StackFrame f = frame; - if (f == null) { - if (thread != null) { - f = thread.getCurrentStackFrame(); - } else { - Thread t = (Thread)target.getCurrentThread(); - f = t.getCurrentStackFrame(); - } - } - checkType(f, type); - } - - VariableDescriptor vo = null; - - if (varDesc instanceof ArgumentDescriptor || varDesc instanceof Argument) { - vo = new ArgumentDescriptor(target, thread, frame, name, fullName, pos, depth); - } else if (varDesc instanceof LocalVariableDescriptor || varDesc instanceof LocalVariable) { - vo = new LocalVariableDescriptor(target, thread, frame, name, fullName, pos, depth); - } else if (varDesc instanceof GlobalVariableDescriptor || varDesc instanceof GlobalVariable) { - vo = new GlobalVariableDescriptor(target, thread, frame, name, fullName, pos, depth); - } else if (varDesc instanceof ThreadStorageDescriptor || varDesc instanceof ThreadStorage) { - vo = new ThreadStorageDescriptor(target, thread, frame, name, fullName, pos, depth); - } else if (varDesc instanceof RegisterDescriptor || varDesc instanceof Register) { - vo = new RegisterDescriptor(target, thread, frame, name, fullName, pos, depth); - } else { - throw new CDIException(CdiResources.getString("cdi.VariableManager.Unknown_variable_object")); //$NON-NLS-1$ - } - - String[] castings = varDesc.getCastingTypes(); - if (castings == null) { - castings = new String[] { type }; - } else { - String[] temp = new String[castings.length + 1]; - System.arraycopy(castings, 0, temp, 0, castings.length); - temp[castings.length] = type; - castings = temp; - } - vo.setCastingTypes(castings); - return vo; - } - - public Variable createVariable(VariableDescriptor varDesc) throws CDIException { - if (varDesc instanceof ArgumentDescriptor) { - return createArgument((ArgumentDescriptor)varDesc); - } else if (varDesc instanceof LocalVariableDescriptor) { - return createLocalVariable((LocalVariableDescriptor)varDesc); - } else if (varDesc instanceof GlobalVariableDescriptor) { - return createGlobalVariable((GlobalVariableDescriptor)varDesc); - } else if (varDesc instanceof RegisterDescriptor) { - RegisterManager regMgr = ((Session)getSession()).getRegisterManager(); - return regMgr.createRegister((RegisterDescriptor)varDesc); - } else if (varDesc instanceof ThreadStorageDescriptor) { - return createThreadStorage((ThreadStorageDescriptor)varDesc); - } - throw new CDIException(CdiResources.getString("cdi.VariableManager.Unknown_variable_object")); //$NON-NLS-1$ - } - - public Argument createArgument(ArgumentDescriptor argDesc) throws CDIException { - Variable variable = findVariable(argDesc); - Argument argument = null; - if (variable != null && variable instanceof Argument) { - argument = (Argument) variable; - } - if (argument == null) { - String name = argDesc.getQualifiedName(); - StackFrame stack = (StackFrame)argDesc.getStackFrame(); - Target target = (Target)argDesc.getTarget(); - Thread currentThread = (Thread)target.getCurrentThread(); - StackFrame currentFrame = currentThread.getCurrentStackFrame(); - synchronized(target.getLock()) { - try { - target.setCurrentThread(stack.getThread(), false); - ((Thread)stack.getThread()).setCurrentStackFrame(stack, false); - MISession mi = target.getMISession(); - CommandFactory factory = mi.getCommandFactory(); - MIVarCreate var = factory.createMIVarCreate(name); - mi.postCommand(var, -1); - argument = new Argument(argDesc, var); -// mi.postCommand(var); -// MIVarCreateInfo info = var.getMIVarCreateInfo(); -// if (info == null) { -// throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ -// } -// argument = new Argument(argDesc, info.getMIVar()); - List variablesList = getVariablesList(target); - variablesList.add(argument); - } catch (MIException e) { - throw new MI2CDIException(e); - } finally { - target.setCurrentThread(currentThread, false); - currentThread.setCurrentStackFrame(currentFrame, false); - } - } - } - return argument; - } - - public ICDIArgumentDescriptor[] getArgumentDescriptors(StackFrame frame) throws CDIException { - List argObjects = new ArrayList(); - Target target = (Target)frame.getTarget(); - Thread currentThread = (Thread)target.getCurrentThread(); - StackFrame currentFrame = currentThread.getCurrentStackFrame(); - synchronized(target.getLock()) { - try { - target.setCurrentThread(frame.getThread(), false); - ((Thread)frame.getThread()).setCurrentStackFrame(frame, false); - MISession mi = target.getMISession(); - CommandFactory factory = mi.getCommandFactory(); - int depth = frame.getThread().getStackFrameCount(); - int level = frame.getLevel(); - // Need the GDB/MI view of level which the reverse i.e. Highest frame is 0 - int miLevel = depth - level; - MIStackListArguments listArgs = factory.createMIStackListArguments(false, miLevel, miLevel); - MIArg[] args = null; - mi.postCommand(listArgs); - MIStackListArgumentsInfo info = listArgs.getMIStackListArgumentsInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - MIFrame[] miFrames = info.getMIFrames(); - if (miFrames != null && miFrames.length == 1) { - args = miFrames[0].getArgs(); - } - if (args != null) { - for (int i = 0; i < args.length; i++) { - ArgumentDescriptor arg = new ArgumentDescriptor(target, null, frame, args[i].getName(), null, args.length - i, level); - argObjects.add(arg); - } - } - } catch (MIException e) { - throw new MI2CDIException(e); - } finally { - target.setCurrentThread(currentThread, false); - currentThread.setCurrentStackFrame(currentFrame, false); - } - } - return (ICDIArgumentDescriptor[]) argObjects.toArray(new ICDIArgumentDescriptor[0]); - } - - public GlobalVariableDescriptor getGlobalVariableDescriptor(Target target, String filename, String function, String name) throws CDIException { - if (filename == null) { - filename = new String(); - } - if (function == null) { - function = new String(); - } - if (name == null) { - name = new String(); - } - StringBuffer buffer = new StringBuffer(); - if (filename.length() > 0) { - buffer.append('\'').append(filename).append('\'').append("::"); //$NON-NLS-1$ - } - if (function.length() > 0) { - buffer.append(function).append("::"); //$NON-NLS-1$ - } - buffer.append(name); - return new GlobalVariableDescriptor(target, null, null, buffer.toString(), null, 0, 0); - } - - public GlobalVariable createGlobalVariable(GlobalVariableDescriptor varDesc) throws CDIException { - Variable variable = findVariable(varDesc); - GlobalVariable global = null; - if (variable instanceof GlobalVariable) { - global = (GlobalVariable)variable; - } - if (global == null) { - String name = varDesc.getQualifiedName(); - Target target = (Target)varDesc.getTarget(); - try { - MISession mi = target.getMISession(); - CommandFactory factory = mi.getCommandFactory(); - MIVarCreate var = factory.createMIVarCreate(name); - mi.postCommand(var, -1); - global = new GlobalVariable(varDesc, var); -// mi.postCommand(var; -// MIVarCreateInfo info = var.getMIVarCreateInfo(); -// if (info == null) { -// throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ -// } -// global = new GlobalVariable(varDesc, info.getMIVar()); - List variablesList = getVariablesList(target); - variablesList.add(global); - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - return global; - } - - public ICDILocalVariableDescriptor[] getLocalVariableDescriptors(StackFrame frame) throws CDIException { - List varObjects = new ArrayList(); - Target target = (Target)frame.getTarget(); - Thread currentThread = (Thread)target.getCurrentThread(); - StackFrame currentFrame = currentThread.getCurrentStackFrame(); - synchronized(target.getLock()) { - try { - target.setCurrentThread(frame.getThread(), false); - ((Thread)frame.getThread()).setCurrentStackFrame(frame, false); - MISession mi = target.getMISession(); - CommandFactory factory = mi.getCommandFactory(); - int level = frame.getLevel(); - MIArg[] args = null; - MIStackListLocals locals = factory.createMIStackListLocals(false); - mi.postCommand(locals); - MIStackListLocalsInfo info = locals.getMIStackListLocalsInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - args = info.getLocals(); - if (args != null) { - for (int i = 0; i < args.length; i++) { - LocalVariableDescriptor varObj = new LocalVariableDescriptor(target, null, frame, args[i].getName(), null, args.length - i, level); - varObjects.add(varObj); - } - } - } catch (MIException e) { - throw new MI2CDIException(e); - } finally { - target.setCurrentThread(currentThread, false); - currentThread.setCurrentStackFrame(currentFrame, false); - } - } - return (ICDILocalVariableDescriptor[]) varObjects.toArray(new ICDILocalVariableDescriptor[0]); - } - - public LocalVariable createLocalVariable(LocalVariableDescriptor varDesc) throws CDIException { - Variable variable = findVariable(varDesc); - LocalVariable local = null; - if (variable instanceof LocalVariable) { - local = (LocalVariable)variable; - } - if (local == null) { - String name = varDesc.getQualifiedName(); - StackFrame stack = (StackFrame)varDesc.getStackFrame(); - Target target = (Target)varDesc.getTarget(); - Thread currentThread = (Thread)target.getCurrentThread(); - StackFrame currentFrame = currentThread.getCurrentStackFrame(); - synchronized(target.getLock()) { - try { - target.setCurrentThread(stack.getThread(), false); - ((Thread)stack.getThread()).setCurrentStackFrame(stack, false); - MISession mi = target.getMISession(); - CommandFactory factory = mi.getCommandFactory(); - MIVarCreate var = factory.createMIVarCreate(name); - mi.postCommand(var, -1); - local = new LocalVariable(varDesc, var); -// mi.postCommand(var); -// MIVarCreateInfo info = var.getMIVarCreateInfo(); -// if (info == null) { -// throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ -// } -// local = new LocalVariable(varDesc, info.getMIVar()); - List variablesList = getVariablesList(target); - variablesList.add(local); - } catch (MIException e) { - throw new MI2CDIException(e); - } finally { - target.setCurrentThread(currentThread, false); - currentThread.setCurrentStackFrame(currentFrame, false); - } - } - } - return local; - } - - public ICDIThreadStorageDescriptor[] getThreadStorageDescriptors(Thread thread) throws CDIException { - return new ICDIThreadStorageDescriptor[0]; - } - - public ThreadStorage createThreadStorage(ThreadStorageDescriptor desc) throws CDIException { - throw new CDIException(CdiResources.getString("cdi.VariableManager.Unknown_variable_object")); //$NON-NLS-1$ - } - - public void destroyVariable(Variable variable) throws CDIException { - // Fire a destroyEvent ? - Target target = (Target)variable.getTarget(); - MISession mi = target.getMISession(); - // no need to call -var-delete for variable that are not in - // the list most probaby they are children of other variables and in this case - // we should not delete them - List varList = getVariablesList(target); - if (varList.contains(variable)) { - removeMIVar(mi, variable.getMIVar()); - } - MIVarDeletedEvent del = new MIVarDeletedEvent(mi, variable.getMIVar().getVarName()); - mi.fireEvent(del); - } - - public void destroyAllVariables(Target target) throws CDIException { - Variable[] variables = getVariables(target); - MISession mi = target.getMISession(); - for (int i = 0; i < variables.length; ++i) { - removeMIVar(mi, variables[i].getMIVar()); - MIVarDeletedEvent del = new MIVarDeletedEvent(mi, variables[i].getMIVar().getVarName()); - mi.fireEvent(del); - } - } - - /** - * Update the elements in the cache, from the response of the "-var-update" - * mi/command. Althought tempting we do not use the "-var-update *" command, since - * for some reason on gdb-5.2.1 it starts to misbehave until it hangs ... sigh - * We take the approach of updating the variables ourselfs. But we do it a smart - * way by only updating the variables visible in the current stackframe but not - * the other locals in different frames. The downside if any side effects we loose, - * This ok, since the IDE only a frame at a time. - * - */ - @Override - public void update(Target target) throws CDIException { - int highLevel = 0; - int lowLevel = 0; - List eventList = new ArrayList(); - MISession mi = target.getMISession(); - CommandFactory factory = mi.getCommandFactory(); - Variable[] vars = getVariables(target); - ICDIStackFrame[] frames = null; - StackFrame currentStack = null; - Thread currentThread = (Thread)target.getCurrentThread(); - if (currentThread != null) { - currentStack = currentThread.getCurrentStackFrame(); - if (currentStack != null) { - highLevel = currentStack.getLevel(); - } - if (highLevel > MAX_STACK_DEPTH) { - highLevel = MAX_STACK_DEPTH; - } - lowLevel = highLevel - MAX_STACK_DEPTH; - if (lowLevel < 0) { - lowLevel = 0; - } - frames = currentThread.getStackFrames(0, highLevel); - } - for (int i = 0; i < vars.length; i++) { - Variable variable = vars[i]; - if (isVariableNeedsToBeUpdate(variable, currentStack, frames, lowLevel)) { - update(target, variable, eventList); - } else { - variable.setUpdated(false); - } - } - MIEvent[] events = (MIEvent[]) eventList.toArray(new MIEvent[0]); - mi.fireEvents(events); - } - - public void update(Variable variable) throws CDIException { - Target target = (Target)variable.getTarget(); - MISession mi = target.getMISession(); - List eventList = new ArrayList(); - update(target, variable, eventList); - MIEvent[] events = (MIEvent[]) eventList.toArray(new MIEvent[0]); - mi.fireEvents(events); - } - - public void update(Target target, Variable variable, List eventList) throws CDIException { - MISession mi = target.getMISession(); - CommandFactory factory = mi.getCommandFactory(); - MIVarChange[] changes = noChanges; - try { - String miVarName = variable.getMIVar().getVarName(); - MIVarUpdate update = factory.createMIVarUpdate(miVarName); - try { - mi.postCommand(update); - MIVarUpdateInfo info = update.getMIVarUpdateInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - changes = info.getMIVarChanges(); - } catch (MIException e) { - //throw new MI2CDIException(e); - eventList.add(new MIVarDeletedEvent(mi, miVarName)); - } - } catch (CDIException exc) { - // When the variable was out of scope the fisrt time, the getMIVar() generates an exception. - // Then create again the variable, set the fVarCreateCMD of Variable class and try again the update command. - try { - MIVarCreate var = factory.createMIVarCreate(variable.getName()); - mi.postCommand(var); - MIVarCreateInfo info = var.getMIVarCreateInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - variable.setMIVarCreate(var); - update(target, variable, eventList); - } catch (MIException e) { - // Creating failed, variable not in scope => remove - // No events to fire as the variable isn't backed by a MIVar - getVariablesList(target).remove(variable); - variable.setUpdated(false); - return; - } catch (CDIException e) { - throw e; - } - } - variable.setUpdated(true); - for (int j = 0; j < changes.length; j++) { - String n = changes[j].getVarName(); - if (changes[j].isInScope()) { - eventList.add(new MIVarChangedEvent(mi, n)); - } else { - destroyVariable(variable); - eventList.add(new MIVarDeletedEvent(mi, n)); - } - } - } - - /** - * We are trying to minimize the impact of the updates, this can be very long and unncessary if we - * have a very deep stack and lots of local variables. We can assume here that the local variables - * in the other non-selected stackframe will not change and only update the selected frame variables. - * - * @param variable - * @param current - * @param frames - * @return - */ - boolean isVariableNeedsToBeUpdate(Variable variable, ICDIStackFrame current, ICDIStackFrame[] frames, int lowLevel) - throws CDIException { - ICDIStackFrame varStack = variable.getStackFrame(); - boolean inScope = false; - - // Something wrong and the program terminated bail out here. - if (current == null || frames == null) { - return false; - } - - // If the variable Stack is null, it means this is a global variable we should update - if (varStack == null) { - return true; - } else if (varStack.equals(current)) { - // The variable is in the current selected frame it should be updated - return true; - } else { - if (varStack.getLevel() >= lowLevel) { - // Check if the Variable is still in Scope - // if it is no longer in scope so update() can call "-var-delete". - for (int i = 0; i < frames.length; i++) { - if (varStack.equals(frames[i])) { - inScope = true; - } - } - } else { - inScope = true; - } - } - // return true if the variable is no longer in scope we - // need to call -var-delete. - return !inScope; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/WatchpointScope.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/WatchpointScope.java deleted file mode 100644 index ea0a92a9f94..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/WatchpointScope.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi; - -import org.eclipse.cdt.debug.core.cdi.ICDIWatchpointScope; -import org.eclipse.cdt.debug.core.cdi.model.ICDIWatchpoint; -import org.eclipse.cdt.debug.mi.core.cdi.model.Watchpoint; -import org.eclipse.cdt.debug.mi.core.event.MIWatchpointScopeEvent; - -/** - */ -public class WatchpointScope extends SessionObject implements ICDIWatchpointScope { - - MIWatchpointScopeEvent watchEvent; - - public WatchpointScope(Session session, MIWatchpointScopeEvent e) { - super(session); - watchEvent = e; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIWatchpointScope#getWatchpoint() - */ - @Override - public ICDIWatchpoint getWatchpoint() { - int number = watchEvent.getNumber(); - // Ask the breakpointManager for the breakpoint - BreakpointManager mgr = ((Session)getSession()).getBreakpointManager(); - // We need to return the same object as the reason. - Watchpoint point = mgr.getWatchpoint(watchEvent.getMISession(), number); - // FIXME: if point ==null ??? Create a new breakpoint ? - return point; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/WatchpointTrigger.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/WatchpointTrigger.java deleted file mode 100644 index 36eb17b2713..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/WatchpointTrigger.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi; - -import org.eclipse.cdt.debug.core.cdi.ICDIWatchpointTrigger; -import org.eclipse.cdt.debug.core.cdi.model.ICDIWatchpoint; -import org.eclipse.cdt.debug.mi.core.cdi.model.Watchpoint; -import org.eclipse.cdt.debug.mi.core.event.MIWatchpointTriggerEvent; - -/** - */ -public class WatchpointTrigger extends SessionObject implements ICDIWatchpointTrigger { - - MIWatchpointTriggerEvent watchEvent; - - public WatchpointTrigger(Session session, MIWatchpointTriggerEvent e) { - super(session); - watchEvent = e; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIWatchpointTrigger#getNewValue() - */ - @Override - public String getNewValue() { - return watchEvent.getNewValue(); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIWatchpointTrigger#getOldValue() - */ - @Override - public String getOldValue() { - return watchEvent.getOldValue(); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIWatchpointTrigger#getWatchpoint() - */ - @Override - public ICDIWatchpoint getWatchpoint() { - int number = watchEvent.getNumber(); - // Ask the breakpointManager for the breakpoint - BreakpointManager mgr = ((Session)getSession()).getBreakpointManager(); - // We need to return the same object as the reason. - Watchpoint point = mgr.getWatchpoint(watchEvent.getMISession(), number); - // FIXME: if point ==null ??? Create a new breakpoint ? - return point; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/ChangedEvent.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/ChangedEvent.java deleted file mode 100644 index 64c2df86031..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/ChangedEvent.java +++ /dev/null @@ -1,136 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi.event; - -import org.eclipse.cdt.debug.core.cdi.event.ICDIChangedEvent; -import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint; -import org.eclipse.cdt.debug.core.cdi.model.ICDIObject; -import org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary; -import org.eclipse.cdt.debug.core.cdi.model.ICDISignal; -import org.eclipse.cdt.debug.mi.core.MISession; -import org.eclipse.cdt.debug.mi.core.cdi.BreakpointManager; -import org.eclipse.cdt.debug.mi.core.cdi.ExpressionManager; -import org.eclipse.cdt.debug.mi.core.cdi.RegisterManager; -import org.eclipse.cdt.debug.mi.core.cdi.Session; -import org.eclipse.cdt.debug.mi.core.cdi.SharedLibraryManager; -import org.eclipse.cdt.debug.mi.core.cdi.SignalManager; -import org.eclipse.cdt.debug.mi.core.cdi.VariableManager; -import org.eclipse.cdt.debug.mi.core.cdi.model.CObject; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; -import org.eclipse.cdt.debug.mi.core.event.MIBreakpointChangedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIRegisterChangedEvent; -import org.eclipse.cdt.debug.mi.core.event.MISharedLibChangedEvent; -import org.eclipse.cdt.debug.mi.core.event.MISignalChangedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIVarChangedEvent; - -/** - */ -public class ChangedEvent implements ICDIChangedEvent { - - Session session; - ICDIObject source; - - public ChangedEvent(Session s, MIVarChangedEvent var) { - session = s; - - // Try the Variable manager. - VariableManager mgr = session.getVariableManager(); - String varName = var.getVarName(); - MISession miSession = var.getMISession(); - source = mgr.getVariable(miSession, varName); - - // Try the Expression manager - if (source == null) { - ExpressionManager expMgr = session.getExpressionManager(); - source = expMgr.getVariable(miSession, varName); - } - - // Try the Register manager - if (source == null) { - RegisterManager regMgr = session.getRegisterManager(); - source = regMgr.getRegister(miSession, varName); - } - - // Fall back - if (source == null) { - Target target = session.getTarget(miSession); - source = new CObject(target); - } - } - - public ChangedEvent(Session s, MIRegisterChangedEvent reg) { - session = s; - RegisterManager mgr = session.getRegisterManager(); - MISession miSession = reg.getMISession(); - int regno = reg.getNumber(); - source = mgr.getRegister(miSession, regno); - if (source == null) { - Target target = session.getTarget(miSession); - source = new CObject(target); - } - } - - public ChangedEvent(Session s, MIBreakpointChangedEvent bpoint) { - session = s; - BreakpointManager mgr = session.getBreakpointManager(); - MISession miSession = bpoint.getMISession(); - int number = bpoint.getNumber(); - ICDIBreakpoint breakpoint = mgr.getBreakpoint(miSession, number); - if (breakpoint != null) { - source = breakpoint; - } else { - Target target = session.getTarget(miSession); - source = new CObject(target); - } - } - - public ChangedEvent(Session s, MISharedLibChangedEvent slib) { - session = s; - SharedLibraryManager mgr = session.getSharedLibraryManager(); - MISession miSession = slib.getMISession(); - String name = slib.getName(); - ICDISharedLibrary lib = mgr.getSharedLibrary(miSession, name); - if (lib != null) { - source = lib; - } else { - Target target = session.getTarget(miSession); - source = new CObject(target); - } - } - - public ChangedEvent(Session s, MISignalChangedEvent sig) { - session = s; - SignalManager mgr = session.getSignalManager(); - MISession miSession = sig.getMISession(); - String name = sig.getName(); - ICDISignal signal = mgr.getSignal(miSession, name); - if (signal != null) { - source = signal; - } else { - Target target = session.getTarget(miSession); - source = new CObject(target); - } - } - - public ChangedEvent(Session s, ICDIObject src) { - session = s; - source = src; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.event.ICDIEvent#getSource() - */ - @Override - public ICDIObject getSource() { - return source; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/CreatedEvent.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/CreatedEvent.java deleted file mode 100644 index 847c54a6580..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/CreatedEvent.java +++ /dev/null @@ -1,135 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi.event; - -import org.eclipse.cdt.debug.core.cdi.event.ICDICreatedEvent; -import org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock; -import org.eclipse.cdt.debug.core.cdi.model.ICDIObject; -import org.eclipse.cdt.debug.mi.core.MISession; -import org.eclipse.cdt.debug.mi.core.cdi.BreakpointManager; -import org.eclipse.cdt.debug.mi.core.cdi.MemoryManager; -import org.eclipse.cdt.debug.mi.core.cdi.RegisterManager; -import org.eclipse.cdt.debug.mi.core.cdi.Session; -import org.eclipse.cdt.debug.mi.core.cdi.SharedLibraryManager; -import org.eclipse.cdt.debug.mi.core.cdi.VariableManager; -import org.eclipse.cdt.debug.mi.core.cdi.model.CObject; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; -import org.eclipse.cdt.debug.mi.core.event.MIBreakpointCreatedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIInferiorCreatedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIMemoryCreatedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIRegisterCreatedEvent; -import org.eclipse.cdt.debug.mi.core.event.MISharedLibCreatedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIThreadCreatedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIVarCreatedEvent; - -/** - */ -public class CreatedEvent implements ICDICreatedEvent { - - Session session; - ICDIObject source; - - public CreatedEvent(Session s, MIBreakpointCreatedEvent bpoint) { - session = s; - BreakpointManager mgr = session.getBreakpointManager(); - MISession miSession = bpoint.getMISession(); - int number = bpoint.getNumber(); - source = mgr.getBreakpoint(miSession, number); - if (source == null) { - Target target = session.getTarget(miSession); - source = new CObject(target); - } - } - - public CreatedEvent(Session s, MIVarCreatedEvent var) { - session = s; - VariableManager mgr = session.getVariableManager(); - MISession miSession = var.getMISession(); - String varName = var.getVarName(); - source = mgr.getVariable(miSession, varName); - if (source == null) { - Target target = session.getTarget(miSession); - source = new CObject(target); - } - } - - public CreatedEvent(Session s, MIRegisterCreatedEvent reg) { - session = s; - RegisterManager mgr = session.getRegisterManager(); - MISession miSession = reg.getMISession(); - int regno = reg.getNumber(); - source = mgr.getRegister(miSession, regno); - if (source == null) { - Target target = session.getTarget(miSession); - source = new CObject(target); - } - } - - public CreatedEvent(Session s, MIThreadCreatedEvent cthread) { - session = s; - MISession miSession = cthread.getMISession(); - Target target = session.getTarget(miSession); - source = target.getThread(cthread.getId()); - if (source == null) { - source = new CObject(target); - } - } - - public CreatedEvent(Session s, MIInferiorCreatedEvent inferior) { - session = s; - MISession miSession = inferior.getMISession(); - source = session.getTarget(miSession); - } - - public CreatedEvent(Session s, MIMemoryCreatedEvent mblock) { - session = s; - MemoryManager mgr = session.getMemoryManager(); - MISession miSession = mblock.getMISession(); - ICDIMemoryBlock[] blocks = mgr.getMemoryBlocks(miSession); - for (int i = 0; i < blocks.length; i++) { - if (blocks[i].getStartAddress().equals(mblock.getAddress()) && - blocks[i].getLength() == mblock.getLength()) { - source = blocks[i]; - break; - } - } - if (source == null) { - Target target = session.getTarget(miSession); - source = new CObject(target); - } - } - - public CreatedEvent(Session s, MISharedLibCreatedEvent slib) { - session = s; - SharedLibraryManager mgr = session.getSharedLibraryManager(); - MISession miSession = slib.getMISession(); - String name = slib.getName(); - source = mgr.getSharedLibrary(miSession, name); - if (source == null) { - Target target = session.getTarget(miSession); - source = new CObject(target); - } - } - - public CreatedEvent(Session s, ICDIObject src) { - session = s; - source = src; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.event.ICDIEvent#getSource() - */ - @Override - public ICDIObject getSource() { - return source; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/DestroyedEvent.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/DestroyedEvent.java deleted file mode 100644 index 6cc91079c91..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/DestroyedEvent.java +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi.event; - -import org.eclipse.cdt.debug.core.cdi.event.ICDIDestroyedEvent; -import org.eclipse.cdt.debug.core.cdi.model.ICDIObject; -import org.eclipse.cdt.debug.mi.core.MISession; -import org.eclipse.cdt.debug.mi.core.cdi.BreakpointManager; -import org.eclipse.cdt.debug.mi.core.cdi.ExpressionManager; -import org.eclipse.cdt.debug.mi.core.cdi.Session; -import org.eclipse.cdt.debug.mi.core.cdi.SharedLibraryManager; -import org.eclipse.cdt.debug.mi.core.cdi.VariableManager; -import org.eclipse.cdt.debug.mi.core.cdi.model.Breakpoint; -import org.eclipse.cdt.debug.mi.core.cdi.model.CObject; -import org.eclipse.cdt.debug.mi.core.cdi.model.SharedLibrary; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; -import org.eclipse.cdt.debug.mi.core.cdi.model.Thread; -import org.eclipse.cdt.debug.mi.core.cdi.model.Variable; -import org.eclipse.cdt.debug.mi.core.event.MIBreakpointDeletedEvent; -import org.eclipse.cdt.debug.mi.core.event.MISharedLibUnloadedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIThreadExitEvent; -import org.eclipse.cdt.debug.mi.core.event.MIVarDeletedEvent; - -/** - */ -public class DestroyedEvent implements ICDIDestroyedEvent { - - Session session; - ICDIObject source; - - public DestroyedEvent(Session s, MIThreadExitEvent cthread) { - session = s; - Target target = session.getTarget(cthread.getMISession()); - source = new Thread(target, cthread.getId()); - } - - public DestroyedEvent(Session s, MIVarDeletedEvent var) { - session = s; - VariableManager varMgr = session.getVariableManager(); - MISession miSession = var.getMISession(); - String varName = var.getVarName(); - Variable variable = varMgr.removeVariableFromList(miSession, varName); - if (variable != null) { - source = variable; - } else { - ExpressionManager expMgr = session.getExpressionManager(); - variable = expMgr.removeVariableFromList(miSession, varName); - if (variable != null) { - source = variable; - } else { - Target target = session.getTarget(miSession); - source = new CObject(target); - } - } - } - - public DestroyedEvent(Session s, MIBreakpointDeletedEvent bpoint) { - session = s; - BreakpointManager mgr = session.getBreakpointManager(); - MISession miSession = bpoint.getMISession(); - int number = bpoint.getNumber(); - Breakpoint breakpoint = mgr.getBreakpoint(miSession, number); - if (breakpoint != null) { - source = breakpoint; - mgr.deleteBreakpoint(miSession, number); - } else { - Target target = session.getTarget(miSession); - source = new CObject(target); - } - } - - public DestroyedEvent(Session s, MISharedLibUnloadedEvent slib) { - session = s; - SharedLibraryManager mgr = session.getSharedLibraryManager(); - MISession miSession = slib.getMISession(); - String name = slib.getName(); - SharedLibrary lib = mgr.getSharedLibrary(miSession, name); - if (lib != null) { - mgr.deleteSharedLibrary(miSession, lib); - source = lib; - } else { - Target target = session.getTarget(miSession); - source = new CObject(target); - } - } - - public DestroyedEvent(Session s, ICDIObject src) { - session = s; - source = src; - } - - public DestroyedEvent(Session s) { - session = s; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.event.ICDIEvent#getSource() - */ - @Override - public ICDIObject getSource() { - return source; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/DisconnectedEvent.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/DisconnectedEvent.java deleted file mode 100644 index 65b8d3f1dae..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/DisconnectedEvent.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.event; - -import org.eclipse.cdt.debug.core.cdi.event.ICDIDisconnectedEvent; -import org.eclipse.cdt.debug.core.cdi.model.ICDIObject; -import org.eclipse.cdt.debug.mi.core.cdi.Session; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; -import org.eclipse.cdt.debug.mi.core.event.MIDetachedEvent; - -/** - */ -public class DisconnectedEvent implements ICDIDisconnectedEvent { - - ICDIObject source; - - public DisconnectedEvent(Session session, MIDetachedEvent detach) { - Target target = session.getTarget(detach.getMISession()); - source = target; - } - - /** - * @see org.eclipse.cdt.debug.core..ICDIEvent#getSource() - */ - @Override - public ICDIObject getSource() { - return source; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/ExitedEvent.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/ExitedEvent.java deleted file mode 100644 index 8821d46877e..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/ExitedEvent.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi.event; - -import org.eclipse.cdt.debug.core.cdi.ICDISessionObject; -import org.eclipse.cdt.debug.core.cdi.event.ICDIExitedEvent; -import org.eclipse.cdt.debug.core.cdi.model.ICDIObject; -import org.eclipse.cdt.debug.mi.core.cdi.ExitInfo; -import org.eclipse.cdt.debug.mi.core.cdi.Session; -import org.eclipse.cdt.debug.mi.core.cdi.SignalExitInfo; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; -import org.eclipse.cdt.debug.mi.core.event.MIEvent; -import org.eclipse.cdt.debug.mi.core.event.MIGDBExitEvent; -import org.eclipse.cdt.debug.mi.core.event.MIInferiorExitEvent; -import org.eclipse.cdt.debug.mi.core.event.MIInferiorSignalExitEvent; - -/** - */ -public class ExitedEvent implements ICDIExitedEvent { - - MIEvent event; - Session session; - - public ExitedEvent(Session s, MIInferiorExitEvent e) { - session = s; - event = e; - } - - public ExitedEvent(Session s, MIInferiorSignalExitEvent e) { - session = s; - event = e; - } - - public ExitedEvent(Session s, MIGDBExitEvent e) { - session = s; - event = e; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.event.ICDIExitedEvent#getExitInfo() - */ - @Override - public ICDISessionObject getReason() { - if (event instanceof MIInferiorExitEvent) { - return new ExitInfo(session, (MIInferiorExitEvent)event); - } else if (event instanceof MIInferiorSignalExitEvent) { - return new SignalExitInfo(session, (MIInferiorSignalExitEvent)event); - } - return session; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.event.ICDIEvent#getSource() - */ - @Override - public ICDIObject getSource() { - Target target = session.getTarget(event.getMISession()); - return target; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/MemoryChangedEvent.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/MemoryChangedEvent.java deleted file mode 100644 index bc396f8cba4..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/MemoryChangedEvent.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi.event; - -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.cdt.debug.core.cdi.event.ICDIMemoryChangedEvent; -import org.eclipse.cdt.debug.core.cdi.model.ICDIObject; -import org.eclipse.cdt.debug.mi.core.cdi.Session; -import org.eclipse.cdt.debug.mi.core.cdi.model.MemoryBlock; -import org.eclipse.cdt.debug.mi.core.event.MIMemoryChangedEvent; - -/** - */ -public class MemoryChangedEvent implements ICDIMemoryChangedEvent { - - Session session; - MemoryBlock source; - MIMemoryChangedEvent miMem; - - public MemoryChangedEvent(Session s, MemoryBlock block, MIMemoryChangedEvent mem) { - session = s; - source = block; - miMem = mem; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.event.ICDIEvent#getAddresses() - */ - @Override - public BigInteger[] getAddresses() { - /* But only returns the address that are in the block. */ - BigInteger[] mi_addresses = miMem.getAddresses(); - List aList = new ArrayList(mi_addresses.length); - for (int i = 0; i < mi_addresses.length; i++) { - if (source.contains(mi_addresses[i])) { - aList.add(mi_addresses[i]); - } - } - return (BigInteger[]) aList.toArray(new BigInteger[aList.size()]); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.event.ICDIEvent#getSource() - */ - @Override - public ICDIObject getSource() { - return source; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/ResumedEvent.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/ResumedEvent.java deleted file mode 100644 index b17e5bc8127..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/ResumedEvent.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi.event; - -import org.eclipse.cdt.debug.core.cdi.event.ICDIResumedEvent; -import org.eclipse.cdt.debug.core.cdi.model.ICDIObject; -import org.eclipse.cdt.debug.mi.core.cdi.Session; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; -import org.eclipse.cdt.debug.mi.core.event.MIRunningEvent; - -/** - */ -public class ResumedEvent implements ICDIResumedEvent { - - Session session; - MIRunningEvent event; - - public ResumedEvent(Session s, MIRunningEvent e) { - session = s; - event = e; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.event.ICDIEvent#getSource() - */ - @Override - public ICDIObject getSource() { - // We can send the target as the Source. CDI - // Will assume that all threads are supended for this. - // This is true for gdb when it suspend the inferior - // all threads are suspended. - Target target = session.getTarget(event.getMISession()); - return target; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.event.ICDIResumedEvent#getType() - */ - @Override - public int getType() { - MIRunningEvent running = event; - int type = running.getType(); - int cdiType = 0; - switch (type) { - case MIRunningEvent.CONTINUE: - cdiType = ICDIResumedEvent.CONTINUE; - break; - - case MIRunningEvent.UNTIL: - case MIRunningEvent.NEXT: - cdiType = ICDIResumedEvent.STEP_OVER; - break; - - case MIRunningEvent.NEXTI: - cdiType = ICDIResumedEvent.STEP_OVER_INSTRUCTION; - break; - - case MIRunningEvent.STEP: - cdiType = ICDIResumedEvent.STEP_INTO; - break; - - case MIRunningEvent.STEPI: - cdiType = ICDIResumedEvent.STEP_INTO_INSTRUCTION; - break; - - case MIRunningEvent.RETURN: - case MIRunningEvent.FINISH: - cdiType = ICDIResumedEvent.STEP_RETURN; - break; - - } - return cdiType; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/SuspendedEvent.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/SuspendedEvent.java deleted file mode 100644 index 22540949746..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/SuspendedEvent.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi.event; - -import org.eclipse.cdt.debug.core.cdi.ICDISessionObject; -import org.eclipse.cdt.debug.core.cdi.event.ICDISuspendedEvent; -import org.eclipse.cdt.debug.core.cdi.model.ICDIObject; -import org.eclipse.cdt.debug.mi.core.cdi.BreakpointHit; -import org.eclipse.cdt.debug.mi.core.cdi.BreakpointManager; -import org.eclipse.cdt.debug.mi.core.cdi.EndSteppingRange; -import org.eclipse.cdt.debug.mi.core.cdi.ErrorInfo; -import org.eclipse.cdt.debug.mi.core.cdi.EventBreakpointHit; -import org.eclipse.cdt.debug.mi.core.cdi.FunctionFinished; -import org.eclipse.cdt.debug.mi.core.cdi.Session; -import org.eclipse.cdt.debug.mi.core.cdi.SharedLibraryEvent; -import org.eclipse.cdt.debug.mi.core.cdi.SignalReceived; -import org.eclipse.cdt.debug.mi.core.cdi.WatchpointScope; -import org.eclipse.cdt.debug.mi.core.cdi.WatchpointTrigger; -import org.eclipse.cdt.debug.mi.core.cdi.model.Breakpoint; -import org.eclipse.cdt.debug.mi.core.cdi.model.EventBreakpoint; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; -import org.eclipse.cdt.debug.mi.core.event.MIBreakpointHitEvent; -import org.eclipse.cdt.debug.mi.core.event.MIErrorEvent; -import org.eclipse.cdt.debug.mi.core.event.MIEvent; -import org.eclipse.cdt.debug.mi.core.event.MIFunctionFinishedEvent; -import org.eclipse.cdt.debug.mi.core.event.MILocationReachedEvent; -import org.eclipse.cdt.debug.mi.core.event.MISharedLibEvent; -import org.eclipse.cdt.debug.mi.core.event.MISignalEvent; -import org.eclipse.cdt.debug.mi.core.event.MISteppingRangeEvent; -import org.eclipse.cdt.debug.mi.core.event.MIWatchpointScopeEvent; -import org.eclipse.cdt.debug.mi.core.event.MIWatchpointTriggerEvent; -import org.eclipse.cdt.gdb.internal.eventbkpts.GdbCatchpoints; - -/** - * - */ -public class SuspendedEvent implements ICDISuspendedEvent { - - MIEvent event; - Session session; - - public SuspendedEvent(Session s, MIEvent e) { - session = s; - event = e; - } - - @Override - public ICDISessionObject getReason() { - if (event instanceof MIBreakpointHitEvent) { - // A Catchpoint hit is reported by gdb as a breakpoint hit. We can - // tell it's a catchpoint by looking at why kind of CDT-created - // platform breakpoint is associated with it - BreakpointManager bkptMgr = session.getBreakpointManager(); - Breakpoint bkpt = bkptMgr.getBreakpoint(event.getMISession(), ((MIBreakpointHitEvent)event).getNumber()); - if (bkpt instanceof EventBreakpoint) { - return new EventBreakpointHit(session, GdbCatchpoints.eventToGdbCatchpointKeyword(((EventBreakpoint)bkpt).getEventType())); - } - else { - return new BreakpointHit(session, (MIBreakpointHitEvent)event); - } - } else if (event instanceof MIWatchpointTriggerEvent) { - return new WatchpointTrigger(session, (MIWatchpointTriggerEvent)event); - } else if (event instanceof MIWatchpointScopeEvent) { - return new WatchpointScope(session, (MIWatchpointScopeEvent)event); - } else if (event instanceof MISteppingRangeEvent) { - return new EndSteppingRange(session); - } else if (event instanceof MISignalEvent) { - return new SignalReceived(session, (MISignalEvent)event); - } else if (event instanceof MILocationReachedEvent) { - return new EndSteppingRange(session); - } else if (event instanceof MIFunctionFinishedEvent) { - return new FunctionFinished(session, (MIFunctionFinishedEvent)event); - } else if (event instanceof MIErrorEvent) { - return new ErrorInfo(session, (MIErrorEvent)event); - } else if (event instanceof MISharedLibEvent) { - return new SharedLibraryEvent(session); - } - return session; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.event.ICDIEvent#getSource() - */ - @Override - public ICDIObject getSource() { - Target target = session.getTarget(event.getMISession()); - // We can send the target as the Source. CDI - // Will assume that all threads are supended for this. - // This is true for gdb when it suspend the inferior - // all threads are suspended. - return target; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/AddressBreakpoint.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/AddressBreakpoint.java deleted file mode 100644 index 3abd32bb719..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/AddressBreakpoint.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.ICDICondition; -import org.eclipse.cdt.debug.core.cdi.ICDILocation; -import org.eclipse.cdt.debug.core.cdi.model.ICDIAddressBreakpoint; - -public class AddressBreakpoint extends LocationBreakpoint implements - ICDIAddressBreakpoint { - - public AddressBreakpoint(Target target, int kind, ICDILocation loc, - ICDICondition cond, boolean enabled) { - super(target, kind, loc, cond, enabled); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/AddressLocation.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/AddressLocation.java deleted file mode 100644 index 182662dd983..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/AddressLocation.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model; - -import java.math.BigInteger; - -import org.eclipse.cdt.debug.core.cdi.ICDIAddressLocation; -import org.eclipse.cdt.debug.mi.core.cdi.Location; - -public class AddressLocation extends Location implements ICDIAddressLocation { - - public AddressLocation(BigInteger address) { - super(address); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Argument.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Argument.java deleted file mode 100644 index fe12e7b1d27..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Argument.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.model.ICDIArgument; -import org.eclipse.cdt.debug.mi.core.command.MIVarCreate; -import org.eclipse.cdt.debug.mi.core.output.MIVar; - -/** - */ -public class Argument extends Variable implements ICDIArgument { - - public Argument(Target target, Thread thread, StackFrame frame, - String n, String q, int pos, int depth, MIVar v) { - super(target, thread, frame, n, q, pos, depth, v); - } - - public Argument(ArgumentDescriptor obj, MIVarCreate var) { - super(obj, var); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.core.cdi.model.Variable#createVariable(org.eclipse.cdt.debug.mi.core.cdi.model.Target, org.eclipse.cdt.debug.core.cdi.model.ICDIThread, org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame, java.lang.String, java.lang.String, int, int, org.eclipse.cdt.debug.mi.core.output.MIVar) - */ - @Override - protected Variable createVariable(Target target, Thread thread, StackFrame frame, String name, String fullName, int pos, int depth, MIVar miVar) { - return new Argument(target, thread, frame, name, fullName, pos, depth, miVar); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.core.cdi.model.Variable#createDescriptor(org.eclipse.cdt.debug.mi.core.cdi.model.Target, org.eclipse.cdt.debug.mi.core.cdi.model.Thread, org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame, java.lang.String, java.lang.String, int, int) - */ - @Override - protected VariableDescriptor createDescriptor(Target target, Thread thread, StackFrame frame, String n, String fn, int pos, int depth) { - return new ArgumentDescriptor(target, thread, frame, n, fn, pos, depth); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/ArgumentDescriptor.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/ArgumentDescriptor.java deleted file mode 100644 index ae1787bc789..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/ArgumentDescriptor.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.model.ICDIArgumentDescriptor; - -/** - */ -public class ArgumentDescriptor extends LocalVariableDescriptor implements ICDIArgumentDescriptor { - - public ArgumentDescriptor(Target target, Thread thread, StackFrame frame, String n, String fn, - int pos, int depth) { - super(target, thread, frame, n, fn, pos, depth); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Breakpoint.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Breakpoint.java deleted file mode 100644 index 721686fe782..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Breakpoint.java +++ /dev/null @@ -1,155 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi.model; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.ICDICondition; -import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint2; -import org.eclipse.cdt.debug.core.model.ICBreakpointType; -import org.eclipse.cdt.debug.mi.core.cdi.BreakpointManager; -import org.eclipse.cdt.debug.mi.core.cdi.Condition; -import org.eclipse.cdt.debug.mi.core.cdi.Session; -import org.eclipse.cdt.debug.mi.core.output.MIBreakpoint; - -/** - */ -public abstract class Breakpoint extends CObject implements ICDIBreakpoint2 { - - ICDICondition condition; - MIBreakpoint[] miBreakpoints; - - /** - * One of the type constants in ICBreakpointType - */ - int type; - - boolean enabled; - - public Breakpoint(Target target, int type, ICDICondition condition, boolean enabled) { - super(target); - this.type = type; - this.condition = condition; - this.enabled = enabled; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint2#getType() - */ - @Override - public int getType() { - return type; - } - - public MIBreakpoint[] getMIBreakpoints() { - return miBreakpoints; - } - - public void setMIBreakpoints(MIBreakpoint[] newMIBreakpoints) { - miBreakpoints = newMIBreakpoints; - } - - public boolean isDeferred() { - return (miBreakpoints == null || miBreakpoints.length == 0); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#getCondition() - */ - @Override - public ICDICondition getCondition() throws CDIException { - if (condition == null) { - if (miBreakpoints != null && miBreakpoints.length > 0) { - List list = new ArrayList(miBreakpoints.length); - for (int i = 0; i < miBreakpoints.length; i++) { - String tid = miBreakpoints[i].getThreadId(); - if (tid != null && tid.length() > 0) { - list.add(miBreakpoints[i].getThreadId()); - } - } - String[] tids = (String[]) list.toArray(new String[list.size()]); - int icount = miBreakpoints[0].getIgnoreCount(); - String exp = miBreakpoints[0].getCondition(); - condition = new Condition(icount, exp, tids); - } else { - condition = new Condition(0, new String(), null); - } - } - return condition; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#isEnabled() - */ - @Override - public boolean isEnabled() throws CDIException { - return enabled; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint#isHardware() - * - * CDT 5.0 won't call this deprecated method (since we implement - * ICDIBreakpoint2), but we use it ourselves. - */ - @Override - public boolean isHardware() { - // ignore the TEMPORARY bit qualifier - return ((type & ~ICBreakpointType.TEMPORARY) == ICBreakpointType.HARDWARE); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint#isTemporary() - * - * CDT 5.0 won't call this deprecated method (since we implement - * ICDIBreakpoint2), but we use it ourselves. - */ - @Override - public boolean isTemporary() { - return (type & ICBreakpointType.TEMPORARY) != 0; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#setCondition(ICDICondition) - */ - @Override - public void setCondition(ICDICondition newCondition) throws CDIException { - Session session = (Session)getTarget().getSession(); - BreakpointManager mgr = session.getBreakpointManager(); - mgr.setCondition(this, newCondition); - setCondition0(newCondition); - } - - public void setCondition0(ICDICondition newCondition) { - condition = newCondition; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#setEnabled(boolean) - */ - @Override - public void setEnabled(boolean on) throws CDIException { - Session session = (Session)getTarget().getSession(); - BreakpointManager mgr = session.getBreakpointManager(); - if (on == false && isEnabled() == true) { - mgr.disableBreakpoint(this); - } else if (on == true && isEnabled() == false) { - mgr.enableBreakpoint(this); - } - } - - public void setEnabled0(boolean on) { - enabled = on; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/CObject.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/CObject.java deleted file mode 100644 index e5f129c3cf7..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/CObject.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.model.ICDIObject; -import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; - -/** - */ -public class CObject implements ICDIObject { - - protected Target fTarget; - - public CObject(Target t) { - fTarget = t; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIObject#getTarget() - */ - @Override - public ICDITarget getTarget() { - return fTarget; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/CoreFileConfiguration.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/CoreFileConfiguration.java deleted file mode 100644 index 952b4b2d2eb..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/CoreFileConfiguration.java +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.model.ICDITargetConfiguration; - -public class CoreFileConfiguration extends CObject implements ICDITargetConfiguration { - - /** - * @param t - */ - public CoreFileConfiguration(Target t) { - super(t); - } - - @Override - public boolean supportsTerminate() { - return true; - } - - @Override - public boolean supportsDisconnect() { - return false; - } - - @Override - public boolean supportsRestart() { - return false; - } - - @Override - public boolean supportsStepping() { - return false; - } - - @Override - public boolean supportsInstructionStepping() { - return false; - } - - @Override - public boolean supportsBreakpoints() { - return false; - } - - @Override - public boolean supportsRegisters() { - return true; - } - - @Override - public boolean supportsRegisterModification() { - return false; - } - - @Override - public boolean supportsMemoryRetrieval() { - return true; - } - - @Override - public boolean supportsMemoryModification() { - return false; - } - - @Override - public boolean supportsExpressionEvaluation() { - return true; - } - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIConfiguration#supportsResume() - */ - @Override - public boolean supportsResume() { - return false; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIConfiguration#supportsSuspend() - */ - @Override - public boolean supportsSuspend() { - return false; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIConfiguration#supportsSharedLibrary() - */ - @Override - public boolean supportsSharedLibrary() { - return true; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIConfiguration#terminateSessionOnExit() - */ - public boolean terminateSessionOnExit() { - return true; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/EventBreakpoint.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/EventBreakpoint.java deleted file mode 100644 index 5aa8177aff8..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/EventBreakpoint.java +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi.model; - -import java.util.Arrays; - -import org.eclipse.cdt.debug.core.cdi.ICDICondition; -import org.eclipse.cdt.debug.core.cdi.model.ICDIEventBreakpoint; -import org.eclipse.cdt.debug.core.model.ICBreakpointType; -import org.eclipse.cdt.debug.mi.core.output.MIBreakpoint; -import org.eclipse.cdt.gdb.eventbkpts.IEventBreakpointConstants; -import org.eclipse.cdt.gdb.internal.eventbkpts.GdbCatchpoints; - -/** - * @since 6.0 - */ -public class EventBreakpoint extends Breakpoint implements ICDIEventBreakpoint { - - - private String eventType; - private String arg; - - public EventBreakpoint(Target target, String event, String arg, ICDICondition cond, boolean enabled) { - super(target, ICBreakpointType.REGULAR, cond, enabled); - this.eventType = event; - this.arg = arg==null?"":arg; //$NON-NLS-1$ - } - - @Override - public String getEventType() { - return eventType; - } - - @Override - public String getExtraArgument() { - return arg; - } - - /** - * Returns the gdb catchpoint keyword associated with this event breakpoint - * (e.g., "signal", "throw") - */ - public String getGdbEvent() { - return GdbCatchpoints.eventToGdbCatchpointKeyword(getEventType()); - } - - public String getGdbArg() { - return getExtraArgument(); - } - - @Override - public int hashCode() { - return eventType.hashCode(); - } - @Override - public boolean equals(Object arg0) { - if (this == arg0) return true; - if (!(arg0 instanceof EventBreakpoint)) return false; - MIBreakpoint[] breakpoints = getMIBreakpoints(); - if (breakpoints==null || breakpoints.length==0) { - return super.equals(arg0); - } - return Arrays.equals(breakpoints, ((EventBreakpoint)arg0).getMIBreakpoints()); - } - /** - * Returns event type by using miBreakpoint parameters - * @param miBreakpoint - * @return null if unknown type, null cannot be used to create valid EventBreakpoint - */ - public static String getEventTypeFromMI(MIBreakpoint miBreakpoint) { - // Two exceptions to how the message is typically formatted - if (miBreakpoint.getWhat().equals("exception catch")) { //$NON-NLS-1$ - return IEventBreakpointConstants.EVENT_TYPE_CATCH; - } else if (miBreakpoint.getWhat().equals("exception throw")) { //$NON-NLS-1$ - return IEventBreakpointConstants.EVENT_TYPE_THROW; - } - - String miType = miBreakpoint.getType(); - final String PREFIX = "catch "; //$NON-NLS-1$ - if (miType.startsWith(PREFIX)) { - String keyword = miType.substring(PREFIX.length()); - return GdbCatchpoints.gdbCatchpointKeywordToEvent(keyword); - } - return null; // not known/supported - } - - public static String getEventArgumentFromMI(MIBreakpoint miBreakpoint) { - // need a working gdb command command that support catch event argument test test - return ""; //$NON-NLS-1$ - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Exceptionpoint.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Exceptionpoint.java deleted file mode 100644 index 020908b5bf9..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Exceptionpoint.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.ICDICondition; -import org.eclipse.cdt.debug.core.cdi.model.ICDIExceptionpoint; -import org.eclipse.cdt.debug.core.model.ICBreakpointType; - -/** - * Exceptionpoint - */ -public class Exceptionpoint extends Breakpoint implements ICDIExceptionpoint { - - String fClazz; - boolean fStopOnThrow; - boolean fStopOnCatch; - - /** - */ - public Exceptionpoint(Target target, String clazz, boolean stopOnThrow, boolean stopOnCatch, ICDICondition cond, boolean enabled) { - super(target, ICBreakpointType.REGULAR, cond, enabled); - fClazz = clazz; - fStopOnThrow = stopOnThrow; - fStopOnCatch = stopOnCatch; - } - - public String getExceptionName() { - return fClazz; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExceptionpoint#isStopOnThrow() - */ - @Override - public boolean isStopOnThrow() { - return fStopOnThrow; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExceptionpoint#isStopOnCatch() - */ - @Override - public boolean isStopOnCatch() { - return fStopOnCatch; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Expression.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Expression.java deleted file mode 100644 index 3be6d86a5b9..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Expression.java +++ /dev/null @@ -1,139 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.ICDIExpression; -import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame; -import org.eclipse.cdt.debug.core.cdi.model.ICDIValue; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType; -import org.eclipse.cdt.debug.mi.core.cdi.ExpressionManager; -import org.eclipse.cdt.debug.mi.core.cdi.Session; -import org.eclipse.cdt.debug.mi.core.cdi.SourceManager; -import org.eclipse.cdt.debug.mi.core.cdi.model.type.IncompleteType; -import org.eclipse.cdt.debug.mi.core.cdi.model.type.Type; - - -/** - */ -public class Expression extends CObject implements ICDIExpression { - - private static int ID_COUNT = 0; - private int id; - String fExpression; - Type fType; - Variable fVariable; - ICDIStackFrame fContext; - - public Expression(Target target, String ex) { - super(target); - fExpression = ex; - id = ++ID_COUNT; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExpression#getExpressionText() - */ - @Override - public String getExpressionText() { - return fExpression; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExpression#equals(org.eclipse.cdt.debug.core.cdi.model.ICDIExpression) - */ - @Override - public boolean equals(ICDIExpression obj) { - if (obj instanceof Expression) { - Expression other = (Expression)obj; - return other.id == id; - } - return false; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariable#getType() - */ - public ICDIType getType(ICDIStackFrame frame) throws CDIException { - Type type = null; - Target target = (Target)getTarget(); - Session session = (Session) (target.getSession()); - SourceManager sourceMgr = session.getSourceManager(); - String nametype = sourceMgr.getTypeNameFromVariable((StackFrame)frame, getExpressionText()); - try { - type = sourceMgr.getType(target, nametype); - } catch (CDIException e) { - // Try with ptype. - try { - String ptype = sourceMgr.getDetailTypeName(target, nametype); - type = sourceMgr.getType(target, ptype); - } catch (CDIException ex) { - // Some version of gdb does not work with the name of the class - // ex: class data foo --> ptype data --> fails - // ex: class data foo --> ptype foo --> succeed - try { - String ptype = sourceMgr.getDetailTypeNameFromVariable((StackFrame)frame, getExpressionText()); - type = sourceMgr.getType(target, ptype); - } catch (CDIException e2) { - // give up. - } - } - } - if (type == null) { - type = new IncompleteType(target, nametype); - } - - return type; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExpression#getValue(org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame) - */ - @Override - public ICDIValue getValue(ICDIStackFrame context) throws CDIException { - Session session = (Session)getTarget().getSession(); - ExpressionManager mgr = session.getExpressionManager(); - if (fVariable != null && fContext != null && !context.equals(fContext)) - { // Get rid of the underlying variable if the context has changed. - // This is defensive, in practice each stack frame has it's own - // list of expressions. - mgr.deleteVariable(fVariable); - fVariable = null; - } - fContext = context; - if (fVariable != null) { - // Reuse the variable so we don't have to ask gdb to create another one. Bug 150565. - try { - // It's possible this variable is no longer valid... (Bug 296006) - fVariable.getValue().getValueString(); - } catch (CDIException e) { - fVariable = null; - } - } - if (fVariable == null) - fVariable = mgr.createVariable((StackFrame)context, getExpressionText()); - return fVariable.getValue(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExpression#dispose() - */ - @Override - public void dispose() throws CDIException { - Session session = (Session)getTarget().getSession(); - ExpressionManager mgr = session.getExpressionManager(); - mgr.destroyExpressions((Target)getTarget(), new Expression[] {this}); - if (fVariable != null) - mgr.deleteVariable(fVariable); - fVariable = null; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/FunctionBreakpoint.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/FunctionBreakpoint.java deleted file mode 100644 index 73d2ca9e71f..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/FunctionBreakpoint.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.ICDICondition; -import org.eclipse.cdt.debug.core.cdi.ICDILocation; -import org.eclipse.cdt.debug.core.cdi.model.ICDIFunctionBreakpoint; - -public class FunctionBreakpoint extends LocationBreakpoint implements - ICDIFunctionBreakpoint { - - public FunctionBreakpoint(Target target, int kind, ICDILocation loc, - ICDICondition cond, boolean enabled) { - super(target, kind, loc, cond, enabled); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/FunctionLocation.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/FunctionLocation.java deleted file mode 100644 index 3d0eee9c3fe..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/FunctionLocation.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model; - - -import org.eclipse.cdt.debug.core.cdi.ICDIFunctionLocation; -import org.eclipse.cdt.debug.mi.core.cdi.Location; - -public class FunctionLocation extends Location implements ICDIFunctionLocation { - - public FunctionLocation(String file, String function) { - super(file, function); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/GlobalVariable.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/GlobalVariable.java deleted file mode 100644 index 43831601a14..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/GlobalVariable.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.model.ICDIGlobalVariable; -import org.eclipse.cdt.debug.mi.core.command.MIVarCreate; -import org.eclipse.cdt.debug.mi.core.output.MIVar; - -/** - * GlobalVariable - */ -public class GlobalVariable extends Variable implements ICDIGlobalVariable { - - - /** - * @param obj - * @param v - */ - public GlobalVariable(VariableDescriptor obj, MIVarCreate v) { - super(obj, v); - } - - /** - * @param target - * @param n - * @param q - * @param thread - * @param stack - * @param pos - * @param depth - * @param v - */ - public GlobalVariable(Target target, Thread thread, StackFrame frame, String n, String q, int pos, int depth, MIVar miVar) { - super(target, thread, frame, n, q, pos, depth, miVar); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.core.cdi.model.Variable#createVariable(org.eclipse.cdt.debug.mi.core.cdi.model.Target, java.lang.String, java.lang.String, org.eclipse.cdt.debug.core.cdi.model.ICDIThread, org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame, int, int, org.eclipse.cdt.debug.mi.core.output.MIVar) - */ - @Override - protected Variable createVariable(Target target, Thread thread, StackFrame frame, String name, String fullName, int pos, int depth, MIVar miVar) { - return new GlobalVariable(target, thread, frame, name, fullName, pos, depth, miVar); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.core.cdi.model.Variable#createDescriptor(org.eclipse.cdt.debug.mi.core.cdi.model.Target, org.eclipse.cdt.debug.mi.core.cdi.model.Thread, org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame, java.lang.String, java.lang.String, int, int) - */ - @Override - protected VariableDescriptor createDescriptor(Target target, Thread thread, StackFrame frame, String n, String fn, int pos, int depth) { - return new GlobalVariableDescriptor(target, thread, frame, n, fn, pos, depth); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/GlobalVariableDescriptor.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/GlobalVariableDescriptor.java deleted file mode 100644 index 62fde45a0d4..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/GlobalVariableDescriptor.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.model.ICDIGlobalVariableDescriptor; - -/** - * GlobalVariableDescriptor - */ -public class GlobalVariableDescriptor extends VariableDescriptor implements ICDIGlobalVariableDescriptor { - - /** - * @param target - * @param thread - * @param stack - * @param n - * @param fn - * @param pos - * @param depth - */ - public GlobalVariableDescriptor(Target target, Thread thread, - StackFrame stack, String n, String fn, int pos, int depth) { - super(target, thread, stack, n, fn, pos, depth); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Instruction.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Instruction.java deleted file mode 100644 index 86f840add63..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Instruction.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi.model; - -import java.math.BigInteger; - -import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction; -import org.eclipse.cdt.debug.mi.core.MIFormat; -import org.eclipse.cdt.debug.mi.core.output.MIAsm; - -/** - */ -public class Instruction extends CObject implements ICDIInstruction { - - MIAsm asm; - - public Instruction(Target target, MIAsm a) { - super(target); - asm = a; - } - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction#getAdress() - */ - @Override - public BigInteger getAdress() { - return MIFormat.getBigInteger(asm.getAddress()); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction#getFuntionName() - */ - @Override - public String getFuntionName() { - return asm.getFunction(); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction#getInstruction() - */ - @Override - public String getInstruction() { - return asm.getInstruction(); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction#getOffset() - */ - @Override - public long getOffset() { - return asm.getOffset(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction#getArgs() - */ - @Override - public String getArgs() { - return asm.getArgs(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction#getOpcode() - */ - @Override - public String getOpcode() { - return asm.getOpcode(); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/LineBreakpoint.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/LineBreakpoint.java deleted file mode 100644 index f986ac43d0e..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/LineBreakpoint.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.ICDICondition; -import org.eclipse.cdt.debug.core.cdi.ICDILineLocation; -import org.eclipse.cdt.debug.core.cdi.model.ICDILineBreakpoint; - -public class LineBreakpoint extends LocationBreakpoint implements ICDILineBreakpoint { - - public LineBreakpoint(Target target, int kind, ICDILineLocation loc, ICDICondition cond, boolean enabled) { - super(target, kind, loc, cond, enabled); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/LocalVariable.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/LocalVariable.java deleted file mode 100644 index 3062adce851..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/LocalVariable.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.model.ICDILocalVariable; -import org.eclipse.cdt.debug.mi.core.command.MIVarCreate; -import org.eclipse.cdt.debug.mi.core.output.MIVar; - -/** - * LocalVariable - */ -public class LocalVariable extends Variable implements ICDILocalVariable { - - /** - * @param obj - * @param v - */ - public LocalVariable(LocalVariableDescriptor obj, MIVarCreate v) { - super(obj, v); - } - - public LocalVariable(Target target, Thread thread, StackFrame frame, String n, String q, - int pos, int depth, MIVar miVar) { - super(target, thread, frame, n, q, pos, depth, miVar); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.core.cdi.model.Variable#createVariable(org.eclipse.cdt.debug.mi.core.cdi.model.Target, java.lang.String, java.lang.String, org.eclipse.cdt.debug.core.cdi.model.ICDIThread, org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame, int, int, org.eclipse.cdt.debug.mi.core.output.MIVar) - */ - @Override - protected Variable createVariable(Target target, Thread thread, StackFrame frame, String name, - String fullName, int pos, int depth, MIVar miVar) { - return new LocalVariable(target, thread, frame, name, fullName, pos, depth, miVar); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.core.cdi.model.Variable#createDescriptor(org.eclipse.cdt.debug.mi.core.cdi.model.Target, org.eclipse.cdt.debug.mi.core.cdi.model.Thread, org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame, java.lang.String, java.lang.String, int, int) - */ - @Override - protected VariableDescriptor createDescriptor(Target target, Thread thread, StackFrame frame, String n, String fn, int pos, int depth) { - return new LocalVariableDescriptor(target, thread, frame, n, fn, pos, depth); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/LocalVariableDescriptor.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/LocalVariableDescriptor.java deleted file mode 100644 index b3f03cf4068..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/LocalVariableDescriptor.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.model.ICDILocalVariableDescriptor; - -/** - * LocalVariableDescriptor - */ -public class LocalVariableDescriptor extends VariableDescriptor implements - ICDILocalVariableDescriptor { - - /** - * @param target - * @param n - * @param fn - * @param stack - * @param pos - * @param depth - */ - public LocalVariableDescriptor(Target target, Thread thread, StackFrame frame, String n, String fn, int pos, int depth) { - super(target, thread, frame, n, fn, pos, depth); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/LocationBreakpoint.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/LocationBreakpoint.java deleted file mode 100644 index fd531173df8..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/LocationBreakpoint.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model; - -import java.math.BigInteger; - -import org.eclipse.cdt.debug.core.cdi.ICDIAddressLocation; -import org.eclipse.cdt.debug.core.cdi.ICDICondition; -import org.eclipse.cdt.debug.core.cdi.ICDIFunctionLocation; -import org.eclipse.cdt.debug.core.cdi.ICDILineLocation; -import org.eclipse.cdt.debug.core.cdi.ICDILocation; -import org.eclipse.cdt.debug.core.cdi.ICDILocator; -import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint; -import org.eclipse.cdt.debug.mi.core.MIFormat; -import org.eclipse.cdt.debug.mi.core.cdi.Locator; - -public abstract class LocationBreakpoint extends Breakpoint implements ICDIBreakpoint { - - ICDILocation fLocation; - - public LocationBreakpoint(Target target, int kind, ICDILocation loc, ICDICondition cond, boolean enabled) { - super(target, kind, cond, enabled); - fLocation = loc; - } - - public int getLineNumber() { - if (miBreakpoints != null && miBreakpoints.length > 0) { - return miBreakpoints[0].getLine(); - } else if (fLocation instanceof ICDILineLocation) { - return ((ICDILineLocation)fLocation).getLineNumber(); - } - return 0; - } - - public String getFile() { - if (miBreakpoints != null && miBreakpoints.length > 0) { - return miBreakpoints[0].getFile(); - } else if (fLocation instanceof ICDILineLocation) { - return ((ICDILineLocation)fLocation).getFile(); - } else if (fLocation instanceof ICDIFunctionLocation) { - return ((ICDIFunctionLocation)fLocation).getFile(); - } - return null; - } - - public BigInteger getAddress() { - if (miBreakpoints != null && miBreakpoints.length > 0) { - BigInteger addr = BigInteger.ZERO; - String a = miBreakpoints[0].getAddress(); - if (a != null) { - addr = MIFormat.getBigInteger(a); - } - return addr; - } else if (fLocation instanceof ICDIAddressLocation) { - return ((ICDIAddressLocation)fLocation).getAddress(); - } - return null; - } - - public String getFunction() { - // TODO: We need to review this but for now - // we need to return what the cdt debug passed us - // it is necessary when they do the comparison. - if (fLocation instanceof ICDIFunctionLocation) { - return ((ICDIFunctionLocation)fLocation).getFunction(); - } else if (miBreakpoints != null && miBreakpoints.length > 0) { - return miBreakpoints[0].getFunction(); - } /*else if (fLocation instanceof ICDIFunctionLocation) { - return ((ICDIFunctionLocation)fLocation).getFunction(); - }*/ - return null; - } - - public ICDILocator getLocator() { - return new Locator(getFile(), getFunction(), getLineNumber(), getAddress()); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/MappedSourceLocation.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/MappedSourceLocation.java deleted file mode 100644 index 2c3e53ee4c3..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/MappedSourceLocation.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2012 Nokia and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nokia - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi.model; - -import org.eclipse.cdt.core.IAddress; -import org.eclipse.cdt.debug.core.cdi.model.ICDIAddressToSource; -import org.eclipse.cdt.debug.mi.core.output.CLIInfoLineInfo; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; - -public class MappedSourceLocation implements ICDIAddressToSource.IMappedSourceLocation { - - private CLIInfoLineInfo lineInfo; - private IAddress address; - private String executable; - - public MappedSourceLocation(IAddress address, CLIInfoLineInfo lineInfo, String executable) { - this.address = address; - this.lineInfo = lineInfo; - this.executable = executable; - } - - @Override - public IAddress getAddress() { - return address; - } - - @Override - public IPath getExecutable() { - return Path.fromOSString(executable); - } - - @Override - public String getFunctionName() { - return lineInfo.getStartLocation(); - } - - @Override - public int getLineNumber() { - return lineInfo.getLineNumber(); - } - - @Override - public IPath getSourceFile() { - return Path.fromOSString(lineInfo.getFileName()); - } - - @Override - public String getUnmangledFunctionName() { - return lineInfo.getStartLocation(); - } - - @Override - public int compareTo(Object arg0) { - return address.compareTo(arg0); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/MemoryBlock.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/MemoryBlock.java deleted file mode 100644 index d0e11cab845..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/MemoryBlock.java +++ /dev/null @@ -1,377 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model; - -import java.math.BigInteger; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock; -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.MIFormat; -import org.eclipse.cdt.debug.mi.core.MISession; -import org.eclipse.cdt.debug.mi.core.cdi.CdiResources; -import org.eclipse.cdt.debug.mi.core.cdi.ExpressionManager; -import org.eclipse.cdt.debug.mi.core.cdi.MI2CDIException; -import org.eclipse.cdt.debug.mi.core.cdi.MemoryManager; -import org.eclipse.cdt.debug.mi.core.cdi.RegisterManager; -import org.eclipse.cdt.debug.mi.core.cdi.Session; -import org.eclipse.cdt.debug.mi.core.cdi.VariableManager; -import org.eclipse.cdt.debug.mi.core.command.CommandFactory; -import org.eclipse.cdt.debug.mi.core.command.MIDataWriteMemory; -import org.eclipse.cdt.debug.mi.core.output.MIDataReadMemoryInfo; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIMemory; - -/** - */ -public class MemoryBlock extends CObject implements ICDIMemoryBlock { - - String expression; - boolean frozen; - boolean dirty; - - private MIDataReadMemoryInfo mem; - private int fWordSize; - private BigInteger cStartAddress; //cached start address - private byte[] cBytes; //cached bytes - private int[] badOffsets; - private boolean fIsLittleEndian; - - public MemoryBlock(Target target, String exp, int wordSize, boolean isLittle, MIDataReadMemoryInfo info) { - super(target); - expression = exp; - fWordSize = wordSize; - frozen = true; - fIsLittleEndian = isLittle; - setMIDataReadMemoryInfo(info); - } - - /** - * @return the expression use to create the block. - */ - public String getExpression() { - return expression; - } - - /** - * @return the size of each memory word in bytes. - */ - @Override - public int getWordSize() { - return fWordSize; - } - - /** - * Reset the internal MIDataReadMemoryInfo. All modifications into mem info should be done - * using this method - */ - public void setMIDataReadMemoryInfo(MIDataReadMemoryInfo m) { - cStartAddress = MIFormat.getBigInteger(m.getAddress()); - cBytes = getBytes(m); - mem = m; - } - - /** - * @return the internal MIDataReadMemoryInfo. - */ - public MIDataReadMemoryInfo getMIDataReadMemoryInfo() { - return mem; - } - - /** - * @return true if any address in the array is within the block. - */ - public boolean contains(BigInteger[] adds) { - for (int i = 0; i < adds.length; i++) { - if (contains(adds[i])) { - return true; - } - } - return false; - } - - /** - * @return true if the address is within the block. - */ - public boolean contains(BigInteger addr) { - BigInteger start = getStartAddress(); - long length = getLength(); - if ( start.compareTo(addr) <= 0 && - addr.compareTo(start.add(BigInteger.valueOf(length))) <= 0 ) - { - return true; - } - return false; - } - - /** - * Use by the EventManager to check fire events when doing refresh(). - */ - public boolean isDirty() { - return dirty; - } - - /** - * Use by the EventManager to check fire events when doing refresh(). - */ - public void setDirty(boolean d) { - dirty = d; - } - - /** - * - */ - private byte[] getBytes(MIDataReadMemoryInfo m) { - byte[] bytes = new byte[0]; - - // sanity. - if (m == null) { - return bytes; - } - - // collect the data - MIMemory[] miMem = m.getMemories(); - for (int i = 0; i < miMem.length; ++i) { - long[] data = miMem[i].getData(); - if (data != null && data.length > 0) { -// int blen = bytes.length; -// byte[] newBytes = new byte[blen + data.length]; -// System.arraycopy(bytes, 0, newBytes, 0, blen); -// for (int j = 0; j < data.length; ++j, ++blen) { -// newBytes[blen] = (byte)data[j]; -// } -// bytes = newBytes; - for (int j = 0; j < data.length; ++j) { - byte[] bs = longToBytes(data[j]); - // grow the array - int blen = bytes.length; - byte[] newBytes = new byte[blen + bs.length]; - System.arraycopy(bytes, 0, newBytes, 0, blen); - System.arraycopy(bs, 0, newBytes, blen, bs.length); - bytes = newBytes; - } - } - } - return bytes; - } - - private int[] getBadOffsets(MIDataReadMemoryInfo m) { - int[] offsets = new int[0]; - - // sanity - if (m == null) { - return offsets; - } - - // collect the data - MIMemory[] miMem = m.getMemories(); - for (int i = 0; i < miMem.length; i++) { - int[] data = miMem[i].getBadOffsets(); - if (data.length > 0) { - int olen = offsets.length; - int[] newOffsets = new int[olen + data.length]; - System.arraycopy(offsets, 0, newOffsets, 0, olen); - System.arraycopy(data, 0, newOffsets, olen, data.length); - offsets = newOffsets; - } - } - return offsets; - } - - @Override - public byte[] getBytes() throws CDIException { - return cBytes; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock#refresh() - */ - @Override - public void refresh() throws CDIException { - Target target = (Target)getTarget(); - MemoryManager mgr = ((Session)target.getSession()).getMemoryManager(); - setDirty(true); - BigInteger[] addresses = mgr.update(this, null); - // Check if this affects other blocks. - if (addresses.length > 0) { - MemoryBlock[] blocks = mgr.getMemoryBlocks(target.getMISession()); - for (int i = 0; i < blocks.length; i++) { - MemoryBlock block = blocks[i]; - if (! block.equals(this) && block.contains(addresses)) { - block.setDirty(true); - mgr.update(block, null); - } - } - } - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock#getLength() - */ - @Override - public long getLength() { - try { - // use this instead. If the wordSize - // given does not match the hardware, - // counting the bytes will be correct. - return getBytes().length; - } catch (CDIException e) { - // ignore. - } - return mem.getTotalBytes(); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock#getStartAddress() - */ - @Override - public BigInteger getStartAddress() { - return cStartAddress; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock#isFrozen() - */ - @Override - public boolean isFrozen() { - return frozen; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock#setFrozen(boolean) - */ - @Override - public void setFrozen(boolean frozen) { - this.frozen = frozen; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock#setValue(long, byte[]) - */ - @Override - public void setValue(long offset, byte[] bytes) throws CDIException { - if (offset >= getLength() || offset + bytes.length > getLength()) { - throw new CDIException(CdiResources.getString("cdi.model.MemoryBlock.Bad_Offset")); //$NON-NLS-1$ - } - MISession miSession = ((Target)getTarget()).getMISession(); - CommandFactory factory = miSession.getCommandFactory(); - for (int i = 0; i < bytes.length; i++) { - long l = new Byte(bytes[i]).longValue() & 0xff; - String value = "0x" + Long.toHexString(l); //$NON-NLS-1$ - MIDataWriteMemory mw = factory.createMIDataWriteMemory(offset + i, - expression, MIFormat.HEXADECIMAL, 1, value); - try { - miSession.postCommand(mw); - MIInfo info = mw.getMIInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - // If the assign was succesfull fire a MIChangedEvent() via refresh. - refresh(); - - Target target = (Target)getTarget(); - - // If register manager is on autoupdate, update all registers - RegisterManager regMgr = ((Session)target.getSession()).getRegisterManager(); - if (regMgr.isAutoUpdate()) { - regMgr.update(target); - } - - // If expression manager is on autoupdate, update all expressions - ExpressionManager expMgr = ((Session)target.getSession()).getExpressionManager(); - if (expMgr.isAutoUpdate()) { - expMgr.update(target); - } - - // If variable manager is on autoupdate, update all variables. - VariableManager varMgr = ((Session)target.getSession()).getVariableManager(); - if (varMgr.isAutoUpdate()) { - varMgr.update(target); - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock#getFlags(int) - */ - @Override - public synchronized byte getFlags(int offset) { - if (offset < 0 || offset >= getLength()) { - throw new IndexOutOfBoundsException(); - } - if (badOffsets == null) { - badOffsets = getBadOffsets(mem); - } - if (badOffsets != null) { - for (int i = 0; i < badOffsets.length; ++i) { - if (badOffsets[i] == offset) { - return 0; - } - } - } - return VALID; - } - - - /** - * We should use the wordSize ... but ... - * The problem: the user may not have the right wordsize - * For example on some DSP the user set the wordSize to be 1 byte - * but in fact GDB is reading 2 bytes. - * So let do some guessing since the data(long) may have a bigger value then one byte. - */ - private byte[] longToBytes(long v) { - // Calculate the number of bytes needed - int count = 1; - long value = v; - for (count = 1; (value /= 0x100) > 0; ++count) - ; - - // Reset the wordSize if incorrect. - if (fWordSize != count) { - fWordSize = count; - } - - byte[] bytes = new byte[count]; - if (fIsLittleEndian) { - for (int i = count - 1; i >= 0; --i) { - int shift = i * count; - bytes[i] = (byte)((v >>> shift) & 0xFF); - } -// bytes[7] = (byte)((v >>> 56) & 0xFF); -// bytes[6] = (byte)((v >>> 48) & 0xFF); -// bytes[5] = (byte)((v >>> 40) & 0xFF); -// bytes[4] = (byte)((v >>> 32) & 0xFF); -// bytes[3] = (byte)((v >>> 24) & 0xFF); -// bytes[2] = (byte)((v >>> 16) & 0xFF); -// bytes[1] = (byte)((v >>> 8) & 0xFF); -// bytes[0] = (byte)((v >>> 0) & 0xFF); - } else { - for (int i = 0; i < count; ++i) { - int shift = (count - i - 1) * count; - bytes[i] = (byte)((v >>> shift) & 0xFF); - } -// bytes[0] = (byte)((v >>> 56) & 0xFF); -// bytes[1] = (byte)((v >>> 48) & 0xFF); -// bytes[2] = (byte)((v >>> 40) & 0xFF); -// bytes[3] = (byte)((v >>> 32) & 0xFF); -// bytes[4] = (byte)((v >>> 24) & 0xFF); -// bytes[5] = (byte)((v >>> 16) & 0xFF); -// bytes[6] = (byte)((v >>> 8) & 0xFF); -// bytes[7] = (byte)((v >>> 0) & 0xFF); - } - return bytes; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/MixedInstruction.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/MixedInstruction.java deleted file mode 100644 index c5f78c04532..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/MixedInstruction.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction; -import org.eclipse.cdt.debug.core.cdi.model.ICDIMixedInstruction; -import org.eclipse.cdt.debug.mi.core.output.MIAsm; -import org.eclipse.cdt.debug.mi.core.output.MISrcAsm; - -/** - */ -public class MixedInstruction extends CObject implements ICDIMixedInstruction { - - MISrcAsm srcAsm; - - public MixedInstruction (Target target, MISrcAsm a) { - super(target); - srcAsm = a; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIMixedInstruction#getFileName() - */ - @Override - public String getFileName() { - return srcAsm.getFile(); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIMixedInstruction#getInstructions() - */ - @Override - public ICDIInstruction[] getInstructions() { - MIAsm[] asms = srcAsm.getMIAsms(); - ICDIInstruction[] instructions = new ICDIInstruction[asms.length]; - for (int i = 0; i < asms.length; i++) { - instructions[i] = new Instruction((Target)getTarget(), asms[i]); - } - return instructions; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIMixedInstruction#getLineNumber() - */ - @Override - public int getLineNumber() { - return srcAsm.getLine(); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Register.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Register.java deleted file mode 100644 index f75789cfbec..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Register.java +++ /dev/null @@ -1,124 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi.model; - - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.ICDIRegister; -import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame; -import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; -import org.eclipse.cdt.debug.core.cdi.model.ICDIValue; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType; -import org.eclipse.cdt.debug.mi.core.cdi.RegisterManager; -import org.eclipse.cdt.debug.mi.core.cdi.Session; -import org.eclipse.cdt.debug.mi.core.command.MIVarCreate; -import org.eclipse.cdt.debug.mi.core.output.MIVar; - -/** - */ -public class Register extends Variable implements ICDIRegister { - - /** - * @param target - * @param thread - * @param frame - * @param n - * @param q - * @param pos - * @param depth - * @param v - */ - public Register(Target target, Thread thread, StackFrame frame, - String n, String q, int pos, int depth, MIVar miVar) { - super(target, thread, frame, n, q, pos, depth, miVar); - } - - public Register(RegisterDescriptor obj, MIVarCreate var) { - super(obj, var); - } - - - @Override - protected void addToTypeCache(String nameType, ICDIType type) throws CDIException { - Session session = (Session)getTarget().getSession(); - RegisterManager mgr = session.getRegisterManager(); - mgr.addToTypeCache(nameType, type); - } - - @Override - protected ICDIType getFromTypeCache(String nameType) throws CDIException { - Session session = (Session)getTarget().getSession(); - RegisterManager mgr = session.getRegisterManager(); - return mgr.getFromTypeCache(nameType); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.core.cdi.model.VariableDescriptor#getFullName() - */ - @Override - public String getFullName() { - if (fFullName == null) { - String n = getName(); - if (!n.startsWith("$")) { //$NON-NLS-1$ - fFullName = "$" + n; //$NON-NLS-1$ - } else { - fFullName = n; - } - } - return fFullName; - } - - @Override - protected Variable createVariable(Target target, Thread thread, StackFrame frame, String name, String fullName, int pos, int depth, MIVar miVar) { - return new Register(target, thread, frame, name, fullName, pos, depth, miVar); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariable#dispose() - */ - @Override - public void dispose() throws CDIException { - ICDITarget target = getTarget(); - RegisterManager regMgr = ((Session)target.getSession()).getRegisterManager(); - regMgr.destroyRegister(this); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIRegister#getValue(org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame) - */ - @Override - public ICDIValue getValue(ICDIStackFrame context) throws CDIException { - Session session = (Session)getTarget().getSession(); - RegisterManager mgr = session.getRegisterManager(); - Variable var = mgr.createShadowRegister(this, (StackFrame)context, getQualifiedName()); - return var.getValue(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIRegister#equals(org.eclipse.cdt.debug.core.cdi.model.ICDIRegister) - */ - @Override - public boolean equals(ICDIRegister register) { - if (register instanceof Register) { - Register reg = (Register) register; - return super.equals(reg); - } - return super.equals(register); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.core.cdi.model.Variable#createDescriptor(org.eclipse.cdt.debug.mi.core.cdi.model.Target, org.eclipse.cdt.debug.mi.core.cdi.model.Thread, org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame, java.lang.String, java.lang.String, int, int) - */ - @Override - protected VariableDescriptor createDescriptor(Target target, Thread thread, StackFrame frame, String n, String fn, int pos, int depth) { - return new RegisterDescriptor(target, thread, frame, n, fn, pos, depth); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/RegisterDescriptor.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/RegisterDescriptor.java deleted file mode 100644 index f7c7df62b21..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/RegisterDescriptor.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterDescriptor; - -/** - */ -public class RegisterDescriptor extends VariableDescriptor implements ICDIRegisterDescriptor { - - - public RegisterDescriptor(Target target, Thread thread, StackFrame frame, String name, String fn, int pos, int depth) { - super(target, thread, frame, name, fn, pos, depth); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.core.cdi.model.VariableDescriptor#getFullName() - */ - @Override - public String getFullName() { - if (fFullName == null) { - String n = getName(); - if (!n.startsWith("$")) { //$NON-NLS-1$ - fFullName = "$" + n; //$NON-NLS-1$ - } - } - return fFullName; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/RegisterGroup.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/RegisterGroup.java deleted file mode 100644 index 0d2115ad7e6..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/RegisterGroup.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterDescriptor; -import org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterGroup; -import org.eclipse.cdt.debug.mi.core.cdi.RegisterManager; -import org.eclipse.cdt.debug.mi.core.cdi.Session; - -/** - * RegisterGroup - */ -public class RegisterGroup extends CObject implements ICDIRegisterGroup { - - String fName; - - /** - * @param t - */ - public RegisterGroup(Target t, String name) { - super(t); - fName = name; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterGroup#getRegisterDescriptors() - */ - @Override - public ICDIRegisterDescriptor[] getRegisterDescriptors() throws CDIException { - Target target = (Target)getTarget(); - Session session = (Session)target.getSession(); - RegisterManager regMgr = session.getRegisterManager(); - return regMgr.getRegisterDescriptors(this); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterGroup#getName() - */ - @Override - public String getName() { - return fName; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterGroup#hasRegisters() - */ - @Override - public boolean hasRegisters() throws CDIException { - return true; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/RuntimeOptions.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/RuntimeOptions.java deleted file mode 100644 index 84d4a5cbdf3..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/RuntimeOptions.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi.model; - -import java.util.Iterator; -import java.util.Properties; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.ICDIRuntimeOptions; -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.MISession; -import org.eclipse.cdt.debug.mi.core.cdi.CdiResources; -import org.eclipse.cdt.debug.mi.core.command.CommandFactory; -import org.eclipse.cdt.debug.mi.core.command.MIEnvironmentCD; -import org.eclipse.cdt.debug.mi.core.command.MIExecArguments; -import org.eclipse.cdt.debug.mi.core.command.MIGDBSetEnvironment; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; - -/** - */ -public class RuntimeOptions extends CObject implements ICDIRuntimeOptions { - - public RuntimeOptions(Target t) { - super(t); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIRuntimeOptions#setArguments(String) - */ - @Override - public void setArguments(String[] args) throws CDIException { - Target target = (Target)getTarget(); - if (args == null || args.length == 0) { - return; - } - MISession mi = target.getMISession(); - CommandFactory factory = mi.getCommandFactory(); - MIExecArguments arguments = factory.createMIExecArguments(args); - try { - mi.postCommand(arguments); - MIInfo info = arguments.getMIInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.RuntimeOptions.Unable_to_set_args_target_not_responding")); //$NON-NLS-1$ - } - } catch (MIException e) { - throw new CDIException(CdiResources.getString("cdi.RuntimeOptions.Unable_to_set_args") + e.getMessage()); //$NON-NLS-1$ - } - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIRuntimeOptions#setEnvironment(Properties) - */ - @Override - public void setEnvironment(Properties props) throws CDIException { - Target target = (Target)getTarget(); - if (props == null) { - return; - } - MISession mi = target.getMISession(); - CommandFactory factory = mi.getCommandFactory(); - Iterator iterator = props.keySet().iterator(); - while (iterator.hasNext()) { - String key = (String)iterator.next(); - String value = props.getProperty(key); - String params[] = null; - if (value == null || value.length() == 0) { - params = new String[] {key}; - } else { - params = new String[] {key, value}; - } - MIGDBSetEnvironment set = factory.createMIGDBSetEnvironment(params); - try { - mi.postCommand(set); - MIInfo info = set.getMIInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.RuntimeOptions.Unable_to_set_args_target_not_responding")); //$NON-NLS-1$ - } - } catch (MIException e) { - throw new CDIException(CdiResources.getString("cdi.RuntimeOptions.Unable_to_set_environment") + e.getMessage()); //$NON-NLS-1$ - } - } - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIRuntimeOptions#setWorkingDirectory(String) - */ - @Override - public void setWorkingDirectory(String wd) throws CDIException { - Target target = (Target)getTarget(); - if (wd == null || wd.length() == 0) { - return; - } - MISession mi = target.getMISession(); - CommandFactory factory = mi.getCommandFactory(); - MIEnvironmentCD cd = factory.createMIEnvironmentCD(wd); - try { - mi.postCommand(cd); - MIInfo info = cd.getMIInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.RuntimeOptions.Unable_to_set_args_target_not_responding")); //$NON-NLS-1$ - } - } catch (MIException e) { - throw new CDIException(CdiResources.getString("cdi.RuntimeOptions.Unable_to_set_working_dir") + e.getMessage()); //$NON-NLS-1$ - } - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/SharedLibrary.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/SharedLibrary.java deleted file mode 100644 index a1846d3dc29..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/SharedLibrary.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model; - -import java.math.BigInteger; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary; -import org.eclipse.cdt.debug.mi.core.MIFormat; -import org.eclipse.cdt.debug.mi.core.cdi.Session; -import org.eclipse.cdt.debug.mi.core.cdi.SharedLibraryManager; -import org.eclipse.cdt.debug.mi.core.output.MIShared; - - -/** - * Place holder for shared library info. - */ -public class SharedLibrary extends CObject implements ICDISharedLibrary { - - MIShared miShared; - - public SharedLibrary(Target target, MIShared slib) { - super(target); - miShared = slib; - } - - public void setMIShared(MIShared slib) { - miShared = slib; - } - - public MIShared getMIShared() { - return miShared; - } - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary#getFileName() - */ - @Override - public String getFileName() { - return miShared.getName(); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary#getStartAddress() - */ - @Override - public BigInteger getStartAddress() { - return MIFormat.getBigInteger(miShared.getFrom()); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary#getEndAddress() - */ - @Override - public BigInteger getEndAddress() { - return MIFormat.getBigInteger(miShared.getTo()); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary#areSymbolsLoaded() - */ - @Override - public boolean areSymbolsLoaded() { - return miShared.isRead(); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary#loadSymbols() - */ - @Override - public void loadSymbols() throws CDIException { - Target target = (Target)getTarget(); - SharedLibraryManager mgr = ((Session)target.getSession()).getSharedLibraryManager(); - mgr.loadSymbols(target, new ICDISharedLibrary[] { this }); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Signal.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Signal.java deleted file mode 100644 index 1550706b180..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Signal.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.ICDISignal; -import org.eclipse.cdt.debug.mi.core.cdi.Session; -import org.eclipse.cdt.debug.mi.core.cdi.SignalManager; -import org.eclipse.cdt.debug.mi.core.output.MISigHandle; - -/** - */ -public class Signal extends CObject implements ICDISignal { - - MISigHandle sig; - - public Signal(Target target, MISigHandle s) { - super(target); - sig = s; - } - - public void setMISignal(MISigHandle s) { - sig = s; - } - - public MISigHandle getMISignal() { - return sig; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDISignal#getMeaning() - */ - @Override - public String getDescription() { - return sig.getDescription(); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDISignal#getName() - */ - @Override - public String getName() { - return sig.getName(); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDISignal#handle() - */ - @Override - public void handle(boolean ignore, boolean stop) throws CDIException { - SignalManager mgr = ((Session)getTarget().getSession()).getSignalManager(); - mgr.handle(this, ignore, stop); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDISignal#isIgnore() - */ - @Override - public boolean isIgnore() { - return !sig.isPass(); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDISignal#isStopSet() - */ - @Override - public boolean isStopSet() { - return sig.isStop(); - } - - /** - * Continue program giving it signal specified by the argument. - */ - @Override - public void signal() throws CDIException { - getTarget().resume(this); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/StackFrame.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/StackFrame.java deleted file mode 100644 index d4d604a124e..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/StackFrame.java +++ /dev/null @@ -1,275 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi.model; - -import java.math.BigInteger; -import java.util.HashMap; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.ICDILocator; -import org.eclipse.cdt.debug.core.cdi.model.ICDIArgument; -import org.eclipse.cdt.debug.core.cdi.model.ICDIArgumentDescriptor; -import org.eclipse.cdt.debug.core.cdi.model.ICDILocalVariable; -import org.eclipse.cdt.debug.core.cdi.model.ICDILocalVariableDescriptor; -import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame; -import org.eclipse.cdt.debug.core.cdi.model.ICDIThread; -import org.eclipse.cdt.debug.core.cdi.model.ICDIValue; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType; -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.MIFormat; -import org.eclipse.cdt.debug.mi.core.MISession; -import org.eclipse.cdt.debug.mi.core.cdi.CdiResources; -import org.eclipse.cdt.debug.mi.core.cdi.Locator; -import org.eclipse.cdt.debug.mi.core.cdi.MI2CDIException; -import org.eclipse.cdt.debug.mi.core.cdi.Session; -import org.eclipse.cdt.debug.mi.core.cdi.VariableManager; -import org.eclipse.cdt.debug.mi.core.command.CommandFactory; -import org.eclipse.cdt.debug.mi.core.command.MIExecFinish; -import org.eclipse.cdt.debug.mi.core.command.MIExecReturn; -import org.eclipse.cdt.debug.mi.core.output.MIFrame; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; - -/** - */ -public class StackFrame extends CObject implements ICDIStackFrame { - - MIFrame frame; - Thread cthread; - int level; - ICDIArgumentDescriptor[] argDescs; - ICDILocalVariableDescriptor[] localDescs; - Locator fLocator; - /** - * - */ - private HashMap fTypeCache; - - /* - * - GDB/MI does not keep the stack level, from what we expect. In gdb, the - highest stack is level 0 and lower stack as the highest level: - -stack-list-frames - ^done,stack=[frame={level="0 ",addr="0x0804845b",func="main",file="hello.c",line="24"}, - frame={level="1 ",addr="0x42017499",func="__libc_start_main",from="/lib/i686/libc.so.6"}] - - -stack-list-frames - ^done,stack=[frame={level="0 ",addr="0x08048556",func="main2",file="hello.c",line="58"}, - frame={level="1 ",addr="0x08048501",func="main",file="hello.c",line="41"}, - frame={level="2 ",addr="0x42017499",func="__libc_start_main",from="/lib/i686/libc.so.6"}] - - This is of no use to us since the level is always "0". The level is necessary for example when - doing recursive calls to make a distinction between frames. - So in CDT this reverse the hidghest frame will have the highest number. In CDT: - stack=[frame={level="2 ",addr="0x0804845b",func="main",file="hello.c",line="24"}, - frame={level="1 ",addr="0x42017499",func="__libc_start_main",from="/lib/i686/libc.so.6"}] - - stack=[frame={level="3 ",addr="0x08048556",func="main2",file="hello.c",line="58"}, - frame={level="2 ",addr="0x08048501",func="main",file="hello.c",line="41"}, - frame={level="1 ",addr="0x42017499",func="__libc_start_main",from="/lib/i686/libc.so.6"}] - */ - public StackFrame(Thread thread, MIFrame f, int l) { - super((Target)thread.getTarget()); - cthread = thread; - frame = f; - level = l; - fTypeCache = new HashMap(); - } - - public MIFrame getMIFrame() { - return frame; - } - - public ICDIType getFromTypeCache(String typeName) { - return (ICDIType)fTypeCache.get(typeName); - } - public void addToTypeCache(String typeName, ICDIType typeDefinition) { - fTypeCache.put(typeName, typeDefinition); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame#getThread() - */ - @Override - public ICDIThread getThread() { - return cthread; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame#getArgumentDescriptors() - */ - @Override - public ICDIArgumentDescriptor[] getArgumentDescriptors() throws CDIException { - if (argDescs == null) { - Session session = (Session)getTarget().getSession(); - VariableManager mgr = session.getVariableManager(); - argDescs = mgr.getArgumentDescriptors(this); - } - return argDescs; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame#getLocalVariableDescriptors() - */ - @Override - public ICDILocalVariableDescriptor[] getLocalVariableDescriptors() throws CDIException { - if (localDescs == null) { - Session session = (Session)getTarget().getSession(); - VariableManager mgr = session.getVariableManager(); - localDescs = mgr.getLocalVariableDescriptors(this); - } - return localDescs; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame#createArgument(org.eclipse.cdt.debug.core.cdi.model.ICDIArgumentDescriptor) - */ - @Override - public ICDIArgument createArgument(ICDIArgumentDescriptor varDesc) throws CDIException { - if (varDesc instanceof ArgumentDescriptor) { - Session session = (Session)getTarget().getSession(); - VariableManager mgr = session.getVariableManager(); - return mgr.createArgument((ArgumentDescriptor)varDesc); - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame#createLocalVariable(org.eclipse.cdt.debug.core.cdi.model.ICDILocalVariableDescriptor) - */ - @Override - public ICDILocalVariable createLocalVariable(ICDILocalVariableDescriptor varDesc) throws CDIException { - if (varDesc instanceof ArgumentDescriptor) { - return createArgument((ICDIArgumentDescriptor)varDesc); - } else if (varDesc instanceof LocalVariableDescriptor) { - Session session = (Session)getTarget().getSession(); - VariableManager mgr = session.getVariableManager(); - return mgr.createLocalVariable((LocalVariableDescriptor)varDesc); - } - return null; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame#getLocation() - */ - @Override - public ICDILocator getLocator() { - BigInteger addr = BigInteger.ZERO; - if (frame != null) { - if (fLocator == null) { - String a = frame.getAddress(); - if (a != null) { - addr = MIFormat.getBigInteger(a); - } - fLocator = new Locator(frame.getFile(), - frame.getFunction(), - frame.getLine(), - addr); - } - return fLocator; - } - return new Locator("", "", 0, addr); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame#getLevel() - */ - @Override - public int getLevel() { - return level; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame#equals(ICDIStackFrame) - */ - @Override - public boolean equals(ICDIStackFrame stackframe) { - if (stackframe instanceof StackFrame) { - StackFrame stack = (StackFrame)stackframe; - boolean equal = cthread != null && - cthread.equals(stack.getThread()) && - getLevel() == stack.getLevel(); - if (equal) { - ICDILocator otherLocator = stack.getLocator(); - ICDILocator myLocator = getLocator(); - if (Locator.equalString(myLocator.getFile(), otherLocator.getFile())) { - if (Locator.equalString(myLocator.getFunction(), otherLocator.getFunction())) { - return true; - } - } - } - } - return super.equals(stackframe); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStepReturn#stepReturn() - */ - @Override - public void stepReturn() throws CDIException { - finish(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStepReturn#stepReturn(org.eclipse.cdt.debug.core.cdi.model.ICDIValue) - */ - @Override - public void stepReturn(ICDIValue value) throws CDIException { - execReturn(value.toString()); - } - - /** - */ - protected void finish() throws CDIException { - - ((Thread)getThread()).setCurrentStackFrame(this, false); - - Target target = (Target)getTarget(); - MISession miSession = target.getMISession(); - CommandFactory factory = miSession.getCommandFactory(); - MIExecFinish finish = factory.createMIExecFinish(); - try { - miSession.postCommand(finish); - MIInfo info = finish.getMIInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.model.Target.Target_not_responding")); //$NON-NLS-1$ - } - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - - /** - */ - protected void execReturn(String value) throws CDIException { - - ((Thread)getThread()).setCurrentStackFrame(this, false); - - Target target = (Target)getTarget(); - MISession miSession = target.getMISession(); - CommandFactory factory = miSession.getCommandFactory(); - MIExecReturn ret; - if (value == null) { - ret = factory.createMIExecReturn(); - } else { - ret = factory.createMIExecReturn(value); - } - try { - miSession.postCommand(ret); - MIInfo info = ret.getMIInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.model.Target.Target_not_responding")); //$NON-NLS-1$ - } - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java deleted file mode 100644 index b9fd81b3cb8..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java +++ /dev/null @@ -1,1400 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - * Ken Ryall (Nokia) - 175532 support the address to source location API - * Alena Laskavaia (QNX) - Bug 221224 - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi.model; - -import java.io.File; -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.cdt.core.IAddress; -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.ICDIAddressLocation; -import org.eclipse.cdt.debug.core.cdi.ICDICondition; -import org.eclipse.cdt.debug.core.cdi.ICDIFileLocation; -import org.eclipse.cdt.debug.core.cdi.ICDIFunctionLocation; -import org.eclipse.cdt.debug.core.cdi.ICDILineLocation; -import org.eclipse.cdt.debug.core.cdi.ICDILocation; -import org.eclipse.cdt.debug.core.cdi.model.ICDIAddressBreakpoint; -import org.eclipse.cdt.debug.core.cdi.model.ICDIAddressToSource; -import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint; -import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpointManagement3; -import org.eclipse.cdt.debug.core.cdi.model.ICDIEventBreakpoint; -import org.eclipse.cdt.debug.core.cdi.model.ICDIExceptionpoint; -import org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteMoveInstructionPointer; -import org.eclipse.cdt.debug.core.cdi.model.ICDIExpression; -import org.eclipse.cdt.debug.core.cdi.model.ICDIFunctionBreakpoint; -import org.eclipse.cdt.debug.core.cdi.model.ICDIGlobalVariable; -import org.eclipse.cdt.debug.core.cdi.model.ICDIGlobalVariableDescriptor; -import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction; -import org.eclipse.cdt.debug.core.cdi.model.ICDILineBreakpoint; -import org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock; -import org.eclipse.cdt.debug.core.cdi.model.ICDIMixedInstruction; -import org.eclipse.cdt.debug.core.cdi.model.ICDIRegister; -import org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterDescriptor; -import org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterGroup; -import org.eclipse.cdt.debug.core.cdi.model.ICDIRuntimeOptions; -import org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary; -import org.eclipse.cdt.debug.core.cdi.model.ICDISignal; -import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame; -import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; -import org.eclipse.cdt.debug.core.cdi.model.ICDITargetConfiguration; -import org.eclipse.cdt.debug.core.cdi.model.ICDIThread; -import org.eclipse.cdt.debug.core.cdi.model.ICDIWatchpoint; -import org.eclipse.cdt.debug.core.model.ICBreakpointType; -import org.eclipse.cdt.debug.mi.core.CoreProcess; -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.MIInferior; -import org.eclipse.cdt.debug.mi.core.MISession; -import org.eclipse.cdt.debug.mi.core.RxThread; -import org.eclipse.cdt.debug.mi.core.cdi.BreakpointManager; -import org.eclipse.cdt.debug.mi.core.cdi.CdiResources; -import org.eclipse.cdt.debug.mi.core.cdi.EventManager; -import org.eclipse.cdt.debug.mi.core.cdi.ExpressionManager; -import org.eclipse.cdt.debug.mi.core.cdi.MI2CDIException; -import org.eclipse.cdt.debug.mi.core.cdi.MemoryManager; -import org.eclipse.cdt.debug.mi.core.cdi.RegisterManager; -import org.eclipse.cdt.debug.mi.core.cdi.Session; -import org.eclipse.cdt.debug.mi.core.cdi.SessionObject; -import org.eclipse.cdt.debug.mi.core.cdi.SharedLibraryManager; -import org.eclipse.cdt.debug.mi.core.cdi.SignalManager; -import org.eclipse.cdt.debug.mi.core.cdi.SourceManager; -import org.eclipse.cdt.debug.mi.core.cdi.VariableManager; -import org.eclipse.cdt.debug.mi.core.command.CLIInfoLine; -import org.eclipse.cdt.debug.mi.core.command.CLIInfoThreads; -import org.eclipse.cdt.debug.mi.core.command.CLIJump; -import org.eclipse.cdt.debug.mi.core.command.CLISignal; -import org.eclipse.cdt.debug.mi.core.command.CommandFactory; -import org.eclipse.cdt.debug.mi.core.command.MIDataEvaluateExpression; -import org.eclipse.cdt.debug.mi.core.command.MIExecContinue; -import org.eclipse.cdt.debug.mi.core.command.MIExecNext; -import org.eclipse.cdt.debug.mi.core.command.MIExecNextInstruction; -import org.eclipse.cdt.debug.mi.core.command.MIExecRun; -import org.eclipse.cdt.debug.mi.core.command.MIExecStep; -import org.eclipse.cdt.debug.mi.core.command.MIExecStepInstruction; -import org.eclipse.cdt.debug.mi.core.command.MIExecUntil; -import org.eclipse.cdt.debug.mi.core.command.MIGDBShowEndian; -import org.eclipse.cdt.debug.mi.core.command.MITargetDetach; -import org.eclipse.cdt.debug.mi.core.command.MIThreadSelect; -import org.eclipse.cdt.debug.mi.core.event.MIDetachedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIThreadCreatedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIThreadExitEvent; -import org.eclipse.cdt.debug.mi.core.output.CLIInfoLineInfo; -import org.eclipse.cdt.debug.mi.core.output.CLIInfoThreadsInfo; -import org.eclipse.cdt.debug.mi.core.output.MIDataEvaluateExpressionInfo; -import org.eclipse.cdt.debug.mi.core.output.MIFrame; -import org.eclipse.cdt.debug.mi.core.output.MIGDBShowEndianInfo; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIThreadSelectInfo; - -/** - */ -public class Target extends SessionObject implements ICDITarget, ICDIBreakpointManagement3, ICDIAddressToSource, ICDIExecuteMoveInstructionPointer { - - MISession miSession; - ICDITargetConfiguration fConfiguration; - Thread[] noThreads = new Thread[0]; - Thread[] currentThreads; - int currentThreadId; - String fEndian = null; - boolean suspended = true; - boolean deferBreakpoints = true; - final private Object lock = new Object(); - - public Target(Session s, MISession mi) { - super(s); - miSession = mi; - currentThreads = noThreads; - } - - /** - * Return lock object for target. Replacement for <code>lockTarget</code> and - * <code>releaseTarget</code> methods. - * <p> - * Use as synchronization object: - * </p> - * new code: - * - * <pre> - * synchronized (target.getLock()) { - * ... - * } - * </pre> - * - * old code: - * - * <pre> - * target.lockTarget(); - * try { - * ... - * } finally { - * target.releaseTarget(); - * } - * </pre> - * - * @since 5.0 - */ - public Object getLock() { - return lock; - } - - - public MISession getMISession() { - return miSession; - } - - public void setConfiguration(ICDITargetConfiguration configuration) { - fConfiguration = configuration; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIObject#getTarget() - */ - @Override - public ICDITarget getTarget() { - return this; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#setCurrentThread(ICDIThread) - */ - public void setCurrentThread(ICDIThread cthread) throws CDIException { - if (cthread instanceof Thread) { - setCurrentThread(cthread, true); - } else { - throw new CDIException(CdiResources.getString("cdi.model.Target.Unknown_thread")); //$NON-NLS-1$ - } - } - - public void setCurrentThread(ICDIThread cthread, boolean doUpdate) throws CDIException { - if (cthread instanceof Thread) { - setCurrentThread((Thread)cthread, doUpdate); - } else { - throw new CDIException(CdiResources.getString("cdi.model.Target.Unknown_thread")); //$NON-NLS-1$ - } - } - - public synchronized void setSupended(boolean state) { - suspended = state; - notifyAll(); - } - - /** - */ - public void setCurrentThread(Thread cthread, boolean doUpdate) throws CDIException { - - int id = cthread.getId(); - // No need to set thread id 0, it is a dummy thread. - if (id == 0) { - return; - } - // already the current thread? - if (currentThreadId != id) { - CommandFactory factory = miSession.getCommandFactory(); - MIThreadSelect select = factory.createMIThreadSelect(id); - try { - miSession.postCommand(select); - MIThreadSelectInfo info = select.getMIThreadSelectInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.model.Target.Target_not_responding")); //$NON-NLS-1$ - } - currentThreadId = info.getNewThreadId(); - - // @^&#@^$*^$ - // GDB reset the currentFrame to some other level 0 when switching thread. - // we need to reposition the current stack level. - MIFrame miFrame = info.getFrame(); - if (miFrame != null) { - int depth = cthread.getStackFrameCount(); - cthread.currentFrame = new StackFrame(cthread, miFrame, depth - miFrame.getLevel()); - } - } catch (MIException e) { - throw new MI2CDIException(e); - } - - Session session = (Session)getSession(); - // Resetting threads may change the value of - // some variables like Register. Call an update() - // To generate changeEvents. - if (doUpdate) { - RegisterManager regMgr = session.getRegisterManager(); - if (regMgr.isAutoUpdate()) { - regMgr.update(this); - } - VariableManager varMgr = session.getVariableManager(); - if (varMgr.isAutoUpdate()) { - varMgr.update(this); - } - } - } - - // We should be allright now. - if (currentThreadId != id) { - // thread is gone. Generate a Thread destroyed. - miSession.fireEvent(new MIThreadExitEvent(miSession, id)); - throw new CDIException(CdiResources.getString("cdi.model.Target.Cannot_switch_to_thread") + id); //$NON-NLS-1$ - } - } - - /** - * Called when stopping because of breakpoints etc .. - */ - public synchronized void updateState(int newThreadId) { - Thread[] oldThreads = currentThreads; - - // If we use "info threads" in getCThreads() this - // will be overwritten. However if we use -stack-list-threads - // it does not provide to the current thread - synchronized (lock) { - try { - // get the new Threads. - currentThreadId = newThreadId; - currentThreads = getCThreads(); - } catch (CDIException e) { - currentThreads = noThreads; - } - } - - // Fire CreatedEvent for new threads. - // Replace the new threads with the old thread object - // User may have old on to the old Thread object. - List<Integer> cList = new ArrayList<Integer>(currentThreads.length); - for (int i = 0; i < currentThreads.length; i++) { - boolean found = false; - for (int j = 0; j < oldThreads.length; j++) { - if (currentThreads[i].getId() == oldThreads[j].getId()) { - oldThreads[j].clearState(); - currentThreads[i] = oldThreads[j]; - found = true; - break; - } - } - if (!found) { - cList.add(new Integer(currentThreads[i].getId())); - } - } - if (!cList.isEmpty()) { - MIThreadCreatedEvent[] events = new MIThreadCreatedEvent[cList.size()]; - for (int j = 0; j < events.length; j++) { - int id = cList.get(j); - events[j] = new MIThreadCreatedEvent(miSession, id); - } - miSession.fireEvents(events); - } - - // Fire destroyedEvent for old threads. - List<Integer> dList = new ArrayList<Integer>(oldThreads.length); - for (int i = 0; i < oldThreads.length; i++) { - boolean found = false; - for (int j = 0; j < currentThreads.length; j++) { - if (currentThreads[j].getId() == oldThreads[i].getId()) { - found = true; - break; - } - } - if (!found) { - dList.add(new Integer(oldThreads[i].getId())); - } - } - if (!dList.isEmpty()) { - MIThreadExitEvent[] events = new MIThreadExitEvent[dList.size()]; - for (int j = 0; j < events.length; j++) { - int id = dList.get(j); - events[j] = new MIThreadExitEvent(miSession, id); - } - miSession.fireEvents(events); - } - } - - /** - * Do the real work of call -thread-list-ids. - */ - public Thread[] getCThreads() throws CDIException { - Thread[] cthreads = noThreads; - synchronized (lock) { - RxThread rxThread = miSession.getRxThread(); - rxThread.setEnableConsole(false); - try { - CommandFactory factory = miSession.getCommandFactory(); - CLIInfoThreads tids = factory.createCLIInfoThreads(); - // HACK/FIXME: gdb/mi thread-list-ids does not - // show any newly create thread, we workaround by - // issuing "info threads" instead. - // MIThreadListIds tids = factory.createMIThreadListIds(); - // MIThreadListIdsInfo info = tids.getMIThreadListIdsInfo(); - miSession.postCommand(tids); - CLIInfoThreadsInfo info = tids.getMIInfoThreadsInfo(); - int[] ids; - String[] names; - if (info == null) { - ids = new int[0]; - names = new String[0]; - } else { - ids = info.getThreadIds(); - names = info.getThreadNames(); - currentThreadId = info.getCurrentThread(); - } - if (ids != null && ids.length > 0) { - cthreads = new Thread[ids.length]; - // Ok that means it is a multiThreaded. - if (names != null && names.length == ids.length) { - for (int i = 0; i < ids.length; i++) { - cthreads[i] = new Thread(this, ids[i], names[i]); - } - } else { - for (int i = 0; i < ids.length; i++) { - cthreads[i] = new Thread(this, ids[i]); - } - } - } else { - // Provide a dummy. - cthreads = new Thread[]{new Thread(this, 0)}; - } - // FIX: When attaching there is no thread selected - // We will choose the first one as a workaround. - if (currentThreadId == 0 && cthreads.length > 0) { - setCurrentThread(cthreads[0], false); - } - } catch (MIException e) { - // Do not throw anything in this case. - throw new CDIException(e.getMessage()); - } finally { - rxThread.setEnableConsole(true); - } - } - return cthreads; - } - - @Override - public ICDIThread getCurrentThread() throws CDIException { - ICDIThread[] threads = getThreads(); - for (int i = 0; i < threads.length; i++) { - Thread cthread = (Thread)threads[i]; - if (cthread.getId() == currentThreadId) { - return cthread; - } - } - return null; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#getThreads() - */ - @Override - public synchronized ICDIThread[] getThreads() throws CDIException { - if (currentThreads.length == 0) { - currentThreads = getCThreads(); - } - return currentThreads; - } - - public ICDIThread getThread(int tid) { - Thread th = null; - if (currentThreads != null) { - for (int i = 0; i < currentThreads.length; i++) { - Thread cthread = currentThreads[i]; - if (cthread.getId() == tid) { - th = cthread; - break; - } - } - } - return th; - } - - public boolean isLittleEndian() throws CDIException { - if (fEndian == null) { - CommandFactory factory = miSession.getCommandFactory(); - MIGDBShowEndian endian = factory.createMIGDBShowEndian(); - try { - miSession.postCommand(endian); - MIGDBShowEndianInfo info = endian.getMIShowEndianInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.model.Target.Target_not_responding")); //$NON-NLS-1$ - } - fEndian = info.isLittleEndian() ? "le" : "be"; //$NON-NLS-1$ //$NON-NLS-2$ - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - return fEndian.equals("le"); //$NON-NLS-1$ - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#restart() - */ - @Override - public void restart() throws CDIException { - // Reset the inferior pid - MIInferior inferior = getMISession().getMIInferior(); - int pid = inferior.resetInferiorPID(); - CommandFactory factory = miSession.getCommandFactory(); - MIExecRun run = factory.createMIExecRun(new String[0]); - try { - miSession.postCommand(run); - MIInfo info = run.getMIInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.model.Target.Target_not_responding")); //$NON-NLS-1$ - } - } catch (MIException e) { - // Replace pid since we probably didn't actually restart - inferior.setInferiorPID(pid); - throw new MI2CDIException(e); - } - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#stepInto() - */ - @Override - public void stepInto() throws CDIException { - stepInto(1); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepInto(int) - */ - @Override - public void stepInto(int count) throws CDIException { - CommandFactory factory = miSession.getCommandFactory(); - MIExecStep step = factory.createMIExecStep(count); - try { - miSession.postCommand(step); - MIInfo info = step.getMIInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.model.Target.Target_not_responding")); //$NON-NLS-1$ - } - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#stepIntoInstruction() - */ - @Override - public void stepIntoInstruction() throws CDIException { - stepIntoInstruction(1); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepIntoInstruction(int) - */ - @Override - public void stepIntoInstruction(int count) throws CDIException { - CommandFactory factory = miSession.getCommandFactory(); - MIExecStepInstruction stepi = factory.createMIExecStepInstruction(count); - try { - miSession.postCommand(stepi); - MIInfo info = stepi.getMIInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.model.Target.Target_not_responding")); //$NON-NLS-1$ - } - } catch (MIException e) { - throw new MI2CDIException(e); - } - - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#stepOver() - */ - @Override - public void stepOver() throws CDIException { - stepOver(1); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepOver(int) - */ - @Override - public void stepOver(int count) throws CDIException { - CommandFactory factory = miSession.getCommandFactory(); - MIExecNext next = factory.createMIExecNext(count); - try { - miSession.postCommand(next); - MIInfo info = next.getMIInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.model.Target.Target_not_responding")); //$NON-NLS-1$ - } - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#stepOverInstruction() - */ - @Override - public void stepOverInstruction() throws CDIException { - stepOverInstruction(1); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepOverInstruction(int) - */ - @Override - public void stepOverInstruction(int count) throws CDIException { - CommandFactory factory = miSession.getCommandFactory(); - MIExecNextInstruction nexti = factory.createMIExecNextInstruction(count); - try { - miSession.postCommand(nexti); - MIInfo info = nexti.getMIInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.model.Target.Target_not_responding")); //$NON-NLS-1$ - } - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#stepReturn() - */ - public void stepReturn() throws CDIException { - ((Thread)getCurrentThread()).getCurrentStackFrame().stepReturn(); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#runUntil(ICDILocation) - */ - @Override - public void runUntil(ICDILocation location) throws CDIException { - stepUntil(location); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepUntil(org.eclipse.cdt.debug.core.cdi.ICDILocation) - */ - @Override - public void stepUntil(ICDILocation location) throws CDIException { - CommandFactory factory = miSession.getCommandFactory(); - String loc = null; - File file = null; - if (location instanceof ICDIFileLocation) { - String filePath = ((ICDIFileLocation)location).getFile(); - if (filePath != null && filePath.length() > 0) - file = new File(filePath); - } - if (location instanceof ICDILineLocation) { - ICDILineLocation lineLocation = (ICDILineLocation)location; - if (file != null) { - loc = file.getName() + ":" + lineLocation.getLineNumber(); //$NON-NLS-1$ - } - } else if (location instanceof ICDIFunctionLocation) { - ICDIFunctionLocation funcLocation = (ICDIFunctionLocation)location; - if (funcLocation.getFunction() != null && funcLocation.getFunction().length() > 0) { - loc = funcLocation.getFunction(); - } - if (file != null && loc != null) { - loc = funcLocation.getFile() + ":" + loc; //$NON-NLS-1$ - } - } else if (location instanceof ICDIAddressLocation) { - ICDIAddressLocation addrLocation = (ICDIAddressLocation)location; - if (!addrLocation.getAddress().equals(BigInteger.ZERO)) { - loc = "*0x" + addrLocation.getAddress().toString(16); //$NON-NLS-1$ - } - } - // Throw an exception we do know where to go - if (loc == null) { - throw new CDIException(CdiResources.getString("cdi.mode.Target.Bad_location")); //$NON-NLS-1$ - } - MIExecUntil until = factory.createMIExecUntil(loc); - try { - miSession.postCommand(until); - MIInfo info = until.getMIInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.model.Target.Target_not_responding")); //$NON-NLS-1$ - } - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#suspend() - */ - @Override - public void suspend() throws CDIException { - try { - miSession.getMIInferior().interrupt(); - // Wait till the EventManager tell us the go ahead - long maxSec = miSession.getCommandTimeout()/1000 + 1; - synchronized (this) { - for (int i = 0; !suspended && i < maxSec; i++) { - try { - wait(1000); - } catch (InterruptedException e) { - } - } - } - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#disconnect() - */ - @Override - public void disconnect() throws CDIException { - // if Target is running try to suspend first. - if (isRunning()) { - try { - ((EventManager)getSession().getEventManager()).allowProcessingEvents(false); - suspend(); - } finally { - ((EventManager)getSession().getEventManager()).allowProcessingEvents(true); - } - } - CommandFactory factory = miSession.getCommandFactory(); - MITargetDetach detach = factory.createMITargetDetach(); - try { - miSession.postCommand(detach); - MIInfo info = detach.getMIInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.model.Target.Target_not_responding")); //$NON-NLS-1$ - } - } catch (MIException e) { - throw new MI2CDIException(e); - } - // Unfortunately -target-detach does not generate an - // event so we do it here. - miSession.fireEvent(new MIDetachedEvent(miSession, detach.getToken())); - miSession.getMIInferior().setDisconnected(); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#resume() - */ - @Override - public void resume() throws CDIException { - resume(false); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteResume#resume(org.eclipse.cdt.debug.core.cdi.ICDILocation) - */ - @Override - public void resume(ICDILocation location) throws CDIException { - CommandFactory factory = miSession.getCommandFactory(); - String loc = null; - File file = null; - if (location instanceof ICDIFileLocation) { - String filePath = ((ICDIFileLocation)location).getFile(); - if (filePath != null && filePath.length() > 0) - file = new File(filePath); - } - if (location instanceof ICDILineLocation) { - ICDILineLocation lineLocation = (ICDILineLocation)location; - if (file != null) { - loc = file.getName() + ":" + lineLocation.getLineNumber(); //$NON-NLS-1$ - } - } else if (location instanceof ICDIFunctionLocation) { - ICDIFunctionLocation funcLocation = (ICDIFunctionLocation)location; - if (funcLocation.getFunction() != null && funcLocation.getFunction().length() > 0) { - loc = funcLocation.getFunction(); - } - if (file != null && loc != null) { - loc = funcLocation.getFile() + ":" + loc; //$NON-NLS-1$ - } - } else if (location instanceof ICDIAddressLocation) { - ICDIAddressLocation addrLocation = (ICDIAddressLocation)location; - if (!addrLocation.getAddress().equals(BigInteger.ZERO)) { - loc = "*0x" + addrLocation.getAddress().toString(16); //$NON-NLS-1$ - } - } - // Throw an exception we do know where to go - if (loc == null) { - throw new CDIException(CdiResources.getString("cdi.mode.Target.Bad_location")); //$NON-NLS-1$ - } - - CLIJump jump = factory.createCLIJump(loc); - try { - miSession.postCommand(jump); - MIInfo info = jump.getMIInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.model.Target.Target_not_responding")); //$NON-NLS-1$ - } - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteMoveInstructionPointer#moveInstructionPointer(org.eclipse.cdt.debug.core.cdi.ICDILocation) - */ - /** - * @since 6.0 - */ - @Override - public void moveInstructionPointer(ICDILocation location) throws CDIException { - // Most of this code was taken from our Resume() - // method. The only differences are that we create a temporary - // breakpoint for the location and set it before we post - // the 'jump' command - CommandFactory factory = miSession.getCommandFactory(); - LocationBreakpoint bkpt = null; - String loc = null; - File file = null; - if (location instanceof ICDIFileLocation) { - String filePath = ((ICDIFileLocation)location).getFile(); - if (filePath != null && filePath.length() > 0) - file = new File(filePath); - } - if (location instanceof ICDILineLocation) { - ICDILineLocation lineLocation = (ICDILineLocation)location; - if (file != null) { - loc = file.getName() + ":" + lineLocation.getLineNumber(); //$NON-NLS-1$ - } - bkpt = new LineBreakpoint(this, ICBreakpointType.TEMPORARY, lineLocation, null, true); - } else if (location instanceof ICDIAddressLocation) { - ICDIAddressLocation addrLocation = (ICDIAddressLocation)location; - if (!addrLocation.getAddress().equals(BigInteger.ZERO)) { - loc = "*0x" + addrLocation.getAddress().toString(16); //$NON-NLS-1$ - } - bkpt = new AddressBreakpoint(this, ICBreakpointType.TEMPORARY, addrLocation, null, true); - } - // Throw an exception we do know where to go - if (loc == null) { - throw new CDIException(CdiResources.getString("cdi.mode.Target.Bad_location")); //$NON-NLS-1$ - } - - // Set a temporary breakpoint at the location we're going - // to do a 'jump' (resume from) operation - Session session = (Session)getSession(); - session.getBreakpointManager().setLocationBreakpoint(bkpt); - - CLIJump jump = factory.createCLIJump(loc); - try { - miSession.postCommand(jump); - MIInfo info = jump.getMIInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.model.Target.Target_not_responding")); //$NON-NLS-1$ - } - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteResume#resume(org.eclipse.cdt.debug.core.cdi.model.ICDISignal) - */ - @Override - public void resume(ICDISignal signal) throws CDIException { - CommandFactory factory = miSession.getCommandFactory(); - CLISignal sig = factory.createCLISignal(signal.getName()); - try { - miSession.postCommand(sig); - MIInfo info = sig.getMIInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.model.Target.Target_not_responding")); //$NON-NLS-1$ - } - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteResume#resume(boolean) - */ - @Override - public void resume(boolean passSignal) throws CDIException { - if (miSession.getMIInferior().isRunning()) { - throw new CDIException(CdiResources.getString("cdi.model.Target.Inferior_already_running")); //$NON-NLS-1$ - } else if (miSession.getMIInferior().isSuspended()) { - if (passSignal) { - CommandFactory factory = miSession.getCommandFactory(); - CLISignal signal = factory.createCLISignal("0"); //$NON-NLS-1$ - try { - miSession.postCommand(signal); - MIInfo info = signal.getMIInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.model.Target.Target_not_responding")); //$NON-NLS-1$ - } - } catch (MIException e) { - throw new MI2CDIException(e); - } - } else { - continuation(); - } - } else if (miSession.getMIInferior().isTerminated()) { - restart(); - } else { - restart(); - } - } - - public void continuation() throws CDIException { - CommandFactory factory = miSession.getCommandFactory(); - MIExecContinue cont = factory.createMIExecContinue(); - try { - miSession.postCommand(cont); - MIInfo info = cont.getMIInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.model.Target.Target_not_responding")); //$NON-NLS-1$ - } - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#jump(ICDILocation) - */ - @Override - public void jump(ICDILocation location) throws CDIException { - resume(location); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#signal() - */ - @Override - public void signal() throws CDIException { - resume(true); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#signal(ICDISignal) - */ - @Override - public void signal(ICDISignal signal) throws CDIException { - resume(signal); - } - - @Override - public String evaluateExpressionToString(ICDIStackFrame frame, String expressionText) throws CDIException { - Target target = (Target)frame.getTarget(); - Thread currentThread = (Thread)target.getCurrentThread(); - StackFrame currentFrame = currentThread.getCurrentStackFrame(); - target.setCurrentThread(frame.getThread(), false); - ((Thread)frame.getThread()).setCurrentStackFrame((StackFrame)frame, false); - try { - CommandFactory factory = miSession.getCommandFactory(); - MIDataEvaluateExpression evaluate = - factory.createMIDataEvaluateExpression(expressionText); - miSession.postCommand(evaluate); - MIDataEvaluateExpressionInfo info = - evaluate.getMIDataEvaluateExpressionInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.model.Target.Target_not_responding")); //$NON-NLS-1$ - } - return info.getExpression(); - } catch (MIException e) { - throw new MI2CDIException(e); - } finally { - target.setCurrentThread(currentThread, false); - currentThread.setCurrentStackFrame(currentFrame, false); - } - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#terminate() - */ - @Override - public void terminate() throws CDIException { - try { - miSession.getMIInferior().terminate(); - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#isTerminated() - */ - @Override - public boolean isTerminated() { - return miSession.getMIInferior().isTerminated(); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#isDisconnected() - */ - @Override - public boolean isDisconnected() { - return !miSession.getMIInferior().isConnected(); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#isSuspended() - */ - @Override - public boolean isSuspended() { - return miSession.getMIInferior().isSuspended(); - } - - public boolean isRunning() { - return miSession.getMIInferior().isRunning(); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#getProcess() - */ - @Override - public Process getProcess() { - if (miSession.isCoreSession()) { - return new CoreProcess(); - } - return miSession.getMIInferior(); - } - - // Implementaton of ICDIBreapointManagement. - - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpointManagement#setLineBreakpoint(int, org.eclipse.cdt.debug.core.cdi.ICDILineLocation, org.eclipse.cdt.debug.core.cdi.ICDICondition, boolean) - */ - @Override - public ICDILineBreakpoint setLineBreakpoint(int type, ICDILineLocation location, - ICDICondition condition, boolean deferred) throws CDIException { - return this.setLineBreakpoint(type, location, condition, deferred, true); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpointManagement#setFunctionBreakpoint(int, org.eclipse.cdt.debug.core.cdi.ICDIFunctionLocation, org.eclipse.cdt.debug.core.cdi.ICDICondition, boolean) - */ - @Override - public ICDIFunctionBreakpoint setFunctionBreakpoint(int type, ICDIFunctionLocation location, - ICDICondition condition, boolean deferred) throws CDIException { - return this.setFunctionBreakpoint(type, location, condition, deferred, true); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpointManagement#setAddressBreakpoint(int, org.eclipse.cdt.debug.core.cdi.ICDIAddressLocation, org.eclipse.cdt.debug.core.cdi.ICDICondition, boolean) - */ - @Override - public ICDIAddressBreakpoint setAddressBreakpoint(int type, ICDIAddressLocation location, - ICDICondition condition, boolean deferred) throws CDIException { - return this.setAddressBreakpoint(type, location, condition, deferred, true); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpointManagement#setWatchpoint(int, int, java.lang.String, org.eclipse.cdt.debug.core.cdi.ICDICondition) - */ - @Override - public ICDIWatchpoint setWatchpoint(int type, int watchType, String expression, - ICDICondition condition) throws CDIException { - return this.setWatchpoint(type, watchType, expression, condition, true); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpointManagement2#setWatchpoint(int, int, java.lang.String, org.eclipse.cdt.debug.core.cdi.ICDICondition, boolean) - */ - @Override - public ICDIWatchpoint setWatchpoint(int type, int watchType, String expression, - ICDICondition condition, boolean enabled) throws CDIException { - BreakpointManager bMgr = ((Session)getSession()).getBreakpointManager(); - Watchpoint bkpt = new Watchpoint(this, expression, type, watchType, condition, enabled); - bMgr.setWatchpoint(bkpt); - return bkpt; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpointManagement2#setWatchpoint(int, int, java.lang.String, java.math.BigInteger, org.eclipse.cdt.debug.core.cdi.ICDICondition, boolean) - */ - @Override - public ICDIWatchpoint setWatchpoint(int type, int watchType, String expression, - String memorySpace, BigInteger range, ICDICondition condition, boolean enabled) throws CDIException { - BreakpointManager bMgr = ((Session)getSession()).getBreakpointManager(); - Watchpoint bkpt = new Watchpoint(this, expression, memorySpace, range, type, watchType, condition, enabled); - bMgr.setWatchpoint(bkpt); - return bkpt; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpointManagement#setExceptionBreakpoint(java.lang.String, boolean, boolean) - */ - @Override - public ICDIExceptionpoint setExceptionBreakpoint(String clazz, boolean stopOnThrow, boolean stopOnCatch) - throws CDIException { - throw new CDIException(CdiResources.getString("cdi.Common.Not_implemented")); //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpointManagement#getBreakpoints() - */ - @Override - public ICDIBreakpoint[] getBreakpoints() throws CDIException { - BreakpointManager bMgr = ((Session)getSession()).getBreakpointManager(); - return bMgr.getBreakpoints(this); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpointManagement#deleteBreakpoints(org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint[]) - */ - @Override - public void deleteBreakpoints(ICDIBreakpoint[] breakpoints) throws CDIException { - BreakpointManager bMgr = ((Session)getSession()).getBreakpointManager(); - bMgr.deleteBreakpoints(this, breakpoints); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpointManagement#deleteAllBreakpoints() - */ - @Override - public void deleteAllBreakpoints() throws CDIException { - BreakpointManager bMgr = ((Session)getSession()).getBreakpointManager(); - bMgr.deleteAllBreakpoints(this); - } - - /* - * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#createCondition(int, java.lang.String, String) - */ - @Override - public ICDICondition createCondition(int ignoreCount, String expression) { - return createCondition(ignoreCount, expression, null); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#createCondition(int, java.lang.String, String) - */ - @Override - public ICDICondition createCondition(int ignoreCount, String expression, String[] tids) { - BreakpointManager bMgr = ((Session)getSession()).getBreakpointManager(); - return bMgr.createCondition(ignoreCount, expression, tids); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#createLineLocation(java.lang.String, int) - */ - @Override - public ICDILineLocation createLineLocation(String file, int line) { - BreakpointManager bMgr = ((Session)getSession()).getBreakpointManager(); - return bMgr.createLineLocation(file, line); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#createFunctionLocation(java.lang.String, java.lang.String) - */ - @Override - public ICDIFunctionLocation createFunctionLocation(String file, String function) { - BreakpointManager bMgr = ((Session)getSession()).getBreakpointManager(); - return bMgr.createFunctionLocation(file, function); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#createLocation(long) - */ - @Override - public ICDIAddressLocation createAddressLocation(BigInteger address) { - BreakpointManager bMgr = ((Session)getSession()).getBreakpointManager(); - return bMgr.createAddressLocation(address); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#getRuntimeOptions() - */ - @Override - public ICDIRuntimeOptions getRuntimeOptions() { - return new RuntimeOptions(this); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExpressionManagement#createExpression(java.lang.String) - */ - @Override - public ICDIExpression createExpression(String code) throws CDIException { - ExpressionManager expMgr = ((Session)getSession()).getExpressionManager(); - return expMgr.createExpression(this, code); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExpressionManagement#getExpressions() - */ - @Override - public ICDIExpression[] getExpressions() throws CDIException { - ExpressionManager expMgr = ((Session)getSession()).getExpressionManager(); - return expMgr.getExpressions(this); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExpressionManagement#destroyExpression(org.eclipse.cdt.debug.core.cdi.model.ICDIExpression[]) - */ - @Override - public void destroyExpressions(ICDIExpression[] expressions) throws CDIException { - ExpressionManager expMgr = ((Session)getSession()).getExpressionManager(); - expMgr.destroyExpressions(this, expressions); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExpressionManagement#destroyAllExpression() - */ - @Override - public void destroyAllExpressions() throws CDIException { - ExpressionManager expMgr = ((Session)getSession()).getExpressionManager(); - expMgr.destroyAllExpressions(this); - } - - /** - * Returns the array of signals defined for this target. - * - * @return the array of signals - * @throws CDIException on failure. Reasons include: - */ - @Override - public ICDISignal[] getSignals() throws CDIException { - SignalManager sigMgr = ((Session)getSession()).getSignalManager(); - return sigMgr.getSignals(this); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDISourceManagement#setSourcePaths(java.lang.String[]) - */ - @Override - public void setSourcePaths(String[] srcPaths) throws CDIException { - SourceManager srcMgr = ((Session)getSession()).getSourceManager(); - srcMgr.setSourcePaths(this, srcPaths); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDISourceManagement#getSourcePaths() - */ - @Override - public String[] getSourcePaths() throws CDIException { - SourceManager srcMgr = ((Session)getSession()).getSourceManager(); - return srcMgr.getSourcePaths(this); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDISourceManagement#getInstructions(java.math.BigInteger, java.math.BigInteger) - */ - @Override - public ICDIInstruction[] getInstructions(BigInteger startAddress, BigInteger endAddress) throws CDIException { - SourceManager srcMgr = ((Session)getSession()).getSourceManager(); - return srcMgr.getInstructions(this, startAddress, endAddress); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDISourceManagement#getInstructions(java.lang.String, int) - */ - @Override - public ICDIInstruction[] getInstructions(String filename, int linenum) throws CDIException { - SourceManager srcMgr = ((Session)getSession()).getSourceManager(); - return srcMgr.getInstructions(this, filename, linenum); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDISourceManagement#getInstructions(java.lang.String, int, int) - */ - @Override - public ICDIInstruction[] getInstructions(String filename, int linenum, int lines) throws CDIException { - SourceManager srcMgr = ((Session)getSession()).getSourceManager(); - return srcMgr.getInstructions(this, filename, linenum, lines); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDISourceManagement#getMixedInstructions(java.math.BigInteger, java.math.BigInteger) - */ - @Override - public ICDIMixedInstruction[] getMixedInstructions(BigInteger startAddress, BigInteger endAddress) throws CDIException { - SourceManager srcMgr = ((Session)getSession()).getSourceManager(); - return srcMgr.getMixedInstructions(this, startAddress, endAddress); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDISourceManagement#getMixedInstructions(java.lang.String, int) - */ - @Override - public ICDIMixedInstruction[] getMixedInstructions(String filename, int linenum) throws CDIException { - SourceManager srcMgr = ((Session)getSession()).getSourceManager(); - return srcMgr.getMixedInstructions(this, filename, linenum); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDISourceManagement#getMixedInstructions(java.lang.String, int, int) - */ - @Override - public ICDIMixedInstruction[] getMixedInstructions(String filename, int linenum, int lines) throws CDIException { - SourceManager srcMgr = ((Session)getSession()).getSourceManager(); - return srcMgr.getMixedInstructions(this, filename, linenum, lines); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlockManagement#createMemoryBlock(java.lang.String, int) - */ - @Override - public ICDIMemoryBlock createMemoryBlock(String address, int units, int wordSize) throws CDIException { - MemoryManager memMgr = ((Session)getSession()).getMemoryManager(); - return memMgr.createMemoryBlock(this, address, units, wordSize); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlockManagement#removeBlocks(org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock[]) - */ - @Override - public void removeBlocks(ICDIMemoryBlock[] memoryBlocks) throws CDIException { - MemoryManager memMgr = ((Session)getSession()).getMemoryManager(); - memMgr.removeBlocks(this, memoryBlocks); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlockManagement#removeAllBlocks() - */ - @Override - public void removeAllBlocks() throws CDIException { - MemoryManager memMgr = ((Session)getSession()).getMemoryManager(); - memMgr.removeAllBlocks(this); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlockManagement#getMemoryBlocks() - */ - @Override - public ICDIMemoryBlock[] getMemoryBlocks() throws CDIException { - MemoryManager memMgr = ((Session)getSession()).getMemoryManager(); - return memMgr.getMemoryBlocks(this); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibraryManagement#getSharedLibraries() - */ - @Override - public ICDISharedLibrary[] getSharedLibraries() throws CDIException { - SharedLibraryManager sharedMgr = ((Session)getSession()).getSharedLibraryManager(); - return sharedMgr.getSharedLibraries(this); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#getGlobalVariableDescriptors(java.lang.String, java.lang.String, java.lang.String) - */ - @Override - public ICDIGlobalVariableDescriptor getGlobalVariableDescriptors(String filename, String function, String name) throws CDIException { - VariableManager varMgr = ((Session)getSession()).getVariableManager(); - return varMgr.getGlobalVariableDescriptor(this, filename, function, name); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#getRegisterGroups() - */ - @Override - public ICDIRegisterGroup[] getRegisterGroups() throws CDIException { - RegisterManager regMgr = ((Session)getSession()).getRegisterManager(); - return regMgr.getRegisterGroups(this); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#getConfiguration() - */ - @Override - public ICDITargetConfiguration getConfiguration() { - if (fConfiguration == null) { - if (miSession.isProgramSession()) { - fConfiguration = new TargetConfiguration(this); - } else if (miSession.isAttachSession()) { - fConfiguration = new TargetConfiguration(this); - } else if (miSession.isCoreSession()) { - fConfiguration = new CoreFileConfiguration(this); - } else { - fConfiguration = new TargetConfiguration(this); - } - } - return fConfiguration; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#createGlobalVariable(org.eclipse.cdt.debug.core.cdi.model.ICDIGlobalVariableDescriptor) - */ - @Override - public ICDIGlobalVariable createGlobalVariable(ICDIGlobalVariableDescriptor varDesc) throws CDIException { - if (varDesc instanceof GlobalVariableDescriptor) { - VariableManager varMgr = ((Session)getSession()).getVariableManager(); - return varMgr.createGlobalVariable((GlobalVariableDescriptor)varDesc); - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#createRegister(org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterDescriptor) - */ - @Override - public ICDIRegister createRegister(ICDIRegisterDescriptor varDesc) throws CDIException { - if (varDesc instanceof RegisterDescriptor) { - Session session = (Session)getTarget().getSession(); - RegisterManager mgr = session.getRegisterManager(); - return mgr.createRegister((RegisterDescriptor)varDesc); - } - return null; - } - - public void deferBreakpoints(boolean defer) { - this.deferBreakpoints = defer; - } - - public boolean areBreakpointsDeferred() { - return this.deferBreakpoints; - } - - public void enableVerboseMode(boolean enabled) { - miSession.enableVerboseMode(enabled); - } - - public boolean isVerboseModeEnabled() { - return miSession.isVerboseModeEnabled(); - } - - @Override - public ICDIAddressBreakpoint setAddressBreakpoint(int type, ICDIAddressLocation location, ICDICondition condition, boolean deferred, boolean enabled) throws CDIException { - BreakpointManager bMgr = ((Session)getSession()).getBreakpointManager(); - return bMgr.setAddressBreakpoint(this, type, location, condition, deferred, enabled); - } - - @Override - public ICDIExceptionpoint setExceptionBreakpoint(String clazz, boolean stopOnThrow, boolean stopOnCatch, boolean enabled) throws CDIException { - throw new CDIException(CdiResources.getString("cdi.Common.Not_implemented")); //$NON-NLS-1$ - } - - @Override - public ICDIFunctionBreakpoint setFunctionBreakpoint(int type, ICDIFunctionLocation location, ICDICondition condition, boolean deferred, boolean enabled) throws CDIException { - BreakpointManager bMgr = ((Session)getSession()).getBreakpointManager(); - return bMgr.setFunctionBreakpoint(this, type, location, condition, deferred, enabled); - } - - @Override - public ICDILineBreakpoint setLineBreakpoint(int type, ICDILineLocation location, ICDICondition condition, boolean deferred, boolean enabled) throws CDIException { - BreakpointManager bMgr = ((Session)getSession()).getBreakpointManager(); - return bMgr.setLineBreakpoint(this, type, location, condition, deferred, enabled); - } - - @Override - public IMappedSourceLocation getSourceForAddress(IAddress address) throws CDIException { - // Ask gdb for info for this address, use the module list - // to determine the executable. - CommandFactory factory = miSession.getCommandFactory(); - CLIInfoLine cmd = factory.createCLIInfoLine(address); - try { - miSession.postCommand(cmd); - CLIInfoLineInfo info = cmd.getMIInfoLineInfo(); - String fileName = ""; //$NON-NLS-1$ - ICDISharedLibrary[] libs = getSharedLibraries(); - BigInteger sourceAddress = address.getValue(); - for (int i = 0; i < libs.length; i++) { - if (sourceAddress.compareTo(libs[i].getStartAddress()) > 0 && sourceAddress.compareTo(libs[i].getEndAddress()) < 0) - { - fileName = libs[i].getFileName(); - } - } - return new MappedSourceLocation(address, info, fileName); - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - - @Override - public ICDIEventBreakpoint setEventBreakpoint(String type, String arg, int cdiType, ICDICondition condition, boolean deferred, - boolean enabled) throws CDIException { - BreakpointManager bMgr = ((Session)getSession()).getBreakpointManager(); - return bMgr.setEventBreakpoint(this,type,arg,condition,enabled); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/TargetConfiguration.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/TargetConfiguration.java deleted file mode 100644 index 80e49319f9a..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/TargetConfiguration.java +++ /dev/null @@ -1,173 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.model.ICDITargetConfiguration; -import org.eclipse.cdt.debug.mi.core.MIInferior; -import org.eclipse.cdt.debug.mi.core.MIProcess; -import org.eclipse.cdt.debug.mi.core.MISession; - -/** - */ -public class TargetConfiguration extends CObject implements ICDITargetConfiguration { - - public TargetConfiguration(Target target) { - super(target); - } - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIConfiguration#supportsBreakpoints() - */ - @Override - public boolean supportsBreakpoints() { - return true; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIConfiguration#supportsDisconnect() - */ - @Override - public boolean supportsDisconnect() { - MISession miSession = ((Target)getTarget()).getMISession(); - return miSession.isAttachSession() ? true : false; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIConfiguration#supportsExpressionEvaluation() - */ - @Override - public boolean supportsExpressionEvaluation() { - return true; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIConfiguration#supportsInstructionStepping() - */ - @Override - public boolean supportsInstructionStepping() { - return true; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIConfiguration#supportsMemoryModification() - */ - @Override - public boolean supportsMemoryModification() { - return true; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIConfiguration#supportsMemoryRetrieval() - */ - @Override - public boolean supportsMemoryRetrieval() { - return true; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIConfiguration#supportsRegisterModification() - */ - @Override - public boolean supportsRegisterModification() { - return true; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIConfiguration#supportsRegisters() - */ - @Override - public boolean supportsRegisters() { - return true; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIConfiguration#supportsSharedLibrary() - */ - @Override - public boolean supportsSharedLibrary() { - return true; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIConfiguration#supportsRestart() - */ - @Override - public boolean supportsRestart() { - MISession miSession = ((Target)getTarget()).getMISession(); - return miSession.isAttachSession() ? false : true; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIConfiguration#supportsStepping() - */ - @Override - public boolean supportsStepping() { - return true; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIConfiguration#supportsTerminate() - */ - @Override - public boolean supportsTerminate() { - return true; - - } - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIConfiguration#supportsResume() - */ - @Override - public boolean supportsResume() { - return true; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIConfiguration#supportsSuspend() - */ - @Override - public boolean supportsSuspend() { - String os = null; - try { - os = System.getProperty("os.name", ""); //$NON-NLS-1$ //$NON-NLS-2$ - } catch (SecurityException e) { - } - Target target = (Target)getTarget(); - MISession miSession = target.getMISession(); - MIProcess gdb = miSession.getGDBProcess(); - MIInferior inferior = miSession.getMIInferior(); - if (gdb.canInterrupt(inferior)) { - // If we attached sending a control-c, - // seems to alays work. - if (miSession.isAttachSession()) { - return true; - } - - // If we have a pty, sending a control-c will work - // except for solaris. - if (os.equals("SunOS")) { //$NON-NLS-1$ - if (inferior.getTTY() != null) { - // FIXME: bug in Solaris gdb when using -tty, sending a control-c - // does not work. - return false; - } - return true; - } - return true; - } - return false; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIConfiguration#terminateSessionOnExit() - */ - public boolean terminateSessionOnExit() { - return true; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java deleted file mode 100644 index 17f16745830..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java +++ /dev/null @@ -1,596 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - * Alena Laskavaia (QNX) - Bug 221224 - * Oyvind Harboe (oyvind.harboe@zylin.com) - Bug 86676 - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi.model; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.ICDICondition; -import org.eclipse.cdt.debug.core.cdi.ICDILocation; -import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint; -import org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteMoveInstructionPointer; -import org.eclipse.cdt.debug.core.cdi.model.ICDISignal; -import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame; -import org.eclipse.cdt.debug.core.cdi.model.ICDIThread; -import org.eclipse.cdt.debug.core.cdi.model.ICDIThreadStorage; -import org.eclipse.cdt.debug.core.cdi.model.ICDIThreadStorageDescriptor; -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.MISession; -import org.eclipse.cdt.debug.mi.core.cdi.CdiResources; -import org.eclipse.cdt.debug.mi.core.cdi.MI2CDIException; -import org.eclipse.cdt.debug.mi.core.cdi.RegisterManager; -import org.eclipse.cdt.debug.mi.core.cdi.Session; -import org.eclipse.cdt.debug.mi.core.cdi.VariableManager; -import org.eclipse.cdt.debug.mi.core.command.CommandFactory; -import org.eclipse.cdt.debug.mi.core.command.MIStackInfoDepth; -import org.eclipse.cdt.debug.mi.core.command.MIStackListFrames; -import org.eclipse.cdt.debug.mi.core.command.MIStackSelectFrame; -import org.eclipse.cdt.debug.mi.core.output.MIFrame; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIStackInfoDepthInfo; -import org.eclipse.cdt.debug.mi.core.output.MIStackListFramesInfo; - -/** - */ -public class Thread extends CObject implements ICDIThread, ICDIExecuteMoveInstructionPointer { - - static ICDIStackFrame[] noStack = new ICDIStackFrame[0]; - int id; - String name; - StackFrame currentFrame; - List currentFrames; - int stackdepth = 0; - - final public static int STACKFRAME_DEFAULT_DEPTH = 200; - - public Thread(Target target, int threadId) { - this(target, threadId, null); - } - - public Thread(Target target, int threadId, String threadName) { - super(target); - id = threadId; - name = threadName; - } - - public int getId() { - return id; - } - - public void clearState() { - stackdepth = 0; - currentFrame = null; - currentFrames = null; - } - - @Override - public String toString() { - String str = Integer.toString(id); - if (name != null) { - str += " " + name; //$NON-NLS-1$ - } - return str; - } - - public void updateState() { - try { - getCurrentStackFrame(); - } catch (CDIException e) { - } - } - - public StackFrame getCurrentStackFrame() throws CDIException { - if (currentFrame == null) { - ICDIStackFrame[] frames = getStackFrames(0, 0); - if (frames.length > 0) { - currentFrame = (StackFrame)frames[0]; - } - } - return currentFrame; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#getStackFrames() - */ - @Override - public ICDIStackFrame[] getStackFrames() throws CDIException { - - // get the frames depth - int depth = getStackFrameCount(); - - // refresh if we have nothing or if we have just a subset get everything. - if (currentFrames == null || currentFrames.size() < depth) { - currentFrames = new ArrayList(); - Target target = (Target)getTarget(); - ICDIThread currentThread = target.getCurrentThread(); - synchronized (target.getLock()) { - try { - target.setCurrentThread(this, false); - MISession mi = target.getMISession(); - CommandFactory factory = mi.getCommandFactory(); - MIStackListFrames frames = factory.createMIStackListFrames(); - mi.postCommand(frames); - MIStackListFramesInfo info = frames.getMIStackListFramesInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - MIFrame[] miFrames = info.getMIFrames(); - for (int i = 0; i < miFrames.length; i++) { - currentFrames.add(new StackFrame(this, miFrames[i], depth - miFrames[i].getLevel())); - } - } catch (MIException e) { - //throw new CDIException(e.getMessage()); - //System.out.println(e); - } catch (CDIException e) { - //throw e; - //System.out.println(e); - } finally { - target.setCurrentThread(currentThread, false); - } - } - // assign the currentFrame if it was not done yet. - if (currentFrame == null) { - for (int i = 0; i < currentFrames.size(); i++) { - ICDIStackFrame stack = (ICDIStackFrame) currentFrames.get(i); - if (stack.getLevel() == depth) { - currentFrame = (StackFrame)stack; - } - } - } - } - return (ICDIStackFrame[]) currentFrames.toArray(noStack); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#getStackFrames() - */ - @Override - public int getStackFrameCount() throws CDIException { - if (stackdepth == 0) { - Target target = (Target)getTarget(); - ICDIThread currentThread = target.getCurrentThread(); - synchronized (target.getLock()) { - try { - target.setCurrentThread(this, false); - MISession mi = target.getMISession(); - CommandFactory factory = mi.getCommandFactory(); - MIStackInfoDepth depth = factory.createMIStackInfoDepth(); - mi.postCommand(depth); - MIStackInfoDepthInfo info = null; - try { - // Catch the first exception gdb can recover the second time. - info = depth.getMIStackInfoDepthInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - stackdepth = info.getDepth(); - } catch (MIException e) { - // First try fails, retry. gdb patches up the corrupt frame - // so retry should give us a frame count that is safe. - depth = factory.createMIStackInfoDepth(); - mi.postCommand(depth); - info = depth.getMIStackInfoDepthInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - stackdepth = info.getDepth(); - if (stackdepth > 0) { - stackdepth--; - } - } - } catch (MIException e) { - /* GDB has a bug where it fails to evaluate the stack depth, this must, ultimately - * be fixed in GDB. GNAT nr 2395 - * - * http://sourceware.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gdb&pr=2395 - */ - // Bug#86676 fix: - // - // 1 is safe - stackdepth = 1; - } finally { - target.setCurrentThread(currentThread, false); - } - } - } - return stackdepth; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#getStackFrames() - */ - @Override - public ICDIStackFrame[] getStackFrames(int low, int high) throws CDIException { - if (currentFrames == null || currentFrames.size() < high) { - currentFrames = new ArrayList(); - Target target = (Target) getTarget(); - ICDIThread currentThread = target.getCurrentThread(); - synchronized (target.getLock()) { - try { - target.setCurrentThread(this, false); - int depth = getStackFrameCount(); - int upperBound; - // try to get the largest subset. - // if what the user asks is smaller then the depth - // try to cache things by getting the min(depth,STACKFRAME_DEFAULT_DEPTH) - // else give fetch the entire thing. - if (high < depth) { - upperBound = Math.min(depth, STACKFRAME_DEFAULT_DEPTH); - } else { - upperBound = depth; - } - MISession mi = target.getMISession(); - CommandFactory factory = mi.getCommandFactory(); - MIStackListFrames frames = factory.createMIStackListFrames(0, upperBound); - mi.postCommand(frames); - MIStackListFramesInfo info = frames.getMIStackListFramesInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - MIFrame[] miFrames = info.getMIFrames(); - for (int i = 0; i < miFrames.length; i++) { - currentFrames.add(new StackFrame(this, miFrames[i], depth - miFrames[i].getLevel())); - } - } catch (MIException e) { - //throw new CDIException(e.getMessage()); - //System.out.println(e); - } catch (CDIException e) { - //throw e; - //System.out.println(e); - } finally { - target.setCurrentThread(currentThread, false); - } - } - // take time to assign the currentFrame, if it is in the set - if (currentFrame == null) { - for (int i = 0; i < currentFrames.size(); i++) { - StackFrame f = (StackFrame) currentFrames.get(i); - if (f.getMIFrame().getLevel() == 0) { - currentFrame =f; - } - } - } - } - List list = ((high - low + 1) <= currentFrames.size()) ? currentFrames.subList(low, high + 1) : currentFrames; - return (ICDIStackFrame[])list.toArray(noStack); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#setCurrentStackFrame(ICDIStackFrame, boolean) - */ - public void setCurrentStackFrame(StackFrame stackframe, boolean doUpdate) throws CDIException { - - // Assert we should assert that the stackframe is one of our frames. - - int frameLevel = 0; - if (stackframe != null) { - frameLevel = stackframe.getLevel(); - } - - // Check to see if we are already at this level - if (currentFrame != null && currentFrame.getLevel() == frameLevel) { - if (stackframe != null) { - Thread aThread = (Thread)stackframe.getThread(); - if (aThread != null && aThread.getId() == getId()) { - // noop - return; - } - } - } - - Target target = (Target)getTarget(); - MISession mi = target.getMISession(); - CommandFactory factory = mi.getCommandFactory(); - // Need the GDB/MI view of level which is the reverse, i.e. the highest level is 0 - // See comment in StackFrame constructor. - int miLevel = getStackFrameCount() - frameLevel; - MIStackSelectFrame frame = factory.createMIStackSelectFrame(miLevel); - // Set ourself as the current thread first. - synchronized (target.getLock()) { - try { - target.setCurrentThread(this, doUpdate); - mi.postCommand(frame); - MIInfo info = frame.getMIInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - currentFrame = stackframe; - // Resetting stackframe may change the value of - // some variables like registers. Call an update() - // To generate changeEvents. - if (doUpdate) { - Session session = (Session) target.getSession(); - RegisterManager regMgr = session.getRegisterManager(); - if (regMgr.isAutoUpdate()) { - regMgr.update(target); - } - VariableManager varMgr = session.getVariableManager(); - if (varMgr.isAutoUpdate()) { - varMgr.update(target); - } - } - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#stepInto() - */ - @Override - public void stepInto() throws CDIException { - stepInto(1); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepInto(int) - */ - @Override - public void stepInto(int count) throws CDIException { - Target target = (Target)getTarget(); - synchronized(target.getLock()) { - target.setCurrentThread(this); - target.stepInto(count); - } - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#stepIntoInstruction() - */ - @Override - public void stepIntoInstruction() throws CDIException { - stepIntoInstruction(1); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepIntoInstruction(int) - */ - @Override - public void stepIntoInstruction(int count) throws CDIException { - Target target = (Target)getTarget(); - synchronized(target.getLock()) { - target.setCurrentThread(this); - target.stepIntoInstruction(count); - } - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#stepOver() - */ - @Override - public void stepOver() throws CDIException { - stepOver(1); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepOver(int) - */ - @Override - public void stepOver(int count) throws CDIException { - Target target = (Target)getTarget(); - synchronized(target.getLock()) { - target.setCurrentThread(this); - target.stepOver(count); - } - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#stepOverInstruction() - */ - @Override - public void stepOverInstruction() throws CDIException { - stepOverInstruction(1); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepOverInstruction(int) - */ - @Override - public void stepOverInstruction(int count) throws CDIException { - Target target = (Target)getTarget(); - synchronized(target.getLock()) { - target.setCurrentThread(this); - target.stepOverInstruction(count); - } - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#stepReturn() - */ - @Override - public void stepReturn() throws CDIException { - getCurrentStackFrame().stepReturn(); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#runUntil(ICDILocation) - */ - @Override - public void runUntil(ICDILocation location) throws CDIException { - stepUntil(location); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepUntil(org.eclipse.cdt.debug.core.cdi.ICDILocation) - */ - @Override - public void stepUntil(ICDILocation location) throws CDIException { - Target target = (Target)getTarget(); - synchronized(target.getLock()) { - target.setCurrentThread(this); - target.stepUntil(location); - } -} - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#isSuspended() - */ - @Override - public boolean isSuspended() { - return getTarget().isSuspended(); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#suspend() - */ - @Override - public void suspend() throws CDIException { - getTarget().suspend(); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#resume() - */ - @Override - public void resume() throws CDIException { - resume(false); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteResume#resume(boolean) - */ - - @Override - public void resume(boolean passSignal) throws CDIException { - Target target = (Target)getTarget(); - synchronized(target.getLock()) { - target.setCurrentThread(this); - target.resume(passSignal); - } - } - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteResume#resume(org.eclipse.cdt.debug.core.cdi.ICDILocation) - */ - @Override - public void resume(ICDILocation location) throws CDIException { - Target target = (Target)getTarget(); - synchronized(target.getLock()) { - target.setCurrentThread(this); - target.resume(location); - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteResume#resume(org.eclipse.cdt.debug.core.cdi.model.ICDISignal) - */ - @Override - public void resume(ICDISignal signal) throws CDIException { - Target target = (Target)getTarget(); - synchronized(target.getLock()) { - target.setCurrentThread(this); - target.resume(signal); - } - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#jump(org.eclipse.cdt.debug.core.cdi.ICDILocation) - */ - @Override - public void jump(ICDILocation location) throws CDIException { - resume(location); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#signal() - */ - @Override - public void signal() throws CDIException { - resume(false); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#signal(org.eclipse.cdt.debug.core.cdi.model.ICDISignal) - */ - @Override - public void signal(ICDISignal signal) throws CDIException { - resume(signal); - } - - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#equals(ICDIThread) - */ - @Override - public boolean equals(ICDIThread thread) { - if (thread instanceof Thread) { - Thread cthread = (Thread) thread; - return id == cthread.getId(); - } - return super.equals(thread); - } - - public ICDIBreakpoint[] getBreakpoints() throws CDIException { - Target target = (Target)getTarget(); - ICDIBreakpoint[] bps = target.getBreakpoints(); - ArrayList list = new ArrayList(bps.length); - for (int i = 0; i < bps.length; i++) { - ICDICondition condition = bps[i].getCondition(); - if (condition == null) { - continue; - } - String[] threadIds = condition.getThreadIds(); - for (int j = 0; j < threadIds.length; j++) { - int tid = 0; - try { - tid = Integer.parseInt(threadIds[j]); - } catch (NumberFormatException e) { - // - } - if (tid == getId()) { - list.add(bps[i]); - } - } - } - return (ICDIBreakpoint[]) list.toArray(new ICDIBreakpoint[list.size()]); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#getThreadStorageDescriptors() - */ - @Override - public ICDIThreadStorageDescriptor[] getThreadStorageDescriptors() throws CDIException { - Session session = (Session)getTarget().getSession(); - VariableManager varMgr = session.getVariableManager(); - return varMgr.getThreadStorageDescriptors(this); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#createThreadStorage(org.eclipse.cdt.debug.core.cdi.model.ICDIThreadStorageDescriptor) - */ - @Override - public ICDIThreadStorage createThreadStorage(ICDIThreadStorageDescriptor varDesc) throws CDIException { - if (varDesc instanceof ThreadStorageDescriptor) { - Session session = (Session)getTarget().getSession(); - VariableManager varMgr = session.getVariableManager(); - return varMgr.createThreadStorage((ThreadStorageDescriptor)varDesc); - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteMoveInstructionPointer#moveInstructionPointer(org.eclipse.cdt.debug.core.cdi.ICDILocation) - */ - /** - * @since 6.0 - */ - @Override - public void moveInstructionPointer(ICDILocation location) throws CDIException { - Target target = (Target)getTarget(); - synchronized(target.getLock()) { - target.setCurrentThread(this); - target.moveInstructionPointer(location); - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/ThreadStorage.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/ThreadStorage.java deleted file mode 100644 index b8028e7000c..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/ThreadStorage.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.model.ICDIThreadStorage; -import org.eclipse.cdt.debug.mi.core.command.MIVarCreate; -import org.eclipse.cdt.debug.mi.core.output.MIVar; - -/** - * ThreadStorage - */ -public class ThreadStorage extends Variable implements ICDIThreadStorage { - - /** - * @param obj - * @param v - */ - public ThreadStorage(VariableDescriptor obj, MIVarCreate v) { - super(obj, v); - } - - /** - * @param target - * @param thread - * @param frame - * @param n - * @param q - * @param pos - * @param depth - * @param v - */ - public ThreadStorage(Target target, Thread thread, StackFrame frame, - String n, String q, int pos, int depth, MIVar miVar) { - super(target, thread, frame, n, q, pos, depth, miVar); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.core.cdi.model.Variable#createVariable(org.eclipse.cdt.debug.mi.core.cdi.model.Target, org.eclipse.cdt.debug.mi.core.cdi.model.Thread, org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame, java.lang.String, java.lang.String, int, int, org.eclipse.cdt.debug.mi.core.output.MIVar) - */ - @Override - protected Variable createVariable(Target target, Thread thread, - StackFrame frame, String name, String fullName, int pos, int depth, - MIVar miVar) { - return new Register(target, thread, frame, name, fullName, pos, depth, miVar); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.core.cdi.model.Variable#createDescriptor(org.eclipse.cdt.debug.mi.core.cdi.model.Target, org.eclipse.cdt.debug.mi.core.cdi.model.Thread, org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame, java.lang.String, java.lang.String, int, int) - */ - @Override - protected VariableDescriptor createDescriptor( Target target, Thread thread, StackFrame frame, String n, String fn, int pos, int depth ) { - return new ThreadStorageDescriptor(target, thread, frame, n, fn, pos, depth); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/ThreadStorageDescriptor.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/ThreadStorageDescriptor.java deleted file mode 100644 index 37fa8590c10..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/ThreadStorageDescriptor.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.model.ICDIThreadStorageDescriptor; - -/** - * ThreadStorageDescriptor - */ -public class ThreadStorageDescriptor extends VariableDescriptor implements - ICDIThreadStorageDescriptor { - - /** - * @param target - * @param thread - * @param stack - * @param n - * @param fn - * @param pos - * @param depth - */ - public ThreadStorageDescriptor(Target target, Thread thread, - StackFrame stack, String n, String fn, int pos, int depth) { - super(target, thread, stack, n, fn, pos, depth); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Value.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Value.java deleted file mode 100644 index 2669d17a13e..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Value.java +++ /dev/null @@ -1,161 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.ICDIValue; -import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType; -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.MISession; -import org.eclipse.cdt.debug.mi.core.cdi.CdiResources; -import org.eclipse.cdt.debug.mi.core.command.CommandFactory; -import org.eclipse.cdt.debug.mi.core.command.MIVarEvaluateExpression; -import org.eclipse.cdt.debug.mi.core.output.MIVarEvaluateExpressionInfo; - -/** - */ -public class Value extends CObject implements ICDIValue { - - protected Variable fVariable; - - /** - * Indicates whether this Value object is for a C++ reference variable. If - * it is, then some decoding is needed on the value string we get from gdb, - * since it will contain two things: the address of the variable being - * referenced and the value. - * @since 6.0 - */ - protected boolean fIsReference; - - public Value(Variable v) { - super((Target)v.getTarget()); - fVariable = v; - } - - protected Variable getVariable() throws CDIException { - return fVariable; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIValue#getTypeName() - */ - @Override - public String getTypeName() throws CDIException { - return getVariable().getTypeName(); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIValue#getValueString() - */ - @Override - public String getValueString() throws CDIException { - // make sure the variable is updated. - if (! getVariable().isUpdated()) { - getVariable().update(); - } - - String result = ""; //$NON-NLS-1$ - MISession mi = ((Target)getTarget()).getMISession(); - CommandFactory factory = mi.getCommandFactory(); - MIVarEvaluateExpression var = - factory.createMIVarEvaluateExpression(getVariable().getMIVar().getVarName()); - try { - mi.postCommand(var); - MIVarEvaluateExpressionInfo info = var.getMIVarEvaluateExpressionInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - result = info.getValue(); - - // Reference variables get back a string with two things: the address of the - // variable being referenced and the value of the variable. The expected - // format is, by example (for a float&): "@0x22cc98: 3.19616001e-39" - // We need to dig out the latter. - if (fIsReference) { - if (result.startsWith("@0x")) { //$NON-NLS-1$ - int index = result.indexOf(':'); - if (index > 0 && ((index + 1) < result.length())) { - result = result.substring(index+1).trim(); - } - } - } - } catch (MIException e) { - throw new CDIException(e.getMessage()); - } - return result; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIValue#getVariables() - */ - @Override - public int getChildrenNumber() throws CDIException { - return getVariable().getMIVar().getNumChild(); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIValue#getVariables() - */ - @Override - public boolean hasChildren() throws CDIException { - /* - int number = 0; - MISession mi = getCTarget().getCSession().getMISession(); - CommandFactory factory = mi.getCommandFactory(); - MIVarInfoNumChildren children = - factory.createMIVarInfoNumChildren(variable.getMIVar().getVarName()); - try { - mi.postCommand(children); - MIVarInfoNumChildrenInfo info = children.getMIVarInfoNumChildrenInfo(); - if (info == null) { - throw new CDIException("No answer"); - } - number = info.getChildNumber(); - } catch (MIException e) { - throw new CDIException(e.getMessage()); - } - return (number > 0); - */ - return (getChildrenNumber() > 0); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIValue#getVariables() - */ - @Override - public ICDIVariable[] getVariables() throws CDIException { - return getVariable().getChildren(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIValue#getType() - */ - @Override - public ICDIType getType() throws CDIException { - return getVariable().getType(); - } - - /** - * Call this after construction with 'true' if the Value is for a reference - * variable. See {@link #fIsReference}. - * - * Ideally, this property would be passed to the constructor. However - * introducing it that way at this point in time would cause a lot of churn - * in the codebase, since this class is not directly instantiated, and it - * has many subclasses. - * @since 6.0 - */ - public void setIsReference(boolean isReference) { - fIsReference = isReference; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java deleted file mode 100644 index c219d35b777..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java +++ /dev/null @@ -1,557 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi.model; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.ICDIFormat; -import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; -import org.eclipse.cdt.debug.core.cdi.model.ICDIValue; -import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIArrayType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIBoolType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDICharType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIDoubleType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIEnumType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFunctionType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIIntType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDILongLongType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDILongType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIReferenceType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIShortType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIStructType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIWCharType; -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.MIPlugin; -import org.eclipse.cdt.debug.mi.core.MISession; -import org.eclipse.cdt.debug.mi.core.cdi.CdiResources; -import org.eclipse.cdt.debug.mi.core.cdi.ExpressionManager; -import org.eclipse.cdt.debug.mi.core.cdi.Format; -import org.eclipse.cdt.debug.mi.core.cdi.MI2CDIException; -import org.eclipse.cdt.debug.mi.core.cdi.MemoryManager; -import org.eclipse.cdt.debug.mi.core.cdi.RegisterManager; -import org.eclipse.cdt.debug.mi.core.cdi.Session; -import org.eclipse.cdt.debug.mi.core.cdi.VariableManager; -import org.eclipse.cdt.debug.mi.core.cdi.model.type.ArrayValue; -import org.eclipse.cdt.debug.mi.core.cdi.model.type.BoolValue; -import org.eclipse.cdt.debug.mi.core.cdi.model.type.CharValue; -import org.eclipse.cdt.debug.mi.core.cdi.model.type.DoubleValue; -import org.eclipse.cdt.debug.mi.core.cdi.model.type.EnumValue; -import org.eclipse.cdt.debug.mi.core.cdi.model.type.FloatValue; -import org.eclipse.cdt.debug.mi.core.cdi.model.type.FunctionValue; -import org.eclipse.cdt.debug.mi.core.cdi.model.type.IncompleteType; -import org.eclipse.cdt.debug.mi.core.cdi.model.type.IntValue; -import org.eclipse.cdt.debug.mi.core.cdi.model.type.LongLongValue; -import org.eclipse.cdt.debug.mi.core.cdi.model.type.LongValue; -import org.eclipse.cdt.debug.mi.core.cdi.model.type.PointerValue; -import org.eclipse.cdt.debug.mi.core.cdi.model.type.ReferenceValue; -import org.eclipse.cdt.debug.mi.core.cdi.model.type.ShortValue; -import org.eclipse.cdt.debug.mi.core.cdi.model.type.StructValue; -import org.eclipse.cdt.debug.mi.core.cdi.model.type.WCharValue; -import org.eclipse.cdt.debug.mi.core.command.CommandFactory; -import org.eclipse.cdt.debug.mi.core.command.MIVarAssign; -import org.eclipse.cdt.debug.mi.core.command.MIVarCreate; -import org.eclipse.cdt.debug.mi.core.command.MIVarInfoExpression; -import org.eclipse.cdt.debug.mi.core.command.MIVarInfoType; -import org.eclipse.cdt.debug.mi.core.command.MIVarListChildren; -import org.eclipse.cdt.debug.mi.core.command.MIVarSetFormat; -import org.eclipse.cdt.debug.mi.core.command.MIVarShowAttributes; -import org.eclipse.cdt.debug.mi.core.event.MIVarChangedEvent; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIVar; -import org.eclipse.cdt.debug.mi.core.output.MIVarCreateInfo; -import org.eclipse.cdt.debug.mi.core.output.MIVarInfoExpressionInfo; -import org.eclipse.cdt.debug.mi.core.output.MIVarInfoTypeInfo; -import org.eclipse.cdt.debug.mi.core.output.MIVarListChildrenInfo; -import org.eclipse.cdt.debug.mi.core.output.MIVarShowAttributesInfo; - -/** - */ -public abstract class Variable extends VariableDescriptor implements ICDIVariable { - private static final ICDIVariable[] NO_CHILDREN = new ICDIVariable[0]; - protected MIVarCreate fVarCreateCMD; - protected MIVar fMIVar; - Value value; - public ICDIVariable[] children = NO_CHILDREN; - String editable = null; - String language; - boolean isFake = false; - boolean isUpdated = true; - private String hexAddress; - - public Variable(VariableDescriptor obj, MIVarCreate var) { - super(obj); - fVarCreateCMD = var; - } - - public Variable(Target target, Thread thread, StackFrame frame, String n, String q, int pos, int depth, MIVar miVar) { - super(target, thread, frame, n, q, pos, depth); - fMIVar = miVar; - } - - public void setUpdated(boolean update) { - isUpdated = update; - } - - public boolean isUpdated() { - return isUpdated; - } - - public void update() throws CDIException { - Session session = (Session)getTarget().getSession(); - VariableManager mgr = session.getVariableManager(); - mgr.update(this); - } - - public MIVar getMIVar() throws CDIException { - if (fMIVar == null) { - - // Oops! what's up here, we should use Assert - if (fVarCreateCMD == null) { - throw new CDIException("Incomplete initialization of variable"); //$NON-NLS-1$ - } - - try { - MISession mi = ((Target)getTarget()).getMISession(); - MIVarCreateInfo info = null; - // Wait for the response or timedout - synchronized (fVarCreateCMD) { - // RxThread will set the MIOutput on the cmd - // when the response arrive. - while ((info = fVarCreateCMD.getMIVarCreateInfo()) == null) { - try { - fVarCreateCMD.wait(mi.getCommandTimeout()); - info = fVarCreateCMD.getMIVarCreateInfo(); - if (info == null) { - throw new MIException(MIPlugin.getResourceString("src.MISession.Target_not_responding")); //$NON-NLS-1$ - } - } catch (InterruptedException e) { - } - } - } - - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - fMIVar = info.getMIVar(); - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - return fMIVar; - } - - /** - * @return The address of this variable as hex string if available, otherwise an empty string. - * @noreference This method is not intended to be referenced by clients outside CDT. - * @since 7.1 - */ - public String getHexAddress() throws CDIException { - if (hexAddress != null) { - return hexAddress; - } - VariableManager vm = ((Session)((Target)getTarget()).getSession()).getVariableManager(); - String qualName = "&(" + getQualifiedName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ - VariableDescriptor desc = createDescriptor((Target)getTarget(), (Thread)getThread(), (StackFrame)getStackFrame(), getName(), qualName, getPosition(), getStackDepth()); - Variable v = vm.createVariable( desc ); - // make sure to avoid infinite recursion. see bug 323630 - if (v != this) { - v.setFormat(ICDIFormat.HEXADECIMAL); - hexAddress = v.getValue().getValueString(); - } else { - hexAddress = ""; //$NON-NLS-1$ - } - return hexAddress; - } - - public Variable getChild(String name) { - for (int i = 0; i < children.length; i++) { - Variable variable = (Variable) children[i]; - try { - if (name.equals(variable.getMIVar().getVarName())) { - return variable; - } - // Look also in the grandchildren. - Variable grandChild = variable.getChild(name); - if (grandChild != null) { - return grandChild; - } - } catch (CDIException e) { - // ignore; - } - } - return null; - } - - String getLanguage() throws CDIException { - if (language == null) { - MISession mi = ((Target)getTarget()).getMISession(); - CommandFactory factory = mi.getCommandFactory(); - MIVarInfoExpression var = factory.createMIVarInfoExpression(getMIVar().getVarName()); - try { - mi.postCommand(var); - MIVarInfoExpressionInfo info = var.getMIVarInfoExpressionInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - language = info.getLanguage(); - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - return (language == null) ? "" : language; //$NON-NLS-1$ - } - - boolean isCPPLanguage() throws CDIException { - return getLanguage().equalsIgnoreCase("C++"); //$NON-NLS-1$ - } - - void setIsFake(boolean f) { - isFake = f; - } - - boolean isFake() { - return isFake; - } - - public ICDIVariable[] getChildren() throws CDIException { - // Use the default timeout. - return getChildren(-1); - } - - /** - * This can be a potentially long operation for GDB. - * allow the override of the timeout. - */ - public ICDIVariable[] getChildren(int timeout) throws CDIException { - MISession mi = ((Target)getTarget()).getMISession(); - CommandFactory factory = mi.getCommandFactory(); - MIVarListChildren var = factory.createMIVarListChildren(getMIVar().getVarName()); - try { - if (timeout >= 0) { - mi.postCommand(var, timeout); - } else { - mi.postCommand(var); - } - MIVarListChildrenInfo info = var.getMIVarListChildrenInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - final MIVar[] vars = info.getMIVars(); - final List childrenList = new ArrayList(vars.length); - final ICDIType t = getType(); - final boolean cpp = isCPPLanguage(); - for (int i = 0; i < vars.length; i++) { - String fn = getQualifiedName(); - String childName = vars[i].getExp(); - boolean childFake = false; - if (cpp && isAccessQualifier(childName)) { - // since access qualifier is keyword this only possible when gdb returns this as fake fields - // so it is pretty safe without to do without any other type checks - childFake = true; - // fn remains unchanged otherwise it would be like x->public - } else if (cpp && childName.equals(vars[i].getType())) { - // it is a base class (which is returned by GDB as a field) - // (type of a child is the name of a child) - String childNameForCast = childName.contains("::") ? "'" + childName + "'" : childName; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - if (t instanceof ICDIPointerType) { - // fn -> casting to pointer base class - fn = "(struct " + childNameForCast + ")(*" + fn + ")";//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } else { - // fn -> casting to base class - fn = "(struct " + childNameForCast + ")" + fn;//$NON-NLS-1$ //$NON-NLS-2$ - } - } else if (t instanceof ICDIArrayType) { - // For Array gdb varobj only return the index, override here. - int index = castingIndex + i; - fn = "(" + fn + ")[" + i + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - childName = getName() + "[" + index + "]"; //$NON-NLS-1$ //$NON-NLS-2$ - } else if (t instanceof ICDIPointerType) { - ICDIType subType = ((ICDIPointerType) t).getComponentType(); - if (subType instanceof ICDIStructType || subType instanceof IncompleteType) { - fn = "(" + fn + ")->" + childName; //$NON-NLS-1$ //$NON-NLS-2$ - } else { - fn = "*(" + fn + ")"; //$NON-NLS-1$ //$NON-NLS-2$ - } - } else if (t instanceof ICDIReferenceType) { - ICDIType subType = ((ICDIReferenceType) t).getComponentType(); - if (subType instanceof ICDIStructType || subType instanceof IncompleteType) { - fn = "(" + fn + ")." + childName; //$NON-NLS-1$ //$NON-NLS-2$ - } else if (subType instanceof ICDIPointerType) { - fn = "(" + fn + ")->" + childName; //$NON-NLS-1$ //$NON-NLS-2$ - } else if (subType instanceof ICDIArrayType) { - int index = castingIndex + i; - fn = "(" + fn + ")[" + index + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - // set this to look pretty - childName = getName() + "[" + index + "]"; //$NON-NLS-1$ //$NON-NLS-2$ - } else { - fn = "*(" + fn + ")"; //$NON-NLS-1$ //$NON-NLS-2$ - } - } else if (t instanceof ICDIStructType || t instanceof IncompleteType) { - if (childName.length()>0) { - fn = "(" + fn + ")." + childName; //$NON-NLS-1$ //$NON-NLS-2$ - } - } - Variable v = createVariable((Target)getTarget(), (Thread)getThread(), (StackFrame)getStackFrame(), - childName, fn, getPosition(), getStackDepth(), vars[i]); - if (childFake) { - v.setIsFake(childFake); - // Hack to reset the typename to a known value - v.fType = t; - // don't add these, add their kids - ICDIVariable[] grandchildren = v.getChildren(); - for (int j = 0; j < grandchildren.length; ++j) - childrenList.add(grandchildren[j]); - } else - childrenList.add(v); - } - - children = (ICDIVariable[])childrenList.toArray(new ICDIVariable[childrenList.size()]); - } catch (MIException e) { - throw new MI2CDIException(e); - } - return children; - } - - boolean isAccessQualifier(String foo) { - if (foo==null) return false; - return foo.equals("private") || foo.equals("public") || foo.equals("protected"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } - - protected abstract Variable createVariable(Target target, Thread thread, StackFrame frame, - String name, String fullName, int pos, int depth, MIVar miVar); - - public int getChildrenNumber() throws CDIException { - return getMIVar().getNumChild(); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariable#getValue() - */ - @Override - public ICDIValue getValue() throws CDIException { - if (value == null) { - ICDIType t = getType(); - if (t instanceof ICDIBoolType) { - value = new BoolValue(this); - } else if (t instanceof ICDICharType) { - value = new CharValue(this); - } else if (t instanceof ICDIWCharType) { - value = new WCharValue(this); - } else if (t instanceof ICDIShortType) { - value = new ShortValue(this); - } else if (t instanceof ICDIIntType) { - value = new IntValue(this); - } else if (t instanceof ICDILongType) { - value = new LongValue(this); - } else if (t instanceof ICDILongLongType) { - value = new LongLongValue(this); - } else if (t instanceof ICDIEnumType) { - value = new EnumValue(this); - } else if (t instanceof ICDIFloatType) { - value = new FloatValue(this); - } else if (t instanceof ICDIDoubleType) { - value = new DoubleValue(this); - } else if (t instanceof ICDIFunctionType) { - value = new FunctionValue(this); - } else if (t instanceof ICDIPointerType) { - value = new PointerValue(this); - } else if (t instanceof ICDIReferenceType) { - value = new ReferenceValue(this); - } else if (t instanceof ICDIArrayType) { - value = new ArrayValue(this); - } else if (t instanceof ICDIStructType) { - value = new StructValue(this); - } else { - value = new Value(this); - } - } - return value; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariable#setValue(ICDIValue) - */ - @Override - public void setValue(ICDIValue value) throws CDIException { - setValue(value.getValueString()); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariable#setValue(String) - */ - @Override - public void setValue(String expression) throws CDIException { - Target target = (Target)getTarget(); - MISession miSession = target.getMISession(); - CommandFactory factory = miSession.getCommandFactory(); - MIVarAssign var = factory.createMIVarAssign(getMIVar().getVarName(), expression); - try { - miSession.postCommand(var); - MIInfo info = var.getMIInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - } catch (MIException e) { - throw new MI2CDIException(e); - } - - // If the assign was succesfull fire a MIVarChangedEvent() for the variable - // Note GDB will not fire an event for the changed variable we have to do it manually. - MIVarChangedEvent change = new MIVarChangedEvent(miSession, var.getToken(), getMIVar().getVarName()); - miSession.fireEvent(change); - - // Changing values may have side effects i.e. affecting other variables - // if the manager is on autoupdate check all the other variables. - // Note: This maybe very costly. - // assigning may have side effects i.e. affecting other registers. - - // If register was on autoupdate, update all the other registers - RegisterManager regMgr = ((Session)target.getSession()).getRegisterManager(); - if (regMgr.isAutoUpdate()) { - regMgr.update(target); - } - - // If expression manager is on autoupdate, update all expressions - ExpressionManager expMgr = ((Session)target.getSession()).getExpressionManager(); - if (expMgr.isAutoUpdate()) { - expMgr.update(target); - } - - // If variable manager is on autoupdate, update all variables - VariableManager varMgr = ((Session)target.getSession()).getVariableManager(); - if (varMgr.isAutoUpdate()) { - varMgr.update(target); - } - - // If memory manager is on autoupdate, update all memory blocks - MemoryManager memMgr = ((Session)target.getSession()).getMemoryManager(); - if (memMgr.isAutoUpdate()) { - memMgr.update(target); - } - } - - /** - * Overload the implementation of VariableDescriptor and let gdb - * handle it. - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariable#isEditable() - */ - @Override - public boolean isEditable() throws CDIException { - if (editable == null) { - MISession mi = ((Target) getTarget()).getMISession(); - CommandFactory factory = mi.getCommandFactory(); - MIVarShowAttributes var = factory.createMIVarShowAttributes(getMIVar().getVarName()); - try { - mi.postCommand(var); - MIVarShowAttributesInfo info = var.getMIVarShowAttributesInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - editable = String.valueOf(info.isEditable()); - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - return (editable == null) ? false : editable.equalsIgnoreCase("true"); //$NON-NLS-1$ - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariable#setFormat() - */ - public void setFormat(int format) throws CDIException { - int fmt = Format.toMIFormat(format); - MISession mi = ((Target) getTarget()).getMISession(); - CommandFactory factory = mi.getCommandFactory(); - MIVarSetFormat var = factory.createMIVarSetFormat(getMIVar().getVarName(), fmt); - try { - mi.postCommand(var); - MIInfo info = var.getMIInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariable#equals() - */ - @Override - public boolean equals(ICDIVariable var) { - if (var instanceof Variable) { - Variable variable = (Variable) var; - return equals(variable); - } - return super.equals(var); - } - - /** - * @param variable - * @return - */ - public boolean equals(Variable variable) { - try { - return getMIVar().getVarName().equals(variable.getMIVar().getVarName()); - } catch (CDIException e) { - // ignore. - } - return super.equals(variable); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariable#dispose() - */ - @Override - public void dispose() throws CDIException { - ICDITarget target = getTarget(); - VariableManager varMgr = ((Session)target.getSession()).getVariableManager(); - varMgr.destroyVariable(this); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor#getTypeName() - */ - @Override - public String getTypeName() throws CDIException { - if (fTypename == null) { - fTypename = getMIVar().getType(); - if (fTypename == null || fTypename.length() == 0) { - MISession mi = ((Target) getTarget()).getMISession(); - CommandFactory factory = mi.getCommandFactory(); - MIVarInfoType infoType = factory.createMIVarInfoType(getMIVar().getVarName()); - try { - mi.postCommand(infoType); - MIVarInfoTypeInfo info = infoType.getMIVarInfoTypeInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ - } - fTypename = info.getType(); - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - } - return fTypename; - } - - public void setMIVarCreate(MIVarCreate miVar) { - fVarCreateCMD = miVar; - } - - abstract protected VariableDescriptor createDescriptor(Target target, Thread thread, StackFrame frame, String n, String fn, int pos, int depth); -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/VariableDescriptor.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/VariableDescriptor.java deleted file mode 100644 index 91ef52b064e..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/VariableDescriptor.java +++ /dev/null @@ -1,421 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - * Alena Laskavaia (QNX) - Bug 221224 - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi.model; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame; -import org.eclipse.cdt.debug.core.cdi.model.ICDIThread; -import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType; -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.MISession; -import org.eclipse.cdt.debug.mi.core.cdi.MI2CDIException; -import org.eclipse.cdt.debug.mi.core.cdi.Session; -import org.eclipse.cdt.debug.mi.core.cdi.SourceManager; -import org.eclipse.cdt.debug.mi.core.cdi.VariableManager; -import org.eclipse.cdt.debug.mi.core.cdi.model.type.IncompleteType; -import org.eclipse.cdt.debug.mi.core.command.CommandFactory; -import org.eclipse.cdt.debug.mi.core.command.MIDataEvaluateExpression; -import org.eclipse.cdt.debug.mi.core.output.MIDataEvaluateExpressionInfo; -import org.eclipse.cdt.debug.mi.core.cdi.CdiResources; - -/** - */ -public abstract class VariableDescriptor extends CObject implements ICDIVariableDescriptor { - - // Casting info. - String[] castingTypes; - int castingIndex; - int castingLength; - - String fName; - int position; - StackFrame fStackFrame; - Thread fThread; - int stackdepth; - - String qualifiedName = null; - String fFullName = null; - protected ICDIType fType = null; - protected String fTypename = null; - String sizeof = null; - - /** - * Copy constructor. - * @param desc - */ - public VariableDescriptor(VariableDescriptor desc) { - super((Target)desc.getTarget()); - fName = desc.getName(); - fFullName = desc.fFullName; - sizeof = desc.sizeof; - fType = desc.fType; - try { - fStackFrame = (StackFrame)desc.getStackFrame(); - fThread = (Thread)desc.getThread(); - } catch (CDIException e) { - } - position = desc.getPosition(); - stackdepth = desc.getStackDepth(); - castingIndex = desc.getCastingArrayStart(); - castingLength = desc.getCastingArrayEnd(); - castingTypes = desc.getCastingTypes(); - } - - public VariableDescriptor(Target target, Thread thread, StackFrame stack, String n, String fn, int pos, int depth) { - super(target); - fName = n; - fFullName = fn; - fStackFrame = stack; - fThread = thread; - position = pos; - stackdepth = depth; - } - - public int getPosition() { - return position; - } - - public int getStackDepth() { - return stackdepth; - } - - public void setCastingArrayStart(int start) { - castingIndex = start; - } - public int getCastingArrayStart() { - return castingIndex; - } - - public void setCastingArrayEnd(int end) { - castingLength = end; - } - public int getCastingArrayEnd() { - return castingLength; - } - - public void setCastingTypes(String[] t) { - castingTypes = t; - } - public String[] getCastingTypes() { - return castingTypes; - } - - /** - * If the variable was a cast encode the string appropriately for GDB. - * For example castin to an array is of 2 elements: - * (foo)@2 - * @return - */ - public String encodeVariable() { - String fn = getFullName(); - if (castingLength > 0 || castingIndex > 0) { - StringBuffer buffer = new StringBuffer(); - buffer.append("*("); //$NON-NLS-1$ - buffer.append('(').append(fn).append(')'); - buffer.append('+').append(castingIndex).append(')'); - buffer.append('@').append(castingLength); - fn = buffer.toString(); - } else if (castingTypes != null && castingTypes.length > 0) { - StringBuffer buffer = new StringBuffer(); - for (int i = 0; i < castingTypes.length; ++i) { - if (castingTypes[i] != null && castingTypes[i].length() > 0) { - if (buffer.length() == 0) { - buffer.append('(').append(castingTypes[i]).append(')'); - buffer.append(fn); - } else { - buffer.insert(0, '('); - buffer.append(')'); - StringBuffer b = new StringBuffer(); - b.append('(').append(castingTypes[i]).append(')'); - buffer.insert(0, b.toString()); - } - } - } - fn = buffer.toString(); - } - return fn; - } - - public String getFullName() { - if (fFullName == null) { - fFullName = getName(); - } - return fFullName; - } - - protected ICDIType getFromTypeCache(String nameType) throws CDIException { - StackFrame frame = (StackFrame)getStackFrame(); - ICDIType detailedType = null; - if (frame != null) { - detailedType = frame.getFromTypeCache(nameType); - } - return detailedType; - } - - protected void addToTypeCache(String nameType, ICDIType typeDefinition) throws CDIException { - StackFrame frame = (StackFrame)getStackFrame(); - if (frame != null) { - frame.addToTypeCache(nameType, typeDefinition); - } - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIVariableDescriptor#getName() - */ - @Override - public String getName() { - return fName; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariable#getType() - */ - @Override - public ICDIType getType() throws CDIException { - if (fType == null) { - String nametype = getTypeName(); - Target target = (Target)getTarget(); - Session session = (Session) target.getSession(); - SourceManager sourceMgr = session.getSourceManager(); - try { - fType = sourceMgr.getType(target, nametype); - } catch (CDIException e) { - // We are here because the parser did not recognize the type, it may be something - // like "builtin_x86_vector" or even a class or a typedef - // typedef struct foobar Foobar_t - // for this case we need to call "Ptype" for more details. - - // For speed we save the type definitions in the stackframe, try it first. - fType = getFromTypeCache(nametype); - if (fType == null) { - // Try with ptype. - try { - String ptype = sourceMgr.getDetailTypeName(target, nametype); - fType = sourceMgr.getType(target, ptype); - } catch (CDIException ex) { - // Some version of gdb does not work on the name of the class - // ex: class data foo --> ptype data --> fails - // ex: class data foo --> ptype foo --> succeed - StackFrame frame = (StackFrame)getStackFrame(); - if (frame == null) { - Thread thread = (Thread)getThread(); - if (thread != null) { - frame = thread.getCurrentStackFrame(); - } else { - frame = ((Thread)target.getCurrentThread()).getCurrentStackFrame(); - } - } - try { - String ptype = sourceMgr.getDetailTypeNameFromVariable(frame, getQualifiedName()); - fType = sourceMgr.getType(target, ptype); - } catch (CDIException e2) { - // give up. - } - } - } - } - if (fType == null) { - fType = new IncompleteType(target, nametype); - } - // cache the result - addToTypeCache(nametype, fType); - } - return fType; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor#sizeof() - */ - @Override - public int sizeof() throws CDIException { - if (sizeof == null) { - Target target = (Target) getTarget(); - Thread currentThread = (Thread)target.getCurrentThread(); - StackFrame currentFrame = currentThread.getCurrentStackFrame(); - StackFrame frame = (StackFrame)getStackFrame(); - Thread thread = (Thread)getThread(); - synchronized(target.getLock()) { - try { - if (frame != null) { - target.setCurrentThread(frame.getThread(), false); - ((Thread)frame.getThread()).setCurrentStackFrame(frame, false); - } else if (thread != null) { - target.setCurrentThread(thread, false); - } - MISession mi = target.getMISession(); - CommandFactory factory = mi.getCommandFactory(); - String exp = "sizeof(" + getTypeName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ - MIDataEvaluateExpression evaluate = factory.createMIDataEvaluateExpression(exp); - mi.postCommand(evaluate); - MIDataEvaluateExpressionInfo info = evaluate.getMIDataEvaluateExpressionInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.model.VariableDescriptor.Target_not_responding")); //$NON-NLS-1$ - } - sizeof = info.getExpression(); - } catch (MIException e) { - throw new MI2CDIException(e); - } finally { - if (frame != null) { - target.setCurrentThread(currentThread, false); - currentThread.setCurrentStackFrame(currentFrame, false); - } else if (thread != null) { - target.setCurrentThread(currentThread, false); - } - } - } - } - - if (sizeof != null) { - try { - return Integer.parseInt(sizeof); - } catch (NumberFormatException e) { - throw new CDIException(e.getMessage()); - } - } - return 0; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor#getStackFrame() - */ - public ICDIStackFrame getStackFrame() throws CDIException { - return fStackFrame; - } - - public ICDIThread getThread() throws CDIException { - return fThread; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor#getTypeName() - */ - @Override - public String getTypeName() throws CDIException { - if (fTypename == null) { - Target target = (Target)getTarget(); - StackFrame frame = (StackFrame)getStackFrame(); - if (frame == null) { - Thread thread = (Thread)getThread(); - if (thread != null) { - frame = thread.getCurrentStackFrame(); - } else { - frame = ((Thread)target.getCurrentThread()).getCurrentStackFrame(); - } - } - Session session = (Session) target.getSession(); - SourceManager sourceMgr = session.getSourceManager(); - if (frame != null) { - fTypename = sourceMgr.getTypeNameFromVariable(frame, getQualifiedName()); - } else { - fTypename = sourceMgr.getTypeName(target, getQualifiedName()); - } - } - return fTypename; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor#getQualifiedName() - */ - @Override - public String getQualifiedName() throws CDIException { - if (qualifiedName == null) { - qualifiedName = encodeVariable(); - } - return qualifiedName; - } - - public static boolean equalsCasting(VariableDescriptor var1, VariableDescriptor var2) { - String[] castings1 = var1.getCastingTypes(); - String[] castings2 = var2.getCastingTypes(); - if (castings1 == null && castings2 == null) { - return true; - } else if (castings1 != null && castings2 != null && castings1.length == castings2.length) { - for (int i = 0; i < castings1.length; ++i) { - if (!castings1[i].equals(castings2[i])) { - return false; - } - } - return true; - } - return false; - } - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor#equals(ICDIVariableDescriptor) - */ - @Override - public boolean equals(ICDIVariableDescriptor varDesc) { - if (varDesc instanceof VariableDescriptor) { - VariableDescriptor desc = (VariableDescriptor) varDesc; - if (desc.getFullName().equals(getFullName()) - && desc.getName().equals(getName()) // see bug #113364 - && desc.getCastingArrayStart() == getCastingArrayStart() - && desc.getCastingArrayEnd() == getCastingArrayEnd() - && equalsCasting(desc, this)) { - - // Check the threads - ICDIThread varThread = null; - ICDIThread ourThread = null; - try { - varThread = desc.getThread(); - ourThread = getThread(); - } catch (CDIException e) { - // ignore - } - if ((ourThread == null && varThread == null) || - (varThread != null && ourThread != null && varThread.equals(ourThread))) { - // check the stackFrames - ICDIStackFrame varFrame = null; - ICDIStackFrame ourFrame = null; - try { - varFrame = desc.getStackFrame(); - ourFrame = getStackFrame(); - } catch (CDIException e) { - // ignore - } - if (ourFrame == null && varFrame == null) { - return true; - } else if (varFrame != null && ourFrame != null && varFrame.equals(ourFrame)) { - if (desc.getStackDepth() == getStackDepth()) { - if (desc.getPosition() == getPosition()) { - return true; - } - } - } - } - return false; - } - } - return super.equals(varDesc); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor#getVariableDescriptorAsArray(org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor, int, int) - */ - @Override - public ICDIVariableDescriptor getVariableDescriptorAsArray(int start, int length) throws CDIException { - Session session = (Session)getTarget().getSession(); - VariableManager mgr = session.getVariableManager(); - return mgr.getVariableDescriptorAsArray(this, start, length); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor#getVariableDescriptorAsType(org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor, java.lang.String) - */ - @Override - public ICDIVariableDescriptor getVariableDescriptorAsType(String type) throws CDIException { - Session session = (Session)getTarget().getSession(); - VariableManager mgr = session.getVariableManager(); - return mgr.getVariableDescriptorAsType(this, type); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Watchpoint.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Watchpoint.java deleted file mode 100644 index 8bed0197669..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Watchpoint.java +++ /dev/null @@ -1,128 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi.model; - -import java.math.BigInteger; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.ICDICondition; -import org.eclipse.cdt.debug.core.cdi.model.ICDIWatchpoint; -import org.eclipse.cdt.debug.core.cdi.model.ICDIWatchpoint2; -import org.eclipse.cdt.debug.mi.core.output.MIBreakpoint; - -/** - */ -public class Watchpoint extends Breakpoint implements ICDIWatchpoint2 { - - int watchType; - String expression; - String memorySpace; - BigInteger range; - String derivedExpression; - - public Watchpoint(Target target, String expression, int type, - int watchType, ICDICondition condition, boolean enabled) { - this(target, expression, "", BigInteger.ZERO, type, watchType, condition, enabled); //$NON-NLS-1$ - } - - public Watchpoint(Target target, String expression, String memorySpace, - BigInteger range, int type, int watchType, ICDICondition cond, - boolean enabled) { - super(target, type, cond, enabled); - this.watchType = watchType; - this.expression = expression; - this.memorySpace = memorySpace; - this.range = range; - - // If the range and/or memory space are specified, cast the expression, e.g., - // (@data char[4])(*0x402000) - derivedExpression = ""; //$NON-NLS-1$ - boolean doSpecifyMemorySpace = memorySpace.length() > 0; - boolean doSpecifyRange = range.compareTo(BigInteger.ZERO) > 0; - boolean doSpecify = doSpecifyMemorySpace || doSpecifyRange; - if ( doSpecify ) { - derivedExpression += "("; //$NON-NLS-1$ - if ( doSpecifyMemorySpace ) { - derivedExpression += "@" + memorySpace; //$NON-NLS-1$ - if ( doSpecifyRange ) { - derivedExpression += " "; //$NON-NLS-1$ - } - } - if ( doSpecifyRange ) { - derivedExpression += "char[" + range.toString() + "]"; //$NON-NLS-1$ //$NON-NLS-2$ - } - derivedExpression += ")("; //$NON-NLS-1$ - } - - try { - // Check if this an address watchpoint, and add a '*' - Integer.decode(expression); - derivedExpression += '*'; - } catch (NumberFormatException e) { - } - derivedExpression += expression; - if ( doSpecify ) { - derivedExpression += ")"; //$NON-NLS-1$ - } - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIWatchpoint#getWatchExpression() - */ - @Override - public String getWatchExpression() throws CDIException { - if (expression == null) { - MIBreakpoint[] miPoints = getMIBreakpoints(); - if (miPoints != null && miPoints.length > 0) { - return miPoints[0].getWhat(); - } - } - return expression; - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIWatchpoint#isReadType() - */ - @Override - public boolean isReadType() { - return ((watchType & ICDIWatchpoint.READ) == ICDIWatchpoint.READ); -// MIBreakpoint miPoint = getMIBreakpoint(); -// if (miPoint != null) -// return getMIBreakpoint().isReadWatchpoint() || getMIBreakpoint().isAccessWatchpoint(); -// return ((watchType & ICDIWatchpoint.READ) == ICDIWatchpoint.READ); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIWatchpoint#isWriteType() - */ - @Override - public boolean isWriteType() { - return ((watchType & ICDIWatchpoint.WRITE) == ICDIWatchpoint.WRITE); -// MIBreakpoint miPoint = getMIBreakpoint(); -// if (miPoint != null) -// return getMIBreakpoint().isAccessWatchpoint() || getMIBreakpoint().isWriteWatchpoint(); -// return ((watchType & ICDIWatchpoint.WRITE) == ICDIWatchpoint.WRITE); - } - - @Override - public String getMemorySpace() throws CDIException { - return memorySpace; - } - - @Override - public BigInteger getRange() throws CDIException { - return range; - } - - public String getDerivedExpression() { - return derivedExpression; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/AggregateType.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/AggregateType.java deleted file mode 100644 index c41702dba90..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/AggregateType.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIAggregateType; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; - -/** - */ -public abstract class AggregateType extends Type implements ICDIAggregateType { - - public AggregateType(Target target, String typename) { - super(target, typename); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/AggregateValue.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/AggregateValue.java deleted file mode 100644 index 38ef72cb3e1..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/AggregateValue.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIAggregateValue; -import org.eclipse.cdt.debug.mi.core.cdi.model.Value; -import org.eclipse.cdt.debug.mi.core.cdi.model.Variable; - -/** - */ -public abstract class AggregateValue extends Value implements ICDIAggregateValue { - - public AggregateValue(Variable v) { - super(v); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/ArrayType.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/ArrayType.java deleted file mode 100644 index 75dd2e4db2f..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/ArrayType.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIArrayType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; - -/** - */ -public class ArrayType extends DerivedType implements ICDIArrayType { - - int dimension; - - /** - * @param typename - */ - public ArrayType(Target target, String typename,int dim) { - super(target, typename); - dimension = dim; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIArrayType#getDimension() - */ - @Override - public int getDimension() { - if (derivedType == null) { - getComponentType(); - } - return dimension; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIArrayType#getComponentType() - */ - @Override - public ICDIType getComponentType() { - if (derivedType == null) { - String orig = getTypeName(); - String name = orig; - int lbracket = orig.lastIndexOf('['); - int rbracket = orig.lastIndexOf(']'); - if (lbracket != -1 && rbracket != -1 && (rbracket > lbracket)) { - try { - String dim = name.substring(lbracket + 1, rbracket).trim(); - dimension = Integer.parseInt(dim); - } catch (NumberFormatException e) { - } - name = orig.substring(0, lbracket).trim(); - } - setComponentType(name); - } - return derivedType; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/ArrayValue.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/ArrayValue.java deleted file mode 100644 index 8faa4875044..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/ArrayValue.java +++ /dev/null @@ -1,141 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import java.math.BigInteger; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; -import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable; -import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIArrayValue; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerValue; -import org.eclipse.cdt.debug.mi.core.cdi.Session; -import org.eclipse.cdt.debug.mi.core.cdi.VariableManager; -import org.eclipse.cdt.debug.mi.core.cdi.model.Register; -import org.eclipse.cdt.debug.mi.core.cdi.model.Variable; -import org.eclipse.cdt.debug.mi.core.cdi.model.VariableDescriptor; - -/** - * Enter type comment. - * - * @since Jun 3, 2003 - */ -public class ArrayValue extends DerivedValue implements ICDIArrayValue, ICDIPointerValue { - - private String hexAddress; - - /** - * Construct the array value object given a variable - * - * @param v - * @since 7.1 - */ - public ArrayValue(Variable v) { - super(v); - } - - /** - * Construct the array value object given a variable and the - * hexadecimal address of the variable. - * - * @param v - * @param hexAddress - */ - public ArrayValue(Variable v, String address) { - this(v); - hexAddress = address; - } - - /** - * Compute array address as string. - */ - private String getAddressString() throws CDIException { - if (hexAddress != null) - return hexAddress; - - String address = getVariable().getHexAddress(); - if (address == null) { - address = ""; //$NON-NLS-1$ - } - if (address.startsWith("0x") || address.startsWith("0X")) { //$NON-NLS-1$ //$NON-NLS-2$ - hexAddress = address.substring(2); - } else { - hexAddress = address; - } - return hexAddress; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIValue#getVariables() - */ - @Override - public ICDIVariable[] getVariables() throws CDIException { - - /* GDB is appallingly slow on array fetches. As as slow as 128 entries - * per second on NT gdbs with slow processors. We need to set a timeout - * that's appropriately scaled by number of children to give the slave - * GDB time to respond. In the end perhaps we want a UI for this. As it - * is, let's just make up a number that's 5 seconds for us plus one - * second for every 128 entries. */ - int timeout = getVariable().getMIVar().getNumChild() * 8 + 5000; - - return getVariable().getChildren(timeout); - } - - /** - * - * an Array of range[index, index + length - 1] - */ - @Override - public ICDIVariable[] getVariables(int index, int length) throws CDIException { - //int children = getChildrenNumber(); - //if (index >= children || index + length >= children) { - // throw new CDIException("Index out of bound"); - //} - - // Overload for registers. - Variable variable = getVariable(); - if (variable instanceof Register) { - ICDIVariable[] vars = getVariables(); - - if (index < vars.length && (index + length) <= vars.length) { - ICDIVariable[] newVars = new ICDIVariable[length]; - System.arraycopy(vars, index, newVars, 0, length); - return newVars; - } - return new ICDIVariable[0]; - } - //String subarray = "*(" + variable.getName() + "+" + index + ")@" + length; - ICDITarget target = getTarget(); - Session session = (Session) (target.getSession()); - VariableManager mgr = session.getVariableManager(); - ICDIVariableDescriptor vo = mgr.getVariableDescriptorAsArray(variable, index, length); - return mgr.createVariable((VariableDescriptor)vo).getValue().getVariables(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerValue#pointerValue() - */ - @Override - public BigInteger pointerValue() throws CDIException { - String address = getAddressString(); - if (address.length() > 0 ){ - try { - return new BigInteger(address, 16); - } catch (NumberFormatException e) { - return null; - } - } - return null; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/BoolType.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/BoolType.java deleted file mode 100644 index 79c67164eef..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/BoolType.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIBoolType; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; - -/** - */ -public class BoolType extends IntegralType implements ICDIBoolType { - - /** - * @param typename - */ - public BoolType(Target target, String typename) { - this(target, typename, false); - } - - public BoolType(Target target, String typename, boolean usigned) { - super(target, typename, usigned); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/BoolValue.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/BoolValue.java deleted file mode 100644 index ca9da8c7a61..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/BoolValue.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - * Warren Paul (Nokia) - 150860 - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import java.math.BigInteger; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIBoolValue; -import org.eclipse.cdt.debug.mi.core.cdi.model.Variable; - -/** - */ -public class BoolValue extends IntegralValue implements ICDIBoolValue { - - /** - * @param v - */ - public BoolValue(Variable v) { - super(v); - } - - @Override - public BigInteger bigIntegerValue() throws CDIException { - String valueString = getValueString(); - if (valueString.equalsIgnoreCase("false"))//$NON-NLS-1$ - return BigInteger.ZERO; - else - if (valueString.equalsIgnoreCase("true"))//$NON-NLS-1$ - return BigInteger.ONE; - - return super.bigIntegerValue(); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/CharType.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/CharType.java deleted file mode 100644 index 8055bbfacde..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/CharType.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.model.type.ICDICharType; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; - -/** - */ -public class CharType extends IntegralType implements ICDICharType { - - /** - * @param typename - */ - public CharType(Target target, String typename) { - this(target, typename, false); - } - - public CharType(Target target, String typename, boolean usigned) { - super(target, typename, usigned); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/CharValue.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/CharValue.java deleted file mode 100644 index 39f92177c0b..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/CharValue.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDICharValue; -import org.eclipse.cdt.debug.mi.core.cdi.model.Variable; - -/** - */ -public class CharValue extends IntegralValue implements ICDICharValue { - - /** - * @param v - */ - public CharValue(Variable v) { - super(v); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDICharValue#getValue() - */ - public char getValue() throws CDIException { - return (char)intValue(); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/DerivedType.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/DerivedType.java deleted file mode 100644 index a14bdff7690..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/DerivedType.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIDerivedType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType; -import org.eclipse.cdt.debug.mi.core.cdi.Session; -import org.eclipse.cdt.debug.mi.core.cdi.SourceManager; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; - -/** - */ -public abstract class DerivedType extends Type implements ICDIDerivedType { - - ICDIType derivedType; - - public DerivedType(Target target, String typename) { - super(target, typename); - } - - public void setComponentType(ICDIType dtype) { - derivedType = dtype; - } - - public void setComponentType(String name) { - Target target = (Target)getTarget(); - Session session = (Session)target.getSession(); - SourceManager sourceMgr = session.getSourceManager(); - try { - derivedType = sourceMgr.getType((Target)getTarget(), name); - } catch (CDIException e) { - // Try after ptype. - try { - String ptype = sourceMgr.getDetailTypeName((Target)getTarget(), name); - derivedType = sourceMgr.getType((Target)getTarget(), ptype); - } catch (CDIException ex) { - } - } - if (derivedType == null) { - derivedType = new IncompleteType((Target)getTarget(), name); - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/DerivedValue.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/DerivedValue.java deleted file mode 100644 index cc5b4f47ca5..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/DerivedValue.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIDerivedValue; -import org.eclipse.cdt.debug.mi.core.cdi.model.Value; -import org.eclipse.cdt.debug.mi.core.cdi.model.Variable; - -/** - */ -public abstract class DerivedValue extends Value implements ICDIDerivedValue { - - public DerivedValue(Variable v) { - super(v); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/DoubleType.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/DoubleType.java deleted file mode 100644 index 168d54cc28b..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/DoubleType.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIDoubleType; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; - -/** - */ -public class DoubleType extends FloatingPointType implements ICDIDoubleType { - - /** - * @param typename - */ - public DoubleType(Target target, String typename) { - this(target, typename, false, false, false); - } - - public DoubleType(Target target, String typename, boolean isComplex, boolean isImg, boolean isLong) { - super(target, typename, isComplex, isImg, isLong); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/DoubleValue.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/DoubleValue.java deleted file mode 100644 index 4d33e612efe..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/DoubleValue.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIDoubleValue; -import org.eclipse.cdt.debug.mi.core.cdi.model.Variable; - -/** - */ -public class DoubleValue extends FloatingPointValue implements ICDIDoubleValue { - - /** - * @param Variable - */ - public DoubleValue(Variable v) { - super(v); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/EnumType.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/EnumType.java deleted file mode 100644 index 8c0a1d503a7..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/EnumType.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIEnumType; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; - -/** - */ -public class EnumType extends IntegralType implements ICDIEnumType { - - /** - * @param typename - */ - public EnumType(Target target, String typename) { - this(target, typename, false); - } - - public EnumType(Target target, String typename, boolean usigned) { - super(target, typename, usigned); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/EnumValue.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/EnumValue.java deleted file mode 100644 index b5979204a21..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/EnumValue.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIEnumValue; -import org.eclipse.cdt.debug.mi.core.cdi.model.Variable; - -/** - */ -public class EnumValue extends IntegralValue implements ICDIEnumValue { - - /** - * @param v - */ - public EnumValue(Variable v) { - super(v); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/FloatType.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/FloatType.java deleted file mode 100644 index 86aebee17cf..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/FloatType.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatType; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; - -/** - */ -public class FloatType extends FloatingPointType implements ICDIFloatType { - - /** - * @param typename - */ - public FloatType(Target target, String typename) { - this(target, typename, false, false); - } - - public FloatType(Target target, String typename, boolean isComplex, boolean isImg) { - super(target, typename, isComplex, isImg, false); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/FloatValue.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/FloatValue.java deleted file mode 100644 index e9d59c30c0f..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/FloatValue.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatValue; -import org.eclipse.cdt.debug.mi.core.cdi.model.Variable; - -/** - */ -public class FloatValue extends FloatingPointValue implements ICDIFloatValue { - - /** - * @param Variable - */ - public FloatValue(Variable v) { - super(v); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/FloatingPointType.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/FloatingPointType.java deleted file mode 100644 index 57a47d99239..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/FloatingPointType.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatingPointType; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; - -/** - */ -public abstract class FloatingPointType extends Type implements ICDIFloatingPointType { - - boolean complex; - boolean imaginary; - boolean islong; - - public FloatingPointType(Target target, String typename, boolean comp, boolean img, boolean l) { - super(target, typename); - complex = comp; - imaginary = img; - islong = l; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatingPointType#isComplex() - */ - @Override - public boolean isComplex() { - return complex; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatingPointType#isImaginary() - */ - @Override - public boolean isImaginary() { - return imaginary; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatingPointType#isLong() - */ - @Override - public boolean isLong() { - return islong; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/FloatingPointValue.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/FloatingPointValue.java deleted file mode 100644 index 6a77b46e058..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/FloatingPointValue.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatingPointValue; -import org.eclipse.cdt.debug.mi.core.cdi.model.Value; -import org.eclipse.cdt.debug.mi.core.cdi.model.Variable; - -/** - */ -public abstract class FloatingPointValue extends Value implements ICDIFloatingPointValue { - - /** - * @param v - */ - public FloatingPointValue(Variable v) { - super(v); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatingPointValue#doubleValue() - */ - @Override - public double doubleValue() throws CDIException { - double result = 0; - String valueString = getValueString(); - if (isNaN(valueString)) - result = Double.NaN; - else if (isNegativeInfinity(valueString)) - result = Double.NEGATIVE_INFINITY; - else if (isPositiveInfinity(valueString)) - result = Double.POSITIVE_INFINITY; - else { - try { - result = Double.parseDouble(valueString); - } catch (NumberFormatException e) { - } - } - return result; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatingPointValue#floatValue() - */ - @Override - public float floatValue() throws CDIException { - float result = 0; - String valueString = getValueString(); - if (isNaN(valueString)) - result = Float.NaN; - else if (isNegativeInfinity(valueString)) - result = Float.NEGATIVE_INFINITY; - else if (isPositiveInfinity(valueString)) - result = Float.POSITIVE_INFINITY; - else { - try { - result = Float.parseFloat(valueString); - } catch (NumberFormatException e) { - } - } - return result; - } - - private boolean isPositiveInfinity(String valueString) { - return (valueString != null) ? valueString.indexOf("inf") != -1 : false; //$NON-NLS-1$ - } - - private boolean isNegativeInfinity(String valueString) { - return (valueString != null) ? valueString.indexOf("-inf") != -1 : false; //$NON-NLS-1$ - } - - private boolean isNaN(String valueString) { - return (valueString != null) ? valueString.indexOf("nan") != -1 : false; //$NON-NLS-1$ - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/FunctionType.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/FunctionType.java deleted file mode 100644 index bf1f3cbf101..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/FunctionType.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFunctionType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; - -/** - */ -public class FunctionType extends DerivedType implements ICDIFunctionType { - - String params = ""; //$NON-NLS-1$ - - public FunctionType(Target target, String typename) { - super(target, typename); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIDerivedType#getComponentType() - */ - @Override - public ICDIType getComponentType() { - if (derivedType != null) { - String orig = getTypeName(); - String name = orig; - int lparen = orig.lastIndexOf('('); - int rparen = orig.lastIndexOf(')'); - if (lparen != -1 && rparen != -1 && (rparen > lparen)) { - params = name.substring(lparen + 1, rparen).trim(); - name = orig.substring(0, lparen).trim(); - } - setComponentType(name); - } - return derivedType; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/FunctionValue.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/FunctionValue.java deleted file mode 100644 index fef67bc94bb..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/FunctionValue.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFunctionValue; -import org.eclipse.cdt.debug.mi.core.cdi.model.Variable; - -/** - * Enter type comment. - * - * @since Jun 3, 2003 - */ -public class FunctionValue extends DerivedValue implements ICDIFunctionValue { - - public FunctionValue(Variable v) { - super(v); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/IncompleteType.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/IncompleteType.java deleted file mode 100644 index d87ae1ecf9f..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/IncompleteType.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; - -/** - */ -public class IncompleteType extends Type { - - /** - * @param name - */ - public IncompleteType(Target target, String name) { - super(target, name); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/IntType.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/IntType.java deleted file mode 100644 index e7b5ccd0a42..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/IntType.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIIntType; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; - -/** - */ -public class IntType extends IntegralType implements ICDIIntType { - - /** - * @param typename - */ - public IntType(Target target, String typename) { - this(target, typename, false); - } - - public IntType(Target target, String typename, boolean isUnsigned) { - super(target, typename, isUnsigned); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/IntValue.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/IntValue.java deleted file mode 100644 index 536e771952c..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/IntValue.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIIntValue; -import org.eclipse.cdt.debug.mi.core.cdi.model.Variable; - -/** - */ -public class IntValue extends IntegralValue implements ICDIIntValue { - - /** - * @param v - */ - public IntValue(Variable v) { - super(v); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/IntegralType.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/IntegralType.java deleted file mode 100644 index d494f67fdbf..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/IntegralType.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIIntegralType; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; - -/** - */ -public abstract class IntegralType extends Type implements ICDIIntegralType { - - boolean unSigned; - - public IntegralType(Target target, String typename, boolean isUnsigned) { - super(target, typename); - unSigned = isUnsigned; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIIntegralType#isUnsigned() - */ - @Override - public boolean isUnsigned() { - return unSigned; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/IntegralValue.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/IntegralValue.java deleted file mode 100644 index 2ff9db73da0..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/IntegralValue.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import java.math.BigInteger; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIIntegralValue; -import org.eclipse.cdt.debug.mi.core.MIFormat; -import org.eclipse.cdt.debug.mi.core.cdi.model.Value; -import org.eclipse.cdt.debug.mi.core.cdi.model.Variable; - -/** - */ -public abstract class IntegralValue extends Value implements ICDIIntegralValue { - - /** - * @param v - */ - public IntegralValue(Variable v) { - super(v); - } - - - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIIntegralValue#biIntegerValue() - */ - @Override - public BigInteger bigIntegerValue() throws CDIException { - return bigIntegerValue(getValueString()); - } - - public static BigInteger bigIntegerValue(String valueString) { - // Coming from a reference - if (valueString.startsWith("@")) { //$NON-NLS-1$ - valueString = valueString.substring(1); - int colon = valueString.indexOf(':'); - if (colon != -1) { - valueString = valueString.substring(colon + 1).trim(); - } - } - int space = valueString.indexOf(' '); - if (space != -1) { - valueString = valueString.substring(0, space).trim(); - } - - try { - return MIFormat.getBigInteger(valueString); - } catch (NumberFormatException e) { - // - } - return BigInteger.ZERO; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIIntegralValue#longValue() - */ - @Override - public long longValue() throws CDIException { - return bigIntegerValue().longValue(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIIntegralValue#longValue() - */ - @Override - public int intValue() throws CDIException { - return bigIntegerValue().intValue(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIIntegralValue#shortValue() - */ - @Override - public short shortValue() throws CDIException { - return bigIntegerValue().shortValue(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIIntegralValue#byteValue() - */ - @Override - public int byteValue() throws CDIException { - return bigIntegerValue().byteValue(); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/LongLongType.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/LongLongType.java deleted file mode 100644 index 05244fb8484..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/LongLongType.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.model.type.ICDILongLongType; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; - -/** - */ -public class LongLongType extends IntegralType implements ICDILongLongType { - - /** - * @param typename - */ - public LongLongType(Target target, String typename) { - this(target, typename, false); - } - - public LongLongType(Target target, String typename, boolean usigned) { - super(target, typename, usigned); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/LongLongValue.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/LongLongValue.java deleted file mode 100644 index 29905478cee..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/LongLongValue.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.model.type.ICDILongLongValue; -import org.eclipse.cdt.debug.mi.core.cdi.model.Variable; - -/** - */ -public class LongLongValue extends IntegralValue implements ICDILongLongValue { - - /** - * @param v - */ - public LongLongValue(Variable v) { - super(v); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/LongType.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/LongType.java deleted file mode 100644 index b6f3e07f0e0..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/LongType.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.model.type.ICDILongType; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; - -/** - */ -public class LongType extends IntegralType implements ICDILongType { - - /** - * @param typename - */ - public LongType(Target target, String typename) { - this(target, typename, false); - } - - public LongType(Target target, String typename, boolean usigned) { - super(target, typename, usigned); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/LongValue.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/LongValue.java deleted file mode 100644 index 489436fc96e..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/LongValue.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.model.type.ICDILongValue; -import org.eclipse.cdt.debug.mi.core.cdi.model.Variable; - -/** - */ -public class LongValue extends IntegralValue implements ICDILongValue { - - /** - * @param v - */ - public LongValue(Variable v) { - super(v); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/PointerType.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/PointerType.java deleted file mode 100644 index fa1fb747548..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/PointerType.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; - -/** - */ -public class PointerType extends DerivedType implements ICDIPointerType { - - public PointerType(Target target, String typename) { - super(target, typename); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIDerivedType#getComponentType() - */ - @Override - public ICDIType getComponentType() { - if (derivedType == null) { - String orig = getTypeName(); - String name = orig; - int star = orig.lastIndexOf('*'); - // remove last '*' - if (star != -1) { - name = orig.substring(0, star).trim(); - } - setComponentType(name); - } - return derivedType; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/PointerValue.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/PointerValue.java deleted file mode 100644 index 007edf5fae3..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/PointerValue.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import java.math.BigInteger; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerValue; -import org.eclipse.cdt.debug.mi.core.cdi.model.Variable; - -/** - * Enter type comment. - * - * @since Jun 3, 2003 - */ -public class PointerValue extends DerivedValue implements ICDIPointerValue { - - public PointerValue(Variable v) { - super(v); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerValue#pointerValue() - */ - @Override - public BigInteger pointerValue() throws CDIException { - return IntegralValue.bigIntegerValue(getValueString()); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/ReferenceType.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/ReferenceType.java deleted file mode 100644 index c0823d5c81b..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/ReferenceType.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIReferenceType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; - -/** - */ -public class ReferenceType extends DerivedType implements ICDIReferenceType { - - /** - * @param name - */ - public ReferenceType(Target target, String name) { - super(target, name); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIDerivedType#getComponentType() - */ - @Override - public ICDIType getComponentType() { - if (derivedType == null) { - String orig = getTypeName(); - String name = orig; - int amp = orig.lastIndexOf('&'); - // remove last '&' - if (amp != -1) { - name = orig.substring(0, amp).trim(); - } - setComponentType(name); - } - return derivedType; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/ReferenceValue.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/ReferenceValue.java deleted file mode 100644 index 65cea4d6e20..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/ReferenceValue.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.ICDIValue; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIBoolType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDICharType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIDoubleType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIEnumType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFunctionType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIIntType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDILongLongType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDILongType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIReferenceType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIReferenceValue; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIShortType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIStructType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIWCharType; -import org.eclipse.cdt.debug.mi.core.cdi.model.Value; -import org.eclipse.cdt.debug.mi.core.cdi.model.Variable; - -/** - * Enter type comment. - * - * @since Jun 3, 2003 - */ -public class ReferenceValue extends DerivedValue implements ICDIReferenceValue { - - /** - * Construct a value object for the referred variable - * @param v - * @since 6.0 - */ - public ReferenceValue(Variable v) { - super(v); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIReferenceValue#referenceValue() - */ - @Override - public ICDIValue referenceValue() throws CDIException { - Value value = null; - ICDIReferenceType rt = (ICDIReferenceType)getType(); - ICDIType t = rt.getComponentType(); - if (t instanceof ICDIBoolType) { - value = new BoolValue(getVariable()); - } else if (t instanceof ICDICharType) { - value = new CharValue(getVariable()); - } else if (t instanceof ICDIWCharType) { - value = new WCharValue(getVariable()); - } else if (t instanceof ICDIShortType) { - value = new ShortValue(getVariable()); - } else if (t instanceof ICDIIntType) { - value = new IntValue(getVariable()); - } else if (t instanceof ICDILongType) { - value = new LongValue(getVariable()); - } else if (t instanceof ICDILongLongType) { - value = new LongLongValue(getVariable()); - } else if (t instanceof ICDIEnumType) { - value = new EnumValue(getVariable()); - } else if (t instanceof ICDIFloatType) { - value = new FloatValue(getVariable()); - } else if (t instanceof ICDIDoubleType) { - value = new DoubleValue(getVariable()); - } else if (t instanceof ICDIFunctionType) { - value = new FunctionValue(getVariable()); - } else if (t instanceof ICDIPointerType) { - value = new PointerValue(getVariable()); -// } else if (t instanceof ICDIReferenceType) { -// value = new ReferenceValue(getVariable()); -// -// Don't think you can have a reference to an array variable, making -// the following case pointless. Removing it since it would otherwise -// require us to be constructed with a hexAddress qualifier. -// } else if (t instanceof ICDIArrayType) { -// value = new ArrayValue(getVariable(), hexAddress); -// - } else if (t instanceof ICDIStructType) { - value = new StructValue(getVariable()); - } else { - value = new Value(getVariable()); - } - - value.setIsReference(true); - return value; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/ShortType.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/ShortType.java deleted file mode 100644 index 63a93f33012..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/ShortType.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIShortType; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; - -/** - */ -public class ShortType extends IntegralType implements ICDIShortType { - - /** - * @param typename - */ - public ShortType(Target target, String typename) { - this(target, typename, false); - } - - public ShortType(Target target, String typename, boolean usigned) { - super(target, typename, usigned); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/ShortValue.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/ShortValue.java deleted file mode 100644 index 71d0b43238f..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/ShortValue.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIShortValue; -import org.eclipse.cdt.debug.mi.core.cdi.model.Variable; - -/** - */ -public class ShortValue extends IntegralValue implements ICDIShortValue { - - /** - * @param v - */ - public ShortValue(Variable v) { - super(v); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/StructType.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/StructType.java deleted file mode 100644 index 534a2259c22..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/StructType.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIStructType; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; - -/** - */ -public class StructType extends AggregateType implements ICDIStructType { - - /** - * @param typename - */ - public StructType(Target target, String typename) { - super(target, typename); - } - - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIStructType#isClass() - */ - @Override - public boolean isClass() { - return getDetailTypeName().startsWith("class"); //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIStructType#isStruct() - */ - @Override - public boolean isStruct() { - return getDetailTypeName().startsWith("struct"); //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIStructType#isUnion() - */ - @Override - public boolean isUnion() { - return getDetailTypeName().startsWith("union"); //$NON-NLS-1$ - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/StructValue.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/StructValue.java deleted file mode 100644 index 204be0ce0e1..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/StructValue.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIStructValue; -import org.eclipse.cdt.debug.mi.core.cdi.model.Variable; - -/** - * Enter type comment. - * - * @since Jun 3, 2003 - */ -public class StructValue extends AggregateValue implements ICDIStructValue { - - public StructValue(Variable v) { - super(v); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/Type.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/Type.java deleted file mode 100644 index db86c9d42d8..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/Type.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType; -import org.eclipse.cdt.debug.mi.core.cdi.model.CObject; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; - -/** - */ -public abstract class Type extends CObject implements ICDIType { - - String typename; - String detailName; - - public Type(Target target, String name) { - super(target); - typename = name; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIType#getTypeName() - */ - @Override - public String getTypeName() { - return typename; - } - - public void setDetailTypeName(String name) { - detailName = name; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIType#getDetailTypeName() - */ - @Override - public String getDetailTypeName() { - if (detailName == null) { - return getTypeName(); - } - return detailName; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/VoidType.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/VoidType.java deleted file mode 100644 index 33cd028a435..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/VoidType.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIVoidType; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; - -/** - */ -public class VoidType extends Type implements ICDIVoidType { - - public VoidType(Target target) { - this(target, "void"); //$NON-NLS-1$ - } - public VoidType(Target target, String typename) { - super(target, typename); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/VoidValue.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/VoidValue.java deleted file mode 100644 index 1e251ddbc33..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/VoidValue.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import org.eclipse.cdt.debug.mi.core.cdi.model.Value; -import org.eclipse.cdt.debug.mi.core.cdi.model.Variable; - -/* - * VoidValue - */ -public class VoidValue extends Value { - - /** - * @param v - */ - public VoidValue(Variable v) { - super(v); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/WCharType.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/WCharType.java deleted file mode 100644 index 1bef04c7345..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/WCharType.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIWCharType; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; - -/** - */ -public class WCharType extends IntegralType implements ICDIWCharType { - - /** - * @param typename - */ - public WCharType(Target target, String typename) { - this(target, typename, false); - } - - public WCharType(Target target, String typename, boolean usigned) { - super(target, typename, usigned); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/WCharValue.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/WCharValue.java deleted file mode 100644 index 3c8bc724ccb..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/WCharValue.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.cdi.model.type; - -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIWCharValue; -import org.eclipse.cdt.debug.mi.core.cdi.model.Variable; - -/** - */ -public class WCharValue extends IntegralValue implements ICDIWCharValue { - - /** - * @param v - */ - public WCharValue(Variable v) { - super(v); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.cdi.model.ICDICharValue#getValue() - */ - public char getValue() throws CDIException { - // TODO Auto-generated method stub - return 0; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/design.txt b/debug/org.eclipse.cdt.debug.mi.core/design.txt deleted file mode 100644 index 782d0275725..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/design.txt +++ /dev/null @@ -1,110 +0,0 @@ -<html> -<head> -</head> -<body> -<pre> -Note this is an interim the document and subject to changes. - - -**** -This MI implementation is base on GDB/MI 5.2.1. - -* Command/Response channels -To create an MISession an InputStream and OutputStream are -needed(assuming it is the pipe connected to gdb). - - MISession misession = new MISession(InputStream, OutputStream); - -During initialisation of the session(MISession) two threads -are created TxThread, RxThread and associative list queues -TxQueue and RxQueue: -- The RxThread thread is block on readig the output of the pipe(gdb) for -any responses. -- The TxThread thread is block waiting for command. - -MI Commands are created via the CommandFactory and -are added to the TxQueue, the TxThread will then wake up -generate a token(ID) for the command and send it to the pipe(gdb), after -transmission the command is then move to the RxQueue waiting for the -result(MIResultRecord). - -Any responses will wake the RxThread, the thread will parse -the response constructing an MIOutput, then it searches the RxQueue -for any commands with the same token waking any thread waiting -for a synchronous response(MIResultRecord). Any out-of-band -responses(MIOOBRecord) are dispatch to MISession observers, clients interested -in notifications should register to the MISession. - -* MI Parsing -There is a generic MI parser (MIParser) constructing an syntax tree of the output. -For example, a ResultRecord response after a "-break-insert", the parser will -generate this tree: - 10-break-insert main - 10^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y", - addr="0x08048468",func="main",file="hello.c",line="4",times="0"} - - - MIOutput - - MIOOBRecord[0] - - MIResutRecord - - token = 10 - - ResultClass = "done" - - MIResult[1] - - MIResult[0] - - variable = "bkpt" - - value = MITuple - - MIResult[9] - - MiResult[0] - - variable = "number" - - MIConst = "1" - - MiResult[1] - - variable = "type" - - MIConst = "breakpoint" - - MiResult[2] - - variable = "disp" - - MIConst = "keep" - - MiResult[3] - - variable = "enabled" - - MIConst = "y" - - MiResult[4] - - variable = "addr" - - MIConst = "0x08048468" - - MiResult[5] - - variable = "func" - - MIConst = "main" - - MiResult[6] - - variable = "file" - - MIConst = "hello.c" - - MiResult[7] - - variable = "line" - - MIConst = "4" - - MiResult[8] - - variable = "times" - - MIConst = "0" - -MICommands will do there own parsing: - session = MISession(in, out); - MIBreakInsert cmd = new MIBreakInsert("main"); - session.postCommand(cmd); // sent to gdb. - MIBreakInsertInfo info = cmd.getBreakInsertInfo(); // Parsing of the Result Record. - -**** -MI Process - -For convienience, to java.lang.Process is provided. - - MISession.getSessionProcess(); - -This Process talks directly to gdb and is smart enough to wrap any command -in CLICommand etc .. - - MISession.getMIInferior() - -MIInferior implements Process for the Inferiror. - -***** -MI <==> CDI Adapters - - To do. -</pre> -</body> -</html> diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/CLIProcessor.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/CLIProcessor.java deleted file mode 100644 index dd739a708ac..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/CLIProcessor.java +++ /dev/null @@ -1,272 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2010 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core; - -import java.util.StringTokenizer; - -import org.eclipse.cdt.debug.mi.core.command.CLICommand; -import org.eclipse.cdt.debug.mi.core.command.MIInterpreterExecConsole; -import org.eclipse.cdt.debug.mi.core.event.MIBreakpointChangedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIDetachedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIEvent; -import org.eclipse.cdt.debug.mi.core.event.MIRunningEvent; -import org.eclipse.cdt.debug.mi.core.event.MISignalChangedEvent; - -/** - * Transmission command thread blocks on the command Queue - * and wake cmd are available and push them to gdb out channel. - */ -public class CLIProcessor { - - MISession session; - - public CLIProcessor(MISession s) { - session = s; - } - - /** - * An attempt to discover the command type and - * fire an event if necessary. - */ - void processStateChanges(CLICommand cmd) { - String operation = cmd.getOperation().trim(); - processStateChanges(cmd.getToken(), operation); - } - - void processStateChanges(MIInterpreterExecConsole exec) { - String[] operations = exec.getParameters(); - if (operations != null && operations.length > 0) { - processStateChanges(exec.getToken(), operations[0]); - } - } - - void processStateChanges(int token, String op) { - String operation = op; - // 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) { - // if it was a step instruction set state running - session.getMIInferior().setRunning(); - MIEvent event = new MIRunningEvent(session, token, type); - session.fireEvent(event); - } - } - - /** - * An attempt to discover the command type and - * fire an event if necessary. - */ - void processSettingChanges(CLICommand cmd) { - String operation = cmd.getOperation().trim(); - processSettingChanges(cmd.getToken(), operation); - } - - void processSettingChanges(MIInterpreterExecConsole exec) { - String[] operations = exec.getParameters(); - if (operations != null && operations.length > 0) { - processSettingChanges(exec.getToken(), operations[0]); - } - } - - void processSettingChanges(int token, String command) { - // Get the command name. - String operation = command; - 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. - // But we can parse the command line to hint the top layer - // on the breakpoint type. - // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=135250 - int hint = MIBreakpointChangedEvent.HINT_NONE; - if (isSettingBreakpoint(operation)) { - hint = getBreakpointHint(command); - } - session.fireEvent(new MIBreakpointChangedEvent(session, 0, hint)); - } else if (isSettingSignal(operation)) { - // We do no know which signal let the upper layer find it. - session.fireEvent(new MISignalChangedEvent(session, "")); //$NON-NLS-1$ - } else if (isDetach(operation)) { - // if it was a "detach" command change the state. - session.getMIInferior().setDisconnected(); - MIEvent event = new MIDetachedEvent(session, token); - session.fireEvent(event); - } - } - - static int getSteppingOperationKind(String operation) { - 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; - } - - 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$ - (operation.startsWith("catch"))) { //$NON-NLS-1$ - isbreak = true; - } - return isbreak; - } - - 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; - } - - 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; - } - - 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; - } - - int getBreakpointHint(String command) { - StringTokenizer st = new StringTokenizer(command); - // get operation - String op = st.nextToken(); - if (op.startsWith("rb") && "rbreak".indexOf(op) != -1) { //$NON-NLS-1$ //$NON-NLS-2$ - // only function breakpoints can be set using rbreak - return MIBreakpointChangedEvent.HINT_NEW_FUNCTION_BREAKPOINT; - } - if (op.equals("catch")) { //$NON-NLS-1$ - return MIBreakpointChangedEvent.HINT_NEW_EVENTBREAKPOINT; - } - if ( !st.hasMoreTokens() ) { - // "break" with no arguments - return MIBreakpointChangedEvent.HINT_NEW_LINE_BREAKPOINT; - } - String token = st.nextToken(); - if ("if".equals(token) || "ignore".equals(token) || token.charAt(0) == '+' || token.charAt(0) == '-') { //$NON-NLS-1$ //$NON-NLS-2$ - // conditional "break" with no location argument - // or "break +/- offset" - return MIBreakpointChangedEvent.HINT_NEW_LINE_BREAKPOINT; - } - if (token.charAt(0) == '*') { - return MIBreakpointChangedEvent.HINT_NEW_ADDRESS_BREAKPOINT; - } - int index = token.lastIndexOf( ':' ); - String lineNumber = token; - if (index != -1 && index+1 < token.length()) { - lineNumber = token.substring(index+1, token.length()); - } - try { - Integer.parseInt( lineNumber ); - } - catch(NumberFormatException e) { - return MIBreakpointChangedEvent.HINT_NEW_FUNCTION_BREAKPOINT; - } - return MIBreakpointChangedEvent.HINT_NEW_LINE_BREAKPOINT; - } - - 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 - */ - boolean isDetach(String operation) { - return (operation.startsWith("det") && "detach".indexOf(operation) != -1); //$NON-NLS-1$ //$NON-NLS-2$ - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/CommandQueue.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/CommandQueue.java deleted file mode 100644 index df95b3fc45a..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/CommandQueue.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core; - -import org.eclipse.cdt.debug.mi.core.command.Command; - -/** - * Simple thread-safe Queue implemetation. - */ -public class CommandQueue extends Queue { - - - public CommandQueue() { - super(); - } - - public Command removeCommand(int id) { - //print("in removeCommand(" + id + ") - entering"); - synchronized (list) { - int size = list.size(); - for (int i = 0; i < size; i++) { - Command cmd = (Command)list.get(i); - int token = cmd.getToken(); - if (token == id) { - list.remove(cmd); - return cmd; - } - } - } - return null; - } - - public Command removeCommand() throws InterruptedException { - //print("in removeCommand() - entering"); - return (Command)removeItem(); - } - - public void addCommand(Command cmd) { - //print("in addCommand() - entering"); - addItem(cmd); - } - - public Command[] clearCommands() { - Object[] objs = clearItems(); - Command[] cmds = new Command[objs.length]; - System.arraycopy(objs, 0, cmds, 0, objs.length); - return cmds; - } - -// private static void print(String msg) { -// String name = Thread.currentThread().getName(); -// System.out.println(name + ": " + msg); -// } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/CoreProcess.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/CoreProcess.java deleted file mode 100644 index 8b2615b134e..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/CoreProcess.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -/* - * CoreProcess - */ -public class CoreProcess extends Process { - - /* (non-Javadoc) - * @see java.lang.Process#exitValue() - */ - @Override - public int exitValue() { - return 0; - } - - /* (non-Javadoc) - * @see java.lang.Process#waitFor() - */ - @Override - public int waitFor() throws InterruptedException { - return 0; - } - - /* (non-Javadoc) - * @see java.lang.Process#destroy() - */ - @Override - public void destroy() { - } - - /* (non-Javadoc) - * @see java.lang.Process#getErrorStream() - */ - @Override - public InputStream getErrorStream() { - return new InputStream() { - @Override - public int read() throws IOException { - return -1; - } - }; - } - - /* (non-Javadoc) - * @see java.lang.Process#getInputStream() - */ - @Override - public InputStream getInputStream() { - return new InputStream() { - @Override - public int read() throws IOException { - return -1; - } - }; - } - - /* (non-Javadoc) - * @see java.lang.Process#getOutputStream() - */ - @Override - public OutputStream getOutputStream() { - return new OutputStream() { - @Override - public void write(int b) throws IOException { - } - }; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/ErrorThread.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/ErrorThread.java deleted file mode 100644 index 55fadceb9df..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/ErrorThread.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2012 Broadcom Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * James Blackburn (Broadcom Corp.) - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.OutputStream; - -/** - * Receiving, and printing to the console, stderr output - * @since 7.0 - * @noextend This class is not intended to be subclassed by clients. - * @noinstantiate This class is not intended to be instantiated by clients. - */ -public class ErrorThread extends Thread { - - final MISession session; - - public ErrorThread(MISession s) { - super("MI Error Thread"); //$NON-NLS-1$ - session = s; - } - - /* - * Sit on the error stream output, and append to the GDB console - */ - @Override - public void run() { - BufferedReader reader = new BufferedReader(new InputStreamReader(session.getChannelErrorStream())); - try { - String line; - while ((line = reader.readLine()) != null) { - OutputStream console = session.getLogPipe(); - if (console != null) { - console.write((line + "\n").getBytes()); //$NON-NLS-1$ - console.flush(); - } - } - } catch (IOException e) { - try { - reader.close(); - } catch (IOException e1) {/* closing anyway */} - } - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/EventThread.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/EventThread.java deleted file mode 100644 index bc8b5ad5348..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/EventThread.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core; - -import org.eclipse.cdt.debug.mi.core.event.MIEvent; -import org.eclipse.cdt.debug.mi.core.event.MIStoppedEvent; - -/** - * Event Thread blocks on the event Queue, wakes up - * when events are available and notify all the observers. - */ -public class EventThread extends Thread { - - MISession session; - - public EventThread(MISession s) { - super("MI Event Thread"); //$NON-NLS-1$ - session = s; - } - - @Override - public void run() { - // Signal by the session of time to die. - while (session.getChannelOutputStream() != null) { - MIEvent event = null; - Queue eventQueue = session.getEventQueue(); - // removeItem() will block until an item is available. - try { - event = (MIEvent) eventQueue.removeItem(); - } catch (InterruptedException e) { - //e.printStackTrace(); - } - if (event instanceof MIStoppedEvent) { - processSuspendedEvent((MIStoppedEvent)event); - } - try { - if (event != null) { - session.notifyObservers(event); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - } - - void processSuspendedEvent(MIStoppedEvent stopped) { - // give a chance also to the underlying inferior. - session.getMIInferior().update(); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/GDBTypeParser.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/GDBTypeParser.java deleted file mode 100644 index a800d611e70..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/GDBTypeParser.java +++ /dev/null @@ -1,582 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - * Matthias Spycher (matthias@coware.com) - bug 124966 - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core; - -import java.util.regex.Pattern; - -/** - * GDB Type Parser. - * The code was lifted from: The C Programming Language - * B. W. Kernighan and D. Ritchie - */ -public class GDBTypeParser { - - // GDB type parsing from whatis command - // declarator: type dcl - // type: (name)+ - // dcl: ('*' | '&')* direct-decl - // direct-dcl: '(' dcl ')' - // direct-dcl '(' ')' - // direct-dcl '[' integer ']' - // name: ([a-zA-z][0-9])+ - // integer ([0-9)+ - - final static int EOF = -1; - final static int NAME = 0; - final static int PARENS = 1; - final static int BRACKETS = 2; - - String line; - int index; - int tokenType; - String token; - String dataType; - String name; - GDBDerivedType gdbDerivedType; - GDBType genericType; - - public GDBType getGDBType() { - if (gdbDerivedType != null) { - return gdbDerivedType; - } - return genericType; - } - - public String getVariableName() { - return name; - } - - public GDBType parse(String s) { - // Sanity. - if (s == null) { - s = new String(); - } - 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. - line = s; - index = 0; - tokenType = -1; - token = ""; //$NON-NLS-1$ - dataType = ""; //$NON-NLS-1$ - name = ""; //$NON-NLS-1$ - gdbDerivedType = null; - genericType = null; - - // Fetch the datatype. - while (getToken() == NAME) { - dataType += " " + token; //$NON-NLS-1$ - } - - // Hack for GDB, the typename can be something like - // class A : public B, C { ... } * - // 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; - } - genericType = new GDBType(dataType); - - // Start the recursive parser. - dcl(tokenType); - return getGDBType(); - } - - public static String unParse (GDBType gdbType) { - - StringBuffer sb = new StringBuffer(); - // Fetch the datatype. - while (gdbType != null) { - GDBDerivedType derived = null; - int type = gdbType.getType(); - if (gdbType instanceof GDBDerivedType) { - derived = (GDBDerivedType)gdbType; - gdbType = derived.getChild(); - // respect the precedence of operators. - if (type == GDBType.FUNCTION) { - sb.append("()"); //$NON-NLS-1$ - } else if (type == GDBType.ARRAY) { - sb.append('[').append(derived.getDimension()).append(']'); - } else if (type == GDBType.POINTER) { - int childType = (gdbType != null) ? gdbType.getType() : GDBType.GENERIC; - if (childType == GDBType.POINTER || childType == GDBType.REFERENCE) { - sb.append('*'); - } else if (childType == GDBType.GENERIC) { - sb.insert(0, '*'); - } else { - sb.insert(0, "(*").append(')'); //$NON-NLS-1$ - } - } else if (type == GDBType.REFERENCE) { - int childType = (gdbType != null) ? gdbType.getType() : GDBType.GENERIC; - if (childType == GDBType.POINTER || childType == GDBType.REFERENCE) { - sb.append("&"); //$NON-NLS-1$ - } else if (childType == GDBType.GENERIC) { - sb.insert(0, '&'); - } else { - sb.insert(0, "(&").append(')'); //$NON-NLS-1$ - } - } - } else { - sb.insert(0, ' '); - sb.insert(0, gdbType.nameType); - gdbType = null; - } - } - return sb.toString().trim(); - - } - - public class GDBType { - public final static int GENERIC = 0; - public final static int POINTER = 1; - public final static int REFERENCE = 2; - public final static int ARRAY = 3; - public final static int FUNCTION = 4; - - String nameType; - int type; - - public GDBType(String n) { - this(n, 0); - } - - public GDBType(int t) { - this("", t); //$NON-NLS-1$ - } - - public GDBType(String n, int t) { - nameType = n; - type = t; - } - - @Override - public String toString() { - return unParse(this); - } - - public String verbose() { - return nameType; - } - - public int getType() { - return type; - } - - public String getTypeName() { - return nameType; - } - } - - public class GDBDerivedType extends GDBType { - int dimension; - GDBType child; - - public GDBDerivedType(GDBType c, int i) { - this(c, i, 0); - } - - public GDBDerivedType(GDBType c, int t, int dim) { - super(t); - setChild(c); - dimension = dim; - } - - public int getDimension() { - return dimension; - } - - public void setChild(GDBType c) { - child = c; - } - - public GDBType getChild() { - return child; - } - - public boolean hasChild() { - return child != null; - } - - @Override - public String verbose() { - StringBuffer sb = new StringBuffer(); - switch (getType()) { - case FUNCTION : - sb.append(" function returning " + (hasChild() ? child.verbose() : "")); //$NON-NLS-1$//$NON-NLS-2$ - break; - case ARRAY : - sb.append(" array[" + dimension + "]" + " of " + (hasChild() ? child.verbose() : "")); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - break; - case REFERENCE : - sb.append(" reference to " + (hasChild() ? child.verbose() : "")); //$NON-NLS-1$//$NON-NLS-2$ - break; - case POINTER : - sb.append(" pointer to " + (hasChild() ? child.verbose() : "")); //$NON-NLS-1$//$NON-NLS-2$ - break; - } - return sb.toString(); - } - } - - int getch() { - if (index >= line.length() || index < 0) { - return EOF; - } - return line.charAt(index++); - } - - void ungetch() { - if (index > 0) { - index--; - } - } - - // check if the character is an alphabet - boolean isCIdentifierStart(int c) { - if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || c == '_' || c == ':' || c == ',') { - return true; - } - return false; - } - - // check is the character is alpha numeric - // [a-zA-Z0-9] - // GDB hack accept ':' ',' part of the GDB hacks - // when doing ptype gdb returns "class A : public C { ..}" - boolean isCIdentifierPart(int c) { - if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || c == '_' || c == ':') { - return true; - } - return false; - } - - boolean isCSpace(int c) { - if (c == ' ' || c == '\t' || c == '\f' || c == '\n') { - return true; - } - return false; - } - - void insertingChild(int kind) { - insertingChild(kind, 0); - } - - void insertingChild(int kind, int d) { - if (gdbDerivedType == null) { - gdbDerivedType = new GDBDerivedType(genericType, kind, d); - } else { - GDBDerivedType dType = gdbDerivedType; - GDBType gdbType = gdbDerivedType.getChild(); - while (gdbType instanceof GDBDerivedType) { - dType = (GDBDerivedType)gdbType; - gdbType = dType.getChild(); - } - gdbType = new GDBDerivedType(gdbType, kind, d); - dType.setChild(gdbType); - } - } - - // method returns the next token - int getToken() { - token = ""; //$NON-NLS-1$ - - int c = getch(); - - // Skip over any space - while (isCSpace(c)) { - c = getch(); - } - - //char character = (char) c; - - if (c == '(') { - c = getch(); - if (c == ')') { - token = "()"; //$NON-NLS-1$ - tokenType = PARENS; - } else if (isCIdentifierStart(c)) { - int i = 0; - token += (char)c; - while (i == 0 && c != ')') { - if (c == EOF) { - // Unbalanced parantheses. - break; - } - c = getch(); - token += (char)c; - if (c == '(') { - ++i; - } else if (c == ')') { - --i; - } - } - tokenType = PARENS; - } else { - ungetch(); - tokenType = '('; - } - - - - } else if (c == '[') { - while ((c = getch()) != ']' && c != EOF) { - token += (char) c; - } - tokenType = BRACKETS; - } else if (isCIdentifierStart(c)) { - StringBuffer sb = new StringBuffer(); - sb.append((char) c); - while (isCIdentifierPart((c = getch())) && c != EOF) { - 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) { - ungetch(); - } - token = sb.toString(); - tokenType = NAME; - } else if (c == '{') { - // Swallow gdb sends things like "struct foobar {..} *" - // FIXME: if the bracket is not terminate do we throw exception? - int count = 1; - do { - c = getch(); - if (c == '{') { - count++; - } else if (c == '}') { - count--; - } - } while (count > 0 && c != EOF); - } else { - tokenType = c; - } - return tokenType; - } - - void dcl() { - dcl(getToken()); - } - - // parse a declarator - void dcl(int c) { - int nstar = 0; - int namp = 0; - if (c == '*') { - nstar++; - for (; getToken() == '*'; nstar++) { - } - } else if (c == '&') { - namp++; - for (; getToken() == '&'; namp++) { - } - } - dirdcl(); - while (nstar-- > 0) { - insertingChild(GDBType.POINTER); - } - while (namp-- > 0) { - insertingChild(GDBType.REFERENCE); - } - } - - // parse a direct declarator - void dirdcl() { - int type; - - if (tokenType == '(') { - dcl(); - if (tokenType != ')' /*&& name.length() > 0*/) { - // Do we throw an exception on unterminated parentheses - // It should have been handle by getToken() - return; - } - } else if (tokenType == NAME) { - // Useless we do not need the name of the variable - name = " " + token; //$NON-NLS-1$ - } else if (tokenType == PARENS) { - insertingChild(GDBType.FUNCTION); - } else if (tokenType == BRACKETS) { - int len = 0; - if (token.length() > 0) { - try { - len = Integer.parseInt(token); - } catch (NumberFormatException e) { - } - } - insertingChild(GDBType.ARRAY, len); - } else if (tokenType == '&') { - insertingChild(GDBType.REFERENCE); - } else { - // oops bad declaration ? - return; - } - - while ((type = getToken()) == PARENS || type == BRACKETS) { - if (type == PARENS) { - insertingChild(GDBType.FUNCTION); - } else { /* BRACKETS */ - int len = 0; - if (token.length() > 0) { - try { - len = Integer.parseInt(token); - } catch (NumberFormatException e) { - } - } - insertingChild(GDBType.ARRAY, len); - } - } - } - - public static void main(String[] args) { - - GDBTypeParser parser = new GDBTypeParser(); - - System.out.println("int *&"); //$NON-NLS-1$ - parser.parse("int *&"); //$NON-NLS-1$ - System.out.println(GDBTypeParser.unParse(parser.getGDBType())); - System.out.println(parser.getGDBType().verbose()); - System.out.println(); - - System.out.println("int (&rg)(int)"); //$NON-NLS-1$ - parser.parse("int (&rg)(int)"); //$NON-NLS-1$ - System.out.println(GDBTypeParser.unParse(parser.getGDBType())); - System.out.println(parser.getGDBType().verbose()); - System.out.println(); - - System.out.println("int (&ra)[3]"); //$NON-NLS-1$ - parser.parse("int (&rg)[3]"); //$NON-NLS-1$ - System.out.println(GDBTypeParser.unParse(parser.getGDBType())); - System.out.println(parser.getGDBType().verbose()); - System.out.println(); - - System.out.println("struct link { int i; int j; struct link * next;} *"); //$NON-NLS-1$ - parser.parse("struct link { 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$ - parser.parse("char **argv"); //$NON-NLS-1$ - System.out.println(GDBTypeParser.unParse(parser.getGDBType())); - System.out.println(parser.getGDBType().verbose()); - System.out.println(); - - System.out.println("int (*daytab)[13]"); //$NON-NLS-1$ - parser.parse("int (*daytab)[13]"); //$NON-NLS-1$ - System.out.println(GDBTypeParser.unParse(parser.getGDBType())); - System.out.println(parser.getGDBType().verbose()); - System.out.println(); - - System.out.println("int *daytab[13]"); //$NON-NLS-1$ - parser.parse("int *daytab[13]"); //$NON-NLS-1$ - System.out.println(GDBTypeParser.unParse(parser.getGDBType())); - System.out.println(parser.getGDBType().verbose()); - System.out.println(); - - System.out.println("void *comp()"); //$NON-NLS-1$ - parser.parse("void *comp()"); //$NON-NLS-1$ - System.out.println(GDBTypeParser.unParse(parser.getGDBType())); - System.out.println(parser.getGDBType().verbose()); - System.out.println(); - - System.out.println("void (*comp)()"); //$NON-NLS-1$ - parser.parse("void (*comp)()"); //$NON-NLS-1$ - System.out.println(GDBTypeParser.unParse(parser.getGDBType())); - System.out.println(parser.getGDBType().verbose()); - System.out.println(); - - System.out.println("int (*func[15])()"); //$NON-NLS-1$ - parser.parse("int (*func[15])()"); //$NON-NLS-1$ - System.out.println(GDBTypeParser.unParse(parser.getGDBType())); - System.out.println(parser.getGDBType().verbose()); - System.out.println(); - - System.out.println("char (*(*x())[])()"); //$NON-NLS-1$ - parser.parse("char (*(*x())[])()"); //$NON-NLS-1$ - System.out.println(GDBTypeParser.unParse(parser.getGDBType())); - System.out.println(parser.getGDBType().verbose()); - System.out.println(); - - System.out.println("char (*(*x[3])())[5]"); //$NON-NLS-1$ - parser.parse("char (*(*x[3])())[5]"); //$NON-NLS-1$ - System.out.println(GDBTypeParser.unParse(parser.getGDBType())); - System.out.println(parser.getGDBType().verbose()); - System.out.println(); - - System.out.println("char *[5]"); //$NON-NLS-1$ - parser.parse("char *[5]"); //$NON-NLS-1$ - System.out.println(GDBTypeParser.unParse(parser.getGDBType())); - System.out.println(parser.getGDBType().verbose()); - System.out.println(); - - System.out.println("int [2][3]"); //$NON-NLS-1$ - parser.parse("int [2][3]"); //$NON-NLS-1$ - System.out.println(GDBTypeParser.unParse(parser.getGDBType())); - System.out.println(parser.getGDBType().verbose()); - System.out.println(); - - System.out.println("int (int, char **)"); //$NON-NLS-1$ - parser.parse("int (int, char **)"); //$NON-NLS-1$ - System.out.println(GDBTypeParser.unParse(parser.getGDBType())); - System.out.println(parser.getGDBType().verbose()); - System.out.println(); - - System.out.println("int (int)"); //$NON-NLS-1$ - parser.parse("int (int)"); //$NON-NLS-1$ - System.out.println(GDBTypeParser.unParse(parser.getGDBType())); - System.out.println(parser.getGDBType().verbose()); - System.out.println(); - - System.out.println("int (void)"); //$NON-NLS-1$ - parser.parse("int (void)"); //$NON-NLS-1$ - System.out.println(GDBTypeParser.unParse(parser.getGDBType())); - System.out.println(parser.getGDBType().verbose()); - System.out.println(); - - System.out.println("int ()"); //$NON-NLS-1$ - parser.parse("int ()"); //$NON-NLS-1$ - System.out.println(GDBTypeParser.unParse(parser.getGDBType())); - System.out.println(parser.getGDBType().verbose()); - System.out.println(); - - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/IMITTY.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/IMITTY.java deleted file mode 100644 index 99e0d28132a..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/IMITTY.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core; - -import java.io.InputStream; -import java.io.OutputStream; - -/** - */ -public interface IMITTY { - - /** - * Returns the name of the slave to pass to gdb --tty command - * ex: --tty=/dev/pty/1 - * - * @return - */ - public String getSlaveName(); - - /** - * Returns the OutputStream of the Master. - * - * @return - */ - public OutputStream getOutputStream(); - - /** - * Returns the InputStream of the Master - * - * @return - */ - public InputStream getInputStream(); - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/MIException.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/MIException.java deleted file mode 100644 index 7ac50ce5c49..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/MIException.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core; - -/** - * - * A checked exception representing a failure. - * - */ -public class MIException extends Exception { - /** - * - */ - private static final long serialVersionUID = 3257844402679724085L; - String log = ""; //$NON-NLS-1$ - - public MIException(String s) { - super(s); - } - - public MIException(String s, String l) { - super(s); - log = l; - } - - public String getLogMessage() { - return log; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/MIFormat.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/MIFormat.java deleted file mode 100644 index 0d118c392ef..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/MIFormat.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core; - -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 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() { - } - - /** - * 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; - } - - while (cursor < len && Character.digit(buffer.charAt(cursor), radix) != -1) { - cursor++; - } - - String s = buffer.substring(offset, cursor); - return getBigInteger(s); - } - - 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 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; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/MIInferior.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/MIInferior.java deleted file mode 100644 index 6505077c249..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/MIInferior.java +++ /dev/null @@ -1,421 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - * Hewlett-Packard Development Company - fix for bug 109733 - * ENEA Software AB - CLI command extension - fix for bug 190277 - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.PipedInputStream; -import java.io.PipedOutputStream; - -import org.eclipse.cdt.debug.mi.core.command.CommandFactory; -import org.eclipse.cdt.debug.mi.core.command.CLIExecAbort; -import org.eclipse.cdt.debug.mi.core.command.MIExecInterrupt; -import org.eclipse.cdt.debug.mi.core.command.MIGDBShowExitCode; -import org.eclipse.cdt.debug.mi.core.command.CLIInfoProc; -import org.eclipse.cdt.debug.mi.core.command.CLIInfoProgram; -import org.eclipse.cdt.debug.mi.core.event.MIInferiorExitEvent; -import org.eclipse.cdt.debug.mi.core.output.MIGDBShowExitCodeInfo; -import org.eclipse.cdt.debug.mi.core.output.CLIInfoProcInfo; -import org.eclipse.cdt.debug.mi.core.output.CLIInfoProgramInfo; - -/** - */ -public class MIInferior extends Process { - - final static int SUSPENDED = 1; - final static int RUNNING = 2; - final static int TERMINATED = 4; - - boolean connected = false; - - boolean exitCodeKnown = false; - int exitCode = 0; - int state = 0; - - MISession session; - - OutputStream out; - InputStream in; - - PipedOutputStream inPiped; - - PipedInputStream err; - PipedOutputStream errPiped; - IMITTY tty; - - int inferiorPID; - - - /** See {@link #isRemoteInferior()} */ - private boolean fIsRemoteInferior; - - public MIInferior(MISession mi, IMITTY p) { - session = mi; - tty = p; - if (tty != null) { - out = tty.getOutputStream(); - in = tty.getInputStream(); - } - } - - /** - * @see java.lang.Process#getOutputStream() - */ - @Override - public OutputStream getOutputStream() { - if (out == null) { - out = new OutputStream() { - @Override - public void write(int b) throws IOException { - if (!isRunning()) { - throw new IOException(MIPlugin.getResourceString("src.MIInferior.target_is_suspended")); //$NON-NLS-1$ - } - OutputStream channel = session.getChannelOutputStream(); - if (channel == null) { - throw new IOException(MIPlugin.getResourceString("src.MIInferior.No_session")); //$NON-NLS-1$ - } - channel.write(b); - } - }; - } - return out; - } - - /** - * @see java.lang.Process#getInputStream() - */ - @Override - public InputStream getInputStream() { - if (in == null) { - try { - inPiped = new PipedOutputStream(); - in = new PipedInputStream(inPiped); - } catch (IOException e) { - } - } - return in; - } - - /** - * @see java.lang.Process#getErrorStream() - */ - @Override - public InputStream getErrorStream() { - // FIXME: We do not have any err stream from gdb/mi - // so this gdb err channel instead. - if (err == null) { - try { - errPiped = new PipedOutputStream(); - err = new PipedInputStream(errPiped); - } catch (IOException e) { - } - } - return err; - } - - public synchronized void waitForSync() throws InterruptedException { - while (state != TERMINATED) { - wait(); - } - } - - /** - * @see java.lang.Process#waitFor() - */ - @Override - public int waitFor() throws InterruptedException { - waitForSync(); - return exitValue(); - } - - /** - * @see java.lang.Process#exitValue() - */ - @Override - public int exitValue() { - if (isTerminated()) { - if (!session.isTerminated()) { - if (!exitCodeKnown) { - CommandFactory factory = session.getCommandFactory(); - MIGDBShowExitCode code = factory.createMIGDBShowExitCode(); - try { - session.postCommand(code); - MIGDBShowExitCodeInfo info = code.getMIGDBShowExitCodeInfo(); - exitCode = info.getCode(); - } catch (MIException e) { - // no rethrown. - } - exitCodeKnown = true; - } - } - return exitCode; - } - throw new IllegalThreadStateException(); - } - - /** - * @see java.lang.Process#destroy() - */ - @Override - public void destroy() { - try { - terminate(); - } catch (MIException e) { - // do nothing. - } - } - - public void terminate() throws MIException { - // An inferior will be destroy():interrupt and kill if - // - For attach session: - // the inferior was not disconnected yet (no need to try - // to kill a disconnected program). - // - For Program session: - // if the inferior was not terminated. - // - For PostMortem(Core): send event - // else noop - if ((session.isAttachSession() && isConnected()) || (session.isProgramSession() && !isTerminated())) { - // Try to interrupt the inferior, first. - if (isRunning()) { - interrupt(); - } - int token = 0; - if (isSuspended()) { - try { - CommandFactory factory = session.getCommandFactory(); - CLIExecAbort abort = factory.createCLIExecAbort(); - session.postCommand0(abort, -1); - // do not wait for the answer. - //abort.getMIInfo(); - token = abort.getToken(); - } catch (MIException e) { - // ignore the error - } - } - setTerminated(token, true); - } else if (session.isCoreSession() && !isTerminated()){ - setTerminated(); - } - } - - public void interrupt() throws MIException { - MIProcess gdb = session.getGDBProcess(); - // Check if they can handle the interrupt - // Try the exec-interrupt; this will be for "gdb --async" - CommandFactory factory = session.getCommandFactory(); - MIExecInterrupt interrupt = factory.createMIExecInterrupt(); - if (interrupt != null) { - try { - session.postCommand(interrupt); - // call getMIInfo() even if we discard the value; - interrupt.getMIInfo(); - // Allow MI command timeout for the interrupt to propagate. - long maxSec = session.getCommandTimeout()/1000 + 1; - synchronized(this) { - for (int i = 0;(state == RUNNING) && i < maxSec; i++) { - try { - wait(1000); - } catch (InterruptedException e) { - } - } - } - } catch (MIException e) { - } - } else if (gdb.canInterrupt(this)) { - gdb.interrupt(this); - } - - // If we've failed throw an exception up. - if (state == RUNNING) { - throw new MIException(MIPlugin.getResourceString("src.MIInferior.Failed_to_interrupt")); //$NON-NLS-1$ - } - } - - public boolean isSuspended() { - return state == SUSPENDED; - } - - public boolean isRunning() { - return state == RUNNING; - } - - public boolean isTerminated() { - return state == TERMINATED; - } - - public boolean isConnected() { - return connected; - } - - public synchronized void setConnected() { - connected = true; - } - - public synchronized void setDisconnected() { - connected = false; - } - - public synchronized void setSuspended() { - state = SUSPENDED; - notifyAll(); - } - - public synchronized void setRunning() { - state = RUNNING; - notifyAll(); - } - - public synchronized void setTerminated() { - setTerminated(0, true); - } - - synchronized void setTerminated(int token, boolean fireEvent) { - state = TERMINATED; - // Close the streams. - try { - if (inPiped != null) { - inPiped.close(); - inPiped = null; - } - } catch (IOException e) { - //e.printStackTrace(); - } - try { - if (errPiped != null) { - errPiped.close(); - errPiped = null; - } - } catch (IOException e) { - //e.printStackTrace(); - } - - // If tty is not null then we are using a master/slave terminal - // emulation close the master to notify the slave. - if (tty != null) { - if (in != null) { - try { - in.close(); - } catch (IOException e) { - //e.printStackTrace(); - } - in = null; - } - if (out != null) { - try { - out.close(); - } catch (IOException e) { - //e.printStackTrace(); - } - out = null; - } - } - if (fireEvent) { - session.fireEvent(new MIInferiorExitEvent(session, token)); - } - notifyAll(); - } - - public OutputStream getPipedOutputStream() { - return inPiped; - } - - public OutputStream getPipedErrorStream() { - return errPiped; - } - - public IMITTY getTTY() { - return tty; - } - - public void update() { - if (getInferiorPID() == 0) { - int pid = 0; - // Do not try this on attach session. - if (!isConnected()) { - // Try to discover the pid using GDB/CLI Command "info proc" - CommandFactory factory = session.getCommandFactory(); - CLIInfoProc proc = factory.createCLIInfoProc(); - try { - RxThread rxThread = session.getRxThread(); - rxThread.setEnableConsole(false); - session.postCommand(proc); - CLIInfoProcInfo infoProc = proc.getMIInfoProcInfo(); - pid = infoProc.getPID(); - } catch (MIException e) { - // no rethrown. - } - - // Try to discover the pid using GDB/CLI Command "info program" if "info proc" failed - try { - if(pid <= 0){ - CLIInfoProgram prog = factory.createCLIInfoProgram(); - session.postCommand(prog); - CLIInfoProgramInfo info = prog.getMIInfoProgramInfo(); - pid = info.getPID(); - } - } catch (MIException e) { - // no rethrown. - } finally { - RxThread rxThread = session.getRxThread(); - rxThread.setEnableConsole(true); - } - } - // We fail permantely. - setInferiorPID((pid == 0) ? -1: pid); - } - } - - public int resetInferiorPID() { - int pid = inferiorPID; - inferiorPID = 0; - return pid; - } - - public void setInferiorPID(int pid) { - inferiorPID = pid; - } - - public int getInferiorPID() { - return inferiorPID; - } - - /** - * Called early on in the debug session to mark the inferior process as being - * under the control of a gdbserver. - * - * @since 7.0 - */ - public void setIsRemoteInferior(boolean value) { - fIsRemoteInferior = value; - } - - /** - * Is the inferior process being debugged remotely through gdbserver? - * - * @since 7.0 - */ - public boolean isRemoteInferior() { - return fIsRemoteInferior; - } - - /** - * Was the inferior process attached to by gdb (as opposed to launched by - * gdb). - * - * @since 7.0 - */ - public boolean isAttachedInferior() { - return session.isAttachSession(); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/MIProcess.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/MIProcess.java deleted file mode 100644 index 998df6f4bc5..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/MIProcess.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core; - -import java.io.InputStream; -import java.io.OutputStream; - -/** - * Check if we can interrupt the inferior. - * - */ -public interface MIProcess { - - - public abstract boolean canInterrupt(MIInferior inferior); - - public abstract void interrupt(MIInferior inferior); - - /* (non-Javadoc) - * @see java.lang.Process#destroy() - */ - public void destroy(); - - /* (non-Javadoc) - * @see java.lang.Process#exitValue() - */ - public int exitValue(); - - /* (non-Javadoc) - * @see java.lang.Process#getErrorStream() - */ - public InputStream getErrorStream(); - - /* (non-Javadoc) - * @see java.lang.Process#getInputStream() - */ - public InputStream getInputStream(); - - /* (non-Javadoc) - * @see java.lang.Process#getOutputStream() - */ - public OutputStream getOutputStream(); - - /* (non-Javadoc) - * @see java.lang.Process#waitFor() - */ - public int waitFor() throws InterruptedException; - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/MISession.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/MISession.java deleted file mode 100644 index 2962e2c49b9..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/MISession.java +++ /dev/null @@ -1,896 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - * Hewlett-Packard Development Company - fix for bug 109733 - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.PipedInputStream; -import java.io.PipedOutputStream; -import java.util.Observable; - -import org.eclipse.cdt.debug.mi.core.command.Command; -import org.eclipse.cdt.debug.mi.core.command.CommandFactory; -import org.eclipse.cdt.debug.mi.core.command.MIExecInterrupt; -import org.eclipse.cdt.debug.mi.core.command.MIGDBExit; -import org.eclipse.cdt.debug.mi.core.command.MIGDBSet; -import org.eclipse.cdt.debug.mi.core.command.MIGDBShowExitCode; -import org.eclipse.cdt.debug.mi.core.command.MIGDBShowPrompt; -import org.eclipse.cdt.debug.mi.core.command.MIInterpreterExecConsole; -import org.eclipse.cdt.debug.mi.core.command.MIVersion; -import org.eclipse.cdt.debug.mi.core.event.MIEvent; -import org.eclipse.cdt.debug.mi.core.event.MIGDBExitEvent; -import org.eclipse.cdt.debug.mi.core.output.MIGDBShowInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; -import org.eclipse.cdt.debug.mi.core.output.MIParser; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; - -/** - * Represents a GDB/MI session. - * Note that on GNU/Linux the target stream is not - * preceded by the token '@' until this is fix, on GNU/Linux - * there a good change to confuse the parser. - */ -public class MISession extends Observable { - - /** - * Normal program debuging. - */ - public final static int PROGRAM = 0; - /** - * Attach to a running process debuging. - */ - public final static int ATTACH = 1; - /** - * PostMortem analysis. - */ - public final static int CORE = 2; - - /** - * Timeout value for a very long time. - */ - public final static int FOREVER = Integer.MAX_VALUE; - - boolean terminated; - boolean useInterpreterExecConsole; - boolean verboseMode = false; - boolean breakpointsWithFullName = false; - - // hold the type of the session(post-mortem, attach etc ..) - int sessionType; - - Process sessionProcess; - MIProcess gdbProcess; - InputStream inChannel; - InputStream inErrChannel; - OutputStream outChannel; - - TxThread txThread; - RxThread rxThread; - ErrorThread errorThread; - EventThread eventThread; - - CommandQueue txQueue; - CommandQueue rxQueue; - Queue eventQueue; - - PipedInputStream miInConsolePipe; - PipedOutputStream miOutConsolePipe; - PipedInputStream miInLogPipe; - PipedOutputStream miOutLogPipe; - - - CommandFactory factory; - - MIParser parser; - - long cmdTimeout; - - MIInferior inferior; - - /** - * @param process - * @param tty - * @param type - * @param commandTimeout - * @param launchTimeout - * @param miVersion - * @param monitor - * @throws MIException - * @deprecated - */ - @Deprecated - public MISession(MIProcess process, IMITTY tty, int type, int commandTimeout, int launchTimeout, String miVersion, IProgressMonitor monitor) throws MIException { - this(process, tty, type, new CommandFactory(miVersion), commandTimeout, launchTimeout, monitor); - } - - - /** - * Create the gdb session. Assume MIVersion 1 - * - * @deprecated use the other constructors with the MIVersion - * @param Process gdb Process. - * @param pty Terminal to use for the inferior. - * @param timeout time in milliseconds to wait for command response. - * @param type the type of debugin session. - * @deprecated - */ - @Deprecated - public MISession(MIProcess process, IMITTY tty, int commandTimeout, int type, int launchTimeout) throws MIException { - this(process, tty, type, commandTimeout, launchTimeout, MIVersion.MI1, new NullProgressMonitor()); - if (useExecConsole()) { - // if exec console is present, assume MI2 supported - setCommandFactory(new CommandFactory(MIVersion.MI2)); - } - } - - /** - * Create the gdb session. - * - * @param type the type of debugging session. - * @param commandFactory the MI command factory - * @param Process gdb Process. - * @param pty Terminal to use for the inferior. - * @param timeout time in milliseconds to wait for command response. - * @deprecated - */ - @Deprecated - public MISession(MIProcess process, IMITTY tty, int type, CommandFactory commandFactory, int commandTimeout, int launchTimeout, IProgressMonitor monitor) throws MIException { - gdbProcess = process; - inChannel = process.getInputStream(); - inErrChannel = process.getErrorStream(); - outChannel = process.getOutputStream(); - - factory = commandFactory; - cmdTimeout = commandTimeout; - - sessionType = type; - - parser = new MIParser(); - - inferior = new MIInferior(this, tty); - - txQueue = new CommandQueue(); - rxQueue = new CommandQueue(); - eventQueue = new Queue(); - - txThread = new TxThread(this); - rxThread = new RxThread(this); - errorThread = new ErrorThread(this); - eventThread = new EventThread(this); - - // initialize/setup - setup(launchTimeout, new NullProgressMonitor()); - } - - /** - * Constructor for MISession. Creates MI wrapper for the given gdb process. - * - * @param type the type of debugging session: <code>PROGRAM</code>, <code>ATTACH</code> or <code>CORE</code> - * @param commandFactory the set of gdb/mi commands supported by given gdb - * @param Process a gdb process - * @param pty terminal to use for the inferior. - * @param timeout time in milliseconds to wait for command response. - * - * @since 3.1 - */ - public MISession(MIProcess process, IMITTY tty, int type, CommandFactory commandFactory, int commandTimeout) throws MIException { - gdbProcess = process; - inChannel = process.getInputStream(); - inErrChannel = process.getErrorStream(); - outChannel = process.getOutputStream(); - - factory = commandFactory; - cmdTimeout = commandTimeout; - - sessionType = type; - - parser = new MIParser(); - - inferior = new MIInferior(this, tty); - - txQueue = new CommandQueue(); - rxQueue = new CommandQueue(); - eventQueue = new Queue(); - - txThread = new TxThread(this); - rxThread = new RxThread(this); - errorThread = new ErrorThread(this); - eventThread = new EventThread(this); - - setup(); - - txThread.start(); - rxThread.start(); - errorThread.start(); - eventThread.start(); - } - - /** - * No need to pass a progress monitor and a launch timeout. - * @since 3.1 - */ - protected void setup() throws MIException { - // The Process may have terminated earlier because - // of bad arguments etc .. check this here and bail out. - try { - gdbProcess.exitValue(); - InputStream err = gdbProcess.getErrorStream(); - BufferedReader reader = new BufferedReader(new InputStreamReader(err)); - String line = null; - try { - line = reader.readLine(); - reader.close(); - } catch (Exception e) { - // the reader may throw a NPE. - } - if (line == null) { - line = MIPlugin.getResourceString("src.MISession.Process_Terminated"); //$NON-NLS-1$ - } - throw new MIException(line); - } catch (IllegalThreadStateException e) { - // Ok, it means the process is alive. - } - } - - /** - * Initializes the gdb session. - * @since 3.1 - */ - public void start() throws MIException { - try { - initialize(); - } catch (MIException exc) { - // Kill the Transmition thread. - if (txThread.isAlive()) { - txThread.interrupt(); - } - // Kill the Receiving Thread. - if (rxThread.isAlive()) { - rxThread.interrupt(); - } - // Kill the Error reading Thread. - if (errorThread.isAlive()) { - errorThread.interrupt(); - } - // Kill the event Thread. - if (eventThread.isAlive()) { - eventThread.interrupt(); - } - // rethrow up the exception. - throw exc; - } - } - - /** - * @deprecated use <code>setup()</code> without parameters - */ - @Deprecated - protected void setup(int launchTimeout, IProgressMonitor monitor) throws MIException { - // The Process may have terminated earlier because - // of bad arguments etc .. check this here and bail out. - try { - gdbProcess.exitValue(); - InputStream err = gdbProcess.getErrorStream(); - BufferedReader reader = new BufferedReader(new InputStreamReader(err)); - String line = null; - try { - line = reader.readLine(); - reader.close(); - } catch (Exception e) { - // the reader may throw a NPE. - } - if (line == null) { - line = MIPlugin.getResourceString("src.MISession.Process_Terminated"); //$NON-NLS-1$ - } - throw new MIException(line); - } catch (IllegalThreadStateException e) { - // Ok, it means the process is alive. - } - - if (monitor.isCanceled()) { - throw new MIException(MIPlugin.getResourceString("src.MISession.Process_Terminated")); //$NON-NLS-1$ - } - - txThread.start(); - rxThread.start(); - errorThread.start(); - eventThread.start(); - - try { - if (monitor.isCanceled()) { - throw new MIException(MIPlugin.getResourceString("src.MISession.Process_Terminated")); //$NON-NLS-1$ - } - - initialize(launchTimeout, monitor); - } catch (MIException exc) { - // Kill the Transmition thread. - if (txThread.isAlive()) { - txThread.interrupt(); - } - // Kill the Receiving Thread. - if (rxThread.isAlive()) { - rxThread.interrupt(); - } - // Kill the Error Thread. - if (errorThread.isAlive()) { - errorThread.interrupt(); - } - // Kill the event Thread. - if (eventThread.isAlive()) { - eventThread.interrupt(); - } - // rethrow up the exception. - throw exc; - } - } - - /** - * Turns off the "confirm" option of gdb. - * Sets witdth and height of gdb session to 0. - * @since 3.1 - */ - protected void initialize() throws MIException { - // Disable a certain number of irritations from gdb. - // Like confirmation and screen size. - MIGDBSet confirm = getCommandFactory().createMIGDBSet(new String[]{"confirm", "off"}); //$NON-NLS-1$ //$NON-NLS-2$ - postCommand(confirm); - confirm.getMIInfo(); - - MIGDBSet width = getCommandFactory().createMIGDBSet(new String[]{"width", "0"}); //$NON-NLS-1$ //$NON-NLS-2$ - postCommand(width); - width.getMIInfo(); - - MIGDBSet height = getCommandFactory().createMIGDBSet(new String[]{"height", "0"}); //$NON-NLS-1$ //$NON-NLS-2$ - postCommand(height); - height.getMIInfo(); - - useInterpreterExecConsole = canUseInterpreterExecConsole(); - - String prompt = getCLIPrompt(); - if (prompt != null) { - getMIParser().cliPrompt = prompt; - } - } - - /** - * @deprecated use <code>initialize()</code> without parameters - */ - @Deprecated - protected void initialize(int launchTimeout, IProgressMonitor monitor) throws MIException { - // Disable a certain number of irritations from gdb. - // Like confirmation and screen size. - MIGDBSet confirm = getCommandFactory().createMIGDBSet(new String[]{"confirm", "off"}); //$NON-NLS-1$ //$NON-NLS-2$ - postCommand(confirm, launchTimeout); - confirm.getMIInfo(); - if (monitor.isCanceled()) { - throw new MIException(MIPlugin.getResourceString("src.MISession.Process_Terminated")); //$NON-NLS-1$ - } - - MIGDBSet width = getCommandFactory().createMIGDBSet(new String[]{"width", "0"}); //$NON-NLS-1$ //$NON-NLS-2$ - postCommand(width, launchTimeout); - width.getMIInfo(); - if (monitor.isCanceled()) { - throw new MIException(MIPlugin.getResourceString("src.MISession.Process_Terminated")); //$NON-NLS-1$ - } - - MIGDBSet height = getCommandFactory().createMIGDBSet(new String[]{"height", "0"}); //$NON-NLS-1$ //$NON-NLS-2$ - postCommand(height, launchTimeout); - height.getMIInfo(); - if (monitor.isCanceled()) { - throw new MIException(MIPlugin.getResourceString("src.MISession.Process_Terminated")); //$NON-NLS-1$ - } - - useInterpreterExecConsole = canUseInterpreterExecConsole(); - if (monitor.isCanceled()) { - throw new MIException(MIPlugin.getResourceString("src.MISession.Process_Terminated")); //$NON-NLS-1$ - } - - String prompt = getCLIPrompt(); - if (monitor.isCanceled()) { - throw new MIException(MIPlugin.getResourceString("src.MISession.Process_Terminated")); //$NON-NLS-1$ - } - if (prompt != null) { - getMIParser().cliPrompt = prompt; - } - } - - protected boolean canUseInterpreterExecConsole() { - // Try to discover if "-interpreter-exec" is supported. - try { - MIInterpreterExecConsole echo = getCommandFactory().createMIInterpreterExecConsole("echo"); //$NON-NLS-1$ - postCommand(echo); - echo.getMIInfo(); - return true; - } catch (MIException e) { - // - } - return false; - } - - protected String getCLIPrompt() throws MIException { - // Get GDB's prompt - MIGDBShowPrompt prompt = getCommandFactory().createMIGDBShowPrompt(); - postCommand(prompt); - MIGDBShowInfo infoPrompt = prompt.getMIGDBShowInfo(); - String value = infoPrompt.getValue(); - if (value != null && value.length() > 0) { - return value.trim(); - } - return null; - } - - /** - * get MI Console Stream. - * The parser will make available the MI console stream output. - */ - public InputStream getMIConsoleStream() { - if (miInConsolePipe == null) { - try { - miOutConsolePipe = new PipedOutputStream(); - miInConsolePipe = new PipedInputStream(miOutConsolePipe); - } catch (IOException e) { - } - } - return miInConsolePipe; - } - - /** - * get MI Console Stream. - * The parser will make available the MI console stream output. - */ - public InputStream getMILogStream() { - if (miInLogPipe == null) { - try { - miOutLogPipe = new PipedOutputStream(); - miInLogPipe = new PipedInputStream(miOutLogPipe); - } catch (IOException e) { - } - } - return miInLogPipe; - } - - /** - * For example the CDI/MI bridge uses the command - * factory to create MI commands this allow overloading. - */ - public CommandFactory getCommandFactory() { - return factory; - } - - /** - * Set a new factory to use for command. - */ - public void setCommandFactory(CommandFactory f) { - factory = f; - } - - /** - * Return the MI parser. - */ - public MIParser getMIParser() { - return parser; - } - - /** - * Reset the MI parser. - */ - public void setMIParser(MIParser p) { - parser = p; - } - - /** - * Set the type of session this is. - * Certain action will base on that, for example - * the inferior will not try to kill/destroy a - * attach session disconnected. - */ - public int getSessionType() { - return sessionType; - } - - public void setSessionType(int type) { - sessionType = type; - } - - public boolean useExecConsole() { - return useInterpreterExecConsole; - } - - public boolean inPrimaryPrompt() { - return rxThread.inPrimaryPrompt(); - } - - public boolean inSecondaryPrompt() { - return rxThread.inSecondaryPrompt(); - } - /** - * The debug session is a program being debug. - */ - public boolean isProgramSession() { - return sessionType == PROGRAM; - } - - /** - * The debug session is a program being attach to. - */ - public boolean isAttachSession() { - return sessionType == ATTACH; - } - - /** - * The debug session is a core being analysed. - */ - public boolean isCoreSession() { - return sessionType == CORE; - } - - /** - * Reset the default Command Timeout. - */ - public void setCommandTimeout(long timeout) { - cmdTimeout = timeout; - } - - /** - * Return the default Command Timeout, default 10 secs. - */ - public long getCommandTimeout() { - return cmdTimeout; - } - - /** - * equivalent to: - * postCommand(cmd, cmdTimeout) - */ - public void postCommand(Command cmd) throws MIException { - postCommand(cmd, cmdTimeout); - } - - /** - * Sends a command to gdb, and wait(timeout) for a response. - * if timeout < 0 the wait will be skipped. - * - */ - public void postCommand(Command cmd, long timeout) throws MIException { - - // Test if we are in a sane state. - if (!txThread.isAlive() || !rxThread.isAlive()) { - throw new MIException(MIPlugin.getResourceString("src.MISession.Thread_Terminated")); //$NON-NLS-1$ - } - - // Test if we are in the right state? - if (inferior.isRunning()) { - // REMINDER: if we support -exec-interrupt - // Let it throught: - if (!(cmd instanceof MIExecInterrupt)) { - throw new MIException(MIPlugin.getResourceString("src.MISession.Target_not_suspended")); //$NON-NLS-1$ - } - } - - if (inferior.isTerminated()) { - // the only thing that can call postCommand when the inferior is in a TERMINATED - // state is MIGDBShowExitCode, for when MIInferior is computing error code. - if (!(cmd instanceof MIGDBShowExitCode)) { - throw new MIException(MIPlugin.getResourceString("src.MISession.Inferior_Terminated")); //$NON-NLS-1$ - } - } - - if (isTerminated()) { - throw new MIException(MIPlugin.getResourceString("src.MISession.Session_terminated")); //$NON-NLS-1$ - } - postCommand0(cmd, timeout); - } - - /** - * if timeout < 0 the operation will not try to way for - * answer from gdb. - * - * @param cmd - * @param timeout - * @throws MIException - */ - public synchronized void postCommand0(Command cmd, long timeout) throws MIException { - // TRACING: print the command; - if (MIPlugin.DEBUG) { - MIPlugin.getDefault().debugLog(cmd.toString()); - } - - if (isVerboseModeEnabled()) - writeToConsole(cmd.toString()); - - txQueue.addCommand(cmd); - - // do not wait around the answer. - if (timeout < 0) { - return; - } - // Wait for the response or timedout - synchronized (cmd) { - // RxThread will set the MIOutput on the cmd - // when the response arrive. - while (cmd.getMIOutput() == null) { - try { - cmd.wait(timeout); - if (cmd.getMIOutput() == null) { - throw new MIException(MIPlugin.getResourceString("src.MISession.Target_not_responding")); //$NON-NLS-1$ - } - } catch (InterruptedException e) { - } - } - } - } - - /** - * Return the inferior "Process". - */ - public MIInferior getMIInferior() { - return inferior; - } - - /** - * Set the inferior "Process". - */ - public void setMIInferior(MIInferior inferior) { - this.inferior = inferior; - } - - /** - * Return the "gdb" Process. - */ - public MIProcess getGDBProcess() { - return gdbProcess; - } - - /** - * Return a "fake" Process that will - * encapsulate the call input/output of gdb. - */ - public Process getSessionProcess() { - if (sessionProcess == null) { - sessionProcess = new SessionProcess(this); - } - return sessionProcess; - } - - /** - * Check if the gdb session is terminated. - */ - public boolean isTerminated() { - return terminated; - } - - /** - * Terminate the MISession. - */ - public void terminate() { - - // Sanity check. - if (isTerminated()) { - return; - } - - terminated = true; - - // Destroy any MI Inferior(Process) and streams. - inferior.destroy(); - - // {in,out}Channel is use as predicate/condition - // in the {RX,TX,Event}Thread to detect termination - // and bail out. So they are set to null. - InputStream inGDB = inChannel; - inChannel = null; - OutputStream outGDB = outChannel; - outChannel = null; - - // Although we will close the pipe(). It is cleaner - // to give a chance to gdb to cleanup. - // send the exit(-gdb-exit). But we only wait a maximum of 2 sec. - MIGDBExit exit = getCommandFactory().createMIGDBExit(); - try { - postCommand0(exit, 2000); - } catch (MIException e) { - //ignore any exception at this point. - } - - // Make sure gdb is killed. - // FIX: the destroy() must be call before closing gdb streams - // on windows if the order is not follow the close() will hang. - if (gdbProcess != null) { - gdbProcess.destroy(); - } - - // Close the input GDB prompt - try { - if (inGDB != null) - inGDB.close(); - } catch (IOException e) { - } - - // Close the output GDB prompt - try { - if (outGDB != null) - outGDB.close(); - } catch (IOException e) { - } - - // Destroy the MI console stream. - try { - miInConsolePipe = null; - if (miOutConsolePipe != null) { - miOutConsolePipe.close(); - } - } catch (IOException e) { - } - - // Destroy the MI log stream. - try { - miInLogPipe = null; - if (miOutLogPipe != null) { - miOutLogPipe.close(); - } - } catch (IOException e) { - } - - // Kill the Transmition thread. - try { - if (txThread.isAlive()) { - txThread.interrupt(); - txThread.join(cmdTimeout); - } - } catch (InterruptedException e) { - } - - // Kill the Receiving Thread. - try { - if (rxThread.isAlive()) { - rxThread.interrupt(); - rxThread.join(cmdTimeout); - } - } catch (InterruptedException e) { - } - // Kill the Error Thread. - try { - if (errorThread.isAlive()) { - errorThread.interrupt(); - errorThread.join(cmdTimeout); - } - } catch (InterruptedException e) { - } - // Kill the event Thread ... if it is not us. - if (!eventThread.equals(Thread.currentThread())) { - // Kill the event Thread. - try { - if (eventThread.isAlive()) { - eventThread.interrupt(); - eventThread.join(cmdTimeout); - } - } catch (InterruptedException e) { - } - } - - // Tell the observers that the session is terminated - notifyObservers(new MIGDBExitEvent(this, 0)); - - // Should not be necessary but just to be safe. - deleteObservers(); - } - - /** - * Notify the observers of new MI OOB events. - */ - @Override - public void notifyObservers(Object arg) { - setChanged(); - super.notifyObservers(arg); - } - - OutputStream getConsolePipe() { - if (miOutConsolePipe == null) { - getMIConsoleStream(); - } - return miOutConsolePipe; - } - - OutputStream getLogPipe() { - if (miOutLogPipe == null) { - getMILogStream(); - } - return miOutLogPipe; - } - - CommandQueue getTxQueue() { - return txQueue; - } - - CommandQueue getRxQueue() { - return rxQueue; - } - - Queue getEventQueue() { - return eventQueue; - } - - public RxThread getRxThread() { - return rxThread; - } - - InputStream getChannelInputStream() { - return inChannel; - } - - InputStream getChannelErrorStream() { - return inErrChannel; - } - - OutputStream getChannelOutputStream() { - return outChannel; - } - - MIOutput parse(String buffer) { - return parser.parse(buffer); - } - - public void fireEvents(MIEvent[] events) { - if (events != null && events.length > 0) { - for (int i = 0; i < events.length; i++) { - fireEvent(events[i]); - } - } - } - - public void fireEvent(MIEvent event) { - if (event != null) { - getEventQueue().addItem(event); - } - } - - protected void writeToConsole(String text) { - OutputStream console = getConsolePipe(); - if (console != null) { - try { - console.write(text.getBytes()); - console.flush(); - } - catch(IOException e) { - } - } - } - - public void enableVerboseMode(boolean enabled) { - verboseMode = enabled; - } - - public boolean isVerboseModeEnabled() { - return verboseMode; - } - - - /** - * getter for breakpointsWithFullName - * @return true when debugger should set breakpoints using full file name - */ - public final boolean isBreakpointsWithFullName() { - return breakpointsWithFullName; - } - - /** - * setter for breakpointsWithFullName - * set to true when debugger should set breakpoints using full file name, default is false - */ - public final void setBreakpointsWithFullName(boolean breakpointsWithFullName) { - this.breakpointsWithFullName = breakpointsWithFullName; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/Queue.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/Queue.java deleted file mode 100644 index 639d8b64842..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/Queue.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core; - -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; - -/** - * Simple thread-safe Queue implemetation. - */ -public class Queue { - - protected List list; - - public Queue() { - list = Collections.synchronizedList(new LinkedList()); - } - - public Object removeItem() throws InterruptedException { - //print("in removeItem() - entering"); - synchronized (list) { - while (list.isEmpty()) { - //print("in removeItem() - about to wait()"); - list.wait(); - //print("in removeItem() - done with wait()"); - } - - // extract the new first cmd - Object item = list.remove(0); - - //print("in removeItem() - leaving"); - return item; - } - } - - public void addItem(Object item) { - //print("in addItem() - entering"); - synchronized (list) { - // There will always be room to add to this List - // because it expands as needed. - list.add(item); - //print("in addItem - just added: '" + cmd + "'"); - - // After adding, notify any and all waiting - // threads that the list has changed. - list.notifyAll(); - //print("in addItem() - just notified"); - } - //print("in addItem() - leaving"); - } - - public Object[] clearItems() { - Object[] array; - synchronized (list) { - array = list.toArray(); - list.clear(); - } - return array; - } - - public boolean isEmpty() { - boolean empty; - synchronized (list) { - empty = list.isEmpty(); - } - return empty; - } - -// private static void print(String msg) { -// String name = Thread.currentThread().getName(); -// System.out.println(name + ": " + msg); -// } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/RxThread.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/RxThread.java deleted file mode 100644 index d83a41a27e7..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/RxThread.java +++ /dev/null @@ -1,562 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - * Norbert Ploett, Siemens AG - fix for bug 119370 - * Hewlett-Packard Development Company - fix for bug 109733 (null check in setPrompt) - * Marc Khouzam (Ericsson) - Bug 369594: GDB 7.4 now reports solib events in MI, but no longer in CLI - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; -import java.util.StringTokenizer; - -import org.eclipse.cdt.debug.mi.core.command.CLICommand; -import org.eclipse.cdt.debug.mi.core.command.Command; -import org.eclipse.cdt.debug.mi.core.command.MIExecContinue; -import org.eclipse.cdt.debug.mi.core.command.MIExecFinish; -import org.eclipse.cdt.debug.mi.core.command.MIExecNext; -import org.eclipse.cdt.debug.mi.core.command.MIExecNextInstruction; -import org.eclipse.cdt.debug.mi.core.command.MIExecReturn; -import org.eclipse.cdt.debug.mi.core.command.MIExecStep; -import org.eclipse.cdt.debug.mi.core.command.MIExecStepInstruction; -import org.eclipse.cdt.debug.mi.core.command.MIExecUntil; -import org.eclipse.cdt.debug.mi.core.command.MIInterpreterExecConsole; -import org.eclipse.cdt.debug.mi.core.event.MIBreakpointHitEvent; -import org.eclipse.cdt.debug.mi.core.event.MIErrorEvent; -import org.eclipse.cdt.debug.mi.core.event.MIEvent; -import org.eclipse.cdt.debug.mi.core.event.MIFunctionFinishedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIInferiorExitEvent; -import org.eclipse.cdt.debug.mi.core.event.MIInferiorSignalExitEvent; -import org.eclipse.cdt.debug.mi.core.event.MILocationReachedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIRunningEvent; -import org.eclipse.cdt.debug.mi.core.event.MISharedLibEvent; -import org.eclipse.cdt.debug.mi.core.event.MISignalEvent; -import org.eclipse.cdt.debug.mi.core.event.MISteppingRangeEvent; -import org.eclipse.cdt.debug.mi.core.event.MIStoppedEvent; -import org.eclipse.cdt.debug.mi.core.event.MIWatchpointScopeEvent; -import org.eclipse.cdt.debug.mi.core.event.MIWatchpointTriggerEvent; -import org.eclipse.cdt.debug.mi.core.output.MIAsyncRecord; -import org.eclipse.cdt.debug.mi.core.output.MIConsoleStreamOutput; -import org.eclipse.cdt.debug.mi.core.output.MIConst; -import org.eclipse.cdt.debug.mi.core.output.MIExecAsyncOutput; -import org.eclipse.cdt.debug.mi.core.output.MILogStreamOutput; -import org.eclipse.cdt.debug.mi.core.output.MINotifyAsyncOutput; -import org.eclipse.cdt.debug.mi.core.output.MIOOBRecord; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; -import org.eclipse.cdt.debug.mi.core.output.MIParser; -import org.eclipse.cdt.debug.mi.core.output.MIResult; -import org.eclipse.cdt.debug.mi.core.output.MIResultRecord; -import org.eclipse.cdt.debug.mi.core.output.MIStatusAsyncOutput; -import org.eclipse.cdt.debug.mi.core.output.MIStreamRecord; -import org.eclipse.cdt.debug.mi.core.output.MITargetStreamOutput; -import org.eclipse.cdt.debug.mi.core.output.MIValue; - -/** - * Receiving thread of gdb response output. - */ -public class RxThread extends Thread { - - final MISession session; - LinkedList<MIStreamRecord> fStreamRecords = new LinkedList<MIStreamRecord>(); - CLIProcessor cli; - int prompt = 1; // 1 --> Primary prompt "(gdb)"; 2 --> Secondary Prompt ">" - boolean fEnableConsole = true; - - public RxThread(MISession s) { - super("MI RX Thread"); //$NON-NLS-1$ - session = s; - cli = new CLIProcessor(session); - } - - /* - * Get the response, parse the output, dispatch for OOB - * search for the corresponding token in rxQueue for the ResultRecord. - */ - @Override - public void run() { - BufferedReader reader = new BufferedReader(new InputStreamReader(session.getChannelInputStream())); - try { - String line; - while ((line = reader.readLine()) != null) { - // TRACING: print the output. - if (MIPlugin.DEBUG) { - MIPlugin.getDefault().debugLog(line); - } - - if (session.isVerboseModeEnabled()) - session.writeToConsole(line + "\n"); //$NON-NLS-1$ - - setPrompt(line); - processMIOutput(line + "\n"); //$NON-NLS-1$ - } - } catch (IOException e) { - //e.printStackTrace(); - } - // This code should be executed when gdb been abruptly - // or unxepectedly killed. This is detected by checking - // if the channelInputStream is not null. In normal case - // session.terminate() will set the channelInputStream to null. - if (session.getChannelInputStream() != null) { - Runnable cleanup = new Runnable() { - @Override - public void run() { - // Change the state of the inferior. - session.getMIInferior().setTerminated(); - session.terminate(); - } - }; - Thread clean = new Thread(cleanup, "GDB Died"); //$NON-NLS-1$ - clean.setDaemon(true); - clean.start(); - } - // Clear the queue and notify any command waiting, we are going down. - CommandQueue rxQueue = session.getRxQueue(); - if (rxQueue != null) { - Command[] cmds = rxQueue.clearCommands(); - for (int i = 0; i < cmds.length; i++) { - synchronized (cmds[i]) { - cmds[i].notifyAll(); - } - } - } - } - - void setPrompt(String line) { - MIParser parser = session.getMIParser(); - prompt = 0; - // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=109733 - if (line == null || parser == null) - return; - line = line.trim(); - if (line.equals(parser.primaryPrompt)) { - prompt = 1; - } else if (line.equals(parser.secondaryPrompt)) { - prompt = 2; - } - } - - public boolean inPrimaryPrompt() { - return prompt == 1; - } - - public boolean inSecondaryPrompt() { - return prompt == 2; - } - - public void setEnableConsole(boolean enable) { - fEnableConsole = enable; - } - - public boolean isEnableConsole() { - return fEnableConsole; - } - - /** - * Search for the command in the RxQueue, set the MIOutput - * and notify() the other end. - * Any OOBs are consider like event and dipatch to the - * listeners/observers in different thread. - */ - void processMIOutput(String buffer) { - MIOutput response = session.parse(buffer); - if (response != null) { - List<MIEvent> list = new ArrayList<MIEvent>(); - CommandQueue rxQueue = session.getRxQueue(); - - MIResultRecord rr = response.getMIResultRecord(); - if (rr != null) { - int id = rr.getToken(); - Command cmd = rxQueue.removeCommand(id); - - // Get a snapshot of the accumulated stream records. We clear - // the collection below (with each new Result Command response). - MIStreamRecord[] streamRecords = fStreamRecords.toArray(new MIStreamRecord[fStreamRecords.size()]); - - // 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; - } - session.getMIInferior().setRunning(); - MIEvent event = new MIRunningEvent(session, id, type); - if (cmd != null && cmd.isQuiet()) - event.setPropagate(false); - list.add(event); - } else if ("exit".equals(state)) { //$NON-NLS-1$ - // No need to do anything, terminate() will. - session.getMIInferior().setTerminated(); - } else if ("connected".equals(state)) { //$NON-NLS-1$ - session.getMIInferior().setConnected(); - } else if ("error".equals(state)) { //$NON-NLS-1$ - if (session.getMIInferior().isRunning()) { - session.getMIInferior().setSuspended(); - MIEvent event = new MIErrorEvent(session, rr, streamRecords); - list.add(event); - } - } else if ("done".equals(state) && cmd instanceof CLICommand) { //$NON-NLS-1$ - // "done" usually mean that gdb returns after some CLI command - // The result record may contains informaton specific to oob. - // This will happen when CLI-Command is use, for example - // doing "run" will block and return a breakpointhit - processMIOOBRecord(rr, list); - } - - // Set the accumulate console Stream - response.setMIOOBRecords(streamRecords); - - // Notify the waiting command. - // Notify any command waiting for a ResultRecord. - if (cmd != null) { - // Process the Command line to recognize patterns we may need to fire event. - if (cmd instanceof CLICommand) { - cli.processSettingChanges((CLICommand)cmd); - } else if (cmd instanceof MIInterpreterExecConsole) { - cli.processSettingChanges((MIInterpreterExecConsole)cmd); - } - - synchronized (cmd) { - cmd.setMIOutput(response); - cmd.notifyAll(); - } - } - - // Clear the accumulated stream records on each new Result Command response. - fStreamRecords.clear(); - - } else { - - // Process OOBs - MIOOBRecord[] oobs = response.getMIOOBRecords(); - for (int i = 0; i < oobs.length; i++) { - processMIOOBRecord(oobs[i], list); - } - // If not waiting for any command results, ensure the stream list doesn't - // get too large. See Bug 302927 for more - if (rxQueue.isEmpty() && fStreamRecords.size() > 20) - fStreamRecords.removeFirst(); - } - - MIEvent[] events = list.toArray(new MIEvent[list.size()]); - session.fireEvents(events); - } // if response != null - } - - /** - * Dispatch a thread to deal with the listeners. - */ - void processMIOOBRecord(MIOOBRecord oob, List<MIEvent> list) { - if (oob instanceof MIAsyncRecord) { - processMIOOBRecord((MIAsyncRecord) oob, list); - fStreamRecords.clear(); - } else if (oob instanceof MIStreamRecord) { - processMIOOBRecord((MIStreamRecord) oob); - } - } - - void processMIOOBRecord(MIAsyncRecord async, List<MIEvent> list) { - if (async instanceof MIExecAsyncOutput) { - MIExecAsyncOutput exec = (MIExecAsyncOutput) async; - // Change of state. - String state = exec.getAsyncClass(); - if ("stopped".equals(state)) { //$NON-NLS-1$ - 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) { - list.add(e); - } - } - } - } - - // GDB does not provide reason when stopping on a shared library - // event (gdb < 7.4) or because of a catchpoint (in gdb < 7.0). - // Hopefully this will be fixed in a future version. Meanwhile, - // we will use a hack to cope. On most platform we can detect by - // looking at the console stream for phrase. Although it is a - // _real_ bad idea to do this, we do not have any other - // alternatives. - if (list.isEmpty()) { - String[] logs = getStreamRecords(); - for (int i = 0; i < logs.length; i++) { - if (logs[i].equalsIgnoreCase("Stopped due to shared library event")) { //$NON-NLS-1$ - session.getMIInferior().setSuspended(); - MIEvent e = new MISharedLibEvent(session, exec); - list.add(e); - } - else if (logs[i].startsWith("Catchpoint ")) { //$NON-NLS-1$ - session.getMIInferior().setSuspended(); - - // Example: "Catchpoint 1 (exception caught)" - StringTokenizer tokenizer = new StringTokenizer(logs[i]); - tokenizer.nextToken(); // "Catchpoint" - try { - int bkptNumber = Integer.parseInt(tokenizer.nextToken()); // 1 - list.add(new MIBreakpointHitEvent(session, exec, bkptNumber)); - } - catch (NumberFormatException exc) { - assert false : "unexpected catchpoint stream record format: " + logs[i]; //$NON-NLS-1$ - } - } - } - } - - // We were stopped for some unknown reason, for example - // GDB for temporary breakpoints will not send the - // "reason" ??? still fire a stopped event. - if (list.isEmpty()) { - session.getMIInferior().setSuspended(); - MIEvent e = new MIStoppedEvent(session, exec); - list.add(e); - } - } - } else if (async instanceof MIStatusAsyncOutput) { - // Nothing done .. but what about +download?? - } else if (async instanceof MINotifyAsyncOutput) { - // Nothing - } - } - - void processMIOOBRecord(MIStreamRecord stream) { - if (stream instanceof MIConsoleStreamOutput) { - OutputStream console = session.getConsolePipe(); - if (console != null) { - MIConsoleStreamOutput out = (MIConsoleStreamOutput) stream; - String str = out.getString(); - // Process the console stream too. - setPrompt(str); - if (str != null && isEnableConsole()) { - try { - console.write(str.getBytes()); - console.flush(); - } catch (IOException e) { - } - } - } - // Accumulate the Console Stream Output response for parsing. - // Some commands will put valuable info in the Console Stream. - fStreamRecords.add(stream); - } else if (stream instanceof MITargetStreamOutput) { - OutputStream target = session.getMIInferior().getPipedOutputStream(); - if (target != null) { - MITargetStreamOutput out = (MITargetStreamOutput) stream; - String str = out.getString(); - if (str != null) { - try { - target.write(str.getBytes()); - target.flush(); - } catch (IOException e) { - } - } - } - // Accumulate the Target Stream Output response for parsing. - // Some commands, e.g. 'monitor' will put valuable info in the Console Stream. - // This fixes bug 119370. - fStreamRecords.add(stream); - } else if (stream instanceof MILogStreamOutput) { - // This is meant for the gdb console. - OutputStream log = session.getLogPipe(); - if (log != null) { - MILogStreamOutput out = (MILogStreamOutput) stream; - String str = out.getString(); - if (str != null && isEnableConsole()) { - try { - log.write(str.getBytes()); - log.flush(); - } catch (IOException e) { - } - } - } - // Accumulate the Log Stream Output response for parsing. - // Some commands will put valuable info in the Log Stream. - fStreamRecords.add(stream); - } - } - - /** - * Check for any info that we can gather form the console. - */ - void processMIOOBRecord(MIResultRecord rr, List<MIEvent> list) { - MIResult[] results = rr.getMIResults(); - for (int i = 0; i < results.length; i++) { - String var = results[i].getVariable(); - if (var.equals("reason")) { //$NON-NLS-1$ - MIValue value = results[i].getMIValue(); - if (value instanceof MIConst) { - String reason = ((MIConst) value).getString(); - MIEvent event = createEvent(reason, rr); - if (event != null) { - list.add(event); - } - } - } - } - // GDB does not have reason when stopping on shared (gdb < 7.4) - // we will use a hack - // to cope. On most platform we can detect this state by looking at the - // console stream for the phrase: - // ~"Stopped due to shared library event\n" - // - // Although it is a _real_ bad idea to do this, we do not have - // any other alternatives. - if (list.isEmpty()) { - String[] logs = getStreamRecords(); - for (int i = 0; i < logs.length; i++) { - if (logs[i].equalsIgnoreCase("Stopped due to shared library event")) { //$NON-NLS-1$ - session.getMIInferior().setSuspended(); - MIEvent e = new MISharedLibEvent(session, rr); - list.add(e); - } - } - } - // We were stopped for some unknown reason, for example - // GDB for temporary breakpoints will not send the - // "reason" ??? still fire a stopped event. - if (list.isEmpty()) { - if (session.getMIInferior().isRunning()) { - session.getMIInferior().setSuspended(); - MIEvent event = new MIStoppedEvent(session, rr); - session.fireEvent(event); - } - } - } - - MIEvent createEvent(String reason, MIExecAsyncOutput exec) { - return createEvent(reason, null, exec); - } - - MIEvent createEvent(String reason, MIResultRecord rr) { - return createEvent(reason, rr, null); - } - - MIEvent createEvent(String reason, MIResultRecord rr, MIExecAsyncOutput exec) { - MIEvent event = null; - if ("breakpoint-hit".equals(reason)) { //$NON-NLS-1$ - if (exec != null) { - event = new MIBreakpointHitEvent(session, exec); - } else if (rr != null) { - event = new MIBreakpointHitEvent(session, rr); - } - session.getMIInferior().setSuspended(); - } 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$ - if (exec != null) { - event = new MIWatchpointTriggerEvent(session, exec); - } else if (rr != null) { - event = new MIWatchpointTriggerEvent(session, rr); - } - session.getMIInferior().setSuspended(); - } else if ("watchpoint-scope".equals(reason)) { //$NON-NLS-1$ - if (exec != null) { - event = new MIWatchpointScopeEvent(session, exec); - } else if (rr != null) { - event = new MIWatchpointScopeEvent(session, rr); - } - session.getMIInferior().setSuspended(); - } else if ("end-stepping-range".equals(reason)) { //$NON-NLS-1$ - if (exec != null) { - event = new MISteppingRangeEvent(session, exec); - } else if (rr != null) { - event = new MISteppingRangeEvent(session, rr); - } - session.getMIInferior().setSuspended(); - } else if ("signal-received".equals(reason)) { //$NON-NLS-1$ - if (exec != null) { - event = new MISignalEvent(session, exec); - } else if (rr != null) { - event = new MISignalEvent(session, rr); - } - session.getMIInferior().setSuspended(); - } else if ("location-reached".equals(reason)) { //$NON-NLS-1$ - if (exec != null) { - event = new MILocationReachedEvent(session, exec); - } else if (rr != null) { - event = new MILocationReachedEvent(session, rr); - } - session.getMIInferior().setSuspended(); - } else if ("function-finished".equals(reason)) { //$NON-NLS-1$ - if (exec != null) { - event = new MIFunctionFinishedEvent(session, exec); - } else if (rr != null) { - event = new MIFunctionFinishedEvent(session, rr); - } - session.getMIInferior().setSuspended(); - } else if ("exited-normally".equals(reason) || "exited".equals(reason)) { //$NON-NLS-1$ //$NON-NLS-2$ - if (exec != null) { - event = new MIInferiorExitEvent(session, exec); - } else if (rr != null) { - event = new MIInferiorExitEvent(session, rr); - } - session.getMIInferior().setTerminated(0,false); - } else if ("exited-signalled".equals(reason)) { //$NON-NLS-1$ - if (exec != null) { - event = new MIInferiorSignalExitEvent(session, exec); - } else if (rr != null) { - event = new MIInferiorSignalExitEvent(session, rr); - } - session.getMIInferior().setTerminated(0,false); - } else if ("shlib-event".equals(reason) || //$NON-NLS-1$ - // GDB 7.4 reports this event as "solib-event" - // Bug 369594 - "solib-event".equals(reason)) {//$NON-NLS-1$ - if (exec != null) { - event = new MISharedLibEvent(session, exec); - } else if (rr != null) { - event = new MISharedLibEvent(session, rr); - } - session.getMIInferior().setSuspended(); - } - return event; - } - - String[] getStreamRecords() { - List<String> streamRecords = new ArrayList<String>(fStreamRecords.size()); - for (MIStreamRecord rec : fStreamRecords) { - String str = rec.getString().trim(); - if (str.length() > 0) { - streamRecords.add(str); - } - } - return streamRecords.toArray(new String[streamRecords.size()]); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/SessionProcess.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/SessionProcess.java deleted file mode 100644 index 6ddc4f69de8..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/SessionProcess.java +++ /dev/null @@ -1,127 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -import org.eclipse.cdt.debug.mi.core.command.CLICommand; -import org.eclipse.cdt.debug.mi.core.command.Command; -import org.eclipse.cdt.debug.mi.core.command.CommandFactory; -import org.eclipse.cdt.debug.mi.core.command.RawCommand; - -/** - */ -public class SessionProcess extends Process { - - MISession session; - OutputStream out; - - public SessionProcess(MISession s) { - session = s; - } - - /** - * @see java.lang.Process#destroy() - */ - @Override - public void destroy() { - session.terminate(); - } - - /** - * @see java.lang.Process#exitValue() - */ - @Override - public int exitValue() { - return session.getGDBProcess().exitValue(); - } - - /** - * @see java.lang.Process#getErrorStream() - */ - @Override - public InputStream getErrorStream() { - return session.getMILogStream(); - } - - /** - * @see java.lang.Process#getInputStream() - */ - @Override - public InputStream getInputStream() { - return session.getMIConsoleStream(); - } - - /** - * @see java.lang.Process#getOutputStream() - */ - @Override - public OutputStream getOutputStream() { - if (out == null) { - out = new OutputStream() { - StringBuffer buf = new StringBuffer(); - @Override - public void write(int b) throws IOException { - buf.append((char)b); - if (b == '\n') { - post(); - } - } - - // Encapsulate the string sent to gdb in a fake - // command and post it to the TxThread. - public void post() throws IOException { - // Throw away the newline. - String str = buf.toString().trim(); - buf.setLength(0); - Command 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 interpreterexec for stepping operation - // the UI will fall out of step. - // 3- - // Normal Command Line Interface. - boolean secondary = session.inSecondaryPrompt(); - if (secondary) { - cmd = new RawCommand(str); - } else if (session.useExecConsole() && str.length() > 0 - && !CLIProcessor.isSteppingOperation(str)) { - CommandFactory factory = session.getCommandFactory(); - cmd = factory.createMIInterpreterExecConsole(str); - } else { - cmd = new CLICommand(str); - } - try { - // Do not wait around for the answer. - session.postCommand(cmd, -1); - } catch (MIException e) { - //e.printStackTrace(); - throw new IOException(e.getMessage()); - } - } - }; - } - return out; - } - - /** - * @see java.lang.Process#waitFor() - */ - @Override - public int waitFor() throws InterruptedException { - return session.getGDBProcess().waitFor(); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/TxThread.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/TxThread.java deleted file mode 100644 index 5e8b5074503..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/TxThread.java +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core; - -import java.io.IOException; -import java.io.OutputStream; - -import org.eclipse.cdt.debug.mi.core.command.CLICommand; -import org.eclipse.cdt.debug.mi.core.command.Command; -import org.eclipse.cdt.debug.mi.core.command.MIInterpreterExecConsole; -import org.eclipse.cdt.debug.mi.core.command.RawCommand; - -/** - * Transmission command thread blocks on the command Queue - * and wake cmd are available and push them to gdb out channel. - */ -public class TxThread extends Thread { - - MISession session; - CLIProcessor cli; - - public TxThread(MISession s) { - super("MI TX Thread"); //$NON-NLS-1$ - session = s; - cli = new CLIProcessor(session); - } - - @Override - public void run () { - try { - - // signal by the session of time to die. - OutputStream out; - while ((out = session.getChannelOutputStream()) != null) { - Command cmd = null; - CommandQueue txQueue = session.getTxQueue(); - // removeCommand() will block until a command is available. - try { - cmd = txQueue.removeCommand(); - } catch (InterruptedException e) { - //e.printStackTrace(); - } - - if (cmd != null) { - String str = cmd.toString(); - // if string is empty consider as a noop - if (str.length() > 0) { - // Move to the RxQueue only if RxThread is alive. - Thread rx = session.getRxThread(); - if (rx != null && rx.isAlive() && !(cmd instanceof RawCommand)) { - CommandQueue rxQueue = session.getRxQueue(); - rxQueue.addCommand(cmd); - } else { - // The RxThread is not running - synchronized (cmd) { - cmd.notifyAll(); - } - } - - // Process the Command line to recognise patterns we may need to fire event. - if (cmd instanceof CLICommand) { - cli.processStateChanges((CLICommand)cmd); - } else if (cmd instanceof MIInterpreterExecConsole) { - cli.processStateChanges((MIInterpreterExecConsole)cmd); - } - - // shove in the pipe - if (out != null) { - out.write(str.getBytes()); - out.flush(); - } - } else { - // String is empty consider as a noop - synchronized (cmd) { - cmd.notifyAll(); - } - } - } - } - } catch (IOException e) { - //e.printStackTrace(); - } - - // Clear the queue and notify any command waiting, we are going down. - CommandQueue txQueue = session.getTxQueue(); - if (txQueue != null) { - Command[] cmds = txQueue.clearCommands(); - for (int i = 0; i < cmds.length; i++) { - synchronized (cmds[i]) { - cmds[i].notifyAll(); - } - } - } - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLICatch.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLICatch.java deleted file mode 100644 index 3b4dc728771..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLICatch.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.CLICatchInfo; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; - - - -/** - * Gdb catch command - */ -public class CLICatch extends CLICommand { - - MIOutput out; - - public CLICatch(String event, String arg) { - super("catch " + event + ' ' +arg); //$NON-NLS-1$ - } - - /** - * This command return breakpoint inserted - */ - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new CLICatchInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLICommand.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLICommand.java deleted file mode 100644 index 7b1db04cbb1..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLICommand.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - - - -/** - * Represents a CLI command. - */ -public class CLICommand extends Command -{ - - String operation = ""; //$NON-NLS-1$ - - public CLICommand(String oper) { - operation = oper; - } - - public void setOperation(String op) { - operation = op; - } - - public String getOperation() { - return operation; - } - - /** - * Returns the text representation of this command. - * - * @return the text representation of this command - */ - @Override - public String toString(){ - String str = getToken() + " " + operation; //$NON-NLS-1$ - if (str.endsWith("\n")) //$NON-NLS-1$ - return str; - return str + "\n"; //$NON-NLS-1$ - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLIExecAbort.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLIExecAbort.java deleted file mode 100644 index e8f8ba38711..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLIExecAbort.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -/** - * - * -exec-finish - * - * Asynchronous command. Resumes the execution of the inferior program - * until the current function is exited. Displays the results returned by - * the function. - * - */ -public class CLIExecAbort extends CLICommand -{ - public CLIExecAbort() { - super("kill"); //$NON-NLS-1$ - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLIHandle.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLIHandle.java deleted file mode 100644 index 77f4167ab6b..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLIHandle.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - - - -/** - * - * handle SIGUSR1 nostop noignore - * - */ -public class CLIHandle extends CLICommand { - - public CLIHandle(String arg) { - super("handle " + arg); //$NON-NLS-1$ - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLIInfoLine.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLIInfoLine.java deleted file mode 100644 index 098b7f7e475..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLIInfoLine.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2012 Nokia and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nokia - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.core.IAddress; -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.CLIInfoLineInfo; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; - -public class CLIInfoLine extends CLICommand { - - public CLIInfoLine(IAddress address) { - super("info line *" + address.toHexAddressString()); //$NON-NLS-1$ - } - - public CLIInfoLineInfo getMIInfoLineInfo() throws MIException { - return (CLIInfoLineInfo)getMIInfo(); - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new CLIInfoLineInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLIInfoProc.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLIInfoProc.java deleted file mode 100644 index 100d58fe551..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLIInfoProc.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2012 ENEA Software AB and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * ENEA Software AB - CLI command extension - fix for bug 190277 - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.CLIInfoProcInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; - -/** - * - * info proc - * - */ -public class CLIInfoProc extends CLICommand -{ - public CLIInfoProc() { - super("info proc"); //$NON-NLS-1$ - } - - public CLIInfoProcInfo getMIInfoProcInfo() throws MIException { - return (CLIInfoProcInfo)getMIInfo(); - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new CLIInfoProcInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLIInfoProgram.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLIInfoProgram.java deleted file mode 100644 index 8284980fd68..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLIInfoProgram.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.CLIInfoProgramInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; - -/** - * - * info threads - * - */ -public class CLIInfoProgram extends CLICommand -{ - public CLIInfoProgram() { - super("info program"); //$NON-NLS-1$ - } - - public CLIInfoProgramInfo getMIInfoProgramInfo() throws MIException { - return (CLIInfoProgramInfo)getMIInfo(); - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new CLIInfoProgramInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLIInfoSharedLibrary.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLIInfoSharedLibrary.java deleted file mode 100644 index e48283fefbe..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLIInfoSharedLibrary.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.CLIInfoSharedLibraryInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; - -/** - * - * info sharedlibrary - * - */ -public class CLIInfoSharedLibrary extends CLICommand -{ - public CLIInfoSharedLibrary() { - super("info sharedlibrary"); //$NON-NLS-1$ - } - - public CLIInfoSharedLibraryInfo getMIInfoSharedLibraryInfo() throws MIException { - return (CLIInfoSharedLibraryInfo)getMIInfo(); - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new CLIInfoSharedLibraryInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLIInfoSignals.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLIInfoSignals.java deleted file mode 100644 index b26650c1245..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLIInfoSignals.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.CLIInfoSignalsInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; - -/** - * - * info threads - * - */ -public class CLIInfoSignals extends CLICommand -{ - public CLIInfoSignals() { - super("info signals"); //$NON-NLS-1$ - } - - public CLIInfoSignals(String name) { - super("info signal " + name); //$NON-NLS-1$ - } - - public CLIInfoSignalsInfo getMIInfoSignalsInfo() throws MIException { - return (CLIInfoSignalsInfo)getMIInfo(); - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new CLIInfoSignalsInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLIInfoThreads.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLIInfoThreads.java deleted file mode 100644 index c555c6bca1e..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLIInfoThreads.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.CLIInfoThreadsInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; - -/** - * - * info threads - * - */ -public class CLIInfoThreads extends CLICommand -{ - public CLIInfoThreads() { - super("info threads"); //$NON-NLS-1$ - } - - public CLIInfoThreadsInfo getMIInfoThreadsInfo() throws MIException { - return (CLIInfoThreadsInfo)getMIInfo(); - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new CLIInfoThreadsInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLIJump.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLIJump.java deleted file mode 100644 index ebcbb3352e9..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLIJump.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.output.MIOutput; -import org.eclipse.cdt.debug.mi.core.output.MIResultRecord; - - -/** - * - * jump LINESPEC - * - */ -public class CLIJump extends CLICommand { - - MIOutput out; - - public CLIJump(String loc) { - super("jump " + loc); //$NON-NLS-1$ - } - - /** - * This is a CLI command contraly to - * the -exec-continue or -exec-run - * it does not return so we have to fake - * a return value. We return "^running" - */ - @Override - public MIOutput getMIOutput() { - if (out == null) { - out = new MIOutput(); - MIResultRecord rr = new MIResultRecord(); - rr.setToken(getToken()); - rr.setResultClass(MIResultRecord.RUNNING); - out.setMIResultRecord(rr); - } - return out; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLIPType.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLIPType.java deleted file mode 100644 index 68d14e7c59b..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLIPType.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; -import org.eclipse.cdt.debug.mi.core.output.CLIPTypeInfo; - -/** - * - * ptype type - * - */ -public class CLIPType extends CLICommand -{ - public CLIPType(String var) { - super("ptype " + var); //$NON-NLS-1$ - } - - public CLIPTypeInfo getMIPtypeInfo() throws MIException { - return (CLIPTypeInfo)getMIInfo(); - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new CLIPTypeInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLISharedLibrary.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLISharedLibrary.java deleted file mode 100644 index 0e0c769a6e3..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLISharedLibrary.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - - - -/** - * - * sharedlibrary filename - * - */ -public class CLISharedLibrary extends CLICommand { - - public CLISharedLibrary() { - super("sharedlibrary"); //$NON-NLS-1$ - } - - public CLISharedLibrary(String name) { - super("sharedlibrary " + name); //$NON-NLS-1$ - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLISignal.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLISignal.java deleted file mode 100644 index b8ba98e8da6..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLISignal.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.output.MIOutput; -import org.eclipse.cdt.debug.mi.core.output.MIResultRecord; - - - -/** - * - * signal SIGUSR1 - * - */ -public class CLISignal extends CLICommand { - - MIOutput out; - - public CLISignal(String arg) { - super("signal " + arg); //$NON-NLS-1$ - } - - /** - * This is a CLI command contraly to - * the -exec-continue or -exec-run - * it does not return so we have to fake - * a return value. We return "^running" - */ - @Override - public MIOutput getMIOutput() { - if (out == null) { - out = new MIOutput(); - MIResultRecord rr = new MIResultRecord(); - rr.setToken(getToken()); - rr.setResultClass(MIResultRecord.RUNNING); - out.setMIResultRecord(rr); - } - return out; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLITargetAttach.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLITargetAttach.java deleted file mode 100644 index c49ac888d4f..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLITargetAttach.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -/** - * - * - * -target-attach PID | FILE - * - * Attach to a process PID or a file FILE outside of GDB. - * - */ -public class CLITargetAttach extends CLICommand -{ - public CLITargetAttach(int pid) { - super("attach " + Integer.toString(pid)); //$NON-NLS-1$ - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLIWhatis.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLIWhatis.java deleted file mode 100644 index 48910c79b51..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CLIWhatis.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; -import org.eclipse.cdt.debug.mi.core.output.CLIWhatisInfo; - -/** - * - * whatis type - * - */ -public class CLIWhatis extends CLICommand -{ - public CLIWhatis(String var) { - super("whatis " + var); //$NON-NLS-1$ - } - - public CLIWhatisInfo getMIWhatisInfo() throws MIException { - return (CLIWhatisInfo)getMIInfo(); - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new CLIWhatisInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/Command.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/Command.java deleted file mode 100644 index 57bbac729e1..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/Command.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MILogStreamOutput; -import org.eclipse.cdt.debug.mi.core.output.MIOOBRecord; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; -import org.eclipse.cdt.debug.mi.core.output.MIStreamRecord; - -/** - * A base class for all mi requests. - */ -public abstract class Command -{ - private static int globalCounter; - - int token = 0; - MIOutput output; - boolean quiet = false; - - /** - * 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 static synchronized int getUniqToken() { - int count = ++globalCounter; - // If we ever wrap around. - if (count <= 0) { - count = globalCounter = 1; - } - return count; - } - - /** - * Returns the identifier of this request. - * - * @return the identifier of this request - */ - public int getToken() { - if (token == 0) { - token = getUniqToken(); - } - return token; - } - -// public void setToken(int token) { -// this.token = token; -// } - - public MIOutput getMIOutput() { - return output; - } - - public void setMIOutput(MIOutput mi) { - output = mi; - } - - /** - * Parse the MIOutput generate after posting the command. - */ - public MIInfo getMIInfo () throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new MIInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } - - /** - * throw an MIException. - */ - protected void throwMIException (MIInfo info, MIOutput out) throws MIException { - String mesg = info.getErrorMsg().trim(); - StringBuffer sb = new StringBuffer(); - MIOOBRecord[] oobs = out.getMIOOBRecords(); - for (int i = 0; i < oobs.length; i++) { - if (oobs[i] instanceof MILogStreamOutput) { - MIStreamRecord o = (MIStreamRecord) oobs[i]; - String s = o.getString(); - if (!s.trim().equalsIgnoreCase(mesg)) { - sb.append(s); - } - } - } - String details = sb.toString(); - if (details.trim().length() == 0) { - details = mesg; - } - throw new MIException(mesg, details); - } - - public boolean isQuiet() { - return this.quiet; - } - - public void setQuiet( boolean quiet ) { - this.quiet = quiet; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java deleted file mode 100644 index 61ed6871aff..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java +++ /dev/null @@ -1,469 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2011 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - * ENEA Software AB - CLI command extension - fix for bug 190277 - * Marc Khouzam (Ericsson) - New methods for new MIDataDisassemble (Bug 357073) - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import java.io.File; -import java.io.IOException; - -import org.eclipse.cdt.core.IAddress; -import org.eclipse.cdt.debug.mi.core.MIProcess; -import org.eclipse.cdt.debug.mi.core.MIProcessAdapter; -import org.eclipse.core.runtime.IProgressMonitor; - - -/** - * Factory to create GDB commands. - */ -public class CommandFactory { - - String fMIVersion; - - protected CommandFactory() { - } - - public CommandFactory(String miVersion) { - fMIVersion = miVersion; - } - - public void setMIVersion(String miVersion) { - fMIVersion = miVersion; - } - - public String getMIVersion() { - return fMIVersion; - } - - public MIBreakAfter createMIBreakAfter(int brknum, int count) { - return new MIBreakAfter(getMIVersion(), brknum, count); - } - - public MIBreakCondition createMIBreakCondition (int brknum, String expr) { - return new MIBreakCondition(getMIVersion(), brknum, expr); - } - - public MIBreakDelete createMIBreakDelete (int[] brknum) { - return new MIBreakDelete(getMIVersion(), brknum); - } - - public MIBreakDisable createMIBreakDisable(int[] brknum) { - return new MIBreakDisable(getMIVersion(), brknum); - } - - public MIBreakEnable createMIBreakEnable(int[] brknum) { - return new MIBreakEnable(getMIVersion(), brknum); - } - - public MIBreakInsert createMIBreakInsert(boolean isTemporary, boolean isHardware, - String condition, int ignoreCount, String line, int tid) { - return new MIBreakInsert(getMIVersion(), isTemporary, isHardware, condition, ignoreCount, line, tid); - } - - public MIBreakInsert createMIBreakInsert(String func) { - return new MIBreakInsert(getMIVersion(), func); - } - - public MIBreakList createMIBreakList() { - return new MIBreakList(getMIVersion()); - } - - public MIBreakWatch createMIBreakWatch(boolean access, boolean read, String expression) { - return new MIBreakWatch(getMIVersion(), access, read, expression); - } - - public CLICatch createCLICatch(String event, String arg) { - return new CLICatch(event, arg); - } - - public MIDataDisassemble createMIDataDisassemble(String start, String end, boolean mixed) { - return new MIDataDisassemble(getMIVersion(), start, end, mixed); - } - - /** @since 7.2 */ - public MIDataDisassemble createMIDataDisassemble(String start, String end, int mode) { - return new MIDataDisassemble(getMIVersion(), start, end, mode); - } - - public MIDataDisassemble createMIDataDisassemble(String file, int linenum, int lines, boolean mixed) { - return new MIDataDisassemble(getMIVersion(), file, linenum, lines, mixed); - } - - /** @since 7.2 */ - public MIDataDisassemble createMIDataDisassemble(String file, int linenum, int lines, int mode) { - return new MIDataDisassemble(getMIVersion(), file, linenum, lines, mode); - } - - public MIDataEvaluateExpression createMIDataEvaluateExpression(String expression) { - return new MIDataEvaluateExpression(getMIVersion(), expression); - } - - public MIDataListChangedRegisters createMIDataListChangedRegisters() { - return new MIDataListChangedRegisters(getMIVersion()); - } - - public MIDataListRegisterNames createMIDataListRegisterNames() { - return new MIDataListRegisterNames(getMIVersion()); - } - - public MIDataListRegisterNames createMIDataListRegisterNames(int[] regnos) { - return new MIDataListRegisterNames(getMIVersion(), regnos); - } - - public MIDataListRegisterValues createMIDataListRegisterValues(int fmt, int[] regnos) { - return new MIDataListRegisterValues(getMIVersion(), fmt, regnos); - } - - public MIDataWriteRegisterValues createMIDataWriteRegisterValues(int fmt, int[] regnos, String[] values) { - return new MIDataWriteRegisterValues(getMIVersion(), fmt, regnos, values); - } - - public MIDataReadMemory createMIDataReadMemory(long offset, String address, - int wordFormat, int wordSize, - int rows, int cols, Character asChar) { - return new MIDataReadMemory(getMIVersion(), offset, address, wordFormat, wordSize, - rows, cols, asChar); - } - - public MIDataWriteMemory createMIDataWriteMemory(long offset, String address, - int wordFormat, int wordSize, - String value) { - return new MIDataWriteMemory(getMIVersion(), offset, address, wordFormat, wordSize, value); - } - - public MIEnvironmentCD createMIEnvironmentCD(String pathdir) { - return new MIEnvironmentCD(getMIVersion(), pathdir); - } - - public MIEnvironmentDirectory createMIEnvironmentDirectory(boolean reset, String[] pathdirs) { - return new MIEnvironmentDirectory(getMIVersion(), reset, pathdirs); - } - - public MIEnvironmentPath createMIEnvironmentPath(String[] paths) { - return new MIEnvironmentPath(getMIVersion(), paths); - } - - public MIEnvironmentPWD createMIEnvironmentPWD() { - return new MIEnvironmentPWD(getMIVersion()); - } - - /** - * @param params - * @return - */ - public MIGDBSetEnvironment createMIGDBSetEnvironment(String[] params) { - return new MIGDBSetEnvironment(getMIVersion(), params); - } - - public CLIExecAbort createCLIExecAbort() { - return new CLIExecAbort(); - } - - public MIExecArguments createMIExecArguments(String[] args) { - return new MIExecArguments(getMIVersion(), args); - } - - public MIExecContinue createMIExecContinue() { - return new MIExecContinue(getMIVersion()); - } - - public MIExecFinish createMIExecFinish() { - return new MIExecFinish(getMIVersion()); - } - - public MIExecInterrupt createMIExecInterrupt() { - // return null here to signal that we do not support - // -exec-interrupt and to use to drop a signal to gdb - // instead via the MIProcess class - return null; - } - - public MIExecNext createMIExecNext(int count) { - return new MIExecNext(getMIVersion(), count); - } - - public MIExecNextInstruction createMIExecNextInstruction(int count) { - return new MIExecNextInstruction(getMIVersion(), count); - } - - public MIExecReturn createMIExecReturn() { - return new MIExecReturn(getMIVersion()); - } - - public MIExecReturn createMIExecReturn(String arg) { - return new MIExecReturn(getMIVersion(), arg); - } - - public MIExecRun createMIExecRun(String[] args) { - return new MIExecRun(getMIVersion(), args); - } - - public MIExecStep createMIExecStep(int count) { - return new MIExecStep(getMIVersion(), count); - } - - public MIExecStepInstruction createMIExecStepInstruction(int count) { - return new MIExecStepInstruction(getMIVersion(), count); - } - - public MIExecUntil createMIExecUntil(String location) { - return new MIExecUntil(getMIVersion(), location); - } - - public CLIJump createCLIJump(String location) { - return new CLIJump(location); - } - - public MIFileExecFile createMIFileExecFile(String file) { - return new MIFileExecFile(getMIVersion(), file); - } - - public MIFileSymbolFile createMIFileSymbolFile(String file) { - return new MIFileSymbolFile(getMIVersion(), file); - } - - public MIGDBExit createMIGDBExit() { - return new MIGDBExit(getMIVersion()); - } - - public MIGDBSet createMIGDBSet(String[] params) { - return new MIGDBSet(getMIVersion(), params); - } - - public MIGDBSetAutoSolib createMIGDBSetAutoSolib(boolean set) { - return new MIGDBSetAutoSolib(getMIVersion(), set); - } - - public MIGDBSetStopOnSolibEvents createMIGDBSetStopOnSolibEvents(boolean set) { - return new MIGDBSetStopOnSolibEvents(getMIVersion(), set); - } - - public MIGDBSetSolibSearchPath createMIGDBSetSolibSearchPath(String[] params) { - return new MIGDBSetSolibSearchPath(getMIVersion(), params); - } - - public MIGDBSetBreakpointPending createMIGDBSetBreakpointPending(boolean set) { - return new MIGDBSetBreakpointPending(getMIVersion(), set); - } - - public MIGDBShow createMIGDBShow(String[] params) { - return new MIGDBShow(getMIVersion(), params); - } - - public MIGDBShowPrompt createMIGDBShowPrompt() { - return new MIGDBShowPrompt(getMIVersion()); - } - - public MIGDBShowExitCode createMIGDBShowExitCode() { - return new MIGDBShowExitCode(getMIVersion()); - } - - public MIGDBShowDirectories createMIGDBShowDirectories() { - return new MIGDBShowDirectories(getMIVersion()); - } - - public MIGDBShowSolibSearchPath createMIGDBShowSolibSearchPath() { - return new MIGDBShowSolibSearchPath(getMIVersion()); - } - - public MIGDBShowAddressSize createMIGDBShowAddressSize() { - return new MIGDBShowAddressSize(getMIVersion()); - } - - public MIGDBShowEndian createMIGDBShowEndian() { - return new MIGDBShowEndian(getMIVersion()); - } - - public MIStackInfoDepth createMIStackInfoDepth() { - return new MIStackInfoDepth(getMIVersion()); - } - - public MIStackInfoDepth createMIStackInfoDepth(int depth) { - return new MIStackInfoDepth(getMIVersion(), depth); - } - - public MIStackListArguments createMIStackListArguments(boolean showValue) { - return new MIStackListArguments(getMIVersion(), showValue); - } - - public MIStackListArguments createMIStackListArguments(boolean showValue, int lowFrame, int highFrame) { - return new MIStackListArguments(getMIVersion(), showValue, lowFrame, highFrame); - } - - public MIStackListFrames createMIStackListFrames() { - return new MIStackListFrames(getMIVersion()); - } - - public MIStackListFrames createMIStackListFrames(int lowFrame, int highFrame) { - return new MIStackListFrames(getMIVersion(), lowFrame, highFrame); - } - - public MIStackListLocals createMIStackListLocals(boolean showValues) { - return new MIStackListLocals(getMIVersion(), showValues); - } - - public MIStackSelectFrame createMIStackSelectFrame(int frameNum) { - return new MIStackSelectFrame(getMIVersion(), frameNum); - } - - public CLITargetAttach createCLITargetAttach(int pid) { - return new CLITargetAttach(pid); - } - - public MITargetDetach createMITargetDetach() { - return new MITargetDetach(getMIVersion()); - } - - public MITargetDownload createMITargetDownload(String file) { - return new MITargetDownload(getMIVersion(), file); - } - - public MITargetSelect createMITargetSelect(String[] params) { - return new MITargetSelect(getMIVersion(), params); - } - - public MIThreadListIds createMIThreadListIds() { - return new MIThreadListIds(getMIVersion()); - } - - public CLIInfoThreads createCLIInfoThreads() { - return new CLIInfoThreads(); - } - - public MIThreadSelect createMIThreadSelect(int threadNum) { - return new MIThreadSelect(getMIVersion(), threadNum); - } - - public CLIInfoSharedLibrary createCLIInfoSharedLibrary() { - return new CLIInfoSharedLibrary(); - } - - public CLISharedLibrary createCLISharedLibrary() { - return new CLISharedLibrary(); - } - - public CLISharedLibrary createCLISharedLibrary(String name) { - return new CLISharedLibrary(name); - } - - public CLIWhatis createCLIWhatis(String name) { - return new CLIWhatis(name); - } - - public CLIInfoSignals createCLIInfoSignals() { - return new CLIInfoSignals(); - } - - public CLIInfoSignals createCLIInfoSignals(String name) { - return new CLIInfoSignals(name); - } - - public CLIHandle createCLIHandle(String arg) { - return new CLIHandle(arg); - } - - public CLISignal createCLISignal(String arg) { - return new CLISignal(arg); - } - - public CLIPType createCLIPType(String name) { - return new CLIPType(name); - } - - public CLIInfoProc createCLIInfoProc() { - return new CLIInfoProc(); - } - - public CLIInfoProgram createCLIInfoProgram() { - return new CLIInfoProgram(); - } - - public CLIInfoLine createCLIInfoLine(IAddress address) { - return new CLIInfoLine(address); - } - - public MIVarCreate createMIVarCreate(String expression) { - return new MIVarCreate(getMIVersion(), expression); - } - - public MIVarCreate createMIVarCreate(String name, String frameAddr, String expression) { - return new MIVarCreate(getMIVersion(), name, frameAddr, expression); - } - - public MIVarDelete createMIVarDelete(String name) { - return new MIVarDelete(getMIVersion(), name); - } - - public MIVarSetFormat createMIVarSetFormat(String name, int format) { - return new MIVarSetFormat(getMIVersion(), name, format); - } - - public MIVarShowFormat createMIVarShowFormat(String name) { - return new MIVarShowFormat(getMIVersion(), name); - } - - public MIVarInfoNumChildren createMIVarInfoNumChildren(String name) { - return new MIVarInfoNumChildren(getMIVersion(), name); - } - - public MIVarListChildren createMIVarListChildren(String name) { - return new MIVarListChildren(getMIVersion(), name); - } - - public MIVarInfoType createMIVarInfoType(String name) { - return new MIVarInfoType(getMIVersion(), name); - } - - public MIVarInfoExpression createMIVarInfoExpression(String name) { - return new MIVarInfoExpression(getMIVersion(), name); - } - - public MIVarShowAttributes createMIVarShowAttributes(String name) { - return new MIVarShowAttributes(getMIVersion(), name); - } - - public MIVarEvaluateExpression createMIVarEvaluateExpression(String name) { - return new MIVarEvaluateExpression(getMIVersion(), name); - } - - public MIVarAssign createMIVarAssign(String name, String expr) { - return new MIVarAssign(getMIVersion(), name, expr); - } - - public MIVarUpdate createMIVarUpdate() { - return new MIVarUpdate(getMIVersion()); - } - - public MIVarUpdate createMIVarUpdate(String name) { - return new MIVarUpdate(getMIVersion(), name); - } - - public MIInterpreterExecConsole createMIInterpreterExecConsole(String cmd) { - return new MIInterpreterExecConsole(getMIVersion(), cmd); - } - - public MIGDBSetNewConsole createMIGDBSetNewConsole() { - return new MIGDBSetNewConsole(getMIVersion()); - } - - public MIInfoSharedLibrary createMIInfoSharedLibrary() { - return null; - } - - public String getWorkingDirectory(File cwd) { - return "--cd=" + cwd.getAbsolutePath(); //$NON-NLS-1$ - } - - public MIProcess createMIProcess(String[] args, int launchTimeout, IProgressMonitor monitor) throws IOException { - return new MIProcessAdapter(args, launchTimeout, monitor); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIBreakAfter.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIBreakAfter.java deleted file mode 100644 index 781dea80b15..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIBreakAfter.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - - - -/** - * - * -break-after NUMBER COUNT - * The breakpoint number NUMBER is not in effect until it has been hit - * COUNT times. - * - * Result: - * ^done - * - */ -public class MIBreakAfter extends MICommand -{ - public MIBreakAfter(String miVersion, int brknum, int count) { - super(miVersion, "-break-after",new String[]{Integer.toString(brknum), //$NON-NLS-1$ - Integer.toString(count)}); - - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIBreakCondition.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIBreakCondition.java deleted file mode 100644 index 2b95bf1b203..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIBreakCondition.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -/** - * - * - * -break-condition NUMBER EXPR - * - * Breakpoint NUMBER will stop the program only if the condition in - * EXPR is true. The condition becomes part of the `-break-list' output - * Result: - * ^done - */ -public class MIBreakCondition extends MICommand { - public MIBreakCondition(String miVersion, int brknum, String expr) { - super(miVersion, "-break-condition", new String[] { Integer.toString(brknum), expr }); //$NON-NLS-1$ - } - - /** - * Do not do any munging on the string i.e. quoting spaces - * etc .. doing this will break the command -break-condition. - */ - @Override - protected String parametersToString() { - String[] parameters = getParameters(); - StringBuffer buffer = new StringBuffer(); - for (int i = 0; i < parameters.length; i++) { - buffer.append(' ').append(parameters[i]); - } - return buffer.toString().trim(); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIBreakDelete.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIBreakDelete.java deleted file mode 100644 index 1df2f8608b2..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIBreakDelete.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -/** - * - * -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 -{ - public MIBreakDelete (String miVersion, int[] array) { - super(miVersion, "-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] = Integer.toString(array[i]); - } - setParameters(brkids); - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIBreakDisable.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIBreakDisable.java deleted file mode 100644 index 7962b3f9620..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIBreakDisable.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -/** - * - * -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 -{ - public MIBreakDisable (String miVersion, int[] array) { - super(miVersion, "-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] = Integer.toString(array[i]); - } - setParameters(brkids); - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIBreakEnable.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIBreakEnable.java deleted file mode 100644 index 8ddc4c2e291..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIBreakEnable.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -/** - * - * -break-enable ( BREAKPOINT )+ - * - * Enable (previously disabled) BREAKPOINT(s). - * - * Result: - * ^done - */ -public class MIBreakEnable extends MICommand -{ - public MIBreakEnable (String miVersion, int[] array) { - super(miVersion, "-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] = Integer.toString(array[i]); - } - setParameters(brkids); - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIBreakInsert.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIBreakInsert.java deleted file mode 100644 index c4f31699c12..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIBreakInsert.java +++ /dev/null @@ -1,138 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.MIBreakInsertInfo; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; - -/** - * - * -break-insert [ -t ] [ -h ] [ -r ] - * [ -c CONDITION ] [ -i IGNORE-COUNT ] - * [ -p THREAD ] [ LINE | ADDR ] - * - * If specified, LINE, can be one of: - * - * * function - * - * * filename:linenum - * - * * filename:function - * - * * *address - * - * The possible optional parameters of this command are: - * - * `-t' - * Insert a tempoary breakpoint. - * - * `-h' - * Insert a hardware breakpoint. - * - * `-c CONDITION' - * Make the breakpoint conditional on CONDITION. - * - * `-i IGNORE-COUNT' - * Initialize the IGNORE-COUNT. - * - * `-r' - * - * Insert a regular breakpoint in all the functions whose names match - * the given regular expression. Other flags are not applicable to - * regular expresson. - * - * The result is in the form: - * - * ^done,bkptno="NUMBER",func="FUNCNAME", - * file="FILENAME",line="LINENO" - * - */ -public class MIBreakInsert extends MICommand -{ - public MIBreakInsert(String miVersion, String func) { - this(miVersion, false, false, null, 0, func, 0); - } - - public MIBreakInsert(String miVersion, boolean isTemporary, boolean isHardware, - String condition, int ignoreCount, String line, int tid) { - super(miVersion, "-break-insert"); //$NON-NLS-1$ - - int i = 0; - if (isTemporary) { - i++; - } - if (isHardware) { - i++; - } - if (condition != null && condition.length() > 0) { - i += 2; - } - if (ignoreCount > 0) { - i += 2; - } - if (tid > 0) { - i += 2; - } - String[] opts = new String[i]; - - i = 0; - if (isTemporary) { - opts[i] = "-t"; //$NON-NLS-1$ - i++; - } - if (isHardware) { - opts[i] = "-h"; //$NON-NLS-1$ - i++; - } - if (condition != null && condition.length() > 0) { - 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); - } - - if (opts.length > 0) { - setOptions(opts); - } - setParameters(new String[]{line}); - } - - public MIBreakInsertInfo getMIBreakInsertInfo() throws MIException { - return (MIBreakInsertInfo)getMIInfo(); - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new MIBreakInsertInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIBreakList.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIBreakList.java deleted file mode 100644 index eb5537cb623..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIBreakList.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.MIBreakListInfo; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; - -/** - * - * -break-list - * - * Displays the list of inserted breakpoints, showing the following - * fields: - * - * `Number' - * number of the breakpoint - * - * `Type' - * type of the breakpoint: `breakpoint' or `watchpoint' - * - * `Disposition' - * should the breakpoint be deleted or disabled when it is hit: `keep' - * or `nokeep' - * - * `Enabled' - * is the breakpoint enabled or no: `y' or `n' - * - * `Address' - * memory location at which the breakpoint is set - * - * `What' - * logical location of the breakpoint, expressed by function name, - * - * `Times' - * number of times the breakpoint has been hit - * - * If there are no breakpoints or watchpoints, the `BreakpointTable' - * `body' field is an empty list. - * - */ -public class MIBreakList extends MICommand -{ - public MIBreakList (String miVersion) { - super(miVersion, "-break-list"); //$NON-NLS-1$ - } - - public MIBreakListInfo getMIBreakListInfo() throws MIException { - return (MIBreakListInfo)getMIInfo(); - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new MIBreakListInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIBreakWatch.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIBreakWatch.java deleted file mode 100644 index f566eb23520..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIBreakWatch.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.MIBreakWatchInfo; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; - -/** - * - * -break-watch [ -a | -r ] - * - * Create a watchpoint. With the `-a' option it will create an - * "access" watchpoint, i.e. a watchpoint that triggers either on a read - * from or on a write to the memory location. With the `-r' option, the - * watchpoint created is a "read" watchpoint, i.e. it will trigger only - * when the memory location is accessed for reading. Without either of - * the options, the watchpoint created is a regular watchpoint, i.e. it - * will trigger when the memory location is accessed for writing. - * - */ -public class MIBreakWatch extends MICommand -{ - public MIBreakWatch (String miVersion, boolean access, boolean read, String expr) { - super(miVersion, "-break-watch");//$NON-NLS-1$ - String[] opts = null; - if (access) { - opts = new String[] {"-a"}; //$NON-NLS-1$ - } else if (read) { - opts = new String[] {"-r"}; //$NON-NLS-1$ - } - if (opts != null) { - setOptions(opts); - } - setParameters(new String[]{expr}); - } - - public MIBreakWatchInfo getMIBreakWatchInfo() throws MIException { - return (MIBreakWatchInfo)getMIInfo(); - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new MIBreakWatchInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MICommand.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MICommand.java deleted file mode 100644 index 568f3090aae..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MICommand.java +++ /dev/null @@ -1,206 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2015 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.command; - -/** - * Represents a MI command. - */ -public class MICommand extends Command { - final static String[] empty = {}; - String[] fOptions = empty; - String[] fParameters = empty; - String fOperation = new String(); - String fMIVersion; - - public MICommand(String miVersion, String oper) { - this(miVersion, oper, empty); - } - - public MICommand(String miVersion, String oper, String[] params) { - this(miVersion, oper, empty, params); - } - - public MICommand(String miVersion, String oper, String[] opt, String[] params) { - fMIVersion = miVersion; - fOperation = oper; - fOptions = opt; - fParameters = params; - } - - /** - * Return the MI version for this command - * @return - */ - public String getMIVersion() { - return fMIVersion; - } - - /** - * Set the MI version for this command - * @param miVersion - */ - public void setMIVersion(String miVersion) { - fMIVersion = miVersion; - } - - /** - * whether the MI version is "mi1" - * @return - */ - public boolean isMI1() { - return MIVersion.MI1.equalsIgnoreCase(fMIVersion); - } - - /** - * whether the MI version is "mi2" - * @return - */ - public boolean isMI2() { - return MIVersion.MI2.equalsIgnoreCase(fMIVersion); - } - - /** - * Returns the operation of this command. - * - * @return the operation of this command - */ - public String getOperation() { - return fOperation; - } - - protected void setOperation(String op) { - fOperation = op; - } - - /** - * Returns an array of command's options. An empty collection is - * returned if there are no options. - * - * @return an array of command's options - */ - public String[] getOptions() { - return fOptions; - } - - public void setOptions(String[] opt) { - fOptions = opt; - } - - /** - * Returns an array of command's parameters. An empty collection is - * returned if there are no parameters. - * - * @return an array of command's parameters - */ - public String[] getParameters() { - return fParameters; - } - - public void setParameters(String[] p) { - fParameters = p; - } - - protected String optionsToString() { - String[] options = getOptions(); - StringBuilder sb = new StringBuilder(); - if (options != null && options.length > 0) { - for (int i = 0; i < options.length; i++) { - String option = options[i]; - // If the option argument contains " or \ it must be escaped - if (option.indexOf('"') != -1 || option.indexOf('\\') != -1) { - StringBuilder buf = new StringBuilder(); - for (int j = 0; j < option.length(); j++) { - char c = option.charAt(j); - if (c == '"' || c == '\\') { - buf.append('\\'); - } - buf.append(c); - } - option = buf.toString(); - } - - // If the option contains a space according to - // GDB/MI spec we must surround it with double quotes. - if (option.indexOf('\t') != -1 || option.indexOf(' ') != -1) { - sb.append(' ').append('"').append(option).append('"'); - } else { - sb.append(' ').append(option); - } - } - } - return sb.toString().trim(); - } - - protected String parametersToString() { - String[] parameters = getParameters(); - String[] options = getOptions(); - StringBuilder buffer = new StringBuilder(); - if (parameters != null && parameters.length > 0) { - // According to GDB/MI spec - // Add a "--" separator if any parameters start with "-" - if (options != null && options.length > 0) { - for (int i = 0; i < parameters.length; i++) { - if (parameters[i].startsWith("-")) { //$NON-NLS-1$ - buffer.append('-').append('-'); - break; - } - } - } - - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < parameters.length; i++) { - // We need to escape the double quotes and the backslash. - sb.setLength(0); - String param = parameters[i]; - for (int j = 0; j < param.length(); j++) { - char c = param.charAt(j); - if (c == '"' || c == '\\') { - sb.append('\\'); - } - sb.append(c); - } - - // If the string contains spaces instead of escaping - // surround the parameter with double quotes. - if (containsWhitespace(param)) { - sb.insert(0, '"'); - sb.append('"'); - } - buffer.append(' ').append(sb); - } - } - return buffer.toString().trim(); - } - - @Override - public String toString() { - StringBuilder command = new StringBuilder(getToken() + getOperation()); - String opt = optionsToString(); - if (opt.length() > 0) { - command.append(' ').append(opt); - } - String p = parametersToString(); - if (p.length() > 0) { - command.append(' ').append(p); - } - command.append('\n'); - return command.toString(); - } - - protected boolean containsWhitespace(String s) { - for (int i = 0; i < s.length(); i++) { - if (Character.isWhitespace(s.charAt(i))) { - return true; - } - } - return false; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIDataDisassemble.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIDataDisassemble.java deleted file mode 100644 index 2d53e49c485..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIDataDisassemble.java +++ /dev/null @@ -1,145 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - * Daniel Thomas (Broadcom corp.) - Added support for mode 2 and 3 (Bug 357073) - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.MIDataDisassembleInfo; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; - -/** - * - * -data-disassemble - * [ -s START-ADDR -e END-ADDR ] - * | [ -f FILENAME -l LINENUM [ -n LINES ] ] - * -- MODE - * - *Where: - * - *`START-ADDR' - * is the beginning address (or `$pc') - * - *`END-ADDR' - * is the end address - * - *`FILENAME' - * is the name of the file to disassemble - * - *`LINENUM' - * is the line number to disassemble around - * - *`LINES' - * is the the number of disassembly lines to be produced. If it is - * -1, the whole function will be disassembled, in case no END-ADDR is - * specified. If END-ADDR is specified as a non-zero value, and - * LINES is lower than the number of disassembly lines between - * START-ADDR and END-ADDR, only LINES lines are displayed; if LINES - * is higher than the number of lines between START-ADDR and - * END-ADDR, only the lines up to END-ADDR are displayed. - * - *`MODE' - * - 0 disassembly - * - 1 mixed source and disassembly - * - 2 disassembly with raw opcodes - * - 3 mixed source and disassembly with raw opcodes - * Note: Modes 2 and 3 are only available starting with GDB 7.3 - * - *Result - *...... - * - * The output for each instruction is composed of four fields: - * - * * Address - * - * * Func-name - * - * * Offset - * - * * Instruction - * - * Note that whatever included in the instruction field, is not - *manipulated directly by GDB/MI, i.e. it is not possible to adjust its - *format. - * - * - */ -public class MIDataDisassemble extends MICommand -{ - private static final int MIN_MODE = 0; - private static final int MAX_MODE = 3; - private static final String MODE_OUT_OF_RANGE = "Mode out of range: "; //$NON-NLS-1$ - - public MIDataDisassemble(String miVersion, String start, String end, boolean mode) { - this(miVersion, start, end, mode ? 1 : 0); - } - - /** @since 7.2 */ - public MIDataDisassemble(String miVersion, String start, String end, int mode) { - super(miVersion, "-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); - } - } - - public MIDataDisassemble(String miVersion, String file, int linenum, int lines, boolean mode) { - this(miVersion, file, linenum, lines, mode ? 1 : 0); - } - - /** @since 7.2 */ - public MIDataDisassemble(String miVersion, String file, int linenum, int lines, int mode) { - super(miVersion, "-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); - } - } - - public MIDataDisassembleInfo getMIDataDisassembleInfo() throws MIException { - return (MIDataDisassembleInfo)getMIInfo(); - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new MIDataDisassembleInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } - - /* - * GDB the -data-disassemble uses "--" as a separator wit 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 new String(); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIDataEvaluateExpression.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIDataEvaluateExpression.java deleted file mode 100644 index 92b6baea819..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIDataEvaluateExpression.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.MIDataEvaluateExpressionInfo; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; - -/** - * - * -data-evaluate-expression EXPR - * - * Evaluate EXPR as an expression. The expression could contain an - *inferior function call. The function call will execute synchronously. - *If the expression contains spaces, it must be enclosed in double quotes. - * - */ -public class MIDataEvaluateExpression extends MICommand -{ - public MIDataEvaluateExpression(String miVersion, String expr) { - super(miVersion, "-data-evaluate-expression", new String[]{expr}); //$NON-NLS-1$ - } - - public MIDataEvaluateExpressionInfo getMIDataEvaluateExpressionInfo() throws MIException { - return (MIDataEvaluateExpressionInfo)getMIInfo(); - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new MIDataEvaluateExpressionInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIDataListChangedRegisters.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIDataListChangedRegisters.java deleted file mode 100644 index 3200011e4c7..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIDataListChangedRegisters.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.MIDataListChangedRegistersInfo; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; - -/** - * - * -data-list-changed-registers - * - * Display a list of the registers that have changed. - * - */ -public class MIDataListChangedRegisters extends MICommand -{ - public MIDataListChangedRegisters(String miVersion) { - super(miVersion, "-data-list-changed-registers" ); //$NON-NLS-1$ - } - - public MIDataListChangedRegistersInfo getMIDataListChangedRegistersInfo() throws MIException { - return (MIDataListChangedRegistersInfo)getMIInfo(); - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new MIDataListChangedRegistersInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIDataListRegisterNames.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIDataListRegisterNames.java deleted file mode 100644 index ee573a9eca7..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIDataListRegisterNames.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.MIDataListRegisterNamesInfo; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; - -/** - * - * -data-list-register-names [ ( REGNO )+ ] - * - * Show a list of register names for the current target. If no - * arguments are given, it shows a list of the names of all the registers. - * If integer numbers are given as arguments, it will print a list of the - * names of the registers corresponding to the arguments. To ensure - * consistency between a register name and its number, the output list may - * include empty register names. - * - */ -public class MIDataListRegisterNames extends MICommand -{ - public MIDataListRegisterNames(String miVersion) { - super(miVersion, "-data-list-register-names"); //$NON-NLS-1$ - } - - public MIDataListRegisterNames(String miVersion, int [] regnos) { - this(miVersion); - 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 MIDataListRegisterNamesInfo getMIDataListRegisterNamesInfo() throws MIException { - return (MIDataListRegisterNamesInfo)getMIInfo(); - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new MIDataListRegisterNamesInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIDataListRegisterValues.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIDataListRegisterValues.java deleted file mode 100644 index 038d19f872d..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIDataListRegisterValues.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.MIFormat; -import org.eclipse.cdt.debug.mi.core.output.MIDataListRegisterValuesInfo; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.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 - * missing list of numbers indicates that the contents of all the - * registers must be returned. - * - */ -public class MIDataListRegisterValues extends MICommand -{ - public MIDataListRegisterValues(String miVersion, int fmt) { - this(miVersion, fmt, null); - } - - public MIDataListRegisterValues(String miVersion, int fmt, int [] regnos) { - super(miVersion, "-data-list-register-values"); //$NON-NLS-1$ - - 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: - default: - format = "x"; //$NON-NLS-1$ - break; - } - - 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 MIDataListRegisterValuesInfo getMIDataListRegisterValuesInfo() throws MIException { - return (MIDataListRegisterValuesInfo)getMIInfo(); - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new MIDataListRegisterValuesInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIDataReadMemory.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIDataReadMemory.java deleted file mode 100644 index 33b1bcee87b..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIDataReadMemory.java +++ /dev/null @@ -1,154 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.MIFormat; -import org.eclipse.cdt.debug.mi.core.output.MIDataReadMemoryInfo; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.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' - * - * - */ -public class MIDataReadMemory extends MICommand { - - public MIDataReadMemory( - String miVersion, - long offset, - String address, - int wordFormat, - int wordSize, - int rows, - int cols, - Character asChar) { - super(miVersion, "-data-read-memory"); //$NON-NLS-1$ - if (offset != 0) { - 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 : - 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 : - default : - format = "x"; //$NON-NLS-1$ - break; - } - - if (asChar == null) { - setParameters( - new String[] { - address, - format, - Integer.toString(wordSize), - Integer.toString(rows), - Integer.toString(cols)}); - } else { - setParameters( - new String[] { - address, - format, - Integer.toString(wordSize), - Integer.toString(rows), - Integer.toString(cols), - asChar.toString()}); - } - } - - public MIDataReadMemoryInfo getMIDataReadMemoryInfo() throws MIException { - return (MIDataReadMemoryInfo)getMIInfo(); - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new MIDataReadMemoryInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIDataWriteMemory.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIDataWriteMemory.java deleted file mode 100644 index cbb75c377a6..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIDataWriteMemory.java +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIFormat; - -/** - * - * -data-write-memory [-o COLUMN_OFFSET] ADDR FORMAT WORD-SIZE VALUE."); - * - * where: - * - * DATA-MEMORY-WRITE: - * - * COLUMN_OFFSET: optional argument. Must be preceeded by '-o'. The - * offset from the beginning of the memory grid row where the cell to - * be written is. - * ADDR: start address of the row in the memory grid where the memory - * cell is, if OFFSET_COLUMN is specified. Otherwise, the address of - * the location to write to. - * FORMAT: a char indicating format for the ``word''. See - * the ``x'' command. - * WORD_SIZE: size of each ``word''; 1,2,4, or 8 bytes - * VALUE: value to be written into the memory address. - * - * Writes VALUE into ADDR + (COLUMN_OFFSET * WORD_SIZE). - * - * Prints nothing. - * - */ -public class MIDataWriteMemory extends MICommand { - - public MIDataWriteMemory(String miVersion, long offset, String address, int wordFormat, int wordSize, - String value) { - - super (miVersion, "-data-write-memory"); //$NON-NLS-1$ - - if (offset != 0) { - 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 : - 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 : - default : - format = "x"; //$NON-NLS-1$ - break; - } - - setParameters(new String[] {address, format, Integer.toString(wordSize), value}); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIDataWriteRegisterValues.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIDataWriteRegisterValues.java deleted file mode 100644 index f9c9a813f52..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIDataWriteRegisterValues.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.cdt.debug.mi.core.MIFormat; - -/** - * - * Write given values into registers. The registers and values are - * given as pairs. The corresponding MI command is - * -data-write-register-values <format> [<regnum1> <value1>...<regnumN> <valueN>] - * - */ -public class MIDataWriteRegisterValues extends MICommand { - - public MIDataWriteRegisterValues(String miVersion, int fmt, int[] regnos, String[] values) { - super(miVersion, "-data-write-register-values"); //$NON-NLS-1$ - - 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: - default: - format = "x"; //$NON-NLS-1$ - break; - } - - setOptions(new String[]{format}); - - if (regnos != null && values != null) { - List aList = new ArrayList(regnos.length); - for (int i = 0; i < regnos.length && i < values.length; i++) { - aList.add(Integer.toString(regnos[i])); - aList.add(values[i]); - } - String[] array = (String[])aList.toArray(new String[0]); - setParameters(array); - } - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIEnvironmentCD.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIEnvironmentCD.java deleted file mode 100644 index 45ba9c57efa..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIEnvironmentCD.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2010 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -/** - * - * - * -environment-cd PATHDIR - * - * Set GDB's working directory. - * - * - */ -public class MIEnvironmentCD extends MICommand -{ - public MIEnvironmentCD(String miVersion, String path) { - super(miVersion, "-environment-cd", new String[]{path}); //$NON-NLS-1$ - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIEnvironmentDirectory.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIEnvironmentDirectory.java deleted file mode 100644 index f91b751412f..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIEnvironmentDirectory.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -/** - * - * -environment-directory PATHDIR - * - * Add directory PATHDIR to beginning of search path for source files. - * - */ -public class MIEnvironmentDirectory extends MICommand -{ - public MIEnvironmentDirectory(String miVersion, boolean reset, String[] paths) { - super(miVersion, "-environment-directory", paths); //$NON-NLS-1$ - if (isMI2()) { - // earlier version do no accept the "-r" option. - if (reset) { - setOptions(new String[] {"-r"}); //$NON-NLS-1$ - } - } - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIEnvironmentPWD.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIEnvironmentPWD.java deleted file mode 100644 index 6b2b298d0eb..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIEnvironmentPWD.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.MIEnvironmentPWDInfo; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; - -/** - * - * -environment-pwd - * - * Show the current working directory. - * - */ -public class MIEnvironmentPWD extends MICommand -{ - public MIEnvironmentPWD(String miVersion) { - super(miVersion, "-environment-pwd"); //$NON-NLS-1$ - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new MIEnvironmentPWDInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIEnvironmentPath.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIEnvironmentPath.java deleted file mode 100644 index 6417c2299cb..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIEnvironmentPath.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -/** - * - * -environment-path ( PATHDIR )+ - * - * Add directories PATHDIR to beginning of search path for object files. - * - */ -public class MIEnvironmentPath extends MICommand -{ - public MIEnvironmentPath(String miVersion, String[] paths) { - super(miVersion, "-environment-path", paths); //$NON-NLS-1$ - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecArguments.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecArguments.java deleted file mode 100644 index 5ff5b9a7150..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecArguments.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2013 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -/** - * - * -exec-arguments ARGS - * - * Set the inferior program arguments, to be used in the next - * `-exec-run'. - * - */ -public class MIExecArguments extends MICommand -{ - public MIExecArguments(String miVersion, String[] args) { - super(miVersion, "-exec-arguments", processArguments(args)); //$NON-NLS-1$ - } - - private static String[] processArguments(String[] args) { - String[] result = new String[args.length]; - for (int i = 0; i < result.length; ++i) { - if (args[i].isEmpty()) { - result[i] = "''"; //$NON-NLS-1$ - } - else { - result[i] = args[i]; - } - } - return result; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecContinue.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecContinue.java deleted file mode 100644 index 083b20f132d..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecContinue.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -/** - * - * -exec-continue - * - * Asynchronous command. Resumes the execution of the inferior program - * until a breakpoint is encountered, or until the inferior exits. - * - */ -public class MIExecContinue extends MICommand -{ - public MIExecContinue(String miVersion) { - super(miVersion, "-exec-continue"); //$NON-NLS-1$ - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecFinish.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecFinish.java deleted file mode 100644 index dd5f2c48398..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecFinish.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -/** - * - * -exec-finish - * - * Asynchronous command. Resumes the execution of the inferior program - * until the current function is exited. Displays the results returned by - * the function. - * - */ -public class MIExecFinish extends MICommand -{ - public MIExecFinish(String miVersion) { - super(miVersion, "-exec-finish"); //$NON-NLS-1$ - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecInterrupt.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecInterrupt.java deleted file mode 100644 index 1e0702de0bc..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecInterrupt.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -/** - * - * -exec-interrupt - * - * Asynchronous command. Interrupts the background execution of the - * target. Note how the token associated with the stop message is the one - * for the execution command that has been interrupted. The token for the - * 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 -{ - public MIExecInterrupt(String miVersion) { - super(miVersion, "-exec-interrupt"); //$NON-NLS-1$ - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecNext.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecNext.java deleted file mode 100644 index bf2cca380dd..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecNext.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -/** - * - * -exec-next - * - * Asynchronous command. Resumes execution of the inferior program, - * stopping when the beginning of the next source line is reached. - * - */ -public class MIExecNext extends MICommand -{ - public MIExecNext(String miVersion) { - super(miVersion, "-exec-next"); //$NON-NLS-1$ - } - - public MIExecNext(String miVersion, int count) { - super(miVersion, "-exec-next", new String[] { Integer.toString(count) }); //$NON-NLS-1$ - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecNextInstruction.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecNextInstruction.java deleted file mode 100644 index 9939966b04e..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecNextInstruction.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -/** - * - * -exec-next-instruction - * - * 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 -{ - public MIExecNextInstruction(String miVersion) { - super(miVersion, "-exec-next-instruction"); //$NON-NLS-1$ - } - - public MIExecNextInstruction(String miVersion, int count) { - super(miVersion, "-exec-next-instruction", new String[] { Integer.toString(count) }); //$NON-NLS-1$ - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecReturn.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecReturn.java deleted file mode 100644 index 1da4ebab9de..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecReturn.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -/** - * - * -exec-return - * - * Makes current function return immediately. Doesn't execute the - * inferior. Displays the new current frame. - * - */ -public class MIExecReturn extends MICommand -{ - public MIExecReturn(String miVersion) { - super(miVersion, "-exec-return"); //$NON-NLS-1$ - } - - public MIExecReturn(String miVersion, String arg) { - super(miVersion, "-exec-return", new String[] { arg }); //$NON-NLS-1$ - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecRun.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecRun.java deleted file mode 100644 index 1ac92773191..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecRun.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -/** - * - * -exec-run - * - * Asynchronous command. Starts execution of the inferior from the - * beginning. The inferior executes until either a breakpoint is - * encountered or the program exits. - * - */ -public class MIExecRun extends MICommand -{ - public MIExecRun(String miVersion) { - super(miVersion, "-exec-run"); //$NON-NLS-1$ - } - - public MIExecRun(String miVersion, String[] args) { - super(miVersion, "-exec-run", args); //$NON-NLS-1$ - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecStep.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecStep.java deleted file mode 100644 index 86d2fb9372a..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecStep.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -/** - * - * -exec-step - * - * 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 -{ - public MIExecStep(String miVersion) { - super(miVersion, "-exec-step"); //$NON-NLS-1$ - } - - public MIExecStep(String miVersion, int count) { - super(miVersion, "-exec-step", new String[] { Integer.toString(count) }); //$NON-NLS-1$ - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecStepInstruction.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecStepInstruction.java deleted file mode 100644 index ee4a6927c08..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecStepInstruction.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - - - -/** - * - * -exec-step-instruction - - * Asynchronous command. Resumes the inferior which executes one - * machine instruction. The output, once GDB has stopped, will vary - * 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 -{ - public MIExecStepInstruction(String miVersion) { - super(miVersion, "-exec-step-instruction"); //$NON-NLS-1$ - } - - public MIExecStepInstruction(String miVersion, int count) { - super(miVersion, "-exec-step-instruction", new String[] { Integer.toString(count) }); //$NON-NLS-1$ - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecUntil.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecUntil.java deleted file mode 100644 index 9bce50ab927..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecUntil.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -/** - * - * -exec-until [ LOCATION ] - * - * Asynchronous command. Executes the inferior until the LOCATION - * specified in the argument is reached. If there is no argument, the - * 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 -{ - public MIExecUntil(String miVersion) { - super(miVersion, "-exec-until"); //$NON-NLS-1$ - } - - public MIExecUntil(String miVersion, String loc) { - super(miVersion, "-exec-until", new String[]{loc}); //$NON-NLS-1$ - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIFileExecFile.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIFileExecFile.java deleted file mode 100644 index 7983656133d..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIFileExecFile.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -/** - * - * -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, except a completion - * notification. - * - */ -public class MIFileExecFile extends MICommand -{ - public MIFileExecFile(String miVersion, String file) { - super(miVersion, "-file-exec-file", new String[]{file}); //$NON-NLS-1$ - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIFileSymbolFile.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIFileSymbolFile.java deleted file mode 100644 index cc3ef957711..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIFileSymbolFile.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -/** - * - * -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 for a completion notification. - * - */ -public class MIFileSymbolFile extends MICommand -{ - public MIFileSymbolFile(String miVersion, String file) { - super(miVersion, "-file-symbol-file", new String[]{file}); //$NON-NLS-1$ - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBExit.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBExit.java deleted file mode 100644 index 44a682687f6..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBExit.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -/** - * - * -gdb-exit - * - * Exit GDB immediately. - * - */ -public class MIGDBExit extends MICommand -{ - public MIGDBExit(String miVersion) { - super(miVersion, "-gdb-exit"); //$NON-NLS-1$ - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBSet.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBSet.java deleted file mode 100644 index 3ae5492c075..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBSet.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2010 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -/** - * - * -gdb-set - * - * Set an internal GDB variable. - * - */ -public class MIGDBSet extends MICommand -{ - public MIGDBSet(String miVersion, String[] params) { - super(miVersion, "-gdb-set", params); //$NON-NLS-1$ - } - @Override - protected String parametersToString() { - /* gdb (at least up to 6.8) does not correctly process escaping for arguments. - * pass argument without escaping. Just in case only do it for simple cases only like -gdb-set variable value. - * For example set solib-search-path */ - if (fParameters!=null && fParameters.length==2 && (fOptions==null || fOptions.length==0)) { - return fParameters[0]+" "+fParameters[1]; //$NON-NLS-1$ - } - return super.parametersToString(); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBSetAutoSolib.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBSetAutoSolib.java deleted file mode 100644 index 807ebf63d59..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBSetAutoSolib.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -/** - * - * -gdb-set - * - * Set an internal GDB variable. - * - */ -public class MIGDBSetAutoSolib extends MIGDBSet { - public MIGDBSetAutoSolib(String miVersion, boolean isSet) { - super(miVersion, new String[] {"auto-solib-add", (isSet) ? "on" : "off"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBSetBreakpointPending.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBSetBreakpointPending.java deleted file mode 100644 index 6d2843a8601..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBSetBreakpointPending.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 QnX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Qnx Software Systems - initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -/** - * - * MIGDBSetBreakpointPending - * - */ -public class MIGDBSetBreakpointPending extends MIGDBSet { - - public MIGDBSetBreakpointPending(String miVersion, boolean set) { - super(miVersion, new String[] {"breakpoint", "pending", (set) ? "on" : "off"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBSetEnvironment.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBSetEnvironment.java deleted file mode 100644 index fd10b8c5302..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBSetEnvironment.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -/** - * - * -gdb-set - * - * Set an internal GDB variable. - * - */ -public class MIGDBSetEnvironment extends MIGDBSet { - - public MIGDBSetEnvironment(String miVersion, String[] paths) { - super(miVersion, paths); - // Overload the parameter - String[] newPaths = new String[paths.length + 1]; - newPaths[0] = "environment"; //$NON-NLS-1$ - System.arraycopy(paths, 0, newPaths, 1, paths.length); - setParameters(newPaths); - } - - /** - * According to the help.: - * Set environment variable value to give the program. - * Arguments are VAR VALUE where VAR is variable name and VALUE is value. - * VALUES of environment variables are uninterpreted strings. - * This does not affect the program until the next "run" command. - * - * So pass the strings raw without interpretation. - */ - @Override - protected String parametersToString() { - String[] parameters = getParameters(); - StringBuffer buffer = new StringBuffer(); - if (parameters != null) { - for (int i = 0; i < parameters.length; i++) { - buffer.append(' ').append(parameters[i]); - } - } - return buffer.toString().trim(); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBSetNewConsole.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBSetNewConsole.java deleted file mode 100644 index e74ccde5d21..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBSetNewConsole.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Seimens AG - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Seimens AG - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.command; - -public class MIGDBSetNewConsole extends MIGDBSet { - - public MIGDBSetNewConsole(String miVersion) { - this(miVersion, "on"); //$NON-NLS-1$ - } - - public MIGDBSetNewConsole(String miVersion, String param) { - super(miVersion, new String[] {"new-console", param}); //$NON-NLS-1$ - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBSetSolibSearchPath.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBSetSolibSearchPath.java deleted file mode 100644 index ea044a19bf0..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBSetSolibSearchPath.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2013 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.core.variables.IStringVariableManager; -import org.eclipse.core.variables.VariablesPlugin; - -/** - * - * -gdb-set - * - * Set an internal GDB variable. - * - */ -public class MIGDBSetSolibSearchPath extends MIGDBSet { - public MIGDBSetSolibSearchPath(String miVersion, String[] paths) { - super(miVersion, paths); - // Overload the parameter - String sep = System.getProperty("path.separator", ":"); //$NON-NLS-1$ //$NON-NLS-2$ - StringBuffer buffer = new StringBuffer(); - for (int i = 0; i < paths.length; i++) { - if (buffer.length() > 0) { - buffer.append(sep); - } - buffer.append(resolve(paths[i])); - } - String[] p = new String [] {"solib-search-path", buffer.toString()}; //$NON-NLS-1$ - setParameters(p); - } - - /** @since 7.3 */ - protected String resolve(String path) { - try { - IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager(); - path = manager.performStringSubstitution(path, false); - } catch (Exception e) { - // if anything happens here just use the non-resolved one - } - return path; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBSetStopOnSolibEvents.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBSetStopOnSolibEvents.java deleted file mode 100644 index d52a128bee2..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBSetStopOnSolibEvents.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -/** - * - * -gdb-set stop-on-solib-events - * - * Set an internal GDB variable. - * - */ -public class MIGDBSetStopOnSolibEvents extends MIGDBSet { - - public MIGDBSetStopOnSolibEvents(String miVersion, boolean isSet) { - super(miVersion, new String[] {"stop-on-solib-events", (isSet) ? "1" : "0"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBShow.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBShow.java deleted file mode 100644 index d3fedaf7522..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBShow.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.MIGDBShowInfo; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; - -/** - * - * -gdb-show - * - * Show the current value of a GDB variable. - * - */ -public class MIGDBShow extends MICommand { - public MIGDBShow(String miVersion, String[] params) { - super(miVersion, "-gdb-show", params); //$NON-NLS-1$ - } - - public MIGDBShowInfo getMIGDBShowInfo() throws MIException { - return (MIGDBShowInfo)getMIInfo(); - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new MIGDBShowInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBShowAddressSize.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBShowAddressSize.java deleted file mode 100644 index 514396566b2..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBShowAddressSize.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.MIGDBShowAddressSizeInfo; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; - -/** - * - */ -public class MIGDBShowAddressSize extends MIGDBShow { - - public MIGDBShowAddressSize (String miVersion) { - super(miVersion, new String[] { "remoteaddresssize" }); //$NON-NLS-1$ - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIGDBShowAddressSizeInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new MIGDBShowAddressSizeInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBShowDirectories.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBShowDirectories.java deleted file mode 100644 index f5d8dff65c6..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBShowDirectories.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.MIGDBShowDirectoriesInfo; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; - -/** - * - * -gdb-show directories - * - * Show the current value of a GDB variable(directories). - * - */ -public class MIGDBShowDirectories extends MIGDBShow { - public MIGDBShowDirectories(String miVersion) { - super(miVersion, new String[] { "directories" }); //$NON-NLS-1$ - } - - public MIGDBShowDirectoriesInfo getMIGDBShowDirectoriesInfo() throws MIException { - return (MIGDBShowDirectoriesInfo)getMIInfo(); - } - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new MIGDBShowDirectoriesInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBShowEndian.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBShowEndian.java deleted file mode 100644 index b59d6aa6bc2..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBShowEndian.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; -import org.eclipse.cdt.debug.mi.core.output.MIGDBShowEndianInfo; - -public class MIGDBShowEndian extends MIGDBShow { - - public MIGDBShowEndian(String miVersion) { - super(miVersion, new String[] {"endian"}); //$NON-NLS-1$ - } - - public MIGDBShowEndianInfo getMIShowEndianInfo() throws MIException { - return (MIGDBShowEndianInfo)getMIInfo(); - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new MIGDBShowEndianInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBShowExitCode.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBShowExitCode.java deleted file mode 100644 index 31d5f6d6a84..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBShowExitCode.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.MIGDBShowExitCodeInfo; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; - -/** - * - *-data-evaluate-expression $_exitcode - * ^done,value="10" - * - * Show the current value of a $_exitcode - * - */ -public class MIGDBShowExitCode extends MIDataEvaluateExpression { - - public MIGDBShowExitCode(String miVersion) { - super(miVersion, "$_exitcode"); //$NON-NLS-1$ - } - - public MIGDBShowExitCodeInfo getMIGDBShowExitCodeInfo() throws MIException { - return (MIGDBShowExitCodeInfo)getMIInfo(); - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new MIGDBShowExitCodeInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBShowPrompt.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBShowPrompt.java deleted file mode 100644 index b30c23e1726..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBShowPrompt.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -/** - * -gdb-show prompt - */ -public class MIGDBShowPrompt extends MIGDBShow { - - /** - * @param params - */ - public MIGDBShowPrompt(String miVersion) { - super(miVersion, new String[] { "prompt" }); //$NON-NLS-1$ - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBShowSolibSearchPath.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBShowSolibSearchPath.java deleted file mode 100644 index ee0998da934..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBShowSolibSearchPath.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.MIGDBShowSolibSearchPathInfo; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; - -/** - * - * -gdb-show directories - * - * Show the current value of a GDB variable(directories). - * - */ -public class MIGDBShowSolibSearchPath extends MIGDBShow { - public MIGDBShowSolibSearchPath(String miVersion) { - super(miVersion, new String[] { "solib-search-path" }); //$NON-NLS-1$ - } - - public MIGDBShowSolibSearchPathInfo getMIGDBShowSolibSearchPathInfo() throws MIException { - return (MIGDBShowSolibSearchPathInfo)getMIInfo(); - } - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new MIGDBShowSolibSearchPathInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIInfoSharedLibrary.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIInfoSharedLibrary.java deleted file mode 100644 index c393c2406c0..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIInfoSharedLibrary.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2012 QNX Software Systems - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIInfoSharedLibraryInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; - -public class MIInfoSharedLibrary extends MICommand { - - public MIInfoSharedLibrary(String miVersion) { - super(miVersion, "info sharedlibrary"); //$NON-NLS-1$ - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new MIInfoSharedLibraryInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } - - public MIInfoSharedLibraryInfo getMIInfoSharedLibraryInfo() throws MIException { - return (MIInfoSharedLibraryInfo) getMIInfo(); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIInterpreterExec.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIInterpreterExec.java deleted file mode 100644 index a1d0c6859a1..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIInterpreterExec.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -/** - * 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" - * ~"Breakpoint 1 at 0x8074fc6: file ../../src/gdb/main.c, line 743.\n" - * ^done - * - */ -public class MIInterpreterExec extends MICommand { - - /** - * @param oper - */ - public MIInterpreterExec(String miVersion, String interpreter, String cmd) { - super(miVersion, "-interpreter-exec", new String[]{interpreter}, new String[] {cmd}); //$NON-NLS-1$ - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIInterpreterExecConsole.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIInterpreterExecConsole.java deleted file mode 100644 index f13bfc19d11..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIInterpreterExecConsole.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -/** - * MIInterpreterExecConsole - */ -public class MIInterpreterExecConsole extends MIInterpreterExec { - - /** - * @param interpreter - * @param cmd - */ - public MIInterpreterExecConsole(String miVersion, String cmd) { - super(miVersion, "console", cmd); //$NON-NLS-1$ - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIStackInfoDepth.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIStackInfoDepth.java deleted file mode 100644 index 12ede5e2028..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIStackInfoDepth.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; -import org.eclipse.cdt.debug.mi.core.output.MIStackInfoDepthInfo; - -/** - * - * -stack-info-depth [ MAX-DEPTH ] - * - * Return the depth of the stack. If the integer argument MAX-DEPTH is - * specified, do not count beyond MAX-DEPTH frames. - * - */ -public class MIStackInfoDepth extends MICommand -{ - public MIStackInfoDepth(String miVersion) { - super(miVersion, "-stack-info-depth"); //$NON-NLS-1$ - } - - public MIStackInfoDepth(String miVersion, int maxDepth) { - super(miVersion, "-stack-info-depth", new String[]{Integer.toString(maxDepth)}); //$NON-NLS-1$ - } - - public MIStackInfoDepthInfo getMIStackInfoDepthInfo() throws MIException { - return (MIStackInfoDepthInfo)getMIInfo(); - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new MIStackInfoDepthInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIStackListArguments.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIStackListArguments.java deleted file mode 100644 index 051246abb9b..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIStackListArguments.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; -import org.eclipse.cdt.debug.mi.core.output.MIStackListArgumentsInfo; - -/** - * - * -stack-list-arguments SHOW-VALUES - * [ LOW-FRAME HIGH-FRAME ] - * - * Display a list of the arguments for the frames between LOW-FRAME and - * HIGH-FRAME (inclusive). If LOW-FRAME and HIGH-FRAME are not provided, - * list the arguments for the whole call stack. - * - * 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 -{ - public MIStackListArguments(String miVersion, boolean showValues) { - super(miVersion, "-stack-list-arguments"); //$NON-NLS-1$ - if (showValues) { - setParameters(new String[]{"1"}); //$NON-NLS-1$ - } else { - setParameters(new String[]{"0"}); //$NON-NLS-1$ - } - } - - public MIStackListArguments(String miVersion, boolean showValues, int low, int high) { - super(miVersion, "-stack-list-arguments"); //$NON-NLS-1$ - String[] params = new String[3]; - if (showValues) { - params[0] = "1"; //$NON-NLS-1$ - } else { - params[0] = "0"; //$NON-NLS-1$ - } - params[1] = Integer.toString(low); - params[2] = Integer.toString(high); - setParameters(params); - } - - public MIStackListArgumentsInfo getMIStackListArgumentsInfo() throws MIException { - return (MIStackListArgumentsInfo)getMIInfo(); - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new MIStackListArgumentsInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIStackListFrames.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIStackListFrames.java deleted file mode 100644 index 08f601bdbbf..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIStackListFrames.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; -import org.eclipse.cdt.debug.mi.core.output.MIStackListFramesInfo; - -/** - * - * -stack-list-frames [ LOW-FRAME HIGH-FRAME ] - * - * List the frames currently on the stack. For each frame it displays - * the following info: - * - * `LEVEL' - * The frame number, 0 being the topmost frame, i.e. the innermost - * function. - * - * `ADDR' - * The `$pc' value for that frame. - * - * `FUNC' - * Function name. - * - * `FILE' - * File name of the source file where the function lives. - * - * `FULLNAME' - * Absolute file name of the source file where the function lives. - * @since gdb 6.4 - * - * `LINE' - * Line number corresponding to the `$pc'. - * - * If invoked without arguments, this command prints a backtrace for the - * 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 -{ - public MIStackListFrames(String miVersion) { - super(miVersion, "-stack-list-frames"); //$NON-NLS-1$ - } - - public MIStackListFrames(String miVersion, int low, int high) { - super(miVersion, "-stack-list-frames", new String[]{Integer.toString(low), //$NON-NLS-1$ - Integer.toString(high)}); - } - - public MIStackListFramesInfo getMIStackListFramesInfo() throws MIException { - return (MIStackListFramesInfo)getMIInfo(); - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new MIStackListFramesInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIStackListLocals.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIStackListLocals.java deleted file mode 100644 index d472e87f02e..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIStackListLocals.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; -import org.eclipse.cdt.debug.mi.core.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 -{ - public MIStackListLocals(String miVersion, boolean printValues) { - super(miVersion, "-stack-list-locals"); //$NON-NLS-1$ - if (printValues) { - setParameters(new String[]{"1"}); //$NON-NLS-1$ - } else { - setParameters(new String[]{"0"}); //$NON-NLS-1$ - } - } - - public MIStackListLocalsInfo getMIStackListLocalsInfo() throws MIException { - return (MIStackListLocalsInfo)getMIInfo(); - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new MIStackListLocalsInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIStackSelectFrame.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIStackSelectFrame.java deleted file mode 100644 index dcd993762d7..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIStackSelectFrame.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - - - -/** - * - * -stack-select-frame FRAMENUM - * - * Change the current frame. Select a different frame FRAMENUM on the - * stack. - * - */ -public class MIStackSelectFrame extends MICommand -{ - public MIStackSelectFrame(String miVersion, int frameNum) { - super(miVersion, "-stack-select-frame", new String[]{Integer.toString(frameNum)}); //$NON-NLS-1$ - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MITargetDetach.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MITargetDetach.java deleted file mode 100644 index 757c80197c9..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MITargetDetach.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -/** - * - * - * -target-detach - * - * Disconnect from the remote target. There's no output. - * - */ -public class MITargetDetach extends MICommand -{ - public MITargetDetach(String miVersion) { - super(miVersion, "-target-detach"); //$NON-NLS-1$ - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MITargetDownload.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MITargetDownload.java deleted file mode 100644 index bc9afd8bcd9..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MITargetDownload.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2007 RedHat Inc and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * RedHat Inc - initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -/** - * - * -target-download - * - * Load the executable to the remote target. This command takes no args. - * - * - * Loads the executable onto the remote target. It prints out an - * update message every half second, which includes the fields: - * - * +download,{section=".text",section-size="6668",total-size="9880"} - * +download,{section=".text",section-sent="512",section-size="6668", - * total-sent="512",total-size="9880"} - * - */ -public class MITargetDownload extends MICommand { - - public MITargetDownload(String miVersion) { - super(miVersion, "-target-download"); //$NON-NLS-1$ - } - - public MITargetDownload(String miVersion, String file) { - super(miVersion, "-target-download", new String[] { file }); //$NON-NLS-1$ - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MITargetSelect.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MITargetSelect.java deleted file mode 100644 index b31d99e8e8c..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MITargetSelect.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -/** - * - * -target-select TYPE PARAMETERS ... - * - * Connect GDB to the remote target. This command takes two args: - * - * `TYPE' - * The type of target, for instance `async', `remote', etc. - * - * `PARAMETERS' - * Device names, host names and the like. *Note Commands for - * managing targets: Target Commands, for more details. - * - * The output is a connection notification, followed by the address at - * which the target program is, in the following form: - * - * ^connected,addr="ADDRESS",func="FUNCTION NAME", - * args=[ARG LIST] - * - */ -public class MITargetSelect extends MICommand -{ - public MITargetSelect(String miVersion, String[] params) { - super(miVersion, "-target-select", params); //$NON-NLS-1$ - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIThreadListIds.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIThreadListIds.java deleted file mode 100644 index ef5e1855145..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIThreadListIds.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; -import org.eclipse.cdt.debug.mi.core.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 -{ - public MIThreadListIds(String miVersion) { - super(miVersion, "-thread-list-ids"); //$NON-NLS-1$ - } - - public MIThreadListIdsInfo getMIThreadListIdsInfo() throws MIException { - return (MIThreadListIdsInfo)getMIInfo(); - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new MIThreadListIdsInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIThreadSelect.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIThreadSelect.java deleted file mode 100644 index 76d6b8bb2e7..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIThreadSelect.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; -import org.eclipse.cdt.debug.mi.core.output.MIThreadSelectInfo; - -/** - * - * -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 -{ - public MIThreadSelect(String miVersion, int threadNum) { - super(miVersion, "-thread-select", new String[]{Integer.toString(threadNum)}); //$NON-NLS-1$ - } - - public MIThreadSelectInfo getMIThreadSelectInfo() throws MIException { - return (MIThreadSelectInfo)getMIInfo(); - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new MIThreadSelectInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVarAssign.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVarAssign.java deleted file mode 100644 index e70796833c8..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVarAssign.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -/** - * - * -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 -{ - public MIVarAssign(String miVersion, String name, String expression) { - super(miVersion, "-var-assign", new String[]{name, expression}); //$NON-NLS-1$ - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVarCreate.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVarCreate.java deleted file mode 100644 index 1fa1db2f64b..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVarCreate.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; -import org.eclipse.cdt.debug.mi.core.output.MIVarCreateInfo; - -/** - * - * -var-create {NAME | "-"} - * {FRAME-ADDR | "*"} EXPRESSION - * - * This operation creates a variable object, which allows the - * monitoring of a variable, the result of an expression, a memory cell or - * a CPU register. - * - * The NAME parameter is the string by which the object can be - * referenced. It must be unique. If `-' is specified, the varobj system - * will generate a string "varNNNNNN" automatically. It will be unique - * provided that one does not specify NAME on that format. The command - * fails if a duplicate name is found. - * - * The frame under which the expression should be evaluated can be - * specified by FRAME-ADDR. A `*' indicates that the current frame should - * be used. - * - * EXPRESSION is any expression valid on the current language set (must - * not begin with a `*'), or one of the following: - * - * * `*ADDR', where ADDR is the address of a memory cell - * - * * `*ADDR-ADDR' -- a memory address range (TBD) - * - * * `$REGNAME' -- a CPU register name - * - */ -public class MIVarCreate extends MICommand -{ - public MIVarCreate(String miVersion, String expression) { - this(miVersion, "-", "*", expression); //$NON-NLS-1$ //$NON-NLS-2$ - } - - public MIVarCreate(String miVersion, String name, String expression) { - this(miVersion, name, "*", expression); //$NON-NLS-1$ - } - - public MIVarCreate(String miVersion, String name, String frameAddr, String expression) { - super(miVersion, "-var-create", new String[]{name, frameAddr, expression}); //$NON-NLS-1$ - } - - public MIVarCreateInfo getMIVarCreateInfo() throws MIException { - return (MIVarCreateInfo)getMIInfo(); - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new MIVarCreateInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVarDelete.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVarDelete.java deleted file mode 100644 index 944fbc4d4fc..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVarDelete.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; -import org.eclipse.cdt.debug.mi.core.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 -{ - public MIVarDelete(String miVersion, String name) { - super(miVersion, "-var-delete", new String[]{name}); //$NON-NLS-1$ - } - - public MIVarDeleteInfo getMIVarDeleteInfo() throws MIException { - return (MIVarDeleteInfo)getMIInfo(); - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new MIVarDeleteInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVarEvaluateExpression.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVarEvaluateExpression.java deleted file mode 100644 index e25a45df160..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVarEvaluateExpression.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; -import org.eclipse.cdt.debug.mi.core.output.MIVarEvaluateExpressionInfo; - -/** - * - * -var-evaluate-expression NAME - * - * Evaluates the expression that is represented by the specified - * variable object and returns its value as a string in the current format - * specified for the object: - * - * value=VALUE - * - */ -public class MIVarEvaluateExpression extends MICommand { - public MIVarEvaluateExpression(String miVersion, String expression) { - super(miVersion, "-var-evaluate-expression", new String[] { expression }); //$NON-NLS-1$ - } - - public MIVarEvaluateExpressionInfo getMIVarEvaluateExpressionInfo() - throws MIException { - return (MIVarEvaluateExpressionInfo) getMIInfo(); - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new MIVarEvaluateExpressionInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVarInfoExpression.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVarInfoExpression.java deleted file mode 100644 index 4eb7de48eac..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVarInfoExpression.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; -import org.eclipse.cdt.debug.mi.core.output.MIVarInfoExpressionInfo; - -/** - * - * -var-info-expression NAME - * - * Returns what is represented by the variable object NAME: - * - * lang=LANG-SPEC,exp=EXPRESSION - * - * where LANG-SPEC is `{"C" | "C++" | "Java"}'. - * - */ -public class MIVarInfoExpression extends MICommand -{ - public MIVarInfoExpression(String miVersion, String name) { - super(miVersion, "-var-info-expression", new String[]{name}); //$NON-NLS-1$ - } - - public MIVarInfoExpressionInfo getMIVarInfoExpressionInfo() throws MIException { - return (MIVarInfoExpressionInfo)getMIInfo(); - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new MIVarInfoExpressionInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVarInfoNumChildren.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVarInfoNumChildren.java deleted file mode 100644 index aa3e2f09dba..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVarInfoNumChildren.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; -import org.eclipse.cdt.debug.mi.core.output.MIVarInfoNumChildrenInfo; - -/** - * - * -var-info-num-children NAME - * - * Returns the number of children of a variable object NAME: - * - * numchild=N - * - */ -public class MIVarInfoNumChildren extends MICommand -{ - public MIVarInfoNumChildren(String miVersion, String name) { - super(miVersion, "-var-info-num-children", new String[]{name}); //$NON-NLS-1$ - } - - public MIVarInfoNumChildrenInfo getMIVarInfoNumChildrenInfo() throws MIException { - return (MIVarInfoNumChildrenInfo)getMIInfo(); - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new MIVarInfoNumChildrenInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVarInfoType.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVarInfoType.java deleted file mode 100644 index 4b987130ffd..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVarInfoType.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; -import org.eclipse.cdt.debug.mi.core.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 -{ - public MIVarInfoType(String miVersion, String name) { - super(miVersion, "-var-info-type", new String[]{name}); //$NON-NLS-1$ - } - - public MIVarInfoTypeInfo getMIVarInfoTypeInfo() throws MIException { - return (MIVarInfoTypeInfo)getMIInfo(); - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new MIVarInfoTypeInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVarListChildren.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVarListChildren.java deleted file mode 100644 index 8ea7adb281e..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVarListChildren.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; -import org.eclipse.cdt.debug.mi.core.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 -{ - public MIVarListChildren(String miVersion, String name) { - super(miVersion, "-var-list-children", new String[]{name}); //$NON-NLS-1$ - } - - public MIVarListChildrenInfo getMIVarListChildrenInfo() throws MIException { - return (MIVarListChildrenInfo)getMIInfo(); - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new MIVarListChildrenInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVarSetFormat.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVarSetFormat.java deleted file mode 100644 index c7961ed880f..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVarSetFormat.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIFormat; - -/** - * - * -var-set-format NAME FORMAT-SPEC - * - * Sets the output format for the value of the object NAME to be - * FORMAT-SPEC. - * - * The syntax for the FORMAT-SPEC is as follows: - * - * FORMAT-SPEC ==> - * {binary | decimal | hexadecimal | octal | natural} - * - */ -public class MIVarSetFormat extends MICommand -{ - public MIVarSetFormat(String miVersion, String name, int fmt) { - super(miVersion, "-var-set-format"); //$NON-NLS-1$ - String format = "hexadecimal"; //$NON-NLS-1$ - switch (fmt) { - case MIFormat.NATURAL: - format = "natural"; //$NON-NLS-1$ - break; - case MIFormat.DECIMAL: - format = "decimal"; //$NON-NLS-1$ - break; - case MIFormat.BINARY: - format = "binary"; //$NON-NLS-1$ - break; - case MIFormat.OCTAL: - format = "octal"; //$NON-NLS-1$ - break; - /* - case MIFormat.HEXADECIMAL: - case MIFormat.RAW: - default: - format = "hexadecimal"; - break; - */ - } - setParameters(new String[]{name, format}); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVarShowAttributes.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVarShowAttributes.java deleted file mode 100644 index 2995e924452..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVarShowAttributes.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; -import org.eclipse.cdt.debug.mi.core.output.MIVarShowAttributesInfo; - -/** - * - * -var-show-attributes NAME - * - * List attributes of the specified variable object NAME: - * - * status=ATTR [ ( ,ATTR )* ] - * - * where ATTR is `{ { editable | noneditable } | TBD }'. - * - */ -public class MIVarShowAttributes extends MICommand -{ - public MIVarShowAttributes(String miVersion, String name) { - super(miVersion, "-var-show-attributes", new String[]{name}); //$NON-NLS-1$ - } - - public MIVarShowAttributesInfo getMIVarShowAttributesInfo() throws MIException { - return (MIVarShowAttributesInfo)getMIInfo(); - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new MIVarShowAttributesInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVarShowFormat.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVarShowFormat.java deleted file mode 100644 index 04d84be20ea..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVarShowFormat.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -/** - * - * -var-show-format NAME - * - * Returns the format used to display the value of the object NAME. - * - * FORMAT ==> - * FORMAT-SPEC - * - */ -public class MIVarShowFormat extends MICommand -{ - public MIVarShowFormat(String miVersion, String name) { - super(miVersion, "-var-show-format", new String[]{name}); //$NON-NLS-1$ - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVarUpdate.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVarUpdate.java deleted file mode 100644 index bca9b482427..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVarUpdate.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; -import org.eclipse.cdt.debug.mi.core.output.MIVarUpdateInfo; - -/** - * - * -var-update {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. - * - */ -public class MIVarUpdate extends MICommand { - - public MIVarUpdate(String miVersion) { - this(miVersion, "*"); //$NON-NLS-1$ - } - - public MIVarUpdate(String miVersion, String name) { - super(miVersion, "-var-update", new String[] { name }); //$NON-NLS-1$ - } - - public MIVarUpdateInfo getMIVarUpdateInfo() throws MIException { - return (MIVarUpdateInfo)getMIInfo(); - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new MIVarUpdateInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVersion.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVersion.java deleted file mode 100644 index 3100be3bc93..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIVersion.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -/** - * TODO: Make this an enum type. - * MI Version constants. - */ -public class MIVersion { - - public static final String MI1 = "mi1"; //$NON-NLS-1$ - public static final String MI2 = "mi2"; //$NON-NLS-1$ - public static final String MI3 = "mi3"; //$NON-NLS-1$ - - public static int compare(String v1, String v2) { - return v1.compareToIgnoreCase(v2); - } - - public static boolean equals(String v1, String v2) { - return v1.equalsIgnoreCase(v2); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/RawCommand.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/RawCommand.java deleted file mode 100644 index ead5f25a3b4..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/RawCommand.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command; - -import org.eclipse.cdt.debug.mi.core.output.MIOutput; - -/** - */ -public class RawCommand extends Command { - - String fRaw; - - public RawCommand(String operation) { - fRaw = operation; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - if (fRaw == null) { - fRaw = "\n"; //$NON-NLS-1$; - } else if (! fRaw.endsWith("\n")) { //$NON-NLS-1$ - fRaw += "\n"; //$NON-NLS-1$ - } - return fRaw; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.core.command.Command#getMIOutput() - */ - @Override - public MIOutput getMIOutput() { - return new MIOutput(); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/CommandFactoriesMessages.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/CommandFactoriesMessages.java deleted file mode 100644 index dae1a690b32..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/CommandFactoriesMessages.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.command.factories; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -public class CommandFactoriesMessages { - - private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.mi.core.command.factories.CommandFactoriesMessages"; //$NON-NLS-1$ - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME ); - - private CommandFactoriesMessages() { - } - - public static String getString( String key ) { - try { - return RESOURCE_BUNDLE.getString( key ); - } - catch( MissingResourceException e ) { - return '!' + key + '!'; - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/CommandFactoriesMessages.properties b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/CommandFactoriesMessages.properties deleted file mode 100644 index 51b73c66f9b..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/CommandFactoriesMessages.properties +++ /dev/null @@ -1,11 +0,0 @@ -############################################################################### -# Copyright (c) 2006 QNX Software Systems and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# QNX Software Systems - initial API and implementation -############################################################################### -CommandFactoryDescriptor.0=Error instantiating command factory. diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/CommandFactoryDescriptor.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/CommandFactoryDescriptor.java deleted file mode 100644 index 548607817d8..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/CommandFactoryDescriptor.java +++ /dev/null @@ -1,136 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.command.factories; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.StringTokenizer; -import org.eclipse.cdt.debug.mi.core.MIPlugin; -import org.eclipse.cdt.debug.mi.core.command.CommandFactory; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; - -/** - * A command factory descriptor wrappers a configuration - * element for a <code>commandFactory</code> extension. - */ -public class CommandFactoryDescriptor { - - private final static String IDENTIFIER = "id"; //$NON-NLS-1$ - private final static String CLASS = "class"; //$NON-NLS-1$ - private final static String NAME = "name"; //$NON-NLS-1$ - private final static String DEBUGGER_ID = "debuggerID"; //$NON-NLS-1$ - private final static String MI_VERSIONS = "miVersions"; //$NON-NLS-1$ - private final static String DESCRIPTION = "description"; //$NON-NLS-1$ - private final static String PLATFORMS = "platforms"; //$NON-NLS-1$ - - /** - * The configuration element of the extension. - */ - private IConfigurationElement fElement; - - /** - * The set of the platforms supported by this command factory. - */ - private Set fPlatforms; - - /** - * The mi levels supported by this command factory. - */ - private String[] fMIVersions = new String[0]; - - /** - * Constructor for CommandFactoryDescriptor. - */ - protected CommandFactoryDescriptor( IConfigurationElement element ) { - fElement = element; - } - - protected IConfigurationElement getConfigurationElement() { - return fElement; - } - - public String getIdentifier() { - return getConfigurationElement().getAttribute( IDENTIFIER ); - } - - public String getName() { - return getConfigurationElement().getAttribute( NAME ); - } - - public String getDebuggerIdentifier() { - return getConfigurationElement().getAttribute( DEBUGGER_ID ); - } - - public String[] getMIVersions() { - if ( fMIVersions.length == 0 ) { - String miVersions = getConfigurationElement().getAttribute( MI_VERSIONS ); - if ( miVersions == null || miVersions.trim().length() == 0 ) - miVersions = "mi"; //$NON-NLS-1$ - StringTokenizer tokenizer = new StringTokenizer( miVersions, "," ); //$NON-NLS-1$ - List list = new ArrayList( tokenizer.countTokens() ); - while( tokenizer.hasMoreTokens() ) { - list.add( tokenizer.nextToken().trim() ); - } - fMIVersions = (String[])list.toArray( new String[list.size()] ); - } - return fMIVersions; - } - - public String getDescription() { - String desc = getConfigurationElement().getAttribute( DESCRIPTION ); - if ( isEmpty( desc ) ) { - desc =""; //$NON-NLS-1$ - } - return desc; - } - - protected Set getSupportedPlatforms() { - if ( fPlatforms == null ) { - String platforms = getConfigurationElement().getAttribute( PLATFORMS ); - if ( platforms == null ) { - return new HashSet( 0 ); - } - StringTokenizer tokenizer = new StringTokenizer( platforms, "," ); //$NON-NLS-1$ - fPlatforms = new HashSet( tokenizer.countTokens() ); - while( tokenizer.hasMoreTokens() ) { - fPlatforms.add( tokenizer.nextToken().trim() ); - } - } - return fPlatforms; - } - - public boolean supportsPlatform( String platform ) { - Set all = getSupportedPlatforms(); - return all.isEmpty() || all.contains( "*" ) || all.contains( platform ); //$NON-NLS-1$ - } - - public String[] getSupportedPlatformList() { - Set platforms = getSupportedPlatforms(); - return (String[])platforms.toArray( new String[platforms.size()] ); - } - - public CommandFactory getCommandFactory() throws CoreException { - Object clazz = getConfigurationElement().createExecutableExtension( CLASS ); - if ( clazz instanceof CommandFactory ) { - return (CommandFactory)clazz; - } - throw new CoreException( new Status( IStatus.ERROR, MIPlugin.getUniqueIdentifier(), -1, CommandFactoriesMessages.getString( "CommandFactoryDescriptor.0" ), null ) ); //$NON-NLS-1$ - } - - private boolean isEmpty( String str ) { - return ( str == null || str.trim().length() == 0 ); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/CommandFactoryManager.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/CommandFactoryManager.java deleted file mode 100644 index ed119fef20d..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/CommandFactoryManager.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.command.factories; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import org.eclipse.cdt.debug.mi.core.MIPlugin; -import org.eclipse.cdt.debug.mi.core.command.CommandFactory; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.Platform; - -/** - * Manages command factories. - */ -public class CommandFactoryManager { - - private List fDescriptors = null; - - public CommandFactoryDescriptor[] getDescriptors() { - List factories = getDescriptorList(); - return (CommandFactoryDescriptor[])factories.toArray( new CommandFactoryDescriptor[factories.size()] ); - } - - public CommandFactoryDescriptor getDefaultDescriptor( String debuggerID ) { - // TODO: temporary - CommandFactoryDescriptor[] descriptors = getDescriptors( debuggerID ); - return descriptors[0]; - } - - public CommandFactoryDescriptor[] getDescriptors( String debuggerID ) { - String platform = Platform.getOS(); - List all = getDescriptorList(); - ArrayList list = new ArrayList( all.size() ); - Iterator it = all.iterator(); - while( it.hasNext() ) { - CommandFactoryDescriptor desc = (CommandFactoryDescriptor)it.next(); - if ( desc.getDebuggerIdentifier().equals( debuggerID ) && desc.supportsPlatform( platform ) ) { - list.add( desc ); - } - } - return (CommandFactoryDescriptor[])list.toArray( new CommandFactoryDescriptor[list.size()] ); - } - - public CommandFactory getCommandFactory( String factoryID ) throws CoreException { - List all = getDescriptorList(); - Iterator it = all.iterator(); - while( it.hasNext() ) { - CommandFactoryDescriptor desc = (CommandFactoryDescriptor)it.next(); - if ( desc.getIdentifier().equals( factoryID ) ) { - return desc.getCommandFactory(); - } - } - return null; - } - - private List getDescriptorList() { - if ( fDescriptors == null ) - initializeDescriptorList(); - return fDescriptors; - } - - private synchronized void initializeDescriptorList() { - if ( fDescriptors == null ) { - IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint( MIPlugin.getUniqueIdentifier(), MIPlugin.EXTENSION_POINT_COMMAND_FACTORIES ); - IConfigurationElement[] infos = extensionPoint.getConfigurationElements(); - fDescriptors = new ArrayList( infos.length ); - for( int i = 0; i < infos.length; i++ ) { - IConfigurationElement configurationElement = infos[i]; - CommandFactoryDescriptor factory = new CommandFactoryDescriptor( configurationElement ); - fDescriptors.add( factory ); - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/StandardCommandFactory.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/StandardCommandFactory.java deleted file mode 100644 index 13341aeb516..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/StandardCommandFactory.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.command.factories; - -import org.eclipse.cdt.debug.mi.core.command.CommandFactory; - -/** - * The "standard" command factory. - */ -public class StandardCommandFactory extends CommandFactory { - - /** - * Constructor for StandardCommandFactory. - */ - public StandardCommandFactory() { - super(); - } - - /** - * Constructor for StandardCommandFactory. - */ - public StandardCommandFactory( String miVersion ) { - super( miVersion ); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/linux/LinuxCLIInfoSharedLibrary.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/linux/LinuxCLIInfoSharedLibrary.java deleted file mode 100644 index d467866cb91..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/linux/LinuxCLIInfoSharedLibrary.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.command.factories.linux; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.command.CLIInfoSharedLibrary; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; - -/** - * Linux version of "info shared library". - */ -public class LinuxCLIInfoSharedLibrary extends CLIInfoSharedLibrary { - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.core.command.CLIInfoSharedLibrary#getMIInfo() - */ - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if ( out != null ) { - info = new LinuxCLIInfoSharedLibraryInfo( out ); - if ( info.isError() ) { - throwMIException( info, out ); - } - } - return info; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/linux/LinuxCLIInfoSharedLibraryInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/linux/LinuxCLIInfoSharedLibraryInfo.java deleted file mode 100644 index a53a30dcf89..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/linux/LinuxCLIInfoSharedLibraryInfo.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.command.factories.linux; - -import java.util.List; -import org.eclipse.cdt.debug.mi.core.output.CLIInfoSharedLibraryInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; -import org.eclipse.cdt.debug.mi.core.output.MIShared; - -/** - * Linux specific parser of the "info shared" output. - */ -public class LinuxCLIInfoSharedLibraryInfo extends CLIInfoSharedLibraryInfo { - - /** - * Constructor for LinuxCLIInfoSharedLibraryInfo. - */ - public LinuxCLIInfoSharedLibraryInfo( MIOutput out ) { - super( out ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.core.output.CLIInfoSharedLibraryInfo#parseShared(java.lang.String, java.util.List) - */ - @Override - protected void parseShared( String str, List aList ) { - if ( str.length() > 0 && !str.startsWith( "From" ) ) { //$NON-NLS-1$ - // Pass the header - int index = -1; - String from = ""; //$NON-NLS-1$ - String to = ""; //$NON-NLS-1$ - boolean syms = false; - String name = ""; //$NON-NLS-1$ - for( int i = 0; (index = str.lastIndexOf( ' ' )) != -1 || i <= 3; i++ ) { - if ( index == -1 ) { - index = 0; - } - String sub = str.substring( index ).trim(); - // move to previous column - str = str.substring( 0, index ).trim(); - switch( i ) { - case 0: - name = sub; - break; - case 1: - if ( sub.equalsIgnoreCase( "Yes" ) ) { //$NON-NLS-1$ - syms = true; - } - break; - case 2: // second column is "To" - to = sub; - break; - case 3: // first column is "From" - from = sub; - break; - } - } - if ( name.length() > 0 ) { - MIShared s = new MIShared( from, to, syms, name ); - aList.add( s ); - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/linux/StandardLinuxCommandFactory.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/linux/StandardLinuxCommandFactory.java deleted file mode 100644 index ef7e7065037..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/linux/StandardLinuxCommandFactory.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.command.factories.linux; - -import org.eclipse.cdt.debug.mi.core.command.CLIInfoSharedLibrary; -import org.eclipse.cdt.debug.mi.core.command.MIGDBSetNewConsole; -import org.eclipse.cdt.debug.mi.core.command.factories.StandardCommandFactory; - -/** - * Command factory for the standard gdb/mi protocol for Linux. - */ -public class StandardLinuxCommandFactory extends StandardCommandFactory { - - /** - * Constructor for StandardLinuxCommandFactory. - */ - public StandardLinuxCommandFactory() { - super(); - } - - /** - * Constructor for StandardLinuxCommandFactory. - */ - public StandardLinuxCommandFactory( String miVersion ) { - super( miVersion ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.core.command.CommandFactory#createCLIInfoSharedLibrary() - */ - @Override - public CLIInfoSharedLibrary createCLIInfoSharedLibrary() { - return new LinuxCLIInfoSharedLibrary(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.core.command.CommandFactory#createMIGDBSetNewConsole() - */ - @Override - public MIGDBSetNewConsole createMIGDBSetNewConsole() { - // Suppress "set new-console" - returns error on Linux - return new MIGDBSetNewConsole( getMIVersion() ) { - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.core.command.MICommand#getOperation() - */ - @Override - public String getOperation() { - return ""; //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.core.command.MICommand#getOptions() - */ - @Override - public String[] getOptions() { - return new String[0]; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.core.command.MICommand#getParameters() - */ - @Override - public String[] getParameters() { - return new String[0]; - } - }; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/MacOSCLIInfoPID.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/MacOSCLIInfoPID.java deleted file mode 100644 index 14382356573..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/MacOSCLIInfoPID.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2012 ENEA Software AB and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * ENEA Software AB - CLI command extension - fix for bug 190277 - * Marc-Andre Laperle - Replace info proc with info pid, patch for bug 294538 - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.command.factories.macos; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.command.CLIInfoProc; -import org.eclipse.cdt.debug.mi.core.output.CLIInfoProcInfo; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; -import org.eclipse.cdt.debug.mi.core.output.MIResult; - -/** - * GDB/CLI info proc parsing. 18 info pid &"info pid\n" - * 18^done,process-id="89643" - * - */ -class MacOSCLIInfoPID extends CLIInfoProc { - - // apple-gdb doesn't have info proc but has info pid - // Since info proc is only used to get the pid, it is valid to use info pid - // as a replacement - public MacOSCLIInfoPID() { - setOperation("info pid"); //$NON-NLS-1$ - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new MacOSCLIInfoPIDOutput(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } - - class MacOSCLIInfoPIDOutput extends CLIInfoProcInfo { - - int pid; - - public MacOSCLIInfoPIDOutput(MIOutput out) { - super(out); - parsePID(); - } - - void parsePID() { - if (isDone()) { - MIOutput out = getMIOutput(); - MIResult[] rr = out.getMIResultRecord().getMIResults(); - for (int i = 0; i < rr.length; i++) { - parsePIDLine(rr[i].toString()); - } - } - } - - void parsePIDLine(String str) { - if (str != null && str.length() > 0) { - str = str.trim(); - if (!str.startsWith("process-id=")) { //$NON-NLS-1$ - return; - } - - pid = Integer.decode(str.substring(12, str.length() - 1)) - .intValue(); - } - } - - @Override - public int getPID() { - return pid; - } - - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/MacOSCLIInfoThreads.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/MacOSCLIInfoThreads.java deleted file mode 100644 index 83303eeebdf..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/MacOSCLIInfoThreads.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - * Marc-Andre Laperle - use -thread-list-ids for mac, fix for bug 294538 - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.command.factories.macos; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.command.CLIInfoThreads; -import org.eclipse.cdt.debug.mi.core.output.CLIInfoThreadsInfo; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; - -class MacOSCLIInfoThreads extends CLIInfoThreads { - public MacOSCLIInfoThreads() { - super(); - // with apple-gdb, we use -thread-list-ids as a replacement for info - // threads - setOperation("-thread-list-ids"); //$NON-NLS-1$ - } - - // MI doesn't work with a space between the token and the - // operation, so we override CLICommmand's toString - @Override - public String toString() { - return getToken() + getOperation() + "\n"; //$NON-NLS-1$ - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new MacOsCLIInfoThreadsInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } - - @Override - public CLIInfoThreadsInfo getMIInfoThreadsInfo() throws MIException { - return (CLIInfoThreadsInfo) getMIInfo(); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/MacOSCLIPtype.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/MacOSCLIPtype.java deleted file mode 100644 index 371480c4844..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/MacOSCLIPtype.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2012 Nokia and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nokia - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.command.factories.macos; - -import org.eclipse.cdt.debug.mi.core.command.CLIPType; - -class MacOSCLIPtype extends CLIPType { - - public MacOSCLIPtype(String var) { - super(var); - // apple-gdb does not give a ^error response with an invalid CLI command - // but with -interpreter-exec console it does - setOperation("-interpreter-exec console \"ptype " + var + "\""); //$NON-NLS-1$ //$NON-NLS-2$ - } - - // MI doesn't work with a space between the token and the - // operation, so we override CLICommmand's toString - @Override - public String toString() { - return getToken() + getOperation() + "\n"; //$NON-NLS-1$ - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/MacOSMIEnvironmentCD.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/MacOSMIEnvironmentCD.java deleted file mode 100644 index 6eea7a50fc4..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/MacOSMIEnvironmentCD.java +++ /dev/null @@ -1,34 +0,0 @@ -/********************************************************************** - * Copyright (c) 2006, 2012 Nokia and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nokia - Initial API and implementation - * Marc-Andre Laperle - fix for bug 263689 (spaces in directory) -***********************************************************************/ -package org.eclipse.cdt.debug.mi.core.command.factories.macos; - -import org.eclipse.cdt.debug.mi.core.command.MIEnvironmentCD; - -public class MacOSMIEnvironmentCD extends MIEnvironmentCD { - - public MacOSMIEnvironmentCD(String miVersion, String path) { - super(miVersion, path); - this.setOperation("-environment-cd");//$NON-NLS-1$ - } - - @Override - protected String parametersToString() { - String[] parameters = getParameters(); - if (parameters != null && parameters.length == 1) { - // To handle spaces in the path, the command string has this format: - // -environment-cd "\"/path with spaces\"" - return "\"\\\"" + parameters[0] + "\\\"\""; //$NON-NLS-1$ //$NON-NLS-2$ - } - return super.parametersToString(); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/MacOSMIVarUpdate.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/MacOSMIVarUpdate.java deleted file mode 100644 index f031766f804..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/MacOSMIVarUpdate.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - * Marc-Andre Laperle - patch for bug #250037 - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.command.factories.macos; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.command.MIVarUpdate; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; - -/** - *@see MIVarUpdate - * - * Apple gdb needs special handling for MIVarUpdateInfo so we need this class - * to override getMIInfo to return a MacOSMIVarUpdateInfo instead - */ -class MacOSMIVarUpdate extends MIVarUpdate { - - public MacOSMIVarUpdate(String miVersion) { - super(miVersion); - } - - public MacOSMIVarUpdate(String miVersion, String name) { - super(miVersion, name); - } - - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if (out != null) { - info = new MacOSMIVarUpdateInfo(out); - if (info.isError()) { - throwMIException(info, out); - } - } - return info; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/MacOSMIVarUpdateInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/MacOSMIVarUpdateInfo.java deleted file mode 100644 index 570472b5018..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/MacOSMIVarUpdateInfo.java +++ /dev/null @@ -1,132 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - * Marc-Andre Laperle - patch for bug #250037 - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.command.factories.macos; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.cdt.debug.mi.core.output.MIConst; -import org.eclipse.cdt.debug.mi.core.output.MIList; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; -import org.eclipse.cdt.debug.mi.core.output.MIResult; -import org.eclipse.cdt.debug.mi.core.output.MIResultRecord; -import org.eclipse.cdt.debug.mi.core.output.MITuple; -import org.eclipse.cdt.debug.mi.core.output.MIValue; -import org.eclipse.cdt.debug.mi.core.output.MIVarChange; -import org.eclipse.cdt.debug.mi.core.output.MIVarUpdateInfo; - -/** - * GDB/MI var-update for Apple gdb - * -var-update * - * ^done,changelist=[varobj={name="var1",in_scope="true",type_changed="false"}],time={.....} - */ -class MacOSMIVarUpdateInfo extends MIVarUpdateInfo { - - MIVarChange[] changeList; - - public MacOSMIVarUpdateInfo(MIOutput record) { - super(record); - parse(); - } - - @Override - public MIVarChange[] getMIVarChanges() { - return changeList; - } - - void parse() { - List aList = new ArrayList(); - 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 = (MIVarChange[])aList.toArray(new MIVarChange[aList.size()]); - } - - /** - * For MI2 the format is now a MIList. - * @param tuple - * @param aList - */ - void parseChangeList(MIList miList, List aList) { - MIValue[] values = miList.getMIValues(); - for (int i = 0; i < values.length; ++i) { - if (values[i] instanceof MITuple) { - parseChangeList((MITuple)values[i], aList); - } else if (values[i] instanceof MIList) { - parseChangeList((MIList)values[i], aList); - } - } - - // The MIList in Apple gdb contains MIResults instead of MIValues. It looks like: - // ^done,changelist=[varobj={name="var1",in_scope="true",type_changed="false"}],time={.....} - // Bug 250037 - MIResult[] results = miList.getMIResults(); - for (int i = 0; i < results.length; i++) { - String var = results[i].getVariable(); - if (var.equals("varobj")) { //$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); - } - } - } - } - - void parseChangeList(MITuple tuple, List aList) { - MIResult[] results = tuple.getMIResults(); - MIVarChange change = null; - for (int i = 0; i < results.length; i++) { - String var = results[i].getVariable(); - MIValue value = results[i].getMIValue(); - if (value instanceof MITuple) { - parseChangeList((MITuple)value, aList); - } - else - { - String str = ""; //$NON-NLS-1$ - if (value instanceof MIConst) { - str = ((MIConst)value).getString(); - } - if (var.equals("name")) { //$NON-NLS-1$ - change = new MIVarChange(str); - aList.add(change); - } else if (var.equals("in_scope")) { //$NON-NLS-1$ - if (change != null) { - change.setInScope("true".equals(str)); //$NON-NLS-1$ - } - } else if (var.equals("type_changed")) { //$NON-NLS-1$ - if (change != null) { - change.setChanged("true".equals(str)); //$NON-NLS-1$ - } - } - } - } - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/MacOsCLIInfoThreadsInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/MacOsCLIInfoThreadsInfo.java deleted file mode 100644 index 32ad4c48662..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/MacOsCLIInfoThreadsInfo.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - * Marc-Andre Laperle - use -thread-list-ids for mac, fix for bug 294538 - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.command.factories.macos; - -import java.util.Arrays; - -import org.eclipse.cdt.debug.mi.core.output.CLIInfoThreadsInfo; -import org.eclipse.cdt.debug.mi.core.output.MIConst; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; -import org.eclipse.cdt.debug.mi.core.output.MIResult; -import org.eclipse.cdt.debug.mi.core.output.MIResultRecord; -import org.eclipse.cdt.debug.mi.core.output.MITuple; -import org.eclipse.cdt.debug.mi.core.output.MIValue; - -/** - * This class actually parses -thread-list-ids and converts it to the - * CLIInfoThreadsInfo 'format' - */ -class MacOsCLIInfoThreadsInfo extends CLIInfoThreadsInfo { - - public MacOsCLIInfoThreadsInfo(MIOutput out) { - super(out); - } - - @Override - protected 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(); - if (var.equals("thread-ids")) { //$NON-NLS-1$ - MIValue val = results[i].getMIValue(); - if (val instanceof MITuple) { - parseThreadIds((MITuple) val); - } - } - } - } - } - if (threadIds == null) { - threadIds = new int[0]; - } - Arrays.sort(threadIds); - if (threadIds.length > 0) { - currentThreadId = threadIds[0]; - } - } - - void parseThreadIds(MITuple tuple) { - MIResult[] results = tuple.getMIResults(); - threadIds = new int[results.length]; - for (int i = 0; i < results.length; i++) { - String var = results[i].getVariable(); - if (var.equals("thread-id")) { //$NON-NLS-1$ - MIValue value = results[i].getMIValue(); - if (value instanceof MIConst) { - String str = ((MIConst) value).getCString(); - try { - threadIds[i] = Integer.parseInt(str.trim()); - } catch (NumberFormatException e) { - } - } - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/StandardMacOSCommandFactory.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/StandardMacOSCommandFactory.java deleted file mode 100644 index 90cef376873..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/StandardMacOSCommandFactory.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2012 Nokia and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nokia - Initial API and implementation - * Marc-Andre Laperle - patch for bug #250037, 294538 - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.command.factories.macos; - -import java.io.File; - -import org.eclipse.cdt.debug.mi.core.command.CLIInfoProc; -import org.eclipse.cdt.debug.mi.core.command.CLIInfoThreads; -import org.eclipse.cdt.debug.mi.core.command.CLIPType; -import org.eclipse.cdt.debug.mi.core.command.MIEnvironmentCD; -import org.eclipse.cdt.debug.mi.core.command.MIExecInterrupt; -import org.eclipse.cdt.debug.mi.core.command.MIInfoSharedLibrary; -import org.eclipse.cdt.debug.mi.core.command.MIVarUpdate; -import org.eclipse.cdt.debug.mi.core.command.factories.StandardCommandFactory; - -public class StandardMacOSCommandFactory extends StandardCommandFactory { - - /** - * Constructor for StandardMacOSCommandFactory. - */ - public StandardMacOSCommandFactory() { - super(); - } - - @Override - public String getWorkingDirectory(File cwd) { - return "--cd=" + '"' + cwd.getAbsolutePath() + '"'; //$NON-NLS-1$ - } - - /** - * Constructor for StandardMacOSCommandFactory. - */ - public StandardMacOSCommandFactory( String miVersion ) { - super( miVersion ); - } - - @Override - public MIEnvironmentCD createMIEnvironmentCD(String pathdir) { - return new MacOSMIEnvironmentCD(getMIVersion(), pathdir); - } - - @Override - public CLIPType createCLIPType(String name) { - return new MacOSCLIPtype(name); - } - - @Override - public MIInfoSharedLibrary createMIInfoSharedLibrary() { - return new MIInfoSharedLibrary(getMIVersion()); - } - - @Override - public MIVarUpdate createMIVarUpdate() { - return new MacOSMIVarUpdate(getMIVersion()); - } - - @Override - public MIVarUpdate createMIVarUpdate(String name) { - return new MacOSMIVarUpdate(getMIVersion(), name); - } - - @Override - public CLIInfoProc createCLIInfoProc() { - return new MacOSCLIInfoPID(); - } - - @Override - public MIExecInterrupt createMIExecInterrupt() { - return new MIExecInterrupt(getMIVersion()); - } - - @Override - public CLIInfoThreads createCLIInfoThreads() { - return new MacOSCLIInfoThreads(); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/CygwinCommandFactory.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/CygwinCommandFactory.java deleted file mode 100644 index 6ece2e4c9ac..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/CygwinCommandFactory.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.command.factories.win32; - -import java.io.IOException; - -import org.eclipse.cdt.debug.mi.core.CygwinMIProcessAdapter; -import org.eclipse.cdt.debug.mi.core.MIProcess; -import org.eclipse.cdt.debug.mi.core.command.MIEnvironmentDirectory; -import org.eclipse.core.runtime.IProgressMonitor; - -/** - * Command factory for the gdb/mi protocol for CygWin environment. - */ -public class CygwinCommandFactory extends StandardWinCommandFactory { - - /** - * Constructor for CygwinCommandFactory. - */ - public CygwinCommandFactory() { - super(); - } - - /** - * Constructor for CygwinCommandFactory. - */ - public CygwinCommandFactory( String miVersion ) { - super( miVersion ); - } - - @Override - public MIEnvironmentDirectory createMIEnvironmentDirectory(boolean reset, String[] pathdirs) { - return new CygwinMIEnvironmentDirectory( getMIVersion(), reset, pathdirs ); - } - - @Override - public MIProcess createMIProcess(String[] args, int launchTimeout, - IProgressMonitor monitor) throws IOException { - return new CygwinMIProcessAdapter(args, launchTimeout, monitor); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/CygwinMIEnvironmentCD.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/CygwinMIEnvironmentCD.java deleted file mode 100644 index 143d277b275..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/CygwinMIEnvironmentCD.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2010 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command.factories.win32; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import org.eclipse.cdt.core.CommandLauncher; -import org.eclipse.cdt.core.ICommandLauncher; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.Path; - -/** - * CygwinMIEnvironmentCD - */ -public class CygwinMIEnvironmentCD extends WinMIEnvironmentCD { - - CygwinMIEnvironmentCD( String miVersion, String path ) { - super( miVersion, path ); - // Use the cygpath utility to convert the path - ICommandLauncher launcher = new CommandLauncher(); - ByteArrayOutputStream out = new ByteArrayOutputStream(); - ByteArrayOutputStream err = new ByteArrayOutputStream(); - String newPath = null; - try { - launcher.execute( new Path( "cygpath" ), //$NON-NLS-1$ - new String[]{ "-u", path }, //$NON-NLS-1$ - new String[0], new Path( "." ), //$NON-NLS-1$ - null); - } catch (CoreException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - if ( launcher.waitAndRead( out, err ) == ICommandLauncher.OK ) { - newPath = out.toString(); - if ( newPath != null ) { - newPath = newPath.trim(); - if ( newPath.length() > 0 ) { - path = newPath; - } - } - } - try { - out.close(); - err.close(); - } - catch( IOException e ) { - // ignore. - } - setParameters( new String[]{ path } ); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/CygwinMIEnvironmentDirectory.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/CygwinMIEnvironmentDirectory.java deleted file mode 100644 index 43167403bcc..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/CygwinMIEnvironmentDirectory.java +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.command.factories.win32; - -import java.io.ByteArrayOutputStream; -import java.util.StringTokenizer; - -import org.eclipse.cdt.core.CommandLauncher; -import org.eclipse.cdt.core.ICommandLauncher; -import org.eclipse.cdt.debug.mi.core.command.MIEnvironmentDirectory; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.Path; - -/** - * Cygwin implementation of the MIEnvironmentDirectory command. In the cygwin - * environment, the paths are DOS paths and need to be converted to cygwin - * style paths before passing them to gdb. - */ -public class CygwinMIEnvironmentDirectory extends MIEnvironmentDirectory { - - final static private int BUFFER_SIZE = 1000; - - /** - * To prevent to call "cygpath" for each folder (see //bugs.eclipse.org/bugs/show_bug.cgi?id=107202) - * we use the "-p" option of "cygpath". - * We can not convert the whole path in one shot because the size of the spawner's buffer is limited to 2049, - * so we divide the path's folders into groups. - */ - CygwinMIEnvironmentDirectory(String miVersion, boolean reset, String[] paths) { - super(miVersion, reset, paths); - - String[] newpaths = new String[paths.length]; - int index = 0; - while(index < paths.length) { - int length = 0; - StringBuffer sb = new StringBuffer(BUFFER_SIZE); - for (int i = index; i < paths.length; i++) { - if (length + paths[i].length() < BUFFER_SIZE) { - length += paths[i].length(); - newpaths[i] = paths[i]; - sb.append(paths[i]).append(';'); - ++length; - } - else { - convertPath(sb, newpaths, index); - index = i; - break; - } - if (i == paths.length - 1) { - convertPath(sb, newpaths, index); - index = paths.length; - break; - } - } - } - setParameters(newpaths); - } - - /** - * Converts a path to the cygwin path and stores the resulting - * folders into the given array starting from <code>index</code>. - */ - private void convertPath(StringBuffer sb, String[] paths, int index) { - if (sb.charAt(sb.length() - 1) == ';') - sb.deleteCharAt(sb.length() - 1); - String result = convertPath0(sb.toString()); - StringTokenizer st = new StringTokenizer(result, ":"); //$NON-NLS-1$ - int j = index; - while(st.hasMoreTokens()) { - if (j >= paths.length) - break; - paths[j++] = st.nextToken(); - } - } - - /** - * Converts a windows type path into the cygwin type path using "cygpath" - * with the "-p" option. - */ - private String convertPath0(String path) { - String result = path; - ICommandLauncher launcher = new CommandLauncher(); - ByteArrayOutputStream out = new ByteArrayOutputStream(); - try { - launcher.execute( - new Path("cygpath"), //$NON-NLS-1$ - new String[] { "-p", "-u", path }, //$NON-NLS-1$ //$NON-NLS-2$ - new String[0], - new Path("."), null); //$NON-NLS-1$ - } catch (CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - if (launcher.waitAndRead(out, out) == ICommandLauncher.OK) - result = out.toString().trim(); - return result; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/StandardWinCommandFactory.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/StandardWinCommandFactory.java deleted file mode 100644 index 9738ef6b220..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/StandardWinCommandFactory.java +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.command.factories.win32; - -import org.eclipse.cdt.debug.mi.core.command.CLIInfoSharedLibrary; -import org.eclipse.cdt.debug.mi.core.command.MIEnvironmentCD; -import org.eclipse.cdt.debug.mi.core.command.MIGDBSetAutoSolib; -import org.eclipse.cdt.debug.mi.core.command.MIGDBSetNewConsole; -import org.eclipse.cdt.debug.mi.core.command.MIGDBSetSolibSearchPath; -import org.eclipse.cdt.debug.mi.core.command.MIGDBShowSolibSearchPath; -import org.eclipse.cdt.debug.mi.core.command.factories.StandardCommandFactory; - -/** - * Command factory for the standard gdb/mi protocol for Windows. - */ -public class StandardWinCommandFactory extends StandardCommandFactory { - - /** - * Constructor for StandardWinCommandFactory. - */ - public StandardWinCommandFactory() { - super(); - } - - /** - * Constructor for StandardWinCommandFactory. - */ - public StandardWinCommandFactory( String miVersion ) { - super( miVersion ); - } - - @Override - public MIEnvironmentCD createMIEnvironmentCD( String pathdir ) { - return new WinMIEnvironmentCD( getMIVersion(), pathdir ); - } - - @Override - public CLIInfoSharedLibrary createCLIInfoSharedLibrary() { - return new WinCLIInfoSharedLibrary(); - } - - @Override - public MIGDBSetAutoSolib createMIGDBSetAutoSolib( boolean set ) { - return new WinMIGDBSetAutoSolib( getMIVersion(), set ); - } - - @Override - public MIGDBShowSolibSearchPath createMIGDBShowSolibSearchPath() { - // Suppress "show solib-search-path" - returns error on Windows - return new MIGDBShowSolibSearchPath( getMIVersion() ) { - - @Override - public String getOperation() { - return ""; //$NON-NLS-1$ - } - - @Override - public String[] getOptions() { - return new String[0]; - } - - @Override - public String[] getParameters() { - return new String[0]; - } - }; - } - - @Override - public MIGDBSetSolibSearchPath createMIGDBSetSolibSearchPath( String[] params ) { - // Suppress "set solib-search-path" - returns error on Windows - return new MIGDBSetSolibSearchPath( getMIVersion(), params ) { - - @Override - public String getOperation() { - return ""; //$NON-NLS-1$ - } - - @Override - public String[] getOptions() { - return new String[0]; - } - - @Override - public String[] getParameters() { - return new String[0]; - } - }; - } - - @Override - public MIGDBSetNewConsole createMIGDBSetNewConsole() { - // By default in Windows, turn off new console so that the - // Ctrl-C's get propogated automatically to the inferior. - return new MIGDBSetNewConsole(getMIVersion(), "off"); //$NON-NLS-1$ - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/WinCLIInfoSharedLibrary.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/WinCLIInfoSharedLibrary.java deleted file mode 100644 index a61867ba9a8..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/WinCLIInfoSharedLibrary.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.command.factories.win32; - -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.command.CLIInfoSharedLibrary; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; - -/** - * Windows version of "info shared library". - */ -public class WinCLIInfoSharedLibrary extends CLIInfoSharedLibrary { - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.core.command.CLIInfoSharedLibrary#getMIInfo() - */ - @Override - public MIInfo getMIInfo() throws MIException { - MIInfo info = null; - MIOutput out = getMIOutput(); - if ( out != null ) { - info = new WinCLIInfoSharedLibraryInfo( out ); - if ( info.isError() ) { - throwMIException( info, out ); - } - } - return info; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/WinCLIInfoSharedLibraryInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/WinCLIInfoSharedLibraryInfo.java deleted file mode 100644 index 8c63d92f747..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/WinCLIInfoSharedLibraryInfo.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.command.factories.win32; - -import java.util.List; -import org.eclipse.cdt.debug.mi.core.output.CLIInfoSharedLibraryInfo; -import org.eclipse.cdt.debug.mi.core.output.MIOutput; -import org.eclipse.cdt.debug.mi.core.output.MIShared; - -/** - * Windows specific parser of the "info shared" output. - */ -public class WinCLIInfoSharedLibraryInfo extends CLIInfoSharedLibraryInfo { - - public WinCLIInfoSharedLibraryInfo( MIOutput out ) { - super( out ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.core.output.CLIInfoSharedLibraryInfo#parseShared(java.lang.String, java.util.List) - */ - @Override - protected void parseShared( String str, List aList ) { - // skip the header (DLL Name) - if ( !str.startsWith( "DLL" ) ) { //$NON-NLS-1$ - String from = ""; //$NON-NLS-1$ - String to = ""; //$NON-NLS-1$ - boolean syms = true; - int index = str.lastIndexOf( ' ' ); - if ( index > 0 ) { - String sub = str.substring( index ).trim(); - // Go figure they do not print the "0x" to indicate hexadecimal!! - if ( !sub.startsWith( "0x" ) ) { //$NON-NLS-1$ - sub = "0x" + sub; //$NON-NLS-1$ - } - from = sub; - str = str.substring( 0, index ).trim(); - } - MIShared s = new MIShared( from, to, syms, str.trim() ); - aList.add( s ); - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/WinMIEnvironmentCD.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/WinMIEnvironmentCD.java deleted file mode 100644 index 4734478fd12..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/WinMIEnvironmentCD.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.command.factories.win32; - -import org.eclipse.cdt.debug.mi.core.command.MIEnvironmentCD; - -/** - * Comment for . - */ -public class WinMIEnvironmentCD extends MIEnvironmentCD { - - public WinMIEnvironmentCD( String miVersion, String path ) { - super( miVersion, path ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.core.command.MICommand#parametersToString() - */ - @Override - protected String parametersToString() { - String[] params = getParameters(); - if ( params != null && params.length == 1 ) { - StringBuffer sb = new StringBuffer(); - // We need to escape the double quotes and the backslash. - String param = params[0]; - for( int j = 0; j < param.length(); j++ ) { - char c = param.charAt( j ); - if ( c == '"' || c == '\\' ) { - sb.append( '\\' ); - } - sb.append( c ); - } - // If the string contains spaces instead of escaping - // surround the parameter with double quotes. - if ( containsWhitespace( param ) ) { - sb.insert( 0, '"' ); - sb.append( '"' ); - } - return sb.toString().trim(); - } - return super.parametersToString(); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/WinMIGDBSetAutoSolib.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/WinMIGDBSetAutoSolib.java deleted file mode 100644 index cbbd491d71d..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/WinMIGDBSetAutoSolib.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Mentor Graphics and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Mentor Graphics - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.command.factories.win32; - -import org.eclipse.cdt.debug.mi.core.command.MIGDBSetAutoSolib; - -/** - * Suppress "set auto-solib" - returns error on Windows - */ -class WinMIGDBSetAutoSolib extends MIGDBSetAutoSolib { - - public WinMIGDBSetAutoSolib(String miVersion, boolean isSet) { - super(miVersion, isSet); - setOperation(""); //$NON-NLS-1$ - setOptions(new String[0]); - setParameters(new String[0]); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIBreakpointChangedEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIBreakpointChangedEvent.java deleted file mode 100644 index ac75983326a..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIBreakpointChangedEvent.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.event; - -import org.eclipse.cdt.debug.mi.core.MISession; - -public class MIBreakpointChangedEvent extends MIChangedEvent { - - /** - * We need these flags to notify the upper layer what kind of a breakpoint - * has been set from the console. - * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=135250 - */ - public static final int HINT_NONE = 0; - public static final int HINT_NEW_LINE_BREAKPOINT = 1; - public static final int HINT_NEW_FUNCTION_BREAKPOINT = 2; - public static final int HINT_NEW_ADDRESS_BREAKPOINT = 3; - public static final int HINT_NEW_EVENTBREAKPOINT = 4; - - int no = 0; - int hint = HINT_NONE; - - public MIBreakpointChangedEvent(MISession source, int number) { - this(source, 0, number, 0); - } - - public MIBreakpointChangedEvent(MISession source, int number, int hint) { - this(source, 0, number, hint); - } - - public MIBreakpointChangedEvent(MISession source, int id, int number, int hint) { - super(source, id); - this.no = number; - this.hint = hint; - } - - public int getNumber() { - return no; - } - - public int getHint() { - return hint; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIBreakpointCreatedEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIBreakpointCreatedEvent.java deleted file mode 100644 index d9a43d0a20c..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIBreakpointCreatedEvent.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.event; - -import org.eclipse.cdt.debug.mi.core.MISession; - - - -/** - * - */ -public class MIBreakpointCreatedEvent extends MICreatedEvent { - - int no; - - public MIBreakpointCreatedEvent(MISession source, int number) { - this(source, 0, number); - } - - public MIBreakpointCreatedEvent(MISession source, int id, int number) { - super(source, id); - no = number; - } - - public int getNumber() { - return no; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIBreakpointDeletedEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIBreakpointDeletedEvent.java deleted file mode 100644 index 224a21be73d..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIBreakpointDeletedEvent.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.event; - -import org.eclipse.cdt.debug.mi.core.MISession; - - - -/** - * - */ -public class MIBreakpointDeletedEvent extends MIDestroyedEvent { - - int no; - - public MIBreakpointDeletedEvent(MISession source, int number) { - this(source, 0, number); - } - - public MIBreakpointDeletedEvent(MISession source, int id, int number) { - super(source, id); - no = number; - } - - public int getNumber() { - return no; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIBreakpointHitEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIBreakpointHitEvent.java deleted file mode 100644 index 062d5403633..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIBreakpointHitEvent.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.event; - -import org.eclipse.cdt.debug.mi.core.MISession; -import org.eclipse.cdt.debug.mi.core.output.MIConst; -import org.eclipse.cdt.debug.mi.core.output.MIExecAsyncOutput; -import org.eclipse.cdt.debug.mi.core.output.MIFrame; -import org.eclipse.cdt.debug.mi.core.output.MIResult; -import org.eclipse.cdt.debug.mi.core.output.MIResultRecord; -import org.eclipse.cdt.debug.mi.core.output.MITuple; -import org.eclipse.cdt.debug.mi.core.output.MIValue; - -/** - * ^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"} - * - */ -public class MIBreakpointHitEvent extends MIStoppedEvent { - - int bkptno; - MIFrame frame; - - public MIBreakpointHitEvent(MISession source, MIExecAsyncOutput record) { - super(source, record); - parse(); - } - - public MIBreakpointHitEvent(MISession source, MIResultRecord record) { - super(source, record); - parse(); - } - - /** - * This constructor is used for catchpoint hits with gdb < 7.0. In that - * environment, we have to get creative as gdb doesn't send us a reason with - * the stopped event. Fortunately, a stream record tells us the target has - * stopped because of a catchpoint and the associated breakpoint number. - * - * @since 7.0 - */ - public MIBreakpointHitEvent(MISession source, MIExecAsyncOutput record, int bkptNumber) { - super(source, record); - parse(); - bkptno = bkptNumber; - assert bkptNumber > 0; // we know gdb bkpt numbers are 1-based - } - - public int getNumber() { - return bkptno; - } - - public MIFrame getMIFrame() { - return frame; - } - - @Override - public String toString() { - StringBuffer buffer = new StringBuffer(); - buffer.append("number=").append(bkptno).append('\n'); //$NON-NLS-1$ - buffer.append("thread-id=").append(getThreadId()).append('\n'); //$NON-NLS-1$ - buffer.append(frame.toString()); - return buffer.toString(); - } - - @Override - void parse () { - MIResult[] results = null; - MIExecAsyncOutput exec = getMIExecAsyncOutput(); - MIResultRecord rr = getMIResultRecord(); - if (exec != null) { - results = exec.getMIResults(); - } else if (rr != null) { - results = rr.getMIResults(); - } - 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 != null && value instanceof MIConst) { - str = ((MIConst)value).getString(); - } - - if (var.equals("bkptno")) { //$NON-NLS-1$ - try { - bkptno = Integer.parseInt(str.trim()); - } catch (NumberFormatException e) { - } - } else if (var.equals("thread-id")) { //$NON-NLS-1$ - try { - int id = Integer.parseInt(str.trim()); - setThreadId(id); - } catch (NumberFormatException e) { - } - } else if (var.equals("frame")) { //$NON-NLS-1$ - if (value instanceof MITuple) { - frame = new MIFrame((MITuple)value); - } - } - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIChangedEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIChangedEvent.java deleted file mode 100644 index c7d886a93a5..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIChangedEvent.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.event; - -import org.eclipse.cdt.debug.mi.core.MISession; - - - -/** - * This can not be detected yet by gdb/mi. - * - */ -public abstract class MIChangedEvent extends MIEvent { - public MIChangedEvent(MISession source, int id) { - super(source, id); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MICreatedEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MICreatedEvent.java deleted file mode 100644 index 00c7e7036dc..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MICreatedEvent.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.event; - -import org.eclipse.cdt.debug.mi.core.MISession; - - - -/** - * This can not be detected yet by gdb/mi. - * - */ -public abstract class MICreatedEvent extends MIEvent { - public MICreatedEvent(MISession source, int id) { - super(source, id); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIDestroyedEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIDestroyedEvent.java deleted file mode 100644 index 2f52bbfacbd..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIDestroyedEvent.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.event; - -import org.eclipse.cdt.debug.mi.core.MISession; - - - -/** - * This can not be detected yet by gdb/mi. - * - */ -public abstract class MIDestroyedEvent extends MIEvent { - public MIDestroyedEvent(MISession source, int id) { - super(source, id); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIDetachedEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIDetachedEvent.java deleted file mode 100644 index d56cb1fdf1c..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIDetachedEvent.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.event; - -import org.eclipse.cdt.debug.mi.core.MISession; - - - -/** - * - * ^running - */ -public class MIDetachedEvent extends MIDestroyedEvent { - - public MIDetachedEvent(MISession source, int token) { - super(source, token); - } - - @Override - public String toString() { - return "Detached"; //$NON-NLS-1$ - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIErrorEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIErrorEvent.java deleted file mode 100644 index f2b1b5bc9d9..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIErrorEvent.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.event; - -import org.eclipse.cdt.debug.mi.core.MISession; -import org.eclipse.cdt.debug.mi.core.output.MIConst; -import org.eclipse.cdt.debug.mi.core.output.MILogStreamOutput; -import org.eclipse.cdt.debug.mi.core.output.MIOOBRecord; -import org.eclipse.cdt.debug.mi.core.output.MIResult; -import org.eclipse.cdt.debug.mi.core.output.MIResultRecord; -import org.eclipse.cdt.debug.mi.core.output.MIStreamRecord; -import org.eclipse.cdt.debug.mi.core.output.MIValue; - - - -/** - * (gdb) - * &"warning: Cannot insert breakpoint 2:\n" - * &"Cannot access memory at address 0x8020a3\n" - * 30^error,msg=3D"Cannot access memory at address 0x8020a3"=20 - */ -public class MIErrorEvent extends MIStoppedEvent { - - String msg = ""; //$NON-NLS-1$ - String log = ""; //$NON-NLS-1$ - MIOOBRecord[] oobs; - - public MIErrorEvent(MISession source, MIResultRecord rr, MIOOBRecord[] o) { - super(source, rr); - oobs = o; - parse(); - } - - public String getMessage() { - return msg; - } - - public String getLogMessage() { - return log; - } - - @Override - void parse () { - MIResultRecord rr = getMIResultRecord(); - if (rr != null) { - MIResult[] results = rr.getMIResults(); - 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("msg")) { //$NON-NLS-1$ - msg = str; - } - } - } - if (oobs != null) { - StringBuffer sb = new StringBuffer(); - 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(); - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIEvent.java deleted file mode 100644 index f6501093d47..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIEvent.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.event; - -import java.util.EventObject; - -import org.eclipse.cdt.debug.mi.core.MISession; - -/** - */ -public abstract class MIEvent extends EventObject { - - int token; - boolean propagate = true; - - public MIEvent(MISession session, int token) { - super(session); - this.token = token; - } - - public int getToken() { - return token; - } - - public MISession getMISession() { - return (MISession)getSource(); - } - - public boolean propagate() { - return propagate; - } - - public void setPropagate( boolean propagate ) { - this.propagate = propagate; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIFunctionFinishedEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIFunctionFinishedEvent.java deleted file mode 100644 index ed34a8a0ba9..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIFunctionFinishedEvent.java +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.event; - -import org.eclipse.cdt.debug.mi.core.MISession; -import org.eclipse.cdt.debug.mi.core.output.MIConst; -import org.eclipse.cdt.debug.mi.core.output.MIExecAsyncOutput; -import org.eclipse.cdt.debug.mi.core.output.MIFrame; -import org.eclipse.cdt.debug.mi.core.output.MIResult; -import org.eclipse.cdt.debug.mi.core.output.MIResultRecord; -import org.eclipse.cdt.debug.mi.core.output.MITuple; -import org.eclipse.cdt.debug.mi.core.output.MIValue; - -/** - * *stopped,reason="function-finished",thread-id="0",frame={addr="0x0804855a",func="main",args=[{name="argc",value="1"},{name="argv",value="0xbffff18c"}],file="hello.c",line="17"},gdb-result-var="$1",return-value="10" - */ -public class MIFunctionFinishedEvent extends MIStoppedEvent { - - String gdbResult = ""; //$NON-NLS-1$ - String returnValue = ""; //$NON-NLS-1$ - String returnType = ""; //$NON-NLS-1$ - - public MIFunctionFinishedEvent(MISession source, MIExecAsyncOutput async) { - super(source, async); - parse(); - } - - public MIFunctionFinishedEvent(MISession source, MIResultRecord record) { - super(source, record); - parse(); - } - - public String getGDBResultVar() { - return gdbResult; - } - - public String getReturnValue() { - return returnValue; - } - - public String getReturnType() { - return returnType; - } - - @Override - public String toString() { - StringBuffer buffer = new StringBuffer(); - buffer.append("gdb-result-var=" + gdbResult + "\n"); //$NON-NLS-1$//$NON-NLS-2$ - buffer.append("return-value=" + returnValue + "\n"); //$NON-NLS-1$//$NON-NLS-2$ - buffer.append("return-type=" + returnType + "\n"); //$NON-NLS-1$//$NON-NLS-2$ - buffer.append("thread-id=").append(getThreadId()).append('\n'); //$NON-NLS-1$ - MIFrame f = getFrame(); - if (f != null) { - buffer.append(f.toString()); - } - return buffer.toString(); - } - - @Override - void parse () { - MIExecAsyncOutput exec = getMIExecAsyncOutput(); - MIResultRecord rr = getMIResultRecord(); - - MIResult[] results = null; - if (exec != null) { - results = exec.getMIResults(); - } else if (rr != null) { - results = rr.getMIResults(); - } - 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("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; - } else if (var.equals("thread-id")) { //$NON-NLS-1$ - try { - int id = Integer.parseInt(str.trim()); - setThreadId(id); - } catch (NumberFormatException e) { - } - } else if (var.equals("frame")) { //$NON-NLS-1$ - if (value instanceof MITuple) { - MIFrame f = new MIFrame((MITuple)value); - setFrame(f); - } - } - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIGDBExitEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIGDBExitEvent.java deleted file mode 100644 index acd34f57fdd..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIGDBExitEvent.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.event; - -import org.eclipse.cdt.debug.mi.core.MISession; - - - -/** - * Gdb Session terminated. - */ -public class MIGDBExitEvent extends MIDestroyedEvent { - - public MIGDBExitEvent(MISession source, int token) { - super(source, token); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIInferiorCreatedEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIInferiorCreatedEvent.java deleted file mode 100644 index 59f8fbd7a64..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIInferiorCreatedEvent.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.event; - -import org.eclipse.cdt.debug.mi.core.MISession; - -/** - * MIInferiorCreatedEvent - */ -public class MIInferiorCreatedEvent extends MICreatedEvent { - - /** - * @param source - * @param id - */ - public MIInferiorCreatedEvent(MISession source, int id) { - super(source, id); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIInferiorExitEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIInferiorExitEvent.java deleted file mode 100644 index 5b7abbc63ff..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIInferiorExitEvent.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.event; - -import org.eclipse.cdt.debug.mi.core.MISession; -import org.eclipse.cdt.debug.mi.core.output.MIConst; -import org.eclipse.cdt.debug.mi.core.output.MIExecAsyncOutput; -import org.eclipse.cdt.debug.mi.core.output.MIResult; -import org.eclipse.cdt.debug.mi.core.output.MIResultRecord; -import org.eclipse.cdt.debug.mi.core.output.MIValue; - - - -/** - * *stopped,reason="exited-normally" - * *stopped,reason="exited",exit-code="04" - * ^done,reason="exited",exit-code="04" - * - */ -public class MIInferiorExitEvent extends MIDestroyedEvent { - - int code = 0; - - MIExecAsyncOutput exec = null; - MIResultRecord rr = null; - - public MIInferiorExitEvent(MISession source, int token) { - super(source, token); - } - - public MIInferiorExitEvent(MISession source, MIExecAsyncOutput async) { - super(source, async.getToken()); - exec = async; - parse(); - } - - public MIInferiorExitEvent(MISession source, MIResultRecord record) { - super(source, record.getToken()); - rr = record; - parse(); - } - - public int getExitCode() { - return code; - } - - void parse () { - MIResult[] results = null; - if (exec != null) { - results = exec.getMIResults(); - } else if (rr != null) { - results = rr.getMIResults(); - } - - 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) { - } - } - } - } - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIInferiorSignalExitEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIInferiorSignalExitEvent.java deleted file mode 100644 index 43b55915478..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIInferiorSignalExitEvent.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.event; - -import org.eclipse.cdt.debug.mi.core.MISession; -import org.eclipse.cdt.debug.mi.core.output.MIConst; -import org.eclipse.cdt.debug.mi.core.output.MIExecAsyncOutput; -import org.eclipse.cdt.debug.mi.core.output.MIResult; -import org.eclipse.cdt.debug.mi.core.output.MIResultRecord; -import org.eclipse.cdt.debug.mi.core.output.MIValue; - -/** - * signal 2 - * "signal 2\n" - * ^done,reason="exited-signalled",signal-name="SIGINT",signal-meaning="Interrupt" - * - */ -public class MIInferiorSignalExitEvent extends MIDestroyedEvent { - - String sigName = ""; //$NON-NLS-1$ - String sigMeaning = ""; //$NON-NLS-1$ - - MIExecAsyncOutput exec = null; - MIResultRecord rr = null; - - public MIInferiorSignalExitEvent(MISession source, MIExecAsyncOutput async) { - super(source, async.getToken()); - exec = async; - parse(); - } - - public MIInferiorSignalExitEvent(MISession source, MIResultRecord record) { - super(source, record.getToken()); - rr = record; - parse(); - } - - public String getName() { - return sigName; - } - - public String getMeaning() { - return sigMeaning; - } - - @Override - public String toString() { - StringBuffer buffer = new StringBuffer(); - buffer.append("signal-name=" + sigName + "\n"); //$NON-NLS-1$//$NON-NLS-2$ - buffer.append("signal-meaning=" + sigMeaning + "\n"); //$NON-NLS-1$//$NON-NLS-2$ - return buffer.toString(); - } - - void parse () { - MIResult[] results = null; - if (exec != null) { - results = exec.getMIResults(); - } else if (rr != null) { - results = rr.getMIResults(); - } - 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("signal-name")) { //$NON-NLS-1$ - sigName = str; - } else if (var.equals("signal-meaning")) { //$NON-NLS-1$ - sigMeaning = str; - } - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MILocationReachedEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MILocationReachedEvent.java deleted file mode 100644 index f93fe2b7a5d..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MILocationReachedEvent.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.event; - -import org.eclipse.cdt.debug.mi.core.MISession; -import org.eclipse.cdt.debug.mi.core.output.MIConst; -import org.eclipse.cdt.debug.mi.core.output.MIExecAsyncOutput; -import org.eclipse.cdt.debug.mi.core.output.MIFrame; -import org.eclipse.cdt.debug.mi.core.output.MIResult; -import org.eclipse.cdt.debug.mi.core.output.MIResultRecord; -import org.eclipse.cdt.debug.mi.core.output.MITuple; -import org.eclipse.cdt.debug.mi.core.output.MIValue; - -/** - * *stopped,reason="location-reached",thread-id="0",frame={addr="0x0804858e",func="main2",args=[],file="hello.c",line="27"} - */ -public class MILocationReachedEvent extends MIStoppedEvent { - - public MILocationReachedEvent(MISession source, MIExecAsyncOutput async) { - super(source, async); - parse(); - } - - public MILocationReachedEvent(MISession source, MIResultRecord record) { - super(source, record); - parse(); - } - - @Override - public String toString() { - StringBuffer buffer = new StringBuffer(); - buffer.append("thread-id=").append(getThreadId()).append('\n'); //$NON-NLS-1$ - MIFrame f = getFrame(); - if (f != null) { - buffer.append(f.toString()); - } - return buffer.toString(); - } - - @Override - void parse () { - MIResult[] results = null; - MIExecAsyncOutput exec = getMIExecAsyncOutput(); - MIResultRecord rr = getMIResultRecord(); - - if (exec != null) { - results = exec.getMIResults(); - } else if (rr != null) { - results = rr.getMIResults(); - } - 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("thread-id")) { //$NON-NLS-1$ - try { - int id = Integer.parseInt(str.trim()); - setThreadId(id); - } catch (NumberFormatException e) { - } - } else if (var.equals("frame")) { //$NON-NLS-1$ - if (value instanceof MITuple) { - MIFrame f = new MIFrame((MITuple)value); - setFrame(f); - } - } - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIMemoryChangedEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIMemoryChangedEvent.java deleted file mode 100644 index 32142332237..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIMemoryChangedEvent.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.event; - -import java.math.BigInteger; - -import org.eclipse.cdt.debug.mi.core.MISession; - -/** - * This can not be detected yet by gdb/mi. - * - */ -public class MIMemoryChangedEvent extends MIChangedEvent { - - BigInteger[] addresses; - - public MIMemoryChangedEvent(MISession source, BigInteger[] addrs) { - this(source, 0, addrs); - } - - public MIMemoryChangedEvent(MISession source, int token, BigInteger[] addrs) { - super(source, token); - addresses = addrs; - } - - public BigInteger[] getAddresses() { - return addresses; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIMemoryCreatedEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIMemoryCreatedEvent.java deleted file mode 100644 index 2cf2db807e5..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIMemoryCreatedEvent.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.event; - -import java.math.BigInteger; - -import org.eclipse.cdt.debug.mi.core.MISession; - - - -/** - * This can not be detected yet by gdb/mi. - * - */ -public class MIMemoryCreatedEvent extends MICreatedEvent { - - BigInteger address; - long totalBytes; - - public MIMemoryCreatedEvent(MISession source, BigInteger addr, long total) { - this(source, 0, addr, total); - } - - public MIMemoryCreatedEvent(MISession source, int token, BigInteger addr, long total) { - super(source, token); - address = addr; - totalBytes = total; - } - - public BigInteger getAddress() { - return address; - } - - public long getLength() { - return totalBytes; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIRegisterChangedEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIRegisterChangedEvent.java deleted file mode 100644 index 1d9bf6eb34a..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIRegisterChangedEvent.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.event; - -import org.eclipse.cdt.debug.mi.core.MISession; - - - -/** - * This can not be detected yet by gdb/mi. - * - */ -public class MIRegisterChangedEvent extends MIChangedEvent { - - String regName; - int regno; - - public MIRegisterChangedEvent(MISession source, int token, String name, int no) { - super(source, token); - regName = name; - regno = no; - } - - public String getName() { - return regName; - } - - public int getNumber() { - return regno; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIRegisterCreatedEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIRegisterCreatedEvent.java deleted file mode 100644 index 580fd44ba34..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIRegisterCreatedEvent.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.event; - -import org.eclipse.cdt.debug.mi.core.MISession; - - - -/** - * This can not be detected yet by gdb/mi. - * - */ -public class MIRegisterCreatedEvent extends MICreatedEvent { - - String regName; - int regno; - - public MIRegisterCreatedEvent(MISession source, String name, int number) { - this(source, 0, name, number); - } - - public MIRegisterCreatedEvent(MISession source, int token, String name, int number) { - super(source, token); - regName = name; - regno = number; - } - - public String getName() { - return regName; - } - - public int getNumber() { - return regno; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIRunningEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIRunningEvent.java deleted file mode 100644 index 35699d6694b..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIRunningEvent.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.event; - -import org.eclipse.cdt.debug.mi.core.MISession; - - - -/** - * - * ^running - */ -public class MIRunningEvent extends MIEvent { - - 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; - - int type; - - public MIRunningEvent(MISession source, int token, int t) { - super(source, token); - type = t; - } - - public int getType() { - return type; - } - - @Override - public String toString() { - return "Running"; //$NON-NLS-1$ - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MISharedLibChangedEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MISharedLibChangedEvent.java deleted file mode 100644 index 91a487fc998..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MISharedLibChangedEvent.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.event; - -import org.eclipse.cdt.debug.mi.core.MISession; - - - -/** - * - */ -public class MISharedLibChangedEvent extends MIChangedEvent { - - String filename; - - public MISharedLibChangedEvent(MISession source, String name) { - this(source, 0, name); - } - - public MISharedLibChangedEvent(MISession source, int id, String name) { - super(source, id); - filename = name; - } - - public String getName() { - return filename; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MISharedLibCreatedEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MISharedLibCreatedEvent.java deleted file mode 100644 index e2c8aff21ab..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MISharedLibCreatedEvent.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.event; - -import org.eclipse.cdt.debug.mi.core.MISession; - - - -/** - * - */ -public class MISharedLibCreatedEvent extends MICreatedEvent { - - String filename; - - public MISharedLibCreatedEvent(MISession source, String name) { - this(source, 0, name); - } - - public MISharedLibCreatedEvent(MISession source, int id, String name) { - super(source, id); - filename = name; - } - - public String getName() { - return filename; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MISharedLibEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MISharedLibEvent.java deleted file mode 100644 index 30cca3c4656..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MISharedLibEvent.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.event; - -import org.eclipse.cdt.debug.mi.core.MISession; -import org.eclipse.cdt.debug.mi.core.output.MIExecAsyncOutput; -import org.eclipse.cdt.debug.mi.core.output.MIResultRecord; - - - -/** - * - */ -public class MISharedLibEvent extends MIStoppedEvent { - - public MISharedLibEvent(MISession source, MIExecAsyncOutput async) { - super(source, async); - parse(); - } - - public MISharedLibEvent(MISession source, MIResultRecord record) { - super(source, record); - parse(); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MISharedLibUnloadedEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MISharedLibUnloadedEvent.java deleted file mode 100644 index 5e8f4384beb..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MISharedLibUnloadedEvent.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.event; - -import org.eclipse.cdt.debug.mi.core.MISession; - -/** - * - */ -public class MISharedLibUnloadedEvent extends MIDestroyedEvent { - - String filename; - - public MISharedLibUnloadedEvent(MISession source, String name) { - this(source, 0, name); - } - - public MISharedLibUnloadedEvent(MISession source, int id, String name) { - super(source, id); - filename = name; - } - - public String getName() { - return filename; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MISignalChangedEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MISignalChangedEvent.java deleted file mode 100644 index 190e0c2211b..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MISignalChangedEvent.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.event; - -import org.eclipse.cdt.debug.mi.core.MISession; - - - -/** - * - */ -public class MISignalChangedEvent extends MIChangedEvent { - - String name; - - public MISignalChangedEvent(MISession source, String n) { - this(source, 0, n); - } - - public MISignalChangedEvent(MISession source, int id, String n) { - super(source, id); - name = n; - } - - public String getName() { - return name; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MISignalEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MISignalEvent.java deleted file mode 100644 index 3f6117b388a..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MISignalEvent.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.event; - -import org.eclipse.cdt.debug.mi.core.MISession; -import org.eclipse.cdt.debug.mi.core.output.MIConst; -import org.eclipse.cdt.debug.mi.core.output.MIExecAsyncOutput; -import org.eclipse.cdt.debug.mi.core.output.MIFrame; -import org.eclipse.cdt.debug.mi.core.output.MIResult; -import org.eclipse.cdt.debug.mi.core.output.MIResultRecord; -import org.eclipse.cdt.debug.mi.core.output.MITuple; -import org.eclipse.cdt.debug.mi.core.output.MIValue; - -/** - * *stopped,reason="signal-received",signal-name="SIGINT",signal-meaning="Interrupt",thread-id="0",frame={addr="0x400e18e1",func="__libc_nanosleep",args=[],file="__libc_nanosleep",line="-1"} - * - */ -public class MISignalEvent extends MIStoppedEvent { - - String sigName = ""; //$NON-NLS-1$ - String sigMeaning = ""; //$NON-NLS-1$ - - public MISignalEvent(MISession source, MIExecAsyncOutput async) { - super(source, async); - parse(); - } - - public MISignalEvent(MISession source, MIResultRecord record) { - super(source, record); - parse(); - } - - public String getName() { - return sigName; - } - - public String getMeaning() { - return sigMeaning; - } - - @Override - public String toString() { - StringBuffer buffer = new StringBuffer(); - buffer.append("signal-name=" + sigName + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ - buffer.append("signal-meaning=" + sigMeaning + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ - buffer.append("thread-id=").append(getThreadId()).append('\n'); //$NON-NLS-1$ - MIFrame f = getFrame(); - if (f != null) { - buffer.append(f.toString()); - } - return buffer.toString(); - } - - @Override - void parse () { - MIExecAsyncOutput exec = getMIExecAsyncOutput(); - MIResultRecord rr = getMIResultRecord(); - - MIResult[] results = null; - if (exec != null) { - results = exec.getMIResults(); - } else if (rr != null) { - results = rr.getMIResults(); - } - 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("signal-name")) { //$NON-NLS-1$ - sigName = str; - } else if (var.equals("signal-meaning")) { //$NON-NLS-1$ - sigMeaning = str; - } else if (var.equals("thread-id")) { //$NON-NLS-1$ - try { - int id = Integer.parseInt(str.trim()); - setThreadId(id); - } catch (NumberFormatException e) { - } - } else if (var.equals("frame")) { //$NON-NLS-1$ - if (value instanceof MITuple) { - MIFrame f = new MIFrame((MITuple)value); - setFrame(f); - } - } - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MISteppingRangeEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MISteppingRangeEvent.java deleted file mode 100644 index 13ff5495cd4..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MISteppingRangeEvent.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.event; - -import org.eclipse.cdt.debug.mi.core.MISession; -import org.eclipse.cdt.debug.mi.core.output.MIConst; -import org.eclipse.cdt.debug.mi.core.output.MIExecAsyncOutput; -import org.eclipse.cdt.debug.mi.core.output.MIFrame; -import org.eclipse.cdt.debug.mi.core.output.MIResult; -import org.eclipse.cdt.debug.mi.core.output.MIResultRecord; -import org.eclipse.cdt.debug.mi.core.output.MITuple; -import org.eclipse.cdt.debug.mi.core.output.MIValue; - -/** - * - * *stopped,reason="end-stepping-range",thread-id="0",frame={addr="0x08048538",func="main",args=[{name="argc",value="1"},{name="argv",value="0xbffff18c"}],file="hello.c",line="13"} - */ -public class MISteppingRangeEvent extends MIStoppedEvent { - - public MISteppingRangeEvent(MISession source, MIExecAsyncOutput async) { - super(source, async); - parse(); - } - - public MISteppingRangeEvent(MISession source, MIResultRecord record) { - super(source, record); - parse(); - } - - @Override - public String toString() { - StringBuffer buffer = new StringBuffer(); - buffer.append("thread-id=").append(getThreadId()).append('\n'); //$NON-NLS-1$ - MIFrame f = getFrame(); - if (f != null) { - buffer.append(getFrame().toString()); - } - return buffer.toString(); - } - - @Override - void parse () { - MIResult[] results = null; - MIExecAsyncOutput exec = getMIExecAsyncOutput(); - MIResultRecord rr = getMIResultRecord(); - if (exec != null) { - results = exec.getMIResults(); - } else if (rr != null) { - results = rr.getMIResults(); - } - if (results != null) { - for (int i = 0; i < results.length; i++) { - String var = results[i].getVariable(); - MIValue value = results[i].getMIValue(); - - if (var.equals("thread-id")) { //$NON-NLS-1$ - if (value instanceof MIConst) { - String str = ((MIConst)value).getString(); - try { - int id = Integer.parseInt(str.trim()); - setThreadId(id); - } catch (NumberFormatException e) { - } - } - } else if (var.equals("frame")) { //$NON-NLS-1$ - if (value instanceof MITuple) { - MIFrame f = new MIFrame((MITuple)value); - setFrame(f); - } - } - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIStoppedEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIStoppedEvent.java deleted file mode 100644 index 331e4f4ff5b..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIStoppedEvent.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.event; - -import org.eclipse.cdt.debug.mi.core.MISession; -import org.eclipse.cdt.debug.mi.core.output.MIConst; -import org.eclipse.cdt.debug.mi.core.output.MIExecAsyncOutput; -import org.eclipse.cdt.debug.mi.core.output.MIFrame; -import org.eclipse.cdt.debug.mi.core.output.MIResult; -import org.eclipse.cdt.debug.mi.core.output.MIResultRecord; -import org.eclipse.cdt.debug.mi.core.output.MITuple; -import org.eclipse.cdt.debug.mi.core.output.MIValue; - - - -/** - * *stopped - * - */ -public class MIStoppedEvent extends MIEvent { - - private int threadId; - private MIFrame frame; - private MIExecAsyncOutput exec; - private MIResultRecord rr; - - public MIStoppedEvent(MISession source, MIExecAsyncOutput record) { - super(source, record.getToken()); - exec = record; - parse(); - } - - public MIStoppedEvent(MISession source, MIResultRecord record) { - super(source, record.getToken()); - rr = record; - parse(); - } - - public int getThreadId() { - return threadId; - } - - public void setThreadId(int id) { - threadId = id; - } - - public MIFrame getFrame() { - return frame; - } - - public void setFrame(MIFrame f) { - frame = f; - } - - public MIExecAsyncOutput getMIExecAsyncOutput() { - return exec; - } - - public MIResultRecord getMIResultRecord() { - return rr; - } - - void parse () { - MIResult[] results = null; - if (exec != null) { - results = exec.getMIResults(); - } else if (rr != null) { - results = rr.getMIResults(); - } - if (results != null) { - for (int i = 0; i < results.length; i++) { - String var = results[i].getVariable(); - MIValue value = results[i].getMIValue(); - - if (var.equals("thread-id")) { //$NON-NLS-1$ - if (value instanceof MIConst) { - String str = ((MIConst)value).getString(); - try { - threadId = Integer.parseInt(str.trim()); - } catch (NumberFormatException e) { - } - } - } else if (var.equals("frame")) { //$NON-NLS-1$ - if (value instanceof MITuple) { - frame = new MIFrame((MITuple)value); - } - } - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIThreadCreatedEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIThreadCreatedEvent.java deleted file mode 100644 index 15ff143f371..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIThreadCreatedEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.event; - -import org.eclipse.cdt.debug.mi.core.MISession; - - -/** - * This can not be detected yet by gdb/mi. - * - */ -public class MIThreadCreatedEvent extends MICreatedEvent { - - int tid; - - public MIThreadCreatedEvent(MISession source, int id) { - this(source, 0, id); - } - - public MIThreadCreatedEvent(MISession source, int token, int id) { - super(source, token); - tid = id; - } - - public int getId() { - return tid; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIThreadExitEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIThreadExitEvent.java deleted file mode 100644 index 32b2e3a0f6f..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIThreadExitEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.event; - -import org.eclipse.cdt.debug.mi.core.MISession; - - -/** - * This can not be detected yet by gdb/mi. - * - */ -public class MIThreadExitEvent extends MIDestroyedEvent { - - int tid; - - public MIThreadExitEvent(MISession source, int id) { - this(source, 0, id); - } - - public MIThreadExitEvent(MISession source, int token, int id) { - super(source, token); - tid = id; - } - - public int getId() { - return tid; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIVarChangedEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIVarChangedEvent.java deleted file mode 100644 index e3084c707e8..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIVarChangedEvent.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.event; - -import org.eclipse.cdt.debug.mi.core.MISession; - - - -/** - * This can not be detected yet by gdb/mi. - * - */ -public class MIVarChangedEvent extends MIChangedEvent { - - String varName; - - public MIVarChangedEvent(MISession source, String var) { - this(source, 0, var); - } - - public MIVarChangedEvent(MISession source, int token, String var) { - super(source, token); - varName = var; - } - - public String getVarName() { - return varName; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIVarCreatedEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIVarCreatedEvent.java deleted file mode 100644 index 9cdea25ce56..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIVarCreatedEvent.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.event; - -import org.eclipse.cdt.debug.mi.core.MISession; - - - -/** - * This can not be detected yet by gdb/mi. - * - */ -public class MIVarCreatedEvent extends MICreatedEvent { - - String varName; - - public MIVarCreatedEvent(MISession source, String var) { - super(source, 0); - varName = var; - } - - public MIVarCreatedEvent(MISession source, int token, String var) { - super(source, token); - varName = var; - } - - public String getVarName() { - return varName; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIVarDeletedEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIVarDeletedEvent.java deleted file mode 100644 index c2fbec222d5..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIVarDeletedEvent.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.event; - -import org.eclipse.cdt.debug.mi.core.MISession; - - - -/** - * This can not be detected yet by gdb/mi. - * - */ -public class MIVarDeletedEvent extends MIDestroyedEvent { - - String varName; - - public MIVarDeletedEvent(MISession source, String var) { - this(source, 0, var); - } - - public MIVarDeletedEvent(MISession source, int token, String var) { - super(source, token); - varName = var; - } - - public String getVarName() { - return varName; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIWatchpointScopeEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIWatchpointScopeEvent.java deleted file mode 100644 index e9a42cd2340..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIWatchpointScopeEvent.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.event; - -import org.eclipse.cdt.debug.mi.core.MISession; -import org.eclipse.cdt.debug.mi.core.output.MIConst; -import org.eclipse.cdt.debug.mi.core.output.MIExecAsyncOutput; -import org.eclipse.cdt.debug.mi.core.output.MIFrame; -import org.eclipse.cdt.debug.mi.core.output.MIResult; -import org.eclipse.cdt.debug.mi.core.output.MIResultRecord; -import org.eclipse.cdt.debug.mi.core.output.MITuple; -import org.eclipse.cdt.debug.mi.core.output.MIValue; - -/** - * *stopped,reason="watchpoint-trigger",wpt={number="2",exp="i"},value={old="0",new="1"},thread-id="0",frame={addr="0x08048534",func="main",args=[{name="argc",value="1"},{name="argv",value="0xbffff18c"}],file="hello.c",line="10"} - * - */ -public class MIWatchpointScopeEvent extends MIStoppedEvent { - - int number; - - public MIWatchpointScopeEvent(MISession source, MIExecAsyncOutput async) { - super(source, async); - parse(); - } - - public MIWatchpointScopeEvent(MISession source, MIResultRecord record) { - super(source, record); - parse(); - } - - public int getNumber() { - return number; - } - - @Override - void parse() { - MIExecAsyncOutput exec = getMIExecAsyncOutput(); - MIResultRecord rr = getMIResultRecord(); - - MIResult[] results = null; - if (exec != null) { - results = exec.getMIResults(); - } else if (rr != null) { - results = rr.getMIResults(); - } - if (results != null) { - 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 = Integer.parseInt(str.trim()); - } catch (NumberFormatException e) { - } - } - } else if (var.equals("thread-id")) { //$NON-NLS-1$ - if (value instanceof MIConst) { - String str = ((MIConst) value).getString(); - try { - int id = Integer.parseInt(str.trim()); - setThreadId(id); - } catch (NumberFormatException e) { - } - } - } else if (var.equals("frame")) { //$NON-NLS-1$ - if (value instanceof MITuple) { - MIFrame f = new MIFrame((MITuple) value); - setFrame(f); - } - } - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIWatchpointTriggerEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIWatchpointTriggerEvent.java deleted file mode 100644 index acafb878c99..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIWatchpointTriggerEvent.java +++ /dev/null @@ -1,158 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.event; - -import org.eclipse.cdt.debug.mi.core.MISession; -import org.eclipse.cdt.debug.mi.core.output.MIConst; -import org.eclipse.cdt.debug.mi.core.output.MIExecAsyncOutput; -import org.eclipse.cdt.debug.mi.core.output.MIFrame; -import org.eclipse.cdt.debug.mi.core.output.MIResult; -import org.eclipse.cdt.debug.mi.core.output.MIResultRecord; -import org.eclipse.cdt.debug.mi.core.output.MITuple; -import org.eclipse.cdt.debug.mi.core.output.MIValue; - -/** - * *stopped,reason="watchpoint-trigger",wpt={number="2",exp="i"},value={old="0",new="1"},thread-id="0",frame={addr="0x08048534",func="main",args=[{name="argc",value="1"},{name="argv",value="0xbffff18c"}],file="hello.c",line="10"} - * - */ -public class MIWatchpointTriggerEvent extends MIStoppedEvent { - - int number; - String exp = ""; //$NON-NLS-1$ - String oldValue = ""; //$NON-NLS-1$ - String newValue = ""; //$NON-NLS-1$ - - public MIWatchpointTriggerEvent(MISession source, MIExecAsyncOutput async) { - super(source, async); - parse(); - } - - public MIWatchpointTriggerEvent(MISession source, MIResultRecord record) { - super(source, record); - parse(); - } - - public int getNumber() { - return number; - } - - public String getExpression() { - return exp; - } - - public String getOldValue() { - return oldValue; - } - - public String getNewValue() { - return newValue; - } - - - @Override - public String toString() { - StringBuffer buffer = new StringBuffer(); - buffer.append("number=").append(number).append('\n'); //$NON-NLS-1$ - buffer.append("expression=" + exp + "\n"); //$NON-NLS-1$//$NON-NLS-2$ - buffer.append("old=" + oldValue + "\n"); //$NON-NLS-1$//$NON-NLS-2$ - buffer.append("new=" + newValue + "\n"); //$NON-NLS-1$//$NON-NLS-2$ - buffer.append("thread-id=").append(getThreadId()).append('\n'); //$NON-NLS-1$ - MIFrame f = getFrame(); - if (f != null) { - buffer.append(f.toString()); - } - return buffer.toString(); - } - - @Override - void parse() { - MIResult[] results = null; - MIExecAsyncOutput exec = getMIExecAsyncOutput(); - MIResultRecord rr = getMIResultRecord(); - if (exec != null) { - results = exec.getMIResults(); - } else if (rr != null) { - results = rr.getMIResults(); - } - if (results != null) { - 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) { - parseWPT((MITuple) value); - } - } else if (var.equals("value")) { //$NON-NLS-1$ - if (value instanceof MITuple) { - parseValue((MITuple) value); - } - } else if (var.equals("thread-id")) { //$NON-NLS-1$ - if (value instanceof MIConst) { - String str = ((MIConst) value).getString(); - try { - int id = Integer.parseInt(str.trim()); - setThreadId(id); - } catch (NumberFormatException e) { - } - } - } else if (var.equals("frame")) { //$NON-NLS-1$ - if (value instanceof MITuple) { - MIFrame f = new MIFrame((MITuple) value); - setFrame(f); - } - } - } - } - } - - void parseWPT(MITuple tuple) { - MIResult[] results = tuple.getMIResults(); - for (int i = 0; i < results.length; i++) { - String var = results[i].getVariable(); - MIValue value = results[i].getMIValue(); - - if (var.equals("number")) { //$NON-NLS-1$ - if (value instanceof MIConst) { - String str = ((MIConst) value).getString(); - try { - number = Integer.parseInt(str); - } catch (NumberFormatException e) { - } - } - } else if (var.equals("exp")) { //$NON-NLS-1$ - if (value instanceof MIConst) { - exp = ((MIConst) value).getString(); - } - } - } - } - - void parseValue(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).getString(); - } - - if (var.equals("old")) { //$NON-NLS-1$ - oldValue = str; - } else if (var.equals("new")) { //$NON-NLS-1$ - newValue = str; - } else if (var.equals("value")) { //$NON-NLS-1$ - oldValue = newValue = str; - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/CLICatchInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/CLICatchInfo.java deleted file mode 100644 index 03e3d52b154..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/CLICatchInfo.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -import java.util.ArrayList; -import java.util.List; -import java.util.StringTokenizer; - -public class CLICatchInfo extends MIInfo { - MIBreakpoint[] breakpoints; - - public CLICatchInfo(MIOutput record) { - super(record); - parse(); - } - - /** - * sample output: Catchpoint 3 (catch) - */ - protected void parse() { - List aList = new ArrayList(); - try { - if (isDone()) { - MIOutput out = getMIOutput(); - MIOOBRecord[] oobs = out.getMIOOBRecords(); - for (int i = 0; i < oobs.length; i++) { - if (oobs[i] instanceof MIConsoleStreamOutput) { - MIStreamRecord cons = (MIStreamRecord) oobs[i]; - String str = cons.getString(); - // We are interested in the signal info - if (parseCatchpoint(str.trim(), aList)) - break; - } - } - } - } finally { - breakpoints = (MIBreakpoint[]) aList.toArray(new MIBreakpoint[aList.size()]); - } - } - - private boolean parseCatchpoint(String str, List aList) { - if (str.length() == 0) - return false; - if (str.startsWith("Catchpoint ")) { //$NON-NLS-1$ - int bn = 0; - - StringTokenizer tokenizer = new StringTokenizer(str); - for (int i = 0; tokenizer.hasMoreTokens(); i++) { - String sub = tokenizer.nextToken(); - switch (i) { - case 0: // first column is "Signal" - - break; - case 1: // second column is number - bn = Integer.parseInt(sub); - break; - } - } - MITuple tuple = new MITuple(); - MIBreakpoint m = new MIBreakpoint(tuple); - m.setNumber(bn); - aList.add(m); - return true; - } - return false; - } - - public MIBreakpoint[] getMIBreakpoints() { - if (breakpoints == null) { - parse(); - } - return breakpoints; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/CLIInfoLineInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/CLIInfoLineInfo.java deleted file mode 100644 index 0ce83f51409..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/CLIInfoLineInfo.java +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Nokia and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nokia - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.List; - - -public class CLIInfoLineInfo extends MIInfo { - - private int lineNumber; - private BigInteger startAddress; - private BigInteger endAddress; - private String startLocation; - private String endLocation; - private String fileName; - - public CLIInfoLineInfo(MIOutput out) { - super(out); - parse(); - } - - public int getLineNumber() { - return lineNumber; - } - - public BigInteger getStartAddress() { - return startAddress; - } - - public BigInteger getEndAddress() { - return endAddress; - } - - public String getStartLocation() { - return startLocation; - } - - public String getEndLocation() { - return endLocation; - } - - public String getFileName() { - return fileName; - } - - protected void parse() { - List aList = new ArrayList(); - if (isDone()) { - MIOutput out = getMIOutput(); - MIOOBRecord[] oobs = out.getMIOOBRecords(); - for (int i = 0; i < oobs.length; i++) { - if (oobs[i] instanceof MIConsoleStreamOutput) { - MIStreamRecord cons = (MIStreamRecord) oobs[i]; - String str = cons.getString(); - // We are interested in finding the current thread - parseLineInfo(str.trim(), aList); - } - } - } - - } - - protected void parseLineInfo(String str, List aList) { - if (str.endsWith(".")) //$NON-NLS-1$ - str = str.substring(0, str.length()-1); - String[] strbits = str.split("\\s"); //$NON-NLS-1$ - for (int i = 0; i < strbits.length; i++) { - if (strbits[i].equals("Line")) //$NON-NLS-1$ - { - lineNumber = Integer.parseInt(strbits[i+1]); - } - else - if (strbits[i].equals("starts")) //$NON-NLS-1$ - { - - startAddress = new BigInteger(strbits[i+3].substring(2), 16); - startLocation = strbits[i+4]; - } - else - if (strbits[i].equals("ends")) //$NON-NLS-1$ - { - endAddress = new BigInteger(strbits[i+2].substring(2), 16); - endLocation = i+3<strbits.length? strbits[i+3]: null; - } - } - strbits = str.split("\""); //$NON-NLS-1$ - if (strbits.length>0) fileName = strbits[1]; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/CLIInfoProcInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/CLIInfoProcInfo.java deleted file mode 100644 index 01c9f2d0cd1..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/CLIInfoProcInfo.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 ENEA Software AB and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * ENEA Software AB - CLI command extension - fix for bug 190277 - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.output; - -import java.util.StringTokenizer; - - -/** - * GDB/CLI info proc parsing. -(gdb) info proc -process 19127 flags: -PR_STOPPED Process (LWP) is stopped -PR_ISTOP Stopped on an event of interest -PR_RLC Run-on-last-close is in effect -PR_FAULTED : Incurred a traced hardware fault FLTBPT: Breakpoint trap - */ -public class CLIInfoProcInfo extends MIInfo { - - int pid; - - public CLIInfoProcInfo(MIOutput out) { - super(out); - parse(); - } - - public int getPID() { - return pid; - } - - void parse() { - if (isDone()) { - MIOutput out = getMIOutput(); - MIOOBRecord[] oobs = out.getMIOOBRecords(); - for (int i = 0; i < oobs.length; i++) { - if (oobs[i] instanceof MIConsoleStreamOutput) { - MIStreamRecord cons = (MIStreamRecord) oobs[i]; - String str = cons.getString(); - // We are interested in the process info and PID - parseLine(str); - } - } - } - } - - void parseLine(String str) { - if (str != null && str.length() > 0) { - str = str.trim(); - if (!str.startsWith("process")) { //$NON-NLS-1$ - return; - } - StringTokenizer st = new StringTokenizer(str); - while (st.hasMoreTokens()) { - String s = st.nextToken(); - if (Character.isDigit(s.charAt(0))) { - try { - pid = Integer.decode(s).intValue(); - break; - } catch (NumberFormatException e) { - } - } - } - } - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/CLIInfoProgramInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/CLIInfoProgramInfo.java deleted file mode 100644 index c86be5772bd..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/CLIInfoProgramInfo.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - * ENEA Software AB - CLI command extension - fix for bug 190277 - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -import java.util.StringTokenizer; - - -/** - * GDB/MI info program parsing. -(gdb) -info program -&"info program\n" -~"\tUsing the running image of child process 21301.\n" -~"Program stopped at 0x804853f.\n" -~"It stopped at breakpoint 1.\n" -~"Type \"info stack\" or \"info registers\" for more information.\n" -^done -(gdb) - - */ -public class CLIInfoProgramInfo extends MIInfo { - - int pid; - - public CLIInfoProgramInfo(MIOutput out) { - super(out); - parse(); - } - - public int getPID() { - return pid; - } - - void parse() { - if (isDone()) { - MIOutput out = getMIOutput(); - MIOOBRecord[] oobs = out.getMIOOBRecords(); - for (int i = 0; i < oobs.length; i++) { - if (oobs[i] instanceof MIConsoleStreamOutput) { - MIStreamRecord cons = (MIStreamRecord) oobs[i]; - String str = cons.getString(); - // We are interested in the signal info - parseLine(str); - } - } - } - } - - void parseLine(String str) { - if (str != null && str.length() > 0) { - str = str.replace('.', ' '); - str = str.trim(); - if (str.startsWith("Using")) { //$NON-NLS-1$ - StringTokenizer st = new StringTokenizer(str); - while (st.hasMoreTokens()) { - String s = st.nextToken(); - /* Not a process id if LWP is reported */ - if (s.equals("LWP")) break; //$NON-NLS-1$ - - if (Character.isDigit(s.charAt(0))) { - try { - pid = Integer.decode(s).intValue(); - break; - } catch (NumberFormatException e) { - } - } - } - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/CLIInfoSharedLibraryInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/CLIInfoSharedLibraryInfo.java deleted file mode 100644 index fafb73af866..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/CLIInfoSharedLibraryInfo.java +++ /dev/null @@ -1,192 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -import java.util.ArrayList; -import java.util.List; - -/** - * - */ -public class CLIInfoSharedLibraryInfo extends MIInfo { - - MIShared[] shared; - boolean isUnixFormat = true; - boolean hasProcessHeader = false; - - // HP-UX shared library view - private boolean isHPUXFormat; - static String mergestr=null; - - public CLIInfoSharedLibraryInfo(MIOutput out) { - super(out); - parse(); - } - - public MIShared[] getMIShared() { - return shared; - } - - void parse() { - List aList = new ArrayList(); - if (isDone()) { - MIOutput out = getMIOutput(); - MIOOBRecord[] oobs = out.getMIOOBRecords(); - for (int i = 0; i < oobs.length; i++) { - if (oobs[i] instanceof MIConsoleStreamOutput) { - MIStreamRecord cons = (MIStreamRecord) oobs[i]; - String str = cons.getString(); - // We are interested in the shared info - parseShared(str.trim(), aList); - } - } - } - shared = new MIShared[aList.size()]; - for (int i = 0; i < aList.size(); i++) { - shared[i] = (MIShared) aList.get(i); - } - } - - protected void parseShared(String str, List aList) { - if (!hasProcessHeader) { - // Process the header and choose a type. - if (str.startsWith("DLL")) { //$NON-NLS-1$ - // Cygwin info shared - isUnixFormat = false; - } else if(str.startsWith("Shared Object Libraries")) { //$NON-NLS-1$ - // HP-UX shared library view - isHPUXFormat = true; - } - hasProcessHeader = true; - } else if (isHPUXFormat) { - // FIX : HP-UX shared library view - if(str.startsWith("0x")) { //$NON-NLS-1$ - //merging... - mergestr +=" "+str; //$NON-NLS-1$ - parseHPUXShared(mergestr, aList); - return; - } else if(str.startsWith("tstart")) { //$NON-NLS-1$ - return; - } else { - // new shareed library entry...; - mergestr = new String(str); - return; - } - } else if (isUnixFormat) { - parseUnixShared(str, aList); - } else { - parseWinShared(str, aList); - } - } - - /** - * We do the parsing backward because on some Un*x system, the To or the From - * and even the "Sym Read" can be empty.... - * @param str - * @param aList - */ - void parseUnixShared(String str, List aList) { - if (str.length() > 0) { - // Pass the header - int index = -1; - String from = ""; //$NON-NLS-1$ - String to = ""; //$NON-NLS-1$ - boolean syms = false; - String name = ""; //$NON-NLS-1$ - - for (int i = 0;(index = str.lastIndexOf(' ')) != -1 || i <= 3; i++) { - if (index == -1) { - index = 0; - } - String sub = str.substring(index).trim(); - // move to previous column - str = str.substring(0, index).trim(); - switch (i) { - case 0 : - name = sub; - break; - case 1 : - if (sub.equalsIgnoreCase("Yes")) { //$NON-NLS-1$ - syms = true; - } - break; - case 2 : // second column is "To" - to = sub; - break; - case 3 : // first column is "From" - from = sub; - break; - } - } - if (name.length() > 0) { - MIShared s = new MIShared(from, to, syms, name); - aList.add(s); - } - } - } - - // FIX : HP-UX shared library view - void parseHPUXShared(String str, List aList) { - if (str.length() > 0) { - // Pass the header - int index = -1; - String from = ""; //$NON-NLS-1$ - String to = ""; //$NON-NLS-1$ - boolean syms = false; - String name = ""; //$NON-NLS-1$ - - for (int i = 0;(index = str.indexOf(' ')) != -1 || i < 3; i++) - { - if (index == -1) { - index = 0; - } - - String sub = str.substring(0,index).trim(); - str= str.substring(index).trim(); - switch (i) { - case 0 : - name = sub; - break; - case 2 : // second column is "To" - to = sub; - break; - case 1 : // first column is "From" - from = sub; - break; - } - } - syms=true; - if (name.length() > 0) { - MIShared s = new MIShared(from, to, syms, name); - aList.add(s); - } - } - } // end fo fix - - void parseWinShared(String str, List aList) { - String from = ""; //$NON-NLS-1$ - String to = ""; //$NON-NLS-1$ - boolean syms = true; - - int index = str.lastIndexOf(' '); - if (index > 0) { - String sub = str.substring(index).trim(); - // Go figure they do not print the "0x" to indicate hexadecimal!! - if (!sub.startsWith("0x")) { //$NON-NLS-1$ - sub = "0x" + sub; //$NON-NLS-1$ - } - from = sub; - str = str.substring(0, index).trim(); - } - MIShared s = new MIShared(from, to, syms, str.trim()); - aList.add(s); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/CLIInfoSignalsInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/CLIInfoSignalsInfo.java deleted file mode 100644 index b39ed41acf4..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/CLIInfoSignalsInfo.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -import java.util.ArrayList; -import java.util.List; -import java.util.StringTokenizer; - -/** - * GDB/MI signal table parsing. - info signals - &"info signals\n" - ~"Signal Stop\tPrint\tPass to program\tDescription\n" - ~"\n" - ~"SIGHUP Yes\tYes\tYes\t\tHangup\n" - ~"SIGINT Yes\tYes\tNo\t\tInterrupt\n" - ~"SIGQUIT Yes\tYes\tYes\t\tQuit\n" - ~"SIGILL Yes\tYes\tYes\t\tIllegal instruction\n" - ~"SIGTRAP Yes\tYes\tNo\t\tTrace/breakpoint trap\n" - ~"SIGABRT Yes\tYes\tYes\t\tAborted\n" - ~"SIGEMT Yes\tYes\tYes\t\tEmulation trap\n" - */ -public class CLIInfoSignalsInfo extends MIInfo { - - MISigHandle[] signals; - - public CLIInfoSignalsInfo(MIOutput out) { - super(out); - parse(); - } - - public MISigHandle[] getMISignals() { - return signals; - } - - void parse() { - List aList = new ArrayList(); - if (isDone()) { - MIOutput out = getMIOutput(); - MIOOBRecord[] oobs = out.getMIOOBRecords(); - for (int i = 0; i < oobs.length; i++) { - if (oobs[i] instanceof MIConsoleStreamOutput) { - MIStreamRecord cons = (MIStreamRecord) oobs[i]; - String str = cons.getString(); - // We are interested in the signal info - parseSignal(str.trim(), aList); - } - } - } - signals = new MISigHandle[aList.size()]; - for (int i = 0; i < aList.size(); i++) { - signals[i] = (MISigHandle)aList.get(i); - } - } - - void parseSignal(String str, List aList) { - if (str.length() > 0) { - // Pass the header and th tailer. - // ~"Signal Stop\tPrint\tPass to program\tDescription\n" - // ~"Use the \"handle\" command to change these tables.\n" - if (!str.startsWith("Signal ") && !str.startsWith("Use ")) { //$NON-NLS-1$ //$NON-NLS-2$ - String signal = ""; //$NON-NLS-1$ - boolean stop = false; - boolean print = false; - boolean pass = false; - String desc = ""; //$NON-NLS-1$ - - StringTokenizer tokenizer = new StringTokenizer(str); - for (int i = 0; tokenizer.hasMoreTokens(); i++) { - String sub = null; - if (i == 4) { - sub = tokenizer.nextToken("\n"); //$NON-NLS-1$ - } else { - sub = tokenizer.nextToken(); - } - switch (i) { - case 0: // first column is "Signal" - signal = sub; - break; - case 1: // second column is "Stop" - stop = getBoolean(sub); - break; - case 2: // third column is "Print" - print = getBoolean(sub); - break; - case 3: // third column is "Pass to Program" - pass = getBoolean(sub); - break; - case 4: // last column is "Description" - desc = sub; - break; - } - } - MISigHandle s = new MISigHandle(signal, stop, print, pass, desc.trim()); - aList.add(s); - } - } - } - - static boolean getBoolean(String value) { - if (value != null && value.equalsIgnoreCase("Yes")) { //$NON-NLS-1$ - return true; - } - return false; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/CLIInfoThreadsInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/CLIInfoThreadsInfo.java deleted file mode 100644 index ac2785c0b3f..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/CLIInfoThreadsInfo.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -/** - * GDB/MI thread list parsing. -~"\n" -~" 2 Thread 2049 (LWP 29354) " -~"* 1 Thread 1024 (LWP 29353) " - - */ -public class CLIInfoThreadsInfo extends MIInfo { - - protected int[] threadIds; - protected int currentThreadId; - - public CLIInfoThreadsInfo(MIOutput out) { - super(out); - parse(); - } - - public int[] getThreadIds() { - return threadIds; - } - - public String[] getThreadNames() { - return null; - } - - public int getCurrentThread() { - return currentThreadId; - } - - protected void parse() { - List aList = new ArrayList(); - if (isDone()) { - MIOutput out = getMIOutput(); - MIOOBRecord[] oobs = out.getMIOOBRecords(); - for (int i = 0; i < oobs.length; i++) { - if (oobs[i] instanceof MIConsoleStreamOutput) { - MIStreamRecord cons = (MIStreamRecord) oobs[i]; - String str = cons.getString(); - // We are interested in finding the current thread - parseThreadInfo(str.trim(), aList); - } - } - } - threadIds = new int[aList.size()]; - for (int i = 0; i < aList.size(); i++) { - threadIds[i] = ((Integer) aList.get(i)).intValue(); - } - Arrays.sort(threadIds); - } - - protected void parseThreadInfo(String str, List aList) { - if (str.length() > 0) { - boolean isCurrentThread = false; - // Discover the current thread - if (str.charAt(0) == '*') { - isCurrentThread = true; - str = str.substring(1).trim(); - } - // Fetch the threadId - if (str.length() > 0 && Character.isDigit(str.charAt(0))) { - int i = 1; - while (i < str.length() && Character.isDigit(str.charAt(i))) { - i++; - } - String number = str.substring(0, i); - try { - Integer num = Integer.valueOf(number); - aList.add(num); - if (isCurrentThread) { - currentThreadId = num.intValue(); - } - } catch (NumberFormatException e) { - } - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/CLIPTypeInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/CLIPTypeInfo.java deleted file mode 100644 index 2a01e0829e6..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/CLIPTypeInfo.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -/** - * GDB/MI whatis parsing. - */ -public class CLIPTypeInfo extends MIInfo { - - String type; - - public CLIPTypeInfo(MIOutput out) { - super(out); - parse(); - } - - public String getType() { - return type; - } - - void parse() { - StringBuffer buffer = new StringBuffer(); - if (isDone()) { - MIOutput out = getMIOutput(); - MIOOBRecord[] oobs = out.getMIOOBRecords(); - for (int i = 0; i < oobs.length; i++) { - if (oobs[i] instanceof MIConsoleStreamOutput) { - MIStreamRecord cons = (MIStreamRecord) oobs[i]; - String str = cons.getString(); - // We are interested in the shared info - if (str != null) { - str = str.trim(); - if (str.startsWith ("type")) { //$NON-NLS-1$ - int equal = str.indexOf('='); - if (equal > 0) { - str = str.substring(equal + 1); - } - } - buffer.append(str); - } - } - } - } - type = buffer.toString().trim(); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/CLIWhatisInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/CLIWhatisInfo.java deleted file mode 100644 index 1be47995732..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/CLIWhatisInfo.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -/** - * GDB/MI whatis parsing. - */ -public class CLIWhatisInfo extends MIInfo { - - String type; - - public CLIWhatisInfo(MIOutput out) { - super(out); - parse(); - } - - public String getType() { - return type; - } - - void parse() { - StringBuffer buffer = new StringBuffer(); - if (isDone()) { - MIOutput out = getMIOutput(); - MIOOBRecord[] oobs = out.getMIOOBRecords(); - for (int i = 0; i < oobs.length; i++) { - if (oobs[i] instanceof MIConsoleStreamOutput) { - MIStreamRecord cons = (MIStreamRecord) oobs[i]; - String str = cons.getString(); - // We are interested in the shared info - if (str != null) { - str = str.trim(); - if (str.startsWith ("type")) { //$NON-NLS-1$ - int equal = str.indexOf('='); - if (equal > 0) { - str = str.substring(equal + 1); - } - } - buffer.append(str); - } - } - } - } - type = buffer.toString().trim(); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIArg.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIArg.java deleted file mode 100644 index a491c2c99ac..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIArg.java +++ /dev/null @@ -1,131 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.output; - -import java.util.ArrayList; -import java.util.List; - - -/** - * Represents a set name=value. - */ -public class MIArg { - String name; - String value; - - public MIArg(String name, String value) { - this.name = name; - this.value = value; - } - - public String getName() { - return name; - } - - public String getValue() { - return value; - } - - /** - * Parsing a MIList 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 aList = new ArrayList(); - 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 ((MIArg[])aList.toArray(new MIArg[aList.size()])); - } - - /** - * Parsing a MITuple 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 aList = new ArrayList(); - 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 ((MIArg[])aList.toArray(new MIArg[aList.size()])); - } - /** - * Parsing a MITuple 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$ - } - } - - arg = new MIArg(aName, aValue); - } - return arg; - } - - @Override - public String toString() { - return name + "=" + value; //$NON-NLS-1$ - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIAsm.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIAsm.java deleted file mode 100644 index ec13f27f04f..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIAsm.java +++ /dev/null @@ -1,117 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -/** - * Represent a GDB Tuple MI assembly response. - */ -public class MIAsm { - String address; - String function = ""; //$NON-NLS-1$ - String opcode = ""; //$NON-NLS-1$ - String args = ""; //$NON-NLS-1$ - long offset; - - public MIAsm (MITuple tuple) { - parse(tuple); - } - - public String getAddress() { - return address; - } - - public String getFunction() { - return function; - } - - public long getOffset() { - return offset; - } - - public String getInstruction() { - return opcode + " " + args; //$NON-NLS-1$ - } - - @Override - public String toString() { - StringBuffer buffer = new StringBuffer(); - buffer.append('{'); - buffer.append("address=\"" + address +"\""); //$NON-NLS-1$//$NON-NLS-2$ - buffer.append(",func-name=\"" + function + "\""); //$NON-NLS-1$//$NON-NLS-2$ - buffer.append(",offset=\"").append(offset).append('"'); //$NON-NLS-1$ - buffer.append(",inst=\"" + getInstruction() + "\""); //$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(); - } - - if (var.equals("address")) { //$NON-NLS-1$ - try { - address = str.trim(); - } catch (NumberFormatException e) { - } - } else if (var.equals("func-name")) { //$NON-NLS-1$ - function = str; - } else if (var.equals("offset")) { //$NON-NLS-1$ - try { - offset = Long.decode(str.trim()).longValue(); - } catch (NumberFormatException e) { - } - } else 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. */ - str = ((MIConst)value).getString(); - - 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 ); - } - } - } - - /** - * @return String - */ - public String getArgs() { - return args; - } - - /** - * @return String - */ - public String getOpcode() { - return opcode; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIAsyncRecord.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIAsyncRecord.java deleted file mode 100644 index 94875182ea9..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIAsyncRecord.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.output; - -/** - * base Abstract class for the OOB stream MI responses. - */ -public abstract class MIAsyncRecord extends MIOOBRecord { - - final static MIResult[] nullResults = new MIResult[0]; - - MIResult[] results = null; - String asynClass = ""; //$NON-NLS-1$ - int token = 0; - - public int getToken() { - return token; - } - - public void setToken(int t) { - token = t; - } - - public String getAsyncClass() { - return asynClass; - } - - public void setAsyncClass(String a) { - asynClass = a; - } - - public MIResult[] getMIResults() { - if (results == null) { - return nullResults; - } - return results; - } - - public void setMIResults(MIResult[] res) { - results = res; - } - - @Override - public String toString() { - StringBuffer buffer = new StringBuffer(); - 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/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIBreakInsertInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIBreakInsertInfo.java deleted file mode 100644 index 278863a7421..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIBreakInsertInfo.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.output; - -import java.util.ArrayList; -import java.util.List; - - -/** - * -break-insert main - * ^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x08048468",func="main",file="hello.c",line="4",times="0"} - * -break-insert -a p - * ^done,hw-awpt={number="2",exp="p"} - * -break-watch -r p - * ^done,hw-rwpt={number="4",exp="p"} - * -break-watch p - * ^done,wpt={number="6",exp="p"} - */ -public class MIBreakInsertInfo extends MIInfo { - - MIBreakpoint[] breakpoints; - - void parse() { - List aList = new ArrayList(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(); - MIValue val = results[i].getMIValue(); - MIBreakpoint bpt = null; - if (var.equals("wpt")) { //$NON-NLS-1$ - if (val instanceof MITuple) { - bpt = new MIBreakpoint((MITuple)val); - bpt.setEnabled(true); - bpt.setWriteWatchpoint(true); - } - } else if (var.equals("bkpt")) { //$NON-NLS-1$ - if (val instanceof MITuple) { - bpt = new MIBreakpoint((MITuple)val); - bpt.setEnabled(true); - } - } else if (var.equals("hw-awpt")) { //$NON-NLS-1$ - if (val instanceof MITuple) { - bpt = new MIBreakpoint((MITuple)val); - bpt.setAccessWatchpoint(true); - bpt.setEnabled(true); - } - } else if (var.equals("hw-rwpt")) { //$NON-NLS-1$ - if (val instanceof MITuple) { - bpt = new MIBreakpoint((MITuple)val); - bpt.setReadWatchpoint(true); - bpt.setEnabled(true); - } - } - if (bpt != null) { - aList.add(bpt); - } - } - } - } - breakpoints = (MIBreakpoint[])aList.toArray(new MIBreakpoint[aList.size()]); - } - - public MIBreakInsertInfo(MIOutput record) { - super(record); - } - - public MIBreakpoint[] getMIBreakpoints() { - if (breakpoints == null) { - parse(); - } - return breakpoints; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIBreakListInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIBreakListInfo.java deleted file mode 100644 index 20aeb7206c2..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIBreakListInfo.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -import java.util.ArrayList; -import java.util.List; - - -/** - * A -break-list result-record is the form: - * <pre> - * ^done,BreakpointTable={nr_rows="1",nr_cols="6",hdr=[..],body=[brkpt={},brkpt={}]} - *-break-list -^done,BreakpointTable={nr_rows="6",nr_cols="6",hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},{width="14",alignment="-1",col_name="type",colhdr="Type"},{width="4",alignment="-1",col_name="disp",colhdr="Disp"},{width="3",alignment="-1",col_name="enabled",colhdr="Enb"},{width="10",alignment="-1",col_name="addr",colhdr="Address"},{width="40",alignment="2",col_name="what",colhdr="What"}],body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0804846b",func="main",file="hello.c",line="4",times="0"},bkpt={number="2",type="breakpoint",disp="del",enabled="y",addr="0x0804846b",func="main",file="hello.c",line="4",times="0"},bkpt={number="3",type="breakpoint",disp="keep",enabled="y",addr="0x0804846b",func="main",file="hello.c",line="4",cond="1",times="0"},bkpt={number="4",type="hw breakpoint",disp="keep",enabled="y",addr="0x0804846b",func="main",file="hello.c",line="4",times="0"},bkpt={number="5",type="breakpoint",disp="keep",enabled="y",addr="0x0804846b",func="main",file="hello.c",line="4",thread="0",thread="0",times="0"},bkpt={number="6",type="breakpoint",disp="keep",enabled="y",addr="0x0804846b",func="main",file="hello.c",line="4",thread="1",thread="1",times="0"}]} - * </pre> - */ -public class MIBreakListInfo extends MIInfo { - - MIBreakpoint[] breakpoints; - - public MIBreakListInfo(MIOutput rr) { - super(rr); - } - - public MIBreakpoint[] getMIBreakpoints() { - if (breakpoints == null) { - parse(); - } - return breakpoints; - } - - void parse() { - List aList = new ArrayList(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 = (MIBreakpoint[])aList.toArray(new MIBreakpoint[aList.size()]); - } - - void parseTable(MIValue val, List 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 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(new MIBreakpoint((MITuple)value)); - } - } - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIBreakWatchInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIBreakWatchInfo.java deleted file mode 100644 index dcbf26ddda3..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIBreakWatchInfo.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.output; - - -/** - * -break-watch buf - * ^done,wpt={number="2",exp="buf"} - */ -public class MIBreakWatchInfo extends MIBreakInsertInfo { - - public MIBreakWatchInfo(MIOutput rr) { - super(rr); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIBreakpoint.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIBreakpoint.java deleted file mode 100644 index 016173a7cfa..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIBreakpoint.java +++ /dev/null @@ -1,275 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2011 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - * Abeer Bagul (Tensilica) - Differentiate between hw breakpoint and watchpoint - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.output; - -/** - * Contain info about the GDB/MI breakpoint info. - *<ul> - * <li> - * -break-insert main - * ^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0804846b",func="main",file="hello.c",line="4",times="0"} - * (gdb) - * </li> - * <li> - * -break-insert -t main - * ^done,bkpt={number="2",type="breakpoint",disp="del",enabled="y",addr="0x0804846b",func="main",file="hello.c",line="4",times="0"} - * </li> - * <li> - * -break-insert -c 1 main -^done,bkpt={number="3",type="breakpoint",disp="keep",enabled="y",addr="0x0804846b",func="main",file="hello.c",line="4",cond="1",times="0"} - * </li> - * <li> - * -break-insert -h main - * ^done,bkpt={number="4",type="hw breakpoint",disp="keep",enabled="y",addr="0x0804846b",func="main",file="hello.c",line="4",times="0"} - * <li> - * -break-insert -p 0 main - * ^done,bkpt={number="5",type="breakpoint",disp="keep",enabled="y",addr="0x0804846b",func="main",file="hello.c",line="4",thread="0",thread="0",times="0"} - * </li> - * <li> - * -break-insert -a p - * ^done,hw-awpt={number="2",exp="p"} - * </li> - * <li> - * -break-watch -r p - * ^done,hw-rwpt={number="4",exp="p"} - * </li> - * <li> - * -break-watch p - * ^done,wpt={number="6",exp="p"} - * </li> - *</ul> - */ -public class MIBreakpoint { - - int number; - String type = ""; //$NON-NLS-1$ - String disp = ""; //$NON-NLS-1$ - boolean enabled; - String address; - String func = ""; //$NON-NLS-1$ - String file = ""; //$NON-NLS-1$ - int line; - String cond = ""; //$NON-NLS-1$ - int times; - String what = ""; //$NON-NLS-1$ - String threadId = ""; //$NON-NLS-1$ - int ignore; - - boolean isWpt; - boolean isAWpt; - boolean isRWpt; - boolean isWWpt; - boolean isHdw; - - public MIBreakpoint(MITuple tuple) { - parse(tuple); - } - - public int getNumber() { - return number; - } - - public void setNumber(int num) { - number = num; - } - - public String getType() { - return type; - } - - public boolean isTemporary() { - return getDisposition().equals("del"); //$NON-NLS-1$ - } - - public boolean isWatchpoint() { - return isWpt; - } - - public void setWatchpoint(boolean w) { - isWpt = w; - } - - public boolean isHardware() { - return isHdw; - } - - public void setHardware(boolean hd) { - isHdw = hd; - } - - public boolean isAccessWatchpoint() { - return isAWpt; - } - - public void setAccessWatchpoint(boolean a) { - isWpt = a; - isAWpt = a; - } - - public boolean isReadWatchpoint() { - return isRWpt; - } - - public void setReadWatchpoint(boolean r) { - isWpt = r; - isRWpt = r; - } - - public boolean isWriteWatchpoint() { - return isWWpt; - } - - public void setWriteWatchpoint(boolean w) { - isWpt = w; - isWWpt = w; - } - - public String getDisposition() { - return disp; - } - - public boolean isEnabled() { - return enabled; - } - - public void setEnabled(boolean e) { - enabled = e; - } - - public String getAddress() { - return address; - } - - public String getFunction() { - return func; - } - - public String getFile() { - return file; - } - - public int getLine() { - return line; - } - - public int getTimes() { - return times; - } - - public String getWhat() { - return what; - } - - public int getIgnoreCount() { - return ignore; - } - - public String getCondition() { - return cond; - } - - public String getThreadId() { - return threadId; - } - - 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$ - try { - number = Integer.parseInt(str.trim()); - } catch (NumberFormatException e) { - } - } else if (var.equals("type")) { //$NON-NLS-1$ - 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$ - isWWpt = true; - isRWpt = true; - isWpt = true; - } - //type="read watchpoint" - if (type.startsWith("read")) { //$NON-NLS-1$ - isRWpt = true; - isWpt = true; - } - // ?? - if (type.equals("watchpoint")) { //$NON-NLS-1$ - isWpt = 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$ - try { - address = str.trim(); - } catch (NumberFormatException e) { - } - } else if (var.equals("func")) { //$NON-NLS-1$ - func = str; - } else if (var.equals("file")) { //$NON-NLS-1$ - file = 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$ - what = str; - } else if (var.equals("ignore")) { //$NON-NLS-1$ - try { - ignore = Integer.parseInt(str.trim()); - } catch (NumberFormatException e) { - } - } else if (var.equals("cond")) { //$NON-NLS-1$ - cond = str; - } - } - } - - public void setFile(String file) { - this.file = file; - } - - /** - * @since 7.0 - */ - public void setLine(int line) { - this.line = line; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIConsoleStreamOutput.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIConsoleStreamOutput.java deleted file mode 100644 index 6fd8894dc61..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIConsoleStreamOutput.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.output; - -/** - * @see MIStreamRecord - */ -public class MIConsoleStreamOutput extends MIStreamRecord { -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIConst.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIConst.java deleted file mode 100644 index 4a73faff858..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIConst.java +++ /dev/null @@ -1,123 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.output; - -/** - * GDB/MI const value represents a ios-c string. - */ -public class MIConst extends MIValue { - String cstring = ""; //$NON-NLS-1$ - - public String getCString() { - return cstring; - } - - public void setCString(String str) { - cstring = str; - } - - /** - * Translate gdb c-string. - */ - public String getString() { - return getString(cstring); - } - - public static String getString(String str) { - StringBuffer buffer = new StringBuffer(); - boolean escape = false; - for (int i = 0; i < str.length(); i++) { - char c = str.charAt(i); - if (c == '\\') { - if (escape) { - buffer.append(c); - escape = false; - } else { - escape = true; - } - } else { - if (escape) { - if (isIsoCSpecialChar(c)) { - buffer.append(isoC(c)); - } else { - buffer.append('\\'); - buffer.append(c); - } - } else { - buffer.append(c); - } - escape = false; - } - } - - // If escape is still true it means that the - // last char was an '\'. - if (escape) { - buffer.append('\\'); - } - - return buffer.toString(); - } - - @Override - public String toString() { - return getCString(); - } - - /** - * Assuming that the precedent character was the - * escape sequence '\' - */ - private static String isoC(char c) { - String s = new Character(c).toString(); - if (c == '"') { - s = "\""; //$NON-NLS-1$ - } else if (c == '\'') { - s = "\'"; //$NON-NLS-1$ - } else if (c == '?') { - s = "?"; //$NON-NLS-1$ - } else if (c == 'a') { - s = "\007"; //$NON-NLS-1$ - } else if (c == 'b') { - s = "\b"; //$NON-NLS-1$ - } else if (c == 'f') { - s = "\f"; //$NON-NLS-1$ - } else if (c == 'n') { - s = System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$ $NON-NLS-2$ - } else if (c == 'r') { - s = "\r"; //$NON-NLS-1$ - } else if (c == 't') { - s = "\t"; //$NON-NLS-1$ - } else if (c == 'v') { - s = "\013"; //$NON-NLS-1$ - } - return s; - } - - private static boolean isIsoCSpecialChar(char c) { - switch (c) { - case '"': - case '\'': - case '?': - case 'a': - case 'b': - case 'f': - case 'n': - case 'r': - case 't': - case 'v': - return true; - } - return false; - - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIDataDisassembleInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIDataDisassembleInfo.java deleted file mode 100644 index 7f7cbaf1522..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIDataDisassembleInfo.java +++ /dev/null @@ -1,125 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.output; - -import java.util.ArrayList; -import java.util.List; - -/** - * GDB/MI disassemble parsing response. - */ -public class MIDataDisassembleInfo extends MIInfo { - - MISrcAsm[] src_asm; - MIAsm[] asm; - boolean mixed; - - public MIDataDisassembleInfo(MIOutput rr) { - super(rr); - mixed = false; - parse(); - } - - public MIAsm[] getMIAsms() { - return asm; - } - - public boolean isMixed() { - return mixed; - } - - public MISrcAsm[] getMISrcAsms() { - return src_asm; - } - - @Override - public String toString() { - StringBuffer buffer = new StringBuffer(); - buffer.append("asm_insns=["); //$NON-NLS-1$ - - if (isMixed()) { - MISrcAsm[] array = getMISrcAsms(); - for (int i = 0; i < array.length; i++) { - if (i != 0) { - buffer.append(','); - } - buffer.append(array[i].toString()); - } - } else { - MIAsm[] array = getMIAsms(); - for (int i = 0; i < array.length; i++) { - if (i != 0) { - buffer.append(','); - } - buffer.append(array[i].toString()); - } - } - buffer.append("]"); //$NON-NLS-1$ - return buffer.toString(); - } - - void parse() { - List asmList = new ArrayList(); - List srcList = new ArrayList(); - 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("asm_insns")) { //$NON-NLS-1$ - MIValue value = results[i].getMIValue(); - if (value instanceof MIList) { - parse((MIList)value, srcList, asmList); - } - } - } - } - } - src_asm = (MISrcAsm[])srcList.toArray(new MISrcAsm[srcList.size()]); - asm = (MIAsm[])asmList.toArray(new MIAsm[asmList.size()]); - } - - void parse(MIList list, List srcList, List asmList) { - // src and assembly is different - - // Mixed mode. - 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) { - MISrcAsm miSrcAsm = new MISrcAsm((MITuple) value); - if (miSrcAsm.getMIAsms() != null && miSrcAsm.getMIAsms().length > 0) { - srcList.add(miSrcAsm); - } - } - } - } - mixed = true; - } - - // Non Mixed with source - 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 MIAsm((MITuple)values[i])); - } - } - mixed = false; - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIDataEvaluateExpressionInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIDataEvaluateExpressionInfo.java deleted file mode 100644 index f798092be18..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIDataEvaluateExpressionInfo.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.output; - - -/** - * GDB/MI Data evalue expression parsing response. - */ -public class MIDataEvaluateExpressionInfo extends MIInfo{ - - String expr; - - public MIDataEvaluateExpressionInfo(MIOutput rr) { - super(rr); - } - - public String getExpression() { - if (expr == null) { - parse(); - } - return expr; - } - - void parse() { - expr = ""; //$NON-NLS-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("value")) { //$NON-NLS-1$ - MIValue value = results[i].getMIValue(); - if (value instanceof MIConst) { - expr = ((MIConst)value).getCString(); - } - } - } - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIDataListChangedRegistersInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIDataListChangedRegistersInfo.java deleted file mode 100644 index cbd19733ff5..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIDataListChangedRegistersInfo.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -import java.util.ArrayList; -import java.util.List; - -/** - * GDB/MI data list changed registers response parsing. - */ -public class MIDataListChangedRegistersInfo extends MIInfo { - - int[] registers; - - public MIDataListChangedRegistersInfo(MIOutput rr) { - super(rr); - } - - public int[] getRegisterNumbers() { - if (registers == null) { - parse(); - } - return registers; - } - - void parse() { - List aList = new ArrayList(); - 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("changed-registers")) { //$NON-NLS-1$ - MIValue value = results[i].getMIValue(); - if (value instanceof MIList) { - parseRegisters((MIList)value, aList); - } - } - } - } - } - registers = new int[aList.size()]; - for (int i = 0; i < aList.size(); i++) { - String str = (String)aList.get(i); - try { - registers[i] = Integer.parseInt(str.trim()); - } catch (NumberFormatException e) { - } - } - } - - void parseRegisters(MIList list, List aList) { - MIValue[] values = list.getMIValues(); - for (int i = 0; i < values.length; i++) { - if (values[i] instanceof MIConst) { - String str = ((MIConst)values[i]).getCString(); - if (str != null && str.length() > 0) { - aList.add(str); - } - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIDataListRegisterNamesInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIDataListRegisterNamesInfo.java deleted file mode 100644 index d9fc474be3b..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIDataListRegisterNamesInfo.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.output; - -import java.util.ArrayList; -import java.util.List; - -/** - * GDB/MI data list regiter names response extraction. - */ -public class MIDataListRegisterNamesInfo extends MIInfo { - - String[] names; - protected int realNameCount = 0; - - public MIDataListRegisterNamesInfo(MIOutput rr) { - super(rr); - } - - /** - * @return the list of register names. This list can include 0 length - * strings in the case where the underlying GDB has a sparse set of - * registers. They are returned as 0 length strings - */ - public String[] getRegisterNames() { - if (names == null) { - parse(); - } - return names; - } - - void parse() { - List aList = new ArrayList(); - 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("register-names")) { //$NON-NLS-1$ - MIValue value = results[i].getMIValue(); - if (value instanceof MIList) { - parseRegisters((MIList) value, aList); - } - } - } - } - } - names = (String[]) aList.toArray(new String[aList.size()]); - } - - void parseRegisters(MIList list, List 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.length() > 0) { - realNameCount++; - aList.add(str); - } else { - aList.add(""); //$NON-NLS-1$ - } - } - } - } - - /** - * @return the number of non-null and non-empty names in the - * register list - */ - public int getNumRealNames() { - if (names == null) - parse(); - return realNameCount; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIDataListRegisterValuesInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIDataListRegisterValuesInfo.java deleted file mode 100644 index 619ca219fc3..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIDataListRegisterValuesInfo.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.output; - -/** - * GDB/MI data list register values extraction. - */ -public class MIDataListRegisterValuesInfo extends MIInfo { - - MIRegisterValue[] registers; - - public MIDataListRegisterValuesInfo(MIOutput rr) { - super(rr); - } - - public MIRegisterValue[] getMIRegisterValues() { - if (registers == null) { - parse(); - } - return registers; - } - - 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(); - 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]; - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIDataReadMemoryInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIDataReadMemoryInfo.java deleted file mode 100644 index bd224814edd..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIDataReadMemoryInfo.java +++ /dev/null @@ -1,154 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.output; - - - -/** - * GDB/MI data read memor info extraction. - */ -public class MIDataReadMemoryInfo extends MIInfo { - - String addr; - long nextRow; - long prevRow; - long nextPage; - long prevPage; - long numBytes; - long totalBytes; - MIMemory[] memories; - - - public MIDataReadMemoryInfo(MIOutput rr) { - super(rr); - parse(); - } - - public String getAddress() { - return addr; - } - - public long getNumberBytes() { - return numBytes; - } - - public long getTotalBytes() { - return totalBytes; - } - - public long getNextRow() { - return nextRow; - } - - public long getPreviousRow() { - return prevRow; - } - - public long getNextPage() { - return nextPage; - } - - public long getPreviousPage() { - return prevPage; - } - - public MIMemory[] getMemories() { - return memories; - } -/* - public String toString() { - MIMemory[] mem = getMemories(); - StringBuffer buffer = new StringBuffer(); - for (int i = 0; i < mem.length; i++) { - buffer.append(Long.toHexString(mem[i].getAddress())); - buffer.append(":"); - long[] data = mem[i].getData(); - for (int j = 0; j < data.length; j++) { - buffer.append(" ").append(Long.toHexString(data[j])); - } - buffer.append("\t").append(mem[i].getAscii()); - } - return buffer.toString(); - } -*/ - 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(); - } - - if (var.equals("addr")) { //$NON-NLS-1$ - try { - addr = str.trim(); - } catch (NumberFormatException e) { - } - } else if (var.equals("nr-bytes")) { //$NON-NLS-1$ - try { - numBytes = Long.decode(str.trim()).longValue(); - } catch (NumberFormatException e) { - } - } else if (var.equals("total-bytes")) { //$NON-NLS-1$ - try { - totalBytes = Long.decode(str.trim()).longValue(); - } catch (NumberFormatException e) { - } - } else if (var.equals("next-row")) { //$NON-NLS-1$ - try { - nextRow = Long.decode(str.trim()).longValue(); - } catch (NumberFormatException e) { - } - } else if (var.equals("prev-row")) { //$NON-NLS-1$ - try { - prevRow = Long.decode(str.trim()).longValue(); - } catch (NumberFormatException e) { - } - } else if (var.equals("next-page")) { //$NON-NLS-1$ - try { - nextPage = Long.decode(str.trim()).longValue(); - } catch (NumberFormatException e) { - } - } else if (var.equals("prev-page")) { //$NON-NLS-1$ - try { - prevPage = Long.decode(str.trim()).longValue(); - } catch (NumberFormatException e) { - } - } else if (var.equals("memory")) { //$NON-NLS-1$ - if (value instanceof MIList) { - parseMemory((MIList)value); - } - } - } - } - } - if (memories == null) { - memories = new MIMemory[0]; - } - } - - void parseMemory(MIList list) { - MIValue[] values = list.getMIValues(); - memories = new MIMemory[values.length]; - for (int i = 0; i < values.length; i++) { - if (values[i] instanceof MITuple) { - memories[i] = new MIMemory((MITuple)values[i]); - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIEnvironmentPWDInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIEnvironmentPWDInfo.java deleted file mode 100644 index 6fd9bd04b6f..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIEnvironmentPWDInfo.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.output; - - - - -/** - * GDB/MI environment PWD info extraction. - */ -public class MIEnvironmentPWDInfo extends MIInfo { - - String pwd = ""; //$NON-NLS-1$ - - public MIEnvironmentPWDInfo(MIOutput o) { - super(o); - parse(); - } - - public String getWorkingDirectory() { - return pwd; - } - - void parse() { - if (isDone()) { - MIOutput out = getMIOutput(); - MIOOBRecord[] oobs = out.getMIOOBRecords(); - for (int i = 0; i < oobs.length; i++) { - if (oobs[i] instanceof MIConsoleStreamOutput) { - MIStreamRecord cons = (MIStreamRecord)oobs[i]; - String str = cons.getString(); - if (str.startsWith("Working directory")) { //$NON-NLS-1$ - int len = "Working directory".length(); //$NON-NLS-1$ - str = str.substring(len).trim(); - len = str.indexOf('.'); - if (len != -1) { - str = str.substring(0, len); - } - pwd = str; - } - } - } - } - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIExecAsyncOutput.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIExecAsyncOutput.java deleted file mode 100644 index 74fc3ccc4a7..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIExecAsyncOutput.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -/** - * @see MIAsyncRecord - */ -public class MIExecAsyncOutput extends MIAsyncRecord { -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIFrame.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIFrame.java deleted file mode 100644 index 383ed84fc12..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIFrame.java +++ /dev/null @@ -1,152 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -/** - * GDB/MI Frame tuple parsing. - */ -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]; - - public MIFrame(MITuple tuple) { - parse(tuple); - } - - public MIArg[] getArgs() { - return args; - } - - public String getFile() { - String fname = getFullname(); - return ( fname.length() != 0 ) ? fname : file; - } - - public String getFullname() { - return fullname; - } - - public String getFunction() { - return func; - } - - public int getLine() { - return line; - } - - public String getAddress() { - return addr; - } - - public int getLevel() { - return level; - } - - @Override - public String toString() { - StringBuffer buffer = new StringBuffer(); - buffer.append("level=\"" + level + "\""); //$NON-NLS-1$//$NON-NLS-2$ - buffer.append(",addr=\"" + addr + "\""); //$NON-NLS-1$//$NON-NLS-2$ - buffer.append(",func=\"" + func + "\""); //$NON-NLS-1$//$NON-NLS-2$ - buffer.append(",file=\"" + file + "\""); //$NON-NLS-1$//$NON-NLS-2$ - 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=\"" + args[i].getName() + "\"");//$NON-NLS-1$//$NON-NLS-2$ - buffer.append(",value=\"" + args[i].getValue() + "\"}");//$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(); - } - - 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(); - } 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 - // However PR180059: only cut it if it is last brackets represent parameters, - // because gdb can return: func="(anonymous namespace)::func2((anonymous namespace)::Test*)" - int closing = str.lastIndexOf(')'); - if (closing == str.length() - 1) { - int end = getMatchingBracketIndex(str, closing - 1); - if (end >= 0) { - 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); - } - } - } - } - - 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; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIGDBShowAddressSizeInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIGDBShowAddressSizeInfo.java deleted file mode 100644 index 46fd274c27b..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIGDBShowAddressSizeInfo.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - initial API and implementation - *******************************************************************************/ -/* - * Created on Jun 7, 2004 - * - * To change the template for this generated file go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -package org.eclipse.cdt.debug.mi.core.output; - -/** - * @author root - * - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -public class MIGDBShowAddressSizeInfo extends MIGDBShowInfo { - - public MIGDBShowAddressSizeInfo(MIOutput o) { - super(o); - } - - public int getAddressSize() - { - return Integer.parseInt(getValue()); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIGDBShowDirectoriesInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIGDBShowDirectoriesInfo.java deleted file mode 100644 index 008aa4d3d26..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIGDBShowDirectoriesInfo.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -import java.util.StringTokenizer; - - -/** - * GDB/MI show parsing. - * (gdb) - * -gdb-show directories - * ~"Source directories searched: /tmp:$cdir:$cwd\n" - * ^done - */ -public class MIGDBShowDirectoriesInfo extends MIInfo { - - String[] dirs = new String[0]; - - public MIGDBShowDirectoriesInfo(MIOutput o) { - super(o); - parse(); - } - - public String[] getDirectories() { - return dirs; - } - - void parse() { - if (isDone()) { - MIOutput out = getMIOutput(); - MIOOBRecord[] oobs = out.getMIOOBRecords(); - for (int i = 0; i < oobs.length; i++) { - if (oobs[i] instanceof MIConsoleStreamOutput) { - MIStreamRecord cons = (MIStreamRecord)oobs[i]; - String str = cons.getString(); - if (str.startsWith("Source directories searched:")) { //$NON-NLS-1$ - int j = str.indexOf(':'); - if (j != -1) { - String sub = str.substring(j + 1).trim(); - parseDirectories(sub); - } - } - } - } - } - } - - void parseDirectories(String d) { - String sep = System.getProperty("path.separator", ":"); //$NON-NLS-1$ //$NON-NLS-2$ - StringTokenizer st = new StringTokenizer(d, sep); - int count = st.countTokens(); - dirs = new String[count]; - for (int i = 0; st.hasMoreTokens() && i < count; i++) { - dirs[i] = st.nextToken(); - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIGDBShowEndianInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIGDBShowEndianInfo.java deleted file mode 100644 index 7fb986b7b3a..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIGDBShowEndianInfo.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.output; - -/** - * -gdb-show endian - * ~"The target endianness is set automatically (currently little endian)\n" - * ^done - * &"show endian\n" - * - */ -public class MIGDBShowEndianInfo extends MIInfo { - - boolean littleEndian; - - public MIGDBShowEndianInfo(MIOutput out) { - super(out); - parse(); - } - - public boolean isLittleEndian() { - return littleEndian; - } - - void parse() { - if (isDone()) { - MIOutput out = getMIOutput(); - MIOOBRecord[] oobs = out.getMIOOBRecords(); - for (int i = 0; i < oobs.length; i++) { - if (oobs[i] instanceof MIConsoleStreamOutput) { - MIStreamRecord cons = (MIStreamRecord) oobs[i]; - String str = cons.getString(); - // We are interested in the stream info - parseLine(str); - } - } - } - } - - void parseLine(String str) { - if (str != null && str.length() > 0) { - littleEndian = (str.indexOf("little") != -1); //$NON-NLS-1$ - } - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIGDBShowExitCodeInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIGDBShowExitCodeInfo.java deleted file mode 100644 index 62416676589..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIGDBShowExitCodeInfo.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - - - - -/** - * GDB/MI show parsing. - * (gdb) - * -data-evaluate-expression $_exitcode - * ^done,value="10" - * (gdb) - */ -public class MIGDBShowExitCodeInfo extends MIDataEvaluateExpressionInfo { - - public MIGDBShowExitCodeInfo(MIOutput o) { - super(o); - } - - public int getCode() { - int code = 0; - String exp = getExpression(); - try { - code = Integer.parseInt(exp); - } catch (NumberFormatException e) { - } - return code; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIGDBShowInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIGDBShowInfo.java deleted file mode 100644 index e0ba76984ca..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIGDBShowInfo.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - - - - -/** - * GDB/MI show parsing. - */ -public class MIGDBShowInfo extends MIInfo { - - String value = ""; //$NON-NLS-1$ - - public MIGDBShowInfo(MIOutput o) { - super(o); - parse(); - } - - public String getValue() { - return value; - } - - 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(); - if (var.equals("value")) { //$NON-NLS-1$ - MIValue val = results[i].getMIValue(); - if (val instanceof MIConst) { - value = ((MIConst)val).getString(); - } - } - } - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIGDBShowSolibSearchPathInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIGDBShowSolibSearchPathInfo.java deleted file mode 100644 index d141e822ab8..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIGDBShowSolibSearchPathInfo.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -import java.util.StringTokenizer; - - -/** - * GDB/MI show parsing. - * -gdb-show solib-search-path - * ^done,value="" - * (gdb) - * -gdb-set solib-search-path /tmp:/lib - * ^done - * (gdb) - * -gdb-show solib-search-path - * ^done,value="/tmp:/lib" - */ -public class MIGDBShowSolibSearchPathInfo extends MIGDBShowInfo { - - String[] dirs = null; - - public MIGDBShowSolibSearchPathInfo(MIOutput o) { - super(o); - } - - public String[] getDirectories() { - if (dirs == null) { - String val = getValue(); - parseDirectories(val); - } - return dirs; - } - - void parseDirectories(String d) { - String sep = System.getProperty("path.separator", ":"); //$NON-NLS-1$ //$NON-NLS-2$ - StringTokenizer st = new StringTokenizer(d, sep); - int count = st.countTokens(); - dirs = new String[count]; - for (int i = 0; st.hasMoreTokens() && i < count; i++) { - dirs[i] = st.nextToken(); - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIInfo.java deleted file mode 100644 index fd4efe7fe74..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIInfo.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -/** - * Base class for teh parsing/info GDB/MI classes. - */ -public class MIInfo { - - MIOutput miOutput; - - public MIInfo(MIOutput record) { - miOutput = record; - } - - public MIOutput getMIOutput () { - return miOutput; - } - - public boolean isDone() { - return isResultClass(MIResultRecord.DONE); - } - - public boolean isRunning() { - return isResultClass(MIResultRecord.RUNNING); - } - - public boolean isConnected() { - return isResultClass(MIResultRecord.CONNECTED); - } - - public boolean isError() { - return isResultClass(MIResultRecord.ERROR); - } - - public boolean isExit() { - return isResultClass(MIResultRecord.EXIT); - } - - @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; - } - - 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$ - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIInfoSharedLibraryInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIInfoSharedLibraryInfo.java deleted file mode 100644 index ba22c74db88..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIInfoSharedLibraryInfo.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 Newco - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Newco - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -import java.util.ArrayList; - -public class MIInfoSharedLibraryInfo extends MIInfo { - - MIShared[] shared = new MIShared[0]; - - public MIInfoSharedLibraryInfo(MIOutput record) { - super(record); - parse(); - } - - private void parse() { - if (isDone()) { - ArrayList aList = new ArrayList(); - 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("shlib-info")) { //$NON-NLS-1$ - MIValue val = results[i].getMIValue(); - if (val instanceof MITuple) - { - MIResult[] libResults = ((MITuple)val).getMIResults(); - String from = ""; //$NON-NLS-1$ - String to = ""; //$NON-NLS-1$ - boolean syms = true; - String name = ""; //$NON-NLS-1$ - - for (int j = 0; j < libResults.length; j++) { - if (libResults[j].getVariable().equals("description")) //$NON-NLS-1$ - { - name = libResults[j].getMIValue().toString(); - } - if (libResults[j].getVariable().equals("loaded_addr")) //$NON-NLS-1$ - { - from = libResults[j].getMIValue().toString(); - to = from; - } - } - MIShared s = new MIShared(from, to, syms, name); - aList.add(s); - } - } - } - } - shared = (MIShared[]) aList.toArray(new MIShared[aList.size()]); - } - } - - public MIShared[] getMIShared() { - return shared; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIList.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIList.java deleted file mode 100644 index 6bb0404bc52..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIList.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -/** - * GDB/MI list semantic. - */ -public class MIList extends MIValue { - - final static MIResult[] nullResults = new MIResult[0]; - final static MIValue[] nullValues = new MIValue[0]; - - MIResult[] results = nullResults; - MIValue[] values = nullValues; - - public MIResult[] getMIResults() { - return results; - } - - public void setMIResults(MIResult[] res) { - results = res; - } - - public MIValue[] getMIValues() { - return values; - } - - public void setMIValues(MIValue[] vals) { - values = vals; - } - - @Override - public String toString() { - StringBuffer buffer = new StringBuffer(); - 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/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MILogStreamOutput.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MILogStreamOutput.java deleted file mode 100644 index 0fd2c2adc38..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MILogStreamOutput.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -/** - * @see MIStreamRecord - */ -public class MILogStreamOutput extends MIStreamRecord { - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIMemory.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIMemory.java deleted file mode 100644 index 55f03b76815..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIMemory.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -import java.util.ArrayList; -import java.util.List; - -/** - * GDB/MI memory parsing. - */ -public class MIMemory { - String addr; - long [] data = new long[0]; - List badOffsets = new ArrayList(); - String ascii = ""; //$NON-NLS-1$ - - public MIMemory(MITuple tuple) { - parse(tuple); - } - - public String getAddress() { - return addr; - } - - public long [] getData() { - return data; - } - - public int[] getBadOffsets() { - int[] data = new int[badOffsets.size()]; - for (int i = 0; i < data.length; ++i) { - Integer o = (Integer)badOffsets.get(i); - data[i] = o.intValue(); - } - return data; - } - - public String getAscii() { - return ascii; - } - - public String toSting() { - StringBuffer buffer = new StringBuffer(); - buffer.append("addr=\"" + addr + "\""); //$NON-NLS-1$ //$NON-NLS-2$ - buffer.append("data=["); //$NON-NLS-1$ - for (int i = 0 ; i < data.length; i++) { - if (i != 0) { - buffer.append(','); - } - buffer.append('"').append(Long.toHexString(data[i])).append('"'); - } - buffer.append(']'); - if (ascii.length() > 0) { - buffer.append(",ascii=\"" + ascii + "\""); //$NON-NLS-1$ //$NON-NLS-2$ - } - 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(); - } - - if (var.equals("addr")) { //$NON-NLS-1$ - try { - addr = str.trim(); - } catch (NumberFormatException e) { - } - } else if (var.equals("data")) { //$NON-NLS-1$ - if (value != null && value instanceof MIList) { - parseData((MIList)value); - } - } else if (var.equals("ascii")) { //$NON-NLS-1$ - ascii = str; - } - } - } - - void parseData(MIList list) { - MIValue[] values = list.getMIValues(); - data = new long[values.length]; - for (int i = 0; i < values.length; i++) { - if (values[i] instanceof MIConst) { - String str = ((MIConst)values[i]).getCString(); - try { - data[i] = Long.decode(str.trim()).longValue(); - } catch (NumberFormatException e) { - badOffsets.add(new Integer(i)); - data[i] = 0; - } - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MINotifyAsyncOutput.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MINotifyAsyncOutput.java deleted file mode 100644 index 053e46ca2a1..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MINotifyAsyncOutput.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -/** - * @see MIAsyncRecord - */ -public class MINotifyAsyncOutput extends MIAsyncRecord { -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIOOBRecord.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIOOBRecord.java deleted file mode 100644 index 6fcea72ac31..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIOOBRecord.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -/** - * @see MIOOBRecord - */ -public abstract class MIOOBRecord { -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIOutput.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIOutput.java deleted file mode 100644 index 652dfc3e6e7..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIOutput.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -/** - * GDB/MI response. - */ -public class MIOutput { - - public static final MIOOBRecord[] nullOOBRecord = new MIOOBRecord[0]; - MIResultRecord rr = null; - MIOOBRecord[] oobs = nullOOBRecord; - - - public MIResultRecord getMIResultRecord() { - return rr; - } - - public void setMIResultRecord(MIResultRecord res) { - rr = res ; - } - - public MIOOBRecord[] getMIOOBRecords() { - return oobs; - } - - public void setMIOOBRecords(MIOOBRecord [] bands) { - oobs = bands; - } - - @Override - public String toString() { - StringBuffer buffer = new StringBuffer(); - 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/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIParser.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIParser.java deleted file mode 100644 index f6b26fcb6cc..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIParser.java +++ /dev/null @@ -1,578 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -import java.util.ArrayList; -import java.util.List; -import java.util.StringTokenizer; - -/** -<pre> -`OUTPUT :' - `( OUT-OF-BAND-RECORD )* [ RESULT-RECORD ] "(gdb)" NL' - -`RESULT-RECORD :' - ` [ TOKEN ] "^" RESULT-CLASS ( "," RESULT )* NL' - -`OUT-OF-BAND-RECORD :' - `ASYNC-RECORD | STREAM-RECORD' - -`ASYNC-RECORD :' - `EXEC-ASYNC-OUTPUT | STATUS-ASYNC-OUTPUT | NOTIFY-ASYNC-OUTPUT' - -`EXEC-ASYNC-OUTPUT :' - `[ TOKEN ] "*" ASYNC-OUTPUT' - -`STATUS-ASYNC-OUTPUT :' - `[ TOKEN ] "+" ASYNC-OUTPUT' - -`NOTIFY-ASYNC-OUTPUT :' - `[ TOKEN ] "=" ASYNC-OUTPUT' - -`ASYNC-OUTPUT :' - `ASYNC-CLASS ( "," RESULT )* NL' - -`RESULT-CLASS :' - `"done" | "running" | "connected" | "error" | "exit"' - -`ASYNC-CLASS :' - `"stopped" | OTHERS' (where OTHERS will be added depending on the - needs--this is still in development). - -`RESULT :' - ` VARIABLE "=" VALUE' - -`VARIABLE :' - ` STRING ' - -`VALUE :' - ` CONST | TUPLE | LIST ' - -`CONST :' - `C-STRING' - -`TUPLE :' - ` "{}" | "{" RESULT ( "," RESULT )* "}" ' - -`LIST :' - ` "[]" | "[" VALUE ( "," VALUE )* "]" | "[" RESULT ( "," RESULT )* - "]" ' - -`STREAM-RECORD :' - `CONSOLE-STREAM-OUTPUT | TARGET-STREAM-OUTPUT | LOG-STREAM-OUTPUT' - -`CONSOLE-STREAM-OUTPUT :' - `"~" C-STRING' - -`TARGET-STREAM-OUTPUT :' - `"@" C-STRING' - -`LOG-STREAM-OUTPUT :' - `"&" C-STRING' - -`NL :' - `CR | CR-LF' - -`TOKEN :' - _any sequence of digits_. - -`C-STRING :' - `""" SEVEN-BIT-ISO-C-STRING-CONTENT """' -</pre> - */ -public class MIParser { - - public String primaryPrompt = "(gdb)"; //$NON-NLS-1$ - public String cliPrompt = primaryPrompt; - public String secondaryPrompt = ">"; //$NON-NLS-1$ - - /** - * Point of entry to create an AST for MI. - * - * @param buffer Output from MI Channel. - * @return MIOutput - * @see MIOutput - */ - public MIOutput parse(String buffer) { - MIOutput mi = new MIOutput(); - MIResultRecord rr = null; - List oobs = new ArrayList(1); - int id = -1; - - StringTokenizer st = new StringTokenizer(buffer, "\n"); //$NON-NLS-1$ - while (st.hasMoreTokens()) { - StringBuffer token = new StringBuffer(st.nextToken()); - - // Fetch the Token/Id - if (token.length() > 0 && Character.isDigit(token.charAt(0))) { - int i = 1; - while (i < token.length() && Character.isDigit(token.charAt(i))) { - i++; - } - String numbers = token.substring(0, i); - try { - id = Integer.parseInt(numbers); - } catch (NumberFormatException e) { - } - // Consume the token. - token.delete(0, i); - } - - // ResultRecord ||| Out-Of-Band Records - if (token.length() > 0) { - if (token.charAt(0) == '^') { - token.deleteCharAt(0); - rr = processMIResultRecord(token, id); - } else if (startsWith(token, primaryPrompt)) { - //break; // Do nothing. - } else { - MIOOBRecord band = processMIOOBRecord(token, id); - if (band != null) { - oobs.add(band); - } - } - } - } - MIOOBRecord[] bands = (MIOOBRecord[]) oobs.toArray(new MIOOBRecord[oobs.size()]); - mi.setMIOOBRecords(bands); - mi.setMIResultRecord(rr); - return mi; - } - - /** - * Assuming '^' was deleted from the Result Record. - */ - private MIResultRecord processMIResultRecord(StringBuffer buffer, int id) { - 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 { - // FIXME: - // 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. - */ - private MIOOBRecord processMIOOBRecord(StringBuffer buffer, int id) { - MIOOBRecord oob = null; - char c = buffer.charAt(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; - } - 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; - } - stream.setCString(removeSurroundingDoubleQuotes(buffer.toString())); - oob = stream; - } else { - // Badly format MI line, just pass it to the user as target stream - MIStreamRecord stream = new MITargetStreamOutput(); - String res = buffer.toString(); - // this awfull expression just mean to replace \ with \\. This is needed because otherwise escaping is lost. - // this is to fix bug 255946 without breaking other stuff 286785 - res = res.replaceAll("\\Q\\", "\\\\\\\\"); //$NON-NLS-1$//$NON-NLS-2$ - stream.setCString(res + "\n"); //$NON-NLS-1$ - oob = stream; - } - return oob; - } - - private String removeSurroundingDoubleQuotes(String str) { - String s = str; - // remove leading double quote - if (s.startsWith("\"")) { //$NON-NLS-1$ - s = s.substring(1); - } - // remove trailing double quote - if (s.endsWith("\"")) { //$NON-NLS-1$ - s = s.substring(0, s.length() - 1); - } - return s; - } - - /** - * Assuming that the usual leading comma was consumed. - * Extract the MI Result comma separated responses. - */ - private MIResult[] processMIResults(FSB buffer) { - List aList = new ArrayList(); - 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 (MIResult[]) aList.toArray(new MIResult[aList.size()]); - } - - /** - * Construct the MIResult. 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) { - String variable = buffer.substring(0, equal); - result.setVariable(variable); - buffer.delete(0, equal + 1); - MIValue value = processMIValue(buffer); - result.setMIValue(value); - } else if(buffer.length()>0 && buffer.charAt(0)=='"') { - // This an error but we just swallow it and move on. - MIValue value = processMIValue(buffer); - result.setMIValue(value); - } else { - result.setVariable(buffer.toString()); - result.setMIValue(new MIConst()); // Empty string:??? - buffer.setLength(0); - } - return result; - } - - /** - * Find a MIValue 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(); - cnst.setCString(translateCString(buffer)); - 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 valueList = new ArrayList(); - List resultList = new ArrayList(); - // Catch closing '}' - while (buffer.length() > 0 && buffer.charAt(0) != '}') { - // Try for the MIValue 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 = (MIValue[]) valueList.toArray(new MIValue[valueList.size()]); - MIResult[] res = (MIResult[]) 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 valueList = new ArrayList(); - List resultList = new ArrayList(); - // catch closing ']' - while (buffer.length() > 0 && buffer.charAt(0) != ']') { - // Try for the MIValue 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 = (MIValue[]) valueList.toArray(new MIValue[valueList.size()]); - MIResult[] res = (MIResult[]) resultList.toArray(new MIResult[resultList.size()]); - list.setMIValues(values); - list.setMIResults(res); - return list; - } - - /* - * MI C-String rather MIConst values are enclose in double quotes - * and any double quotes or backslash 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 StringBuffer will move forward. - */ - private String translateCString(FSB buffer) { - 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); - 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/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIRegisterValue.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIRegisterValue.java deleted file mode 100644 index bbace67c30c..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIRegisterValue.java +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -import java.util.ArrayList; -import java.util.List; - - - -/** - * GDB/MI register response parsing. - */ -public class MIRegisterValue { - int number; - String value; - - public MIRegisterValue(int n, String v) { - number = n; - value = v; - } - - public int getNumber() { - return number; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - StringBuffer buffer = new StringBuffer(); - buffer.append("number=\"").append(number).append('"'); //$NON-NLS-1$ - buffer.append(',').append("value=\"" + value + "\""); //$NON-NLS-1$ //$NON-NLS-2$ - return buffer.toString(); - } - - /** - * Parsing a MIList of the form: - * [{number="1",value="0xffff"},{number="xxx",value="yyy"},..] - */ - public static MIRegisterValue[] getMIRegisterValues(MIList miList) { - List aList = new ArrayList(); - 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 ((MIRegisterValue[])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$ - } - - // 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; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIResult.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIResult.java deleted file mode 100644 index 625d050d740..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIResult.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.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; - } - - public MIValue getMIValue() { - return value; - } - - public void setMIValue(MIValue val) { - value = val; - } - - @Override - public String toString() { - StringBuffer buffer = new StringBuffer(); - buffer.append(variable); - if (value != null) { - String v = value.toString(); - buffer.append('='); - if (v.charAt(0) == '[' || v.charAt(0) =='{') { - buffer.append(v); - } else { - buffer.append("\"" + value.toString() + "\""); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - return buffer.toString(); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIResultRecord.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIResultRecord.java deleted file mode 100644 index 75045aa90ce..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIResultRecord.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -/** - * GDB/MI ResultRecord. - */ -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$ - - static final MIResult[] nullResults = new MIResult[0]; - MIResult[] results = nullResults; - String resultClass = ""; //$NON-NLS-1$ - int token = -1; - - public int getToken() { - return token; - } - - public void setToken(int t) { - token = t; - } - - /** - */ - public String getResultClass() { - return resultClass; - } - - public void setResultClass(String type) { - resultClass = type; - } - - public MIResult[] getMIResults() { - return results; - } - - public void setMIResults(MIResult[] res) { - results = res; - } - - @Override - public String toString() { - StringBuffer buffer = new StringBuffer(); - buffer.append(token).append('^').append(resultClass); - for (int i = 0; i < results.length; i++) { - buffer.append(',').append(results[i].toString()); - } - return buffer.toString(); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIShared.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIShared.java deleted file mode 100644 index 868d566e388..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIShared.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - - -/** - * GDB/MI shared information - */ -public class MIShared { - - String from; - String to; - boolean isread; - String name; - - public MIShared (String start, String end, boolean read, String location) { - from = start; - to = end; - isread = read; - name = location; - } - - public String getFrom() { - return from; - } - - public String getTo() { - return to; - } - - public boolean isRead() { - return isread; - } - - public String getName() { - return name; - } - - public void setSymbolsRead(boolean read) { - isread = read; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MISigHandle.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MISigHandle.java deleted file mode 100644 index ad0864481d0..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MISigHandle.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - - -/** - * GDB/MI shared information - */ -public class MISigHandle { - - String signal = ""; //$NON-NLS-1$ - boolean stop; - boolean print; - boolean pass; - String description = ""; //$NON-NLS-1$ - - public MISigHandle (String name, boolean stp, boolean prnt, boolean ps, String desc) { - signal = name; - stop = stp; - print = prnt; - pass = ps; - description = desc; - } - - public String getName() { - return signal; - } - - public boolean isStop() { - return stop; - } - - public boolean isPrint() { - return print; - } - - public boolean isPass() { - return pass; - } - - public void handle(boolean isIgnore, boolean isStop) { - pass = !isIgnore; - stop = isStop; - } - - public String getDescription() { - return description; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MISrcAsm.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MISrcAsm.java deleted file mode 100644 index 536d523ebd2..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MISrcAsm.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -import java.util.ArrayList; -import java.util.List; - -/** - * Represent a GDB Tuple MI assembly response. - */ -public class MISrcAsm { - int line; - String file = ""; //$NON-NLS-1$ - MIAsm[] asm; - - public MISrcAsm(MITuple tuple) { - parse(tuple); - } - - public int getLine() { - return line; - } - - public String getFile() { - return file; - } - - public MIAsm[] getMIAsms() { - return asm; - } - - @Override - public String toString() { - StringBuffer buffer = new StringBuffer(); - buffer.append("src_and_asm_line={"); //$NON-NLS-1$ - buffer.append("line=\"").append(line).append('"'); //$NON-NLS-1$ - buffer.append(",file=\"" + file + "\","); //$NON-NLS-1$ //$NON-NLS-2$ - buffer.append("line_asm_insn=["); //$NON-NLS-1$ - for (int i = 0; i < asm.length; i++) { - if (i != 0) { - buffer.append(','); - } - buffer.append(asm[i].toString()); - } - buffer.append(']'); - buffer.append('}'); - return buffer.toString(); - } - - void parse(MITuple tuple) { - List aList = new ArrayList(); - 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_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) { - aList.add(new MIAsm((MITuple)values[j])); - } - } - } - } if (var.equals("line")) { //$NON-NLS-1$ - try { - line = Integer.parseInt(str.trim()); - } catch (NumberFormatException e) { - } - } else if (var.equals("file")) { //$NON-NLS-1$ - file = str; - } - } - asm = (MIAsm[])aList.toArray(new MIAsm[aList.size()]); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIStackInfoDepthInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIStackInfoDepthInfo.java deleted file mode 100644 index b5581a5585b..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIStackInfoDepthInfo.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.output; - -/** - * GDB/MI stack info depth parsing. - */ -public class MIStackInfoDepthInfo extends MIInfo { - - int depth; - - public MIStackInfoDepthInfo(MIOutput out) { - super(out); - parse(); - } - - public int getDepth() { - return depth; - } - - 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(); - if (var.equals("depth")) { //$NON-NLS-1$ - MIValue val = results[i].getMIValue(); - if (val instanceof MIConst) { - String str = ((MIConst)val).getCString(); - try { - depth = Integer.parseInt(str.trim()); - } catch (NumberFormatException e) { - } - } - } - } - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIStackListArgumentsInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIStackListArgumentsInfo.java deleted file mode 100644 index c4aaaf7f68c..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIStackListArgumentsInfo.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.output; - -import java.util.ArrayList; -import java.util.List; - - -/** - * GDB/MI stack list arguments parsing. - */ -public class MIStackListArgumentsInfo extends MIInfo { - - MIFrame[] frames; - - public MIStackListArgumentsInfo(MIOutput out) { - super(out); - } - - public MIFrame[] getMIFrames() { - if (frames == null) { - parse(); - } - return frames; - } - - void parse() { - List aList = new ArrayList(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("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 = (MIFrame[])aList.toArray(new MIFrame[aList.size()]); - } - - void parseStack(MIList miList, List 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(MITuple miTuple, List 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/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIStackListFramesInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIStackListFramesInfo.java deleted file mode 100644 index 88aa6a6d73c..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIStackListFramesInfo.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -import java.util.ArrayList; -import java.util.List; - - -/** - * GDB/MI stack list frames info. - */ -public class MIStackListFramesInfo extends MIInfo { - - MIFrame[] frames; - - public MIStackListFramesInfo(MIOutput out) { - super(out); - } - - public MIFrame[] getMIFrames() { - if (frames == null) { - parse(); - } - return frames; - } - - void parse() { - List aList = new ArrayList(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("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 = (MIFrame[])aList.toArray(new MIFrame[aList.size()]); - } - - void parseStack(MIList miList, List 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 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/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIStackListLocalsInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIStackListLocalsInfo.java deleted file mode 100644 index c8e2ba8d630..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIStackListLocalsInfo.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.output; - - - -/** - * GDB/MI stack list locals parsing. - * -stack-list-locals 1 - * ^done,locals=[{name="p",value="0x8048600 \"ghislaine\""},{name="buf",value="\"'\", 'x' <repeats 24 times>, \"i,xxxxxxxxx\", 'a' <repeats 24 times>"},{name="buf2",value="\"\\\"?'\\\\()~\""},{name="buf3",value="\"alain\""},{name="buf4",value="\"\\t\\t\\n\\f\\r\""},{name="i",value="0"}] - * - * On MacOS X 10.4 this returns a tuple: - * ^done,locals={{name="p",value="0x8048600 \"ghislaine\""},{name="buf",value="\"'\", 'x' <repeats 24 times>, \"i,xxxxxxxxx\", 'a' <repeats 24 times>"},{name="buf2",value="\"\\\"?'\\\\()~\""},{name="buf3",value="\"alain\""},{name="buf4",value="\"\\t\\t\\n\\f\\r\""},{name="i",value="0"}} - */ -public class MIStackListLocalsInfo extends MIInfo { - - MIArg[] locals; - - public MIStackListLocalsInfo(MIOutput out) { - super(out); - parse(); - } - - public MIArg[] getLocals() { - if (locals == null) { - parse(); - } - return locals; - } - - 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(); - if (var.equals("locals")) { //$NON-NLS-1$ - MIValue value = results[i].getMIValue(); - if (value instanceof MIList) { - locals = MIArg.getMIArgs((MIList)value); - } else if (value instanceof MITuple) { - locals = MIArg.getMIArgs((MITuple)value); - } - } - } - } - } - if (locals == null) { - locals = new MIArg[0]; - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIStatusAsyncOutput.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIStatusAsyncOutput.java deleted file mode 100644 index 8d7b3286c12..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIStatusAsyncOutput.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -/** - * @see MIAsyncRecord - */ -public class MIStatusAsyncOutput extends MIAsyncRecord { - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIStreamRecord.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIStreamRecord.java deleted file mode 100644 index 2499be952d0..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIStreamRecord.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -/** - * GDB/MI stream record response. - */ -public abstract class MIStreamRecord extends MIOOBRecord { - - String cstring = ""; //$NON-NLS-1$ - - public String getCString() { - return cstring; - } - - public void setCString(String str) { - cstring = str; - } - - public String getString () { - return MIConst.getString(getCString()); - } - - @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$ - } - return "\"" + cstring + "\"\n"; //$NON-NLS-1$ //$NON-NLS-2$ - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MITargetStreamOutput.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MITargetStreamOutput.java deleted file mode 100644 index 59fe4839f33..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MITargetStreamOutput.java +++ /dev/null @@ -1,19 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -/** - * @see MIStreamRecord - */ -public class MITargetStreamOutput extends MIStreamRecord { - - public static final String startTag = "@"; //$NON-NLS-1$ -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIThreadListIdsInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIThreadListIdsInfo.java deleted file mode 100644 index d8e47cd9807..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIThreadListIdsInfo.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -/** - * GDB/MI thread list parsing. - */ -public class MIThreadListIdsInfo extends MIInfo { - - int[] threadIds; - - public MIThreadListIdsInfo(MIOutput out) { - super(out); - } - - public int[] getThreadIds() { - if (threadIds == null) { - parse(); - } - return threadIds; - } - - 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(); - if (var.equals("thread-ids")) { //$NON-NLS-1$ - MIValue val = results[i].getMIValue(); - if (val instanceof MITuple) { - parseThreadIds((MITuple)val); - } - } - } - } - } - if (threadIds == null) { - threadIds = new int[0]; - } - } - - void parseThreadIds(MITuple tuple) { - MIResult[] results = tuple.getMIResults(); - threadIds = new int[results.length]; - for (int i = 0; i < results.length; i++) { - String var = results[i].getVariable(); - if (var.equals("thread-id")) { //$NON-NLS-1$ - MIValue value = results[i].getMIValue(); - if (value instanceof MIConst) { - String str = ((MIConst)value).getCString(); - try { - threadIds[i] = Integer.parseInt(str.trim()); - } catch (NumberFormatException e) { - } - } - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIThreadSelectInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIThreadSelectInfo.java deleted file mode 100644 index c0b817d2807..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIThreadSelectInfo.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -/** - * GDB/MI thread select parsing. - */ -public class MIThreadSelectInfo extends MIInfo { - - int threadId; - MIFrame frame; - - public MIThreadSelectInfo(MIOutput out) { - super(out); - parse(); - } - - public int getNewThreadId() { - return threadId; - } - - public MIFrame getFrame() { - return frame; - } - - 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(); - if (var.equals("new-thread-id")) { //$NON-NLS-1$ - MIValue value = results[i].getMIValue(); - if (value instanceof MIConst) { - String str = ((MIConst)value).getCString(); - try { - threadId = Integer.parseInt(str.trim()); - } catch (NumberFormatException e) { - } - } - } else if (var.equals("frame")) { //$NON-NLS-1$ - MIValue value = results[i].getMIValue(); - if (value instanceof MITuple) { - frame = new MIFrame((MITuple)value); - } - } - } - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MITuple.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MITuple.java deleted file mode 100644 index 577271488b7..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MITuple.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -/** - * GDB/MI tuple value. - */ -public class MITuple extends MIValue { - - final static MIResult[] nullResults = new MIResult[0]; - final static MIValue[] nullValues = new MIValue[0]; - MIResult[] results = nullResults; - MIValue[] values = nullValues; - - public MIResult[] getMIResults() { - return results; - } - - public void setMIResults(MIResult[] res) { - results = res; - } - - public MIValue[] getMIValues() { - return values; - } - - public void setMIValues(MIValue[] vals) { - values = vals; - } - - @Override - public String toString() { - StringBuffer buffer = new StringBuffer(); - 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/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIValue.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIValue.java deleted file mode 100644 index d89c7b0b36f..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIValue.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -/** - * GDB/MI value. - */ -public abstract class MIValue { -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIVar.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIVar.java deleted file mode 100644 index ba3323fcaca..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIVar.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.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"}} - * - */ -public class MIVar { - - String name = ""; //$NON-NLS-1$ - String type = ""; //$NON-NLS-1$ - String exp = ""; //$NON-NLS-1$ - int numchild; - - - public MIVar(String n, int num, String t) { - name = n; - numchild = num; - type = t; - } - - public MIVar(MITuple tuple) { - parse(tuple); - } - - public String getVarName() { - return name; - } - - public String getType() { - return type; - } - - public int getNumChild() { - return numchild; - } - - public String getExp() { - return exp; - } - - 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("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("exp")) { //$NON-NLS-1$ - exp = str; - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIVarChange.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIVarChange.java deleted file mode 100644 index 1eb5b4926df..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIVarChange.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -/** - * GDB/MI var-update. - */ - -public class MIVarChange { - String name; - boolean inScope; - boolean changed; - - public MIVarChange(String n) { - name = n; - } - - public String getVarName() { - return name; - } - - public boolean isInScope() { - return inScope; - } - - public boolean isChanged() { - return changed; - } - - public void setInScope(boolean b) { - inScope = b; - } - - public void setChanged(boolean c) { - changed = c; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIVarCreateInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIVarCreateInfo.java deleted file mode 100644 index bf00512ba82..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIVarCreateInfo.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - - -/** - * GDB/MI var-create. - * -var-create "-" * buf3 - * ^done,name="var1",numchild="6",type="char [6]" - */ -public class MIVarCreateInfo extends MIInfo { - - String name = ""; //$NON-NLS-1$ - int numChild; - String type = ""; //$NON-NLS-1$ - MIVar child; - - public MIVarCreateInfo(MIOutput record) { - super(record); - parse(); - } - - public MIVar getMIVar() { - if (child == null) { - child = new MIVar(name, numChild, type); - } - return child; - } - - 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 instanceof MIConst) { - str = ((MIConst)value).getString(); - } - - if (var.equals("name")) { //$NON-NLS-1$ - name = str; - } else if (var.equals("numchild")) { //$NON-NLS-1$ - try { - numChild = Integer.parseInt(str.trim()); - } catch (NumberFormatException e) { - } - } else if (var.equals("type")) { //$NON-NLS-1$ - type = str; - } - } - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIVarDeleteInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIVarDeleteInfo.java deleted file mode 100644 index 5e20244a74d..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIVarDeleteInfo.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - - -/** - * GDB/MI var-delete. - */ -public class MIVarDeleteInfo extends MIInfo { - - int ndeleted; - - public MIVarDeleteInfo(MIOutput record) { - super(record); - parse(); - } - - public int getNumberDeleted () { - return ndeleted; - } - - 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(); - 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) { - } - } - } - } - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIVarEvaluateExpressionInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIVarEvaluateExpressionInfo.java deleted file mode 100644 index 8031aafb530..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIVarEvaluateExpressionInfo.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -/** - * GDB/MI var-evalute-expression - */ -public class MIVarEvaluateExpressionInfo extends MIInfo { - - String value = ""; //$NON-NLS-1$ - - public MIVarEvaluateExpressionInfo(MIOutput record) { - super(record); - parse(); - } - - public String getValue () { - return value; - } - - 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(); - if (var.equals("value")) { //$NON-NLS-1$ - MIValue val = results[i].getMIValue(); - if (val instanceof MIConst) { - value = ((MIConst)val).getCString(); - } - } - } - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIVarInfoExpressionInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIVarInfoExpressionInfo.java deleted file mode 100644 index 37631620c48..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIVarInfoExpressionInfo.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -/** - * GDB/MI var-info-expression. - */ -public class MIVarInfoExpressionInfo extends MIInfo { - - String lang = ""; //$NON-NLS-1$ - String exp = ""; //$NON-NLS-1$ - - public MIVarInfoExpressionInfo(MIOutput record) { - super(record); - parse(); - } - - public String getLanguage () { - return lang; - } - - public String getExpression() { - return exp; - } - - 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 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; - } - } - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIVarInfoNumChildrenInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIVarInfoNumChildrenInfo.java deleted file mode 100644 index 7200cfe4f39..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIVarInfoNumChildrenInfo.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core.output; - - -/** - * GDB/MI var-info-num-children. - */ -public class MIVarInfoNumChildrenInfo extends MIInfo { - - int children; - - public MIVarInfoNumChildrenInfo(MIOutput record) { - super(record); - parse(); - } - - public int getChildNumber() { - return children; - } - - 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(); - - 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) { - } - } - } - } - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIVarInfoTypeInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIVarInfoTypeInfo.java deleted file mode 100644 index 9ebf6af7965..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIVarInfoTypeInfo.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - - -/** - * GDB/MI var-info-type - */ -public class MIVarInfoTypeInfo extends MIInfo { - - String type = ""; //$NON-NLS-1$ - - public MIVarInfoTypeInfo(MIOutput record) { - super(record); - parse(); - } - - public String getType() { - return type; - } - - 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(); - if (var.equals("type")) { //$NON-NLS-1$ - MIValue value = results[i].getMIValue(); - if (value instanceof MIConst) { - type = ((MIConst)value).getString(); - } - } - } - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIVarListChildrenInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIVarListChildrenInfo.java deleted file mode 100644 index 3ccdd6d9c29..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIVarListChildrenInfo.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -import java.util.ArrayList; -import java.util.List; - -/** - * 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"}} - * - */ -public class MIVarListChildrenInfo extends MIInfo { - - MIVar[] children; - int numchild; - - public MIVarListChildrenInfo(MIOutput record) { - super(record); - parse(); - } - - public MIVar[] getMIVars() { - return children; - } - - void parse() { - List aList = new ArrayList(); - 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); - } - } - } - } - children = (MIVar[])aList.toArray(new MIVar[aList.size()]); - } - - /* - * Some gdb MacOSX do not return a MITuple so we have - * to check for different format. - * See PR 81019 - */ - void parseChildren(MIValue val, List aList) { - MIResult[] results = null; - if (val instanceof MITuple) { - results = ((MITuple)val).getMIResults(); - } else if (val instanceof MIList) { - results = ((MIList)val).getMIResults(); - } - if (results != null) { - for (int i = 0; i < results.length; i++) { - String var = results[i].getVariable(); - if (var.equals("child")) { //$NON-NLS-1$ - MIValue value = results[i].getMIValue(); - if (value instanceof MITuple) { - aList.add(new MIVar((MITuple)value)); - } - } - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIVarShowAttributesInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIVarShowAttributesInfo.java deleted file mode 100644 index 0798489d573..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIVarShowAttributesInfo.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -/** - * GDB/MI var-show-attributes - */ -public class MIVarShowAttributesInfo extends MIInfo { - - String attr = ""; //$NON-NLS-1$ - - public MIVarShowAttributesInfo(MIOutput record) { - super(record); - parse(); - } - - public String getAttributes () { - return attr; - } - - public boolean isEditable() { - return attr.equals("editable"); //$NON-NLS-1$ - } - - 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(); - if (var.equals("attr")) { //$NON-NLS-1$ - MIValue value = results[i].getMIValue(); - if (value instanceof MIConst) { - attr = ((MIConst)value).getString(); - } - } - } - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIVarShowFormatInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIVarShowFormatInfo.java deleted file mode 100644 index 3d6043fb76f..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIVarShowFormatInfo.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -import org.eclipse.cdt.debug.mi.core.MIFormat; - -/** - * GDB/MI var-show-format - */ -public class MIVarShowFormatInfo extends MIInfo { - - int format = MIFormat.NATURAL; - - public MIVarShowFormatInfo(MIOutput record) { - super(record); - parse(); - } - - public int getFormat() { - return format; - } - - 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(); - 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; - } - } - } - } - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIVarUpdateInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIVarUpdateInfo.java deleted file mode 100644 index fa8553760b0..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIVarUpdateInfo.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core.output; - -import java.util.ArrayList; -import java.util.List; - -/** - * GDB/MI var-update. - * -var-update * - * ^done,changelist={name="var3",in_scope="true",type_changed="false",name="var2",in_scope="true",type_changed="false"} - */ -public class MIVarUpdateInfo extends MIInfo { - - MIVarChange[] changeList; - - public MIVarUpdateInfo(MIOutput record) { - super(record); - parse(); - } - - public MIVarChange[] getMIVarChanges() { - return changeList; - } - - void parse() { - List aList = new ArrayList(); - 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 = (MIVarChange[])aList.toArray(new MIVarChange[aList.size()]); - } - - /** - * For MI2 the format is now a MIList. - * @param tuple - * @param aList - */ - void parseChangeList(MIList miList, List aList) { - MIValue[] values = miList.getMIValues(); - for (int i = 0; i < values.length; ++i) { - if (values[i] instanceof MITuple) { - parseChangeList((MITuple)values[i], aList); - } else if (values[i] instanceof MIList) { - parseChangeList((MIList)values[i], aList); - } - } - } - - void parseChangeList(MITuple tuple, List aList) { - MIResult[] results = tuple.getMIResults(); - MIVarChange change = null; - for (int i = 0; i < results.length; i++) { - String var = results[i].getVariable(); - MIValue value = results[i].getMIValue(); - if (value instanceof MITuple) { - parseChangeList((MITuple)value, aList); - } - else - { - String str = ""; //$NON-NLS-1$ - if (value instanceof MIConst) { - str = ((MIConst)value).getString(); - } - if (var.equals("name")) { //$NON-NLS-1$ - change = new MIVarChange(str); - aList.add(change); - } else if (var.equals("in_scope")) { //$NON-NLS-1$ - if (change != null) { - change.setInScope("true".equals(str)); //$NON-NLS-1$ - } - } else if (var.equals("type_changed")) { //$NON-NLS-1$ - if (change != null) { - change.setChanged("true".equals(str)); //$NON-NLS-1$ - } - } - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/plugin.properties b/debug/org.eclipse.cdt.debug.mi.core/plugin.properties deleted file mode 100644 index 86a8cadfa10..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/plugin.properties +++ /dev/null @@ -1,23 +0,0 @@ -############################################################################### -# Copyright (c) 2000, 2010 QNX Software Systems and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# QNX Software Systems - Initial API and implementation -# IBM Corporation -############################################################################### -pluginName=C/C++ Development Tools GDB/MI CDI Debugger Core -providerName=Eclipse CDT - -GDBServer.name=gdbserver -GDBMIDebugger.name=gdb/mi -MinGWDebugger.name=MinGW gdb - -StandardCommandFactory.name=Standard -StandardLinuxCommandFactory.name=Standard (Linux) -StandardWindowsCommandFactory.name=Standard (Windows) -StandardMacOSCommandFactory.name=Standard (Mac OS) -CygWinCommandFactory.name=CygWin diff --git a/debug/org.eclipse.cdt.debug.mi.core/plugin.xml b/debug/org.eclipse.cdt.debug.mi.core/plugin.xml deleted file mode 100755 index 9dc2698c11e..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/plugin.xml +++ /dev/null @@ -1,129 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.0"?> -<plugin> - <extension-point id="commandFactories" name="gdb/mi Command Factories" schema="schema/commandFactories.exsd"/> - - <extension - point="org.eclipse.cdt.debug.core.CDebugger"> - <debugger - class="org.eclipse.cdt.debug.mi.core.GDBCDIDebugger2" - cpu="native" - id="org.eclipse.cdt.debug.mi.core.CDebuggerNew" - modes="attach,core,run" - name="%GDBMIDebugger.name" - platform="*"> - <buildIdPattern - pattern="cdt\.managedbuild\.config\.gnu\..*"> - </buildIdPattern> - <buildIdPattern - pattern="cdt\.managedbuild\.toolchain\.gnu\..*"> - </buildIdPattern> - </debugger> - <debugger - platform="*" - name="%GDBServer.name" - modes="run" - cpu="*" - class="org.eclipse.cdt.debug.mi.core.GDBServerCDIDebugger2" - id="org.eclipse.cdt.debug.mi.core.GDBServerCDebugger"/> - <debugger - class="org.eclipse.cdt.debug.mi.core.MinGWDebugger" - cpu="native" - id="org.eclipse.cdt.debug.mi.core.MinGW" - modes="attach,core,run" - name="%MinGWDebugger.name" - platform="win32"> - <buildIdPattern - pattern="cdt\.managedbuild\.config\.gnu\.mingw\..*"> - </buildIdPattern> - <buildIdPattern - pattern="cdt\.managedbuild\.toolchain\.gnu\.mingw\..*"> - </buildIdPattern> - </debugger> - </extension> - <extension - point="org.eclipse.core.runtime.preferences"> - <initializer class="org.eclipse.cdt.debug.mi.core.MIPreferenceInitializer"/> - </extension> - <extension - point="org.eclipse.cdt.debug.mi.core.commandFactories"> - <commandFactory - class="org.eclipse.cdt.debug.mi.core.command.factories.win32.StandardWinCommandFactory" - debuggerID="org.eclipse.cdt.debug.mi.core.CDebuggerNew" - id="org.eclipse.cdt.debug.mi.core.standardWinCommandFactory" - miVersions="mi,mi1,mi2" - name="%StandardWindowsCommandFactory.name" - platforms="win32"/> - <commandFactory - class="org.eclipse.cdt.debug.mi.core.command.factories.win32.CygwinCommandFactory" - debuggerID="org.eclipse.cdt.debug.mi.core.CDebuggerNew" - id="org.eclipse.cdt.debug.mi.core.cygwinCommandFactory" - miVersions="mi,mi1,mi2" - name="%CygWinCommandFactory.name" - platforms="win32"/> - <commandFactory - class="org.eclipse.cdt.debug.mi.core.command.factories.linux.StandardLinuxCommandFactory" - debuggerID="org.eclipse.cdt.debug.mi.core.CDebuggerNew" - id="org.eclipse.cdt.debug.mi.core.standardLinuxCommandFactory" - miVersions="mi,mi1,mi2" - name="%StandardLinuxCommandFactory.name" - platforms="linux"/> - <commandFactory - class="org.eclipse.cdt.debug.mi.core.command.factories.macos.StandardMacOSCommandFactory" - debuggerID="org.eclipse.cdt.debug.mi.core.CDebuggerNew" - id="org.eclipse.cdt.debug.mi.core.standardMacOSCommandFactory" - miVersions="mi,mi1,mi2" - name="%StandardMacOSCommandFactory.name" - platforms="macosx"/> - <commandFactory - class="org.eclipse.cdt.debug.mi.core.command.factories.StandardCommandFactory" - debuggerID="org.eclipse.cdt.debug.mi.core.CDebuggerNew" - id="org.eclipse.cdt.debug.mi.core.standardCommandFactory" - miVersions="mi,mi1,mi2" - name="%StandardCommandFactory.name" - platforms="*"/> - <commandFactory - class="org.eclipse.cdt.debug.mi.core.command.factories.StandardCommandFactory" - debuggerID="org.eclipse.cdt.debug.mi.core.GDBServerCDebugger" - id="org.eclipse.cdt.debug.mi.core.standardCommandFactory" - miVersions="mi,mi1,mi2" - name="%StandardCommandFactory.name" - platforms="*"/> - <commandFactory - class="org.eclipse.cdt.debug.mi.core.command.factories.win32.StandardWinCommandFactory" - debuggerID="org.eclipse.cdt.debug.mi.core.GDBServerCDebugger" - id="org.eclipse.cdt.debug.mi.core.standardWinCommandFactory" - miVersions="mi,mi1,mi2" - name="%StandardWindowsCommandFactory.name" - platforms="win32"/> - <commandFactory - class="org.eclipse.cdt.debug.mi.core.command.factories.win32.CygwinCommandFactory" - debuggerID="org.eclipse.cdt.debug.mi.core.GDBServerCDebugger" - id="org.eclipse.cdt.debug.mi.core.cygwinCommandFactory" - miVersions="mi,mi1,mi2" - name="%CygWinCommandFactory.name" - platforms="win32"/> - <commandFactory - class="org.eclipse.cdt.debug.mi.core.command.factories.linux.StandardLinuxCommandFactory" - debuggerID="org.eclipse.cdt.debug.mi.core.GDBServerCDebugger" - id="org.eclipse.cdt.debug.mi.core.standardLinuxCommandFactory" - miVersions="mi,mi1,mi2" - name="%StandardLinuxCommandFactory.name" - platforms="linux"/> - <commandFactory - class="org.eclipse.cdt.debug.mi.core.command.factories.macos.StandardMacOSCommandFactory" - debuggerID="org.eclipse.cdt.debug.mi.core.GDBServerCDebugger" - id="org.eclipse.cdt.debug.mi.core.standardMacOSCommandFactory" - miVersions="mi,mi1,mi2" - name="%StandardMacOSCommandFactory.name" - platforms="macosx"/> - <commandFactory - class="org.eclipse.cdt.debug.mi.core.command.factories.win32.StandardWinCommandFactory" - debuggerID="org.eclipse.cdt.debug.mi.core.MinGW" - id="org.eclipse.cdt.debug.mi.core.mingwCommandFactory" - miVersions="mi,mi1,mi2" - name="%StandardWindowsCommandFactory.name" - platforms="win32"/> - </extension> - -</plugin> diff --git a/debug/org.eclipse.cdt.debug.mi.core/pom.xml b/debug/org.eclipse.cdt.debug.mi.core/pom.xml deleted file mode 100644 index 3e159871f10..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/pom.xml +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" - xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.eclipse.cdt</groupId> - <artifactId>cdt-parent</artifactId> - <version>9.0.0-SNAPSHOT</version> - <relativePath>../../pom.xml</relativePath> - </parent> - - <version>7.3.0-SNAPSHOT</version> - <artifactId>org.eclipse.cdt.debug.mi.core</artifactId> - <packaging>eclipse-plugin</packaging> -</project> diff --git a/debug/org.eclipse.cdt.debug.mi.core/schema/commandFactories.exsd b/debug/org.eclipse.cdt.debug.mi.core/schema/commandFactories.exsd deleted file mode 100644 index 84a7736b1fa..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/schema/commandFactories.exsd +++ /dev/null @@ -1,161 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> -<!-- Schema file written by PDE --> -<schema targetNamespace="org.eclipse.cdt.debug.mi.core"> -<annotation> - <appInfo> - <meta.schema plugin="org.eclipse.cdt.debug.mi.core" id="commandFactories" name="gdb/mi Command Factories"/> - </appInfo> - <documentation> - Allows the contributions of modified gdb/mi command sets. - </documentation> - </annotation> - - <element name="extension"> - <complexType> - <sequence> - <element ref="commandFactory" minOccurs="1" maxOccurs="unbounded"/> - </sequence> - <attribute name="point" type="string" use="required"> - <annotation> - <documentation> - a fully qualified identifier of the target extension point - </documentation> - </annotation> - </attribute> - <attribute name="id" type="string"> - <annotation> - <documentation> - an optional identifier of the extension instance - </documentation> - </annotation> - </attribute> - <attribute name="name" type="string"> - <annotation> - <documentation> - an optional name of the extension instance - </documentation> - <appInfo> - <meta.attribute translatable="true"/> - </appInfo> - </annotation> - </attribute> - </complexType> - </element> - - <element name="commandFactory"> - <complexType> - <attribute name="id" type="string" use="required"> - <annotation> - <documentation> - specifies a unique identifier for this command factory. - </documentation> - </annotation> - </attribute> - <attribute name="class" type="string" use="required"> - <annotation> - <documentation> - specifies a fully qualified name of a Java class that extends &lt;code&gt;CommandFactory&lt;/code&gt; - </documentation> - <appInfo> - <meta.attribute kind="java" basedOn="org.eclipse.cdt.debug.mi.core.command.CommandFactory"/> - </appInfo> - </annotation> - </attribute> - <attribute name="debuggerID" type="string" use="required"> - <annotation> - <documentation> - specifies the identifier of the debugger this command factory is contributed to. - </documentation> - </annotation> - </attribute> - <attribute name="name" type="string" use="required"> - <annotation> - <documentation> - specifies the name of this command factory that will appear in the launch dialog. - </documentation> - </annotation> - </attribute> - <attribute name="description" type="string"> - <annotation> - <documentation> - specifies the description of this command factory. - </documentation> - </annotation> - </attribute> - <attribute name="platforms" type="string"> - <annotation> - <documentation> - specifies a comma separated list of supported platforms. - </documentation> - </annotation> - </attribute> - <attribute name="miVersions" type="string"> - <annotation> - <documentation> - specifies a comma separated list of mi levels supported by this command factory. - </documentation> - </annotation> - </attribute> - </complexType> - </element> - - <annotation> - <appInfo> - <meta.section type="since"/> - </appInfo> - <documentation> - 3.1 - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="examples"/> - </appInfo> - <documentation> - The following is an example of a command factory extension point: - -<extension point="org.eclipse.cdt.debug.mi.core.commandFactories"> - <commandFactory - class="org.eclipse.cdt.debug.mi.core.command.factories.win32.CygwinCommandFactory" - debuggerID="org.eclipse.cdt.debug.mi.core.CDebuggerNew" - id="org.eclipse.cdt.debug.mi.core.cygwinCommandFactory" - miVersions="mi,mi1,mi2" - name="CygWin" - platforms="win32"/> -</extension> - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="apiInfo"/> - </appInfo> - <documentation> - Value of the attribute class must be a fully qualified name of a Java class that extends the class org.eclipse.cdt.debug.mi.core.command.CommandFactory. - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="implementation"/> - </appInfo> - <documentation> - - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="copyright"/> - </appInfo> - <documentation> - Copyright (c) 2004, 2005 QNX Software Systems and others. -All rights reserved. This program and the accompanying materials -are made available under the terms of the Eclipse Public License v1.0 -which accompanies this distribution, and is available at -http://www.eclipse.org/legal/epl-v10.html - </documentation> - </annotation> - -</schema> diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/AbstractGDBCDIDebugger.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/AbstractGDBCDIDebugger.java deleted file mode 100644 index b50f39a6a9f..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/AbstractGDBCDIDebugger.java +++ /dev/null @@ -1,243 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core; - -import java.io.File; -import com.ibm.icu.text.DateFormat; -import com.ibm.icu.text.MessageFormat; -import java.util.Date; -import java.util.Map; -import org.eclipse.cdt.core.IBinaryParser.IBinaryObject; -import org.eclipse.cdt.debug.core.ICDIDebugger2; -import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.ICDISession; -import org.eclipse.cdt.debug.core.cdi.ICDISessionConfiguration; -import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; -import org.eclipse.cdt.debug.mi.core.cdi.Session; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; -import org.eclipse.cdt.debug.mi.core.command.CommandFactory; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.MultiStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.variables.VariablesPlugin; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.model.IProcess; - -/** - * Base class for the gdb/mi-based <code>ICDIDebugger</code> extension point - * implementations. - */ -abstract public class AbstractGDBCDIDebugger implements ICDIDebugger2 { - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.ICDIDebugger#createDebuggerSession(org.eclipse.debug.core.ILaunch, org.eclipse.cdt.core.IBinaryParser.IBinaryObject, org.eclipse.core.runtime.IProgressMonitor) - */ - @Override - public ICDISession createDebuggerSession( ILaunch launch, IBinaryObject exe, IProgressMonitor monitor ) throws CoreException { - return createSession( launch, exe.getPath().toFile(), monitor ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.ICDIDebugger2#createSession(org.eclipse.debug.core.ILaunch, java.io.File, org.eclipse.core.runtime.IProgressMonitor) - */ - @Override - public ICDISession createSession( ILaunch launch, File executable, IProgressMonitor monitor ) throws CoreException { - boolean failed = false; - if ( monitor == null ) { - monitor = new NullProgressMonitor(); - } - if ( monitor.isCanceled() ) { - throw new OperationCanceledException(); - } - boolean verboseMode = verboseMode( launch.getLaunchConfiguration() ); - boolean breakpointsFullPath = getBreakpointsWithFullNameAttribute(launch.getLaunchConfiguration() ); - Session session = createGDBSession( launch, executable, monitor ); - if ( session != null ) { - try { - ICDITarget[] targets = session.getTargets(); - for( int i = 0; i < targets.length; i++ ) { - Process debugger = session.getSessionProcess( targets[i] ); - if ( debugger != null ) { - IProcess debuggerProcess = createGDBProcess( (Target)targets[i], launch, debugger, renderDebuggerProcessLabel( launch ), null ); - launch.addProcess( debuggerProcess ); - } - Target target = (Target)targets[i]; - target.enableVerboseMode( verboseMode ); - target.getMISession().setBreakpointsWithFullName(breakpointsFullPath); - target.getMISession().start(); - - } - doStartSession( launch, session, monitor ); - } - catch( MIException e ) { - failed = true; - throw newCoreException( e ); - } - catch( CoreException e ) { - failed = true; - throw e; - } - finally { - try { - if ( (failed || monitor.isCanceled()) && session != null ) - session.terminate(); - } - catch( CDIException e1 ) { - } - } - } - return session; - } - - protected Session createGDBSession( ILaunch launch, File executable, IProgressMonitor monitor ) throws CoreException { - Session session = null; - IPath gdbPath = getGDBPath( launch ); - ILaunchConfiguration config = launch.getLaunchConfiguration(); - CommandFactory factory = getCommandFactory( config ); - String[] extraArgs = getExtraArguments( config ); - boolean usePty = usePty( config ); - try { - session = MIPlugin.getDefault().createSession( getSessionType( config ), gdbPath.toOSString(), factory, executable, extraArgs, usePty, monitor ); - ICDISessionConfiguration sessionConfig = getSessionConfiguration( session ); - if ( sessionConfig != null ) { - session.setConfiguration( sessionConfig ); - } - } - catch( OperationCanceledException e ) { - } - catch( Exception e ) { - // Catch all wrap them up and rethrow - if ( e instanceof CoreException ) { - throw (CoreException)e; - } - throw newCoreException( e ); - } - return session; - } - - protected int getSessionType( ILaunchConfiguration config ) throws CoreException { - String debugMode = config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN ); - if ( ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN.equals( debugMode ) ) - return MISession.PROGRAM; - if ( ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH.equals( debugMode ) ) - return MISession.ATTACH; - if ( ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE.equals( debugMode ) ) - return MISession.CORE; - throw newCoreException( MIPlugin.getResourceString( "src.AbstractGDBCDIDebugger.0" ) + debugMode, null ); //$NON-NLS-1$ - } - - protected String[] getExtraArguments( ILaunchConfiguration config ) throws CoreException { - return new String[0]; - } - - protected boolean usePty( ILaunchConfiguration config ) throws CoreException { - return config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_USE_TERMINAL, true ); - } - - abstract protected CommandFactory getCommandFactory( ILaunchConfiguration config ) throws CoreException; - - protected void doStartSession( ILaunch launch, Session session, IProgressMonitor monitor ) throws CoreException { - } - - protected String renderDebuggerProcessLabel( ILaunch launch ) { - String format = "{0} ({1})"; //$NON-NLS-1$ - String timestamp = DateFormat.getInstance().format( new Date( System.currentTimeMillis() ) ); - String label = MIPlugin.getResourceString( "src.AbstractGDBCDIDebugger.2" ); //$NON-NLS-1$ - try { - IPath path = getGDBPath( launch ); - label = path.toOSString(); - } - catch( CoreException e ) { - } - return MessageFormat.format( format, new String[]{ label, timestamp } ); - } - - protected IPath getGDBPath(ILaunch launch) throws CoreException { - ILaunchConfiguration config = launch.getLaunchConfiguration(); - String command = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, - IMILaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT); - try { - command = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(command, false); - } catch (Exception e) { - MIPlugin.log(e); - // take value of command as it - } - return new Path(command); - } - - protected ICDISessionConfiguration getSessionConfiguration( ICDISession session ) { - return null; - } - - /** - * Throws a core exception with an error status object built from - * the lower level exception and error code. - * - * @param exception lower level exception associated with the error, - * or <code>null</code> if none - * @param code error code - */ - protected CoreException newCoreException( Throwable exception ) { - String message = MIPlugin.getResourceString( "src.AbstractGDBCDIDebugger.1" ); //$NON-NLS-1$ - return newCoreException( message, exception ); - } - - /** - * 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 lower level exception associated with the error, - * or <code>null</code> if none - * @param code error code - */ - protected CoreException newCoreException( String message, Throwable exception ) { - int code = ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR; - String ID = MIPlugin.getUniqueIdentifier(); - MultiStatus status = new MultiStatus( ID, code, message, exception ); - status.add( new Status( IStatus.ERROR, ID, code, exception == null ? new String() : exception.getLocalizedMessage(), exception ) ); - return new CoreException( status ); - } - - protected IProcess createGDBProcess( Target target, ILaunch launch, Process process, String label, Map attributes ) { - return new GDBProcess( target, launch, process, label, attributes ); - } - - protected boolean verboseMode( ILaunchConfiguration config ) { - boolean result = IMILaunchConfigurationConstants.DEBUGGER_VERBOSE_MODE_DEFAULT; - try { - return config.getAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_VERBOSE_MODE, result ); - } - catch( CoreException e ) { - // use default - } - return result; - } - - protected boolean getBreakpointsWithFullNameAttribute( ILaunchConfiguration config ) { - boolean result = IMILaunchConfigurationConstants.DEBUGGER_FULLPATH_BREAKPOINTS_DEFAULT; - try { - return config.getAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_FULLPATH_BREAKPOINTS, result ); - } - catch( CoreException e ) { - // use default - } - return result; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CygwinMIProcessAdapter.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CygwinMIProcessAdapter.java deleted file mode 100644 index ce05133ff62..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CygwinMIProcessAdapter.java +++ /dev/null @@ -1,105 +0,0 @@ -/********************************************************************** - * Copyright (c) 2007, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - **********************************************************************/ - -package org.eclipse.cdt.debug.mi.core; - -import java.io.IOException; - -import org.eclipse.cdt.utils.spawner.Spawner; -import org.eclipse.core.runtime.IProgressMonitor; - -/** - * @author Doug Schaefer - */ -public class CygwinMIProcessAdapter extends MIProcessAdapter { - - /** - * @param args - * @param launchTimeout - * @param monitor - * @throws IOException - */ - public CygwinMIProcessAdapter(String[] args, int launchTimeout, - IProgressMonitor monitor) throws IOException { - super(args, launchTimeout, monitor); - } - - @Override - public void interrupt(MIInferior inferior) { - if (fGDBProcess instanceof Spawner) { - if (inferior.isRunning()) { - boolean interruptedInferior = false; - Spawner gdbSpawner = (Spawner) fGDBProcess; - - // Cygwin gdb 6.8 is capricious when it comes to interrupting - // the target. MinGW and later versions of Cygwin aren't. A - // simple CTRL-C to gdb seems to do the trick in every case. - // Once we drop support for gdb 6.8, we should be able to ditch - // this method and rely on the base implementation - // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=304096#c56 - if (inferior.isRemoteInferior()) { - // Interrupt gdb with a 'kill -SIGINT'. The reason we - // need to send a simulated Cygwin/POSIX SIGINT to - // Cygwin gdb is that it has special handling in the case - // of remote debugging, as explained in the bugzilla - // comment above. That special handling will forward the - // interrupt request through gdbserver to the remote - // inferior, but the interrupt to gdb *must* be a - // simulated Cygwin/POSIX SIGINT; a CTRL-C won't do. - gdbSpawner.interrupt(); - } - else if (inferior.isAttachedInferior()) { - // Cygwin gdb 6.8 has no support for forwarding an - // interrupt request to the local process it has - // attached to. That support has since been added and - // will be available in 7.x. So, the only way to suspend the - // attached-to inferior is to interrupt it directly. - // The following call will take a special path in the - // JNI code. See - // Java_org_eclipse_cdt_utils_spawner_Spawner_raise() - // We don't use the Cygwin 'kill' command since (a) we don't - // know if the process associated with PID (the inferior) is - // a cygwin one (kill only works on cygwin programs), and - // (b) a CTRL-C will work just fine whether it's a cygwin - // program or not - interruptInferior(inferior); - interruptedInferior = true; - } - else { - // The typical case--gdb launches the inferior. - // Interrupt gdb but with a CTRL-C. gdb (6.8) itself - // doesn't have a handler for CTRL-C, but all processes - // in the console - // process group will receive the CTRL-C, and gdb - // registers itself to catch any such events that - // happen in the inferior. Thus it is able to determine - // and report that the inferior has been interrupted. - // But it's important we don't interrupt Cygwin gdb with - // a 'kill' since that will only reach gdb, and gdb - // won't forward the request on to the inferior. See - // bugzilla comment referenced above for details. - gdbSpawner.interruptCTRLC(); - } - - waitForInterrupt(inferior); - - // If we are still running try to interrupt the inferior (unless we - // already tried that above) - if (inferior.isRunning() && inferior.getInferiorPID() > 0 && !interruptedInferior) { - // lets try something else. - interruptInferior(inferior); - } - } - } - - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBCDIDebugger.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBCDIDebugger.java deleted file mode 100644 index 2c630d7cb40..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBCDIDebugger.java +++ /dev/null @@ -1,304 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - * Joanne Woo (jwoo@mvista.com) - bug #118900 - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core; - -import java.io.File; -import com.ibm.icu.text.DateFormat; -import com.ibm.icu.text.MessageFormat; -import java.util.Collections; -import java.util.Date; -import java.util.List; - -import org.eclipse.cdt.core.IBinaryParser.IBinaryObject; -import org.eclipse.cdt.debug.core.ICDIDebugger; -import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.ICDISession; -import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; -import org.eclipse.cdt.debug.mi.core.cdi.Session; -import org.eclipse.cdt.debug.mi.core.cdi.SharedLibraryManager; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.MultiStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.model.IProcess; - -/** - * Implementing cdebugger extension point - */ -public class GDBCDIDebugger implements ICDIDebugger { - - ILaunch fLaunch; - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.ICDIDebugger#createDebuggerSession(org.eclipse.debug.core.ILaunch, org.eclipse.cdt.core.IBinaryParser.IBinaryExecutable, org.eclipse.core.runtime.IProgressMonitor) - */ - @Override - public ICDISession createDebuggerSession(ILaunch launch, IBinaryObject exe, IProgressMonitor monitor) - throws CoreException { - fLaunch = launch; - ILaunchConfiguration config = launch.getLaunchConfiguration(); - Session dsession = null; - String debugMode = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, - ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN); - - if (monitor == null) { - monitor = new NullProgressMonitor(); - } - if (monitor.isCanceled()) { - throw new OperationCanceledException(); - } - - if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN)) { - dsession = createLaunchSession(config, exe, monitor); - } else if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH)) { - dsession = createAttachSession(config, exe, monitor); - } else if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE)) { - dsession = createCoreSession(config, exe, monitor); - } - if (dsession != null) { - ICDITarget[] dtargets = dsession.getTargets(); - for (int i = 0; i < dtargets.length; i++) { - Process debugger = dsession.getSessionProcess(dtargets[i]); - if (debugger != null) { - IProcess debuggerProcess = DebugPlugin.newProcess(launch, debugger, renderDebuggerProcessLabel(config)); - launch.addProcess(debuggerProcess); - } - } - } - - return dsession; - } - - public Session createLaunchSession(ILaunchConfiguration config, IBinaryObject exe, IProgressMonitor monitor) throws CoreException { - Session session = null; - boolean failed = false; - try { - String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb"); //$NON-NLS-1$ - String miVersion = getMIVersion(config); - boolean usePty = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_USE_TERMINAL, true); - File cwd = getProjectPath(config).toFile(); - String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, IMILaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT); - if (usePty) { - session = MIPlugin.getDefault().createCSession(gdb, miVersion, exe.getPath().toFile(), cwd, gdbinit, monitor); - } else { - session = MIPlugin.getDefault().createCSession(gdb, miVersion, exe.getPath().toFile(), cwd, gdbinit, null, monitor); - } - initializeLibraries(config, session); - return session; - } catch (Exception e) { - // Catch all wrap them up and rethrow - failed = true; - if (e instanceof CoreException) { - throw (CoreException)e; - } - throw newCoreException(e); - } finally { - if (failed) { - if (session != null) { - try { - session.terminate(); - } catch (Exception ex) { - // ignore the exception here. - } - } - } - } - } - - public Session createAttachSession(ILaunchConfiguration config, IBinaryObject exe, IProgressMonitor monitor) throws CoreException { - Session session = null; - boolean failed = false; - try { - String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb"); //$NON-NLS-1$ - String miVersion = getMIVersion(config); - int pid = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_ATTACH_PROCESS_ID, -1); - File cwd = getProjectPath(config).toFile(); - String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, IMILaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT); - File exeFile = exe != null ? exe.getPath().toFile() : null; - session = MIPlugin.getDefault().createCSession(gdb, miVersion, exeFile, pid, null, cwd, gdbinit, monitor); - initializeLibraries(config, session); - return session; - } catch (Exception e) { - // Catch all wrap them up and rethrow - failed = true; - if (e instanceof CoreException) { - throw (CoreException)e; - } - throw newCoreException(e); - } finally { - if (failed) { - if (session != null) { - try { - session.terminate(); - } catch (Exception ex) { - // ignore the exception here. - } - } - } - } - } - - public Session createCoreSession(ILaunchConfiguration config, IBinaryObject exe, IProgressMonitor monitor) throws CoreException { - Session session = null; - boolean failed = false; - try { - String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb"); //$NON-NLS-1$ - String miVersion = getMIVersion(config); - File cwd = getProjectPath(config).toFile(); - IPath coreFile = new Path(config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, (String)null)); - String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, IMILaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT); - session = MIPlugin.getDefault().createCSession(gdb, miVersion, exe.getPath().toFile(), coreFile.toFile(), cwd, gdbinit, monitor); - initializeLibraries(config, session); - session.getSharedLibraryManager().update(); - return session; - } catch (Exception e) { - // Catch all wrap them up and rethrow - failed = true; - if (e instanceof CoreException) { - throw (CoreException)e; - } - throw newCoreException(e); - } finally { - if (failed) { - if (session != null) { - try { - session.terminate(); - } catch (Exception ex) { - // ignore the exception here. - } - } - } - } - } - - protected void initializeLibraries(ILaunchConfiguration config, Session session) throws CoreException { - try { - SharedLibraryManager sharedMgr = session.getSharedLibraryManager(); - boolean autolib = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, IMILaunchConfigurationConstants.DEBUGGER_AUTO_SOLIB_DEFAULT); - boolean stopOnSolibEvents = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS, IMILaunchConfigurationConstants.DEBUGGER_STOP_ON_SOLIB_EVENTS_DEFAULT); - List p = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_SOLIB_PATH, Collections.EMPTY_LIST); - ICDITarget[] dtargets = session.getTargets(); - for (int i = 0; i < dtargets.length; ++i) { - Target target = (Target)dtargets[i]; - try { - sharedMgr.setAutoLoadSymbols(target, autolib); - sharedMgr.setStopOnSolibEvents(target, stopOnSolibEvents); - // The idea is that if the user set autolib, by default - // we provide with the capability of deferred breakpoints - // And we set setStopOnSolib events for them(but they should not see those things. - // - // If the user explicitly set stopOnSolibEvents well it probably - // means that they wanted to see those events so do no do deferred breakpoints. - if (autolib && !stopOnSolibEvents) { - sharedMgr.setStopOnSolibEvents(target, true); - sharedMgr.setDeferredBreakpoint(target, true); - } - } catch (CDIException e) { - // Ignore this error - // it seems to be a real problem on many gdb platform - } - if (p.size() > 0) { - String[] oldPaths = sharedMgr.getSharedLibraryPaths(target); - String[] paths = new String[oldPaths.length + p.size()]; - System.arraycopy(p.toArray(new String[p.size()]), 0, paths, 0, p.size()); - System.arraycopy(oldPaths, 0, paths, p.size(), oldPaths.length); - sharedMgr.setSharedLibraryPaths(target, paths); - } - } - } catch (CDIException e) { - throw newCoreException(MIPlugin.getResourceString("src.GDBDebugger.Error_initializing_shared_lib_options") + e.getMessage(), e); //$NON-NLS-1$ - } - } - - public static IPath getProjectPath(ILaunchConfiguration configuration) throws CoreException { - String projectName = getProjectName(configuration); - if (projectName != null) { - projectName = projectName.trim(); - if (projectName.length() > 0) { - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); - IPath p = project.getLocation(); - if (p != null) { - return p; - } - } - } - return Path.EMPTY; - } - - public static String getProjectName(ILaunchConfiguration configuration) throws CoreException { - return configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String)null); - } - - protected ILaunch getLauch() { - return fLaunch; - } - - protected String renderDebuggerProcessLabel(ILaunchConfiguration config) { - String format = "{0} ({1})"; //$NON-NLS-1$ - String timestamp = DateFormat.getInstance().format(new Date(System.currentTimeMillis())); - String label = MIPlugin.getResourceString("src.GDBDebugger.Debugger_process"); //$NON-NLS-1$ - try { - label = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb"); //$NON-NLS-1$ - } - catch( CoreException e ) { - } - return MessageFormat.format(format, new String[]{label, timestamp}); - } - - /** - * 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 - * lower level exception associated with the error, or - * <code>null</code> if none - * @param code - * error code - */ - protected CoreException newCoreException(Throwable exception) { - String message = MIPlugin.getResourceString("src.GDBDebugger.Error_creating_session") + exception.getMessage();//$NON-NLS-1$ - int code = ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR; - String ID = MIPlugin.getUniqueIdentifier(); - String exMessage = ((exception==null)||(exception.getLocalizedMessage()==null)) ? new String() : exception.getLocalizedMessage(); - MultiStatus status = new MultiStatus(ID, code, message, exception); - status.add(new Status(IStatus.ERROR, ID, code, exMessage, exception)); - return new CoreException(status); - } - - protected CoreException newCoreException(String message, Throwable exception) { - int code = ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR; - String ID = MIPlugin.getUniqueIdentifier(); - String exMessage = ((exception==null)||(exception.getLocalizedMessage()==null)) ? new String() : exception.getLocalizedMessage(); - MultiStatus status = new MultiStatus(ID, code, message, exception); - status.add(new Status(IStatus.ERROR, ID, code, exMessage, exception)); - return new CoreException(status); - } - - protected String getMIVersion( ILaunchConfiguration config ) { - return MIPlugin.getMIVersion( config ); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBCDIDebugger2.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBCDIDebugger2.java deleted file mode 100644 index 461154a418d..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBCDIDebugger2.java +++ /dev/null @@ -1,289 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core; - -import java.io.File; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; -import org.eclipse.cdt.debug.mi.core.cdi.CdiResources; -import org.eclipse.cdt.debug.mi.core.cdi.Session; -import org.eclipse.cdt.debug.mi.core.cdi.SharedLibraryManager; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; -import org.eclipse.cdt.debug.mi.core.command.CLITargetAttach; -import org.eclipse.cdt.debug.mi.core.command.CommandFactory; -import org.eclipse.cdt.debug.mi.core.command.MIGDBSet; -import org.eclipse.cdt.debug.mi.core.command.MIGDBSetNewConsole; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.variables.VariablesPlugin; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchConfiguration; - -import com.ibm.icu.text.MessageFormat; - -/** - * Implementing the cdebugger extension point for basic launch configurations. - */ -public class GDBCDIDebugger2 extends AbstractGDBCDIDebugger { - - @Override - protected String[] getExtraArguments( ILaunchConfiguration config ) throws CoreException { - String debugMode = config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN ); - if ( ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN.equals( debugMode ) ) - return getRunArguments( config ); - if ( ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH.equals( debugMode ) ) - return getAttachArguments( config ); - if ( ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE.equals( debugMode ) ) - return getCoreArguments( config ); - return new String[0]; - } - - protected String[] getRunArguments( ILaunchConfiguration config ) throws CoreException { - return new String[]{ getWorkingDirectory( config ), getCommandFile( config ) }; - } - - protected String[] getAttachArguments( ILaunchConfiguration config ) throws CoreException { - return new String[]{ getWorkingDirectory( config ), getCommandFile( config ) }; - } - - protected String[] getCoreArguments( ILaunchConfiguration config ) throws CoreException { - IPath coreFile = new Path( config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, (String)null ) ); - return new String[]{ getWorkingDirectory( config ), getCommandFile( config ), "-c", coreFile.toFile().getAbsolutePath() }; //$NON-NLS-1$ - } - - @Override - protected CommandFactory getCommandFactory( ILaunchConfiguration config ) throws CoreException { - String factoryID = MIPlugin.getCommandFactory( config ); - CommandFactory factory = MIPlugin.getDefault().getCommandFactoryManager().getCommandFactory( factoryID ); - String miVersion = getMIVersion( config ); - if ( factory != null ) { - factory.setMIVersion( miVersion ); - } - return ( factory != null ) ? factory : new CommandFactory( miVersion ); - } - - public static IPath getProjectPath( ILaunchConfiguration configuration ) throws CoreException { - String projectName = getProjectName( configuration ); - if ( projectName != null ) { - projectName = projectName.trim(); - if ( projectName.length() > 0 ) { - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject( projectName ); - IPath p = project.getLocation(); - if ( p != null ) { - return p; - } - } - } - return Path.EMPTY; - } - - public static String getProjectName( ILaunchConfiguration configuration ) throws CoreException { - return configuration.getAttribute( ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String)null ); - } - - protected String getMIVersion( ILaunchConfiguration config ) { - return MIPlugin.getMIVersion( config ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.core.AbstractGDBCDIDebugger#doStartSession(org.eclipse.debug.core.ILaunch, org.eclipse.cdt.debug.mi.core.cdi.Session, org.eclipse.core.runtime.IProgressMonitor) - */ - @Override - protected void doStartSession( ILaunch launch, Session session, IProgressMonitor monitor ) throws CoreException { - ILaunchConfiguration config = launch.getLaunchConfiguration(); - setAsyncMode( config, session ); - initializeLibraries( config, session ); - if ( monitor.isCanceled() ) { - throw new OperationCanceledException(); - } - String debugMode = config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN ); - if ( ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN.equals( debugMode ) ) - startLocalGDBSession( config, session, monitor ); - if ( ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH.equals( debugMode ) ) - startAttachGDBSession( config, session, monitor ); - if ( ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE.equals( debugMode ) ) - startCoreGDBSession( config, session, monitor ); - } - - protected void startLocalGDBSession( ILaunchConfiguration config, Session session, IProgressMonitor monitor ) throws CoreException { - // TODO: need a better solution for new-console - MISession miSession = getMISession( session ); - try { - CommandFactory factory = miSession.getCommandFactory(); - MIGDBSetNewConsole newConsole = factory.createMIGDBSetNewConsole(); - miSession.postCommand( newConsole ); - MIInfo info = newConsole.getMIInfo(); - if ( info == null ) { - throw new MIException( MIPlugin.getResourceString( "src.common.No_answer" ) ); //$NON-NLS-1$ - } - } - catch( MIException e ) { - // We ignore this exception, for example - // on GNU/Linux the new-console is an error. - } - } - - protected void startAttachGDBSession( ILaunchConfiguration config, Session session, IProgressMonitor monitor ) throws CoreException { - MISession miSession = getMISession( session ); - CommandFactory factory = miSession.getCommandFactory(); - int pid = -1; - try { - pid = config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_ATTACH_PROCESS_ID, -1 ); - } - catch( CoreException e ) { - throw newCoreException( MIPlugin.getResourceString( "src.GDBCDIDebugger2.0" ), e ); //$NON-NLS-1$ - } - if ( pid <= 0 ) { - throw newCoreException( MIPlugin.getResourceString( "src.GDBCDIDebugger2.1" ), null ); //$NON-NLS-1$ - } - try { - CLITargetAttach attach = factory.createCLITargetAttach( pid ); - miSession.postCommand( attach ); - MIInfo info = attach.getMIInfo(); - if ( info == null ) { - throw new MIException( MIPlugin.getResourceString( "src.common.No_answer" ) ); //$NON-NLS-1$ - } - miSession.getMIInferior().setInferiorPID( pid ); - // @@@ for attach we nee to manually set the connected state - // attach does not send the ^connected ack - miSession.getMIInferior().setConnected(); - } - catch( MIException e ) { - throw newCoreException( MessageFormat.format( MIPlugin.getResourceString( "src.GDBCDIDebugger2.2" ), new Integer[] { new Integer( pid ) } ), e ); //$NON-NLS-1$ - } - // @@@ We have to set the suspended state manually - miSession.getMIInferior().setSuspended(); - miSession.getMIInferior().update(); - } - - protected void startCoreGDBSession( ILaunchConfiguration config, Session session, IProgressMonitor monitor ) throws CoreException { - getMISession( session ).getMIInferior().setSuspended(); - try { - session.getSharedLibraryManager().update(); - } - catch( CDIException e ) { - throw newCoreException( e ); - } - } - - protected MISession getMISession( Session session ) { - ICDITarget[] targets = session.getTargets(); - if ( targets.length == 0 || !(targets[0] instanceof Target) ) - return null; - return ((Target)targets[0]).getMISession(); - } - - protected void initializeLibraries( ILaunchConfiguration config, Session session ) throws CoreException { - try { - SharedLibraryManager sharedMgr = session.getSharedLibraryManager(); - boolean autolib = config.getAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, IMILaunchConfigurationConstants.DEBUGGER_AUTO_SOLIB_DEFAULT ); - boolean stopOnSolibEvents = config.getAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS, IMILaunchConfigurationConstants.DEBUGGER_STOP_ON_SOLIB_EVENTS_DEFAULT ); - List p = config.getAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_SOLIB_PATH, Collections.EMPTY_LIST ); - ICDITarget[] dtargets = session.getTargets(); - for( int i = 0; i < dtargets.length; ++i ) { - Target target = (Target)dtargets[i]; - try { - sharedMgr.setAutoLoadSymbols( target, autolib ); - sharedMgr.setStopOnSolibEvents( target, stopOnSolibEvents ); - sharedMgr.setDeferredBreakpoint( target, false ); - // The idea is that if the user set autolib, by default - // we provide with the capability of deferred breakpoints - // And we set setStopOnSolib events for them(but they should not see those things. - // - // If the user explicitly set stopOnSolibEvents well it probably - // means that they wanted to see those events so do no do deferred breakpoints. - if ( autolib && !stopOnSolibEvents ) { - sharedMgr.setStopOnSolibEvents( target, true ); - sharedMgr.setDeferredBreakpoint( target, true ); - } - } - catch( CDIException e ) { - // Ignore this error - // it seems to be a real problem on many gdb platform - } - if ( p.size() > 0 ) { - String[] oldPaths = sharedMgr.getSharedLibraryPaths( target ); - String[] paths = new String[oldPaths.length + p.size()]; - System.arraycopy( p.toArray( new String[p.size()] ), 0, paths, 0, p.size() ); - System.arraycopy( oldPaths, 0, paths, p.size(), oldPaths.length ); - sharedMgr.setSharedLibraryPaths( target, paths ); - } - // use file names instead of full paths - File[] autoSolibs = MICoreUtils.getAutoSolibs( config ); - ArrayList libs = new ArrayList( autoSolibs.length ); - for ( int j = 0; j < autoSolibs.length; ++j ) - libs.add( new File( autoSolibs[j].getName() ) ); - sharedMgr.autoLoadSymbols( (File[])libs.toArray( new File[libs.size()] ) ); - if ( !autolib && !stopOnSolibEvents ) - sharedMgr.setDeferredBreakpoint( target, libs.size() > 0 ); - } - } - catch( CDIException e ) { - throw newCoreException( MIPlugin.getResourceString( "src.GDBDebugger.Error_initializing_shared_lib_options" ) + e.getMessage(), e ); //$NON-NLS-1$ - } - } - - protected String getWorkingDirectory( ILaunchConfiguration config ) throws CoreException { - IPath path = null; - String location = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, (String)null); - - if (location != null) { - String expandedLocation = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(location); - if (expandedLocation.length() > 0) { - path = new Path(expandedLocation); - } - } - - if(path == null){ - path = getProjectPath( config ); - } - - CommandFactory factory = getCommandFactory( config ); - return factory.getWorkingDirectory(path.toFile()); - } - - protected String getCommandFile( ILaunchConfiguration config ) throws CoreException { - String gdbinit = config.getAttribute( IMILaunchConfigurationConstants.ATTR_GDB_INIT, IMILaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT ); - return (gdbinit != null && gdbinit.length() > 0) ? "--command=" + gdbinit : "--nx"; //$NON-NLS-1$ //$NON-NLS-2$ - } - - private void setAsyncMode( ILaunchConfiguration config, Session session ) throws CoreException { - ICDITarget[] dtargets = session.getTargets(); - for( int i = 0; i < dtargets.length; ++i ) { - MISession miSession = ((Target)dtargets[i]).getMISession(); - try { - MIGDBSet setAsyncMode = miSession.getCommandFactory().createMIGDBSet( - new String[] { - "target-async", //$NON-NLS-1$ - "0" //$NON-NLS-1$ - } ); - miSession.postCommand( setAsyncMode ); - MIInfo info = setAsyncMode.getMIInfo(); - if (info == null) { - throw newCoreException(new CDIException(CdiResources.getString( "cdi.Common.No_answer"))); //$NON-NLS-1$ - } - } catch (MIException e) { - // Earlier versions of GDB don't support "target-async". - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBDebugger.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBDebugger.java deleted file mode 100644 index eb3cc15d84c..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBDebugger.java +++ /dev/null @@ -1,174 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core; - -import java.io.File; -import java.io.IOException; -import java.util.Collections; -import java.util.List; - -import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; -import org.eclipse.cdt.debug.core.ICDebugger; -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.ICDISession; -import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; -import org.eclipse.cdt.debug.mi.core.cdi.Session; -import org.eclipse.cdt.debug.mi.core.cdi.SharedLibraryManager; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.debug.core.ILaunchConfiguration; - -public class GDBDebugger implements ICDebugger { - - protected void initializeLibraries(ILaunchConfiguration config, Session session) throws CDIException { - try { - SharedLibraryManager mgr = session.getSharedLibraryManager(); - boolean autolib = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, IMILaunchConfigurationConstants.DEBUGGER_AUTO_SOLIB_DEFAULT); - boolean stopOnSolibEvents = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS, IMILaunchConfigurationConstants.DEBUGGER_STOP_ON_SOLIB_EVENTS_DEFAULT); - List p = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_SOLIB_PATH, Collections.EMPTY_LIST); - ICDITarget[] dtargets = session.getTargets(); - for (int i = 0; i < dtargets.length; ++i) { - Target target = (Target)dtargets[i]; - try { - mgr.setAutoLoadSymbols(target, autolib); - mgr.setStopOnSolibEvents(target, stopOnSolibEvents); - // The idea is that if the user set autolib, by default - // we provide with the capability of deferred breakpoints - // And we set setStopOnSolib events for them(but they should not see those things. - // - // If the user explicitly set stopOnSolibEvents well it probably - // means that they wanted to see those events so do no do deferred breakpoints. - if (autolib && !stopOnSolibEvents) { - mgr.setStopOnSolibEvents(target, true); - mgr.setDeferredBreakpoint(target, true); - } - } catch (CDIException e) { - // Ignore this error - // it seems to be a real problem on many gdb platform - } - if (p.size() > 0) { - String[] oldPaths = mgr.getSharedLibraryPaths(target); - String[] paths = new String[oldPaths.length + p.size()]; - System.arraycopy(p.toArray(new String[p.size()]), 0, paths, 0, p.size()); - System.arraycopy(oldPaths, 0, paths, p.size(), oldPaths.length); - mgr.setSharedLibraryPaths(target, paths); - } - } - } catch (CoreException e) { - throw new CDIException(MIPlugin.getResourceString("src.GDBDebugger.Error_initializing_shared_lib_options") + e.getMessage()); //$NON-NLS-1$ - } - } - - @Override - public ICDISession createLaunchSession(ILaunchConfiguration config, IFile exe) throws CDIException { - Session session = null; - boolean failed = false; - try { - String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb"); //$NON-NLS-1$ - String miVersion = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, "mi"); //$NON-NLS-1$ - File cwd = exe.getProject().getLocation().toFile(); - String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, IMILaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT); - session = MIPlugin.getDefault().createCSession(gdb, miVersion, exe.getLocation().toFile(), cwd, gdbinit, null); - initializeLibraries(config, session); - return session; - } catch (IOException e) { - failed = true; - throw new CDIException(MIPlugin.getResourceString("src.GDBDebugger.Error_creating_session") + e.getMessage()); //$NON-NLS-1$ - } catch (MIException e) { - failed = true; - throw new CDIException(MIPlugin.getResourceString("src.GDBDebugger.Error_creating_session") + e.getMessage()); //$NON-NLS-1$ - } catch (CoreException e) { - failed = true; - throw new CDIException(MIPlugin.getResourceString("src.GDBDebugger.Error_creating_session") + e.getMessage()); //$NON-NLS-1$ - } finally { - if (failed) { - if (session != null) { - try { - session.terminate(); - } catch (Exception ex) { - // ignore the exception here. - } - } - } - } - } - - @Override - public ICDISession createAttachSession(ILaunchConfiguration config, IFile exe, int pid) throws CDIException { - Session session = null; - boolean failed = false; - try { - String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb"); //$NON-NLS-1$ - String miVersion = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, "mi"); //$NON-NLS-1$ - File cwd = exe.getProject().getLocation().toFile(); - String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, IMILaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT); - session = MIPlugin.getDefault().createCSession(gdb, miVersion, exe.getLocation().toFile(), pid, null, cwd, gdbinit, null); - initializeLibraries(config, session); - return session; - } catch (IOException e) { - failed = true; - throw new CDIException(MIPlugin.getResourceString("src.GDBDebugger.Error_creating_session") + e.getMessage()); //$NON-NLS-1$ - } catch (MIException e) { - failed = true; - throw new CDIException(MIPlugin.getResourceString("src.GDBDebugger.Error_creating_session") + e.getMessage()); //$NON-NLS-1$ - } catch (CoreException e) { - failed = true; - throw new CDIException(MIPlugin.getResourceString("src.GDBDebugger.Error_creating_session") + e.getMessage()); //$NON-NLS-1$ - } finally { - if (failed) { - if (session != null) { - try { - session.terminate(); - } catch (Exception ex) { - // ignore the exception here. - } - } - } - } - } - - @Override - public ICDISession createCoreSession(ILaunchConfiguration config, IFile exe, IPath corefile) throws CDIException { - Session session = null; - boolean failed = false; - try { - String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb"); //$NON-NLS-1$ - String miVersion = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, "mi"); //$NON-NLS-1$ - File cwd = exe.getProject().getLocation().toFile(); - String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, IMILaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT); - session = MIPlugin.getDefault().createCSession(gdb, miVersion, exe.getLocation().toFile(), corefile.toFile(), cwd, gdbinit, null); - initializeLibraries(config, session); - return session; - } catch (IOException e) { - failed = true; - throw new CDIException(MIPlugin.getResourceString("src.GDBDebugger.Error_creating_session") + e.getMessage()); //$NON-NLS-1$ - } catch (MIException e) { - failed = true; - throw new CDIException(MIPlugin.getResourceString("src.GDBDebugger.Error_creating_session") + e.getMessage()); //$NON-NLS-1$ - } catch (CoreException e) { - failed = true; - throw new CDIException(MIPlugin.getResourceString("src.GDBDebugger.Error_creating_session") + e.getMessage()); //$NON-NLS-1$ - } finally { - if (failed) { - if (session != null) { - try { - session.terminate(); - } catch (Exception ex) { - // ignore the exception here. - } - } - } - } - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBProcess.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBProcess.java deleted file mode 100644 index c2af3523625..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBProcess.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - * Alena Laskavaia (QNX) - Fix for 186172 - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core; - -import java.util.Map; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.model.RuntimeProcess; - -public class GDBProcess extends RuntimeProcess { - - // volatile because the field may be accessed concurrently during construction - private volatile Target fTarget; - - public GDBProcess(Target target, ILaunch launch, Process process, String name, Map attributes) { - super( launch, process, name, attributes ); - fTarget = target; - fireChangeEvent(); - } - - public Target getTarget() { - return fTarget; - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBServerCDIDebugger.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBServerCDIDebugger.java deleted file mode 100644 index 2de2f33adcf..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBServerCDIDebugger.java +++ /dev/null @@ -1,123 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core; - -import java.io.File; -import org.eclipse.cdt.core.IBinaryParser.IBinaryObject; -import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; -import org.eclipse.cdt.debug.mi.core.cdi.Session; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; -import org.eclipse.cdt.debug.mi.core.command.CommandFactory; -import org.eclipse.cdt.debug.mi.core.command.MIGDBSet; -import org.eclipse.cdt.debug.mi.core.command.MITargetSelect; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Preferences; -import org.eclipse.debug.core.ILaunchConfiguration; - -/** - * Implementing cdebugger extension point - */ -public class GDBServerCDIDebugger extends GDBCDIDebugger { - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.core.GDBCDIDebugger#createLaunchSession(org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.cdt.core.IBinaryParser.IBinaryExecutable, org.eclipse.core.runtime.IProgressMonitor) - */ - @Override - public Session createLaunchSession(ILaunchConfiguration config, IBinaryObject exe, IProgressMonitor monitor) - throws CoreException { - Session session = null; - boolean failed = false; - try { - String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb"); //$NON-NLS-1$ - String miVersion = getMIVersion(config); - File cwd = getProjectPath(config).toFile(); - String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, IMILaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT); - if (config.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_REMOTE_TCP, false)) { - String remote = config.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_HOST, "invalid"); //$NON-NLS-1$ - remote += ":"; //$NON-NLS-1$ - remote += config.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_PORT, "invalid"); //$NON-NLS-1$ - String[] args = new String[] {"remote", remote}; //$NON-NLS-1$ - session = MIPlugin.getDefault().createCSession(gdb, miVersion, exe.getPath().toFile(), 0, args, cwd, gdbinit, monitor); - } else { - MIPlugin plugin = MIPlugin.getDefault(); - Preferences prefs = plugin.getPluginPreferences(); - int launchTimeout = prefs.getInt(IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT); - - String remote = config.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_DEV, "invalid"); //$NON-NLS-1$ - String remoteBaud = config.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_DEV_SPEED, "invalid"); //$NON-NLS-1$ - session = MIPlugin.getDefault().createCSession(gdb, miVersion, exe.getPath().toFile(), -1, null, cwd, gdbinit, monitor); - ICDITarget[] targets = session.getTargets(); - for (int i = 0; i < targets.length; ++i) { - Target target = (Target)targets[i]; - MISession miSession = target.getMISession(); - CommandFactory factory = miSession.getCommandFactory(); - MIGDBSet setRemoteBaud = factory.createMIGDBSet(new String[]{"remotebaud", remoteBaud}); //$NON-NLS-1$ - // Set serial line parameters - miSession.postCommand(setRemoteBaud, launchTimeout); - MIInfo info = setRemoteBaud.getMIInfo(); - if (info == null) { - throw new MIException (MIPlugin.getResourceString("src.GDBServerDebugger.Can_not_set_Baud")); //$NON-NLS-1$ - } - MITargetSelect select = factory.createMITargetSelect(new String[] {"remote", remote}); //$NON-NLS-1$ - miSession.postCommand(select, launchTimeout); - select.getMIInfo(); - if (info == null) { - throw new MIException (MIPlugin.getResourceString("src.common.No_answer")); //$NON-NLS-1$ - } - } - } - initializeLibraries(config, session); - return session; - } catch (Exception e) { - // Catch all wrap them up and rethrow - failed = true; - if (e instanceof CoreException) { - throw (CoreException)e; - } - throw newCoreException(e); - } finally { - if (failed) { - if (session != null) { - try { - session.terminate(); - } catch (Exception ex) { - // ignore the exception here. - } - } - } - } - - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.core.GDBCDIDebugger#createAttachSession(org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.cdt.core.IBinaryParser.IBinaryExecutable, org.eclipse.core.runtime.IProgressMonitor) - */ - @Override - public Session createAttachSession(ILaunchConfiguration config, IBinaryObject exe, IProgressMonitor monitor) - throws CoreException { - String msg = MIPlugin.getResourceString("src.GDBServerDebugger.GDBServer_attaching_unsupported"); //$NON-NLS-1$ - throw newCoreException(msg, null); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.core.GDBCDIDebugger#createCoreSession(org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.cdt.core.IBinaryParser.IBinaryExecutable, org.eclipse.core.runtime.IProgressMonitor) - */ - @Override - public Session createCoreSession(ILaunchConfiguration config, IBinaryObject exe, IProgressMonitor monitor) - throws CoreException { - String msg = MIPlugin.getResourceString("src.GDBServerDebugger.GDBServer_corefiles_unsupported"); //$NON-NLS-1$ - throw newCoreException(msg, null); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBServerCDIDebugger2.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBServerCDIDebugger2.java deleted file mode 100644 index c5d5608a602..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBServerCDIDebugger2.java +++ /dev/null @@ -1,161 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core; - -import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; -import org.eclipse.cdt.debug.mi.core.cdi.CdiResources; -import org.eclipse.cdt.debug.mi.core.cdi.Session; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; -import org.eclipse.cdt.debug.mi.core.command.CommandFactory; -import org.eclipse.cdt.debug.mi.core.command.MIGDBSet; -import org.eclipse.cdt.debug.mi.core.command.MITargetSelect; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchConfiguration; - -/** - * Implementing the cdebugger extension point for gdbserver. - */ -public class GDBServerCDIDebugger2 extends GDBCDIDebugger2 { - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.core.GDBCDIDebugger2#doStartSession(org.eclipse.debug.core.ILaunch, org.eclipse.cdt.debug.mi.core.cdi.Session, org.eclipse.core.runtime.IProgressMonitor) - */ - @Override - protected void doStartSession( ILaunch launch, Session session, IProgressMonitor monitor ) throws CoreException { - ILaunchConfiguration config = launch.getLaunchConfiguration(); - setAsyncMode( config, session ); - initializeLibraries( config, session ); - if ( monitor.isCanceled() ) { - throw new OperationCanceledException(); - } - String debugMode = config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN ); - if ( ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN.equals( debugMode ) ) - startGDBServerSession( config, session, monitor ); - if ( ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH.equals( debugMode ) ) { - String msg = MIPlugin.getResourceString( "src.GDBServerDebugger.GDBServer_attaching_unsupported" ); //$NON-NLS-1$ - throw newCoreException( msg, null ); - } - if ( ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE.equals( debugMode ) ) { - String msg = MIPlugin.getResourceString( "src.GDBServerDebugger.GDBServer_corefiles_unsupported" ); //$NON-NLS-1$ - throw newCoreException( msg, null ); - } - } - - protected void startGDBServerSession( ILaunchConfiguration config, Session session, IProgressMonitor monitor ) throws CoreException { - if ( monitor.isCanceled() ) { - throw new OperationCanceledException(); - } - ICDITarget[] targets = session.getTargets(); - int launchTimeout = MIPlugin.getLaunchTimeout(); - boolean tcpConnection = config.getAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_REMOTE_TCP, false ); - // Set serial line parameters - if ( !tcpConnection ) { - String remoteBaud = config.getAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_DEV_SPEED, "invalid" ); //$NON-NLS-1$ - for( int i = 0; i < targets.length; ++i ) { - if ( monitor.isCanceled() ) { - throw new OperationCanceledException(); - } - Target target = (Target)targets[i]; - MISession miSession = target.getMISession(); - CommandFactory factory = miSession.getCommandFactory(); - MIGDBSet setRemoteBaud = factory.createMIGDBSet( new String[]{ "remotebaud", remoteBaud } ); //$NON-NLS-1$ - // Set serial line parameters - MIInfo info = null; - MIException ex = null; - try { - // shouldn't we use the command timeout instead? - miSession.postCommand( setRemoteBaud, launchTimeout ); - info = setRemoteBaud.getMIInfo(); - } - catch( MIException e ) { - ex = e; - } - if ( info == null ) { - throw newCoreException( MIPlugin.getResourceString( "src.GDBServerDebugger.Can_not_set_Baud" ), ex ); //$NON-NLS-1$ - } - } - } - for( int i = 0; i < targets.length; ++i ) { - if ( monitor.isCanceled() ) { - throw new OperationCanceledException(); - } - Target target = (Target)targets[i]; - MISession miSession = target.getMISession(); - CommandFactory factory = miSession.getCommandFactory(); - String[] targetParams = getTargetParams( config, tcpConnection ); - MITargetSelect select = factory.createMITargetSelect( targetParams ); - MIInfo info = null; - MIException ex = null; - try { - miSession.postCommand( select, launchTimeout ); - info = select.getMIInfo(); - } - catch( MIException e ) { - ex = e; - } - if ( info == null ) { - throw newCoreException( MIPlugin.getResourceString( "src.GDBServerCDIDebugger.target_selection_failed" ), ex ); //$NON-NLS-1$ - } - // @@@ We have to set the suspended state manually - miSession.getMIInferior().setSuspended(); - miSession.getMIInferior().update(); - miSession.getMIInferior().setIsRemoteInferior(true); - } - } - - protected String[] getTargetParams( ILaunchConfiguration config, boolean tcpConnection ) throws CoreException { - String remote = null; - if ( tcpConnection ) { - remote = config.getAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_HOST, "invalid" ); //$NON-NLS-1$ - remote += ":"; //$NON-NLS-1$ - remote += config.getAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_PORT, "invalid" ); //$NON-NLS-1$ - } - else { - remote = config.getAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_DEV, "invalid" ); //$NON-NLS-1$ - } - return new String[]{ "remote", remote }; //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.core.AbstractGDBCDIDebugger#usePty(org.eclipse.debug.core.ILaunchConfiguration) - */ - @Override - protected boolean usePty( ILaunchConfiguration config ) throws CoreException { - return false; - } - - private void setAsyncMode( ILaunchConfiguration config, Session session ) throws CoreException { - ICDITarget[] dtargets = session.getTargets(); - for( int i = 0; i < dtargets.length; ++i ) { - MISession miSession = ((Target)dtargets[i]).getMISession(); - try { - MIGDBSet setAsyncMode = miSession.getCommandFactory().createMIGDBSet( - new String[] { - "target-async", //$NON-NLS-1$ - "0" //$NON-NLS-1$ - } ); - miSession.postCommand( setAsyncMode ); - MIInfo info = setAsyncMode.getMIInfo(); - if (info == null) { - throw newCoreException(new CDIException(CdiResources.getString( "cdi.Common.No_answer"))); //$NON-NLS-1$ - } - } catch (MIException e) { - // Earlier versions of GDB don't support "target-async". - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBServerDebugger.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBServerDebugger.java deleted file mode 100644 index 3cc9857978a..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBServerDebugger.java +++ /dev/null @@ -1,138 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Monta Vista - initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; -import org.eclipse.cdt.debug.core.ICDebugger; -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.ICDISession; -import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; -import org.eclipse.cdt.debug.mi.core.cdi.Session; -import org.eclipse.cdt.debug.mi.core.cdi.SharedLibraryManager; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; -import org.eclipse.cdt.debug.mi.core.command.CommandFactory; -import org.eclipse.cdt.debug.mi.core.command.MIGDBSet; -import org.eclipse.cdt.debug.mi.core.command.MITargetSelect; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Preferences; -import org.eclipse.debug.core.ILaunchConfiguration; - -public class GDBServerDebugger implements ICDebugger { - - void initializeLibraries(ILaunchConfiguration config, Session session) throws CDIException { - try { - SharedLibraryManager mgr = session.getSharedLibraryManager(); - boolean autolib = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, IMILaunchConfigurationConstants.DEBUGGER_AUTO_SOLIB_DEFAULT); - List p = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_SOLIB_PATH, new ArrayList(1)); - ICDITarget[] dtargets = session.getTargets(); - for (int i = 0; i < dtargets.length; ++i) { - Target target = (Target)dtargets[i]; - try { - mgr.setAutoLoadSymbols(target, autolib); - } catch (CDIException e) { - // ignore this one, cause problems for many gdb. - } - if (p.size() > 0) { - String[] paths = (String[])p.toArray(new String[0]); - mgr.setSharedLibraryPaths(target, paths); - } - } - } catch (CoreException e) { - throw new CDIException(MIPlugin.getResourceString("src.GDBServerDebugger.Error_initializing") + e.getMessage()); //$NON-NLS-1$ - } - } - - @Override - public ICDISession createLaunchSession(ILaunchConfiguration config, IFile exe) throws CDIException { - Session session = null; - boolean failed = false; - try { - String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb"); //$NON-NLS-1$ - String miVersion = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, "mi"); //$NON-NLS-1$ - File cwd = exe.getProject().getLocation().toFile(); - String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, IMILaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT); - if (config.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_REMOTE_TCP, false)) { - String remote = config.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_HOST, "invalid"); //$NON-NLS-1$ - remote += ":"; //$NON-NLS-1$ - remote += config.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_PORT, "invalid"); //$NON-NLS-1$ - String[] args = new String[] {"remote", remote}; //$NON-NLS-1$ - session = MIPlugin.getDefault().createCSession(gdb, miVersion, exe.getLocation().toFile(), 0, args, cwd, gdbinit, null); - } else { - MIPlugin plugin = MIPlugin.getDefault(); - Preferences prefs = plugin.getPluginPreferences(); - int launchTimeout = prefs.getInt(IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT); - - String remote = config.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_DEV, "invalid"); //$NON-NLS-1$ - String remoteBaud = config.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_DEV_SPEED, "invalid"); //$NON-NLS-1$ - session = MIPlugin.getDefault().createCSession(gdb, miVersion, exe.getLocation().toFile(), -1, null, cwd, gdbinit, null); - ICDITarget[] targets = session.getTargets(); - for (int i = 0; i < targets.length; ++i) { - Target target = (Target)targets[i]; - MISession miSession = target.getMISession(); - CommandFactory factory = miSession.getCommandFactory(); - MIGDBSet setRemoteBaud = factory.createMIGDBSet(new String[]{"remotebaud", remoteBaud}); //$NON-NLS-1$ - // Set serial line parameters - miSession.postCommand(setRemoteBaud, launchTimeout); - MIInfo info = setRemoteBaud.getMIInfo(); - if (info == null) { - throw new MIException (MIPlugin.getResourceString("src.GDBServerDebugger.Can_not_set_Baud")); //$NON-NLS-1$ - } - MITargetSelect select = factory.createMITargetSelect(new String[] {"remote", remote}); //$NON-NLS-1$ - miSession.postCommand(select, launchTimeout); - select.getMIInfo(); - if (info == null) { - throw new MIException (MIPlugin.getResourceString("src.common.No_answer")); //$NON-NLS-1$ - } - } - } - initializeLibraries(config, session); - return session; - } catch (IOException e) { - failed = true; - throw new CDIException(MIPlugin.getResourceString("src.GDBServerDebugger.Error_initializing") + e.getMessage()); //$NON-NLS-1$ - } catch (MIException e) { - failed = true; - throw new CDIException(MIPlugin.getResourceString("src.GDBServerDebugger.Error_initializing") + e.getMessage()); //$NON-NLS-1$ - } catch (CoreException e) { - failed = true; - throw new CDIException(MIPlugin.getResourceString("src.GDBServerDebugger.Error_initializing") + e.getMessage()); //$NON-NLS-1$ - } finally { - if (failed) { - if (session != null) { - try { - session.terminate(); - } catch (Exception ex) { - // ignore the exception here. - } - } - } - } - } - - @Override - public ICDISession createAttachSession(ILaunchConfiguration config, IFile exe, int pid) throws CDIException { - throw new CDIException(MIPlugin.getResourceString("src.GDBServerDebugger.GDBServer_attaching_unsupported")); //$NON-NLS-1$ - } - - @Override - public ICDISession createCoreSession(ILaunchConfiguration config, IFile exe, IPath corefile) throws CDIException { - throw new CDIException(MIPlugin.getResourceString("src.GDBServerDebugger.GDBServer_corefiles_unsupported")); //$NON-NLS-1$ - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/IGDBServerMILaunchConfigurationConstants.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/IGDBServerMILaunchConfigurationConstants.java deleted file mode 100644 index 8aaa289fa4e..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/IGDBServerMILaunchConfigurationConstants.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Monta Vista - initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core; - - -public interface IGDBServerMILaunchConfigurationConstants extends IMILaunchConfigurationConstants { - - /** - * Launch configuration attribute key. The "remote target xxx" value. - */ - public static final String ATTR_REMOTE_TCP = MIPlugin.getUniqueIdentifier() + ".REMOTE_TCP"; //$NON-NLS-1$ - public static final String ATTR_HOST = MIPlugin.getUniqueIdentifier() + ".HOST"; //$NON-NLS-1$ - public static final String ATTR_PORT = MIPlugin.getUniqueIdentifier() + ".PORT"; //$NON-NLS-1$ - public static final String ATTR_DEV = MIPlugin.getUniqueIdentifier() + ".DEV"; //$NON-NLS-1$ - public static final String ATTR_DEV_SPEED = MIPlugin.getUniqueIdentifier() + ".DEV_SPEED"; //$NON-NLS-1$ -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/IMIConstants.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/IMIConstants.java deleted file mode 100644 index 88c95ef14d8..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/IMIConstants.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2010 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core; - -/** - * - * Constant definitions for GDB MI plug-in. - * - * @since Oct 4, 2002 - */ -public interface IMIConstants -{ - /** - * MI plug-in identifier (value <code>"org.eclipse.cdt.debug.mi"</code>). - */ - public static final String PLUGIN_ID = MIPlugin.getUniqueIdentifier(); - - /** - * Preference key for default MI request timeout value. - */ - public static final String PREF_REQUEST_TIMEOUT = PLUGIN_ID + ".PREF_REQUEST_TIMEOUT"; //$NON-NLS-1$ - - /** - * Preference key for default MI launch request timeout value. - */ - public static final String PREF_REQUEST_LAUNCH_TIMEOUT = PLUGIN_ID + ".PREF_REQUEST_LAUNCH_TIMEOUT"; //$NON-NLS-1$ - - /** - * The default MI request timeout when no preference is set. - */ - public static final int DEF_REQUEST_LAUNCH_TIMEOUT = 30000; - - /** - * The default MI request timeout when no preference is set. - */ - public static final int DEF_REQUEST_TIMEOUT = 10000; - - /** - * The minimum value the MI request timeout can have. - */ - public static final int MIN_REQUEST_TIMEOUT = 100; - - /** - * The maximum value the MI request timeout can have. - */ - public static final int MAX_REQUEST_TIMEOUT = Integer.MAX_VALUE; - - /** - * Boolean preference controlling whether the shared library manager will be - * refreshed every time when the execution of program stops. - */ - public static final String PREF_SHARED_LIBRARIES_AUTO_REFRESH = PLUGIN_ID + ".SharedLibraries.auto_refresh"; //$NON-NLS-1$ - - /** - * The default value of the for <code>PREF_SHARED_LIBRARIES_AUTO_REFRESH</code> property - */ - public static final boolean DEF_PREF_SHARED_LIBRARIES_AUTO_REFRESH = true; -} - diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/IMILaunchConfigurationConstants.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/IMILaunchConfigurationConstants.java deleted file mode 100644 index 0a0561a0bde..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/IMILaunchConfigurationConstants.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2010 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core; - -public interface IMILaunchConfigurationConstants { - /** - * Launch configuration attribute key. The value is the name of - * the Debuger associated with a C/C++ launch configuration. - */ - public static final String ATTR_DEBUG_NAME = MIPlugin.getUniqueIdentifier() + ".DEBUG_NAME"; //$NON-NLS-1$ - - /** - * Launch configuration attribute key. Boolean value to set the gdb command file - * Debuger/gdb/MI property. - */ - public static final String ATTR_GDB_INIT = MIPlugin.getUniqueIdentifier() + ".GDB_INIT"; //$NON-NLS-1$ - - /** - * Launch configuration attribute key. Boolean value to set the 'automatically load shared library symbols' flag of the debugger. - */ - public static final String ATTR_DEBUGGER_AUTO_SOLIB = MIPlugin.getUniqueIdentifier() + ".AUTO_SOLIB"; //$NON-NLS-1$ - - /** - * Launch configuration attribute key. Boolean value to set the 'stop on shared library events' flag of the debugger. - */ - public static final String ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS = MIPlugin.getUniqueIdentifier() + ".STOP_ON_SOLIB_EVENTS"; //$NON-NLS-1$ - - /** - * Launch configuration attribute key. The value is a List (array of String) of directories for the search path of shared libraries. - */ - public static final String ATTR_DEBUGGER_SOLIB_PATH = MIPlugin.getUniqueIdentifier() + ".SOLIB_PATH"; //$NON-NLS-1$ - - /** - * Launch configuration attribute key. The value is a List (array of String) of shared libraries to load symbols automatically. - */ - public static final String ATTR_DEBUGGER_AUTO_SOLIB_LIST = MIPlugin.getUniqueIdentifier() + ".AUTO_SOLIB_LIST"; //$NON-NLS-1$ - - /** - * Launch configuration attribute value. The key is ATTR_DEBUG_NAME. - */ - public static final String DEBUGGER_DEBUG_NAME_DEFAULT = "gdb"; //$NON-NLS-1$ - - /** - * Launch configuration attribute value. The key is ATTR_GDB_INIT. - */ - public static final String DEBUGGER_GDB_INIT_DEFAULT = ".gdbinit"; //$NON-NLS-1$ - - /** - * Launch configuration attribute value. The key is ATTR_DEBUGGER_AUTO_SOLIB. - */ - public static final boolean DEBUGGER_AUTO_SOLIB_DEFAULT = true; - - /** - * Launch configuration attribute value. The key is ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS. - */ - public static final boolean DEBUGGER_STOP_ON_SOLIB_EVENTS_DEFAULT = false; - - /** - * Launch configuration attribute key. The value is a string specifying the identifier of the command factory to use. - */ - public static final String ATTR_DEBUGGER_COMMAND_FACTORY = MIPlugin.getUniqueIdentifier() + ".commandFactory"; //$NON-NLS-1$ - - /** - * Launch configuration attribute key. The value is a string specifying the protocol to - * use. For now only "mi", "mi1", "m2", "mi3" are supported. - */ - public static final String ATTR_DEBUGGER_PROTOCOL = MIPlugin.getUniqueIdentifier() + ".protocol"; //$NON-NLS-1$ - - /** - * Launch configuration attribute key. The value is a boolean specifying the mode of the gdb console. - */ - public static final String ATTR_DEBUGGER_VERBOSE_MODE = MIPlugin.getUniqueIdentifier() + ".verboseMode"; //$NON-NLS-1$ - - /** - * Launch configuration attribute value. The key is ATTR_DEBUGGER_VERBOSE_MODE. - */ - public static final boolean DEBUGGER_VERBOSE_MODE_DEFAULT = false; - /** - * Launch configuration attribute key. The value is a boolean specifying is debugger should use full pathname to set breakpoints. - */ - public static final String ATTR_DEBUGGER_FULLPATH_BREAKPOINTS = MIPlugin.getUniqueIdentifier() + ".breakpointsFullPath"; //$NON-NLS-1$ - - /** - * Launch configuration default attribute value. The key is ATTR_DEBUGGER_FULLPATH_BREAKPOINTS. - * To see why this default is FALSE, see bug 176636 - */ - public static final boolean DEBUGGER_FULLPATH_BREAKPOINTS_DEFAULT = false; -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MICoreUtils.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MICoreUtils.java deleted file mode 100644 index 14e5d9d252a..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MICoreUtils.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core; - -import java.io.File; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.ILaunchConfiguration; - -/** - * Utility methods. - */ -public class MICoreUtils { - - public static File[] getAutoSolibs( ILaunchConfiguration configuration ) throws CoreException { - List autoSolibs = configuration.getAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB_LIST, Collections.EMPTY_LIST ); - List list = new ArrayList( autoSolibs.size() ); - Iterator it = autoSolibs.iterator(); - while( it.hasNext() ) { - list.add( new File( (String)it.next() ) ); - } - return (File[])list.toArray( new File[list.size()] ); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPlugin.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPlugin.java deleted file mode 100644 index 1541c7121b7..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPlugin.java +++ /dev/null @@ -1,642 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2013 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import com.ibm.icu.text.MessageFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -import org.eclipse.cdt.debug.core.CDebugCorePlugin; -import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; -import org.eclipse.cdt.debug.core.ICDebugConfiguration; -import org.eclipse.cdt.debug.core.ICDebugConstants; -import org.eclipse.cdt.debug.mi.core.cdi.Session; -import org.eclipse.cdt.debug.mi.core.command.CLITargetAttach; -import org.eclipse.cdt.debug.mi.core.command.CommandFactory; -import org.eclipse.cdt.debug.mi.core.command.MIStackListFrames; -import org.eclipse.cdt.debug.mi.core.command.MITargetSelect; -import org.eclipse.cdt.debug.mi.core.command.factories.CommandFactoryManager; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.cdt.utils.pty.PTY; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Plugin; -import org.eclipse.core.runtime.Preferences; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.osgi.framework.BundleContext; - -/** - * GDB/MI Plugin. - */ -public class MIPlugin extends Plugin { - - /** - * The plug-in identifier of the Java core support - * (value <code>"org.eclipse.jdt.core"</code>). - */ - public static final String PLUGIN_ID = "org.eclipse.cdt.debug.mi.core" ; //$NON-NLS-1$ - - /** - * Simple identifier constant (value <code>"commandFactories"</code>) - * for the "gdb/mi command factories" extension point. - * - * @since 3.1 - */ - public static final String EXTENSION_POINT_COMMAND_FACTORIES = "commandFactories"; //$NON-NLS-1$ - - //The shared instance. - private static MIPlugin plugin; - - // GDB command - private static final String GDB = "gdb"; //$NON-NLS-1$ - - private static final int INTERNAL_ERROR = 42; - - /** - * Has tracing for this plug-in been turned on? - * @since 7.0 - */ - public static final boolean DEBUG = "true".equals( //$NON-NLS-1$ - Platform.getDebugOption("org.eclipse.cdt.debug.mi.core/debug")); //$NON-NLS-1$ - /** - * The singleton command factory manager. - */ - private CommandFactoryManager fCommandFactoryManager; - - private static ResourceBundle fgResourceBundle; - static { - try { - fgResourceBundle = ResourceBundle.getBundle("org.eclipse.cdt.debug.mi.core.MIPluginResources"); //$NON-NLS-1$ - } catch (MissingResourceException x) { - fgResourceBundle = null; - } - } - /** - * The constructor - * @see org.eclipse.core.runtime.Plugin#Plugin() - */ - public MIPlugin() { - super(); - plugin = this; - } - - /** - * Returns the singleton. - */ - public static MIPlugin getDefault() { - return plugin; - } - - /** - * Method createMISession. - * @param Process - * @param PTY - * @param int - * @param int - * @throws MIException - * @return MISession - * - * @deprecated - */ - @Deprecated - public MISession createMISession(MIProcess process, IMITTY pty, int timeout, int type, int launchTimeout, String miVersion, IProgressMonitor monitor) throws MIException { - return new MISession(process, pty, type, timeout, launchTimeout, miVersion, monitor); - } - - /** - * Method createMISession. - * @param Process - * @param PTY - * @param type - * @throws MIException - * @return MISession - * - * @deprecated - */ - @Deprecated - public MISession createMISession(MIProcess process, IMITTY pty, int type, String miVersion, IProgressMonitor monitor) throws MIException { - MIPlugin miPlugin = getDefault(); - Preferences prefs = miPlugin.getPluginPreferences(); - int timeout = prefs.getInt(IMIConstants.PREF_REQUEST_TIMEOUT); - int launchTimeout = prefs.getInt(IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT); - return createMISession(process, pty, timeout, type, launchTimeout, miVersion, monitor); - } - - private MISession createMISession0(int type, MIProcess process, CommandFactory commandFactory, IMITTY pty, int timeout) throws MIException { - return new MISession(process, pty, type, commandFactory, timeout); - } - - /** - * Method createCSession; Create an new PTY instance and launch gdb in mi for local debug. - * - * @param program - * @return ICDISession - * @throws MIException - * - * @deprecated use <code>createSession</code> - */ - @Deprecated - public Session createCSession(String gdb, String miVersion, File program, File cwd, String gdbinit, IProgressMonitor monitor) throws IOException, MIException { - IMITTY pty = null; - boolean failed = false; - - try { - PTY pseudo = new PTY(); - pseudo.validateSlaveName(); - pty = new MITTYAdapter(pseudo); - } catch (IOException e) { - // Should we not print/log this ? - } - - try { - return createCSession(gdb, miVersion, program, cwd, gdbinit, pty, monitor); - } catch (IOException exc) { - failed = true; - throw exc; - } catch (MIException exc) { - failed = true; - throw exc; - } finally { - if (failed) { - // Shutdown the pty console. - if (pty != null) { - try { - OutputStream out = pty.getOutputStream(); - if (out != null) { - out.close(); - } - InputStream in = pty.getInputStream(); - if (in != null) { - in.close(); - } - } catch (IOException e) { - } - } - } - } - } - - /** - * Method createCSession; lauch gdb in mi mode for local debugging - * @param program - * @return ICDISession - * @throws IOException - * - * @deprecated use <code>createSession</code> - */ - @Deprecated - public Session createCSession(String gdb, String miVersion, File program, File cwd, String gdbinit, IMITTY pty, IProgressMonitor monitor) throws IOException, MIException { - if (gdb == null || gdb.length() == 0) { - gdb = GDB; - } - - String commandFile = (gdbinit != null && gdbinit.length() > 0) ? "--command="+gdbinit : "--nx"; //$NON-NLS-1$ //$NON-NLS-2$ - - if (monitor == null) { - monitor = new NullProgressMonitor(); - } - - String[] args; - if (pty != null) { - if (program == null) { - args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), commandFile, "-q", "-nw", "-tty", pty.getSlaveName(), "-i", miVersion}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - } else { - args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), commandFile, "-q", "-nw", "-tty", pty.getSlaveName(), "-i", miVersion, program.getAbsolutePath()}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - } - } else { - if (program == null) { - args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), commandFile, "-q", "-nw", "-i", miVersion}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - } else { - args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), commandFile, "-q", "-nw", "-i", miVersion, program.getAbsolutePath()}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - } - } - - int launchTimeout = MIPlugin.getDefault().getPluginPreferences().getInt(IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT); - MIProcess pgdb = new MIProcessAdapter(args, launchTimeout, monitor); - - if (MIPlugin.DEBUG) { - StringBuffer sb = new StringBuffer(); - for (int i = 0; i < args.length; ++i) { - sb.append(args[i]); - sb.append(' '); - } - MIPlugin.getDefault().debugLog(sb.toString()); - } - - MISession session; - try { - session = createMISession(pgdb, pty, MISession.PROGRAM, miVersion, monitor); - } catch (MIException e) { - pgdb.destroy(); - throw e; - } - // Try to detect if we have been attach/connected via "target remote localhost:port" - // or "attach" and set the state to be suspended. - try { - CommandFactory factory = session.getCommandFactory(); - MIStackListFrames frames = factory.createMIStackListFrames(); - session.postCommand(frames); - MIInfo info = frames.getMIInfo(); - if (info == null) { - pgdb.destroy(); - throw new MIException(getResourceString("src.common.No_answer")); //$NON-NLS-1$ - } - //@@@ We have to manually set the suspended state since we have some stackframes - session.getMIInferior().setSuspended(); - session.getMIInferior().update(); - } catch (MIException e) { - // If an exception is thrown that means ok - // we did not attach/connect to any target. - } - return new Session(session, false); - } - - /** - * Method createCSession; Post mortem debug with a core file. - * @param program - * @param core - * @return ICDISession - * @throws IOException - * - * @deprecated use <code>createSession</code> - */ - @Deprecated - public Session createCSession(String gdb, String miVersion, File program, File core, File cwd, String gdbinit, IProgressMonitor monitor) throws IOException, MIException { - if (gdb == null || gdb.length() == 0) { - gdb = GDB; - } - - String commandFile = (gdbinit != null && gdbinit.length() > 0) ? "--command="+gdbinit : "--nx"; //$NON-NLS-1$ //$NON-NLS-2$ - - if (monitor == null) { - monitor = new NullProgressMonitor(); - } - - String[] args; - if (program == null) { - args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), commandFile, "--quiet", "-nw", "-i", miVersion, "-c", core.getAbsolutePath()}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - } else { - args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), commandFile, "--quiet", "-nw", "-i", miVersion, "-c", core.getAbsolutePath(), program.getAbsolutePath()}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - } - - int launchTimeout = MIPlugin.getDefault().getPluginPreferences().getInt(IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT); - MIProcess pgdb = new MIProcessAdapter(args, launchTimeout, monitor); - - if (MIPlugin.DEBUG) { - StringBuffer sb = new StringBuffer(); - for (int i = 0; i < args.length; ++i) { - sb.append(args[i]); - sb.append(' '); - } - MIPlugin.getDefault().debugLog(sb.toString()); - } - - MISession session; - try { - session = createMISession(pgdb, null, MISession.CORE, miVersion, monitor); - //@@@ We have to manually set the suspended state when doing post-mortem - session.getMIInferior().setSuspended(); - } catch (MIException e) { - pgdb.destroy(); - throw e; - } - return new Session(session); - } - - /** - * Method createCSession; remote debuging by selectin a target. - * @param program - * @param pid - * @return ICDISession - * @throws IOException - * - * @deprecated use <code>createSession</code> - */ - @Deprecated - public Session createCSession(String gdb, String miVersion, File program, int pid, String[] targetParams, File cwd, String gdbinit, IProgressMonitor monitor) throws IOException, MIException { - if (gdb == null || gdb.length() == 0) { - gdb = GDB; - } - - String commandFile = (gdbinit != null && gdbinit.length() > 0) ? "--command="+gdbinit : "--nx"; //$NON-NLS-1$ //$NON-NLS-2$ - - if (monitor == null) { - monitor = new NullProgressMonitor(); - } - - String[] args; - if (program == null) { - args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), commandFile, "--quiet", "-nw", "-i", miVersion}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - } else { - args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), commandFile, "--quiet", "-nw", "-i", miVersion, program.getAbsolutePath()}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - } - - int launchTimeout = MIPlugin.getDefault().getPluginPreferences().getInt(IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT); - MIProcess pgdb = new MIProcessAdapter(args, launchTimeout, monitor); - - if (MIPlugin.getDefault().isDebugging()) { - StringBuffer sb = new StringBuffer(); - for (int i = 0; i < args.length; ++i) { - sb.append(args[i]); - sb.append(' '); - } - MIPlugin.getDefault().debugLog(sb.toString()); - } - - MISession session; - try { - session = createMISession(pgdb, null, MISession.ATTACH, miVersion, monitor); - } catch (MIException e) { - pgdb.destroy(); - throw e; - } - CommandFactory factory = session.getCommandFactory(); - try { - if (targetParams != null && targetParams.length > 0) { - MITargetSelect target = factory.createMITargetSelect(targetParams); - session.postCommand(target); - MIInfo info = target.getMIInfo(); - if (info == null) { - throw new MIException(getResourceString("src.common.No_answer")); //$NON-NLS-1$ - } - } - if (pid > 0) { - CLITargetAttach attach = factory.createCLITargetAttach(pid); - session.postCommand(attach); - MIInfo info = attach.getMIInfo(); - if (info == null) { - throw new MIException(getResourceString("src.common.No_answer")); //$NON-NLS-1$ - } - session.getMIInferior().setInferiorPID(pid); - // @@@ for attach we nee to manually set the connected state - // attach does not send the ^connected ack - session.getMIInferior().setConnected(); - } - } catch (MIException e) { - if(session != null) - session.terminate(); - - pgdb.destroy(); - throw e; - } - //@@@ We have to manually set the suspended state when we attach - session.getMIInferior().setSuspended(); - session.getMIInferior().update(); - return new Session(session, true); - } - - /** - * Starts a process by executing the following command: - * gdb -q -nw -i <mi_version>(extracted from the command factory) - * -tty<pty_name> (if <code>usePTY</code> is <code>true</code>) - * extraArgs program (if <code>program</code> is not <code>null</code>) - * - * @param sessionType the type of debugging session: - * <code>MISession.PROGRAM</code>, - * <code>MISession.ATTACH</code> - * or <code>MISession.CORE</code> - * @param gdb the name of the gdb file - * @param factory the command set supported by gdb - * @param program a program to debug or <code>null</code> - * @param extraArgs arguments to pass to gdb - * @param usePty whether to use pty or not - * @param monitor a progress monitor - * @return an instance of <code>ICDISession</code> - * @throws IOException - * @throws MIException - */ - public Session createSession(int sessionType, String gdb, CommandFactory factory, File program, String[] extraArgs, boolean usePty, IProgressMonitor monitor) throws IOException, MIException { - if (monitor == null) { - monitor = new NullProgressMonitor(); - } - - if (gdb == null || gdb.length() == 0) { - gdb = GDB; - } - - IMITTY pty = null; - - if (usePty) { - try { - PTY pseudo = new PTY(); - pseudo.validateSlaveName(); - pty = new MITTYAdapter(pseudo); - } catch (IOException e) { - // Should we not print/log this ? - } - } - - ArrayList argList = new ArrayList(extraArgs.length + 8); - argList.add(gdb); - argList.add("-q"); //$NON-NLS-1$ - argList.add("-nw"); //$NON-NLS-1$ - argList.add("-i"); //$NON-NLS-1$ - argList.add(factory.getMIVersion()); - if (pty != null) { - argList.add("-tty"); //$NON-NLS-1$ - argList.add(pty.getSlaveName()); - } - argList.addAll(Arrays.asList(extraArgs)); - if (program != null) { - argList.add(program.getAbsolutePath()); - } - String[] args = (String[])argList.toArray(new String[argList.size()]); - int launchTimeout = MIPlugin.getDefault().getPluginPreferences().getInt(IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT); - - MISession miSession = null; - MIProcess pgdb = null; - boolean failed = false; - try { - pgdb = factory.createMIProcess(args, launchTimeout, monitor); - - if (MIPlugin.DEBUG) { - StringBuffer sb = new StringBuffer(); - for (int i = 0; i < args.length; ++i) { - sb.append(args[i]); - sb.append(' '); - } - MIPlugin.getDefault().debugLog(sb.toString()); - } - - miSession = createMISession0(sessionType, pgdb, factory, pty, getCommandTimeout()); - } catch (MIException e) { - failed = true; - throw e; - } catch(IOException e ) { - failed = true; - throw e; - } finally { - if (failed) { - // Kill gdb - if ( pgdb != null ) - pgdb.destroy(); - // Shutdown the pty console. - if (pty != null) { - try { - OutputStream out = pty.getOutputStream(); - if (out != null) { - out.close(); - } - InputStream in = pty.getInputStream(); - if (in != null) { - in.close(); - } - } catch (IOException e) { - } - } - } - } - - return new Session(miSession); - } - - /** - * Convenience method which returns the unique identifier of this plugin. - */ - public static String getUniqueIdentifier() { - return PLUGIN_ID; - } - - public void debugLog(String message) { - if (getDefault().isDebugging()) { - // Time stamp - message = MessageFormat.format( "[{0}] {1}", new Object[] { new Long( System.currentTimeMillis() ), message } ); //$NON-NLS-1$ - // This is to verbose for a log file, better use the console. - // getDefault().getLog().log(StatusUtil.newStatus(Status.ERROR, message, null)); - // ALERT:FIXME: For example for big buffers say 4k length, - // the console will simply blows taking down eclipse. - // This seems only to happen in Eclipse-gtk and Eclipse-motif - // on GNU/Linux, so we break the lines in smaller chunks. - while (message.length() > 100) { - String partial = message.substring(0, 100); - message = message.substring(100); - System.out.println(partial + "\\"); //$NON-NLS-1$ - } - if (message.endsWith("\n")) { //$NON-NLS-1$ - System.out.print(message); - } else { - System.out.println(message); - } - } - } - public static String getResourceString(String key) { - try { - return fgResourceBundle.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } catch (NullPointerException e) { - return '#' + key + '#'; - } - } - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.Plugin#startup() - */ - @Override - public void start(BundleContext context) throws Exception { - super.start(context); - ICDebugConfiguration dc = CDebugCorePlugin.getDefault().getDefaultDefaultDebugConfiguration(); - if (dc == null) { - CDebugCorePlugin.getDefault().getPluginPreferences().setDefault(ICDebugConstants.PREF_DEFAULT_DEBUGGER_TYPE, "org.eclipse.cdt.debug.mi.core.CDebuggerNew"); //$NON-NLS-1$ - } - } - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.Plugin#shutdown() - */ - @Override - public void stop(BundleContext context) throws Exception { - savePluginPreferences(); - super.stop(context); - } - - public static int getCommandTimeout() { - Preferences prefs = getDefault().getPluginPreferences(); - return prefs.getInt(IMIConstants.PREF_REQUEST_TIMEOUT); - } - - public static int getLaunchTimeout() { - Preferences prefs = plugin.getPluginPreferences(); - return prefs.getInt(IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT); - } - - public static String getMIVersion( ILaunchConfiguration config ) { - String miVersion = ""; //$NON-NLS-1$ - try { - miVersion = config.getAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, "" ); //$NON-NLS-1$ - } - catch( CoreException e ) { - } - if ( miVersion.length() == 0 ) { - try { - miVersion = config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, "mi" ); //$NON-NLS-1$ - } - catch( CoreException e ) { - miVersion = "mi"; //$NON-NLS-1$ - } - } - return miVersion; - } - - public static String getCommandFactory( ILaunchConfiguration config ) { - String commandFactory = ""; //$NON-NLS-1$ - try { - commandFactory = config.getAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_COMMAND_FACTORY, "" ); //$NON-NLS-1$ - } - catch( CoreException e ) { - } - return commandFactory; - } - - public CommandFactoryManager getCommandFactoryManager() { - if ( fCommandFactoryManager == null ) { - fCommandFactoryManager = new CommandFactoryManager(); - } - return fCommandFactoryManager; - } - - /** - * Log internal error - * @param string - error message - */ - public static void log(String string) { - log(new Status( IStatus.ERROR, getUniqueIdentifier(), string)); - } - /** - * 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 throwable - * - * @param e - * the exception to be logged - */ - public static void log( Throwable e ) { - log( new Status( IStatus.ERROR, getUniqueIdentifier(), INTERNAL_ERROR, "Internal Error", e ) ); //$NON-NLS-1$ - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPluginResources.properties b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPluginResources.properties deleted file mode 100644 index 969a465e6c3..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPluginResources.properties +++ /dev/null @@ -1,39 +0,0 @@ -############################################################################### -# Copyright (c) 2003, 2006 QNX Software Systems and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# QNX Software Systems - initial API and implementation -############################################################################### - -src.common.No_answer=No answer -src.GDBCDIDebugger2.0=Unable to get pid. -src.GDBCDIDebugger2.1=Invalid pid. -src.GDBCDIDebugger2.2=Attach to process {0} failed. -src.GDBServerDebugger.Error_initializing=Error initializing: -src.GDBServerDebugger.Can_not_set_Baud=Can not set Baud -src.GDBServerDebugger.GDBServer_attaching_unsupported=GDBServer does not support attaching -src.GDBServerDebugger.GDBServer_corefiles_unsupported=GDBServer does not support core files -src.GDBServerCDIDebugger.target_selection_failed=Target selection failed. -src.GDBDebugger.Error_initializing_shared_lib_options=Error initializing shared library options: -src.GDBDebugger.Error_creating_session=Error creating session: -src.GDBDebugger.Error_launch_timeout=Launch timeout -src.GDBDebugger.Error_launch_cancel=Launch cancel -src.GDBDebugger.Debugger_process=Debugger Process -src.MISession.Process_Terminated=Process Terminated -src.MISession.Thread_Terminated={R,T}xThread terminated -src.MISession.Target_not_suspended=Target is not suspended -src.MISession.Session_terminated=Session terminated -src.MISession.Inferior_Terminated=Inferior terminated -src.MISession.Target_not_responding=Target is not responding (timed out) -src.CygwinGDBDebugger.Error_init_shared_lib_options=Error initializing shared library options: -src.MIInferior.target_is_suspended=target is suspended -src.MIInferior.No_session=No MI Session -src.MIInferior.Failed_to_interrupt=Failed to interrupt - -src.AbstractGDBCDIDebugger.0=Invalid session type: -src.AbstractGDBCDIDebugger.1=Error creating session -src.AbstractGDBCDIDebugger.2=Debugger Process diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPreferenceInitializer.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPreferenceInitializer.java deleted file mode 100644 index 99171b0e22f..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPreferenceInitializer.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.mi.core; - -import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; - -public class MIPreferenceInitializer extends AbstractPreferenceInitializer { - - /** - * Constructor for MIPreferenceInitializer. - */ - public MIPreferenceInitializer() { - super(); - } - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() - */ - @Override - public void initializeDefaultPreferences() { - MIPlugin.getDefault().getPluginPreferences().setDefault(IMIConstants.PREF_REQUEST_TIMEOUT, IMIConstants.DEF_REQUEST_TIMEOUT); - MIPlugin.getDefault().getPluginPreferences().setDefault(IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT, IMIConstants.DEF_REQUEST_LAUNCH_TIMEOUT); - MIPlugin.getDefault().getPluginPreferences().setDefault(IMIConstants.PREF_SHARED_LIBRARIES_AUTO_REFRESH, IMIConstants.DEF_PREF_SHARED_LIBRARIES_AUTO_REFRESH); - } -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIProcessAdapter.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIProcessAdapter.java deleted file mode 100644 index 6c13d5a38ec..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIProcessAdapter.java +++ /dev/null @@ -1,212 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.PushbackInputStream; - -import org.eclipse.cdt.utils.spawner.ProcessFactory; -import org.eclipse.cdt.utils.spawner.Spawner; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; - -/** - */ -public class MIProcessAdapter implements MIProcess { - - Process fGDBProcess; - InputStream gdbInputStream; - private static final int ONE_SECOND = 1000; - private long commandTimeout; - - public MIProcessAdapter(String[] args, IProgressMonitor monitor) throws IOException { - this(args, 0, monitor); - } - - public MIProcessAdapter(String[] args, int launchTimeout, IProgressMonitor monitor) throws IOException { - fGDBProcess = getGDBProcess(args, launchTimeout, monitor); - commandTimeout = MIPlugin.getCommandTimeout(); - } - - /** - * Do some basic synchronisation, gdb may take some time to load for - * whatever reasons and we need to be able to let the user bailout. - * - * @param args - * @return Process - * @throws IOException - */ - protected Process getGDBProcess(String[] args, int launchTimeout, IProgressMonitor monitor) throws IOException { - final Process pgdb = createGDBProcess(args); - Thread syncStartup = new Thread("GDB Start") { //$NON-NLS-1$ - @Override - public void run() { - try { - PushbackInputStream pb = new PushbackInputStream(pgdb.getInputStream()); - gdbInputStream = pb; - pb.unread(pb.read()); // actually read something, then return it - } catch (Exception e) { - // Do nothing, ignore the errors - } - } - }; - syncStartup.start(); - - int timepass = 0; - if (launchTimeout <= 0) { - // Simulate we are waiting forever. - launchTimeout = Integer.MAX_VALUE; - } - - // To respect the IProgressMonitor we can not use wait/notify - // instead we have to loop and check for the monitor to allow to cancel the thread. - // The monitor is check every 1 second delay; - for (timepass = 0; timepass < launchTimeout; timepass += ONE_SECOND) { - if (syncStartup.isAlive() && !monitor.isCanceled()) { - try { - Thread.sleep(ONE_SECOND); - } catch (InterruptedException e) { - // ignore - } - } else { - break; - } - } - try { - syncStartup.interrupt(); - syncStartup.join(ONE_SECOND); - } catch (InterruptedException e) { - // ignore - } - if (monitor.isCanceled()) { - pgdb.destroy(); - throw new OperationCanceledException(); - } else if (timepass >= launchTimeout) { - pgdb.destroy(); - String message = MIPlugin.getResourceString("src.GDBDebugger.Error_launch_timeout"); //$NON-NLS-1$ - throw new IOException(message); - } - return pgdb; - } - - /** - * Basic process creation hook. Subclasses may override to create the process some other way, - * for example by setting the child process's environment. - * - * @param args - * the <tt>gdb</tt> command-line - * @return the <tt>gdb</tt> process - * @throws IOException - * on failure to create the child process - * - * @since 7.0 - */ - protected Process createGDBProcess(String[] args) throws IOException { - return ProcessFactory.getFactory().exec(args); - } - - @Override - public boolean canInterrupt(MIInferior inferior) { - return fGDBProcess instanceof Spawner; - } - - @Override - public void interrupt(MIInferior inferior) { - if (fGDBProcess instanceof Spawner) { - if (inferior.isRunning()) { - Spawner gdbSpawner = (Spawner) fGDBProcess; - if (inferior.isAttachedInferior() && !inferior.isRemoteInferior()) { - // not all gdb versions forward the interrupt to an attached - // local inferior, so interrupt the inferior directly - interruptInferior(inferior); - } - else { - // standard case (gdb launches process) and remote case (gdbserver) - gdbSpawner.interrupt(); - } - waitForInterrupt(inferior); - } - } - } - - protected boolean waitForInterrupt(MIInferior inferior) { - synchronized (inferior) { - // Allow MI command timeout for the interrupt to propagate. - long maxSec = commandTimeout / ONE_SECOND + 1; - for (int i = 0; inferior.isRunning() && i < maxSec; i++) { - try { - inferior.wait(ONE_SECOND); - } catch (InterruptedException e) { - } - } - return inferior.isRunning(); - } - } - - /** - * Send an interrupt to the inferior process. - * - * @param inferior - */ - protected void interruptInferior(MIInferior inferior) { - if (fGDBProcess instanceof Spawner) { - Spawner gdbSpawner = (Spawner) fGDBProcess; - gdbSpawner.raise(inferior.getInferiorPID(), gdbSpawner.INT); - } - } - - @Override - public int exitValue() { - return fGDBProcess.exitValue(); - } - - @Override - public int waitFor() throws InterruptedException { - return fGDBProcess.waitFor(); - } - - @Override - public void destroy() { - // We are responsible for closing the streams we have used or else - // we will leak pipes. - // Bug 345164 - try { - getErrorStream().close(); - } catch (IOException e) {} - try { - getInputStream().close(); - } catch (IOException e) {} - try { - getOutputStream().close(); - } catch (IOException e) {} - - fGDBProcess.destroy(); - } - - @Override - public InputStream getErrorStream() { - return fGDBProcess.getErrorStream(); - } - - @Override - public InputStream getInputStream() { - return gdbInputStream; - } - - @Override - public OutputStream getOutputStream() { - return fGDBProcess.getOutputStream(); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MITTYAdapter.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MITTYAdapter.java deleted file mode 100644 index 6d48143988a..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MITTYAdapter.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.mi.core; - -import java.io.InputStream; -import java.io.OutputStream; - -import org.eclipse.cdt.utils.pty.PTY; - -/** - * Adapt the PTY code to IMITTY - * - */ -public class MITTYAdapter implements IMITTY { - - PTY fPty; - - public MITTYAdapter(PTY pty) { - fPty = pty; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.core.IMITTY#getSlaveName() - */ - @Override - public String getSlaveName() { - return fPty.getSlaveName(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.core.IMITTY#getOutputStream() - */ - @Override - public OutputStream getOutputStream() { - return fPty.getOutputStream(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.mi.core.IMITTY#getInputStream() - */ - @Override - public InputStream getInputStream() { - return fPty.getInputStream(); - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MinGWDebugger.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MinGWDebugger.java deleted file mode 100644 index ac493ce9f70..00000000000 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MinGWDebugger.java +++ /dev/null @@ -1,21 +0,0 @@ -/********************************************************************** - * Copyright (c) 2007 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - **********************************************************************/ - -package org.eclipse.cdt.debug.mi.core; - - -/** - * @author Doug Schaefer - * - */ -public class MinGWDebugger extends GDBCDIDebugger2 { - -} |